ReactOS 0.4.15-dev-8102-g108db8f
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
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!
83 IN PCWSTR PathName OPTIONAL,
85
88 IN PCWSTR NtPath,
89 OUT PULONG pDiskNumber,
90 OUT PULONG pPartNumber,
92
96 _In_ PCWSTR PathNameToFile,
99 _Out_ PHANDLE SectionHandle,
101 _In_ BOOLEAN ReadWriteAccess);
102
104MapFile(
106 _Out_ PHANDLE SectionHandle,
108 _In_ BOOLEAN ReadWriteAccess);
109
112 _In_ HANDLE SectionHandle,
114
115#define UnMapAndCloseFile(FileHandle, SectionHandle, BaseAddress) \
116do { \
117 UnMapFile((SectionHandle), (BaseAddress)); \
118 NtClose(FileHandle); \
119} while (0)
120
121/* EOF */
unsigned char BOOLEAN
char * va_list
Definition: acmsvcex.h:78
LONG NTSTATUS
Definition: precomp.h:26
WCHAR RootDirectory[MAX_PATH]
Definition: format.c:74
#define IsDirectory(Fcb)
Definition: ext2fs.h:283
NTSTATUS CombinePaths(OUT PWSTR PathBuffer, IN SIZE_T cchPathSize, IN ULONG NumberOfPathComponents, IN ...)
Definition: filesup.c:681
NTSTATUS MapFile(_In_ HANDLE FileHandle, _Out_ PHANDLE SectionHandle, _Out_ PVOID *BaseAddress, _In_ BOOLEAN ReadWriteAccess)
Maps an opened file in memory.
Definition: filesup.c:989
BOOLEAN DoesFileExist_2(IN PCWSTR PathName OPTIONAL, IN PCWSTR FileName)
Definition: filesup.c:748
BOOLEAN NtPathToDiskPartComponents(IN PCWSTR NtPath, OUT PULONG pDiskNumber, OUT PULONG pPartNumber, OUT PCWSTR *PathComponent OPTIONAL)
Definition: filesup.c:771
NTSTATUS OpenAndMapFile(_In_opt_ HANDLE RootDirectory, _In_ PCWSTR PathNameToFile, _Out_opt_ PHANDLE FileHandle, _Out_opt_ PULONG FileSize, _Out_ PHANDLE SectionHandle, _Out_ PVOID *BaseAddress, _In_ BOOLEAN ReadWriteAccess)
Opens and maps a file in memory.
Definition: filesup.c:887
NTSTATUS ConcatPathsV(IN OUT PWSTR PathBuffer, IN SIZE_T cchPathSize, IN ULONG NumberOfPathComponents, IN va_list PathComponentsList)
Definition: filesup.c:596
NTSTATUS CombinePathsV(OUT PWSTR PathBuffer, IN SIZE_T cchPathSize, IN ULONG NumberOfPathComponents, IN va_list PathComponentsList)
Definition: filesup.c:643
NTSTATUS SetupMoveFile(IN PCWSTR ExistingFileName, IN PCWSTR NewFileName, IN ULONG Flags)
Definition: filesup.c:480
NTSTATUS ConcatPaths(IN OUT PWSTR PathBuffer, IN SIZE_T cchPathSize, IN ULONG NumberOfPathComponents, IN ...)
Definition: filesup.c:659
BOOLEAN UnMapFile(_In_ HANDLE SectionHandle, _In_ PVOID BaseAddress)
Unmaps a mapped file by section.
Definition: filesup.c:1059
NTSTATUS SetupCopyFile(IN PCWSTR SourceFileName, IN PCWSTR DestinationFileName, IN BOOLEAN FailIfExists)
Definition: filesup.c:240
BOOLEAN DoesPathExist(IN HANDLE RootDirectory OPTIONAL, IN PCWSTR PathName, IN BOOLEAN IsDirectory)
Definition: filesup.c:705
NTSTATUS SetupCreateDirectory(IN PCWSTR DirectoryName)
Definition: filesup.c:84
NTSTATUS SetupDeleteFile(IN PCWSTR FileName, IN BOOLEAN ForceDelete)
Definition: filesup.c:151
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
Definition: fltkernel.h:1231
_Must_inspect_result_ _Out_ PLARGE_INTEGER FileSize
Definition: fsrtlfuncs.h:108
#define _Out_opt_
Definition: ms_sal.h:346
#define _Out_
Definition: ms_sal.h:345
#define _In_
Definition: ms_sal.h:308
#define _In_opt_
Definition: ms_sal.h:309
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:455
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
uint16_t * PWSTR
Definition: typedefs.h:56
uint32_t * PULONG
Definition: typedefs.h:59
const uint16_t * PCWSTR
Definition: typedefs.h:57
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170