ReactOS 0.4.15-dev-6675-gcbc63d8
RtlDosSearchPath_Ustr.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPLv2+ - See COPYING in the top level directory
4 * PURPOSE: Test for RtlDosSearchPath_Ustr
5 * PROGRAMMER: Thomas Faber <thomas.faber@reactos.org>
6 */
7
8#include "precomp.h"
9
10/*
11NTSTATUS
12NTAPI
13RtlDosSearchPath_Ustr(
14 IN ULONG Flags,
15 IN PUNICODE_STRING PathString,
16 IN PUNICODE_STRING FileNameString,
17 IN PUNICODE_STRING ExtensionString,
18 IN PUNICODE_STRING CallerBuffer,
19 IN OUT PUNICODE_STRING DynamicString OPTIONAL,
20 OUT PUNICODE_STRING *FullNameOut OPTIONAL,
21 OUT PSIZE_T FilePartSize OPTIONAL,
22 OUT PSIZE_T LengthNeeded OPTIONAL
23);
24*/
25
26#define ok_eq_ulong(value, expected) ok((value) == (expected), #value " = %lu, expected %lu\n", value, expected)
27#define ok_eq_hex(value, expected) ok((value) == (expected), #value " = 0x%lx, expected 0x%lx\n", value, expected)
28#define ok_eq_pointer(value, expected) ok((value) == (expected), #value " = %p, expected %p\n", value, expected)
29
30#define ok_eq_ustr(str1, str2) do { \
31 ok((str1)->Buffer == (str2)->Buffer, "Buffer modified\n"); \
32 ok((str1)->Length == (str2)->Length, "Length modified\n"); \
33 ok((str1)->MaximumLength == (str2)->MaximumLength, "MaximumLength modified\n"); \
34 } while (0)
35
37{
39 UNICODE_STRING PathString;
40 UNICODE_STRING FileNameString;
41 UNICODE_STRING ExtensionString;
42 UNICODE_STRING CallerBuffer;
44 PUNICODE_STRING FullNameOut;
45 UNICODE_STRING EmptyString;
46 SIZE_T FilePartSize;
48 INT i;
49
50 RtlInitUnicodeString(&EmptyString, NULL);
51
52 /* NULLs */
53 StartSeh()
57
58 RtlInitUnicodeString(&FileNameString, NULL);
59 StartSeh()
60 Status = RtlDosSearchPath_Ustr(0, NULL, &FileNameString, NULL, NULL, NULL, NULL, NULL, NULL);
63
64 RtlInitUnicodeString(&PathString, NULL);
65 StartSeh()
66 Status = RtlDosSearchPath_Ustr(0, &PathString, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
69 ok_eq_ustr(&PathString, &EmptyString);
70
71 /* Minimal valid set of parameters */
72 RtlInitUnicodeString(&PathString, NULL);
73 RtlInitUnicodeString(&FileNameString, NULL);
74 StartSeh()
75 Status = RtlDosSearchPath_Ustr(0, &PathString, &FileNameString, NULL, NULL, NULL, NULL, NULL, NULL);
78 ok_eq_ustr(&PathString, &EmptyString);
79 ok_eq_ustr(&FileNameString, &EmptyString);
80
81 /* Check valid flags */
82 for (i = 0; i < 32; i++)
83 {
84 RtlInitUnicodeString(&PathString, NULL);
85 RtlInitUnicodeString(&FileNameString, NULL);
86 StartSeh()
87 Status = RtlDosSearchPath_Ustr(1 << i, &PathString, &FileNameString, NULL, NULL, NULL, NULL, NULL, NULL);
90 ok_eq_ustr(&PathString, &EmptyString);
91 ok_eq_ustr(&FileNameString, &EmptyString);
92 }
93
94 RtlInitUnicodeString(&PathString, NULL);
95 RtlInitUnicodeString(&FileNameString, NULL);
96 StartSeh()
97 Status = RtlDosSearchPath_Ustr(7, &PathString, &FileNameString, NULL, NULL, NULL, NULL, NULL, NULL);
100 ok_eq_ustr(&PathString, &EmptyString);
101 ok_eq_ustr(&FileNameString, &EmptyString);
102
103 /* Everything except PathString */
104 RtlInitUnicodeString(&FileNameString, NULL);
105 RtlInitUnicodeString(&ExtensionString, NULL);
106 RtlInitUnicodeString(&CallerBuffer, NULL);
108 FullNameOut = InvalidPointer;
109 FilePartSize = (SIZE_T)-1;
110 LengthNeeded = (SIZE_T)-1;
111 StartSeh()
113 NULL,
114 &FileNameString,
115 &ExtensionString,
116 &CallerBuffer,
118 &FullNameOut,
119 &FilePartSize,
120 &LengthNeeded);
123 ok_eq_ustr(&FileNameString, &EmptyString);
124 ok_eq_ustr(&ExtensionString, &EmptyString);
125 ok_eq_ustr(&CallerBuffer, &EmptyString);
126 ok_eq_ustr(&DynamicString, &EmptyString);
127 ok_eq_pointer(FullNameOut, NULL);
128 ok_eq_ulong(FilePartSize, 0UL);
130
131 /* Everything except FileNameString */
132 RtlInitUnicodeString(&PathString, NULL);
133 RtlInitUnicodeString(&ExtensionString, NULL);
134 RtlInitUnicodeString(&CallerBuffer, NULL);
136 FullNameOut = InvalidPointer;
137 FilePartSize = (SIZE_T)-1;
138 LengthNeeded = (SIZE_T)-1;
139 StartSeh()
141 &PathString,
142 NULL,
143 &ExtensionString,
144 &CallerBuffer,
146 &FullNameOut,
147 &FilePartSize,
148 &LengthNeeded);
151 ok_eq_ustr(&PathString, &EmptyString);
152 ok_eq_ustr(&ExtensionString, &EmptyString);
153 ok_eq_ustr(&CallerBuffer, &EmptyString);
154 ok_eq_ustr(&DynamicString, &EmptyString);
155 ok_eq_pointer(FullNameOut, NULL);
156 ok_eq_ulong(FilePartSize, 0UL);
158
159 /* Passing CallerBuffer and DynamicString, but not FullNameOut is invalid */
160 RtlInitUnicodeString(&PathString, NULL);
161 RtlInitUnicodeString(&FileNameString, NULL);
162 RtlInitUnicodeString(&ExtensionString, NULL);
163 RtlInitUnicodeString(&CallerBuffer, NULL);
165 FullNameOut = InvalidPointer;
166 FilePartSize = (SIZE_T)-1;
167 LengthNeeded = (SIZE_T)-1;
168 StartSeh()
170 &PathString,
171 &FileNameString,
172 &ExtensionString,
173 &CallerBuffer,
175 NULL,
176 &FilePartSize,
177 &LengthNeeded);
180 ok_eq_ustr(&PathString, &EmptyString);
181 ok_eq_ustr(&FileNameString, &EmptyString);
182 ok_eq_ustr(&ExtensionString, &EmptyString);
183 ok_eq_ustr(&CallerBuffer, &EmptyString);
184 ok_eq_ustr(&DynamicString, &EmptyString);
185 ok_eq_ulong(FilePartSize, 0UL);
187
188 /* All parameters given */
189 RtlInitUnicodeString(&PathString, NULL);
190 RtlInitUnicodeString(&FileNameString, NULL);
191 RtlInitUnicodeString(&ExtensionString, NULL);
192 RtlInitUnicodeString(&CallerBuffer, NULL);
194 FullNameOut = InvalidPointer;
195 FilePartSize = (SIZE_T)-1;
196 LengthNeeded = (SIZE_T)-1;
197 StartSeh()
199 &PathString,
200 &FileNameString,
201 &ExtensionString,
202 &CallerBuffer,
204 &FullNameOut,
205 &FilePartSize,
206 &LengthNeeded);
209 ok_eq_ustr(&PathString, &EmptyString);
210 ok_eq_ustr(&FileNameString, &EmptyString);
211 ok_eq_ustr(&ExtensionString, &EmptyString);
212 ok_eq_ustr(&CallerBuffer, &EmptyString);
213 ok_eq_ustr(&DynamicString, &EmptyString);
214 ok_eq_pointer(FullNameOut, NULL);
215 ok_eq_ulong(FilePartSize, 0UL);
217}
#define ok_eq_pointer(value, expected)
#define ok_eq_hex(value, expected)
#define ok_eq_ulong(value, expected)
#define ok_eq_ustr(str1, str2)
IN PUNICODE_STRING IN PUNICODE_STRING DynamicString
#define InvalidPointer
#define StartSeh()
Definition: _sntprintf.h:16
#define EndSeh(ExpectedStatus)
Definition: _sntprintf.h:17
#define START_TEST(x)
Definition: atltest.h:75
LONG NTSTATUS
Definition: precomp.h:26
#define NULL
Definition: types.h:112
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ SECURITY_INFORMATION _In_ ULONG _Out_opt_ PULONG LengthNeeded
Definition: fltkernel.h:1343
Status
Definition: gdiplustypes.h:25
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
NTSYSAPI NTSTATUS NTAPI RtlDosSearchPath_Ustr(_In_ ULONG Flags, _In_ PUNICODE_STRING PathString, _In_ PUNICODE_STRING FileNameString, _In_ PUNICODE_STRING ExtensionString, _In_ PUNICODE_STRING CallerBuffer, _Inout_opt_ PUNICODE_STRING DynamicString, _Out_opt_ PUNICODE_STRING *FullNameOut, _Out_opt_ PSIZE_T FilePartSize, _Out_opt_ PSIZE_T LengthNeeded)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define STATUS_SUCCESS
Definition: shellext.h:65
#define UL
Definition: tui.h:148
ULONG_PTR SIZE_T
Definition: typedefs.h:80
int32_t INT
Definition: typedefs.h:58
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_NO_SUCH_FILE
Definition: udferr_usr.h:137