Alexandre Julliard : kernel32/tests: Added some tests for behavior of 64-bit kernel handles.
Alexandre Julliard
julliard at winehq.org
Mon Dec 8 09:46:28 CST 2008
Module: wine
Branch: master
Commit: 7749b6e2dd7c53776a076037f6fb410cdb3fccd8
URL: http://source.winehq.org/git/wine.git/?a=commit;h=7749b6e2dd7c53776a076037f6fb410cdb3fccd8
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Dec 8 13:39:31 2008 +0100
kernel32/tests: Added some tests for behavior of 64-bit kernel handles.
---
dlls/kernel32/tests/process.c | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c
index a01d91b..e5f5e7e 100644
--- a/dlls/kernel32/tests/process.c
+++ b/dlls/kernel32/tests/process.c
@@ -1520,6 +1520,36 @@ static void test_GetProcessVersion(void)
CloseHandle(pi.hThread);
}
+static void test_Handles(void)
+{
+ HANDLE handle = GetCurrentProcess();
+ BOOL ret;
+ DWORD code;
+
+ ok( handle == (HANDLE)~(ULONG_PTR)0, "invalid current process handle %p\n", handle );
+ ret = GetExitCodeProcess( handle, &code );
+ ok( ret, "GetExitCodeProcess failed err %u\n", GetLastError() );
+#ifdef _WIN64
+ /* truncated handle */
+ SetLastError( 0xdeadbeef );
+ handle = (HANDLE)((ULONG_PTR)handle & ~0u);
+ ret = GetExitCodeProcess( handle, &code );
+ ok( !ret, "GetExitCodeProcess succeeded for %p\n", handle );
+ ok( GetLastError() == ERROR_INVALID_HANDLE, "wrong error %u\n", GetLastError() );
+ /* sign-extended handle */
+ SetLastError( 0xdeadbeef );
+ handle = (HANDLE)((LONG_PTR)(int)(ULONG_PTR)handle);
+ ret = GetExitCodeProcess( handle, &code );
+ ok( ret, "GetExitCodeProcess failed err %u\n", GetLastError() );
+ /* invalid high-word */
+ SetLastError( 0xdeadbeef );
+ handle = (HANDLE)(((ULONG_PTR)handle & ~0u) + ((ULONG_PTR)1 << 32));
+ ret = GetExitCodeProcess( handle, &code );
+ ok( !ret, "GetExitCodeProcess succeeded for %p\n", handle );
+ ok( GetLastError() == ERROR_INVALID_HANDLE, "wrong error %u\n", GetLastError() );
+#endif
+}
+
START_TEST(process)
{
int b = init();
@@ -1541,6 +1571,7 @@ START_TEST(process)
test_ExitCode();
test_OpenProcess();
test_GetProcessVersion();
+ test_Handles();
/* things that can be tested:
* lookup: check the way program to be executed is searched
* handles: check the handle inheritance stuff (+sec options)
More information about the wine-cvs
mailing list