ReactOS 0.4.16-dev-92-g0c2cdca
FindFile_user.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS kernel-mode tests
3 * LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory
4 * PURPOSE: Test for FindFirstFile's wildcard substitution
5 * PROGRAMMER: Thomas Faber <thomas.faber@reactos.org>
6 */
7
8#include <kmt_test.h>
9
10#include "kernel32_test.h"
11
13{
14 HANDLE FindHandle;
15 WIN32_FIND_DATAW FindData;
16 struct
17 {
20 } Tests[] =
21 {
22 { L"Hello", L"Hello" },
23
24 { L"*", L"*" },
25 { L"a*", L"a*" },
26 { L"*a", L"*a" },
27 { L"a*a", L"a*a" },
28 { L"**", L"**" },
29 { L"*a*", L"*a*" },
30 { L"a*a*a", L"a*a*a" },
31
32 { L"*.*", L"*" },
33 { L"a*.*", L"a<\"*" },
34 { L"*.*a", L"<\"*a" },
35 { L"a*.*a", L"a<\"*a" },
36 { L"*.**.*", L"<\"*<\"*" },
37 { L"*.*a*.*", L"<\"*a<\"*" },
38 { L"a*.*a*.*a", L"a<\"*a<\"*a" },
39
40 { L".*", L"\"*" },
41 { L"a.*", L"a\"*" },
42 { L".*a", L"\"*a" },
43 { L"a.*a", L"a\"*a" },
44 { L".*.*", L"\"<\"*" },
45 { L".*a.*", L"\"*a\"*" },
46 { L"a.*a.*a", L"a\"*a\"*a" },
47
48 { L"*.", L"<" },
49 { L"a*.", L"a<" },
50 { L"*.a", L"<.a" },
51 { L"a*.a", L"a<.a" },
52 { L"*.*.", L"*" },
53 { L"*.a*.", L"<.a<" },
54 { L"a*.a*.a", L"a<.a<.a" },
55
56 { L"?", L">" },
57 { L"a?", L"a>" },
58 { L"?a", L">a" },
59 { L"a?a", L"a>a" },
60 { L"??", L">>" },
61 { L"?a?", L">a>" },
62 { L"a?a?a", L"a>a>a" },
63
64 { L"?.?", L">\">" },
65 { L"a?.?", L"a>\">" },
66 { L"?.?a", L">\">a" },
67 { L"a?.?a", L"a>\">a" },
68 { L"?.??.?", L">\">>\">" },
69 { L"?.?a?.?", L">\">a>\">" },
70 { L"a?.?a?.?a", L"a>\">a>\">a" },
71
72 { L".?", L"\">" },
73 { L"a.?", L"a\">" },
74 { L".?a", L"\">a" },
75 { L"a.?a", L"a\">a" },
76 { L".?.?", L"\">\">" },
77 { L".?a.?", L"\">a\">" },
78 { L"a.?a.?a", L"a\">a\">a" },
79
80 { L"?.", L">" },
81 { L"a?.", L"a>" },
82 { L"?.a", L">.a" },
83 { L"a?.a", L"a>.a" },
84 { L"?.?.", L">\">" },
85 { L"?.a?.", L">.a>" },
86 { L"a?.a?.a", L"a>.a>.a" },
87
88 { L"f*.", L"f<" },
89 { L"f.*", L"f\"*" },
90 { L"f*.*", L"f<\"*" },
91 { L"f*.f*", L"f<.f*" },
92 { L"f*f.*", L"f*f\"*" },
93 { L"f*.*f", L"f<\"*f" },
94
95 /* TODO: add more. Have fun */
96 };
97 const INT TestCount = sizeof(Tests) / sizeof(Tests[0]);
98 INT i;
100 DWORD Error;
101
102 Error = KmtLoadAndOpenDriver(L"kernel32", FALSE);
104 if (Error)
105 return;
106
107 for (i = 0; i < TestCount; i++)
108 {
109 trace("[%d] '%ls', '%ls'\n", i, Tests[i].Expression, Tests[i].ExpectedExpression);
111 wcscpy(ExpressionBuffer, L"\\\\.\\Global\\GLOBALROOT\\Device\\Kmtest-kernel32\\");
113 FindHandle = FindFirstFileW(ExpressionBuffer, &FindData);
114 ok(FindHandle != NULL && FindHandle != INVALID_HANDLE_VALUE, "Handle: %p, error=%lu\n", (PVOID)FindHandle, GetLastError());
115 if (FindHandle != INVALID_HANDLE_VALUE)
116 FindClose(FindHandle);
117 }
118
121}
PCWSTR Expression
struct test_data Tests[]
#define ok_eq_int(value, expected)
Definition: apitest.h:60
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
BOOL Error
Definition: chkdsk.c:66
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define MAX_PATH
Definition: compat.h:34
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
@ FindFile
Definition: find.c:28
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static UNICODE_STRING ExpectedExpression
Definition: kernel32_drv.c:20
static WCHAR ExpressionBuffer[MAX_PATH]
Definition: kernel32_drv.c:21
#define IOCTL_EXPECT_EXPRESSION
Definition: kernel32_test.h:11
#define L(x)
Definition: ntvdm.h:50
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
DWORD KmtLoadAndOpenDriver(IN PCWSTR ServiceName, IN BOOLEAN RestartIfRunning)
Definition: support.c:213
VOID KmtCloseDriver(VOID)
Definition: support.c:236
DWORD KmtSendWStringToDriver(IN DWORD ControlCode, IN PCWSTR String)
Definition: support.c:308
VOID KmtUnloadDriver(VOID)
Definition: support.c:167
const uint16_t * PCWSTR
Definition: typedefs.h:57
int32_t INT
Definition: typedefs.h:58
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
__wchar_t WCHAR
Definition: xmlstorage.h:180