[KMTestSuite]

Update to HEAD

svn path=/branches/GSoC_2011/KMTestSuite/; revision=51628
This commit is contained in:
Thomas Faber 2011-05-07 19:47:38 +00:00
commit 9d307acbbd
35 changed files with 695 additions and 23 deletions

View file

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

View file

@ -21,6 +21,10 @@
<directory name="user32">
<xi:include href="user32/user32_apitest.rbuild" />
</directory>
<directory name="kernel32">
<xi:include href="kernel32/kernel32_apitest.rbuild" />
</directory>
<if property="ARCH" value="i386">
<directory name="w32kdll">

View file

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

View file

@ -0,0 +1,71 @@
#include <stdio.h>
#include <wine/test.h>
#include <windows.h>
#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);
}
}

View file

@ -0,0 +1,13 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="kernel32_apitest" type="win32cui" installbase="bin" installname="kernel32_apitest.exe">
<include base="kernel32_apitest">.</include>
<library>wine</library>
<library>ntdll</library>
<library>pseh</library>
<file>testlist.c</file>
<file>GetDriveType.c</file>
</module>
</group>

View file

@ -0,0 +1,16 @@
#define WIN32_LEAN_AND_MEAN
#define __ROS_LONG64__
#include <windows.h>
#define STANDALONE
#include "wine/test.h"
extern void func_GetDriveType(void);
const struct test winetest_testlist[] =
{
{ "GetDriveType", func_GetDriveType },
{ 0, 0 }
};

View file

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

View file

@ -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 <stdio.h>
#include <wine/test.h>
#include <windows.h>
#include <assert.h>
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();
}

View file

@ -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 <stdio.h>
#include <wine/test.h>
#include <windows.h>
#include <assert.h>
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();
}

View file

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

View file

@ -10,6 +10,7 @@
<file>testlist.c</file>
<file>user32_apitest.rc</file>
<file>GetKeyState.c</file>
<file>InitializeLpkHooks.c</file>
<file>RealGetWindowClass.c</file>
<file>ScrollDC.c</file>
@ -18,6 +19,7 @@
<file>GetIconInfo.c</file>
<file>GetPeekMessage.c</file>
<file>DeferWindowPos.c</file>
<file>SetCursorPos.c</file>
</module>
</group>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,8 @@
add_definitions(-D_DLL -D__USE_CRTIMP)
set_rc_compiler()
list(APPEND SOURCE
osver.c
testlist.c

View file

@ -4,3 +4,4 @@
<library>user32</library>
<file>bltrop.c</file>
<file>bltrop.rc</file>
</module>

View file

@ -4,3 +4,4 @@
<library>gdi32</library>
<file>vbltest.c</file>
<file>vbltest.rc</file>
</module>

View file

@ -334,6 +334,8 @@ VOID FsRtlIsDbcsInExpressionTest()
VOID
NtoskrnlFsRtlTest(HANDLE KeyHandle)
{
StartTest();
FsRtlIsNameInExpressionTest();
FsRtlIsDbcsInExpressionTest();

View file

@ -11,3 +11,4 @@
<file>NtGdiDdWaitForVerticalBlank.c</file>
<file>NtGdiDdCanCreateSurface.c</file>
<file>dump.c</file>
</module>

View file

@ -4,3 +4,4 @@
<library>user32</library>
<file>movefile.cpp</file>
<file>movefile.rc</file>
</module>

View file

@ -16,3 +16,4 @@
<file>capicon.c</file>
<file>capicon.rc</file>
</module>
</group>

View file

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

View file

@ -8,3 +8,4 @@
<library>crypt32</library>
<library>user32</library>
<library>ntdll</library>
</module>

View file

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

View file

@ -3,6 +3,8 @@ add_definitions(
-D__ROS_LONG64__
-D_DLL -D__USE_CRTIMP)
set_rc_compiler()
list(APPEND SOURCE
activex.c
jscript.c

View file

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

228
winetests/kernel32/dosdev.c Normal file
View file

@ -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 <stdarg.h>
#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();
}

View file

@ -40,6 +40,7 @@
<file>version.c</file>
<file>virtual.c</file>
<file>volume.c</file>
<file>dosdev.c</file>
<file>testlist.c</file>
<file>resource.rc</file>
</module>

View file

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

View file

@ -1,4 +1,6 @@
set_rc_compiler()
add_definitions(
-D__ROS_LONG64__
-D_DLL -D__USE_CRTIMP)

View file

@ -3,6 +3,8 @@ add_definitions(
-D__ROS_LONG64__
-D_DLL -D__USE_CRTIMP)
set_rc_compiler()
list(APPEND SOURCE
broadcast.c
class.c

View file

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

View file

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