CoTaskMemAlloc...
C / C++ / MFC
1
Posts
1
Posters
0
Views
1
Watching
-
Does anyone know why there would be a problem using this on seemingly ONLY some XP systems? I guess it doesn't allocate the memory, and it returns NULL when I use it in: LPVOID pData = CoTaskMemAlloc(BufferSize); TRY { RegQueryValueEx(Sub3,"OBJECTS",NULL,&RegistrySize,(BYTE*)pData,&BufferSize); } CATCH(CException,e) { #ifdef _DEBUG MessageBoxes(3);//this is an error/exit function RegCloseKey(Sub3); #endif } END_CATCH In order to set the right size to BufferSize, I call it with NULL in place of the pData first. Is there a better way to do this, or a different function that works with XP consistently, or am I doing something wrong? halblonious