I'm writing a sample code for creating a process memory dump using the MiniDumpWriteDump API. The call works fine with the MiniDumpNormal type but not with the MiniDumpWithFullMemory type.
Here's the code sample:
int main()
{
LPCWSTR lPath = L"C:\\Users\\x\\Desktop\\test.dmp";
HANDLE hFile = CreateFile(lPath, GENERIC_WRITE, NULL, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, false, 10164);
ShowErr();
MiniDumpWriteDump(hProcess,
10164,
hFile,
MiniDumpWithFullMemory,
NULL,
NULL,
NULL);
}
I'm opening the process with PROCESS_ALL_ACCESS successfully and the MiniDumpWriteDump fails with error code 0x57 (The parameter is incorrect). It's worth noting that a dump file is created anyway but it does not look valid.