Собственно до меня не доходит почему BSOD с 0C0000005h. Код (Text): format PE DLL native 4.0 at 10000h entry DriverEntry include 'macro/struct.inc' include 'macro/proc32.inc' include 'KMD/KMD.inc' section '.text' code readable executable notpageable proc DriverEntry lpDriverObject, lpusRegistryPath cinvoke DbgPrint, szTest, 10 mov [eax + DRIVER_OBJECT.DriverUnload], DriverUnload mov eax, STATUS_SUCCESS ret endp proc DriverUnload lpDriverObject ret endp section '.data' data readable writeable notpageable szTest db 'Test value: %d', 0 section '.rdata' data readable notpageable IAT ntoskrnl,\ DbgPrint section 'INIT' import code discardable executable readable writeable library ntoskrnl,'ntoskrnl.exe' import ntoskrnl,\ DbgPrint,'DbgPrint' section '.reloc' fixups data readable discardable если szTest = 'Hello', и cinvoke DbgPrint, szTest, то всё работает. листинг в IDA норма: Код (Text): .text:00010240 push ebp .text:00010241 mov ebp, esp .text:00010243 push 0Ah .text:00010245 push offset Format ; "Test value: %d" .text:0001024A call ds:DbgPrint .text:00010250 add esp, 8 .text:00010253 mov dword ptr [eax+34h], offset sub_10263 .text:0001025A mov eax, 0 .text:0001025F leave .text:00010260 retn 8 Что такое? :\
у меня такой работает Код (Text): format PE native 4.0 at 10000h entry DriverEntry include '%fasminc%\MACRO\PROC32.INC' STATUS_UNSUCCESSFUL = 0C0000001h section '.text' code readable executable notpageable DriverEntry: ; pDriverObject:PDRIVER_OBJECT, pusRegistryPath:PUNICODE_STRING ; int3 cinvoke DbgPrint, sz cli mov eax, cr4 ; push eax ; cinvoke DbgPrint, format_string, eax ; pop eax or eax, 04h ; set ; push eax ; cinvoke DbgPrint, format_string, eax ; pop eax mov cr4, eax ; mov eax, cr4 ; and eax, not 04h ; reset ; push eax ; cinvoke DbgPrint, format_string, eax ; pop eax ; mov cr4, eax sti mov eax, STATUS_UNSUCCESSFUL ; драйвер будет сразу выгружен retn 2*4 section '.rdata' data readable notpageable ntoskrnl_import_address_table: DbgPrint dd rva _DbgPrint dd 0 ; section '.data' data readable writeable notpageable format_string db "cr4: %08lX",0Dh,0Ah,0 sz db "Entered the Driver Entry",0Dh,0Ah,0 section 'INIT' import code readable writeable executable discardable dd rva ntoskrnl_import_lookup_table,0,0,rva ntoskrnl_name,rva ntoskrnl_import_address_table dd 0,0,0,0,0 ntoskrnl_import_lookup_table: dd rva _DbgPrint dd 0 _DbgPrint dw 0 db 'DbgPrint',0 ntoskrnl_name db "ntoskrnl.exe",0 section '.reloc' data fixups readable discardable