Partager via


Generate a Dump File from a Process (Compact 7)

3/12/2014

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

To generate a dump file from a process

  1. Include Windows Embedded Compact Error Reporting in your OS design. For more information, see Include Error Reporting in the OS.

  2. Call CaptureDumpFileOnDevice from your code. See the following code example.

Example

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);
          OutputDebugString(pBuffer);
     }

     ZeroMemory(pBuffer, MAX_PATH);
     return dwLastError;
}

See Also

Tasks

Generate a Dump File Automatically
Generate a Dump File from a Handled Exception
Capture a Dump File While Debugging

Concepts

Generate Dump Files