ReactOS  0.4.14-dev-49-gfb4591c
directory.c
Go to the documentation of this file.
1 /* Unit test suite for Ntdll directory functions
2  *
3  * Copyright 2007 Jeff Latimer
4  * Copyright 2007 Andrey Turkin
5  * Copyright 2008 Jeff Zaroyko
6  * Copyright 2009 Dan Kegel
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21  *
22  * NOTES
23  * We use function pointers here as there is no import library for NTDLL on
24  * windows.
25  */
26 
27 #include <stdio.h>
28 #include <stdarg.h>
29 
30 #include "ntstatus.h"
31 /* Define WIN32_NO_STATUS so MSVC does not give us duplicate macro
32  * definition errors when we get to winnt.h
33  */
34 #define WIN32_NO_STATUS
35 
36 #include "wine/test.h"
37 #include "winnls.h"
38 #include "winternl.h"
39 
40 static NTSTATUS (WINAPI *pNtClose)( PHANDLE );
46 static BOOLEAN (WINAPI *pRtlCreateUnicodeStringFromAsciiz)(PUNICODE_STRING,LPCSTR);
47 static BOOL (WINAPI *pRtlDosPathNameToNtPathName_U)( LPCWSTR, PUNICODE_STRING, PWSTR*, CURDIR* );
48 static VOID (WINAPI *pRtlInitUnicodeString)( PUNICODE_STRING, LPCWSTR );
49 static VOID (WINAPI *pRtlFreeUnicodeString)( PUNICODE_STRING );
50 static LONG (WINAPI *pRtlCompareUnicodeString)( const UNICODE_STRING*, const UNICODE_STRING*,BOOLEAN );
51 static NTSTATUS (WINAPI *pRtlMultiByteToUnicodeN)( LPWSTR dst, DWORD dstlen, LPDWORD reslen,
53 static NTSTATUS (WINAPI *pRtlWow64EnableFsRedirection)( BOOLEAN enable );
54 static NTSTATUS (WINAPI *pRtlWow64EnableFsRedirectionEx)( ULONG disable, ULONG *old_value );
55 
56 /* The attribute sets to test */
57 static struct testfile_s {
58  BOOL attr_done; /* set if attributes were tested for this file already */
59  const DWORD attr; /* desired attribute */
60  WCHAR name[20]; /* filename to use */
61  const char *target; /* what to point to (only for reparse pts) */
62  const char *description; /* for error messages */
63  int nfound; /* How many were found (expect 1) */
64 } testfiles[] = {
65  { 0, FILE_ATTRIBUTE_NORMAL, {'l','o','n','g','f','i','l','e','n','a','m','e','.','t','m','p'}, "normal" },
66  { 0, FILE_ATTRIBUTE_NORMAL, {'n','.','t','m','p',}, "normal" },
67  { 0, FILE_ATTRIBUTE_HIDDEN, {'h','.','t','m','p',}, "hidden" },
68  { 0, FILE_ATTRIBUTE_SYSTEM, {'s','.','t','m','p',}, "system" },
69  { 0, FILE_ATTRIBUTE_DIRECTORY, {'d','.','t','m','p',}, "directory" },
70  { 0, FILE_ATTRIBUTE_NORMAL, {0xe9,'a','.','t','m','p'}, "normal" },
71  { 0, FILE_ATTRIBUTE_NORMAL, {0xc9,'b','.','t','m','p'}, "normal" },
72  { 0, FILE_ATTRIBUTE_NORMAL, {'e','a','.','t','m','p'}, "normal" },
73  { 0, FILE_ATTRIBUTE_DIRECTORY, {'.'}, ". directory" },
74  { 0, FILE_ATTRIBUTE_DIRECTORY, {'.','.'}, ".. directory" }
75 };
76 static const int test_dir_count = sizeof(testfiles) / sizeof(testfiles[0]);
77 static const int max_test_dir_size = sizeof(testfiles) / sizeof(testfiles[0]) + 5; /* size of above plus some for .. etc */
78 
79 static const WCHAR dummyW[] = {'d','u','m','m','y',0};
80 static const WCHAR dotW[] = {'.',0};
81 static const WCHAR dotdotW[] = {'.','.',0};
82 static const WCHAR backslashW[] = {'\\',0};
83 
84 /* Create a test directory full of attribute test files, clear counts */
85 static void set_up_attribute_test(const WCHAR *testdir)
86 {
87  int i;
88  BOOL ret;
89 
90  ret = CreateDirectoryW(testdir, NULL);
91  ok(ret, "couldn't create dir %s, error %d\n", wine_dbgstr_w(testdir), GetLastError());
92 
93  for (i=0; i < test_dir_count; i++) {
95 
96  if (lstrcmpW(testfiles[i].name, dotW) == 0 || lstrcmpW(testfiles[i].name, dotdotW) == 0)
97  continue;
98  lstrcpyW( buf, testdir );
100  lstrcatW( buf, testfiles[i].name );
103  ok(ret, "couldn't create dir %s, error %d\n", wine_dbgstr_w(buf), GetLastError());
104  } else {
107  0, NULL, CREATE_ALWAYS,
108  testfiles[i].attr, 0);
109  ok( h != INVALID_HANDLE_VALUE, "failed to create temp file %s\n", wine_dbgstr_w(buf) );
110  CloseHandle(h);
111  }
112  }
113 }
114 
115 static void reset_found_files(void)
116 {
117  int i;
118 
119  for (i = 0; i < test_dir_count; i++)
120  testfiles[i].nfound = 0;
121 }
122 
123 /* Remove the given test directory and the attribute test files, if any */
124 static void tear_down_attribute_test(const WCHAR *testdir)
125 {
126  int i;
127 
128  for (i = 0; i < test_dir_count; i++) {
129  int ret;
130  WCHAR buf[MAX_PATH];
131  if (lstrcmpW(testfiles[i].name, dotW) == 0 || lstrcmpW(testfiles[i].name, dotdotW) == 0)
132  continue;
133  lstrcpyW( buf, testdir );
134  lstrcatW( buf, backslashW );
135  lstrcatW( buf, testfiles[i].name );
139  "Failed to rmdir %s, error %d\n", wine_dbgstr_w(buf), GetLastError());
140  } else {
141  ret = DeleteFileW(buf);
143  "Failed to rm %s, error %d\n", wine_dbgstr_w(buf), GetLastError());
144  }
145  }
146  RemoveDirectoryW(testdir);
147 }
148 
149 /* Match one found file against testfiles[], increment count if found */
151 {
152  int i;
153  DWORD attribmask =
155  DWORD attrib = dir_info->FileAttributes & attribmask;
156  WCHAR *nameW = dir_info->FileName;
157  int namelen = dir_info->FileNameLength / sizeof(WCHAR);
158 
159  for (i = 0; i < test_dir_count; i++) {
160  int len = lstrlenW(testfiles[i].name);
161  if (namelen != len || memcmp(nameW, testfiles[i].name, len*sizeof(WCHAR)))
162  continue;
163  if (!testfiles[i].attr_done) {
164  ok (attrib == (testfiles[i].attr & attribmask), "file %s: expected %s (%x), got %x (is your linux new enough?)\n", wine_dbgstr_w(testfiles[i].name), testfiles[i].description, testfiles[i].attr, attrib);
165  testfiles[i].attr_done = TRUE;
166  }
167  testfiles[i].nfound++;
168  break;
169  }
170  ok(i < test_dir_count, "unexpected file found %s\n", wine_dbgstr_wn(dir_info->FileName, namelen));
171 }
172 
173 static void test_flags_NtQueryDirectoryFile(OBJECT_ATTRIBUTES *attr, const char *testdirA,
175  BOOLEAN single_entry, BOOLEAN restart_flag)
176 {
177  UNICODE_STRING dummy_mask;
178  HANDLE dirh, new_dirh;
180  UINT data_pos, data_size;
181  UINT data_len; /* length of dir data */
182  BYTE data[8192]; /* directory data */
185  int numfiles;
186  int i;
187 
189  pRtlInitUnicodeString( &dummy_mask, dummyW );
190 
191  data_size = mask ? offsetof( FILE_BOTH_DIRECTORY_INFORMATION, FileName[256] ) : sizeof(data);
192 
193  /* Read the directory and note which files are found */
194  status = pNtOpenFile( &dirh, SYNCHRONIZE | FILE_LIST_DIRECTORY, attr, &io, FILE_SHARE_READ,
196  ok (status == STATUS_SUCCESS, "failed to open dir '%s', ret 0x%x, error %d\n", testdirA, status, GetLastError());
197  if (status != STATUS_SUCCESS) {
198  skip("can't test if we can't open the directory\n");
199  return;
200  }
201 
202  U(io).Status = 0xdeadbeef;
203  status = pNtQueryDirectoryFile( dirh, NULL, NULL, NULL, &io, data, data_size,
204  FileBothDirectoryInformation, single_entry, mask, restart_flag );
205  ok (status == STATUS_SUCCESS, "failed to query directory; status %x\n", status);
206  ok (U(io).Status == STATUS_SUCCESS, "failed to query directory; status %x\n", U(io).Status);
207  data_len = io.Information;
208  ok (data_len >= sizeof(FILE_BOTH_DIRECTORY_INFORMATION), "not enough data in directory\n");
209 
210  DuplicateHandle( GetCurrentProcess(), dirh, GetCurrentProcess(), &new_dirh,
212  pNtClose(dirh);
213 
214  data_pos = 0;
215  numfiles = 0;
216  while ((data_pos < data_len) && (numfiles < max_test_dir_size)) {
217  dir_info = (FILE_BOTH_DIRECTORY_INFORMATION *)(data + data_pos);
218 
219  tally_test_file(dir_info);
220 
221  if (dir_info->NextEntryOffset == 0) {
222  U(io).Status = 0xdeadbeef;
223  status = pNtQueryDirectoryFile( new_dirh, 0, NULL, NULL, &io, data, data_size,
224  FileBothDirectoryInformation, single_entry, &dummy_mask, FALSE );
225  ok (U(io).Status == status, "wrong status %x / %x\n", status, U(io).Status);
226  if (status == STATUS_NO_MORE_FILES) break;
227  ok (status == STATUS_SUCCESS, "failed to query directory; status %x\n", status);
228  data_len = io.Information;
229  if (data_len < sizeof(FILE_BOTH_DIRECTORY_INFORMATION))
230  break;
231  data_pos = 0;
232  } else {
233  data_pos += dir_info->NextEntryOffset;
234  }
235  numfiles++;
236  }
237  ok(numfiles < max_test_dir_size, "too many loops\n");
238 
239  if (mask)
240  for (i = 0; i < test_dir_count; i++)
241  ok(testfiles[i].nfound == (testfiles[i].name == mask->Buffer),
242  "Wrong number %d of %s files found (single_entry=%d,mask=%s)\n",
243  testfiles[i].nfound, testfiles[i].description, single_entry,
244  wine_dbgstr_wn(mask->Buffer, mask->Length/sizeof(WCHAR) ));
245  else
246  for (i = 0; i < test_dir_count; i++)
247  ok(testfiles[i].nfound == 1, "Wrong number %d of %s files found (single_entry=%d,restart=%d)\n",
248  testfiles[i].nfound, testfiles[i].description, single_entry, restart_flag);
249  pNtClose(new_dirh);
250 }
251 
252 static void test_directory_sort( const WCHAR *testdir )
253 {
255  UNICODE_STRING ntdirname;
257  UINT data_pos, data_len, count;
258  BYTE data[8192];
259  WCHAR prev[MAX_PATH], name[MAX_PATH];
260  UNICODE_STRING prev_str, name_str;
263  HANDLE handle;
264  int res;
265 
266  if (!pRtlDosPathNameToNtPathName_U( testdir, &ntdirname, NULL, NULL ))
267  {
268  ok(0, "RtlDosPathNametoNtPathName_U failed\n");
269  return;
270  }
274  ok(status == STATUS_SUCCESS, "failed to open dir %s\n", wine_dbgstr_w(testdir) );
275 
276  U(io).Status = 0xdeadbeef;
277  status = pNtQueryDirectoryFile( handle, NULL, NULL, NULL, &io, data, sizeof(data),
279  ok( status == STATUS_SUCCESS, "failed to query directory; status %x\n", status );
280  ok( U(io).Status == STATUS_SUCCESS, "failed to query directory; status %x\n", U(io).Status );
281  data_len = io.Information;
282  ok( data_len >= sizeof(FILE_BOTH_DIRECTORY_INFORMATION), "not enough data in directory\n" );
283  data_pos = 0;
284  count = 0;
285 
286  while (data_pos < data_len)
287  {
288  info = (FILE_BOTH_DIRECTORY_INFORMATION *)(data + data_pos);
289 
290  memcpy( name, info->FileName, info->FileNameLength );
291  name[info->FileNameLength / sizeof(WCHAR)] = 0;
292  switch (count)
293  {
294  case 0: /* first entry must be '.' */
295  ok( !lstrcmpW( name, dotW ), "wrong name %s\n", wine_dbgstr_w( name ));
296  break;
297  case 1: /* second entry must be '..' */
298  ok( !lstrcmpW( name, dotdotW ), "wrong name %s\n", wine_dbgstr_w( name ));
299  break;
300  case 2: /* nothing to compare against */
301  break;
302  default:
303  pRtlInitUnicodeString( &prev_str, prev );
304  pRtlInitUnicodeString( &name_str, name );
305  res = pRtlCompareUnicodeString( &prev_str, &name_str, TRUE );
306  ok( res < 0, "wrong result %d %s %s\n", res, wine_dbgstr_w( prev ), wine_dbgstr_w( name ));
307  break;
308  }
309  count++;
310  lstrcpyW( prev, name );
311 
312  if (info->NextEntryOffset == 0)
313  {
314  U(io).Status = 0xdeadbeef;
315  status = pNtQueryDirectoryFile( handle, 0, NULL, NULL, &io, data, sizeof(data),
317  ok (U(io).Status == status, "wrong status %x / %x\n", status, U(io).Status);
318  if (status == STATUS_NO_MORE_FILES) break;
319  ok( status == STATUS_SUCCESS, "failed to query directory; status %x\n", status );
320  data_len = io.Information;
321  data_pos = 0;
322  }
323  else data_pos += info->NextEntryOffset;
324  }
325 
326  pNtClose( handle );
327  pRtlFreeUnicodeString( &ntdirname );
328 }
329 
331 {
333  UINT data_size;
334  ULONG data[256];
336  int class;
337 
338  for (class = 0; class < FileMaximumInformation; class++)
339  {
340  U(io).Status = 0xdeadbeef;
341  U(io).Information = 0xdeadbeef;
342  data_size = 0;
343  memset( data, 0x55, sizeof(data) );
344 
345  status = pNtQueryDirectoryFile( handle, 0, NULL, NULL, &io, data, data_size,
346  class, FALSE, mask, TRUE );
347  ok( U(io).Status == 0xdeadbeef, "%u: wrong status %x\n", class, U(io).Status );
348  ok( U(io).Information == 0xdeadbeef, "%u: wrong info %lx\n", class, U(io).Information );
349  ok(data[0] == 0x55555555, "%u: wrong offset %x\n", class, data[0] );
350 
351  switch (class)
352  {
357  /* fall through */
367  ok( status == STATUS_INFO_LENGTH_MISMATCH, "%u: wrong status %x\n", class, status );
368  break;
369  default:
371  "%u: wrong status %x\n", class, status );
372  continue;
373  }
374 
375  for (data_size = 1; data_size < sizeof(data); data_size++)
376  {
377  status = pNtQueryDirectoryFile( handle, 0, NULL, NULL, &io, data, data_size,
378  class, FALSE, mask, TRUE );
380  {
381  ok( U(io).Status == STATUS_BUFFER_OVERFLOW, "%u: wrong status %x\n", class, U(io).Status );
382  ok( U(io).Information == data_size, "%u: wrong info %lx\n", class, U(io).Information );
383  ok(data[0] == 0, "%u: wrong offset %x\n", class, data[0] );
384  }
385  else
386  {
387  ok( U(io).Status == 0xdeadbeef, "%u: wrong status %x\n", class, U(io).Status );
388  ok( U(io).Information == 0xdeadbeef, "%u: wrong info %lx\n", class, U(io).Information );
389  ok(data[0] == 0x55555555, "%u: wrong offset %x\n", class, data[0] );
390  }
391  if (status != STATUS_INFO_LENGTH_MISMATCH) break;
392  }
393 
394  switch (class)
395  {
397  ok( status == STATUS_BUFFER_OVERFLOW, "%u: wrong status %x\n", class, status );
398  ok( data_size == ((offsetof( FILE_DIRECTORY_INFORMATION, FileName[1] ) + 7) & ~7),
399  "%u: wrong size %u\n", class, data_size );
400  break;
402  ok( status == STATUS_BUFFER_OVERFLOW, "%u: wrong status %x\n", class, status );
403  ok( data_size == ((offsetof( FILE_FULL_DIRECTORY_INFORMATION, FileName[1] ) + 7) & ~7),
404  "%u: wrong size %u\n", class, data_size );
405  break;
407  ok( status == STATUS_BUFFER_OVERFLOW, "%u: wrong status %x\n", class, status );
408  ok( data_size == ((offsetof( FILE_BOTH_DIRECTORY_INFORMATION, FileName[1] ) + 7) & ~7),
409  "%u: wrong size %u\n", class, data_size );
410  break;
412  ok( status == STATUS_BUFFER_OVERFLOW, "%u: wrong status %x\n", class, status );
413  ok( data_size == ((offsetof( FILE_NAMES_INFORMATION, FileName[1] ) + 7) & ~7),
414  "%u: wrong size %u\n", class, data_size );
415  break;
417  ok( status == STATUS_BUFFER_OVERFLOW, "%u: wrong status %x\n", class, status );
418  ok( data_size == ((offsetof( FILE_ID_BOTH_DIRECTORY_INFORMATION, FileName[1] ) + 7) & ~7),
419  "%u: wrong size %u\n", class, data_size );
420  break;
422  ok( status == STATUS_BUFFER_OVERFLOW, "%u: wrong status %x\n", class, status );
423  ok( data_size == ((offsetof( FILE_ID_FULL_DIRECTORY_INFORMATION, FileName[1] ) + 7) & ~7),
424  "%u: wrong size %u\n", class, data_size );
425  break;
427  ok( status == STATUS_BUFFER_OVERFLOW, "%u: wrong status %x\n", class, status );
428  ok( data_size == ((offsetof( FILE_ID_GLOBAL_TX_DIR_INFORMATION, FileName[1] ) + 7) & ~7),
429  "%u: wrong size %u\n", class, data_size );
430  break;
432  ok( status == STATUS_INVALID_INFO_CLASS, "%u: wrong status %x\n", class, status );
433  ok( data_size == sizeof(FILE_OBJECTID_INFORMATION), "%u: wrong size %u\n", class, data_size );
434  break;
436  ok( status == STATUS_INVALID_INFO_CLASS, "%u: wrong status %x\n", class, status );
437  ok( data_size == sizeof(FILE_QUOTA_INFORMATION), "%u: wrong size %u\n", class, data_size );
438  break;
440  ok( status == STATUS_INVALID_INFO_CLASS, "%u: wrong status %x\n", class, status );
441  ok( data_size == sizeof(FILE_REPARSE_POINT_INFORMATION), "%u: wrong size %u\n", class, data_size );
442  break;
443  }
444  }
445 }
446 
447 static void test_NtQueryDirectoryFile(void)
448 {
450  UNICODE_STRING ntdirname, mask;
451  char testdirA[MAX_PATH];
452  WCHAR testdirW[MAX_PATH];
453  int i;
455  WCHAR short_name[12];
456  UINT data_size;
457  BYTE data[8192];
459  FILE_POSITION_INFORMATION pos_info;
461  const WCHAR *filename = fbdi->FileName;
463  HANDLE dirh;
464 
465  /* Clean up from prior aborted run, if any, then set up test files */
466  ok(GetTempPathA(MAX_PATH, testdirA), "couldn't get temp dir\n");
467  strcat(testdirA, "NtQueryDirectoryFile.tmp");
468  pRtlMultiByteToUnicodeN(testdirW, sizeof(testdirW), NULL, testdirA, strlen(testdirA)+1);
469  tear_down_attribute_test(testdirW);
470  set_up_attribute_test(testdirW);
471 
472  if (!pRtlDosPathNameToNtPathName_U(testdirW, &ntdirname, NULL, NULL))
473  {
474  ok(0, "RtlDosPathNametoNtPathName_U failed\n");
475  goto done;
476  }
478 
483 
484  for (i = 0; i < test_dir_count; i++)
485  {
486  if (testfiles[i].name[0] == '.') continue; /* . and .. as masks are broken on Windows */
487  mask.Buffer = testfiles[i].name;
488  mask.Length = mask.MaximumLength = lstrlenW(testfiles[i].name) * sizeof(WCHAR);
493  }
494 
495  /* short path passed as mask */
496  status = pNtOpenFile(&dirh, SYNCHRONIZE | FILE_LIST_DIRECTORY, &attr, &io, FILE_SHARE_READ,
498  ok(status == STATUS_SUCCESS, "failed to open dir '%s'\n", testdirA);
499  if (status != STATUS_SUCCESS) {
500  skip("can't test if we can't open the directory\n");
501  return;
502  }
503  status = pNtQueryInformationFile( dirh, &io, &pos_info, sizeof(pos_info), FilePositionInformation );
504  ok( status == STATUS_SUCCESS, "NtQueryInformationFile failed %x\n", status );
505  ok( pos_info.CurrentByteOffset.QuadPart == 0, "wrong pos %s\n",
507 
508  pos_info.CurrentByteOffset.QuadPart = 0xbeef;
509  status = pNtSetInformationFile( dirh, &io, &pos_info, sizeof(pos_info), FilePositionInformation );
510  ok( status == STATUS_SUCCESS, "NtQueryInformationFile failed %x\n", status );
511 
512  status = pNtQueryInformationFile( dirh, &io, &pos_info, sizeof(pos_info), FilePositionInformation );
513  ok( status == STATUS_SUCCESS, "NtQueryInformationFile failed %x\n", status );
514  ok( pos_info.CurrentByteOffset.QuadPart == 0xbeef, "wrong pos %s\n",
516 
517  mask.Buffer = testfiles[0].name;
518  mask.Length = mask.MaximumLength = lstrlenW(testfiles[0].name) * sizeof(WCHAR);
520  U(io).Status = 0xdeadbeef;
521  status = pNtQueryDirectoryFile(dirh, 0, NULL, NULL, &io, data, data_size,
523  ok(status == STATUS_SUCCESS, "failed to query directory; status %x\n", status);
524  ok(U(io).Status == STATUS_SUCCESS, "failed to query directory; status %x\n", U(io).Status);
525  ok(fbdi->ShortName[0], "ShortName is empty\n");
526 
527  status = pNtQueryInformationFile( dirh, &io, &pos_info, sizeof(pos_info), FilePositionInformation );
528  ok( status == STATUS_SUCCESS, "NtQueryInformationFile failed %x\n", status );
529  ok( pos_info.CurrentByteOffset.QuadPart == 0xbeef, "wrong pos %s\n",
531 
532  mask.Length = mask.MaximumLength = fbdi->ShortNameLength;
533  memcpy(short_name, fbdi->ShortName, mask.Length);
534  mask.Buffer = short_name;
535  U(io).Status = 0xdeadbeef;
536  U(io).Information = 0xdeadbeef;
537  status = pNtQueryDirectoryFile(dirh, 0, NULL, NULL, &io, data, data_size,
539  ok(status == STATUS_SUCCESS, "failed to query directory status %x\n", status);
540  ok(U(io).Status == STATUS_SUCCESS, "failed to query directory status %x\n", U(io).Status);
542  "wrong info %lx\n", U(io).Information);
543  ok(fbdi->FileNameLength == lstrlenW(testfiles[0].name)*sizeof(WCHAR) &&
544  !memcmp(fbdi->FileName, testfiles[0].name, fbdi->FileNameLength),
545  "incorrect long file name: %s\n", wine_dbgstr_wn(fbdi->FileName,
546  fbdi->FileNameLength/sizeof(WCHAR)));
547 
548  status = pNtQueryInformationFile( dirh, &io, &pos_info, sizeof(pos_info), FilePositionInformation );
549  ok( status == STATUS_SUCCESS, "NtQueryInformationFile failed %x\n", status );
550  ok( pos_info.CurrentByteOffset.QuadPart == 0xbeef, "wrong pos %s\n",
552 
553  /* tests with short buffer */
554  memset( data, 0x55, data_size );
555  U(io).Status = 0xdeadbeef;
556  U(io).Information = 0xdeadbeef;
558  status = pNtQueryDirectoryFile(dirh, 0, NULL, NULL, &io, data, data_size,
560  ok( status == STATUS_BUFFER_OVERFLOW, "wrong status %x\n", status );
561  ok( U(io).Status == STATUS_BUFFER_OVERFLOW, "wrong status %x\n", U(io).Status );
562  ok( U(io).Information == data_size || broken( U(io).Information == 0),
563  "wrong info %lx\n", U(io).Information );
564  ok( fbdi->NextEntryOffset == 0, "wrong offset %x\n", fbdi->NextEntryOffset );
565  ok( fbdi->FileNameLength == lstrlenW(testfiles[0].name) * sizeof(WCHAR),
566  "wrong length %x\n", fbdi->FileNameLength );
567  ok( filename[0] == testfiles[0].name[0], "incorrect long file name: %s\n",
568  wine_dbgstr_wn(fbdi->FileName, fbdi->FileNameLength/sizeof(WCHAR)));
569  ok( filename[1] == 0x5555, "incorrect long file name: %s\n",
570  wine_dbgstr_wn(fbdi->FileName, fbdi->FileNameLength/sizeof(WCHAR)));
571 
573 
574  /* mask may or may not be ignored when restarting the search */
575  pRtlInitUnicodeString( &mask, dummyW );
576  U(io).Status = 0xdeadbeef;
578  status = pNtQueryDirectoryFile(dirh, 0, NULL, NULL, &io, data, data_size,
580  ok( status == STATUS_SUCCESS || status == STATUS_NO_MORE_FILES, "wrong status %x\n", status );
581  ok( U(io).Status == status, "wrong status %x / %x\n", U(io).Status, status );
582  if (!status)
583  ok( fbdi->FileNameLength == lstrlenW(testfiles[0].name)*sizeof(WCHAR) &&
584  !memcmp(fbdi->FileName, testfiles[0].name, fbdi->FileNameLength),
585  "incorrect long file name: %s\n",
586  wine_dbgstr_wn(fbdi->FileName, fbdi->FileNameLength/sizeof(WCHAR)));
587 
588  pNtClose(dirh);
589 
590  status = pNtOpenFile(&dirh, SYNCHRONIZE | FILE_LIST_DIRECTORY, &attr, &io, FILE_SHARE_READ,
592  ok(status == STATUS_SUCCESS, "failed to open dir '%s'\n", testdirA);
593 
594  memset( data, 0x55, data_size );
595  data_size = sizeof(data);
596  U(io).Status = 0xdeadbeef;
597  U(io).Information = 0xdeadbeef;
598  status = pNtQueryDirectoryFile(dirh, 0, NULL, NULL, &io, data, data_size,
600  ok(status == STATUS_SUCCESS, "wrong status %x\n", status);
601  ok(U(io).Status == STATUS_SUCCESS, "wrong status %x\n", U(io).Status);
602  ok(U(io).Information > 0 && U(io).Information < data_size, "wrong info %lx\n", U(io).Information);
604  "wrong offset %x\n", fbdi->NextEntryOffset );
605  ok( fbdi->FileNameLength == sizeof(WCHAR), "wrong length %x\n", fbdi->FileNameLength );
606  ok( fbdi->FileName[0] == '.', "incorrect long file name: %s\n",
607  wine_dbgstr_wn(fbdi->FileName, fbdi->FileNameLength/sizeof(WCHAR)));
609  ok( next->NextEntryOffset == ((offsetof( FILE_BOTH_DIRECTORY_INFORMATION, FileName[2] ) + 7) & ~7),
610  "wrong offset %x\n", next->NextEntryOffset );
611  ok( next->FileNameLength == 2 * sizeof(WCHAR), "wrong length %x\n", next->FileNameLength );
612  filename = next->FileName;
613  ok( filename[0] == '.' && filename[1] == '.', "incorrect long file name: %s\n",
614  wine_dbgstr_wn(next->FileName, next->FileNameLength/sizeof(WCHAR)));
615 
617  memset( data, 0x55, data_size );
618  U(io).Status = 0xdeadbeef;
619  U(io).Information = 0xdeadbeef;
620  status = pNtQueryDirectoryFile( dirh, 0, NULL, NULL, &io, data, data_size,
622  ok( status == STATUS_SUCCESS, "wrong status %x\n", status );
623  ok( U(io).Status == STATUS_SUCCESS, "wrong status %x\n", U(io).Status );
625  "wrong info %lx\n", U(io).Information );
626  ok( fbdi->NextEntryOffset == 0, "wrong offset %x\n", fbdi->NextEntryOffset );
627  ok( fbdi->FileNameLength == sizeof(WCHAR), "wrong length %x\n", fbdi->FileNameLength );
628  ok( fbdi->FileName[0] == '.', "incorrect long file name: %s\n",
629  wine_dbgstr_wn(fbdi->FileName, fbdi->FileNameLength/sizeof(WCHAR)));
631  ok( next->NextEntryOffset == 0x55555555, "wrong offset %x\n", next->NextEntryOffset );
632 
634  memset( data, 0x55, data_size );
635  U(io).Status = 0xdeadbeef;
636  U(io).Information = 0xdeadbeef;
637  status = pNtQueryDirectoryFile( dirh, 0, NULL, NULL, &io, data, data_size,
639  ok( status == STATUS_SUCCESS, "wrong status %x\n", status );
640  ok( U(io).Status == STATUS_SUCCESS, "wrong status %x\n", U(io).Status );
642  "wrong info %lx\n", U(io).Information );
643  ok( fbdi->NextEntryOffset == 0, "wrong offset %x\n", fbdi->NextEntryOffset );
644 
645  data_size = ((offsetof( FILE_BOTH_DIRECTORY_INFORMATION, FileName[1] ) + 7) & ~7) +
647  memset( data, 0x55, data_size );
648  U(io).Status = 0xdeadbeef;
649  U(io).Information = 0xdeadbeef;
650  status = pNtQueryDirectoryFile( dirh, 0, NULL, NULL, &io, data, data_size,
652  ok( status == STATUS_SUCCESS, "wrong status %x\n", status );
653  ok( U(io).Status == STATUS_SUCCESS, "wrong status %x\n", U(io).Status );
654  ok( U(io).Information == data_size, "wrong info %lx / %x\n", U(io).Information, data_size );
656  "wrong offset %x\n", fbdi->NextEntryOffset );
657  ok( fbdi->FileNameLength == sizeof(WCHAR), "wrong length %x\n", fbdi->FileNameLength );
658  ok( fbdi->FileName[0] == '.', "incorrect long file name: %s\n",
659  wine_dbgstr_wn(fbdi->FileName, fbdi->FileNameLength/sizeof(WCHAR)));
661  ok( next->NextEntryOffset == 0, "wrong offset %x\n", next->NextEntryOffset );
662  ok( next->FileNameLength == 2 * sizeof(WCHAR), "wrong length %x\n", next->FileNameLength );
663  filename = next->FileName;
664  ok( filename[0] == '.' && filename[1] == '.', "incorrect long file name: %s\n",
665  wine_dbgstr_wn(next->FileName, next->FileNameLength/sizeof(WCHAR)));
666 
667  data_size = ((offsetof( FILE_NAMES_INFORMATION, FileName[1] ) + 7) & ~7) +
669  memset( data, 0x55, data_size );
670  U(io).Status = 0xdeadbeef;
671  U(io).Information = 0xdeadbeef;
672  status = pNtQueryDirectoryFile( dirh, 0, NULL, NULL, &io, data, data_size,
674  ok( status == STATUS_SUCCESS, "wrong status %x\n", status );
675  ok( U(io).Status == STATUS_SUCCESS, "wrong status %x\n", U(io).Status );
676  ok( U(io).Information == data_size, "wrong info %lx / %x\n", U(io).Information, data_size );
678  ok( names->NextEntryOffset == ((offsetof( FILE_NAMES_INFORMATION, FileName[1] ) + 7) & ~7),
679  "wrong offset %x\n", names->NextEntryOffset );
680  ok( names->FileNameLength == sizeof(WCHAR), "wrong length %x\n", names->FileNameLength );
681  ok( names->FileName[0] == '.', "incorrect long file name: %s\n",
682  wine_dbgstr_wn(names->FileName, names->FileNameLength/sizeof(WCHAR)));
683  names = (FILE_NAMES_INFORMATION *)(data + names->NextEntryOffset);
684  ok( names->NextEntryOffset == 0, "wrong offset %x\n", names->NextEntryOffset );
685  ok( names->FileNameLength == 2 * sizeof(WCHAR), "wrong length %x\n", names->FileNameLength );
686  filename = names->FileName;
687  ok( filename[0] == '.' && filename[1] == '.', "incorrect long file name: %s\n",
688  wine_dbgstr_wn(names->FileName, names->FileNameLength/sizeof(WCHAR)));
689 
690  pNtClose(dirh);
691 
692  /* create new handle to change mask */
693  status = pNtOpenFile(&dirh, SYNCHRONIZE | FILE_LIST_DIRECTORY, &attr, &io, FILE_SHARE_READ,
695  ok(status == STATUS_SUCCESS, "failed to open dir '%s'\n", testdirA);
696 
697  pRtlInitUnicodeString( &mask, dummyW );
698  U(io).Status = 0xdeadbeef;
699  data_size = sizeof(data);
700  status = pNtQueryDirectoryFile(dirh, 0, NULL, NULL, &io, data, data_size,
702  ok(status == STATUS_NO_SUCH_FILE, "wrong status %x\n", status);
703  ok(U(io).Status == 0xdeadbeef, "wrong status %x\n", U(io).Status);
704 
705  U(io).Status = 0xdeadbeef;
706  status = pNtQueryDirectoryFile(dirh, 0, NULL, NULL, &io, data, data_size,
708  ok(status == STATUS_NO_MORE_FILES, "wrong status %x\n", status);
709  ok(U(io).Status == STATUS_NO_MORE_FILES, "wrong status %x\n", U(io).Status);
710 
711  U(io).Status = 0xdeadbeef;
712  status = pNtQueryDirectoryFile(dirh, 0, NULL, NULL, &io, data, data_size,
714  ok(status == STATUS_NO_MORE_FILES, "wrong status %x\n", status);
715  ok(U(io).Status == STATUS_NO_MORE_FILES, "wrong status %x\n", U(io).Status);
716 
717  pNtClose(dirh);
718 
719  U(io).Status = 0xdeadbeef;
720  status = pNtQueryDirectoryFile( (HANDLE)0xbeef, 0, NULL, NULL, &io, data, data_size,
722  ok(status == STATUS_INVALID_HANDLE, "wrong status %x\n", status);
723  ok(U(io).Status == 0xdeadbeef, "wrong status %x\n", U(io).Status);
724 
725 done:
726  test_directory_sort( testdirW );
727  tear_down_attribute_test( testdirW );
728  pRtlFreeUnicodeString(&ntdirname);
729 }
730 
731 static void set_up_case_test(const char *testdir)
732 {
733  BOOL ret;
734  char buf[MAX_PATH];
735  HANDLE h;
736 
737  ret = CreateDirectoryA(testdir, NULL);
738  ok(ret, "couldn't create dir '%s', error %d\n", testdir, GetLastError());
739 
740  sprintf(buf, "%s\\%s", testdir, "TesT");
743  ok(h != INVALID_HANDLE_VALUE, "failed to create temp file '%s'\n", buf);
744  CloseHandle(h);
745 }
746 
747 static void tear_down_case_test(const char *testdir)
748 {
749  int ret;
750  char buf[MAX_PATH];
751 
752  sprintf(buf, "%s\\%s", testdir, "TesT");
753  ret = DeleteFileA(buf);
755  "Failed to rm %s, error %d\n", buf, GetLastError());
756  RemoveDirectoryA(testdir);
757 }
758 
760 {
761  static const char testfile[] = "TesT";
762  static const WCHAR testfile_w[] = {'T','e','s','T'};
763  static int testfile_len = sizeof(testfile) - 1;
764  static WCHAR testmask[] = {'t','e','s','t'};
766  UNICODE_STRING ntdirname;
767  char testdir[MAX_PATH];
768  WCHAR testdir_w[MAX_PATH];
769  HANDLE dirh;
772  UINT data_size, data_len;
773  BYTE data[8192];
775  DWORD status;
776  WCHAR *name;
777  ULONG name_len;
778 
779  /* Clean up from prior aborted run, if any, then set up test files */
780  ok(GetTempPathA(MAX_PATH, testdir), "couldn't get temp dir\n");
781  strcat(testdir, "case.tmp");
782  tear_down_case_test(testdir);
783  set_up_case_test(testdir);
784 
785  pRtlMultiByteToUnicodeN(testdir_w, sizeof(testdir_w), NULL, testdir, strlen(testdir) + 1);
786  if (!pRtlDosPathNameToNtPathName_U(testdir_w, &ntdirname, NULL, NULL))
787  {
788  ok(0, "RtlDosPathNametoNtPathName_U failed\n");
789  goto done;
790  }
792 
794 
795  status = pNtOpenFile(&dirh, SYNCHRONIZE | FILE_LIST_DIRECTORY, &attr, &io, FILE_SHARE_READ,
797  ok (status == STATUS_SUCCESS, "failed to open dir '%s', ret 0x%x, error %d\n", testdir, status, GetLastError());
798  if (status != STATUS_SUCCESS)
799  {
800  skip("can't test if we can't open the directory\n");
801  return;
802  }
803 
804  mask.Buffer = testmask;
805  mask.Length = mask.MaximumLength = sizeof(testmask);
806  pNtQueryDirectoryFile(dirh, NULL, NULL, NULL, &io, data, data_size,
808  ok(U(io).Status == STATUS_SUCCESS, "failed to query directory; status %x\n", U(io).Status);
809  data_len = io.Information;
810  ok(data_len >= sizeof(FILE_BOTH_DIRECTORY_INFORMATION), "not enough data in directory\n");
811 
812  name = dir_info->FileName;
813  name_len = dir_info->FileNameLength / sizeof(WCHAR);
814 
815  ok(name_len == testfile_len, "unexpected filename length %u\n", name_len);
816  ok(!memcmp(name, testfile_w, testfile_len * sizeof(WCHAR)), "unexpected filename %s\n",
817  wine_dbgstr_wn(name, name_len));
818 
819  pNtClose(dirh);
820 
821 done:
822  tear_down_case_test(testdir);
823  pRtlFreeUnicodeString(&ntdirname);
824 }
825 
826 static void test_redirection(void)
827 {
828  ULONG old, cur;
830 
831  if (!pRtlWow64EnableFsRedirection || !pRtlWow64EnableFsRedirectionEx)
832  {
833  skip( "Wow64 redirection not supported\n" );
834  return;
835  }
836  status = pRtlWow64EnableFsRedirectionEx( FALSE, &old );
838  {
839  skip( "Wow64 redirection not supported\n" );
840  return;
841  }
842  ok( !status, "RtlWow64EnableFsRedirectionEx failed status %x\n", status );
843 
844  status = pRtlWow64EnableFsRedirectionEx( FALSE, &cur );
845  ok( !status, "RtlWow64EnableFsRedirectionEx failed status %x\n", status );
846  ok( !cur, "RtlWow64EnableFsRedirectionEx got %u\n", cur );
847 
848  status = pRtlWow64EnableFsRedirectionEx( TRUE, &cur );
849  ok( !status, "RtlWow64EnableFsRedirectionEx failed status %x\n", status );
850  status = pRtlWow64EnableFsRedirectionEx( TRUE, &cur );
851  ok( !status, "RtlWow64EnableFsRedirectionEx failed status %x\n", status );
852  ok( cur == 1, "RtlWow64EnableFsRedirectionEx got %u\n", cur );
853 
854  status = pRtlWow64EnableFsRedirection( TRUE );
855  ok( !status, "RtlWow64EnableFsRedirectionEx failed status %x\n", status );
856  status = pRtlWow64EnableFsRedirectionEx( TRUE, &cur );
857  ok( !status, "RtlWow64EnableFsRedirectionEx failed status %x\n", status );
858  ok( !cur, "RtlWow64EnableFsRedirectionEx got %u\n", cur );
859 
860  status = pRtlWow64EnableFsRedirectionEx( TRUE, NULL );
861  ok( status == STATUS_ACCESS_VIOLATION, "RtlWow64EnableFsRedirectionEx failed with status %x\n", status );
862  status = pRtlWow64EnableFsRedirectionEx( TRUE, (void*)1 );
863  ok( status == STATUS_ACCESS_VIOLATION, "RtlWow64EnableFsRedirectionEx failed with status %x\n", status );
864  status = pRtlWow64EnableFsRedirectionEx( TRUE, (void*)0xDEADBEEF );
865  ok( status == STATUS_ACCESS_VIOLATION, "RtlWow64EnableFsRedirectionEx failed with status %x\n", status );
866 
867  status = pRtlWow64EnableFsRedirection( FALSE );
868  ok( !status, "RtlWow64EnableFsRedirectionEx failed status %x\n", status );
869  status = pRtlWow64EnableFsRedirectionEx( FALSE, &cur );
870  ok( !status, "RtlWow64EnableFsRedirectionEx failed status %x\n", status );
871  ok( cur == 1, "RtlWow64EnableFsRedirectionEx got %u\n", cur );
872 
873  pRtlWow64EnableFsRedirectionEx( old, &cur );
874 }
875 
877 {
878  WCHAR sysdir[MAX_PATH];
879  HMODULE hntdll = GetModuleHandleA("ntdll.dll");
880  if (!hntdll)
881  {
882  skip("not running on NT, skipping test\n");
883  return;
884  }
885 
886  pNtClose = (void *)GetProcAddress(hntdll, "NtClose");
887  pNtOpenFile = (void *)GetProcAddress(hntdll, "NtOpenFile");
888  pNtQueryDirectoryFile = (void *)GetProcAddress(hntdll, "NtQueryDirectoryFile");
889  pNtQueryInformationFile = (void *)GetProcAddress(hntdll, "NtQueryInformationFile");
890  pNtSetInformationFile = (void *)GetProcAddress(hntdll, "NtSetInformationFile");
891  pRtlCreateUnicodeStringFromAsciiz = (void *)GetProcAddress(hntdll, "RtlCreateUnicodeStringFromAsciiz");
892  pRtlDosPathNameToNtPathName_U = (void *)GetProcAddress(hntdll, "RtlDosPathNameToNtPathName_U");
893  pRtlInitUnicodeString = (void *)GetProcAddress(hntdll, "RtlInitUnicodeString");
894  pRtlFreeUnicodeString = (void *)GetProcAddress(hntdll, "RtlFreeUnicodeString");
895  pRtlCompareUnicodeString = (void *)GetProcAddress(hntdll, "RtlCompareUnicodeString");
896  pRtlMultiByteToUnicodeN = (void *)GetProcAddress(hntdll,"RtlMultiByteToUnicodeN");
897  pRtlWow64EnableFsRedirection = (void *)GetProcAddress(hntdll,"RtlWow64EnableFsRedirection");
898  pRtlWow64EnableFsRedirectionEx = (void *)GetProcAddress(hntdll,"RtlWow64EnableFsRedirectionEx");
899 
900  GetSystemDirectoryW( sysdir, MAX_PATH );
901  test_directory_sort( sysdir );
905 }
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
static ULONG
Definition: directory.c:29
static PUNICODE_STRING
Definition: directory.c:42
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
WCHAR FileName[ANYSIZE_ARRAY]
Definition: winternl.h:573
#define FILE_ATTRIBUTE_SYSTEM
Definition: nt_native.h:704
uint16_t * PWSTR
Definition: typedefs.h:54
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
const char * description
Definition: directory.c:62
#define FILE_DIRECTORY_FILE
Definition: constants.h:491
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
GLuint GLuint GLsizei count
Definition: gl.h:1545
static BOOLEAN
Definition: directory.c:42
#define U(x)
Definition: wordpad.c:44
LONG NTSTATUS
Definition: precomp.h:26
BOOL attr_done
Definition: directory.c:58
static void test_flags_NtQueryDirectoryFile(OBJECT_ATTRIBUTES *attr, const char *testdirA, UNICODE_STRING *mask, BOOLEAN single_entry, BOOLEAN restart_flag)
Definition: directory.c:173
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
static NTSTATUS(WINAPI *pNtClose)(PHANDLE)
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
const char * description
Definition: directx.c:2497
static const int max_test_dir_size
Definition: directory.c:77
static DWORD LPDWORD LPCSTR src
Definition: directory.c:51
const char * filename
Definition: ioapi.h:135
#define lstrlenW
Definition: compat.h:407
GLint namelen
Definition: glext.h:7232
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:231
#define FILE_SHARE_READ
Definition: compat.h:125
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
struct _test_info info[]
Definition: SetCursorPos.c:19
#define sprintf(buf, format,...)
Definition: sprintf.c:55
GLuint GLuint * names
Definition: glext.h:11545
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
#define DUPLICATE_SAME_ACCESS
GLenum GLint GLuint mask
Definition: glext.h:6028
unsigned int BOOL
Definition: ntddk_ex.h:94
static void test_NtQueryDirectoryFile_classes(HANDLE handle, UNICODE_STRING *mask)
Definition: directory.c:330
static ULONG * old_value
Definition: directory.c:54
#define GENERIC_WRITE
Definition: nt_native.h:90
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
const char * target
Definition: directory.c:61
unsigned char BOOLEAN
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
static void tally_test_file(FILE_BOTH_DIRECTORY_INFORMATION *dir_info)
Definition: directory.c:150
smooth NULL
Definition: ftsmooth.c:416
static LONG
Definition: directory.c:44
#define offsetof(TYPE, MEMBER)
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
LARGE_INTEGER CurrentByteOffset
Definition: nt_native.h:955
const char * LPCSTR
Definition: xmlstorage.h:183
BOOL WINAPI RemoveDirectoryW(IN LPCWSTR lpPathName)
Definition: dir.c:732
#define FILE_ATTRIBUTE_REPARSE_POINT
Definition: ntifs_ex.h:381
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
static const WCHAR nameW[]
Definition: main.c:46
static PIO_STATUS_BLOCK
Definition: directory.c:41
#define FILE_LIST_DIRECTORY
Definition: nt_native.h:629
static void test_NtQueryDirectoryFile(void)
Definition: directory.c:447
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define STATUS_NO_MORE_FILES
Definition: udferr_usr.h:128
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1138
static DWORD LPDWORD LPCSTR DWORD srclen
Definition: directory.c:51
#define MAX_PATH
Definition: compat.h:26
#define WINAPI
Definition: msvc.h:8
static void tear_down_case_test(const char *testdir)
Definition: directory.c:747
unsigned long DWORD
Definition: ntddk_ex.h:95
Definition: cookie.c:170
const WCHAR * short_name
Definition: reg.c:43
static void set_up_case_test(const char *testdir)
Definition: directory.c:731
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static void test_directory_sort(const WCHAR *testdir)
Definition: directory.c:252
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
int ret
int nfound
Definition: directory.c:63
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
static const int test_dir_count
Definition: directory.c:76
__u8 attr
Definition: mkdosfs.c:359
#define STATUS_INVALID_INFO_CLASS
Definition: ntstatus.h:226
static FILE_INFORMATION_CLASS
Definition: directory.c:42
static ACCESS_MASK
Definition: directory.c:41
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:414
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
static LPCSTR
Definition: directory.c:46
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
unsigned char BYTE
Definition: mem.h:68
const char * wine_dbgstr_wn(const WCHAR *str, int n)
Definition: compat.c:342
#define GENERIC_READ
Definition: compat.h:124
static void tear_down_attribute_test(const WCHAR *testdir)
Definition: directory.c:124
#define SYNCHRONIZE
Definition: nt_native.h:61
#define broken(x)
Definition: _sntprintf.h:21
Status
Definition: gdiplustypes.h:24
static const WCHAR dummyW[]
Definition: directory.c:79
static const WCHAR backslashW[]
Definition: directory.c:82
static void test_redirection(void)
Definition: directory.c:826
#define CREATE_ALWAYS
Definition: disk.h:72
GLboolean enable
Definition: glext.h:11120
static unsigned __int64 next
Definition: rand_nt.c:6
static DWORD dstlen
Definition: directory.c:51
static HANDLE
Definition: directory.c:42
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define lstrcpyW
Definition: compat.h:406
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2053
static struct testfile_s testfiles[]
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
static void set_up_attribute_test(const WCHAR *testdir)
Definition: directory.c:85
static POBJECT_ATTRIBUTES
Definition: directory.c:41
#define ok(value,...)
Definition: atltest.h:57
#define STATUS_NO_SUCH_FILE
Definition: udferr_usr.h:137
#define FILE_OPEN_FOR_BACKUP_INTENT
Definition: from_kernel.h:42
GLenum GLenum dst
Definition: glext.h:6340
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2312
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
unsigned int UINT
Definition: ndis.h:50
static PVOID
Definition: directory.c:29
static HINSTANCE hntdll
Definition: process.c:66
#define CreateFileW
Definition: compat.h:400
#define skip(...)
Definition: atltest.h:64
static void test_NtQueryDirectoryFile_case(void)
Definition: directory.c:759
static PWSTR CURDIR *static LPCWSTR
Definition: directory.c:48
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
Definition: name.c:36
GLuint res
Definition: glext.h:9613
int disable
Definition: msacm.c:1353
uint32_t * LPDWORD
Definition: typedefs.h:57
static DWORD LPDWORD reslen
Definition: directory.c:51
unsigned int ULONG
Definition: retypes.h:1
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
static const WCHAR dotdotW[]
Definition: directory.c:81
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define GetProcAddress(x, y)
Definition: compat.h:410
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK io
Definition: file.c:100
static BOOL(WINAPI *pRtlDosPathNameToNtPathName_U)(LPCWSTR
START_TEST(directory)
Definition: directory.c:544
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define memset(x, y, z)
Definition: compat.h:39
static SERVICE_STATUS status
Definition: service.c:31
static const WCHAR dotW[]
Definition: directory.c:80
const DWORD attr
Definition: directory.c:59
static void reset_found_files(void)
Definition: directory.c:115
BOOL WINAPI DuplicateHandle(IN HANDLE hSourceProcessHandle, IN HANDLE hSourceHandle, IN HANDLE hTargetProcessHandle, OUT LPHANDLE lpTargetHandle, IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwOptions)
Definition: handle.c:149
Iosb Information
Definition: create.c:4377
LONGLONG QuadPart
Definition: typedefs.h:112
static PWSTR CURDIR *static VOID(WINAPI *pRtlInitUnicodeString)(PUNICODE_STRING
static PIO_APC_ROUTINE
Definition: directory.c:42
Definition: ps.c:97
GLuint const GLchar * name
Definition: glext.h:6031