ReactOS  0.4.14-dev-98-gb0d4763
FindFile_user.c File Reference
#include <kmt_test.h>
#include "kernel32_test.h"
Include dependency graph for FindFile_user.c:

Go to the source code of this file.

Functions

 START_TEST (FindFile)
 

Function Documentation

◆ START_TEST()

START_TEST ( FindFile  )

Definition at line 12 of file FindFile_user.c.

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 
101  KmtLoadDriver(L"kernel32", FALSE);
102  KmtOpenDriver();
103 
104  for (i = 0; i < TestCount; i++)
105  {
106  trace("[%d] '%ls', '%ls'\n", i, Tests[i].Expression, Tests[i].ExpectedExpression);
108  wcscpy(ExpressionBuffer, L"\\\\.\\Global\\GLOBALROOT\\Device\\Kmtest-kernel32\\");
110  FindHandle = FindFirstFileW(ExpressionBuffer, &FindData);
111  ok(FindHandle != NULL && FindHandle != INVALID_HANDLE_VALUE, "Handle: %p, error=%lu\n", (PVOID)FindHandle, GetLastError());
112  if (FindHandle != INVALID_HANDLE_VALUE)
113  FindClose(FindHandle);
114  }
115 
116  KmtCloseDriver();
117  KmtUnloadDriver();
118 }
const uint16_t * PCWSTR
Definition: typedefs.h:55
PCWSTR Expression
#define IOCTL_EXPECT_EXPRESSION
Definition: kernel32_test.h:11
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
int32_t INT
Definition: typedefs.h:56
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
smooth NULL
Definition: ftsmooth.c:416
static UNICODE_STRING ExpectedExpression
Definition: kernel32_drv.c:20
VOID KmtCloseDriver(VOID)
Definition: support.c:200
#define trace
Definition: atltest.h:70
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
DWORD KmtSendWStringToDriver(IN DWORD ControlCode, IN PCWSTR String)
Definition: support.c:273
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
VOID KmtUnloadDriver(VOID)
Definition: support.c:155
#define ok(value,...)
Definition: atltest.h:57
static WCHAR ExpressionBuffer[MAX_PATH]
Definition: kernel32_drv.c:21
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
VOID KmtLoadDriver(IN PCWSTR ServiceName, IN BOOLEAN RestartIfRunning)
Definition: support.c:127
VOID KmtOpenDriver(VOID)
Definition: support.c:174
struct test_data Tests[]
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502