Application crash

%3CLINGO-SUB%20id%3D%22lingo-sub-2885142%22%20slang%3D%22en-US%22%3EApplication%20crash%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2885142%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20detoured%20%22OpenPrinterW%22%20API%20using%20detour%20library.%20In%20the%20detoured%26nbsp%3B%22OpenPrinterW%22%20API%20I%20have%20not%20done%20any%20processing%2C%20I%20have%20just%20called%20trampoline%20as%20follows.%20Whenever%20I%20try%20to%20print%20from%20%22Wordpad.exe%22%2C%20it%20crashes.%20When%20I%20try%20to%20print%20from%20Notepad%20or%20MSPaint%2C%20the%20explorer%20crashes%20as%20I%20think%20%22OpenPrinterW%22%20API%20in%20the%20context%20of%20explorer.%20Everything%20works%20fine%20in%20Windows%2010%2C%20Windows%208.1%2C%20Windows%208.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBOOL%20(WINAPI%20*Trampoline_OpenPrinterW)(LPWSTR%20pPrinterName%2CLPHANDLE%20phPrinter%2C%20LPPRINTER_DEFAULTSW%20pDefault)%20%3D%20OpenPrinterW%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBOOL%20WINAPI%20Detour_OpenPrinterW(LPWSTR%20pPrinterName%2C%20LPHANDLE%20phPrinter%2C%20LPPRINTER_DEFAULTSW%20pDefault)%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20return%20Trampoline_OpenPrinterW(%20pPrinterName%2C%20phPrinter%2C%20pDefault)%3B%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%2F%2F---------------%20Crash%20Details%20of%20Wordpad---------------------------------%3C%2FP%3E%3CP%3EFaulting%20application%20name%3A%20WORDPAD.EXE%2C%20version%3A%2010.0.22000.1%2C%20time%20stamp%3A%200xb930df5e%3CBR%20%2F%3EFaulting%20module%20name%3A%20RPCRT4.dll%2C%20version%3A%2010.0.22000.258%2C%20time%20stamp%3A%200xf73d999a%3CBR%20%2F%3EException%20code%3A%200xc0000409%3CBR%20%2F%3EFault%20offset%3A%200x0000000000072203%3CBR%20%2F%3EFaulting%20process%20id%3A%200x638%3CBR%20%2F%3EFaulting%20application%20start%20time%3A%200x01d7ca45dcb10bf2%3CBR%20%2F%3EFaulting%20application%20path%3A%20C%3A%5CProgram%20Files%5CWindows%20NT%5CAccessories%5CWORDPAD.EXE%3CBR%20%2F%3EFaulting%20module%20path%3A%20C%3A%5CWindows%5CSystem32%5CRPCRT4.dll%3CBR%20%2F%3EReport%20Id%3A%2086c12e6e-71c8-4e53-8d59-82eeee292c26%3CBR%20%2F%3EFaulting%20package%20full%20name%3A%3CBR%20%2F%3EFaulting%20package-relative%20application%20ID%3A%3C%2FP%3E%3CP%3E%2F%2F-----------------------------------------------------------------------------------%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

I have detoured "OpenPrinterW" API using detour library. In the detoured "OpenPrinterW" API I have not done any processing, I have just called trampoline as follows. Whenever I try to print from "Wordpad.exe", it crashes. When I try to print from Notepad or MSPaint, the explorer crashes as I think "OpenPrinterW" API in the context of explorer. Everything works fine in Windows 10, Windows 8.1, Windows 8.

 

BOOL (WINAPI *Trampoline_OpenPrinterW)(LPWSTR pPrinterName,LPHANDLE phPrinter, LPPRINTER_DEFAULTSW pDefault) = OpenPrinterW;

 

BOOL WINAPI Detour_OpenPrinterW(LPWSTR pPrinterName, LPHANDLE phPrinter, LPPRINTER_DEFAULTSW pDefault)
{
        return Trampoline_OpenPrinterW( pPrinterName, phPrinter, pDefault);
}

 

//--------------- Crash Details of Wordpad---------------------------------

Faulting application name: WORDPAD.EXE, version: 10.0.22000.1, time stamp: 0xb930df5e
Faulting module name: RPCRT4.dll, version: 10.0.22000.258, time stamp: 0xf73d999a
Exception code: 0xc0000409
Fault offset: 0x0000000000072203
Faulting process id: 0x638
Faulting application start time: 0x01d7ca45dcb10bf2
Faulting application path: C:\Program Files\Windows NT\Accessories\WORDPAD.EXE
Faulting module path: C:\Windows\System32\RPCRT4.dll
Report Id: 86c12e6e-71c8-4e53-8d59-82eeee292c26
Faulting package full name:
Faulting package-relative application ID:

//-----------------------------------------------------------------------------------

0 Replies