ReactOS 0.4.16-dev-319-g6cf4263
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 PathName);
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_ PCUNICODE_STRING PathName,
73
77 _In_ PCWSTR PathName,
79
80#define DoesDirExist(RootDirectory, DirName) \
81 DoesPathExist((RootDirectory), (DirName), TRUE)
82
83#define DoesFileExist(RootDirectory, FileName) \
84 DoesPathExist((RootDirectory), (FileName), FALSE)
85
86// FIXME: DEPRECATED! HACKish function that needs to be deprecated!
89 IN PCWSTR PathName OPTIONAL,
91
94 IN PCWSTR NtPath,
95 OUT PULONG pDiskNumber,
96 OUT PULONG pPartNumber,
98
102 _In_ PCWSTR PathNameToFile,
105 _Out_ PHANDLE SectionHandle,
107 _In_ BOOLEAN ReadWriteAccess);
108
110MapFile(
112 _Out_ PHANDLE SectionHandle,
114 _In_ BOOLEAN ReadWriteAccess);
115
118 _In_ HANDLE SectionHandle,
120
121#define UnMapAndCloseFile(FileHandle, SectionHandle, BaseAddress) \
122do { \
123 UnMapFile((SectionHandle), (BaseAddress)); \
124 NtClose(FileHandle); \
125} while (0)
126
127/* 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
BOOLEAN DoesPathExist(_In_opt_ HANDLE RootDirectory, _In_ PCWSTR PathName, _In_ BOOLEAN IsDirectory)
Definition: filesup.c:728
NTSTATUS CombinePaths(OUT PWSTR PathBuffer, IN SIZE_T cchPathSize, IN ULONG NumberOfPathComponents, IN ...)
Definition: filesup.c:664
NTSTATUS MapFile(_In_ HANDLE FileHandle, _Out_ PHANDLE SectionHandle, _Out_ PVOID *BaseAddress, _In_ BOOLEAN ReadWriteAccess)
Maps an opened file in memory.
Definition: filesup.c:981
BOOLEAN DoesFileExist_2(IN PCWSTR PathName OPTIONAL, IN PCWSTR FileName)
Definition: filesup.c:740
BOOLEAN NtPathToDiskPartComponents(IN PCWSTR NtPath, OUT PULONG pDiskNumber, OUT PULONG pPartNumber, OUT PCWSTR *PathComponent OPTIONAL)
Definition: filesup.c:763
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:879
NTSTATUS ConcatPathsV(IN OUT PWSTR PathBuffer, IN SIZE_T cchPathSize, IN ULONG NumberOfPathComponents, IN va_list PathComponentsList)
Definition: filesup.c:579
NTSTATUS CombinePathsV(OUT PWSTR PathBuffer, IN SIZE_T cchPathSize, IN ULONG NumberOfPathComponents, IN va_list PathComponentsList)
Definition: filesup.c:626
NTSTATUS SetupMoveFile(IN PCWSTR ExistingFileName, IN PCWSTR NewFileName, IN ULONG Flags)
Definition: filesup.c:463
NTSTATUS SetupCreateDirectory(_In_ PCWSTR PathName)
Create a new directory, specified by the given path. Any intermediate non-existing directory is creat...
Definition: filesup.c:72
NTSTATUS ConcatPaths(IN OUT PWSTR PathBuffer, IN SIZE_T cchPathSize, IN ULONG NumberOfPathComponents, IN ...)
Definition: filesup.c:642
BOOLEAN UnMapFile(_In_ HANDLE SectionHandle, _In_ PVOID BaseAddress)
Unmaps a mapped file by section.
Definition: filesup.c:1051
NTSTATUS SetupCopyFile(IN PCWSTR SourceFileName, IN PCWSTR DestinationFileName, IN BOOLEAN FailIfExists)
Definition: filesup.c:223
NTSTATUS SetupDeleteFile(IN PCWSTR FileName, IN BOOLEAN ForceDelete)
Definition: filesup.c:134
BOOLEAN DoesPathExist_UStr(_In_opt_ HANDLE RootDirectory, _In_ PCUNICODE_STRING PathName, _In_ BOOLEAN IsDirectory)
Definition: filesup.c:688
_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
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
#define _Out_opt_
Definition: no_sal2.h:214
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
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