Manko
April 18th, 2003, 03:28
(This is DS 2.7, but probably easy to apply to other versions with some small amount of work...)
The old patch of altering slightly the name, to make sice fail to set BP on it, has one major drawback... The irritating errormessage that floods softicewindow...
So I thought to find where in code it prints that string...
It turned out to be much simpler to find a way to make it not patch in the first place, or in my case to let it think it had patched...
Finding the string "kernel32!UnhandledExceptionFilter" in NTice.sys is simpel...
We need to disassemble Ntice.sys to find references too it...
...and here they are:
So, we'll just look at the place the adress get stored, to find more interesting procs...
We're gonna look at "some_ckeckUHEFpatched"
As you see, we can easily make it believe it already has a BP set.
(remember to repair any changes you have done earlier to the UnhandledexcptFltr-string you might have done earlier.)
Just patch it!
I patched 75 0e to 75 00. But feel free to deal with this in any way you please! (And DO explore if you get the urge.)
Also, if you do changes to a .sys, remember to recalculate checksum.
It's working GREAT for me!
Best of luck to ya'll!
/Manko
I hate scrolling sideways
Woodmann
The old patch of altering slightly the name, to make sice fail to set BP on it, has one major drawback... The irritating errormessage that floods softicewindow...
So I thought to find where in code it prints that string...
It turned out to be much simpler to find a way to make it not patch in the first place, or in my case to let it think it had patched...

Finding the string "kernel32!UnhandledExceptionFilter" in NTice.sys is simpel...
We need to disassemble Ntice.sys to find references too it...
...and here they are:
Code:
.text:0005DF8C 6B 65 72 6E 65 6C 33 32 21+aKernel32Unhand db 'kernel32!UnhandledExceptionFilter',0
.text:0005DF8C 55 6E 68 61 6E 64 6C 65 64+ ; DATA XREF: Get_UnhandledExceptionFilter_Adress+1Do
.text:0005DF8C 45 78 63 65 70 74 69 6F 6E+ ; Get_UnhandledExceptionFilter_Adress+3Ao
.text:0005DFAE
.text:0005DFAE
; ŚŚŚŚŚŚŚŚŚŚŚŚŚŚŚ S U B R O U T I N E ŚŚŚŚŚŚŚŚŚŚŚŚŚŚŚŚŚŚŚŚŚŚŚŚŚŚŚŚŚŚŚŚŚŚŚŚŚŚŚ
.text:0005DFAE
.text:0005DFAE
.text:0005DFAE Get_UnhandledExceptionFilter_Adress proc near
.text:0005DFAE 60 ; CODE XREF: sub_4CC4E+2Cp
.text:0005DFAE pusha
.text:0005DFAF 83 3D C5 EC 0E 00 00 cmp UnhandledExceptionFilter_Address, 0
.text:0005DFB6 75 2E jnz short loc_5DFE6
.text:0005DFB8 B8 22 DA 0E 00 mov eax, offset aKernel32 ; "Kernel32"
.text:0005DFBD E8 46 96 FF FF call sub_57608
.text:0005DFC2 0B C0 or eax, eax
.text:0005DFC4 74 20 jz short loc_5DFE6
.text:0005DFC6 A3 C9 EC 0E 00 mov baseofKernel32,
eax
.text:0005DFCB BE 8C DF 05 00 mov esi, offset aKernel32Unhand ; "kernel32!UnhandledExceptionFilter"
.text:0005DFD0 E8 D1 98 FD FF call sub_378A6
.text:0005DFD5 72 11 jb short loc_5DFE8
.text:0005DFD7 3D 00 00 10 00 cmp eax, 100000h
.text:0005DFDC 72 08 jb short loc_5DFE6
.text:0005DFDE 8B F8 mov edi, eax
.text:0005DFE0 89 3D C5 EC 0E 00 mov UnhandledExceptionFilter_Address, edi
.text:0005DFE6
.text:0005DFE6 loc_5DFE6: ; CODE XREF: Get_UnhandledExceptionFilter_Adress+8j
.text:0005DFE6 61 ; Get_UnhandledExceptionFilter_Adress+16j
.text:0005DFE6 ; Get_UnhandledExceptionFilter_Adress+2Ej
.text:0005DFE6 ; Get_UnhandledExceptionFilter_Adress+44j
.text:0005DFE6 popa
.text:0005DFE7 C3 retn
.text:0005DFE8 ; ---------------------------------------------------------------------------
.text:0005DFE8
.text:0005DFE8 loc_5DFE8: ; CODE XREF: Get_UnhandledExceptionFilter_Adress+27j
.text:0005DFE8 BE 8C DF 05 00 mov esi, offset aKernel32Unhand ; "kernel32!UnhandledExceptionFilter"
.text:0005DFED E8 E8 EA FD FF call sub_3CADA
.text:0005DFF2 EB F2 jmp short loc_5DFE6
.text:0005DFF2 Get_UnhandledExceptionFilter_Adress endp
So, we'll just look at the place the adress get stored, to find more interesting procs...
Code:
.data:000EECC5 00 00 00 00 UnhandledExceptionFilter_Address dd 0 ; DATA XREF: Get_UnhandledExceptionFilter_Adress+1r
.data:000EECC5 ; Get_UnhandledExceptionFilter_Adress+32w
.data:000EECC5 ; some_ckeckUHEFpatchedr
.data:000EECC5 ; containsUHEFaddr_plusleadstorellatedprocs+Fr
.data:000EECC5 ; Unhandledexceptfltr_BP_reached+4r
We're gonna look at "some_ckeckUHEFpatched"
Code:
.text:0005DFF4 some_ckeckUHEFpatched proc near ; CODE XREF: CChere_UHEFpatchedflaghere_leadsto_checkUHEFpatched+11p
.text:0005DFF4 8B 3D C5 EC 0E 00 ; contains_UHEFpatchedflag_leadsto_checkUHEFpatched+15p
.text:0005DFF4 mov edi, UnhandledExceptionFilter_Address
.text:0005DFFA 0B FF or edi, edi
.text:0005DFFC 74 72 jz short locret_5E070
.text:0005DFFE 0A D2 or dl, dl ; Contains CC or original first byte of UHEF
.text:0005E000 74 6E jz short locret_5E070
.text:0005E002 80 3D 07 6E 0E 00 00 cmp byte_E6E07, 0
.text:0005E009 74 65 jz short locret_5E070
.text:0005E00B E8 7D ED FF FF call sub_5CD8D
.text:0005E010 A1 C9 EC 0E 00 mov eax, baseofKernel32
.text:0005E015 8B DF mov ebx, edi ; edi contains UnhandledExceptionFilter_Address.
.text:0005E017 E8 69 96 FF FF call sub_57685
.text:0005E01C 80 3D CD EC 0E 00 00 cmp Original_first_byte_of_UHEF, 0
.text:0005E023 75 24 jnz short loc_5E049
.text:0005E025 E8 0A 8D FD FF call here_it_gets_originalUHEFfirstbyte
.text:0005E02A 72 3F jb short loc_5E06B
.text:0005E02C A2 CD EC 0E 00 mov Original_first_byte_of_UHEF, al
.text:0005E031 3C 55 cmp al, 55h
.text:0005E033 74 14 jz short loc_5E049
.text:0005E035 3C 8B cmp al, 8Bh
.text:0005E037 74 10 jz short loc_5E049
.text:0005E039 3C 68 cmp al, 68h
.text:0005E03B 74 0C jz short loc_5E049
.text:0005E03D 56 push esi
.text:0005E03E BE C1 ED 0E 00 mov esi, offset aNticeUnrecogni ; "NTICE: *** Unrecognized unhandled excep"...
.text:0005E043 E8 CA B5 FF FF call sub_59612
.text:0005E048 5E pop esi
.text:0005E049
.text:0005E049 loc_5E049: ; CODE XREF: some_ckeckUHEFpatched+2Fj
.text:0005E049 8A C2 ; some_ckeckUHEFpatched+3Fj
.text:0005E049 ; some_ckeckUHEFpatched+43j
.text:0005E049 ; some_ckeckUHEFpatched+47j
.text:0005E049 mov al, dl
.text:0005E04B E8 F2 8D FD FF call sub_36E42
.text:0005E050 72 19 jb short loc_5E06B
.text:0005E052 C6 05 CE EC 0E 00 00 mov is_UHEF_BP_set, 0
.text:0005E059 3C CC cmp al, 0CCh
.text:0005E05B 75 0E jnz short loc_5E06B ; We want the "is_UHEF_BP_set" flag to BE set,
.text:0005E05B ; so maybe we just force it not to jump.
.text:0005E05D C6 05 CE EC 0E 00 01 mov is_UHEF_BP_set, 1
.text:0005E064 C6 05 CF EC 0E 00 00 mov byte_EECCF, 0
.text:0005E06B
.text:0005E06B loc_5E06B: ; CODE XREF: some_ckeckUHEFpatched+36j
.text:0005E06B E8 44 ED FF FF ; some_ckeckUHEFpatched+5Cj
.text:0005E06B ; some_ckeckUHEFpatched+67j
.text:0005E06B call sub_5CDB4
.text:0005E070
.text:0005E070 locret_5E070: ; CODE XREF: some_ckeckUHEFpatched+8j
.text:0005E070 C3 ; some_ckeckUHEFpatched+Cj
.text:0005E070 ; some_ckeckUHEFpatched+15j
.text:0005E070 retn
.text:0005E070 some_ckeckUHEFpatched endp
As you see, we can easily make it believe it already has a BP set.

(remember to repair any changes you have done earlier to the UnhandledexcptFltr-string you might have done earlier.)
Just patch it!
I patched 75 0e to 75 00. But feel free to deal with this in any way you please! (And DO explore if you get the urge.)
Also, if you do changes to a .sys, remember to recalculate checksum.

It's working GREAT for me!

Best of luck to ya'll!
/Manko
I hate scrolling sideways
