ReactOS  0.4.12-dev-685-gf36cbf7
filesup.h
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Setup Library
3  * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE: File support functions.
5  * COPYRIGHT: Casper S. Hornstrup (chorns@users.sourceforge.net)
6  * Copyright 2017-2018 Hermes Belusca-Maito
7  */
8 
9 #pragma once
10 
13  IN PCWSTR DirectoryName);
14 
18  IN BOOLEAN ForceDelete); // ForceDelete can be used to delete read-only files
19 
22  IN PCWSTR SourceFileName,
23  IN PCWSTR DestinationFileName,
24  IN BOOLEAN FailIfExists);
25 
26 #ifndef _WINBASE_
27 
28 #define MOVEFILE_REPLACE_EXISTING 1
29 #define MOVEFILE_COPY_ALLOWED 2
30 #define MOVEFILE_WRITE_THROUGH 8
31 
32 #endif
33 
36  IN PCWSTR ExistingFileName,
37  IN PCWSTR NewFileName,
38  IN ULONG Flags);
39 
42  IN OUT PWSTR PathBuffer,
43  IN SIZE_T cchPathSize,
44  IN ULONG NumberOfPathComponents,
45  IN va_list PathComponentsList);
46 
49  OUT PWSTR PathBuffer,
50  IN SIZE_T cchPathSize,
51  IN ULONG NumberOfPathComponents,
52  IN va_list PathComponentsList);
53 
56  IN OUT PWSTR PathBuffer,
57  IN SIZE_T cchPathSize,
58  IN ULONG NumberOfPathComponents,
59  IN /* PCWSTR */ ...);
60 
63  OUT PWSTR PathBuffer,
64  IN SIZE_T cchPathSize,
65  IN ULONG NumberOfPathComponents,
66  IN /* PCWSTR */ ...);
67 
68 BOOLEAN
71  IN PCWSTR PathName,
73 
74 #define DoesDirExist(RootDirectory, DirName) \
75  DoesPathExist((RootDirectory), (DirName), TRUE)
76 
77 #define DoesFileExist(RootDirectory, FileName) \
78  DoesPathExist((RootDirectory), (FileName), FALSE)
79 
80 // FIXME: DEPRECATED! HACKish function that needs to be deprecated!
81 BOOLEAN
83  IN PCWSTR PathName OPTIONAL,
85 
86 BOOLEAN
88  IN PCWSTR NtPath,
89  OUT PULONG pDiskNumber,
90  OUT PULONG pPartNumber,
92 
96  IN PCWSTR PathNameToFile,
97  OUT PHANDLE FileHandle, // IN OUT PHANDLE OPTIONAL
98  OUT PHANDLE SectionHandle,
101  IN BOOLEAN ReadWriteAccess);
102 
103 BOOLEAN
104 UnMapFile(
105  IN HANDLE SectionHandle,
107 
108 #define UnMapAndCloseFile(FileHandle, SectionHandle, BaseAddress) \
109 do { \
110  UnMapFile((SectionHandle), (BaseAddress)); \
111  NtClose(FileHandle); \
112 } while (0)
113 
114 /* EOF */
const uint16_t * PCWSTR
Definition: typedefs.h:55
#define IN
Definition: typedefs.h:38
NTSTATUS SetupCopyFile(IN PCWSTR SourceFileName, IN PCWSTR DestinationFileName, IN BOOLEAN FailIfExists)
Definition: filesup.c:240
NTSTATUS ConcatPathsV(IN OUT PWSTR PathBuffer, IN SIZE_T cchPathSize, IN ULONG NumberOfPathComponents, IN va_list PathComponentsList)
Definition: filesup.c:596
NTSTATUS ConcatPaths(IN OUT PWSTR PathBuffer, IN SIZE_T cchPathSize, IN ULONG NumberOfPathComponents, IN ...)
Definition: filesup.c:659
WCHAR RootDirectory[MAX_PATH]
Definition: format.c:74
BOOLEAN DoesFileExist_2(IN PCWSTR PathName OPTIONAL, IN PCWSTR FileName)
Definition: filesup.c:748
NTSTATUS SetupDeleteFile(IN PCWSTR FileName, IN BOOLEAN ForceDelete)
Definition: filesup.c:151
uint16_t * PWSTR
Definition: typedefs.h:54
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN UnMapFile(IN HANDLE SectionHandle, IN PVOID BaseAddress)
Definition: filesup.c:974
NTSTATUS SetupCreateDirectory(IN PCWSTR DirectoryName)
Definition: filesup.c:84
HANDLE FileHandle
Definition: stats.c:38
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
BOOLEAN NtPathToDiskPartComponents(IN PCWSTR NtPath, OUT PULONG pDiskNumber, OUT PULONG pPartNumber, OUT PCWSTR *PathComponent OPTIONAL)
Definition: filesup.c:771
NTSTATUS SetupMoveFile(IN PCWSTR ExistingFileName, IN PCWSTR NewFileName, IN ULONG Flags)
Definition: filesup.c:480
unsigned char BOOLEAN
char * va_list
Definition: acmsvcex.h:78
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
_Must_inspect_result_ _In_ PFLT_INSTANCE _Out_ PBOOLEAN IsDirectory
Definition: fltkernel.h:1139
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:414
_Must_inspect_result_ _Out_ PLARGE_INTEGER FileSize
Definition: fsrtlfuncs.h:108
NTSTATUS CombinePathsV(OUT PWSTR PathBuffer, IN SIZE_T cchPathSize, IN ULONG NumberOfPathComponents, IN va_list PathComponentsList)
Definition: filesup.c:643
BOOLEAN DoesPathExist(IN HANDLE RootDirectory OPTIONAL, IN PCWSTR PathName, IN BOOLEAN IsDirectory)
Definition: filesup.c:705
ULONG_PTR SIZE_T
Definition: typedefs.h:78
unsigned int * PULONG
Definition: retypes.h:1
#define OUT
Definition: typedefs.h:39
unsigned int ULONG
Definition: retypes.h:1
NTSTATUS CombinePaths(OUT PWSTR PathBuffer, IN SIZE_T cchPathSize, IN ULONG NumberOfPathComponents, IN ...)
Definition: filesup.c:681
NTSTATUS OpenAndMapFile(IN HANDLE RootDirectory OPTIONAL, IN PCWSTR PathNameToFile, OUT PHANDLE FileHandle, OUT PHANDLE SectionHandle, OUT PVOID *BaseAddress, OUT PULONG FileSize OPTIONAL, IN BOOLEAN ReadWriteAccess)
Definition: filesup.c:858
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68