ReactOS 0.4.16-dev-197-g92996da
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/*
22 * @implemented
23 */
26{
29
31
33 {
35 }
36
39 if (!NT_SUCCESS(Status))
40 {
42 return FALSE;
43 }
44 return TRUE;
45}
46
47
48/*
49 * @implemented
50 */
55 LONG lDistanceToMove,
56 PLONG lpDistanceToMoveHigh,
57 DWORD dwMoveMethod)
58{
59 FILE_POSITION_INFORMATION FilePosition;
60 FILE_STANDARD_INFORMATION FileStandard;
61 NTSTATUS errCode;
63 LARGE_INTEGER Distance;
64
65 TRACE("SetFilePointer(hFile %p, lDistanceToMove %d, dwMoveMethod %lu)\n",
66 hFile,lDistanceToMove,dwMoveMethod);
67
69 {
72 }
73
74 if (lpDistanceToMoveHigh)
75 {
76 Distance.u.HighPart = *lpDistanceToMoveHigh;
77 Distance.u.LowPart = lDistanceToMove;
78 }
79 else
80 {
81 Distance.QuadPart = lDistanceToMove;
82 }
83
84 switch(dwMoveMethod)
85 {
86 case FILE_CURRENT:
89 &FilePosition,
92 FilePosition.CurrentByteOffset.QuadPart += Distance.QuadPart;
93 if (!NT_SUCCESS(errCode))
94 {
95 if (lpDistanceToMoveHigh != NULL)
96 *lpDistanceToMoveHigh = -1;
97 BaseSetLastNTError(errCode);
99 }
100 break;
101 case FILE_END:
104 &FileStandard,
107 FilePosition.CurrentByteOffset.QuadPart =
108 FileStandard.EndOfFile.QuadPart + Distance.QuadPart;
109 if (!NT_SUCCESS(errCode))
110 {
111 if (lpDistanceToMoveHigh != NULL)
112 *lpDistanceToMoveHigh = -1;
113 BaseSetLastNTError(errCode);
115 }
116 break;
117 case FILE_BEGIN:
118 FilePosition.CurrentByteOffset.QuadPart = Distance.QuadPart;
119 break;
120 default:
123 }
124
125 if(FilePosition.CurrentByteOffset.QuadPart < 0)
126 {
129 }
130
131 if (lpDistanceToMoveHigh == NULL && FilePosition.CurrentByteOffset.HighPart != 0)
132 {
133 /* If we're moving the pointer outside of the 32 bit boundaries but
134 the application only passed a 32 bit value we need to bail out! */
137 }
138
139 errCode = NtSetInformationFile(hFile,
141 &FilePosition,
144 if (!NT_SUCCESS(errCode))
145 {
146 if (lpDistanceToMoveHigh != NULL)
147 *lpDistanceToMoveHigh = -1;
148
149 BaseSetLastNTError(errCode);
151 }
152
153 if (lpDistanceToMoveHigh != NULL)
154 {
155 *lpDistanceToMoveHigh = FilePosition.CurrentByteOffset.u.HighPart;
156 }
157
158 if (FilePosition.CurrentByteOffset.u.LowPart == MAXDWORD)
159 {
160 /* The value of -1 is valid here, especially when the new
161 file position is greater than 4 GB. Since NtSetInformationFile
162 succeeded we never set an error code and we explicitly need
163 to clear a previously set error code in this case, which
164 an application will check if INVALID_SET_FILE_POINTER is returned! */
166 }
167
168 return FilePosition.CurrentByteOffset.u.LowPart;
169}
170
171
172/*
173 * @implemented
174 */
175BOOL
176WINAPI
178 LARGE_INTEGER liDistanceToMove,
179 PLARGE_INTEGER lpNewFilePointer,
180 DWORD dwMoveMethod)
181{
184 FILE_POSITION_INFORMATION FilePosition;
185 FILE_STANDARD_INFORMATION FileStandard;
186
188 {
190 return FALSE;
191 }
192
193 switch (dwMoveMethod)
194 {
195 case FILE_CURRENT:
196 {
198 &FilePosition,
201 if (!NT_SUCCESS(Status))
202 {
204 return FALSE;
205 }
206
207 FilePosition.CurrentByteOffset.QuadPart += liDistanceToMove.QuadPart;
208 break;
209 }
210
211 case FILE_END:
212 {
214 &FileStandard,
217 if (!NT_SUCCESS(Status))
218 {
220 return FALSE;
221 }
222
223 FilePosition.CurrentByteOffset.QuadPart = FileStandard.EndOfFile.QuadPart +
224 liDistanceToMove.QuadPart;
225 break;
226 }
227
228 case FILE_BEGIN:
229 {
230 FilePosition.CurrentByteOffset.QuadPart = liDistanceToMove.QuadPart;
231 break;
232 }
233
234 default:
235 {
237 return FALSE;
238 }
239 }
240
241 if (FilePosition.CurrentByteOffset.QuadPart < 0)
242 {
244 return FALSE;
245 }
246
250 if (!NT_SUCCESS(Status))
251 {
253 return FALSE;
254 }
255
256 if (lpNewFilePointer != NULL)
257 {
258 *lpNewFilePointer = FilePosition.CurrentByteOffset;
259 }
260
261 return TRUE;
262}
263
264
265/*
266 * @implemented
267 */
270{
272 IO_STATUS_BLOCK StatusBlock;
274
275 /* Get real handle */
277
278 /* Check for console handle */
280 {
282 return FILE_TYPE_CHAR;
283 }
284
286 &StatusBlock,
287 &DeviceInfo,
290 if (!NT_SUCCESS(Status))
291 {
293 return FILE_TYPE_UNKNOWN;
294 }
295
296 switch (DeviceInfo.DeviceType)
297 {
302 case FILE_DEVICE_DFS:
303 case FILE_DEVICE_DISK:
306 return FILE_TYPE_DISK;
307
310 case FILE_DEVICE_NULL:
317 return FILE_TYPE_CHAR;
318
320 return FILE_TYPE_PIPE;
321 }
322
323 return FILE_TYPE_UNKNOWN;
324}
325
326
327/*
328 * @implemented
329 */
332 LPDWORD lpFileSizeHigh)
333{
334 NTSTATUS errCode;
335 FILE_STANDARD_INFORMATION FileStandard;
337
340 &FileStandard,
343 if (!NT_SUCCESS(errCode))
344 {
345 BaseSetLastNTError(errCode);
346 if ( lpFileSizeHigh == NULL )
347 {
348 return -1;
349 }
350 else
351 {
352 return 0;
353 }
354 }
355 if ( lpFileSizeHigh != NULL )
356 *lpFileSizeHigh = FileStandard.EndOfFile.u.HighPart;
357
358 return FileStandard.EndOfFile.u.LowPart;
359}
360
361
362/*
363 * @implemented
364 */
365BOOL
366WINAPI
369 PLARGE_INTEGER lpFileSize
370 )
371{
372 NTSTATUS errCode;
373 FILE_STANDARD_INFORMATION FileStandard;
375
378 &FileStandard,
381 if (!NT_SUCCESS(errCode))
382 {
383 BaseSetLastNTError(errCode);
384 return FALSE;
385 }
386 if (lpFileSize)
387 *lpFileSize = FileStandard.EndOfFile;
388
389 return TRUE;
390}
391
392
393/*
394 * @implemented
395 */
398 LPDWORD lpFileSizeHigh)
399{
400 PWCHAR FileNameW;
401
402 if (!(FileNameW = FilenameA2W(lpFileName, FALSE)))
403 return INVALID_FILE_SIZE;
404
405 return GetCompressedFileSizeW(FileNameW, lpFileSizeHigh);
406}
407
408
409/*
410 * @implemented
411 */
414 LPDWORD lpFileSizeHigh)
415{
416 FILE_COMPRESSION_INFORMATION FileCompression;
417 NTSTATUS errCode;
420
424 NULL,
427 NULL);
428
430 return INVALID_FILE_SIZE;
431
434 &FileCompression,
437
439
440 if (!NT_SUCCESS(errCode))
441 {
442 BaseSetLastNTError(errCode);
443 return INVALID_FILE_SIZE;
444 }
445
446 if(lpFileSizeHigh)
447 *lpFileSizeHigh = FileCompression.CompressedFileSize.u.HighPart;
448
450 return FileCompression.CompressedFileSize.u.LowPart;
451}
452
453
454/*
455 * @implemented
456 */
459 LPBY_HANDLE_FILE_INFORMATION lpFileInformation)
460{
461 struct
462 {
463 FILE_FS_VOLUME_INFORMATION FileFsVolume;
464 WCHAR Name[255];
465 }
466 FileFsVolume;
467
468 FILE_BASIC_INFORMATION FileBasic;
469 FILE_INTERNAL_INFORMATION FileInternal;
470 FILE_STANDARD_INFORMATION FileStandard;
471 NTSTATUS errCode;
473
475 {
477 return FALSE;
478 }
479
482 &FileBasic,
485 if (!NT_SUCCESS(errCode))
486 {
487 BaseSetLastNTError(errCode);
488 return FALSE;
489 }
490
491 lpFileInformation->dwFileAttributes = (DWORD)FileBasic.FileAttributes;
492
493 lpFileInformation->ftCreationTime.dwHighDateTime = FileBasic.CreationTime.u.HighPart;
494 lpFileInformation->ftCreationTime.dwLowDateTime = FileBasic.CreationTime.u.LowPart;
495
496 lpFileInformation->ftLastAccessTime.dwHighDateTime = FileBasic.LastAccessTime.u.HighPart;
497 lpFileInformation->ftLastAccessTime.dwLowDateTime = FileBasic.LastAccessTime.u.LowPart;
498
499 lpFileInformation->ftLastWriteTime.dwHighDateTime = FileBasic.LastWriteTime.u.HighPart;
500 lpFileInformation->ftLastWriteTime.dwLowDateTime = FileBasic.LastWriteTime.u.LowPart;
501
504 &FileInternal,
507 if (!NT_SUCCESS(errCode))
508 {
509 BaseSetLastNTError(errCode);
510 return FALSE;
511 }
512
513 lpFileInformation->nFileIndexHigh = FileInternal.IndexNumber.u.HighPart;
514 lpFileInformation->nFileIndexLow = FileInternal.IndexNumber.u.LowPart;
515
518 &FileFsVolume,
519 sizeof(FileFsVolume),
521 if (!NT_SUCCESS(errCode))
522 {
523 BaseSetLastNTError(errCode);
524 return FALSE;
525 }
526
527 lpFileInformation->dwVolumeSerialNumber = FileFsVolume.FileFsVolume.VolumeSerialNumber;
528
531 &FileStandard,
534 if (!NT_SUCCESS(errCode))
535 {
536 BaseSetLastNTError(errCode);
537 return FALSE;
538 }
539
540 lpFileInformation->nNumberOfLinks = FileStandard.NumberOfLinks;
541 lpFileInformation->nFileSizeHigh = FileStandard.EndOfFile.u.HighPart;
542 lpFileInformation->nFileSizeLow = FileStandard.EndOfFile.u.LowPart;
543
544 return TRUE;
545}
546
547
548/*
549 * @implemented
550 */
553 GET_FILEEX_INFO_LEVELS fInfoLevelId,
554 LPVOID lpFileInformation)
555{
560 WIN32_FILE_ATTRIBUTE_DATA* FileAttributeData;
561
562 TRACE("GetFileAttributesExW(%S) called\n", lpFileName);
563
564
565 if (fInfoLevelId != GetFileExInfoStandard || lpFileInformation == NULL)
566 {
568 return FALSE;
569 }
570
571 /* Validate and translate the filename */
573 &FileName,
574 NULL,
575 NULL))
576 {
577 WARN ("Invalid path '%S'\n", lpFileName);
579 return FALSE;
580 }
581
582 /* build the object attributes */
584 &FileName,
586 NULL,
587 NULL);
588
589 /* Get file attributes */
592
594 if (!NT_SUCCESS (Status))
595 {
596 WARN ("NtQueryFullAttributesFile() failed (Status %lx)\n", Status);
598 return FALSE;
599 }
600
601 FileAttributeData = (WIN32_FILE_ATTRIBUTE_DATA*)lpFileInformation;
602 FileAttributeData->dwFileAttributes = FileInformation.FileAttributes;
603 FileAttributeData->ftCreationTime.dwLowDateTime = FileInformation.CreationTime.u.LowPart;
604 FileAttributeData->ftCreationTime.dwHighDateTime = FileInformation.CreationTime.u.HighPart;
605 FileAttributeData->ftLastAccessTime.dwLowDateTime = FileInformation.LastAccessTime.u.LowPart;
606 FileAttributeData->ftLastAccessTime.dwHighDateTime = FileInformation.LastAccessTime.u.HighPart;
607 FileAttributeData->ftLastWriteTime.dwLowDateTime = FileInformation.LastWriteTime.u.LowPart;
608 FileAttributeData->ftLastWriteTime.dwHighDateTime = FileInformation.LastWriteTime.u.HighPart;
609 FileAttributeData->nFileSizeLow = FileInformation.EndOfFile.u.LowPart;
610 FileAttributeData->nFileSizeHigh = FileInformation.EndOfFile.u.HighPart;
611
612 return TRUE;
613}
614
615/*
616 * @implemented
617 */
620 GET_FILEEX_INFO_LEVELS fInfoLevelId,
621 LPVOID lpFileInformation)
622{
623 PWCHAR FileNameW;
624
625 if (!(FileNameW = FilenameA2W(lpFileName, FALSE)))
626 return FALSE;
627
628 return GetFileAttributesExW(FileNameW, fInfoLevelId, lpFileInformation);
629}
630
631
632/*
633 * @implemented
634 */
637{
638 PWSTR FileNameW;
639
640 if (!lpFileName || !(FileNameW = FilenameA2W(lpFileName, FALSE)))
642
643 return GetFileAttributesW(FileNameW);
644}
645
646
647/*
648 * @implemented
649 */
650DWORD
651WINAPI
653{
658
659 /* Get the NT path name */
661 {
664 }
665
666 /* Prepare for querying attributes */
669 NULL, NULL);
670 /* Simply query attributes */
672 if (!NT_SUCCESS(Status))
673 {
674 /* It failed? Is it a DOS device? */
676 {
678 }
679
680 /* Set the error otherwise */
683 }
684
685 /* Return the file attributes */
686 return FileInformation.FileAttributes;
687}
688
689
690/*
691 * @implemented
692 */
697{
698 FILE_BASIC_INFORMATION FileBasic;
701
703
705 {
707 return FALSE;
708 }
709
712 &FileBasic,
713 sizeof(FileBasic),
715 if (NT_SUCCESS(Status))
716 {
717 *dwFileAttributes = FileBasic.FileAttributes;
718 return TRUE;
719 }
720
722 return FALSE;
723}
724
725
726/*
727 * @implemented
728 */
733{
734 FILE_BASIC_INFORMATION FileBasic;
737
739
741 {
743 return FALSE;
744 }
745
748 &FileBasic,
749 sizeof(FileBasic),
751 if (NT_SUCCESS(Status))
752 {
754
757 &FileBasic,
758 sizeof(FileBasic),
760 }
761
762 if (!NT_SUCCESS(Status))
763 {
765 return FALSE;
766 }
767
768 return TRUE;
769}
770
771
772/*
773 * @implemented
774 */
779{
780 PWCHAR FileNameW;
781
782 if (!(FileNameW = FilenameA2W(lpFileName, FALSE)))
783 return FALSE;
784
785 return SetFileAttributesW(FileNameW, dwFileAttributes);
786}
787
788
789/*
790 * @implemented
791 */
792BOOL
793WINAPI
796{
798 PWSTR PathUBuffer;
800 UNICODE_STRING NtPathU;
802 RTL_RELATIVE_NAME_U RelativeName;
805
806 /* Get relative name */
807 if (!RtlDosPathNameToRelativeNtPathName_U(lpFileName, &NtPathU, NULL, &RelativeName))
808 {
810 return FALSE;
811 }
812
813 /* Save buffer to allow later freeing */
814 PathUBuffer = NtPathU.Buffer;
815
816 /* If we have relative name (and root dir), use them instead */
817 if (RelativeName.RelativeName.Length != 0)
818 {
819 NtPathU.Length = RelativeName.RelativeName.Length;
820 NtPathU.MaximumLength = RelativeName.RelativeName.MaximumLength;
821 NtPathU.Buffer = RelativeName.RelativeName.Buffer;
822 }
823 else
824 {
825 RelativeName.ContainingDirectory = NULL;
826 }
827
828 /* Prepare the object attribute for opening the file */
831 RelativeName.ContainingDirectory, NULL);
832
833 /* Attempt to open the file, while supporting reparse point */
838 /* If opening failed, check whether it was because of reparse point support */
839 if (!NT_SUCCESS(Status))
840 {
841 /* Nope, just quit */
843 {
844 RtlReleaseRelativeName(&RelativeName);
845 RtlFreeHeap(RtlGetProcessHeap(), 0, PathUBuffer);
847
848 return FALSE;
849 }
850
851 /* Yes, retry without */
856 if (!NT_SUCCESS(Status))
857 {
858 RtlReleaseRelativeName(&RelativeName);
859 RtlFreeHeap(RtlGetProcessHeap(), 0, PathUBuffer);
861
862 return FALSE;
863 }
864 }
865
866 /* We don't need strings anylonger */
867 RtlReleaseRelativeName(&RelativeName);
868 RtlFreeHeap(RtlGetProcessHeap(), 0, PathUBuffer);
869
870 /* Zero our structure, we'll only set file attributes */
872 /* Set the attributes, filtering only allowed attributes, and forcing normal attribute */
874
875 /* Finally, set the attributes */
878 /* Close the file */
880
881 /* If it failed, set the error and fail */
882 if (!NT_SUCCESS(Status))
883 {
885
886 return FALSE;
887 }
888
889 return TRUE;
890}
891
892/*
893 * @implemented
894 */
897 OUT LPFILETIME lpCreationTime OPTIONAL,
898 OUT LPFILETIME lpLastAccessTime OPTIONAL,
899 OUT LPFILETIME lpLastWriteTime OPTIONAL)
900{
903 FILE_BASIC_INFORMATION FileBasic;
904
906 {
908 return FALSE;
909 }
910
913 &FileBasic,
916 if (!NT_SUCCESS(Status))
917 {
919 return FALSE;
920 }
921
922 if (lpCreationTime)
923 {
924 lpCreationTime->dwLowDateTime = FileBasic.CreationTime.LowPart;
925 lpCreationTime->dwHighDateTime = FileBasic.CreationTime.HighPart;
926 }
927
928 if (lpLastAccessTime)
929 {
930 lpLastAccessTime->dwLowDateTime = FileBasic.LastAccessTime.LowPart;
931 lpLastAccessTime->dwHighDateTime = FileBasic.LastAccessTime.HighPart;
932 }
933
934 if (lpLastWriteTime)
935 {
936 lpLastWriteTime->dwLowDateTime = FileBasic.LastWriteTime.LowPart;
937 lpLastWriteTime->dwHighDateTime = FileBasic.LastWriteTime.HighPart;
938 }
939
940 return TRUE;
941}
942
943
944/*
945 * @implemented
946 */
949 CONST FILETIME *lpCreationTime OPTIONAL,
950 CONST FILETIME *lpLastAccessTime OPTIONAL,
951 CONST FILETIME *lpLastWriteTime OPTIONAL)
952{
955 FILE_BASIC_INFORMATION FileBasic;
956
958 {
960 return FALSE;
961 }
962
963 memset(&FileBasic, 0, sizeof(FILE_BASIC_INFORMATION));
964
965 if (lpCreationTime)
966 {
967 FileBasic.CreationTime.LowPart = lpCreationTime->dwLowDateTime;
968 FileBasic.CreationTime.HighPart = lpCreationTime->dwHighDateTime;
969 }
970
971 if (lpLastAccessTime)
972 {
973 FileBasic.LastAccessTime.LowPart = lpLastAccessTime->dwLowDateTime;
974 FileBasic.LastAccessTime.HighPart = lpLastAccessTime->dwHighDateTime;
975 }
976
977 if (lpLastWriteTime)
978 {
979 FileBasic.LastWriteTime.LowPart = lpLastWriteTime->dwLowDateTime;
980 FileBasic.LastWriteTime.HighPart = lpLastWriteTime->dwHighDateTime;
981 }
982
985 &FileBasic,
988 if (!NT_SUCCESS(Status))
989 {
991 return FALSE;
992 }
993
994 return TRUE;
995}
996
997
998/*
999 * The caller must have opened the file with the DesiredAccess FILE_WRITE_DATA flag set.
1000 *
1001 * @implemented
1002 */
1005{
1007 FILE_END_OF_FILE_INFORMATION EndOfFileInfo;
1008 FILE_ALLOCATION_INFORMATION FileAllocationInfo;
1009 FILE_POSITION_INFORMATION FilePosInfo;
1011
1013 {
1015 return FALSE;
1016 }
1017
1018 //get current position
1020 hFile,
1022 &FilePosInfo,
1025 );
1026
1027 if (!NT_SUCCESS(Status)){
1029 return FALSE;
1030 }
1031
1032 EndOfFileInfo.EndOfFile.QuadPart = FilePosInfo.CurrentByteOffset.QuadPart;
1033
1034 /*
1035 NOTE:
1036 This call is not supposed to free up any space after the eof marker
1037 if the file gets truncated. We have to deallocate the space explicitly afterwards.
1038 But...most file systems dispatch both FileEndOfFileInformation
1039 and FileAllocationInformation as they were the same command.
1040
1041 */
1043 hFile,
1044 &IoStatusBlock, //out
1045 &EndOfFileInfo,
1048 );
1049
1050 if (!NT_SUCCESS(Status)){
1052 return FALSE;
1053 }
1054
1055 FileAllocationInfo.AllocationSize.QuadPart = FilePosInfo.CurrentByteOffset.QuadPart;
1056
1057
1059 hFile,
1060 &IoStatusBlock, //out
1061 &FileAllocationInfo,
1064 );
1065
1066 if (!NT_SUCCESS(Status)){
1068 return FALSE;
1069 }
1070
1071 return TRUE;
1072
1073}
1074
1075
1076/*
1077 * @implemented
1078 */
1079BOOL
1080WINAPI
1082 HANDLE hFile,
1083 LONGLONG ValidDataLength
1084 )
1085{
1087 FILE_VALID_DATA_LENGTH_INFORMATION ValidDataLengthInformation;
1089
1090 ValidDataLengthInformation.ValidDataLength.QuadPart = ValidDataLength;
1091
1093 hFile,
1094 &IoStatusBlock, //out
1095 &ValidDataLengthInformation,
1098 );
1099
1100 if (!NT_SUCCESS(Status)){
1102 return FALSE;
1103 }
1104
1105 return TRUE;
1106}
1107
1108/* EOF */
DWORD dwFileAttributes
#define DECLSPEC_HOTPATCH
Definition: _mingw.h:240
LONG NTSTATUS
Definition: precomp.h:26
#define DEBUG_CHANNEL(args)
Definition: rdesktop.h:159
BOOL WINAPI FlushConsoleInputBuffer(IN HANDLE hConsoleInput)
Definition: console.c:220
#define WARN(fmt,...)
Definition: precomp.h:61
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:608
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define STATUS_INVALID_HANDLE
Definition: d3dkmdt.h:40
#define NO_ERROR
Definition: dderror.h:5
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define CloseHandle
Definition: compat.h:739
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define FILE_BEGIN
Definition: compat.h:761
#define INVALID_SET_FILE_POINTER
Definition: compat.h:732
#define OPEN_EXISTING
Definition: compat.h:775
#define SetFilePointer
Definition: compat.h:743
#define SetLastError(x)
Definition: compat.h:752
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define GENERIC_READ
Definition: compat.h:135
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
#define CreateFileW
Definition: compat.h:741
#define GetFileSizeEx
Definition: compat.h:757
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define FILE_SHARE_READ
Definition: compat.h:136
BOOL WINAPI DECLSPEC_HOTPATCH VerifyConsoleIoHandle(HANDLE hIoHandle)
Definition: console.c:1110
BOOL WINAPI SetFileValidData(HANDLE hFile, LONGLONG ValidDataLength)
Definition: fileinfo.c:1081
BOOL WINAPI GetFileInformationByHandle(HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation)
Definition: fileinfo.c:458
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
Definition: fileinfo.c:652
BOOL WINAPI SetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes)
Definition: fileinfo.c:794
DWORD WINAPI GetCompressedFileSizeW(LPCWSTR lpFileName, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:413
BOOL WINAPI SetFileAttributesA(LPCSTR lpFileName, DWORD dwFileAttributes)
Definition: fileinfo.c:776
DWORD WINAPI GetFileType(HANDLE hFile)
Definition: fileinfo.c:269
BOOL WINAPI FlushFileBuffers(IN HANDLE hFile)
Definition: fileinfo.c:25
BOOL WINAPI GetFileAttributesExA(LPCSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation)
Definition: fileinfo.c:619
BOOL WINAPI SetFileAttributesByHandle(IN HANDLE hFile, IN DWORD dwFileAttributes, IN DWORD dwFlags)
Definition: fileinfo.c:730
BOOL WINAPI GetFileAttributesByHandle(IN HANDLE hFile, OUT LPDWORD dwFileAttributes, IN DWORD dwFlags)
Definition: fileinfo.c:694
BOOL WINAPI SetEndOfFile(HANDLE hFile)
Definition: fileinfo.c:1004
BOOL WINAPI GetFileAttributesExW(LPCWSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation)
Definition: fileinfo.c:552
BOOL WINAPI SetFileTime(IN HANDLE hFile, CONST FILETIME *lpCreationTime OPTIONAL, CONST FILETIME *lpLastAccessTime OPTIONAL, CONST FILETIME *lpLastWriteTime OPTIONAL)
Definition: fileinfo.c:948
DWORD WINAPI GetCompressedFileSizeA(LPCSTR lpFileName, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:397
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:331
BOOL WINAPI GetFileTime(IN HANDLE hFile, OUT LPFILETIME lpCreationTime OPTIONAL, OUT LPFILETIME lpLastAccessTime OPTIONAL, OUT LPFILETIME lpLastWriteTime OPTIONAL)
Definition: fileinfo.c:896
BOOL WINAPI SetFilePointerEx(HANDLE hFile, LARGE_INTEGER liDistanceToMove, PLARGE_INTEGER lpNewFilePointer, DWORD dwMoveMethod)
Definition: fileinfo.c:177
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:636
PWCHAR FilenameA2W(LPCSTR NameA, BOOL alloc)
Definition: fileutils.c:18
HANDLE TranslateStdHandle(IN HANDLE hHandle)
Definition: handle.c:19
struct _FileName FileName
Definition: fatprocs.h:897
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
Definition: fltkernel.h:1231
@ FilePositionInformation
Definition: from_kernel.h:75
@ FileEndOfFileInformation
Definition: from_kernel.h:81
@ FileCompressionInformation
Definition: from_kernel.h:89
@ FileInternalInformation
Definition: from_kernel.h:67
@ FileValidDataLengthInformation
Definition: from_kernel.h:100
@ FileAllocationInformation
Definition: from_kernel.h:80
@ FileBasicInformation
Definition: from_kernel.h:65
#define FILE_OPEN_REPARSE_POINT
Definition: from_kernel.h:46
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
@ FileFsDeviceInformation
Definition: from_kernel.h:222
@ FileFsVolumeInformation
Definition: from_kernel.h:219
#define FILE_OPEN_FOR_BACKUP_INTENT
Definition: from_kernel.h:42
Status
Definition: gdiplustypes.h:25
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
NTSTATUS NTAPI NtFlushBuffersFile(IN HANDLE FileHandle, OUT PIO_STATUS_BLOCK IoStatusBlock)
Definition: iofunc.c:1487
#define kernel32file
Definition: kernel32.h:6
#define FILE_DEVICE_SERIAL_PORT
Definition: serial.c:44
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
static OUT PIO_STATUS_BLOCK OUT PVOID FileInformation
Definition: pipe.c:75
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
_In_ HANDLE hFile
Definition: mswsock.h:90
NTSYSAPI ULONG NTAPI RtlIsDosDeviceName_U(_In_ PCWSTR Name)
VOID NTAPI RtlReleaseRelativeName(_In_ PRTL_RELATIVE_NAME_U RelativeName)
NTSYSAPI BOOLEAN NTAPI RtlDosPathNameToRelativeNtPathName_U(_In_ PCWSTR DosName, _Out_ PUNICODE_STRING NtName, _Out_ PCWSTR *PartName, _Out_ PRTL_RELATIVE_NAME_U RelativeName)
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)
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:3952
#define FILE_ATTRIBUTE_VALID_SET_FLAGS
Definition: nt_native.h:715
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define SYNCHRONIZE
Definition: nt_native.h:61
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:3096
NTSYSAPI NTSTATUS NTAPI NtQueryInformationFile(IN HANDLE hFile, OUT PIO_STATUS_BLOCK pIoStatusBlock, OUT PVOID FileInformationBuffer, IN ULONG FileInformationBufferLength, IN FILE_INFORMATION_CLASS FileInfoClass)
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
#define FILE_WRITE_ATTRIBUTES
Definition: nt_native.h:649
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
#define FILE_ATTRIBUTE_ARCHIVE
Definition: nt_native.h:706
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define DWORD
Definition: nt_native.h:44
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define MAXDWORD
NTSTATUS NTAPI NtQueryAttributesFile(IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PFILE_BASIC_INFORMATION FileInformation)
Definition: file.c:3978
NTSTATUS NTAPI NtQueryFullAttributesFile(IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PFILE_NETWORK_OPEN_INFORMATION FileInformation)
Definition: file.c:3990
#define CONST
Definition: pedump.c:81
long LONG
Definition: pedump.c:60
#define FileStandardInformation
Definition: propsheet.cpp:61
#define FILE_DEVICE_DISK_FILE_SYSTEM
Definition: winioctl.h:53
#define FILE_DEVICE_NAMED_PIPE
Definition: winioctl.h:62
#define FILE_DEVICE_MOUSE
Definition: winioctl.h:60
#define FILE_DEVICE_NULL
Definition: winioctl.h:66
#define FILE_DEVICE_CD_ROM
Definition: winioctl.h:47
#define FILE_DEVICE_SCREEN
Definition: winioctl.h:73
#define FILE_DEVICE_DFS
Definition: winioctl.h:51
#define FILE_DEVICE_KEYBOARD
Definition: winioctl.h:56
#define FILE_DEVICE_DATALINK
Definition: winioctl.h:50
#define FILE_DEVICE_CD_ROM_FILE_SYSTEM
Definition: winioctl.h:48
#define FILE_DEVICE_MODEM
Definition: winioctl.h:88
#define FILE_DEVICE_PARALLEL_PORT
Definition: winioctl.h:67
#define FILE_DEVICE_CONTROLLER
Definition: winioctl.h:49
#define FILE_DEVICE_SOUND
Definition: winioctl.h:74
#define FILE_DEVICE_DISK
Definition: winioctl.h:52
#define FILE_DEVICE_PRINTER
Definition: winioctl.h:69
#define FILE_DEVICE_VIRTUAL_DISK
Definition: winioctl.h:81
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:167
#define IsConsoleHandle(h)
Definition: console.h:14
#define memset(x, y, z)
Definition: compat.h:39
NTSTATUS NTAPI NtQueryVolumeInformationFile(HANDLE FileHandle, PIO_STATUS_BLOCK IoStatusBlock, PVOID FsInformation, ULONG Length, FS_INFORMATION_CLASS FsInformationClass)
#define TRACE(s)
Definition: solgame.cpp:4
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
DWORD dwHighDateTime
Definition: mapidefs.h:66
DWORD dwLowDateTime
Definition: mapidefs.h:65
LARGE_INTEGER AllocationSize
Definition: winternl.h:688
LARGE_INTEGER LastWriteTime
Definition: nt_native.h:941
LARGE_INTEGER CreationTime
Definition: nt_native.h:939
LARGE_INTEGER LastAccessTime
Definition: nt_native.h:940
LARGE_INTEGER CompressedFileSize
Definition: iotypes.h:5849
LARGE_INTEGER CurrentByteOffset
Definition: nt_native.h:955
UNICODE_STRING RelativeName
Definition: rtltypes.h:1380
HANDLE ContainingDirectory
Definition: rtltypes.h:1381
USHORT MaximumLength
Definition: env_spec_w32.h:370
uint16_t * PWSTR
Definition: typedefs.h:56
int64_t LONGLONG
Definition: typedefs.h:68
uint32_t * LPDWORD
Definition: typedefs.h:59
#define IN
Definition: typedefs.h:39
int32_t * PLONG
Definition: typedefs.h:58
uint16_t * PWCHAR
Definition: typedefs.h:56
#define OUT
Definition: typedefs.h:40
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONGLONG QuadPart
Definition: typedefs.h:114
ULONG LowPart
Definition: typedefs.h:106
struct _LARGE_INTEGER::@2299 u
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define ZeroMemory
Definition: winbase.h:1736
#define FILE_END
Definition: winbase.h:114
_In_ LPCSTR lpFileName
Definition: winbase.h:3095
#define FILE_TYPE_UNKNOWN
Definition: winbase.h:283
#define FILE_CURRENT
Definition: winbase.h:113
#define INVALID_FILE_SIZE
Definition: winbase.h:573
enum _GET_FILEEX_INFO_LEVELS GET_FILEEX_INFO_LEVELS
#define FILE_TYPE_CHAR
Definition: winbase.h:285
#define FILE_TYPE_PIPE
Definition: winbase.h:286
@ GetFileExInfoStandard
Definition: winbase.h:1185
#define FILE_TYPE_DISK
Definition: winbase.h:284
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
#define WINAPI
Definition: msvc.h:6
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
#define ERROR_NEGATIVE_SEEK
Definition: winerror.h:203
#define ERROR_BAD_PATHNAME
Definition: winerror.h:233
const char * LPCSTR
Definition: xmlstorage.h:183
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185