diff --git a/apitests/CMakeLists.txt b/apitests/CMakeLists.txt index 4ac4b3027d2..1251a06a6ee 100644 --- a/apitests/CMakeLists.txt +++ b/apitests/CMakeLists.txt @@ -5,6 +5,7 @@ add_subdirectory(dciman32) add_subdirectory(gdi32) add_subdirectory(ntdll) add_subdirectory(user32) +add_subdirectory(kernel32) if(NOT MSVC) if(ARCH MATCHES i386) diff --git a/apitests/directory.rbuild b/apitests/directory.rbuild index 14446375bef..37c01c338be 100644 --- a/apitests/directory.rbuild +++ b/apitests/directory.rbuild @@ -21,6 +21,10 @@ + + + + diff --git a/apitests/kernel32/CMakeLists.txt b/apitests/kernel32/CMakeLists.txt new file mode 100644 index 00000000000..3fc8c865e62 --- /dev/null +++ b/apitests/kernel32/CMakeLists.txt @@ -0,0 +1,12 @@ + +add_definitions(-D_DLL -D__USE_CRTIMP) + +list(APPEND SOURCE + GetDriveType.c + testlist.c) + +add_executable(kernel32_apitest ${SOURCE}) +target_link_libraries(kernel32_apitest wine ${PSEH_LIB}) +set_module_type(kernel32_apitest win32cui) +add_importlibs(kernel32_apitest gdi32 user32 msvcrt kernel32 ntdll) +add_cab_target(kernel32_apitest 7) diff --git a/apitests/kernel32/GetDriveType.c b/apitests/kernel32/GetDriveType.c new file mode 100644 index 00000000000..010eb362de7 --- /dev/null +++ b/apitests/kernel32/GetDriveType.c @@ -0,0 +1,71 @@ +#include +#include +#include + +#define IS_DRIVE_TYPE_VALID(type) ((type) != DRIVE_UNKNOWN && (type) != DRIVE_NO_ROOT_DIR) + +START_TEST(GetDriveType) +{ + UINT Type, Type2, i; + WCHAR Path[MAX_PATH]; + + /* Note: Successful calls can set last error to at least ERROR_NOT_A_REPARSE_POINT, we don't test it here */ + SetLastError(0xdeadbeaf); + + Type = GetDriveTypeW(L""); + ok(Type == DRIVE_NO_ROOT_DIR, "Expected DRIVE_NO_ROOT_DIR, got %u\n", Type); + + Type = GetDriveTypeW(L"\nC:\\"); + ok(Type == DRIVE_NO_ROOT_DIR, "Expected DRIVE_NO_ROOT_DIR, got %u\n", Type); + + Type = GetDriveTypeW(L"Z:\\"); + ok(Type == DRIVE_NO_ROOT_DIR, "Expected DRIVE_NO_ROOT_DIR, got %u\n", Type); + + ok(GetLastError() == 0xdeadbeaf, "Expected no errors, got %lu\n", GetLastError()); + + /* Drive root is accepted without ending slash */ + Type = GetDriveTypeW(L"C:"); + ok(IS_DRIVE_TYPE_VALID(Type), "Expected valid drive type, got %u\n", Type); + + Type = GetDriveTypeW(L"C:\\"); + ok(IS_DRIVE_TYPE_VALID(Type), "Expected valid drive type, got %u\n", Type); + + Type = GetDriveTypeW(NULL); + ok(IS_DRIVE_TYPE_VALID(Type), "Expected valid drive type, got %u\n", Type); + + i = GetCurrentDirectoryW(sizeof(Path)/sizeof(Path[0]), Path); + if (i) + { + /* Note: there is no backslash at the end of Path */ + SetLastError(0xdeadbeaf); + Type2 = GetDriveTypeW(Path); + ok(Type2 == DRIVE_NO_ROOT_DIR, "Expected DRIVE_NO_ROOT_DIR, got %u\n", Type2); + ok(GetLastError() == 0xdeadbeaf, "Expected ERROR_NOT_A_REPARSE_POINT, got %lu\n", GetLastError()); + + wcscpy(Path+i, L"\\"); + Type2 = GetDriveTypeW(Path); + ok(Type == Type2, "Types are not equal: %u != %u\n", Type, Type2); + } + + i = GetSystemDirectoryW(Path, sizeof(Path)/sizeof(Path[0])); + if (i) + { + /* Note: there is no backslash at the end of Path */ + SetLastError(0xdeadbeaf); + Type = GetDriveTypeW(Path); + ok(Type == DRIVE_NO_ROOT_DIR, "Expected DRIVE_NO_ROOT_DIR, got %u\n", Type); + ok(GetLastError() == 0xdeadbeaf, "Expected no errors, got %lu\n", GetLastError()); + + wcscpy(Path+i, L"\\"); + Type = GetDriveTypeW(Path); + ok(IS_DRIVE_TYPE_VALID(Type), "Expected valid drive type, got %u\n", Type); + + wcscpy(Path+i, L"/"); + Type = GetDriveTypeW(Path); + ok(IS_DRIVE_TYPE_VALID(Type), "Expected valid drive type, got %u\n", Type); + + wcscpy(Path+i, L"\\\\"); + Type = GetDriveTypeW(Path); + ok(IS_DRIVE_TYPE_VALID(Type), "Expected valid drive type, got %u\n", Type); + } +} diff --git a/apitests/kernel32/kernel32_apitest.rbuild b/apitests/kernel32/kernel32_apitest.rbuild new file mode 100644 index 00000000000..81766be6722 --- /dev/null +++ b/apitests/kernel32/kernel32_apitest.rbuild @@ -0,0 +1,13 @@ + + + + + . + wine + ntdll + pseh + testlist.c + + GetDriveType.c + + diff --git a/apitests/kernel32/testlist.c b/apitests/kernel32/testlist.c new file mode 100644 index 00000000000..123e1ce2ea5 --- /dev/null +++ b/apitests/kernel32/testlist.c @@ -0,0 +1,16 @@ +#define WIN32_LEAN_AND_MEAN +#define __ROS_LONG64__ +#include + +#define STANDALONE +#include "wine/test.h" + +extern void func_GetDriveType(void); + +const struct test winetest_testlist[] = +{ + { "GetDriveType", func_GetDriveType }, + + { 0, 0 } +}; + diff --git a/apitests/user32/CMakeLists.txt b/apitests/user32/CMakeLists.txt index 9fc9374db52..f13bab460b0 100644 --- a/apitests/user32/CMakeLists.txt +++ b/apitests/user32/CMakeLists.txt @@ -1,15 +1,19 @@ add_definitions(-D_DLL -D__USE_CRTIMP) +set_rc_compiler() + list(APPEND SOURCE + DeferWindowPos.c + GetIconInfo.c + GetKeyState.c + GetPeekMessage.c + GetSystemMetrics.c InitializeLpkHooks.c RealGetWindowClass.c ScrollDC.c ScrollWindowEx.c - GetSystemMetrics.c - GetIconInfo.c - GetPeekMessage.c - DeferWindowPos.c + SetCursorPos.c testlist.c user32_apitest.rc) diff --git a/apitests/user32/GetKeyState.c b/apitests/user32/GetKeyState.c new file mode 100644 index 00000000000..759457675d5 --- /dev/null +++ b/apitests/user32/GetKeyState.c @@ -0,0 +1,137 @@ +/* + * PROJECT: ReactOS api tests + * LICENSE: GPL - See COPYING in the top level directory + * PURPOSE: Test for GetKeyState + * PROGRAMMERS: Giannis Adamopoulos + */ + +#include +#include +#include +#include + +HHOOK hKbdHook, hKbdLLHook; + + +LRESULT CALLBACK KeyboardProc(int code, WPARAM wParam, LPARAM lParam) +{ + BOOL pressed = !(lParam & (1<<31)); + BOOL altPressed = lParam & (1<<29); + + if(pressed) + { + ok(altPressed,"\n"); + ok((GetKeyState(VK_MENU) & 0x8000), "Alt should not be pressed\n");\ + ok((GetKeyState(VK_LMENU) & 0x8000), "Left alt should not be pressed\n");\ + } + else + { + ok(!altPressed,"\n"); + ok(!(GetKeyState(VK_MENU) & 0x8000), "Alt should be pressed\n"); + ok(!(GetKeyState(VK_LMENU) & 0x8000), "Left alt should be pressed\n"); + } + + return CallNextHookEx(hKbdHook, code, wParam, lParam); +} + +LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam) +{ + PKBDLLHOOKSTRUCT pLLHook = (PKBDLLHOOKSTRUCT)lParam; + + if(wParam == WM_SYSKEYDOWN) + { + ok(pLLHook->flags & LLKHF_ALTDOWN,"Didn't get LLKHF_ALTDOWN flag\n"); + ok((GetAsyncKeyState (VK_MENU) & 0x8000), "Alt should not be pressed in global kbd status\n"); + ok(!(GetKeyState(VK_MENU) & 0x8000), "Alt should not be pressed in queue state\n"); + ok(!(GetAsyncKeyState (VK_LMENU) & 0x8000), "Left alt should not be pressed in global kbd status\n"); + ok(!(GetKeyState(VK_LMENU) & 0x8000), "Left alt should not be pressed in queue state\n"); + } + else if(wParam == WM_SYSKEYUP) + { + ok(!(pLLHook->flags & LLKHF_ALTDOWN),"got LLKHF_ALTDOWN flag\n"); + ok(!(GetAsyncKeyState (VK_MENU) & 0x8000), "Alt should not be pressed in global kbd status\n"); + ok((GetKeyState(VK_MENU) & 0x8000), "Alt should be pressed in queue state\n"); + ok(!(GetAsyncKeyState (VK_LMENU) & 0x8000), "Left alt should not be pressed in global kbd status\n"); + ok((GetKeyState(VK_LMENU) & 0x8000), "Left alt should be pressed in queue state\n"); + } + + return CallNextHookEx(hKbdLLHook, nCode, wParam, lParam); +} + +static LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) +{ + if(msg == WM_SYSKEYDOWN) + { + ok(wParam == VK_MENU, "Got wrong wParam in WM_SYSKEYDOWN (%d instead of %d)\n", wParam, VK_MENU ); + } + return DefWindowProcA( hWnd, msg, wParam, lParam ); +} + +static HWND CreateTestWindow() +{ + MSG msg; + WNDCLASSA wclass; + HANDLE hInstance = GetModuleHandleA( NULL ); + HWND hWndTest; + + wclass.lpszClassName = "InputSysKeyTestClass"; + wclass.style = CS_HREDRAW | CS_VREDRAW; + wclass.lpfnWndProc = WndProc; + wclass.hInstance = hInstance; + wclass.hIcon = LoadIconA( 0, IDI_APPLICATION ); + wclass.hCursor = LoadCursorA( NULL, IDC_ARROW ); + wclass.hbrBackground = (HBRUSH)( COLOR_WINDOW + 1 ); + wclass.lpszMenuName = 0; + wclass.cbClsExtra = 0; + wclass.cbWndExtra = 0; + RegisterClassA( &wclass ); + /* create the test window that will receive the keystrokes */ + hWndTest = CreateWindowA( wclass.lpszClassName, "InputSysKeyTest", + WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, 100, 100, + NULL, NULL, hInstance, NULL); + assert( hWndTest ); + ShowWindow( hWndTest, SW_SHOW); + SetWindowPos( hWndTest, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE ); + SetForegroundWindow( hWndTest ); + UpdateWindow( hWndTest); + + /* flush pending messages */ + while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); + + return hWndTest; +} + +void Test_GetKeyState() +{ + HWND hwnd; + MSG msg; + + hwnd = CreateTestWindow(); + + hKbdHook = SetWindowsHookEx(WH_KEYBOARD, KeyboardProc, GetModuleHandleA( NULL ), 0); + hKbdLLHook = SetWindowsHookEx(WH_KEYBOARD_LL, LowLevelKeyboardProc, GetModuleHandleA( NULL ), 0); + + ok(hKbdHook!=NULL," \n"); + ok(hKbdLLHook!=NULL," \n"); + + keybd_event(VK_LMENU, 0, 0,0); + + while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); + + keybd_event(VK_LMENU, 0, KEYEVENTF_KEYUP,0); + + //fixme this hangs the test + //while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE|PM_NOYIELD )) DispatchMessageA( &msg ); + + DestroyWindow(hwnd); + + while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); + + UnhookWindowsHookEx (hKbdHook); + UnhookWindowsHookEx (hKbdLLHook); +} + +START_TEST(GetKeyState) +{ + Test_GetKeyState(); +} \ No newline at end of file diff --git a/apitests/user32/SetCursorPos.c b/apitests/user32/SetCursorPos.c new file mode 100644 index 00000000000..97970305fca --- /dev/null +++ b/apitests/user32/SetCursorPos.c @@ -0,0 +1,165 @@ +/* + * PROJECT: ReactOS api tests + * LICENSE: GPL - See COPYING in the top level directory + * PURPOSE: Test for SetCursorPos + * PROGRAMMERS: Giannis Adamopoulos + */ + +#include +#include +#include +#include + +HHOOK hMouseHookLL, hMouseHook; + +struct _test_info +{ + int ll_hook_called; + int hook_called; + int mouse_move_called; +}; + +struct _test_info info[] = { {0,0,0}, /* SetCursorPos without a window */ + {1,2,0}, /* mouse_event without a window */ + {0,1,1}, /* SetCursorPos with a window */ + {1,1,1}, /* mouse_event with a window */ + {0,1,1}, /* multiple SetCursorPos with a window with coalescing */ + {0,2,2}, /* multiple SetCursorPos with a window without coalescing */ + {2,1,1}, /* multiple mouse_event with a window with coalescing */ + {2,2,2}, /* multiple mouse_event with a window without coalescing */ + }; + +struct _test_info results[8]; +int test_no = 0; + + +LRESULT CALLBACK MouseLLHookProc(int nCode, WPARAM wParam, LPARAM lParam) +{ + results[test_no].ll_hook_called++; + return CallNextHookEx(hMouseHookLL, nCode, wParam, lParam); +} + +LRESULT CALLBACK MouseHookProc(int nCode, WPARAM wParam, LPARAM lParam) +{ + results[test_no].hook_called++; + return CallNextHookEx(hMouseHook, nCode, wParam, lParam); +} + +static LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) +{ + if(msg == WM_MOUSEMOVE) + results[test_no].mouse_move_called++; + + return DefWindowProcA( hWnd, msg, wParam, lParam ); +} + +static HWND CreateTestWindow() +{ + MSG msg; + WNDCLASSA wclass; + HANDLE hInstance = GetModuleHandleA( NULL ); + HWND hWndTest; + + wclass.lpszClassName = "MouseInputTestClass"; + wclass.style = CS_HREDRAW | CS_VREDRAW; + wclass.lpfnWndProc = WndProc; + wclass.hInstance = hInstance; + wclass.hIcon = LoadIconA( 0, IDI_APPLICATION ); + wclass.hCursor = LoadCursorA( NULL, IDC_ARROW ); + wclass.hbrBackground = (HBRUSH)( COLOR_WINDOW + 1 ); + wclass.lpszMenuName = 0; + wclass.cbClsExtra = 0; + wclass.cbWndExtra = 0; + RegisterClassA( &wclass ); + /* create the test window that will receive the keystrokes */ + hWndTest = CreateWindowA( wclass.lpszClassName, "MouseInputTestTest", + WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, 100, 100, + NULL, NULL, hInstance, NULL); + assert( hWndTest ); + ShowWindow( hWndTest, SW_SHOWMAXIMIZED); + SetWindowPos( hWndTest, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE ); + SetForegroundWindow( hWndTest ); + UpdateWindow( hWndTest); + SetFocus(hWndTest); + + /* flush pending messages */ + while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); + + return hWndTest; +} + +void Test_SetCursorPos() +{ + HWND hwnd; + MSG msg; + int i; + + memset(results, sizeof(results), 0); + + hMouseHookLL = SetWindowsHookEx(WH_MOUSE_LL, MouseLLHookProc, GetModuleHandleA( NULL ), 0); + hMouseHook = SetWindowsHookEx(WH_MOUSE, MouseHookProc, GetModuleHandleA( NULL ), 0); + ok(hMouseHook!=NULL,"failed to set hook\n"); + ok(hMouseHookLL!=NULL,"failed to set hook\n"); + + test_no = 0; + SetCursorPos(1,1); + while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); + + test_no = 1; + mouse_event(MOUSEEVENTF_MOVE, 2,2, 0,0); + while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); + + hwnd = CreateTestWindow(); + SetCapture(hwnd); + + test_no = 2; + SetCursorPos(50,50); + while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); + + test_no = 3; + mouse_event(MOUSEEVENTF_MOVE, 100,100, 0,0); + while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); + + test_no = 4; + SetCursorPos(50,50); + SetCursorPos(60,60); + while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); + + test_no = 5; + SetCursorPos(50,50); + while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); + SetCursorPos(60,60); + while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); + + test_no = 6; + mouse_event(MOUSEEVENTF_MOVE, 50,50, 0,0); + mouse_event(MOUSEEVENTF_MOVE, 60,60, 0,0); + while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); + + test_no = 7; + mouse_event(MOUSEEVENTF_MOVE, 50,50, 0,0); + while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); + mouse_event(MOUSEEVENTF_MOVE, 60,60, 0,0); + while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); + + for(i = 0; i< 8; i++) + { +#define TEST(s,x,y) ok(y == x, "%d: %s called %d times instead of %d\n",i,s, y,x); + TEST("WH_MOUSE_LL", info[i].ll_hook_called, results[i].ll_hook_called); + /* WH_MOUSE results vary greatly among windows versions */ + //TEST("WH_MOUSE", info[i].hook_called, results[i].hook_called); + TEST("WM_MOUSEMOVE", info[i].mouse_move_called, results[i].mouse_move_called); + } + + SetCapture(NULL); + DestroyWindow(hwnd); + + UnhookWindowsHookEx (hMouseHook); + UnhookWindowsHookEx (hMouseHookLL); + +} + +START_TEST(SetCursorPos) +{ + Test_SetCursorPos(); +} \ No newline at end of file diff --git a/apitests/user32/testlist.c b/apitests/user32/testlist.c index f89be66ed15..cb95521ee22 100644 --- a/apitests/user32/testlist.c +++ b/apitests/user32/testlist.c @@ -13,6 +13,8 @@ extern void func_GetSystemMetrics(void); extern void func_GetIconInfo(void); extern void func_GetPeekMessage(void); extern void func_DeferWindowPos(void); +extern void func_GetKeyState(void); +extern void func_SetCursorPos(void); const struct test winetest_testlist[] = { @@ -24,7 +26,8 @@ const struct test winetest_testlist[] = { "GetIconInfo", func_GetIconInfo }, { "GetPeekMessage", func_GetPeekMessage }, { "DeferWindowPos", func_DeferWindowPos }, - + { "GetKeyState", func_GetKeyState }, + { "SetCursorPos", func_SetCursorPos }, { 0, 0 } }; diff --git a/apitests/user32/user32_apitest.rbuild b/apitests/user32/user32_apitest.rbuild index 6f5489c31d2..e703e7905ca 100644 --- a/apitests/user32/user32_apitest.rbuild +++ b/apitests/user32/user32_apitest.rbuild @@ -10,6 +10,7 @@ testlist.c user32_apitest.rc + GetKeyState.c InitializeLpkHooks.c RealGetWindowClass.c ScrollDC.c @@ -18,6 +19,7 @@ GetIconInfo.c GetPeekMessage.c DeferWindowPos.c + SetCursorPos.c diff --git a/apitests/w32kdll/w32kdll_2k3sp2/CMakeLists.txt b/apitests/w32kdll/w32kdll_2k3sp2/CMakeLists.txt index ead3b82f1bf..57da80875a3 100644 --- a/apitests/w32kdll/w32kdll_2k3sp2/CMakeLists.txt +++ b/apitests/w32kdll/w32kdll_2k3sp2/CMakeLists.txt @@ -2,5 +2,5 @@ add_library(w32kdll_2k3sp2 SHARED main.c w32kdll_2k3sp2.S) set_entrypoint(w32kdll_2k3sp2 0) target_link_libraries(w32kdll_2k3sp2 ${CMAKE_CURRENT_SOURCE_DIR}/w32kdll_2k3sp2.def) -add_dependencies(w32kdll_2k3sp2 psdk buildno_header) +add_dependencies(w32kdll_2k3sp2 psdk ) add_importlib_target(w32kdll_2k3sp2.def) diff --git a/apitests/w32kdll/w32kdll_2ksp4/CMakeLists.txt b/apitests/w32kdll/w32kdll_2ksp4/CMakeLists.txt index efc4ec0ad68..66768eeef4d 100644 --- a/apitests/w32kdll/w32kdll_2ksp4/CMakeLists.txt +++ b/apitests/w32kdll/w32kdll_2ksp4/CMakeLists.txt @@ -2,5 +2,5 @@ add_library(w32kdll_2ksp4 SHARED main.c w32kdll_2ksp4.S) set_entrypoint(w32kdll_2ksp4 0) target_link_libraries(w32kdll_2ksp4 ${CMAKE_CURRENT_SOURCE_DIR}/w32kdll_2ksp4.def) -add_dependencies(w32kdll_2ksp4 psdk buildno_header) +add_dependencies(w32kdll_2ksp4 psdk ) add_importlib_target(w32kdll_2ksp4.def) diff --git a/apitests/w32kdll/w32kdll_ros/CMakeLists.txt b/apitests/w32kdll/w32kdll_ros/CMakeLists.txt index ad143fee275..c96fff8d796 100644 --- a/apitests/w32kdll/w32kdll_ros/CMakeLists.txt +++ b/apitests/w32kdll/w32kdll_ros/CMakeLists.txt @@ -7,5 +7,5 @@ target_link_libraries(w32kdll ${CMAKE_CURRENT_SOURCE_DIR}/w32kdll_ros.def win32ksys) -add_dependencies(w32kdll psdk buildno_header) +add_dependencies(w32kdll psdk ) add_importlib_target(w32kdll_ros.def) diff --git a/apitests/w32kdll/w32kdll_vista/CMakeLists.txt b/apitests/w32kdll/w32kdll_vista/CMakeLists.txt index 5c387435e80..a70bec57cf7 100644 --- a/apitests/w32kdll/w32kdll_vista/CMakeLists.txt +++ b/apitests/w32kdll/w32kdll_vista/CMakeLists.txt @@ -2,5 +2,5 @@ add_library(w32kdll_vista SHARED main.c w32kdll_vista.S) set_entrypoint(w32kdll_vista 0) target_link_libraries(w32kdll_vista ${CMAKE_CURRENT_SOURCE_DIR}/w32kdll_vista.def) -add_dependencies(w32kdll_vista psdk buildno_header) +add_dependencies(w32kdll_vista psdk ) add_importlib_target(w32kdll_vista.def) diff --git a/apitests/w32kdll/w32kdll_xpsp2/CMakeLists.txt b/apitests/w32kdll/w32kdll_xpsp2/CMakeLists.txt index 3f86810f2c6..e3579261dd4 100644 --- a/apitests/w32kdll/w32kdll_xpsp2/CMakeLists.txt +++ b/apitests/w32kdll/w32kdll_xpsp2/CMakeLists.txt @@ -2,5 +2,5 @@ add_library(w32kdll_xpsp2 SHARED main.c w32kdll_xpsp2.S) set_entrypoint(w32kdll_xpsp2 0) target_link_libraries(w32kdll_xpsp2 ${CMAKE_CURRENT_SOURCE_DIR}/w32kdll_xpsp2.def) -add_dependencies(w32kdll_xpsp2 psdk buildno_header) +add_dependencies(w32kdll_xpsp2 psdk ) add_importlib_target(w32kdll_xpsp2.def) diff --git a/apitests/w32knapi/CMakeLists.txt b/apitests/w32knapi/CMakeLists.txt index 21e1e5fd0c1..77dd4528800 100644 --- a/apitests/w32knapi/CMakeLists.txt +++ b/apitests/w32knapi/CMakeLists.txt @@ -1,6 +1,8 @@ add_definitions(-D_DLL -D__USE_CRTIMP) +set_rc_compiler() + list(APPEND SOURCE osver.c testlist.c diff --git a/dibtests/bltrop/bltrop.rbuild b/dibtests/bltrop/bltrop.rbuild index f19491c61bb..82b0a098e2b 100644 --- a/dibtests/bltrop/bltrop.rbuild +++ b/dibtests/bltrop/bltrop.rbuild @@ -4,3 +4,4 @@ user32 bltrop.c bltrop.rc + diff --git a/dibtests/vbltest/vbltest.rbuild b/dibtests/vbltest/vbltest.rbuild index d715469ba68..c49b905f530 100644 --- a/dibtests/vbltest/vbltest.rbuild +++ b/dibtests/vbltest/vbltest.rbuild @@ -4,3 +4,4 @@ gdi32 vbltest.c vbltest.rc + \ No newline at end of file diff --git a/drivers/kmtest/ntos_fsrtl.c b/drivers/kmtest/ntos_fsrtl.c index f94b2529160..5eef05afdd7 100644 --- a/drivers/kmtest/ntos_fsrtl.c +++ b/drivers/kmtest/ntos_fsrtl.c @@ -334,6 +334,8 @@ VOID FsRtlIsDbcsInExpressionTest() VOID NtoskrnlFsRtlTest(HANDLE KeyHandle) { + StartTest(); + FsRtlIsNameInExpressionTest(); FsRtlIsDbcsInExpressionTest(); diff --git a/dxtest/win32kdxtest/win32kdxtest.rbuild b/dxtest/win32kdxtest/win32kdxtest.rbuild index ad0499a5d05..90122ac0b6f 100644 --- a/dxtest/win32kdxtest/win32kdxtest.rbuild +++ b/dxtest/win32kdxtest/win32kdxtest.rbuild @@ -11,3 +11,4 @@ NtGdiDdWaitForVerticalBlank.c NtGdiDdCanCreateSurface.c dump.c + \ No newline at end of file diff --git a/win32/smss/movefile/movefile.rbuild b/win32/smss/movefile/movefile.rbuild index 21033a1930f..9fe8a054cab 100644 --- a/win32/smss/movefile/movefile.rbuild +++ b/win32/smss/movefile/movefile.rbuild @@ -4,3 +4,4 @@ user32 movefile.cpp movefile.rc + \ No newline at end of file diff --git a/win32/user32/drawcaption/drawcaption.rbuild b/win32/user32/drawcaption/drawcaption.rbuild index 351250ec530..026b2410bd8 100644 --- a/win32/user32/drawcaption/drawcaption.rbuild +++ b/win32/user32/drawcaption/drawcaption.rbuild @@ -16,3 +16,4 @@ capicon.c capicon.rc + diff --git a/winetests/comctl32/CMakeLists.txt b/winetests/comctl32/CMakeLists.txt index ff47bca7dc4..f5e93b17fc1 100644 --- a/winetests/comctl32/CMakeLists.txt +++ b/winetests/comctl32/CMakeLists.txt @@ -9,6 +9,8 @@ add_definitions(-D_WIN32_WINNT=0x600) remove_definitions(-D_WIN32_IE=0x600) add_definitions(-D_WIN32_IE=0x500) +set_rc_compiler() + list(APPEND SOURCE comboex.c datetime.c diff --git a/winetests/cryptui/cryptui.rbuild b/winetests/cryptui/cryptui.rbuild index 2c6daf31b46..13b7702ce10 100644 --- a/winetests/cryptui/cryptui.rbuild +++ b/winetests/cryptui/cryptui.rbuild @@ -8,3 +8,4 @@ crypt32 user32 ntdll + diff --git a/winetests/itss/CMakeLists.txt b/winetests/itss/CMakeLists.txt index 10a7130aaa5..dff3b5f070e 100644 --- a/winetests/itss/CMakeLists.txt +++ b/winetests/itss/CMakeLists.txt @@ -3,6 +3,8 @@ add_definitions( -D__ROS_LONG64__ -D_DLL -D__USE_CRTIMP) +set_rc_compiler() + add_executable(itss_winetest protocol.c testlist.c rsrc.rc) target_link_libraries(itss_winetest wine) set_module_type(itss_winetest win32cui) diff --git a/winetests/jscript/CMakeLists.txt b/winetests/jscript/CMakeLists.txt index 347519d5f7d..89215dc9d2d 100644 --- a/winetests/jscript/CMakeLists.txt +++ b/winetests/jscript/CMakeLists.txt @@ -3,6 +3,8 @@ add_definitions( -D__ROS_LONG64__ -D_DLL -D__USE_CRTIMP) +set_rc_compiler() + list(APPEND SOURCE activex.c jscript.c diff --git a/winetests/kernel32/CMakeLists.txt b/winetests/kernel32/CMakeLists.txt index 9094a050c45..9ad88ff3862 100644 --- a/winetests/kernel32/CMakeLists.txt +++ b/winetests/kernel32/CMakeLists.txt @@ -3,6 +3,8 @@ add_definitions( -D__ROS_LONG64__ -D_DLL -D__USE_CRTIMP) +set_rc_compiler() + list(APPEND SOURCE actctx.c alloc.c @@ -38,6 +40,7 @@ list(APPEND SOURCE version.c virtual.c volume.c + dosdev.c testlist.c resource.rc) diff --git a/winetests/kernel32/dosdev.c b/winetests/kernel32/dosdev.c new file mode 100644 index 00000000000..55bb9818ba6 --- /dev/null +++ b/winetests/kernel32/dosdev.c @@ -0,0 +1,228 @@ +/* + * Unit test suite for virtual substituted drive functions. + * + * Copyright 2011 Sam Arun Raj + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include + +#include "wine/test.h" +#include "windef.h" +#include "winbase.h" +#include "winerror.h" + +static void test_DefineDosDeviceA1(void) +{ + /* Test using lowercase drive letters */ + CHAR Target[MAX_PATH]; + CHAR Drive[] = "m:"; + BOOL Result; + + Result = DefineDosDeviceA(0, Drive, "C:\\temp"); + ok(Result, "Failed to subst drive using lowercase drive letter\n"); + + Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE, Drive, "C:\\temp"); + ok(Result, "Failed to remove subst drive using lowercase drive letter\n"); + + Result = QueryDosDeviceA(Drive, Target, MAX_PATH); + ok(!Result, "Subst drive is present even after remove attempt\n"); +} + +static void test_DefineDosDeviceA2(void) +{ + /* Test using trailing \ against drive letter */ + CHAR Target[MAX_PATH]; + CHAR Drive[] = "Q:\\"; + BOOL Result; + + Result = DefineDosDeviceA(0, Drive, "C:\\temp"); + ok(!Result, "Subst drive using trailing path seperator\n"); + + Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE, Drive, "C:\\temp"); + ok(!Result, "Subst drive using trailing path seperator\n"); + + Result = QueryDosDeviceA(Drive, Target, MAX_PATH); + ok(!Result, "Subst drive is present when it should not be created in the first place\n"); +} + +static void test_DefineDosDeviceA3(void) +{ + /* Test using arbitary string, not necessarily a DOS drive letter */ + CHAR Target[MAX_PATH]; + CHAR Drive[] = "!QHello:"; + BOOL Result; + + Result = DefineDosDeviceA(0, Drive, "C:\\temp"); + ok(Result, "Failed to subst drive using non-DOS drive name\n"); + + Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE, Drive, "C:\\temp"); + ok(Result, "Failed to subst drive using non-DOS drive name\n"); + + Result = QueryDosDeviceA(Drive, Target, MAX_PATH); + ok(!Result, "Subst drive is present even after remove attempt\n"); +} + +static void test_DefineDosDeviceA4(void) +{ + /* Test remove without using DDD_EXACT_MATCH_ON_REMOVE */ + CHAR Target[MAX_PATH]; + CHAR Drive[] = "M:"; + BOOL Result; + + Result = DefineDosDeviceA(0, Drive, "C:\\temp"); + ok(Result, "Failed to subst drive\n"); + + Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION, Drive, NULL); + ok(Result, "Failed to remove subst drive using NULL Target name\n"); + + Result = QueryDosDeviceA(Drive, Target, MAX_PATH); + ok(!Result, "Subst drive is present even after remove attempt\n"); +} + +static void test_DefineDosDeviceA5(void) +{ + /* Test multiple adds and multiple removes in add order */ + CHAR Target[MAX_PATH]; + CHAR Drive[] = "M:"; + BOOL Result; + + Result = DefineDosDeviceA(0, Drive, "C:\\temp1"); + ok(Result, "Failed to subst drive\n"); + Result = DefineDosDeviceA(0, Drive, "C:\\temp2"); + ok(Result, "Failed to subst drive\n"); + Result = DefineDosDeviceA(0, Drive, "C:\\temp3"); + ok(Result, "Failed to subst drive\n"); + + Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE, Drive, "C:\\temp1"); + ok(Result, "Failed to remove subst drive\n"); + Result = QueryDosDeviceA(Drive, Target, MAX_PATH); + ok(Result, "Failed to query subst drive\n"); + if (Result) + ok((_stricmp(Target, "\\??\\C:\\temp3") == 0), "Subst drive is not pointing to correct target\n"); + + Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE, Drive, "C:\\temp2"); + ok(Result, "Failed to remove subst drive\n"); + Result = QueryDosDeviceA(Drive, Target, MAX_PATH); + ok(Result, "Failed to query subst drive\n"); + if (Result) + ok((_stricmp(Target, "\\??\\C:\\temp3") == 0), "Subst drive is not pointing to correct target\n"); + + Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE, Drive, "C:\\temp3"); + ok(Result, "Failed to remove subst drive\n"); + + Result = QueryDosDeviceA(Drive, Target, MAX_PATH); + ok(!Result, "Subst drive is present even after remove attempt\n"); +} + +static void test_DefineDosDeviceA6(void) +{ + /* Test multiple adds and multiple removes in reverse order */ + CHAR Target[MAX_PATH]; + CHAR Drive[] = "M:"; + BOOL Result; + + Result = DefineDosDeviceA(0, Drive, "C:\\temp1"); + ok(Result, "Failed to subst drive\n"); + Result = DefineDosDeviceA(0, Drive, "C:\\temp2"); + ok(Result, "Failed to subst drive\n"); + Result = DefineDosDeviceA(0, Drive, "C:\\temp3"); + ok(Result, "Failed to subst drive\n"); + + Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE, Drive, "C:\\temp3"); + ok(Result, "Failed to remove subst drive\n"); + Result = QueryDosDeviceA(Drive, Target, MAX_PATH); + ok(Result, "Failed to query subst drive\n"); + if (Result) + ok((_stricmp(Target, "\\??\\C:\\temp2") == 0), "Subst drive is not pointing to correct target\n"); + + Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE, Drive, "C:\\temp2"); + ok(Result, "Failed to remove subst drive\n"); + Result = QueryDosDeviceA(Drive, Target, MAX_PATH); + ok(Result, "Failed to query subst drive\n"); + if (Result) + ok((_stricmp(Target, "\\??\\C:\\temp1") == 0), "Subst drive is not pointing to correct target\n"); + + Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE, Drive, "C:\\temp1"); + ok(Result, "Failed to remove subst drive\n"); + + Result = QueryDosDeviceA(Drive, Target, MAX_PATH); + ok(!Result, "Subst drive is present even after remove attempt\n"); +} + +static void test_DefineDosDeviceA7(void) +{ + /* Test multiple adds and multiple removes out of order */ + CHAR Target[MAX_PATH]; + CHAR Drive[] = "M:"; + BOOL Result; + + Result = DefineDosDeviceA(0, Drive, "C:\\temp1"); + ok(Result, "Failed to subst drive\n"); + Result = DefineDosDeviceA(0, Drive, "C:\\temp2"); + ok(Result, "Failed to subst drive\n"); + Result = DefineDosDeviceA(0, Drive, "C:\\temp3"); + ok(Result, "Failed to subst drive\n"); + Result = DefineDosDeviceA(0, Drive, "C:\\temp4"); + ok(Result, "Failed to subst drive\n"); + Result = DefineDosDeviceA(0, Drive, "C:\\temp5"); + ok(Result, "Failed to subst drive\n"); + + Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE, Drive, "C:\\temp2"); + ok(Result, "Failed to remove subst drive\n"); + Result = QueryDosDeviceA(Drive, Target, MAX_PATH); + ok(Result, "Failed to query subst drive\n"); + if (Result) + ok((_stricmp(Target, "\\??\\C:\\temp5") == 0), "Subst drive is not pointing to correct target\n"); + + Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE, Drive, "C:\\temp5"); + ok(Result, "Failed to remove subst drive\n"); + Result = QueryDosDeviceA(Drive, Target, MAX_PATH); + ok(Result, "Failed to query subst drive\n"); + if (Result) + ok((_stricmp(Target, "\\??\\C:\\temp4") == 0), "Subst drive is not pointing to correct target\n"); + + Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE, Drive, "C:\\temp1"); + ok(Result, "Failed to remove subst drive\n"); + Result = QueryDosDeviceA(Drive, Target, MAX_PATH); + ok(Result, "Failed to query subst drive\n"); + if (Result) + ok((_stricmp(Target, "\\??\\C:\\temp4") == 0), "Subst drive is not pointing to correct target\n"); + + Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE, Drive, "C:\\temp3"); + ok(Result, "Failed to remove subst drive\n"); + Result = QueryDosDeviceA(Drive, Target, MAX_PATH); + ok(Result, "Failed to query subst drive\n"); + if (Result) + ok((_stricmp(Target, "\\??\\C:\\temp4") == 0), "Subst drive is not pointing to correct target"); + + Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE, Drive, "C:\\temp4"); + ok(Result, "Failed to remove subst drive\n"); + + Result = QueryDosDeviceA(Drive, Target, MAX_PATH); + ok(!Result, "Subst drive is present even after remove attempt\n"); +} + +START_TEST(dosdev) +{ + test_DefineDosDeviceA1(); + test_DefineDosDeviceA2(); + test_DefineDosDeviceA3(); + test_DefineDosDeviceA4(); + test_DefineDosDeviceA5(); + test_DefineDosDeviceA6(); + test_DefineDosDeviceA7(); +} diff --git a/winetests/kernel32/kernel32.rbuild b/winetests/kernel32/kernel32.rbuild index 1b87f4b5414..03e64f87615 100644 --- a/winetests/kernel32/kernel32.rbuild +++ b/winetests/kernel32/kernel32.rbuild @@ -40,6 +40,7 @@ version.c virtual.c volume.c + dosdev.c testlist.c resource.rc diff --git a/winetests/kernel32/testlist.c b/winetests/kernel32/testlist.c index 0102ea70159..0b8317136ba 100755 --- a/winetests/kernel32/testlist.c +++ b/winetests/kernel32/testlist.c @@ -42,6 +42,7 @@ extern void func_toolhelp(void); extern void func_virtual(void); extern void func_version(void); extern void func_volume(void); +extern void func_dosdev(void); const struct test winetest_testlist[] = { @@ -78,6 +79,7 @@ const struct test winetest_testlist[] = { "virtual", func_virtual }, { "version", func_version }, { "volume", func_volume }, + { "dosdev", func_dosdev }, { 0, 0 } }; diff --git a/winetests/mshtml/CMakeLists.txt b/winetests/mshtml/CMakeLists.txt index bdf2c46d140..cf4bb120631 100644 --- a/winetests/mshtml/CMakeLists.txt +++ b/winetests/mshtml/CMakeLists.txt @@ -1,4 +1,6 @@ +set_rc_compiler() + add_definitions( -D__ROS_LONG64__ -D_DLL -D__USE_CRTIMP) diff --git a/winetests/user32/CMakeLists.txt b/winetests/user32/CMakeLists.txt index 6b36fe307b6..3a254e5d1ea 100644 --- a/winetests/user32/CMakeLists.txt +++ b/winetests/user32/CMakeLists.txt @@ -3,6 +3,8 @@ add_definitions( -D__ROS_LONG64__ -D_DLL -D__USE_CRTIMP) +set_rc_compiler() + list(APPEND SOURCE broadcast.c class.c diff --git a/winetests/user32/msg.c b/winetests/user32/msg.c index aef282018f1..e0494ef2a06 100755 --- a/winetests/user32/msg.c +++ b/winetests/user32/msg.c @@ -12572,10 +12572,7 @@ START_TEST(msg) test_paint_messages(); test_interthread_messages(); test_message_conversion(); - if(!winetest_interactive) - skip("skipping test_accelerators, that hangs on reactos\n"); - else - test_accelerators(); + test_accelerators(); test_timers(); test_timers_no_wnd(); if (hCBT_hook) test_set_hook(); @@ -12596,10 +12593,7 @@ START_TEST(msg) test_dialog_messages(); test_nullCallback(); test_dbcs_wm_char(); - if(!winetest_interactive) - skip("skipping test_menu_messages, that hangs on reactos\n"); - else - test_menu_messages(); + test_menu_messages(); test_paintingloop(); test_defwinproc(); test_clipboard_viewers(); diff --git a/winetests/user32/win.c b/winetests/user32/win.c index 668399caeef..33c837bed0e 100644 --- a/winetests/user32/win.c +++ b/winetests/user32/win.c @@ -6058,11 +6058,7 @@ START_TEST(win) test_capture_1(); test_capture_2(); test_capture_3(hwndMain, hwndMain2); - - if(!winetest_interactive) - skip("skipping test_capture_4, that hangs on reactos\n"); - else - test_capture_4(); + test_capture_4(); test_CreateWindow(); test_parent_owner();