I am trying to dump a process, say calc.exe
When I run my program I get
Program received signal SIGSEGV, Segmentation fault.
0x0000000000401640 in MiniDumpWriteDump ()
Here is the code
#include <windows.h>
#include <dbghelp.h>
int main(){
HANDLE hFile = CreateFileA(
"calc.dmp",
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL
);
DWORD procID = 196;
HANDLE hProc = OpenProcess(
PROCESS_ALL_ACCESS,
FALSE,
procID
);
MiniDumpWriteDump(
hProc,
procID,
hFile,
MiniDumpNormal,
NULL,
NULL,
NULL
);
CloseHandle(hFile);
}