ReactOS  0.4.14-dev-552-g2fad488
create.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/create.c
5  * PURPOSE: Directory functions
6  * PROGRAMMER: Ariadne ( ariadne@xs4all.nl)
7  * UPDATE HISTORY:
8  * Created 01/11/98
9  * Removed use of SearchPath (not used by Windows)
10  * 18/08/2002: CreateFileW mess cleaned up (KJK::Hyperion)
11  * 24/08/2002: removed superfluous DPRINTs (KJK::Hyperion)
12  */
13 
14 /* INCLUDES *****************************************************************/
15 
16 #include <k32.h>
17 #define NDEBUG
18 #include <debug.h>
19 
20 #if DBG
22 #endif
23 
24 /* FUNCTIONS ****************************************************************/
25 
26 /*
27  * @implemented
28  */
30  DWORD dwDesiredAccess,
31  DWORD dwShareMode,
32  LPSECURITY_ATTRIBUTES lpSecurityAttributes,
33  DWORD dwCreationDisposition,
34  DWORD dwFlagsAndAttributes,
35  HANDLE hTemplateFile)
36 {
37  PWCHAR FileNameW;
39 
40  TRACE("CreateFileA(lpFileName %s)\n",lpFileName);
41 
42  if (!(FileNameW = FilenameA2W(lpFileName, FALSE)))
43  return INVALID_HANDLE_VALUE;
44 
45  FileHandle = CreateFileW (FileNameW,
46  dwDesiredAccess,
47  dwShareMode,
48  lpSecurityAttributes,
49  dwCreationDisposition,
50  dwFlagsAndAttributes,
51  hTemplateFile);
52 
53  return FileHandle;
54 }
55 
56 
57 /*
58  * @implemented
59  */
61  DWORD dwDesiredAccess,
62  DWORD dwShareMode,
63  LPSECURITY_ATTRIBUTES lpSecurityAttributes,
64  DWORD dwCreationDisposition,
65  DWORD dwFlagsAndAttributes,
66  HANDLE hTemplateFile)
67 {
70  UNICODE_STRING NtPathU;
71  LPCWSTR pszConsoleFileName;
76  ULONG EaLength = 0;
77  BOOLEAN TrailingBackslash;
78 
79  if (!lpFileName || !lpFileName[0])
80  {
82  return INVALID_HANDLE_VALUE;
83  }
84 
85  TRACE("CreateFileW(lpFileName %S)\n",lpFileName);
86 
87  /* validate & translate the creation disposition */
88  switch (dwCreationDisposition)
89  {
90  case CREATE_NEW:
91  dwCreationDisposition = FILE_CREATE;
92  break;
93 
94  case CREATE_ALWAYS:
95  dwCreationDisposition = FILE_OVERWRITE_IF;
96  break;
97 
98  case OPEN_EXISTING:
99  dwCreationDisposition = FILE_OPEN;
100  break;
101 
102  case OPEN_ALWAYS:
103  dwCreationDisposition = FILE_OPEN_IF;
104  break;
105 
106  case TRUNCATE_EXISTING:
107  dwCreationDisposition = FILE_OVERWRITE;
108  break;
109 
110  default:
112  return (INVALID_HANDLE_VALUE);
113  }
114 
115  /* check for console input/output */
116  pszConsoleFileName = IntCheckForConsoleFileName(lpFileName, dwDesiredAccess);
117  if (pszConsoleFileName)
118  {
119  return OpenConsoleW(pszConsoleFileName,
120  dwDesiredAccess,
121  lpSecurityAttributes ? lpSecurityAttributes->bInheritHandle : FALSE,
123  }
124 
125  /* validate & translate the flags */
126 
127  /* translate the flags that need no validation */
128  if (!(dwFlagsAndAttributes & FILE_FLAG_OVERLAPPED))
129  {
130  /* yes, nonalert is correct! apc's are not delivered
131  while waiting for file io to complete */
133  }
134 
135  if(dwFlagsAndAttributes & FILE_FLAG_WRITE_THROUGH)
137 
138  if(dwFlagsAndAttributes & FILE_FLAG_NO_BUFFERING)
140 
141  if(dwFlagsAndAttributes & FILE_FLAG_RANDOM_ACCESS)
143 
144  if(dwFlagsAndAttributes & FILE_FLAG_SEQUENTIAL_SCAN)
146 
147  if(dwFlagsAndAttributes & FILE_FLAG_DELETE_ON_CLOSE)
148  {
150  dwDesiredAccess |= DELETE;
151  }
152 
153  if(dwFlagsAndAttributes & FILE_FLAG_BACKUP_SEMANTICS)
154  {
155  if(dwDesiredAccess & GENERIC_ALL)
157  else
158  {
159  if(dwDesiredAccess & GENERIC_READ)
161 
162  if(dwDesiredAccess & GENERIC_WRITE)
164  }
165  }
166  else
168 
169  if(dwFlagsAndAttributes & FILE_FLAG_OPEN_REPARSE_POINT)
171 
172  if(dwFlagsAndAttributes & FILE_FLAG_OPEN_NO_RECALL)
174 
176 
177  /* handle may always be waited on and querying attributes are always allowed */
178  dwDesiredAccess |= SYNCHRONIZE | FILE_READ_ATTRIBUTES;
179 
180  /* FILE_FLAG_POSIX_SEMANTICS is handled later */
181 
182  /* validate & translate the filename */
184  &NtPathU,
185  NULL,
186  NULL))
187  {
188  WARN("Invalid path\n");
190  return INVALID_HANDLE_VALUE;
191  }
192 
193  TRACE("NtPathU \'%wZ\'\n", &NtPathU);
194 
195  TrailingBackslash = FALSE;
196  if (NtPathU.Length >= sizeof(WCHAR) &&
197  NtPathU.Buffer[NtPathU.Length / sizeof(WCHAR) - 1])
198  {
199  TrailingBackslash = TRUE;
200  }
201 
202  if (hTemplateFile != NULL)
203  {
204  FILE_EA_INFORMATION EaInformation;
205 
206  for (;;)
207  {
208  /* try to get the size of the extended attributes, if we fail just continue
209  creating the file without copying the attributes! */
210  Status = NtQueryInformationFile(hTemplateFile,
211  &IoStatusBlock,
212  &EaInformation,
213  sizeof(FILE_EA_INFORMATION),
215  if (NT_SUCCESS(Status) && (EaInformation.EaSize != 0))
216  {
217  /* there's extended attributes to read, let's give it a try */
218  EaBuffer = RtlAllocateHeap(RtlGetProcessHeap(),
219  0,
220  EaInformation.EaSize);
221  if (EaBuffer == NULL)
222  {
223  RtlFreeHeap(RtlGetProcessHeap(),
224  0,
225  NtPathU.Buffer);
226 
227  /* the template file handle is valid and has extended attributes,
228  however we seem to lack some memory here. We should fail here! */
230  return INVALID_HANDLE_VALUE;
231  }
232 
233  Status = NtQueryEaFile(hTemplateFile,
234  &IoStatusBlock,
235  EaBuffer,
236  EaInformation.EaSize,
237  FALSE,
238  NULL,
239  0,
240  NULL,
241  TRUE);
242 
243  if (NT_SUCCESS(Status))
244  {
245  /* we successfully read the extended attributes, break the loop
246  and continue */
247  EaLength = EaInformation.EaSize;
248  break;
249  }
250  else
251  {
252  RtlFreeHeap(RtlGetProcessHeap(),
253  0,
254  EaBuffer);
255  EaBuffer = NULL;
256 
258  {
259  /* unless we just allocated not enough memory, break the loop
260  and just continue without copying extended attributes */
261  break;
262  }
263  }
264  }
265  else
266  {
267  /* we either failed to get the size of the extended attributes or
268  they're empty, just continue as there's no need to copy
269  attributes */
270  break;
271  }
272  }
273  }
274 
275  /* build the object attributes */
277  &NtPathU,
278  0,
279  NULL,
280  NULL);
281 
282  if (lpSecurityAttributes)
283  {
284  if(lpSecurityAttributes->bInheritHandle)
285  ObjectAttributes.Attributes |= OBJ_INHERIT;
286 
287  ObjectAttributes.SecurityDescriptor = lpSecurityAttributes->lpSecurityDescriptor;
288  }
289 
290  if(!(dwFlagsAndAttributes & FILE_FLAG_POSIX_SEMANTICS))
292 
293  /* perform the call */
295  dwDesiredAccess,
297  &IoStatusBlock,
298  NULL,
300  dwShareMode,
301  dwCreationDisposition,
302  Flags,
303  EaBuffer,
304  EaLength);
305 
306  RtlFreeHeap(RtlGetProcessHeap(),
307  0,
308  NtPathU.Buffer);
309 
310  /* free the extended attributes buffer if allocated */
311  if (EaBuffer != NULL)
312  {
313  RtlFreeHeap(RtlGetProcessHeap(),
314  0,
315  EaBuffer);
316  }
317 
318  /* error */
319  if (!NT_SUCCESS(Status))
320  {
321  /* In the case file creation was rejected due to CREATE_NEW flag
322  * was specified and file with that name already exists, correct
323  * last error is ERROR_FILE_EXISTS and not ERROR_ALREADY_EXISTS.
324  * Note: RtlNtStatusToDosError is not the subject to blame here.
325  */
327  dwCreationDisposition == FILE_CREATE)
328  {
330  }
331  else if (Status == STATUS_FILE_IS_A_DIRECTORY &&
332  TrailingBackslash)
333  {
335  }
336  else
337  {
339  }
340 
341  return INVALID_HANDLE_VALUE;
342  }
343 
344  /*
345  create with OPEN_ALWAYS (FILE_OPEN_IF) returns info = FILE_OPENED or FILE_CREATED
346  create with CREATE_ALWAYS (FILE_OVERWRITE_IF) returns info = FILE_OVERWRITTEN or FILE_CREATED
347  */
348  if (dwCreationDisposition == FILE_OPEN_IF)
349  {
351  }
352  else if (dwCreationDisposition == FILE_OVERWRITE_IF)
353  {
355  }
356  else
357  {
359  }
360 
361  return FileHandle;
362 }
363 
364 /*
365  * @implemented
366  */
369  LPOFSTRUCT lpReOpenBuff,
370  UINT uStyle)
371 {
374  UNICODE_STRING FileNameString;
375  UNICODE_STRING FileNameU;
377  WCHAR PathNameW[MAX_PATH];
379  NTSTATUS errCode;
380  PWCHAR FilePart;
381  ULONG Len;
382 
383  TRACE("OpenFile('%s', lpReOpenBuff %p, uStyle %x)\n", lpFileName, lpReOpenBuff, uStyle);
384 
385  if (lpReOpenBuff == NULL)
386  {
387  return HFILE_ERROR;
388  }
389 
390  lpReOpenBuff->nErrCode = 0;
391 
392  if (uStyle & OF_REOPEN) lpFileName = lpReOpenBuff->szPathName;
393 
394  if (!lpFileName)
395  {
396  return HFILE_ERROR;
397  }
398 
400  sizeof(lpReOpenBuff->szPathName),
401  lpReOpenBuff->szPathName,
402  NULL))
403  {
404  lpReOpenBuff->nErrCode = (WORD)GetLastError();
405  return HFILE_ERROR;
406  }
407 
408  if (uStyle & OF_PARSE)
409  {
410  lpReOpenBuff->fFixedDisk = (GetDriveTypeA(lpReOpenBuff->szPathName) != DRIVE_REMOVABLE);
411  TRACE("(%s): OF_PARSE, res = '%s'\n", lpFileName, lpReOpenBuff->szPathName);
412  return 0;
413  }
414 
415  if ((uStyle & OF_EXIST) && !(uStyle & OF_CREATE))
416  {
418 
419  switch (dwAttributes)
420  {
421  case INVALID_FILE_ATTRIBUTES: /* File does not exist */
423  lpReOpenBuff->nErrCode = (WORD) ERROR_FILE_NOT_FOUND;
424  return -1;
425 
428  lpReOpenBuff->nErrCode = (WORD) ERROR_ACCESS_DENIED;
429  return -1;
430 
431  default:
432  lpReOpenBuff->cBytes = sizeof(OFSTRUCT);
433  return 1;
434  }
435  }
436  lpReOpenBuff->cBytes = sizeof(OFSTRUCT);
437  if ((uStyle & OF_CREATE) == OF_CREATE)
438  {
439  DWORD Sharing;
440  switch (uStyle & 0x70)
441  {
442  case OF_SHARE_EXCLUSIVE: Sharing = 0; break;
443  case OF_SHARE_DENY_WRITE: Sharing = FILE_SHARE_READ; break;
444  case OF_SHARE_DENY_READ: Sharing = FILE_SHARE_WRITE; break;
445  case OF_SHARE_DENY_NONE:
446  case OF_SHARE_COMPAT:
447  default:
448  Sharing = FILE_SHARE_READ | FILE_SHARE_WRITE;
449  }
452  Sharing,
453  NULL,
456  0);
457  }
458 
460 
461  /* convert ansi (or oem) string to unicode */
462  if (bIsFileApiAnsi)
464  else
465  RtlOemStringToUnicodeString (&FileNameU, &FileName, TRUE);
466 
467  Len = SearchPathW (NULL,
468  FileNameU.Buffer,
469  NULL,
471  PathNameW,
472  &FilePart);
473 
474  RtlFreeUnicodeString(&FileNameU);
475 
476  if (Len == 0 || Len > OFS_MAXPATHNAME)
477  {
478  lpReOpenBuff->nErrCode = (WORD)GetLastError();
479  return HFILE_ERROR;
480  }
481 
482  if (uStyle & OF_DELETE)
483  {
484  if (!DeleteFileW(PathNameW))
485  {
486  lpReOpenBuff->nErrCode = (WORD)GetLastError();
487  return HFILE_ERROR;
488  }
489  TRACE("(%s): OF_DELETE return = OK\n", lpFileName);
490  return TRUE;
491  }
492 
493  FileName.Buffer = lpReOpenBuff->szPathName;
494  FileName.Length = 0;
495  FileName.MaximumLength = OFS_MAXPATHNAME;
496 
497  RtlInitUnicodeString(&FileNameU, PathNameW);
498 
499  /* convert unicode string to ansi (or oem) */
500  if (bIsFileApiAnsi)
502  else
504 
505  if (!RtlDosPathNameToNtPathName_U (PathNameW,
506  &FileNameString,
507  NULL,
508  NULL))
509  {
510  return HFILE_ERROR;
511  }
512 
513  // FILE_SHARE_READ
514  // FILE_NO_INTERMEDIATE_BUFFERING
515 
517  ObjectAttributes.RootDirectory = NULL;
518  ObjectAttributes.ObjectName = &FileNameString;
520  ObjectAttributes.SecurityDescriptor = NULL;
521  ObjectAttributes.SecurityQualityOfService = NULL;
522 
523  errCode = NtOpenFile (&FileHandle,
526  &IoStatusBlock,
529 
530  RtlFreeHeap(RtlGetProcessHeap(), 0, FileNameString.Buffer);
531 
532  lpReOpenBuff->nErrCode = (WORD)RtlNtStatusToDosError(errCode);
533 
534  if (!NT_SUCCESS(errCode))
535  {
536  BaseSetLastNTError (errCode);
537  return HFILE_ERROR;
538  }
539 
540  if (uStyle & OF_EXIST)
541  {
543  return (HFILE)1;
544  }
545 
546  return (HFILE)(ULONG_PTR)FileHandle;
547 }
548 
549 /*
550  * @unimplemented
551  */
552 BOOL
553 WINAPI
555 {
556  STUB;
557  return FALSE;
558 }
559 
560 /*
561  * @unimplemented
562  */
563 HANDLE
564 WINAPI
565 ReOpenFile(IN HANDLE hOriginalFile,
566  IN DWORD dwDesiredAccess,
567  IN DWORD dwShareMode,
568  IN DWORD dwFlags)
569 {
570  STUB;
571  return INVALID_HANDLE_VALUE;
572 }
573 
574 /* EOF */
#define STATUS_OBJECT_NAME_COLLISION
Definition: udferr_usr.h:150
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
BOOL WINAPI OpenDataFile(HANDLE hFile, DWORD dwUnused)
Definition: create.c:554
HANDLE WINAPI ReOpenFile(IN HANDLE hOriginalFile, IN DWORD dwDesiredAccess, IN DWORD dwShareMode, IN DWORD dwFlags)
Definition: create.c:565
#define IN
Definition: typedefs.h:38
#define ERROR_FILE_EXISTS
Definition: winerror.h:165
#define GENERIC_ALL
Definition: nt_native.h:92
#define FILE_SEQUENTIAL_ONLY
Definition: from_kernel.h:27
#define TRUE
Definition: types.h:120
#define STATUS_FILE_IS_A_DIRECTORY
Definition: udferr_usr.h:164
UINT WINAPI GetDriveTypeA(IN LPCSTR lpRootPathName)
Definition: disk.c:468
#define FILE_OPEN_IF
Definition: from_kernel.h:56
#define FILE_OVERWRITTEN
Definition: nt_native.h:771
BOOL bIsFileApiAnsi
Definition: utils.c:25
#define ERROR_SUCCESS
Definition: deptool.c:10
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
Iosb Status
Definition: create.c:4311
#define FILE_FLAG_POSIX_SEMANTICS
Definition: disk.h:40
#define FILE_ATTRIBUTE_VALID_FLAGS
Definition: nt_native.h:714
#define WARN(fmt,...)
Definition: debug.h:111
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Out_ PIO_STATUS_BLOCK _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ ULONG _In_ ULONG _In_ ULONG _In_opt_ PVOID EaBuffer
Definition: iofuncs.h:835
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
#define FILE_CREATE
Definition: from_kernel.h:55
BYTE cBytes
Definition: winbase.h:1249
#define FILE_OPENED
Definition: nt_native.h:769
#define FILE_OPEN_NO_RECALL
Definition: from_kernel.h:47
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define FILE_OVERWRITE
Definition: from_kernel.h:57
#define FILE_OPEN_REMOTE_INSTANCE
Definition: from_kernel.h:37
uint16_t * PWCHAR
Definition: typedefs.h:54
HANDLE WINAPI CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
Definition: create.c:29
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
char * LPSTR
Definition: xmlstorage.h:182
#define OF_SHARE_DENY_WRITE
Definition: winbase.h:122
DWORD dwAttributes
Definition: vdmdbg.h:34
#define FILE_SHARE_READ
Definition: compat.h:125
#define DRIVE_REMOVABLE
Definition: winbase.h:248
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
DWORD WINAPI GetFullPathNameA(IN LPCSTR lpFileName, IN DWORD nBufferLength, OUT LPSTR lpBuffer, OUT LPSTR *lpFilePart)
Definition: path.c:992
struct _OFSTRUCT OFSTRUCT
HANDLE FileHandle
Definition: stats.c:38
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define FILE_NO_INTERMEDIATE_BUFFERING
Definition: from_kernel.h:28
#define HFILE_ERROR
Definition: winbase.h:111
#define ERROR_ACCESS_DENIED
Definition: compat.h:87
unsigned int BOOL
Definition: ntddk_ex.h:94
#define kernel32file
Definition: kernel32.h:6
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:786
#define GENERIC_WRITE
Definition: nt_native.h:90
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
HANDLE WINAPI CreateFileW(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
Definition: create.c:60
LPCWSTR IntCheckForConsoleFileName(IN LPCWSTR pszName, IN DWORD dwDesiredAccess)
Definition: console.c:345
#define FILE_WRITE_THROUGH
Definition: from_kernel.h:26
#define DEBUG_CHANNEL(args)
Definition: rdesktop.h:159
unsigned char BOOLEAN
WORD nErrCode
Definition: winbase.h:1251
smooth NULL
Definition: ftsmooth.c:416
#define FILE_OVERWRITE_IF
Definition: from_kernel.h:58
BYTE fFixedDisk
Definition: winbase.h:1250
#define OF_REOPEN
Definition: winbase.h:130
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
#define OF_DELETE
Definition: winbase.h:126
const char * LPCSTR
Definition: xmlstorage.h:183
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE _In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Out_ PIO_STATUS_BLOCK _In_opt_ PLARGE_INTEGER _In_ ULONG FileAttributes
Definition: fltkernel.h:1230
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define OPEN_EXISTING
Definition: compat.h:434
struct _OBJECT_ATTRIBUTES OBJECT_ATTRIBUTES
#define OF_SHARE_DENY_READ
Definition: winbase.h:121
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
PWCHAR FilenameA2W(LPCSTR NameA, BOOL alloc)
Definition: fileinfo.c:22
HFILE WINAPI OpenFile(LPCSTR lpFileName, LPOFSTRUCT lpReOpenBuff, UINT uStyle)
Definition: create.c:368
#define FILE_FLAG_WRITE_THROUGH
Definition: disk.h:47
#define FILE_DELETE_ON_CLOSE
Definition: constants.h:494
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:3951
#define TRACE(s)
Definition: solgame.cpp:4
NTSTATUS NTAPI NtCreateFile(OUT PHANDLE FileHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK IoStatusBlock, IN PLARGE_INTEGER AllocationSize OPTIONAL, IN ULONG FileAttributes, IN ULONG ShareAccess, IN ULONG CreateDisposition, IN ULONG CreateOptions, IN PVOID EaBuffer OPTIONAL, IN ULONG EaLength)
IN PVCB IN PDIRENT OUT PULONG EaLength
Definition: fatprocs.h:866
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define FILE_FLAG_NO_BUFFERING
Definition: disk.h:45
#define OBJ_INHERIT
Definition: winternl.h:225
#define MAX_PATH
Definition: compat.h:26
#define WINAPI
Definition: msvc.h:8
#define FILE_FLAG_DELETE_ON_CLOSE
Definition: disk.h:42
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
#define Len
Definition: deflate.h:82
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define SetLastError(x)
Definition: compat.h:417
#define OPEN_ALWAYS
Definition: disk.h:70
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define FILE_NON_DIRECTORY_FILE
Definition: constants.h:492
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToOemString(POEM_STRING DestinationString, PCUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
#define GENERIC_READ
Definition: compat.h:124
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)
DWORD WINAPI SearchPathW(IN LPCWSTR lpPath OPTIONAL, IN LPCWSTR lpFileName, IN LPCWSTR lpExtension OPTIONAL, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart OPTIONAL)
Definition: path.c:1297
Status
Definition: gdiplustypes.h:24
#define FILE_OPEN
Definition: from_kernel.h:54
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define OF_EXIST
Definition: winbase.h:127
struct _FileName FileName
Definition: fatprocs.h:884
#define CREATE_ALWAYS
Definition: disk.h:72
LPVOID lpSecurityDescriptor
Definition: compat.h:181
#define STUB
Definition: kernel32.h:27
#define FILE_FLAG_SEQUENTIAL_SCAN
Definition: disk.h:43
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
#define OFS_MAXPATHNAME
Definition: winbase.h:152
#define FILE_OPEN_FOR_BACKUP_INTENT
Definition: from_kernel.h:42
#define FILE_FLAG_OPEN_NO_RECALL
Definition: disk.h:38
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define FILE_RANDOM_ACCESS
Definition: from_kernel.h:38
unsigned int UINT
Definition: ndis.h:50
#define OF_PARSE
Definition: winbase.h:128
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
#define OF_SHARE_COMPAT
Definition: winbase.h:119
#define FILE_FLAG_BACKUP_SEMANTICS
Definition: disk.h:41
HANDLE WINAPI OpenConsoleW(LPCWSTR wsName, DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwShareMode)
Definition: console.c:791
#define FILE_FLAG_OPEN_REPARSE_POINT
Definition: disk.h:39
#define OF_CREATE
Definition: winbase.h:125
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define ULONG_PTR
Definition: config.h:101
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
CHAR szPathName[OFS_MAXPATHNAME]
Definition: winbase.h:1254
#define CREATE_NEW
Definition: disk.h:69
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
#define TRUNCATE_EXISTING
Definition: disk.h:71
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
NTSTATUS NTAPI NtQueryEaFile(IN HANDLE FileHandle, OUT PIO_STATUS_BLOCK IoStatusBlock, OUT PVOID Buffer, IN ULONG Length, IN BOOLEAN ReturnSingleEntry, IN PVOID EaList OPTIONAL, IN ULONG EaListLength, IN PULONG EaIndex OPTIONAL, IN BOOLEAN RestartScan)
Definition: iofunc.c:2218
#define OF_SHARE_DENY_NONE
Definition: winbase.h:120
#define FILE_FLAG_OVERLAPPED
Definition: disk.h:46
int HFILE
Definition: windef.h:298
#define FILE_OPEN_REPARSE_POINT
Definition: from_kernel.h:46
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:3028
#define OF_SHARE_EXCLUSIVE
Definition: winbase.h:123
#define DELETE
Definition: nt_native.h:57
#define FILE_FLAG_RANDOM_ACCESS
Definition: disk.h:44