ReactOS  r76032
fileinfo.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS system libraries
4  * FILE: dll/win32/kernel32/client/file/fileinfo.c
5  * PURPOSE: Directory functions
6  * PROGRAMMER: Ariadne ( ariadne@xs4all.nl)
7  * Pierre Schweitzer (pierre.schweitzer@reactos.org)
8  * UPDATE HISTORY:
9  * Created 01/11/98
10  */
11 
12 /* INCLUDES *****************************************************************/
13 
14 #include <k32.h>
15 #define NDEBUG
16 #include <debug.h>
18 
19 /* FUNCTIONS ****************************************************************/
20 
21 PWCHAR
23 {
26  PUNICODE_STRING pstrW;
28 
29  //ASSERT(NtCurrentTeb()->StaticUnicodeString.Buffer == NtCurrentTeb()->StaticUnicodeBuffer);
30  ASSERT(NtCurrentTeb()->StaticUnicodeString.MaximumLength == sizeof(NtCurrentTeb()->StaticUnicodeBuffer));
31 
32  RtlInitAnsiString(&str, NameA);
33  pstrW = alloc ? &strW : &NtCurrentTeb()->StaticUnicodeString;
34 
35  if (bIsFileApiAnsi)
36  Status= RtlAnsiStringToUnicodeString( pstrW, &str, (BOOLEAN)alloc );
37  else
38  Status= RtlOemStringToUnicodeString( pstrW, &str, (BOOLEAN)alloc );
39 
40  if (NT_SUCCESS(Status))
41  return pstrW->Buffer;
42 
43  if (Status== STATUS_BUFFER_OVERFLOW)
45  else
46  BaseSetLastNTError(Status);
47 
48  return NULL;
49 }
50 
51 
52 /*
53 No copy/conversion is done if the dest. buffer is too small.
54 
55 Returns:
56  Success: number of TCHARS copied into dest. buffer NOT including nullterm
57  Fail: size of buffer in TCHARS required to hold the converted filename, including nullterm
58 */
59 DWORD
61  LPSTR DestA,
62  INT destLen, /* buffer size in TCHARS incl. nullchar */
63  PUNICODE_STRING SourceU
64  )
65 {
66  DWORD ret;
67 
68  /* destLen should never exceed MAX_PATH */
69  if (destLen > MAX_PATH) destLen = MAX_PATH;
70 
72  /* ret incl. nullchar */
73 
74  if (DestA && (INT)ret <= destLen)
75  {
77 
78  str.Buffer = DestA;
79  str.MaximumLength = (USHORT)destLen;
80 
81 
82  if (bIsFileApiAnsi)
83  RtlUnicodeStringToAnsiString(&str, SourceU, FALSE );
84  else
85  RtlUnicodeStringToOemString(&str, SourceU, FALSE );
86 
87  ret = str.Length; /* SUCCESS: length without terminating 0 */
88  }
89 
90  return ret;
91 }
92 
93 
94 /*
95 No copy/conversion is done if the dest. buffer is too small.
96 
97 Returns:
98  Success: number of TCHARS copied into dest. buffer NOT including nullterm
99  Fail: size of buffer in TCHARS required to hold the converted filename, including nullterm
100 */
101 DWORD
103  LPSTR DestA,
104  INT destLen, /* buffer size in TCHARS incl. nullchar */
105  LPCWSTR SourceW,
106  INT sourceLen /* buffer size in TCHARS incl. nullchar */
107  )
108 {
110 
111  if (sourceLen < 0) sourceLen = wcslen(SourceW) + 1;
112 
113  strW.Buffer = (PWCHAR)SourceW;
114  strW.MaximumLength = sourceLen * sizeof(WCHAR);
115  strW.Length = strW.MaximumLength - sizeof(WCHAR);
116 
117  return FilenameU2A_FitOrFail(DestA, destLen, &strW);
118 }
119 
120 
121 /*
122 Return: num. TCHARS copied into dest including nullterm
123 */
124 DWORD
126  LPWSTR dest,
127  INT destlen, /* buffer size in TCHARS incl. nullchar */
128  LPCSTR src,
129  INT srclen /* buffer size in TCHARS incl. nullchar */
130  )
131 {
132  DWORD ret;
133 
134  if (srclen < 0) srclen = strlen( src ) + 1;
135 
136  if (bIsFileApiAnsi)
137  RtlMultiByteToUnicodeN( dest, destlen* sizeof(WCHAR), &ret, (LPSTR)src, srclen );
138  else
139  RtlOemToUnicodeN( dest, destlen* sizeof(WCHAR), &ret, (LPSTR)src, srclen );
140 
141  if (ret) dest[(ret/sizeof(WCHAR))-1]=0;
142 
143  return ret/sizeof(WCHAR);
144 }
145 
146 /*
147 Return: num. TCHARS copied into dest including nullterm
148 */
149 DWORD
151  LPSTR dest,
152  INT destlen, /* buffer size in TCHARS incl. nullchar */
153  LPCWSTR src,
154  INT srclen /* buffer size in TCHARS incl. nullchar */
155  )
156 {
157  DWORD ret;
158 
159  if (srclen < 0) srclen = wcslen( src ) + 1;
160 
161  if (bIsFileApiAnsi)
162  RtlUnicodeToMultiByteN( dest, destlen, &ret, (LPWSTR) src, srclen * sizeof(WCHAR));
163  else
164  RtlUnicodeToOemN( dest, destlen, &ret, (LPWSTR) src, srclen * sizeof(WCHAR) );
165 
166  if (ret) dest[ret-1]=0;
167 
168  return ret;
169 }
170 
171 /*
172  * @implemented
173  */
174 BOOL WINAPI
176 {
179 
180  hFile = TranslateStdHandle(hFile);
181 
182  if (IsConsoleHandle(hFile))
183  {
184  return FlushConsoleInputBuffer(hFile);
185  }
186 
187  Status = NtFlushBuffersFile(hFile,
188  &IoStatusBlock);
189  if (!NT_SUCCESS(Status))
190  {
191  BaseSetLastNTError(Status);
192  return FALSE;
193  }
194  return TRUE;
195 }
196 
197 
198 /*
199  * @implemented
200  */
201 DWORD
202 WINAPI
205  LONG lDistanceToMove,
206  PLONG lpDistanceToMoveHigh,
207  DWORD dwMoveMethod)
208 {
209  FILE_POSITION_INFORMATION FilePosition;
210  FILE_STANDARD_INFORMATION FileStandard;
211  NTSTATUS errCode;
213  LARGE_INTEGER Distance;
214 
215  TRACE("SetFilePointer(hFile %p, lDistanceToMove %d, dwMoveMethod %lu)\n",
216  hFile,lDistanceToMove,dwMoveMethod);
217 
218  if(IsConsoleHandle(hFile))
219  {
222  }
223 
224  if (lpDistanceToMoveHigh)
225  {
226  Distance.u.HighPart = *lpDistanceToMoveHigh;
227  Distance.u.LowPart = lDistanceToMove;
228  }
229  else
230  {
231  Distance.QuadPart = lDistanceToMove;
232  }
233 
234  switch(dwMoveMethod)
235  {
236  case FILE_CURRENT:
237  errCode = NtQueryInformationFile(hFile,
238  &IoStatusBlock,
239  &FilePosition,
242  FilePosition.CurrentByteOffset.QuadPart += Distance.QuadPart;
243  if (!NT_SUCCESS(errCode))
244  {
245  if (lpDistanceToMoveHigh != NULL)
246  *lpDistanceToMoveHigh = -1;
247  BaseSetLastNTError(errCode);
249  }
250  break;
251  case FILE_END:
252  errCode = NtQueryInformationFile(hFile,
253  &IoStatusBlock,
254  &FileStandard,
257  FilePosition.CurrentByteOffset.QuadPart =
258  FileStandard.EndOfFile.QuadPart + Distance.QuadPart;
259  if (!NT_SUCCESS(errCode))
260  {
261  if (lpDistanceToMoveHigh != NULL)
262  *lpDistanceToMoveHigh = -1;
263  BaseSetLastNTError(errCode);
265  }
266  break;
267  case FILE_BEGIN:
268  FilePosition.CurrentByteOffset.QuadPart = Distance.QuadPart;
269  break;
270  default:
273  }
274 
275  if(FilePosition.CurrentByteOffset.QuadPart < 0)
276  {
279  }
280 
281  if (lpDistanceToMoveHigh == NULL && FilePosition.CurrentByteOffset.HighPart != 0)
282  {
283  /* If we're moving the pointer outside of the 32 bit boundaries but
284  the application only passed a 32 bit value we need to bail out! */
287  }
288 
289  errCode = NtSetInformationFile(hFile,
290  &IoStatusBlock,
291  &FilePosition,
294  if (!NT_SUCCESS(errCode))
295  {
296  if (lpDistanceToMoveHigh != NULL)
297  *lpDistanceToMoveHigh = -1;
298 
299  BaseSetLastNTError(errCode);
301  }
302 
303  if (lpDistanceToMoveHigh != NULL)
304  {
305  *lpDistanceToMoveHigh = FilePosition.CurrentByteOffset.u.HighPart;
306  }
307 
308  if (FilePosition.CurrentByteOffset.u.LowPart == MAXDWORD)
309  {
310  /* The value of -1 is valid here, especially when the new
311  file position is greater than 4 GB. Since NtSetInformationFile
312  succeeded we never set an error code and we explicitly need
313  to clear a previously set error code in this case, which
314  an application will check if INVALID_SET_FILE_POINTER is returned! */
316  }
317 
318  return FilePosition.CurrentByteOffset.u.LowPart;
319 }
320 
321 
322 /*
323  * @implemented
324  */
325 BOOL
326 WINAPI
328  LARGE_INTEGER liDistanceToMove,
329  PLARGE_INTEGER lpNewFilePointer,
330  DWORD dwMoveMethod)
331 {
332  FILE_POSITION_INFORMATION FilePosition;
333  FILE_STANDARD_INFORMATION FileStandard;
334  NTSTATUS errCode;
336 
337  if(IsConsoleHandle(hFile))
338  {
340  return FALSE;
341  }
342 
343  switch(dwMoveMethod)
344  {
345  case FILE_CURRENT:
347  &IoStatusBlock,
348  &FilePosition,
351  FilePosition.CurrentByteOffset.QuadPart += liDistanceToMove.QuadPart;
352  break;
353  case FILE_END:
355  &IoStatusBlock,
356  &FileStandard,
359  FilePosition.CurrentByteOffset.QuadPart =
360  FileStandard.EndOfFile.QuadPart + liDistanceToMove.QuadPart;
361  break;
362  case FILE_BEGIN:
363  FilePosition.CurrentByteOffset.QuadPart = liDistanceToMove.QuadPart;
364  break;
365  default:
367  return FALSE;
368  }
369 
370  if(FilePosition.CurrentByteOffset.QuadPart < 0)
371  {
373  return FALSE;
374  }
375 
376  errCode = NtSetInformationFile(hFile,
377  &IoStatusBlock,
378  &FilePosition,
381  if (!NT_SUCCESS(errCode))
382  {
383  BaseSetLastNTError(errCode);
384  return FALSE;
385  }
386 
387  if (lpNewFilePointer)
388  {
389  *lpNewFilePointer = FilePosition.CurrentByteOffset;
390  }
391  return TRUE;
392 }
393 
394 
395 /*
396  * @implemented
397  */
400 {
402  IO_STATUS_BLOCK StatusBlock;
404 
405  /* Get real handle */
406  hFile = TranslateStdHandle(hFile);
407 
408  /* Check for console handle */
409  if (IsConsoleHandle(hFile))
410  {
411  if (VerifyConsoleIoHandle(hFile))
412  return FILE_TYPE_CHAR;
413  }
414 
415  Status = NtQueryVolumeInformationFile(hFile,
416  &StatusBlock,
417  &DeviceInfo,
420  if (!NT_SUCCESS(Status))
421  {
422  BaseSetLastNTError(Status);
423  return FILE_TYPE_UNKNOWN;
424  }
425 
426  switch (DeviceInfo.DeviceType)
427  {
428  case FILE_DEVICE_CD_ROM:
432  case FILE_DEVICE_DFS:
433  case FILE_DEVICE_DISK:
436  return FILE_TYPE_DISK;
437 
439  case FILE_DEVICE_MOUSE:
440  case FILE_DEVICE_NULL:
442  case FILE_DEVICE_PRINTER:
444  case FILE_DEVICE_SCREEN:
445  case FILE_DEVICE_SOUND:
446  case FILE_DEVICE_MODEM:
447  return FILE_TYPE_CHAR;
448 
450  return FILE_TYPE_PIPE;
451  }
452 
453  return FILE_TYPE_UNKNOWN;
454 }
455 
456 
457 /*
458  * @implemented
459  */
462  LPDWORD lpFileSizeHigh)
463 {
464  NTSTATUS errCode;
465  FILE_STANDARD_INFORMATION FileStandard;
467 
468  errCode = NtQueryInformationFile(hFile,
469  &IoStatusBlock,
470  &FileStandard,
473  if (!NT_SUCCESS(errCode))
474  {
475  BaseSetLastNTError(errCode);
476  if ( lpFileSizeHigh == NULL )
477  {
478  return -1;
479  }
480  else
481  {
482  return 0;
483  }
484  }
485  if ( lpFileSizeHigh != NULL )
486  *lpFileSizeHigh = FileStandard.EndOfFile.u.HighPart;
487 
488  return FileStandard.EndOfFile.u.LowPart;
489 }
490 
491 
492 /*
493  * @implemented
494  */
495 BOOL
496 WINAPI
498  HANDLE hFile,
499  PLARGE_INTEGER lpFileSize
500  )
501 {
502  NTSTATUS errCode;
503  FILE_STANDARD_INFORMATION FileStandard;
505 
506  errCode = NtQueryInformationFile(hFile,
507  &IoStatusBlock,
508  &FileStandard,
511  if (!NT_SUCCESS(errCode))
512  {
513  BaseSetLastNTError(errCode);
514  return FALSE;
515  }
516  if (lpFileSize)
517  *lpFileSize = FileStandard.EndOfFile;
518 
519  return TRUE;
520 }
521 
522 
523 /*
524  * @implemented
525  */
528  LPDWORD lpFileSizeHigh)
529 {
530  PWCHAR FileNameW;
531 
532  if (!(FileNameW = FilenameA2W(lpFileName, FALSE)))
533  return INVALID_FILE_SIZE;
534 
535  return GetCompressedFileSizeW(FileNameW, lpFileSizeHigh);
536 }
537 
538 
539 /*
540  * @implemented
541  */
544  LPDWORD lpFileSizeHigh)
545 {
546  FILE_COMPRESSION_INFORMATION FileCompression;
547  NTSTATUS errCode;
549  HANDLE hFile;
550 
551  hFile = CreateFileW(lpFileName,
552  GENERIC_READ,
554  NULL,
557  NULL);
558 
559  if (hFile == INVALID_HANDLE_VALUE)
560  return INVALID_FILE_SIZE;
561 
562  errCode = NtQueryInformationFile(hFile,
563  &IoStatusBlock,
564  &FileCompression,
567 
568  CloseHandle(hFile);
569 
570  if (!NT_SUCCESS(errCode))
571  {
572  BaseSetLastNTError(errCode);
573  return INVALID_FILE_SIZE;
574  }
575 
576  if(lpFileSizeHigh)
577  *lpFileSizeHigh = FileCompression.CompressedFileSize.u.HighPart;
578 
580  return FileCompression.CompressedFileSize.u.LowPart;
581 }
582 
583 
584 /*
585  * @implemented
586  */
587 BOOL WINAPI
589  LPBY_HANDLE_FILE_INFORMATION lpFileInformation)
590 {
591  struct
592  {
593  FILE_FS_VOLUME_INFORMATION FileFsVolume;
594  WCHAR Name[255];
595  }
596  FileFsVolume;
597 
598  FILE_BASIC_INFORMATION FileBasic;
599  FILE_INTERNAL_INFORMATION FileInternal;
600  FILE_STANDARD_INFORMATION FileStandard;
601  NTSTATUS errCode;
603 
604  if(IsConsoleHandle(hFile))
605  {
607  return FALSE;
608  }
609 
610  errCode = NtQueryInformationFile(hFile,
611  &IoStatusBlock,
612  &FileBasic,
613  sizeof(FILE_BASIC_INFORMATION),
615  if (!NT_SUCCESS(errCode))
616  {
617  BaseSetLastNTError(errCode);
618  return FALSE;
619  }
620 
621  lpFileInformation->dwFileAttributes = (DWORD)FileBasic.FileAttributes;
622 
623  lpFileInformation->ftCreationTime.dwHighDateTime = FileBasic.CreationTime.u.HighPart;
624  lpFileInformation->ftCreationTime.dwLowDateTime = FileBasic.CreationTime.u.LowPart;
625 
626  lpFileInformation->ftLastAccessTime.dwHighDateTime = FileBasic.LastAccessTime.u.HighPart;
627  lpFileInformation->ftLastAccessTime.dwLowDateTime = FileBasic.LastAccessTime.u.LowPart;
628 
629  lpFileInformation->ftLastWriteTime.dwHighDateTime = FileBasic.LastWriteTime.u.HighPart;
630  lpFileInformation->ftLastWriteTime.dwLowDateTime = FileBasic.LastWriteTime.u.LowPart;
631 
632  errCode = NtQueryInformationFile(hFile,
633  &IoStatusBlock,
634  &FileInternal,
637  if (!NT_SUCCESS(errCode))
638  {
639  BaseSetLastNTError(errCode);
640  return FALSE;
641  }
642 
643  lpFileInformation->nFileIndexHigh = FileInternal.IndexNumber.u.HighPart;
644  lpFileInformation->nFileIndexLow = FileInternal.IndexNumber.u.LowPart;
645 
646  errCode = NtQueryVolumeInformationFile(hFile,
647  &IoStatusBlock,
648  &FileFsVolume,
649  sizeof(FileFsVolume),
651  if (!NT_SUCCESS(errCode))
652  {
653  BaseSetLastNTError(errCode);
654  return FALSE;
655  }
656 
657  lpFileInformation->dwVolumeSerialNumber = FileFsVolume.FileFsVolume.VolumeSerialNumber;
658 
659  errCode = NtQueryInformationFile(hFile,
660  &IoStatusBlock,
661  &FileStandard,
664  if (!NT_SUCCESS(errCode))
665  {
666  BaseSetLastNTError(errCode);
667  return FALSE;
668  }
669 
670  lpFileInformation->nNumberOfLinks = FileStandard.NumberOfLinks;
671  lpFileInformation->nFileSizeHigh = FileStandard.EndOfFile.u.HighPart;
672  lpFileInformation->nFileSizeLow = FileStandard.EndOfFile.u.LowPart;
673 
674  return TRUE;
675 }
676 
677 
678 /*
679  * @implemented
680  */
681 BOOL WINAPI
683  GET_FILEEX_INFO_LEVELS fInfoLevelId,
684  LPVOID lpFileInformation)
685 {
690  WIN32_FILE_ATTRIBUTE_DATA* FileAttributeData;
691 
692  TRACE("GetFileAttributesExW(%S) called\n", lpFileName);
693 
694 
695  if (fInfoLevelId != GetFileExInfoStandard || lpFileInformation == NULL)
696  {
698  return FALSE;
699  }
700 
701  /* Validate and translate the filename */
702  if (!RtlDosPathNameToNtPathName_U (lpFileName,
703  &FileName,
704  NULL,
705  NULL))
706  {
707  WARN ("Invalid path '%S'\n", lpFileName);
709  return FALSE;
710  }
711 
712  /* build the object attributes */
713  InitializeObjectAttributes (&ObjectAttributes,
714  &FileName,
716  NULL,
717  NULL);
718 
719  /* Get file attributes */
720  Status = NtQueryFullAttributesFile(&ObjectAttributes,
721  &FileInformation);
722 
723  RtlFreeUnicodeString (&FileName);
724  if (!NT_SUCCESS (Status))
725  {
726  WARN ("NtQueryFullAttributesFile() failed (Status %lx)\n", Status);
727  BaseSetLastNTError (Status);
728  return FALSE;
729  }
730 
731  FileAttributeData = (WIN32_FILE_ATTRIBUTE_DATA*)lpFileInformation;
732  FileAttributeData->dwFileAttributes = FileInformation.FileAttributes;
733  FileAttributeData->ftCreationTime.dwLowDateTime = FileInformation.CreationTime.u.LowPart;
734  FileAttributeData->ftCreationTime.dwHighDateTime = FileInformation.CreationTime.u.HighPart;
735  FileAttributeData->ftLastAccessTime.dwLowDateTime = FileInformation.LastAccessTime.u.LowPart;
736  FileAttributeData->ftLastAccessTime.dwHighDateTime = FileInformation.LastAccessTime.u.HighPart;
737  FileAttributeData->ftLastWriteTime.dwLowDateTime = FileInformation.LastWriteTime.u.LowPart;
738  FileAttributeData->ftLastWriteTime.dwHighDateTime = FileInformation.LastWriteTime.u.HighPart;
739  FileAttributeData->nFileSizeLow = FileInformation.EndOfFile.u.LowPart;
740  FileAttributeData->nFileSizeHigh = FileInformation.EndOfFile.u.HighPart;
741 
742  return TRUE;
743 }
744 
745 /*
746  * @implemented
747  */
748 BOOL WINAPI
750  GET_FILEEX_INFO_LEVELS fInfoLevelId,
751  LPVOID lpFileInformation)
752 {
753  PWCHAR FileNameW;
754 
755  if (!(FileNameW = FilenameA2W(lpFileName, FALSE)))
756  return FALSE;
757 
758  return GetFileAttributesExW(FileNameW, fInfoLevelId, lpFileInformation);
759 }
760 
761 
762 /*
763  * @implemented
764  */
767 {
768  PWSTR FileNameW;
769 
770  if (!lpFileName || !(FileNameW = FilenameA2W(lpFileName, FALSE)))
772 
773  return GetFileAttributesW(FileNameW);
774 }
775 
776 
777 /*
778  * @implemented
779  */
780 DWORD
781 WINAPI
783 {
788 
789  /* Get the NT path name */
790  if (!RtlDosPathNameToNtPathName_U(lpFileName, &FileName, NULL, NULL))
791  {
794  }
795 
796  /* Prepare for querying attributes */
797  InitializeObjectAttributes(&ObjectAttributes, &FileName,
799  NULL, NULL);
800  /* Simply query attributes */
801  Status = NtQueryAttributesFile(&ObjectAttributes, &FileInformation);
802  if (!NT_SUCCESS(Status))
803  {
804  /* It failed? Is it a DOS device? */
805  if (RtlIsDosDeviceName_U(lpFileName))
806  {
807  return FILE_ATTRIBUTE_ARCHIVE;
808  }
809 
810  /* Set the error otherwise */
811  BaseSetLastNTError(Status);
813  }
814 
815  /* Return the file attributes */
816  return FileInformation.FileAttributes;
817 }
818 
819 
820 /*
821  * @implemented
822  */
823 BOOL WINAPI
825  OUT LPDWORD dwFileAttributes,
826  IN DWORD dwFlags)
827 {
828  FILE_BASIC_INFORMATION FileBasic;
831 
832  UNREFERENCED_PARAMETER(dwFlags);
833 
834  if (IsConsoleHandle(hFile))
835  {
837  return FALSE;
838  }
839 
840  Status = NtQueryInformationFile(hFile,
841  &IoStatusBlock,
842  &FileBasic,
843  sizeof(FileBasic),
845  if (NT_SUCCESS(Status))
846  {
847  *dwFileAttributes = FileBasic.FileAttributes;
848  return TRUE;
849  }
850 
851  BaseSetLastNTError(Status);
852  return FALSE;
853 }
854 
855 
856 /*
857  * @implemented
858  */
859 BOOL WINAPI
861  IN DWORD dwFileAttributes,
862  IN DWORD dwFlags)
863 {
864  FILE_BASIC_INFORMATION FileBasic;
867 
868  UNREFERENCED_PARAMETER(dwFlags);
869 
870  if (IsConsoleHandle(hFile))
871  {
873  return FALSE;
874  }
875 
876  Status = NtQueryInformationFile(hFile,
877  &IoStatusBlock,
878  &FileBasic,
879  sizeof(FileBasic),
881  if (NT_SUCCESS(Status))
882  {
883  FileBasic.FileAttributes = dwFileAttributes;
884 
885  Status = NtSetInformationFile(hFile,
886  &IoStatusBlock,
887  &FileBasic,
888  sizeof(FileBasic),
890  }
891 
892  if (!NT_SUCCESS(Status))
893  {
894  BaseSetLastNTError(Status);
895  return FALSE;
896  }
897 
898  return TRUE;
899 }
900 
901 
902 /*
903  * @implemented
904  */
905 BOOL WINAPI
908  DWORD dwFileAttributes)
909 {
910  PWCHAR FileNameW;
911 
912  if (!(FileNameW = FilenameA2W(lpFileName, FALSE)))
913  return FALSE;
914 
915  return SetFileAttributesW(FileNameW, dwFileAttributes);
916 }
917 
918 
919 /*
920  * @implemented
921  */
922 BOOL
923 WINAPI
925  DWORD dwFileAttributes)
926 {
928  PWSTR PathUBuffer;
930  UNICODE_STRING NtPathU;
932  RTL_RELATIVE_NAME_U RelativeName;
935 
936  /* Get relative name */
937  if (!RtlDosPathNameToRelativeNtPathName_U(lpFileName, &NtPathU, NULL, &RelativeName))
938  {
940  return FALSE;
941  }
942 
943  /* Save buffer to allow later freeing */
944  PathUBuffer = NtPathU.Buffer;
945 
946  /* If we have relative name (and root dir), use them instead */
947  if (RelativeName.RelativeName.Length != 0)
948  {
949  NtPathU.Length = RelativeName.RelativeName.Length;
950  NtPathU.MaximumLength = RelativeName.RelativeName.MaximumLength;
951  NtPathU.Buffer = RelativeName.RelativeName.Buffer;
952  }
953  else
954  {
955  RelativeName.ContainingDirectory = NULL;
956  }
957 
958  /* Prepare the object attribute for opening the file */
959  InitializeObjectAttributes(&ObjectAttributes, &NtPathU,
961  RelativeName.ContainingDirectory, NULL);
962 
963  /* Attempt to open the file, while supporting reparse point */
964  Status = NtOpenFile(&FileHandle, FILE_WRITE_ATTRIBUTES | SYNCHRONIZE,
965  &ObjectAttributes, &IoStatusBlock,
968  /* If opening failed, check whether it was because of reparse point support */
969  if (!NT_SUCCESS(Status))
970  {
971  /* Nope, just quit */
972  if (Status != STATUS_INVALID_PARAMETER)
973  {
974  RtlReleaseRelativeName(&RelativeName);
975  RtlFreeHeap(RtlGetProcessHeap(), 0, PathUBuffer);
976  BaseSetLastNTError(Status);
977 
978  return FALSE;
979  }
980 
981  /* Yes, retry without */
982  Status = NtOpenFile(&FileHandle, FILE_WRITE_ATTRIBUTES | SYNCHRONIZE,
983  &ObjectAttributes, &IoStatusBlock,
986  if (!NT_SUCCESS(Status))
987  {
988  RtlReleaseRelativeName(&RelativeName);
989  RtlFreeHeap(RtlGetProcessHeap(), 0, PathUBuffer);
990  BaseSetLastNTError(Status);
991 
992  return FALSE;
993  }
994  }
995 
996  /* We don't need strings anylonger */
997  RtlReleaseRelativeName(&RelativeName);
998  RtlFreeHeap(RtlGetProcessHeap(), 0, PathUBuffer);
999 
1000  /* Zero our structure, we'll only set file attributes */
1001  ZeroMemory(&FileInformation, sizeof(FileInformation));
1002  /* Set the attributes, filtering only allowed attributes, and forcing normal attribute */
1003  FileInformation.FileAttributes = (dwFileAttributes & FILE_ATTRIBUTE_VALID_SET_FLAGS) | FILE_ATTRIBUTE_NORMAL;
1004 
1005  /* Finally, set the attributes */
1006  Status = NtSetInformationFile(FileHandle, &IoStatusBlock, &FileInformation,
1008  /* Close the file */
1009  NtClose(FileHandle);
1010 
1011  /* If it failed, set the error and fail */
1012  if (!NT_SUCCESS(Status))
1013  {
1014  BaseSetLastNTError(Status);
1015 
1016  return FALSE;
1017  }
1018 
1019  return TRUE;
1020 }
1021 
1022 /*
1023  * @implemented
1024  */
1025 BOOL WINAPI
1027  OUT LPFILETIME lpCreationTime OPTIONAL,
1028  OUT LPFILETIME lpLastAccessTime OPTIONAL,
1029  OUT LPFILETIME lpLastWriteTime OPTIONAL)
1030 {
1031  NTSTATUS Status;
1033  FILE_BASIC_INFORMATION FileBasic;
1034 
1035  if(IsConsoleHandle(hFile))
1036  {
1038  return FALSE;
1039  }
1040 
1041  Status = NtQueryInformationFile(hFile,
1042  &IoStatusBlock,
1043  &FileBasic,
1044  sizeof(FILE_BASIC_INFORMATION),
1046  if (!NT_SUCCESS(Status))
1047  {
1048  BaseSetLastNTError(Status);
1049  return FALSE;
1050  }
1051 
1052  if (lpCreationTime)
1053  {
1054  lpCreationTime->dwLowDateTime = FileBasic.CreationTime.LowPart;
1055  lpCreationTime->dwHighDateTime = FileBasic.CreationTime.HighPart;
1056  }
1057 
1058  if (lpLastAccessTime)
1059  {
1060  lpLastAccessTime->dwLowDateTime = FileBasic.LastAccessTime.LowPart;
1061  lpLastAccessTime->dwHighDateTime = FileBasic.LastAccessTime.HighPart;
1062  }
1063 
1064  if (lpLastWriteTime)
1065  {
1066  lpLastWriteTime->dwLowDateTime = FileBasic.LastWriteTime.LowPart;
1067  lpLastWriteTime->dwHighDateTime = FileBasic.LastWriteTime.HighPart;
1068  }
1069 
1070  return TRUE;
1071 }
1072 
1073 
1074 /*
1075  * @implemented
1076  */
1077 BOOL WINAPI
1079  CONST FILETIME *lpCreationTime OPTIONAL,
1080  CONST FILETIME *lpLastAccessTime OPTIONAL,
1081  CONST FILETIME *lpLastWriteTime OPTIONAL)
1082 {
1083  NTSTATUS Status;
1085  FILE_BASIC_INFORMATION FileBasic;
1086 
1087  if(IsConsoleHandle(hFile))
1088  {
1090  return FALSE;
1091  }
1092 
1093  memset(&FileBasic, 0, sizeof(FILE_BASIC_INFORMATION));
1094 
1095  if (lpCreationTime)
1096  {
1097  FileBasic.CreationTime.LowPart = lpCreationTime->dwLowDateTime;
1098  FileBasic.CreationTime.HighPart = lpCreationTime->dwHighDateTime;
1099  }
1100 
1101  if (lpLastAccessTime)
1102  {
1103  FileBasic.LastAccessTime.LowPart = lpLastAccessTime->dwLowDateTime;
1104  FileBasic.LastAccessTime.HighPart = lpLastAccessTime->dwHighDateTime;
1105  }
1106 
1107  if (lpLastWriteTime)
1108  {
1109  FileBasic.LastWriteTime.LowPart = lpLastWriteTime->dwLowDateTime;
1110  FileBasic.LastWriteTime.HighPart = lpLastWriteTime->dwHighDateTime;
1111  }
1112 
1113  Status = NtSetInformationFile(hFile,
1114  &IoStatusBlock,
1115  &FileBasic,
1116  sizeof(FILE_BASIC_INFORMATION),
1118  if (!NT_SUCCESS(Status))
1119  {
1120  BaseSetLastNTError(Status);
1121  return FALSE;
1122  }
1123 
1124  return TRUE;
1125 }
1126 
1127 
1128 /*
1129  * The caller must have opened the file with the DesiredAccess FILE_WRITE_DATA flag set.
1130  *
1131  * @implemented
1132  */
1133 BOOL WINAPI
1135 {
1137  FILE_END_OF_FILE_INFORMATION EndOfFileInfo;
1138  FILE_ALLOCATION_INFORMATION FileAllocationInfo;
1139  FILE_POSITION_INFORMATION FilePosInfo;
1140  NTSTATUS Status;
1141 
1142  if(IsConsoleHandle(hFile))
1143  {
1145  return FALSE;
1146  }
1147 
1148  //get current position
1149  Status = NtQueryInformationFile(
1150  hFile,
1151  &IoStatusBlock,
1152  &FilePosInfo,
1153  sizeof(FILE_POSITION_INFORMATION),
1155  );
1156 
1157  if (!NT_SUCCESS(Status)){
1158  BaseSetLastNTError(Status);
1159  return FALSE;
1160  }
1161 
1162  EndOfFileInfo.EndOfFile.QuadPart = FilePosInfo.CurrentByteOffset.QuadPart;
1163 
1164  /*
1165  NOTE:
1166  This call is not supposed to free up any space after the eof marker
1167  if the file gets truncated. We have to deallocate the space explicitly afterwards.
1168  But...most file systems dispatch both FileEndOfFileInformation
1169  and FileAllocationInformation as they were the same command.
1170 
1171  */
1172  Status = NtSetInformationFile(
1173  hFile,
1174  &IoStatusBlock, //out
1175  &EndOfFileInfo,
1178  );
1179 
1180  if (!NT_SUCCESS(Status)){
1181  BaseSetLastNTError(Status);
1182  return FALSE;
1183  }
1184 
1185  FileAllocationInfo.AllocationSize.QuadPart = FilePosInfo.CurrentByteOffset.QuadPart;
1186 
1187 
1188  Status = NtSetInformationFile(
1189  hFile,
1190  &IoStatusBlock, //out
1191  &FileAllocationInfo,
1194  );
1195 
1196  if (!NT_SUCCESS(Status)){
1197  BaseSetLastNTError(Status);
1198  return FALSE;
1199  }
1200 
1201  return TRUE;
1202 
1203 }
1204 
1205 
1206 /*
1207  * @implemented
1208  */
1209 BOOL
1210 WINAPI
1212  HANDLE hFile,
1213  LONGLONG ValidDataLength
1214  )
1215 {
1217  FILE_VALID_DATA_LENGTH_INFORMATION ValidDataLengthInformation;
1218  NTSTATUS Status;
1219 
1220  ValidDataLengthInformation.ValidDataLength.QuadPart = ValidDataLength;
1221 
1222  Status = NtSetInformationFile(
1223  hFile,
1224  &IoStatusBlock, //out
1225  &ValidDataLengthInformation,
1228  );
1229 
1230  if (!NT_SUCCESS(Status)){
1231  BaseSetLastNTError(Status);
1232  return FALSE;
1233  }
1234 
1235  return TRUE;
1236 }
1237 
1238 /* EOF */
BOOL WINAPI SetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes)
Definition: fileinfo.c:924
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
BOOL WINAPI SetFilePointerEx(HANDLE hFile, LARGE_INTEGER liDistanceToMove, PLARGE_INTEGER lpNewFilePointer, DWORD dwMoveMethod)
Definition: fileinfo.c:327
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define IN
Definition: typedefs.h:38
#define FILE_DEVICE_DISK
Definition: winioctl.h:112
#define TRUE
Definition: types.h:120
NTSYSAPI DWORD WINAPI RtlUnicodeStringToAnsiSize(const UNICODE_STRING *)
#define FILE_TYPE_DISK
Definition: winbase.h:254
#define CloseHandle
Definition: compat.h:398
#define INVALID_SET_FILE_POINTER
Definition: winbase.h:113
enum _GET_FILEEX_INFO_LEVELS GET_FILEEX_INFO_LEVELS
#define FILE_DEVICE_SCREEN
Definition: winioctl.h:133
BOOL bIsFileApiAnsi
Definition: utils.c:25
NTSTATUS NTAPI NtQueryFullAttributesFile(IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PFILE_NETWORK_OPEN_INFORMATION FileInformation)
Definition: file.c:3546
#define ERROR_SUCCESS
Definition: deptool.c:10
USHORT MaximumLength
Definition: env_spec_w32.h:370
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
NTSYSAPI NTSTATUS WINAPI RtlMultiByteToUnicodeN(LPWSTR, DWORD, LPDWORD, LPCSTR, DWORD)
LARGE_INTEGER LastAccessTime
Definition: nt_native.h:940
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel)?(CompletionRoutine!=NULL):TRUE)
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:315
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define INVALID_FILE_ATTRIBUTES
Definition: test.h:47
#define FILE_CURRENT
Definition: winbase.h:111
#define FILE_DEVICE_NAMED_PIPE
Definition: winioctl.h:122
HANDLE ContainingDirectory
Definition: rtltypes.h:1260
BOOL WINAPI SetEndOfFile(HANDLE hFile)
Definition: fileinfo.c:1134
#define WARN(fmt,...)
Definition: debug.h:111
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
VOID NTAPI RtlReleaseRelativeName(_In_ PRTL_RELATIVE_NAME_U RelativeName)
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:603
PVOID *typedef PWSTR
Definition: winlogon.h:57
BOOL WINAPI SetFileAttributesByHandle(IN HANDLE hFile, IN DWORD dwFileAttributes, IN DWORD dwFlags)
Definition: fileinfo.c:860
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
static OUT PIO_STATUS_BLOCK OUT PVOID FileInformation
Definition: pipe.c:75
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
LARGE_INTEGER CompressedFileSize
Definition: iotypes.h:5460
#define ZeroMemory
Definition: winbase.h:1621
HANDLE TranslateStdHandle(IN HANDLE hHandle)
Definition: handle.c:19
NTSYSAPI NTSTATUS WINAPI RtlOemToUnicodeN(LPWSTR, DWORD, LPDWORD, LPCSTR, DWORD)
NTSTATUS NTAPI NtFlushBuffersFile(IN HANDLE FileHandle, OUT PIO_STATUS_BLOCK IoStatusBlock)
Definition: iofunc.c:1337
#define FILE_DEVICE_VIRTUAL_DISK
Definition: winioctl.h:141
DWORD WINAPI GetFileType(HANDLE hFile)
Definition: fileinfo.c:399
#define INVALID_FILE_SIZE
Definition: winbase.h:520
uint16_t * PWCHAR
Definition: typedefs.h:54
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_DEVICE_NULL
Definition: winioctl.h:126
char * LPSTR
Definition: xmlstorage.h:182
#define FILE_TYPE_UNKNOWN
Definition: winbase.h:253
#define WCHAR
Definition: msvc.h:43
#define NO_ERROR
Definition: dderror.h:5
DWORD FilenameU2A_FitOrFail(LPSTR DestA, INT destLen, PUNICODE_STRING SourceU)
Definition: fileinfo.c:60
NTSYSAPI DWORD WINAPI RtlUnicodeStringToOemSize(const UNICODE_STRING *)
#define DWORD
Definition: msvc.h:34
int32_t INT
Definition: typedefs.h:56
#define FILE_DEVICE_MODEM
Definition: winioctl.h:148
DWORD DWORD
Definition: winlogon.h:75
#define FILE_WRITE_ATTRIBUTES
Definition: nt_native.h:649
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:231
#define FILE_SHARE_READ
Definition: compat.h:125
LARGE_INTEGER AllocationSize
Definition: winternl.h:646
struct _LARGE_INTEGER::@2037 u
NTSYSAPI BOOLEAN NTAPI RtlDosPathNameToRelativeNtPathName_U(_In_ PCWSTR DosName, _Out_ PUNICODE_STRING NtName, _Out_ PCWSTR *PartName, _Out_ PRTL_RELATIVE_NAME_U RelativeName)
BOOL WINAPI DECLSPEC_HOTPATCH VerifyConsoleIoHandle(HANDLE hIoHandle)
Definition: console.c:1110
DWORD FilenameA2W_N(LPWSTR dest, INT destlen, LPCSTR src, INT srclen)
Definition: fileinfo.c:125
DWORD WINAPI DECLSPEC_HOTPATCH SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod)
Definition: fileinfo.c:204
BOOL WINAPI SetFileTime(IN HANDLE hFile, CONST FILETIME *lpCreationTime OPTIONAL, CONST FILETIME *lpLastAccessTime OPTIONAL, CONST FILETIME *lpLastWriteTime OPTIONAL)
Definition: fileinfo.c:1078
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
#define FILE_DEVICE_CD_ROM
Definition: winioctl.h:107
GLuint const GLubyte GLvoid * src
Definition: s_context.h:57
DWORD dwHighDateTime
Definition: mapidefs.h:66
#define FILE_DEVICE_CONTROLLER
Definition: winioctl.h:109
#define FALSE
Definition: types.h:117
NTSYSAPI NTSTATUS NTAPI RtlUnicodeToOemN(PCHAR OemString, ULONG OemSize, PULONG ResultSize, PCWCH UnicodeString, ULONG UnicodeSize)
WCHAR strW[12]
Definition: clipboard.c:2308
long LONG
Definition: pedump.c:60
#define FILE_TYPE_CHAR
Definition: winbase.h:255
#define kernel32file
Definition: kernel32.h:6
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:782
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:766
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:557
#define MAXDWORD
LARGE_INTEGER EndOfFile
Definition: nt_native.h:948
LARGE_INTEGER CurrentByteOffset
Definition: nt_native.h:955
NTSTATUS NTAPI NtQueryVolumeInformationFile(IN HANDLE FileHandle, OUT PIO_STATUS_BLOCK IoStatusBlock, OUT PVOID FsInformation, IN ULONG Length, IN FS_INFORMATION_CLASS FsInformationClass)
Definition: iofunc.c:3813
BOOL WINAPI SetFileAttributesA(LPCSTR lpFileName, DWORD dwFileAttributes)
Definition: fileinfo.c:906
struct _FileName FileName
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
const char * LPCSTR
Definition: xmlstorage.h:183
#define OPEN_EXISTING
Definition: compat.h:426
#define CONST
Definition: compiler.h:170
#define FILE_DEVICE_DISK_FILE_SYSTEM
Definition: winioctl.h:113
#define DECLSPEC_HOTPATCH
Definition: _mingw.h:224
PWCHAR FilenameA2W(LPCSTR NameA, BOOL alloc)
Definition: fileinfo.c:22
USHORT MaximumLength
Definition: env_spec_w32.h:377
int64_t LONGLONG
Definition: typedefs.h:66
NTSYSAPI NTSTATUS NTAPI NtOpenFile(OUT PHANDLE phFile, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG ShareMode, IN ULONG OpenMode)
Definition: file.c:3508
unsigned char BOOLEAN
#define FILE_DEVICE_DATALINK
Definition: winioctl.h:110
BOOL WINAPI GetFileAttributesByHandle(IN HANDLE hFile, OUT LPDWORD dwFileAttributes, IN DWORD dwFlags)
Definition: fileinfo.c:824
#define TRACE(s)
Definition: solgame.cpp:4
LARGE_INTEGER LastWriteTime
Definition: nt_native.h:941
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI FlushFileBuffers(IN HANDLE hFile)
Definition: fileinfo.c:175
BOOL WINAPI GetFileInformationByHandle(HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation)
Definition: fileinfo.c:588
#define FILE_END
Definition: winbase.h:112
DWORD WINAPI GetCompressedFileSizeA(LPCSTR lpFileName, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:527
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
#define FILE_DEVICE_DFS
Definition: winioctl.h:111
static DWORD LPDWORD LPCSTR DWORD srclen
Definition: directory.c:47
#define MAX_PATH
Definition: compat.h:26
GLfloat CONST GLvector4f CONST GLfloat GLvector4f * dest
Definition: m_xform.h:122
struct _DeviceInfo DeviceInfo
#define FILE_DEVICE_PARALLEL_PORT
Definition: winioctl.h:127
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:461
#define SetLastError(x)
Definition: compat.h:409
#define FILE_DEVICE_MOUSE
Definition: winioctl.h:120
#define IsConsoleHandle(h)
Definition: console.h:14
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3392
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define FILE_ATTRIBUTE_ARCHIVE
Definition: nt_native.h:706
_In_ PUNICODE_STRING Name
Definition: mrx.h:218
int ret
NTSYSAPI NTSTATUS NTAPI RtlUnicodeToMultiByteN(PCHAR MbString, ULONG MbSize, PULONG ResultSize, PCWCH UnicodeString, ULONG UnicodeSize)
LARGE_INTEGER CreationTime
Definition: nt_native.h:939
DWORD FilenameW2A_FitOrFail(LPSTR DestA, INT destLen, LPCWSTR SourceW, INT sourceLen)
Definition: fileinfo.c:102
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1170
DEBUG_CHANNEL(kernel32file)
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToOemString(POEM_STRING DestinationString, PCUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
ULONG LowPart
Definition: typedefs.h:104
#define FILE_DEVICE_SOUND
Definition: winioctl.h:134
#define GENERIC_READ
Definition: compat.h:124
BOOL WINAPI FlushConsoleInputBuffer(IN HANDLE hConsoleInput)
Definition: console.c:154
NTSTATUS NTAPI NtQueryInformationFile(HANDLE hFile, PIO_STATUS_BLOCK io, PVOID ptr, ULONG len, FILE_INFORMATION_CLASS FileInformationClass)
#define SYNCHRONIZE
Definition: nt_native.h:61
_In_ HANDLE hFile
Definition: mswsock.h:90
NTSYSAPI NTSTATUS NTAPI RtlOemStringToUnicodeString(PUNICODE_STRING DestinationString, PCOEM_STRING SourceString, BOOLEAN AllocateDestinationString)
#define WINAPI
Definition: msvc.h:20
#define ERROR_NEGATIVE_SEEK
Definition: winerror.h:203
Status
Definition: gdiplustypes.h:24
static HANDLE FileHandle
Definition: cabinet.c:47
#define FILE_BEGIN
Definition: winbase.h:110
DWORD *typedef HANDLE
Definition: winlogon.h:52
LONG NTSTATUS
Definition: DriverTester.h:11
#define FILE_TYPE_PIPE
Definition: winbase.h:256
NTSTATUS NTAPI NtQueryAttributesFile(IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PFILE_BASIC_INFORMATION FileInformation)
Definition: file.c:3534
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:47
unsigned short USHORT
Definition: pedump.c:61
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
#define FILE_OPEN_FOR_BACKUP_INTENT
Definition: from_kernel.h:42
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define alloc
Definition: rosglue.h:13
DWORD WINAPI GetCompressedFileSizeW(LPCWSTR lpFileName, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:543
#define CreateFileW
Definition: compat.h:400
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
#define OUT
Definition: typedefs.h:39
#define FILE_DEVICE_CD_ROM_FILE_SYSTEM
Definition: winioctl.h:108
uint32_t * LPDWORD
Definition: typedefs.h:57
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
UNICODE_STRING RelativeName
Definition: rtltypes.h:1259
BOOL WINAPI GetFileAttributesExW(LPCWSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation)
Definition: fileinfo.c:682
DWORD FilenameW2A_N(LPSTR dest, INT destlen, LPCWSTR src, INT srclen)
Definition: fileinfo.c:150
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
BOOL WINAPI GetFileAttributesExA(LPCSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation)
Definition: fileinfo.c:749
#define FILE_ATTRIBUTE_VALID_SET_FLAGS
Definition: nt_native.h:715
#define FILE_DEVICE_SERIAL_PORT
Definition: serial.c:44
#define memset(x, y, z)
Definition: compat.h:39
signed int * PLONG
Definition: retypes.h:5
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define ERROR_BAD_PATHNAME
Definition: winerror.h:233
BOOL WINAPI SetFileValidData(HANDLE hFile, LONGLONG ValidDataLength)
Definition: fileinfo.c:1211
#define FILE_OPEN_REPARSE_POINT
Definition: from_kernel.h:46
NTSYSAPI ULONG NTAPI RtlIsDosDeviceName_U(_In_ PCWSTR Name)
BOOL WINAPI GetFileTime(IN HANDLE hFile, OUT LPFILETIME lpCreationTime OPTIONAL, OUT LPFILETIME lpLastAccessTime OPTIONAL, OUT LPFILETIME lpLastWriteTime OPTIONAL)
Definition: fileinfo.c:1026
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
IN HDEVINFO IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL
Definition: devinst.c:44
#define FILE_DEVICE_KEYBOARD
Definition: winioctl.h:116
DWORD dwLowDateTime
Definition: mapidefs.h:65
NTSYSAPI NTSTATUS NTAPI NtSetInformationFile(IN HANDLE hFile, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN PVOID FileInformationBuffer, IN ULONG FileInformationBufferLength, IN FILE_INFORMATION_CLASS FileInfoClass)
Definition: iofunc.c:2817
NTSYSAPI BOOLEAN NTAPI RtlDosPathNameToNtPathName_U(_In_opt_z_ PCWSTR DosPathName, _Out_ PUNICODE_STRING NtPathName, _Out_opt_ PCWSTR *NtFileNamePart, _Out_opt_ PRTL_RELATIVE_NAME_U DirectoryInfo)
_In_ LPCSTR lpFileName
Definition: winbase.h:2959
LONGLONG QuadPart
Definition: typedefs.h:112
BOOL WINAPI GetFileSizeEx(HANDLE hFile, PLARGE_INTEGER lpFileSize)
Definition: fileinfo.c:497
#define FILE_DEVICE_PRINTER
Definition: winioctl.h:129
#define ERROR_FILENAME_EXCED_RANGE
Definition: winerror.h:263