Click here to Skip to main content
15,887,821 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Minidamp files isn't created. Where mistake?
Function
C++
LONG __stdcall MyCustomFilter( EXCEPTION_POINTERS* pep ); 
void CreateMiniDump( EXCEPTION_POINTERS* pep ); 
 
LONG __stdcall MyCustomFilter( EXCEPTION_POINTERS* pep ) 
{
    CreateMiniDump( pep ); 
 
    return EXCEPTION_EXECUTE_HANDLER; 
};
 void CreateMiniDump( EXCEPTION_POINTERS* pep ) 
{
    // Open the file 
 
    HANDLE hFile = CreateFile( TEXT("C:\\MiniDump.dmp"), GENERIC_READ | GENERIC_WRITE, 
        0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL ); 
 
    if( ( hFile != NULL ) && ( hFile != INVALID_HANDLE_VALUE ) ) 
    {
        // Create the minidump 
 
        MINIDUMP_EXCEPTION_INFORMATION mdei; 
 
        mdei.ThreadId           = GetCurrentThreadId(); 
        mdei.ExceptionPointers  = pep; 
        mdei.ClientPointers     = FALSE; 
 
        MINIDUMP_TYPE mdt       = MiniDumpNormal; 
 
        BOOL rv = MiniDumpWriteDump( GetCurrentProcess(), GetCurrentProcessId(), 
            hFile, mdt, (pep != 0) ? &mdei : 0, 0, 0 ); 
 
        
 
        // Close the file 
 
        CloseHandle( hFile ); 
 
    }
}

and call function:
C++
case IDC_BUTTON3:
void CreateMiniDump();
Posted

you have no write right in "C:". Use a directory where you can write.

call GetLastError() if any error has occured ;-)
 
Share this answer
 
Thanks :) but the file is not created in the project folder too. Where there may be a problem?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900