1c2c66affSColin Finck /*
2c2c66affSColin Finck * Unit test suite for ntdll path functions
3c2c66affSColin Finck *
4c2c66affSColin Finck * Copyright 2002 Alexandre Julliard
5c2c66affSColin Finck *
6c2c66affSColin Finck * This library is free software; you can redistribute it and/or
7c2c66affSColin Finck * modify it under the terms of the GNU Lesser General Public
8c2c66affSColin Finck * License as published by the Free Software Foundation; either
9c2c66affSColin Finck * version 2.1 of the License, or (at your option) any later version.
10c2c66affSColin Finck *
11c2c66affSColin Finck * This library is distributed in the hope that it will be useful,
12c2c66affSColin Finck * but WITHOUT ANY WARRANTY; without even the implied warranty of
13c2c66affSColin Finck * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14c2c66affSColin Finck * Lesser General Public License for more details.
15c2c66affSColin Finck *
16c2c66affSColin Finck * You should have received a copy of the GNU Lesser General Public
17c2c66affSColin Finck * License along with this library; if not, write to the Free Software
18c2c66affSColin Finck * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19c2c66affSColin Finck */
20c2c66affSColin Finck
21c2c66affSColin Finck #include "ntdll_test.h"
22c2c66affSColin Finck
23c2c66affSColin Finck static NTSTATUS (WINAPI *pRtlMultiByteToUnicodeN)( LPWSTR dst, DWORD dstlen, LPDWORD reslen,
24c2c66affSColin Finck LPCSTR src, DWORD srclen );
25c2c66affSColin Finck static NTSTATUS (WINAPI *pRtlUnicodeToMultiByteN)(LPSTR,DWORD,LPDWORD,LPCWSTR,DWORD);
26c2c66affSColin Finck static UINT (WINAPI *pRtlDetermineDosPathNameType_U)( PCWSTR path );
27c2c66affSColin Finck static ULONG (WINAPI *pRtlIsDosDeviceName_U)( PCWSTR dos_name );
28c2c66affSColin Finck static NTSTATUS (WINAPI *pRtlOemStringToUnicodeString)(UNICODE_STRING *, const STRING *, BOOLEAN );
29c2c66affSColin Finck static BOOLEAN (WINAPI *pRtlIsNameLegalDOS8Dot3)(const UNICODE_STRING*,POEM_STRING,PBOOLEAN);
30c2c66affSColin Finck static DWORD (WINAPI *pRtlGetFullPathName_U)(const WCHAR*,ULONG,WCHAR*,WCHAR**);
31*4ba4c415SAmine Khaldi static NTSTATUS (WINAPI *pRtlDosPathNameToNtPathName_U_WithStatus)(const WCHAR*, UNICODE_STRING*, WCHAR**, CURDIR*);
32c2c66affSColin Finck
test_RtlDetermineDosPathNameType_U(void)33c2c66affSColin Finck static void test_RtlDetermineDosPathNameType_U(void)
34c2c66affSColin Finck {
35c2c66affSColin Finck struct test
36c2c66affSColin Finck {
37c2c66affSColin Finck const char *path;
38c2c66affSColin Finck UINT ret;
39c2c66affSColin Finck };
40c2c66affSColin Finck
41c2c66affSColin Finck static const struct test tests[] =
42c2c66affSColin Finck {
43c2c66affSColin Finck { "\\\\foo", 1 },
44c2c66affSColin Finck { "//foo", 1 },
45c2c66affSColin Finck { "\\/foo", 1 },
46c2c66affSColin Finck { "/\\foo", 1 },
47c2c66affSColin Finck { "\\\\", 1 },
48c2c66affSColin Finck { "//", 1 },
49c2c66affSColin Finck { "c:\\foo", 2 },
50c2c66affSColin Finck { "c:/foo", 2 },
51c2c66affSColin Finck { "c://foo", 2 },
52c2c66affSColin Finck { "c:\\", 2 },
53c2c66affSColin Finck { "c:/", 2 },
54c2c66affSColin Finck { "c:foo", 3 },
55c2c66affSColin Finck { "c:f\\oo", 3 },
56c2c66affSColin Finck { "c:foo/bar", 3 },
57c2c66affSColin Finck { "\\foo", 4 },
58c2c66affSColin Finck { "/foo", 4 },
59c2c66affSColin Finck { "\\", 4 },
60c2c66affSColin Finck { "/", 4 },
61c2c66affSColin Finck { "foo", 5 },
62c2c66affSColin Finck { "", 5 },
63c2c66affSColin Finck { "\0:foo", 5 },
64c2c66affSColin Finck { "\\\\.\\foo", 6 },
65c2c66affSColin Finck { "//./foo", 6 },
66c2c66affSColin Finck { "/\\./foo", 6 },
67c2c66affSColin Finck { "\\\\.foo", 1 },
68c2c66affSColin Finck { "//.foo", 1 },
69c2c66affSColin Finck { "\\\\.", 7 },
70c2c66affSColin Finck { "//.", 7 },
71c2c66affSColin Finck { NULL, 0 }
72c2c66affSColin Finck };
73c2c66affSColin Finck
74c2c66affSColin Finck const struct test *test;
75c2c66affSColin Finck WCHAR buffer[MAX_PATH];
76c2c66affSColin Finck UINT ret;
77c2c66affSColin Finck
78c2c66affSColin Finck if (!pRtlDetermineDosPathNameType_U)
79c2c66affSColin Finck {
80c2c66affSColin Finck win_skip("RtlDetermineDosPathNameType_U is not available\n");
81c2c66affSColin Finck return;
82c2c66affSColin Finck }
83c2c66affSColin Finck
84c2c66affSColin Finck for (test = tests; test->path; test++)
85c2c66affSColin Finck {
86c2c66affSColin Finck pRtlMultiByteToUnicodeN( buffer, sizeof(buffer), NULL, test->path, strlen(test->path)+1 );
87c2c66affSColin Finck ret = pRtlDetermineDosPathNameType_U( buffer );
88c2c66affSColin Finck ok( ret == test->ret, "Wrong result %d/%d for %s\n", ret, test->ret, test->path );
89c2c66affSColin Finck }
90c2c66affSColin Finck }
91c2c66affSColin Finck
92c2c66affSColin Finck
test_RtlIsDosDeviceName_U(void)93c2c66affSColin Finck static void test_RtlIsDosDeviceName_U(void)
94c2c66affSColin Finck {
95c2c66affSColin Finck struct test
96c2c66affSColin Finck {
97c2c66affSColin Finck const char *path;
98c2c66affSColin Finck WORD pos;
99c2c66affSColin Finck WORD len;
100c2c66affSColin Finck BOOL fails;
101c2c66affSColin Finck };
102c2c66affSColin Finck
103c2c66affSColin Finck static const struct test tests[] =
104c2c66affSColin Finck {
105c2c66affSColin Finck { "\\\\.\\CON", 8, 6, TRUE }, /* fails on win8 */
106c2c66affSColin Finck { "\\\\.\\con", 8, 6, TRUE }, /* fails on win8 */
107c2c66affSColin Finck { "\\\\.\\CON2", 0, 0 },
108c2c66affSColin Finck { "", 0, 0 },
109c2c66affSColin Finck { "\\\\foo\\nul", 0, 0 },
110c2c66affSColin Finck { "c:\\nul:", 6, 6 },
111c2c66affSColin Finck { "c:\\nul\\", 0, 0 },
112c2c66affSColin Finck { "c:\\nul\\foo", 0, 0 },
113c2c66affSColin Finck { "c:\\nul::", 6, 6, TRUE }, /* fails on nt4 */
114c2c66affSColin Finck { "c:\\nul::::::", 6, 6, TRUE }, /* fails on nt4 */
115c2c66affSColin Finck { "c:prn ", 4, 6 },
116c2c66affSColin Finck { "c:prn.......", 4, 6 },
117c2c66affSColin Finck { "c:prn... ...", 4, 6 },
118c2c66affSColin Finck { "c:NUL .... ", 4, 6, TRUE }, /* fails on nt4 */
119c2c66affSColin Finck { "c: . . .", 0, 0 },
120c2c66affSColin Finck { "c:", 0, 0 },
121c2c66affSColin Finck { " . . . :", 0, 0 },
122c2c66affSColin Finck { ":", 0, 0 },
123c2c66affSColin Finck { "c:nul. . . :", 4, 6 },
124c2c66affSColin Finck { "c:nul . . :", 4, 6, TRUE }, /* fails on nt4 */
125c2c66affSColin Finck { "c:nul0", 0, 0 },
126c2c66affSColin Finck { "c:prn:aaa", 4, 6, TRUE }, /* fails on win9x */
127c2c66affSColin Finck { "c:PRN:.txt", 4, 6 },
128c2c66affSColin Finck { "c:aux:.txt...", 4, 6 },
129c2c66affSColin Finck { "c:prn:.txt:", 4, 6 },
130c2c66affSColin Finck { "c:nul:aaa", 4, 6, TRUE }, /* fails on win9x */
131c2c66affSColin Finck { "con:", 0, 6 },
132c2c66affSColin Finck { "lpt1:", 0, 8 },
133c2c66affSColin Finck { "c:com5:", 4, 8 },
134c2c66affSColin Finck { "CoM4:", 0, 8 },
135c2c66affSColin Finck { "lpt9:", 0, 8 },
136c2c66affSColin Finck { "c:\\lpt0.txt", 0, 0 },
137c2c66affSColin Finck { "c:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
138c2c66affSColin Finck "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
139c2c66affSColin Finck "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
140c2c66affSColin Finck "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
141c2c66affSColin Finck "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
142c2c66affSColin Finck "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
143c2c66affSColin Finck "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\nul.txt", 1000, 6 },
144c2c66affSColin Finck // ReactOS r54114
145c2c66affSColin Finck { "c:\\nul", 6, 6 },
146c2c66affSColin Finck { NULL, 0 }
147c2c66affSColin Finck };
148c2c66affSColin Finck
149c2c66affSColin Finck const struct test *test;
150c2c66affSColin Finck WCHAR buffer[2000];
151c2c66affSColin Finck ULONG ret;
152c2c66affSColin Finck
153c2c66affSColin Finck if (!pRtlIsDosDeviceName_U)
154c2c66affSColin Finck {
155c2c66affSColin Finck win_skip("RtlIsDosDeviceName_U is not available\n");
156c2c66affSColin Finck return;
157c2c66affSColin Finck }
158c2c66affSColin Finck
159c2c66affSColin Finck for (test = tests; test->path; test++)
160c2c66affSColin Finck {
161c2c66affSColin Finck pRtlMultiByteToUnicodeN( buffer, sizeof(buffer), NULL, test->path, strlen(test->path)+1 );
162c2c66affSColin Finck ret = pRtlIsDosDeviceName_U( buffer );
163c2c66affSColin Finck ok( ret == MAKELONG( test->len, test->pos ) ||
164c2c66affSColin Finck (test->fails && broken( ret == 0 )),
165c2c66affSColin Finck "Wrong result (%d,%d)/(%d,%d) for %s\n",
166c2c66affSColin Finck HIWORD(ret), LOWORD(ret), test->pos, test->len, test->path );
167c2c66affSColin Finck }
168c2c66affSColin Finck }
169c2c66affSColin Finck
test_RtlIsNameLegalDOS8Dot3(void)170c2c66affSColin Finck static void test_RtlIsNameLegalDOS8Dot3(void)
171c2c66affSColin Finck {
172c2c66affSColin Finck struct test
173c2c66affSColin Finck {
174c2c66affSColin Finck const char *path;
175c2c66affSColin Finck BOOLEAN result;
176c2c66affSColin Finck BOOLEAN spaces;
177c2c66affSColin Finck };
178c2c66affSColin Finck
179c2c66affSColin Finck static const struct test tests[] =
180c2c66affSColin Finck {
181c2c66affSColin Finck { "12345678", TRUE, FALSE },
182c2c66affSColin Finck { "123 5678", TRUE, TRUE },
183c2c66affSColin Finck { "12345678.", FALSE, 2 /*not set*/ },
184c2c66affSColin Finck { "1234 678.", FALSE, 2 /*not set*/ },
185c2c66affSColin Finck { "12345678.a", TRUE, FALSE },
186c2c66affSColin Finck { "12345678.a ", FALSE, 2 /*not set*/ },
187c2c66affSColin Finck { "12345678.a c", TRUE, TRUE },
188c2c66affSColin Finck { " 2345678.a ", FALSE, 2 /*not set*/ },
189c2c66affSColin Finck { "1 345678.abc", TRUE, TRUE },
190c2c66affSColin Finck { "1 8.a c", TRUE, TRUE },
191c2c66affSColin Finck { "1 3 5 7 .abc", FALSE, 2 /*not set*/ },
192c2c66affSColin Finck { "12345678. c", TRUE, TRUE },
193c2c66affSColin Finck { "123456789.a", FALSE, 2 /*not set*/ },
194c2c66affSColin Finck { "12345.abcd", FALSE, 2 /*not set*/ },
195c2c66affSColin Finck { "12345.ab d", FALSE, 2 /*not set*/ },
196c2c66affSColin Finck { ".abc", FALSE, 2 /*not set*/ },
197c2c66affSColin Finck { "12.abc.d", FALSE, 2 /*not set*/ },
198c2c66affSColin Finck { ".", TRUE, FALSE },
199c2c66affSColin Finck { "..", TRUE, FALSE },
200c2c66affSColin Finck { "...", FALSE, 2 /*not set*/ },
201c2c66affSColin Finck { "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", FALSE, 2 /*not set*/ },
202c2c66affSColin Finck { NULL, 0 }
203c2c66affSColin Finck };
204c2c66affSColin Finck
205c2c66affSColin Finck const struct test *test;
206c2c66affSColin Finck UNICODE_STRING ustr;
207c2c66affSColin Finck OEM_STRING oem, oem_ret;
208c2c66affSColin Finck WCHAR buffer[200];
209c2c66affSColin Finck char buff2[12];
210c2c66affSColin Finck BOOLEAN ret, spaces;
211c2c66affSColin Finck
212c2c66affSColin Finck if (!pRtlIsNameLegalDOS8Dot3)
213c2c66affSColin Finck {
214c2c66affSColin Finck win_skip("RtlIsNameLegalDOS8Dot3 is not available\n");
215c2c66affSColin Finck return;
216c2c66affSColin Finck }
217c2c66affSColin Finck
218c2c66affSColin Finck ustr.MaximumLength = sizeof(buffer);
219c2c66affSColin Finck ustr.Buffer = buffer;
220c2c66affSColin Finck for (test = tests; test->path; test++)
221c2c66affSColin Finck {
222c2c66affSColin Finck char path[100];
223c2c66affSColin Finck strcpy(path, test->path);
224c2c66affSColin Finck oem.Buffer = path;
225c2c66affSColin Finck oem.Length = strlen(test->path);
226c2c66affSColin Finck oem.MaximumLength = oem.Length + 1;
227c2c66affSColin Finck pRtlOemStringToUnicodeString( &ustr, &oem, FALSE );
228c2c66affSColin Finck spaces = 2;
229c2c66affSColin Finck oem_ret.Length = oem_ret.MaximumLength = sizeof(buff2);
230c2c66affSColin Finck oem_ret.Buffer = buff2;
231c2c66affSColin Finck ret = pRtlIsNameLegalDOS8Dot3( &ustr, &oem_ret, &spaces );
232c2c66affSColin Finck ok( ret == test->result, "Wrong result %d/%d for '%s'\n", ret, test->result, test->path );
233c2c66affSColin Finck ok( spaces == test->spaces, "Wrong spaces value %d/%d for '%s'\n", spaces, test->spaces, test->path );
234c2c66affSColin Finck if (strlen(test->path) <= 12)
235c2c66affSColin Finck {
236c2c66affSColin Finck char str[13];
237c2c66affSColin Finck int i;
238c2c66affSColin Finck strcpy( str, test->path );
239c2c66affSColin Finck for (i = 0; str[i]; i++) str[i] = toupper(str[i]);
240c2c66affSColin Finck ok( oem_ret.Length == strlen(test->path), "Wrong length %d/%d for '%s'\n",
241c2c66affSColin Finck oem_ret.Length, lstrlenA(test->path), test->path );
242c2c66affSColin Finck ok( !memcmp( oem_ret.Buffer, str, oem_ret.Length ),
243c2c66affSColin Finck "Wrong string '%.*s'/'%s'\n", oem_ret.Length, oem_ret.Buffer, str );
244c2c66affSColin Finck }
245c2c66affSColin Finck }
246c2c66affSColin Finck }
test_RtlGetFullPathName_U(void)247c2c66affSColin Finck static void test_RtlGetFullPathName_U(void)
248c2c66affSColin Finck {
249c2c66affSColin Finck static const WCHAR emptyW[] = {0};
250c2c66affSColin Finck static const WCHAR deadbeefW[] = {'d','e','a','d','b','e','e','f',0};
251c2c66affSColin Finck
252c2c66affSColin Finck struct test
253c2c66affSColin Finck {
254c2c66affSColin Finck const char *path;
255c2c66affSColin Finck const char *rname;
256c2c66affSColin Finck const char *rfile;
257c2c66affSColin Finck const char *alt_rname;
258c2c66affSColin Finck const char *alt_rfile;
259c2c66affSColin Finck };
260c2c66affSColin Finck
261c2c66affSColin Finck static const struct test tests[] =
262c2c66affSColin Finck {
263c2c66affSColin Finck { "c:/test", "c:\\test", "test"},
264c2c66affSColin Finck { "c:/test ", "c:\\test", "test"},
265c2c66affSColin Finck { "c:/test.", "c:\\test", "test"},
266c2c66affSColin Finck { "c:/test .... .. ", "c:\\test", "test"},
267c2c66affSColin Finck { "c:/test/ .... .. ", "c:\\test\\", NULL},
268c2c66affSColin Finck { "c:/test/..", "c:\\", NULL},
269c2c66affSColin Finck { "c:/test/.. ", "c:\\test\\", NULL},
270f7932ba2SAmine Khaldi { "c:/TEST", "c:\\TEST", "TEST"},
271c2c66affSColin Finck { "c:/test/file", "c:\\test\\file", "file"},
272c2c66affSColin Finck { "c:/test./file", "c:\\test\\file", "file"},
273c2c66affSColin Finck { "c:/test.. /file", "c:\\test.. \\file","file"},
274c2c66affSColin Finck { "c:/test/././file", "c:\\test\\file", "file"},
275c2c66affSColin Finck { "c:/test\\.\\.\\file", "c:\\test\\file", "file"},
276c2c66affSColin Finck { "c:/test/\\.\\.\\file", "c:\\test\\file", "file"},
277c2c66affSColin Finck { "c:/test\\\\.\\.\\file", "c:\\test\\file", "file"},
278c2c66affSColin Finck { "c:/test\\test1\\..\\.\\file", "c:\\test\\file", "file"},
279c2c66affSColin Finck { "c:///test\\.\\.\\file//", "c:\\test\\file\\", NULL,
280c2c66affSColin Finck "c:\\test\\file", "file"}, /* nt4 */
281c2c66affSColin Finck { "c:///test\\..\\file\\..\\//", "c:\\", NULL},
282c2c66affSColin Finck { "c:/test../file", "c:\\test.\\file", "file",
283c2c66affSColin Finck "c:\\test..\\file", "file"}, /* vista */
284f7932ba2SAmine Khaldi { "c:\\test", "c:\\test", "test"},
285c2c66affSColin Finck { NULL, NULL, NULL}
286c2c66affSColin Finck };
287c2c66affSColin Finck
288c2c66affSColin Finck const struct test *test;
289c2c66affSColin Finck WCHAR pathbufW[2*MAX_PATH], rbufferW[MAX_PATH];
290c2c66affSColin Finck CHAR rbufferA[MAX_PATH], rfileA[MAX_PATH];
291c2c66affSColin Finck ULONG ret;
292c2c66affSColin Finck WCHAR *file_part;
293c2c66affSColin Finck DWORD reslen;
294c2c66affSColin Finck UINT len;
295c2c66affSColin Finck
296c2c66affSColin Finck if (!pRtlGetFullPathName_U)
297c2c66affSColin Finck {
298c2c66affSColin Finck win_skip("RtlGetFullPathName_U is not available\n");
299c2c66affSColin Finck return;
300c2c66affSColin Finck }
301c2c66affSColin Finck
302c2c66affSColin Finck file_part = (WCHAR *)0xdeadbeef;
303c2c66affSColin Finck lstrcpyW(rbufferW, deadbeefW);
304c2c66affSColin Finck ret = pRtlGetFullPathName_U(NULL, MAX_PATH, rbufferW, &file_part);
305c2c66affSColin Finck ok(!ret, "Expected RtlGetFullPathName_U to return 0, got %u\n", ret);
306c2c66affSColin Finck ok(!lstrcmpW(rbufferW, deadbeefW),
307c2c66affSColin Finck "Expected the output buffer to be untouched, got %s\n", wine_dbgstr_w(rbufferW));
308c2c66affSColin Finck ok(file_part == (WCHAR *)0xdeadbeef ||
309c2c66affSColin Finck file_part == NULL, /* Win7 */
310c2c66affSColin Finck "Expected file part pointer to be untouched, got %p\n", file_part);
311c2c66affSColin Finck
312c2c66affSColin Finck file_part = (WCHAR *)0xdeadbeef;
313c2c66affSColin Finck lstrcpyW(rbufferW, deadbeefW);
314c2c66affSColin Finck ret = pRtlGetFullPathName_U(emptyW, MAX_PATH, rbufferW, &file_part);
315c2c66affSColin Finck ok(!ret, "Expected RtlGetFullPathName_U to return 0, got %u\n", ret);
316c2c66affSColin Finck ok(!lstrcmpW(rbufferW, deadbeefW),
317c2c66affSColin Finck "Expected the output buffer to be untouched, got %s\n", wine_dbgstr_w(rbufferW));
318c2c66affSColin Finck ok(file_part == (WCHAR *)0xdeadbeef ||
319c2c66affSColin Finck file_part == NULL, /* Win7 */
320c2c66affSColin Finck "Expected file part pointer to be untouched, got %p\n", file_part);
321c2c66affSColin Finck
322c2c66affSColin Finck for (test = tests; test->path; test++)
323c2c66affSColin Finck {
324c2c66affSColin Finck len= strlen(test->rname) * sizeof(WCHAR);
325c2c66affSColin Finck pRtlMultiByteToUnicodeN(pathbufW , sizeof(pathbufW), NULL, test->path, strlen(test->path)+1 );
326c2c66affSColin Finck ret = pRtlGetFullPathName_U( pathbufW,MAX_PATH, rbufferW, &file_part);
327c2c66affSColin Finck ok( ret == len || (test->alt_rname && ret == strlen(test->alt_rname)*sizeof(WCHAR)),
328c2c66affSColin Finck "Wrong result %d/%d for \"%s\"\n", ret, len, test->path );
329c2c66affSColin Finck ok(pRtlUnicodeToMultiByteN(rbufferA,MAX_PATH,&reslen,rbufferW,(lstrlenW(rbufferW) + 1) * sizeof(WCHAR)) == STATUS_SUCCESS,
330c2c66affSColin Finck "RtlUnicodeToMultiByteN failed\n");
331f7932ba2SAmine Khaldi ok(!lstrcmpA(rbufferA,test->rname) || (test->alt_rname && !lstrcmpA(rbufferA,test->alt_rname)),
332c2c66affSColin Finck "Got \"%s\" expected \"%s\"\n",rbufferA,test->rname);
333c2c66affSColin Finck if (file_part)
334c2c66affSColin Finck {
335c2c66affSColin Finck ok(pRtlUnicodeToMultiByteN(rfileA,MAX_PATH,&reslen,file_part,(lstrlenW(file_part) + 1) * sizeof(WCHAR)) == STATUS_SUCCESS,
336c2c66affSColin Finck "RtlUnicodeToMultiByteN failed\n");
337f7932ba2SAmine Khaldi ok((test->rfile && !lstrcmpA(rfileA,test->rfile)) ||
338f7932ba2SAmine Khaldi (test->alt_rfile && !lstrcmpA(rfileA,test->alt_rfile)),
339c2c66affSColin Finck "Got \"%s\" expected \"%s\"\n",rfileA,test->rfile);
340c2c66affSColin Finck }
341c2c66affSColin Finck else
342c2c66affSColin Finck {
343c2c66affSColin Finck ok( !test->rfile, "Got NULL expected \"%s\"\n", test->rfile );
344c2c66affSColin Finck }
345c2c66affSColin Finck }
346c2c66affSColin Finck }
347c2c66affSColin Finck
test_RtlDosPathNameToNtPathName_U_WithStatus(void)348*4ba4c415SAmine Khaldi static void test_RtlDosPathNameToNtPathName_U_WithStatus(void)
349*4ba4c415SAmine Khaldi {
350*4ba4c415SAmine Khaldi static const WCHAR emptyW[] = { 0 };
351*4ba4c415SAmine Khaldi WCHAR path[MAX_PATH];
352*4ba4c415SAmine Khaldi UNICODE_STRING nameW;
353*4ba4c415SAmine Khaldi NTSTATUS status;
354*4ba4c415SAmine Khaldi
355*4ba4c415SAmine Khaldi if (!pRtlDosPathNameToNtPathName_U_WithStatus)
356*4ba4c415SAmine Khaldi {
357*4ba4c415SAmine Khaldi win_skip("RtlDosPathNameToNtPathName_U_WithStatus() is not supported.\n");
358*4ba4c415SAmine Khaldi return;
359*4ba4c415SAmine Khaldi }
360*4ba4c415SAmine Khaldi
361*4ba4c415SAmine Khaldi GetCurrentDirectoryW( MAX_PATH, path );
362*4ba4c415SAmine Khaldi
363*4ba4c415SAmine Khaldi status = pRtlDosPathNameToNtPathName_U_WithStatus( path, &nameW, NULL, NULL );
364*4ba4c415SAmine Khaldi ok(!status, "Failed convert to nt path, %#x.\n", status);
365*4ba4c415SAmine Khaldi
366*4ba4c415SAmine Khaldi status = pRtlDosPathNameToNtPathName_U_WithStatus( NULL, &nameW, NULL, NULL );
367*4ba4c415SAmine Khaldi ok(status == STATUS_OBJECT_NAME_INVALID || broken(status == STATUS_OBJECT_PATH_NOT_FOUND) /* W2k3 */,
368*4ba4c415SAmine Khaldi "Unexpected status %#x.\n", status);
369*4ba4c415SAmine Khaldi
370*4ba4c415SAmine Khaldi status = pRtlDosPathNameToNtPathName_U_WithStatus( emptyW, &nameW, NULL, NULL );
371*4ba4c415SAmine Khaldi ok(status == STATUS_OBJECT_NAME_INVALID || broken(status == STATUS_OBJECT_PATH_NOT_FOUND) /* W2k3 */,
372*4ba4c415SAmine Khaldi "Unexpected status %#x.\n", status);
373*4ba4c415SAmine Khaldi
374*4ba4c415SAmine Khaldi RtlFreeUnicodeString( &nameW );
375*4ba4c415SAmine Khaldi }
376*4ba4c415SAmine Khaldi
START_TEST(path)377c2c66affSColin Finck START_TEST(path)
378c2c66affSColin Finck {
379c2c66affSColin Finck HMODULE mod = GetModuleHandleA("ntdll.dll");
380c2c66affSColin Finck if (!mod)
381c2c66affSColin Finck {
382c2c66affSColin Finck win_skip("Not running on NT, skipping tests\n");
383c2c66affSColin Finck return;
384c2c66affSColin Finck }
385c2c66affSColin Finck
386c2c66affSColin Finck pRtlMultiByteToUnicodeN = (void *)GetProcAddress(mod,"RtlMultiByteToUnicodeN");
387c2c66affSColin Finck pRtlUnicodeToMultiByteN = (void *)GetProcAddress(mod,"RtlUnicodeToMultiByteN");
388c2c66affSColin Finck pRtlDetermineDosPathNameType_U = (void *)GetProcAddress(mod,"RtlDetermineDosPathNameType_U");
389c2c66affSColin Finck pRtlIsDosDeviceName_U = (void *)GetProcAddress(mod,"RtlIsDosDeviceName_U");
390c2c66affSColin Finck pRtlOemStringToUnicodeString = (void *)GetProcAddress(mod,"RtlOemStringToUnicodeString");
391c2c66affSColin Finck pRtlIsNameLegalDOS8Dot3 = (void *)GetProcAddress(mod,"RtlIsNameLegalDOS8Dot3");
392c2c66affSColin Finck pRtlGetFullPathName_U = (void *)GetProcAddress(mod,"RtlGetFullPathName_U");
393*4ba4c415SAmine Khaldi pRtlDosPathNameToNtPathName_U_WithStatus = (void *)GetProcAddress(mod, "RtlDosPathNameToNtPathName_U_WithStatus");
394c2c66affSColin Finck
395c2c66affSColin Finck test_RtlDetermineDosPathNameType_U();
396c2c66affSColin Finck test_RtlIsDosDeviceName_U();
397c2c66affSColin Finck test_RtlIsNameLegalDOS8Dot3();
398c2c66affSColin Finck test_RtlGetFullPathName_U();
399*4ba4c415SAmine Khaldi test_RtlDosPathNameToNtPathName_U_WithStatus();
400c2c66affSColin Finck }
401