Mega Code Archive

 
Categories / Delphi / Examples
 

Programın debug edilip edilmediği

function IsDebuggerAttached: boolean; var dw: integer; begin asm push eax // Preserve the registers push ecx mov eax, fs:[$18] // Get the TIB's linear address mov eax, dword ptr [eax + $30] mov ecx, dword ptr [eax] // Get the whole DWORD mov [dw], ecx // Save it pop ecx // Restore the registers pop eax end; // The 3rd byte is the byte we really need to check for the // presence of a debugger. // Check the 3rd byte result := (dw and $00010000 ) <>0; end; procedure TForm1.Button1Click(Sender: TObject); begin if IsDebuggerAttached then ShowMessage('Debugger') else ShowMessage('No Debugger'); end; Windows 95/98 üzerinde test edilmedi. dikkatli olun.