Export (0) Print
Expand All

Generating a Dump from a Watched Process

Other versions of this page are also available for the following:
Windows Mobile SupportedWindows Embedded CE Supported

To capture dump file information about a particular process or thread, use CaptureDumpFileOnDevice. This function causes a dump file to be generated when the watched process is invoked.

The following code example shows how to use CaptureDumpFileOnDevice:

CaptureDumpFileOnDevice(ProcessID, ThreadID, PathToExtraFilesToUpload); 
      // ProcessID = 0 for current process
      // ThreadID = 0 for current thread
      // PathToExtraFilesToUpload can be NULL

The following code example shows how to call CaptureDumpFileOnDevice from debugging code:

DWORD CaptureDump( DWORD dwTargetPID )
     // Generate a dump file for the process identified by dwTargetPID
     DWORD dwLastError = 0;
     wchar_t *pBuffer = (wchar_t *)calloc( MAX_PATH,sizeof( wchar_t ) );
     wsprintf( pBuffer, L"Capture Dump for PID %x\n",dwTargetPID );
     OutputDebugString( pBuffer );

     if (FALSE == CaptureDumpFileOnDevice(dwTargetPID, 0, NULL))
          dwLastError = GetLastError();
          wsprintf(pBuffer, L"CaptureDumpFileOnDevice Error: %d\n",dwLastError);

     ZeroMemory(pBuffer, MAX_PATH);
     return dwLastError;

Community Additions

© 2014 Microsoft