samjeba,
You are welcome.
As for the post being in the wrong forum: Actually i didn't notice this, else i would have made a remark. You see, we are working hard to check all topics and reorganizing the site.
So, keeping posting in the appropriate forums, would really help... ;)
For the time, i moved the topic to the "Newbies" Forum.
Now, as far as this method of detecting if you are running under a debugger, don't rely heavily on it. It's already well known ; besides, a call to IsDebuggerPresent API, executes _exactly_ the same code.
Also, this method is OS - dependent, because the PEB structure is not published / documented by Microsoft.
I guess it works on NT-based systems, but this may change in the future.
Anyway, here is a link that describes the PEB structure members...
http://undocumented.ntinternals.net/UserMo...rocess/PEB.htmlAs you can see, the code we are using in this example, checks the third member of the PEB structure: the BOOLEAN (byte) sized BeingDebugged.
If you are interested into anti-debugging, there are numerous methods to detect the presence of a ring-3 debugger...
For more information on the subject, check this link here:
http://www.openrce.org/reference_library/anti_reversingHappy studying!