ReactOS 0.4.15-dev-8339-g4028de8
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)))
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 {
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
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
175 FileAttributes = (dwFlagsAndAttributes & (FILE_ATTRIBUTE_VALID_FLAGS & ~FILE_ATTRIBUTE_DIRECTORY));
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");
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,
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! */
231 }
232
233 Status = NtQueryEaFile(hTemplateFile,
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,
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 }
332 TrailingBackslash)
333 {
335 }
336 else
337 {
339 }
340
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;
446 case OF_SHARE_COMPAT:
447 default:
449 }
452 Sharing,
453 NULL,
456 0);
457 }
458
460
461 /* convert ansi (or oem) string to unicode */
462 if (bIsFileApiAnsi)
464 else
466
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 &FileNameString,
519 NULL,
520 NULL);
521
522 errCode = NtOpenFile (&FileHandle,
528
529 RtlFreeHeap(RtlGetProcessHeap(), 0, FileNameString.Buffer);
530
531 lpReOpenBuff->nErrCode = (WORD)RtlNtStatusToDosError(errCode);
532
533 if (!NT_SUCCESS(errCode))
534 {
535 BaseSetLastNTError (errCode);
536 return HFILE_ERROR;
537 }
538
539 if (uStyle & OF_EXIST)
540 {
542 return (HFILE)1;
543 }
544
545 return (HFILE)(ULONG_PTR)FileHandle;
546}
547
548/*
549 * @unimplemented
550 */
551BOOL
552WINAPI
554{
555 STUB;
556 return FALSE;
557}
558
559/*
560 * @unimplemented
561 */
562HANDLE
563WINAPI
564ReOpenFile(IN HANDLE hOriginalFile,
565 IN DWORD dwDesiredAccess,
566 IN DWORD dwShareMode,
568{
569 STUB;
571}
572
573/* EOF */
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define FILE_NON_DIRECTORY_FILE
Definition: constants.h:492
#define FILE_DELETE_ON_CLOSE
Definition: constants.h:494
#define DEBUG_CHANNEL(args)
Definition: rdesktop.h:159
#define WARN(fmt,...)
Definition: precomp.h:61
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:590
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 ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define Len
Definition: deflate.h:82
#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 ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define OPEN_EXISTING
Definition: compat.h:775
#define SetLastError(x)
Definition: compat.h:752
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:740
#define GENERIC_READ
Definition: compat.h:135
#define MAX_PATH
Definition: compat.h:34
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
#define FILE_SHARE_READ
Definition: compat.h:136
LPCWSTR IntCheckForConsoleFileName(IN LPCWSTR pszName, IN DWORD dwDesiredAccess)
Definition: console.c:345
HANDLE WINAPI OpenConsoleW(LPCWSTR wsName, DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwShareMode)
Definition: console.c:791
HFILE WINAPI OpenFile(LPCSTR lpFileName, LPOFSTRUCT lpReOpenBuff, UINT uStyle)
Definition: create.c:368
BOOL WINAPI OpenDataFile(HANDLE hFile, DWORD dwUnused)
Definition: create.c:553
HANDLE WINAPI ReOpenFile(IN HANDLE hOriginalFile, IN DWORD dwDesiredAccess, IN DWORD dwShareMode, IN DWORD dwFlags)
Definition: create.c:564
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
UINT WINAPI GetDriveTypeA(IN LPCSTR lpRootPathName)
Definition: disk.c:468
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:636
PWCHAR FilenameA2W(LPCSTR NameA, BOOL alloc)
Definition: fileutils.c:18
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:1298
DWORD WINAPI GetFullPathNameA(IN LPCSTR lpFileName, IN DWORD nBufferLength, OUT LPSTR lpBuffer, OUT LPSTR *lpFilePart)
Definition: path.c:993
BOOL bIsFileApiAnsi
Definition: utils.c:25
#define ULONG_PTR
Definition: config.h:101
IN PVCB IN PDIRENT OUT PULONG EaLength
Definition: fatprocs.h:878
struct _FileName FileName
Definition: fatprocs.h:896
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
_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:1236
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
Definition: fltkernel.h:1231
@ FileEaInformation
Definition: from_kernel.h:68
#define FILE_OPEN
Definition: from_kernel.h:54
#define FILE_CREATE
Definition: from_kernel.h:55
#define FILE_OVERWRITE_IF
Definition: from_kernel.h:58
#define FILE_OPEN_REPARSE_POINT
Definition: from_kernel.h:46
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
#define FILE_NO_INTERMEDIATE_BUFFERING
Definition: from_kernel.h:28
#define FILE_RANDOM_ACCESS
Definition: from_kernel.h:38
#define FILE_OVERWRITE
Definition: from_kernel.h:57
#define FILE_WRITE_THROUGH
Definition: from_kernel.h:26
#define FILE_OPEN_NO_RECALL
Definition: from_kernel.h:47
#define FILE_OPEN_IF
Definition: from_kernel.h:56
#define FILE_SEQUENTIAL_ONLY
Definition: from_kernel.h:27
#define FILE_OPEN_REMOTE_INSTANCE
Definition: from_kernel.h:37
#define FILE_OPEN_FOR_BACKUP_INTENT
Definition: from_kernel.h:42
Status
Definition: gdiplustypes.h:25
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define OBJ_INHERIT
Definition: winternl.h:225
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
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:2260
#define STUB
Definition: kernel32.h:27
#define kernel32file
Definition: kernel32.h:6
#define FILE_FLAG_OPEN_REPARSE_POINT
Definition: disk.h:39
#define CREATE_ALWAYS
Definition: disk.h:72
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
#define TRUNCATE_EXISTING
Definition: disk.h:71
#define FILE_FLAG_OVERLAPPED
Definition: disk.h:46
#define FILE_FLAG_NO_BUFFERING
Definition: disk.h:45
#define FILE_FLAG_POSIX_SEMANTICS
Definition: disk.h:40
#define FILE_FLAG_BACKUP_SEMANTICS
Definition: disk.h:41
#define FILE_FLAG_OPEN_NO_RECALL
Definition: disk.h:38
#define FILE_FLAG_RANDOM_ACCESS
Definition: disk.h:44
#define FILE_FLAG_DELETE_ON_CLOSE
Definition: disk.h:42
#define CREATE_NEW
Definition: disk.h:69
#define OPEN_ALWAYS
Definition: disk.h:70
#define FILE_FLAG_SEQUENTIAL_SCAN
Definition: disk.h:43
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define FILE_FLAG_WRITE_THROUGH
Definition: disk.h:47
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
_In_ HANDLE hFile
Definition: mswsock.h:90
unsigned int UINT
Definition: ndis.h:50
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToOemString(POEM_STRING DestinationString, PCUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI NTSTATUS NTAPI RtlOemStringToUnicodeString(PUNICODE_STRING DestinationString, PCOEM_STRING SourceString, BOOLEAN AllocateDestinationString)
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
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define SYNCHRONIZE
Definition: nt_native.h:61
#define FILE_ATTRIBUTE_VALID_FLAGS
Definition: nt_native.h:714
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
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_OVERWRITTEN
Definition: nt_native.h:771
#define GENERIC_ALL
Definition: nt_native.h:92
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define DELETE
Definition: nt_native.h:57
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define FILE_OPENED
Definition: nt_native.h:769
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)
#define GENERIC_WRITE
Definition: nt_native.h:90
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:167
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define TRACE(s)
Definition: solgame.cpp:4
WORD nErrCode
Definition: winbase.h:1291
CHAR szPathName[OFS_MAXPATHNAME]
Definition: winbase.h:1294
BYTE fFixedDisk
Definition: winbase.h:1290
BYTE cBytes
Definition: winbase.h:1289
LPVOID lpSecurityDescriptor
Definition: compat.h:193
#define IN
Definition: typedefs.h:39
uint16_t * PWCHAR
Definition: typedefs.h:56
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_FILE_IS_A_DIRECTORY
Definition: udferr_usr.h:164
#define STATUS_OBJECT_NAME_COLLISION
Definition: udferr_usr.h:150
DWORD dwAttributes
Definition: vdmdbg.h:34
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define OF_REOPEN
Definition: winbase.h:130
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
_In_ LPCSTR lpFileName
Definition: winbase.h:3071
#define OF_EXIST
Definition: winbase.h:127
#define OF_SHARE_COMPAT
Definition: winbase.h:119
#define OF_SHARE_DENY_READ
Definition: winbase.h:121
#define HFILE_ERROR
Definition: winbase.h:111
#define OF_PARSE
Definition: winbase.h:128
#define OFS_MAXPATHNAME
Definition: winbase.h:152
#define OF_SHARE_EXCLUSIVE
Definition: winbase.h:123
#define OF_SHARE_DENY_NONE
Definition: winbase.h:120
#define OF_CREATE
Definition: winbase.h:125
#define OF_DELETE
Definition: winbase.h:126
#define DRIVE_REMOVABLE
Definition: winbase.h:251
struct _OFSTRUCT OFSTRUCT
#define OF_SHARE_DENY_WRITE
Definition: winbase.h:122
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
int HFILE
Definition: windef.h:298
#define WINAPI
Definition: msvc.h:6
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
#define ERROR_FILE_EXISTS
Definition: winerror.h:165
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
_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:845
const char * LPCSTR
Definition: xmlstorage.h:183
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185