kernel32: Check parameter of CheckRemoteDebuggerPresent with tests.

This commit is contained in:
Stefan Leichter 2009-09-27 10:10:41 +02:00 committed by Alexandre Julliard
parent d1099eb4d8
commit 2c576e88b4
2 changed files with 38 additions and 0 deletions

View File

@ -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;

View File

@ -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();
}
}