The MASM Forum

Miscellaneous => The Orphanage => Topic started by: Magnum on November 27, 2012, 04:15:30 AM

Title: Infinite loop wanted (for real :-)
Post by: Magnum on November 27, 2012, 04:15:30 AM
Does Olly trap this infinite loop automatically ?
I even used jnz.

invoke IsDebuggerPresent ; running in the context of a debugger, the return value is nonzero

jz      short continue_initialization_1

jmp     short infinite_loop_1


infinite_loop_1:
   
jmp infinite_loop_1

continue_initialization_1:

---------------------------------------------

Title: Re: Infinite loop wanted (for real :-)
Post by: qWord on November 27, 2012, 04:22:34 AM
Once started, Olly runs an application until an exception occurs or you paused it.
Also, it is not specified whether IsDebuggerPresent (or any other API) set or clear the zero flag ;-)
Title: Re: Infinite loop wanted (for real :-)
Post by: dedndave on November 27, 2012, 04:23:48 AM
invoke IsDebuggerPresent ; running in the context of a debugger, the return value is nonzero
test eax,eax

infinite_loop_1:
jnz infinite_loop_1
Title: Re: Infinite loop wanted (for real :-)
Post by: Magnum on November 27, 2012, 06:39:04 AM
Thanks, the prog works but I am confused.

EAX has zero when run under Olly ?

Title: Re: Infinite loop wanted (for real :-)
Post by: dedndave on November 27, 2012, 01:47:51 PM
i just went by your comment   :P
Quoteinvoke IsDebuggerPresent ; running in the context of a debugger, the return value is nonzero

here is the MSDN doc...
QuoteReturn value

If the current process is running in the context of a debugger, the return value is nonzero.

If the current process is not running in the context of a debugger, the return value is zero.
Title: Re: Infinite loop wanted (for real :-)
Post by: Tedd on November 28, 2012, 02:19:10 AM
The call to IsDebuggerPresent is easily patched to always return false; it could even be considered standard practice.

Stop wasting your time ::)
Title: Re: Infinite loop wanted (for real :-)
Post by: ragdog on November 28, 2012, 05:15:53 AM
Right Tedd

IsDebuggerPresent is only an api the get the BeingDebuged from the Peb