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) ...@@ -402,6 +402,11 @@ BOOL WINAPI IsDebuggerPresent(void)
*/ */
BOOL WINAPI CheckRemoteDebuggerPresent(HANDLE process, PBOOL DebuggerPresent) BOOL WINAPI CheckRemoteDebuggerPresent(HANDLE process, PBOOL DebuggerPresent)
{ {
if(!process || !DebuggerPresent)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
FIXME("(%p)->(%p): Stub!\n", process, DebuggerPresent); FIXME("(%p)->(%p): Stub!\n", process, DebuggerPresent);
*DebuggerPresent = FALSE; *DebuggerPresent = FALSE;
return TRUE; return TRUE;
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
static int myARGC; static int myARGC;
static char** myARGV; static char** myARGV;
static BOOL (WINAPI *pCheckRemoteDebuggerPresent)(HANDLE,PBOOL);
static BOOL (WINAPI *pDebugActiveProcessStop)(DWORD); static BOOL (WINAPI *pDebugActiveProcessStop)(DWORD);
static BOOL (WINAPI *pDebugSetProcessKillOnExit)(BOOL); static BOOL (WINAPI *pDebugSetProcessKillOnExit)(BOOL);
...@@ -431,11 +432,42 @@ static void test_ExitCode(void) ...@@ -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) START_TEST(debugger)
{ {
HMODULE hdll; HMODULE hdll;
hdll=GetModuleHandle("kernel32.dll"); hdll=GetModuleHandle("kernel32.dll");
pCheckRemoteDebuggerPresent=(void*)GetProcAddress(hdll, "CheckRemoteDebuggerPresent");
pDebugActiveProcessStop=(void*)GetProcAddress(hdll, "DebugActiveProcessStop"); pDebugActiveProcessStop=(void*)GetProcAddress(hdll, "DebugActiveProcessStop");
pDebugSetProcessKillOnExit=(void*)GetProcAddress(hdll, "DebugSetProcessKillOnExit"); pDebugSetProcessKillOnExit=(void*)GetProcAddress(hdll, "DebugSetProcessKillOnExit");
...@@ -451,5 +483,6 @@ START_TEST(debugger) ...@@ -451,5 +483,6 @@ START_TEST(debugger)
else else
{ {
test_ExitCode(); 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