ReactOS 0.4.16-dev-125-g798ea90
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_ustr(str1, str2) do { \
27 ok((str1)->Buffer == (str2)->Buffer, "Buffer modified\n"); \
28 ok((str1)->Length == (str2)->Length, "Length modified\n"); \
29 ok((str1)->MaximumLength == (str2)->MaximumLength, "MaximumLength modified\n"); \
30 } while (0)
31
33{
35 UNICODE_STRING PathString;
36 UNICODE_STRING FileNameString;
37 UNICODE_STRING ExtensionString;
38 UNICODE_STRING CallerBuffer;
40 PUNICODE_STRING FullNameOut;
41 UNICODE_STRING EmptyString;
42 SIZE_T FilePartSize;
44 INT i;
45
46 RtlInitUnicodeString(&EmptyString, NULL);
47
48 /* NULLs */
49 StartSeh()
53
54 RtlInitUnicodeString(&FileNameString, NULL);
55 StartSeh()
56 Status = RtlDosSearchPath_Ustr(0, NULL, &FileNameString, NULL, NULL, NULL, NULL, NULL, NULL);
59
60 RtlInitUnicodeString(&PathString, NULL);
61 StartSeh()
62 Status = RtlDosSearchPath_Ustr(0, &PathString, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
65 ok_eq_ustr(&PathString, &EmptyString);
66
67 /* Minimal valid set of parameters */
68 RtlInitUnicodeString(&PathString, NULL);
69 RtlInitUnicodeString(&FileNameString, NULL);
70 StartSeh()
71 Status = RtlDosSearchPath_Ustr(0, &PathString, &FileNameString, NULL, NULL, NULL, NULL, NULL, NULL);
74 ok_eq_ustr(&PathString, &EmptyString);
75 ok_eq_ustr(&FileNameString, &EmptyString);
76
77 /* Check valid flags */
78 for (i = 0; i < 32; i++)
79 {
80 RtlInitUnicodeString(&PathString, NULL);
81 RtlInitUnicodeString(&FileNameString, NULL);
82 StartSeh()
83 Status = RtlDosSearchPath_Ustr(1 << i, &PathString, &FileNameString, NULL, NULL, NULL, NULL, NULL, NULL);
86 ok_eq_ustr(&PathString, &EmptyString);
87 ok_eq_ustr(&FileNameString, &EmptyString);
88 }
89
90 RtlInitUnicodeString(&PathString, NULL);
91 RtlInitUnicodeString(&FileNameString, NULL);
92 StartSeh()
93 Status = RtlDosSearchPath_Ustr(7, &PathString, &FileNameString, NULL, NULL, NULL, NULL, NULL, NULL);
96 ok_eq_ustr(&PathString, &EmptyString);
97 ok_eq_ustr(&FileNameString, &EmptyString);
98
99 /* Everything except PathString */
100 RtlInitUnicodeString(&FileNameString, NULL);
101 RtlInitUnicodeString(&ExtensionString, NULL);
102 RtlInitUnicodeString(&CallerBuffer, NULL);
104 FullNameOut = InvalidPointer;
105 FilePartSize = (SIZE_T)-1;
106 LengthNeeded = (SIZE_T)-1;
107 StartSeh()
109 NULL,
110 &FileNameString,
111 &ExtensionString,
112 &CallerBuffer,
114 &FullNameOut,
115 &FilePartSize,
116 &LengthNeeded);
119 ok_eq_ustr(&FileNameString, &EmptyString);
120 ok_eq_ustr(&ExtensionString, &EmptyString);
121 ok_eq_ustr(&CallerBuffer, &EmptyString);
122 ok_eq_ustr(&DynamicString, &EmptyString);
123 ok_eq_pointer(FullNameOut, NULL);
124 ok_eq_ulong(FilePartSize, 0UL);
126
127 /* Everything except FileNameString */
128 RtlInitUnicodeString(&PathString, NULL);
129 RtlInitUnicodeString(&ExtensionString, NULL);
130 RtlInitUnicodeString(&CallerBuffer, NULL);
132 FullNameOut = InvalidPointer;
133 FilePartSize = (SIZE_T)-1;
134 LengthNeeded = (SIZE_T)-1;
135 StartSeh()
137 &PathString,
138 NULL,
139 &ExtensionString,
140 &CallerBuffer,
142 &FullNameOut,
143 &FilePartSize,
144 &LengthNeeded);
147 ok_eq_ustr(&PathString, &EmptyString);
148 ok_eq_ustr(&ExtensionString, &EmptyString);
149 ok_eq_ustr(&CallerBuffer, &EmptyString);
150 ok_eq_ustr(&DynamicString, &EmptyString);
151 ok_eq_pointer(FullNameOut, NULL);
152 ok_eq_ulong(FilePartSize, 0UL);
154
155 /* Passing CallerBuffer and DynamicString, but not FullNameOut is invalid */
156 RtlInitUnicodeString(&PathString, NULL);
157 RtlInitUnicodeString(&FileNameString, NULL);
158 RtlInitUnicodeString(&ExtensionString, NULL);
159 RtlInitUnicodeString(&CallerBuffer, NULL);
161 FullNameOut = InvalidPointer;
162 FilePartSize = (SIZE_T)-1;
163 LengthNeeded = (SIZE_T)-1;
164 StartSeh()
166 &PathString,
167 &FileNameString,
168 &ExtensionString,
169 &CallerBuffer,
171 NULL,
172 &FilePartSize,
173 &LengthNeeded);
176 ok_eq_ustr(&PathString, &EmptyString);
177 ok_eq_ustr(&FileNameString, &EmptyString);
178 ok_eq_ustr(&ExtensionString, &EmptyString);
179 ok_eq_ustr(&CallerBuffer, &EmptyString);
180 ok_eq_ustr(&DynamicString, &EmptyString);
181 ok_eq_ulong(FilePartSize, 0UL);
183
184 /* All parameters given */
185 RtlInitUnicodeString(&PathString, NULL);
186 RtlInitUnicodeString(&FileNameString, NULL);
187 RtlInitUnicodeString(&ExtensionString, NULL);
188 RtlInitUnicodeString(&CallerBuffer, NULL);
190 FullNameOut = InvalidPointer;
191 FilePartSize = (SIZE_T)-1;
192 LengthNeeded = (SIZE_T)-1;
193 StartSeh()
195 &PathString,
196 &FileNameString,
197 &ExtensionString,
198 &CallerBuffer,
200 &FullNameOut,
201 &FilePartSize,
202 &LengthNeeded);
205 ok_eq_ustr(&PathString, &EmptyString);
206 ok_eq_ustr(&FileNameString, &EmptyString);
207 ok_eq_ustr(&ExtensionString, &EmptyString);
208 ok_eq_ustr(&CallerBuffer, &EmptyString);
209 ok_eq_ustr(&DynamicString, &EmptyString);
210 ok_eq_pointer(FullNameOut, NULL);
211 ok_eq_ulong(FilePartSize, 0UL);
213}
#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 ok_eq_pointer(value, expected)
Definition: apitest.h:59
#define ok_eq_hex(value, expected)
Definition: apitest.h:77
#define ok_eq_ulong(value, expected)
Definition: apitest.h:63
#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:165
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