   Problem parsing X-files
  I want to retrieve the data from an X-file.What I want to know is when I know the type of data how do I get the data. the documentation is poor.Here is the code:IDirectXFile *pDXFile = NULL;IDirectXFileEnumObject *pDXEnum = NULL;IDirectXFileData *pDXData = NULL;int nResult;if (FAILED(DirectXFileCreate(&pDXFile)))return -1;if (FAILED(pDXFile->RegisterTemplates((LPVOID)D3DRM_XTEMPLATES, D3DRM_XTEMPLATE_BYTES))){pDXFile->Release();return FALSE;}if (FAILED(pDXFile->CreateEnumObject((LPVOID)szFileName, DXFILELOAD_FROMFILE, &pDXEnum))){pDXFile->Release();return FALSE;}nResult = 1;while (SUCCEEDED(pDXEnum->GetNextDataObject(&pDXData)) && nResult){nResult = GetData(pDXData);pDXData->Release();pDXData = NULL;}pDXEnum->Release();pDXFile->Release();// ---------------------------------------int GetData(IDirectXFileData *pDXData){IDirectXFileObject *pDXObject = NULL;IDirectXFileDataReference *pDXReference = NULL;IDirectXFileData *pDXSubData = NULL;const GUID *Type = NULL;pDXData->GetType(&Type);if (*Type == TID_D3DRMMesh){// DOESNT GIVE CORRECT DATA!DWORD dwSize = 4;DWORD Buffer[16];memset(Buffer, 0, 16 * 4);pDXData->GetData(NULL, &dwSize, (void **)&Buffer);printf("Mesh\n");printf("%d\n", Buffer[0]);}while(SUCCEEDED(pDXData->GetNextObject(&pDXObject))){// Process embedded referencesif(SUCCEEDED(pDXObject->QueryInterface(IID_IDirectXFileDataReference, (void **)&pDXReference))){if(SUCCEEDED(pDXReference->Resolve(&pDXSubData))){GetData(pDXSubData);pDXSubData->Release();pDXSubData = NULL;}pDXReference->Release();pDXReference = NULL;}// Process non-referenced embedded templatesif(SUCCEEDED(pDXObject->QueryInterface(IID_IDirectXFileData, (void **)&pDXSubData))){GetData(pDXSubData);pDXSubData->Release();pDXSubData = NULL;}pDXObject->Release();pDXObject = NULL;}return 1;}