Why do these yield different results? Aren't these supposed to do the same thing? Or do I need to do a malloc() to create the structure prior to calling the function when I just declare a pointer for it like this (for the second failing one)?
modinfo=(MODULEINFO*)malloc(sizeof(MODULEINFO));
Succeeds:
MODULEINFO modinfo;
GetModuleInformation(hProc,modules[x],&modinfo,sizeof(MODULEINFO));
//address variables using modinfo.property
Fails:
MODULEINFO *modinfo;
GetModuleInformation(hProc,modules[x],modinfo,sizeof(MODULEINFO));
//address variables using modinfo->property
Prototype of the function:
BOOL GetModuleInformation(
HANDLE hProcess,
HMODULE hModule,
LPMODULEINFO lpmodinfo,
DWORD cb
);
Function info:
http://msdn.microsoft.com/library/defau...s/perfmon/base/getmodulefilenameex.asp
Edit: sorry, I just answered my own question I think. I needed to do the malloc/free.
modinfo=(MODULEINFO*)malloc(sizeof(MODULEINFO));
Succeeds:
MODULEINFO modinfo;
GetModuleInformation(hProc,modules[x],&modinfo,sizeof(MODULEINFO));
//address variables using modinfo.property
Fails:
MODULEINFO *modinfo;
GetModuleInformation(hProc,modules[x],modinfo,sizeof(MODULEINFO));
//address variables using modinfo->property
Prototype of the function:
BOOL GetModuleInformation(
HANDLE hProcess,
HMODULE hModule,
LPMODULEINFO lpmodinfo,
DWORD cb
);
Function info:
http://msdn.microsoft.com/library/defau...s/perfmon/base/getmodulefilenameex.asp
Edit: sorry, I just answered my own question I think. I needed to do the malloc/free.