kernel32: Replace Peb->BeingDebugged check by CheckRemoteDebuggerPresent().

misctool.dll from AmiBroker intentionally sets PEB->BeingDebugged
to a random value returned by RDTSC instruction on PROCESS_ATTACH.

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Dmitry Timoshkov 2017-02-10 17:21:32 +01:00 committed by Alexandre Julliard
parent 7c10daf2db
commit 8de06f12dd
2 changed files with 6 additions and 1 deletions

View File

@ -1085,6 +1085,7 @@ static inline DWORD call_process_entry( PEB *peb, LPTHREAD_START_ROUTINE entry )
*/
static DWORD WINAPI start_process( LPTHREAD_START_ROUTINE entry )
{
BOOL being_debugged;
PEB *peb = NtCurrentTeb()->Peb;
if (!entry)
@ -1098,8 +1099,11 @@ static DWORD WINAPI start_process( LPTHREAD_START_ROUTINE entry )
DPRINTF( "%04x:Starting process %s (entryproc=%p)\n", GetCurrentThreadId(),
debugstr_w(peb->ProcessParameters->ImagePathName.Buffer), entry );
if (!CheckRemoteDebuggerPresent( GetCurrentProcess(), &being_debugged ))
being_debugged = FALSE;
SetLastError( 0 ); /* clear error code */
if (peb->BeingDebugged) DbgBreakPoint();
if (being_debugged) DbgBreakPoint();
return call_process_entry( peb, entry );
}

View File

@ -1737,6 +1737,7 @@ WINBASEAPI BOOL WINAPI CancelTimerQueueTimer(HANDLE,HANDLE);
WINBASEAPI BOOL WINAPI CancelWaitableTimer(HANDLE);
WINBASEAPI BOOL WINAPI CheckNameLegalDOS8Dot3A(const char*,char*,DWORD,BOOL*,BOOL*);
WINBASEAPI BOOL WINAPI CheckNameLegalDOS8Dot3W(const WCHAR*, char*,DWORD,BOOL*,BOOL*);
WINBASEAPI BOOL WINAPI CheckRemoteDebuggerPresent(HANDLE,BOOL*);
WINBASEAPI BOOL WINAPI ChangeTimerQueueTimer(HANDLE,HANDLE,ULONG,ULONG);
WINADVAPI BOOL WINAPI CheckTokenMembership(HANDLE,PSID,PBOOL);
WINBASEAPI BOOL WINAPI ClearCommBreak(HANDLE);