Commit 2c576e88 authored by Stefan Leichter's avatar Stefan Leichter Committed by Alexandre Julliard

kernel32: Check parameter of CheckRemoteDebuggerPresent with tests.

parent d1099eb4
......@@ -402,6 +402,11 @@ BOOL WINAPI IsDebuggerPresent(void)
*/
BOOL WINAPI CheckRemoteDebuggerPresent(HANDLE process, PBOOL DebuggerPresent)
{
if(!process || !DebuggerPresent)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
FIXME("(%p)->(%p): Stub!\n", process, DebuggerPresent);
*DebuggerPresent = FALSE;
return TRUE;
......
......@@ -32,6 +32,7 @@
static int myARGC;
static char** myARGV;
static BOOL (WINAPI *pCheckRemoteDebuggerPresent)(HANDLE,PBOOL);
static BOOL (WINAPI *pDebugActiveProcessStop)(DWORD);
static BOOL (WINAPI *pDebugSetProcessKillOnExit)(BOOL);
......@@ -431,11 +432,42 @@ static void test_ExitCode(void)
}
}
static void test_RemoteDebugger(void)
{
BOOL bret, present;
if(!pCheckRemoteDebuggerPresent)
{
win_skip("CheckRemoteDebuggerPresent is not available\n");
return;
}
present = TRUE;
SetLastError(0xdeadbeef);
bret = pCheckRemoteDebuggerPresent(GetCurrentProcess(),&present);
ok(bret , "expected CheckRemoteDebuggerPresent to succeed\n");
ok(0xdeadbeef == GetLastError(),
"expected error to be unchanged, got %d/%x\n",GetLastError(), GetLastError());
present = TRUE;
SetLastError(0xdeadbeef);
bret = pCheckRemoteDebuggerPresent(NULL,&present);
ok(!bret , "expected CheckRemoteDebuggerPresent to fail\n");
ok(present, "expected parameter to be unchanged\n");
ok(ERROR_INVALID_PARAMETER == GetLastError(),
"expected error ERROR_INVALID_PARAMETER, got %d/%x\n",GetLastError(), GetLastError());
SetLastError(0xdeadbeef);
bret = pCheckRemoteDebuggerPresent(GetCurrentProcess(),NULL);
ok(!bret , "expected CheckRemoteDebuggerPresent to fail\n");
ok(ERROR_INVALID_PARAMETER == GetLastError(),
"expected error ERROR_INVALID_PARAMETER, got %d/%x\n",GetLastError(), GetLastError());
}
START_TEST(debugger)
{
HMODULE hdll;
hdll=GetModuleHandle("kernel32.dll");
pCheckRemoteDebuggerPresent=(void*)GetProcAddress(hdll, "CheckRemoteDebuggerPresent");
pDebugActiveProcessStop=(void*)GetProcAddress(hdll, "DebugActiveProcessStop");
pDebugSetProcessKillOnExit=(void*)GetProcAddress(hdll, "DebugSetProcessKillOnExit");
......@@ -451,5 +483,6 @@ START_TEST(debugger)
else
{
test_ExitCode();
test_RemoteDebugger();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment