ReactOS 0.4.16-dev-91-g764881a
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:735
NTSTATUS CombinePaths(OUT PWSTR PathBuffer, IN SIZE_T cchPathSize, IN ULONG NumberOfPathComponents, IN ...)
Definition: filesup.c:671
NTSTATUS MapFile(_In_ HANDLE FileHandle, _Out_ PHANDLE SectionHandle, _Out_ PVOID *BaseAddress, _In_ BOOLEAN ReadWriteAccess)
Maps an opened file in memory.
Definition: filesup.c:988
BOOLEAN DoesFileExist_2(IN PCWSTR PathName OPTIONAL, IN PCWSTR FileName)
Definition: filesup.c:747
BOOLEAN NtPathToDiskPartComponents(IN PCWSTR NtPath, OUT PULONG pDiskNumber, OUT PULONG pPartNumber, OUT PCWSTR *PathComponent OPTIONAL)
Definition: filesup.c:770
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:886
NTSTATUS ConcatPathsV(IN OUT PWSTR PathBuffer, IN SIZE_T cchPathSize, IN ULONG NumberOfPathComponents, IN va_list PathComponentsList)
Definition: filesup.c:586
NTSTATUS CombinePathsV(OUT PWSTR PathBuffer, IN SIZE_T cchPathSize, IN ULONG NumberOfPathComponents, IN va_list PathComponentsList)
Definition: filesup.c:633
NTSTATUS SetupMoveFile(IN PCWSTR ExistingFileName, IN PCWSTR NewFileName, IN ULONG Flags)
Definition: filesup.c:470
NTSTATUS SetupCreateDirectory(_In_ PCWSTR PathName)
Create a new directory, specified by the given path. Any intermediate non-existing directory is creat...
Definition: filesup.c:79
NTSTATUS ConcatPaths(IN OUT PWSTR PathBuffer, IN SIZE_T cchPathSize, IN ULONG NumberOfPathComponents, IN ...)
Definition: filesup.c:649
BOOLEAN UnMapFile(_In_ HANDLE SectionHandle, _In_ PVOID BaseAddress)
Unmaps a mapped file by section.
Definition: filesup.c:1058
NTSTATUS SetupCopyFile(IN PCWSTR SourceFileName, IN PCWSTR DestinationFileName, IN BOOLEAN FailIfExists)
Definition: filesup.c:230
NTSTATUS SetupDeleteFile(IN PCWSTR FileName, IN BOOLEAN ForceDelete)
Definition: filesup.c:141
BOOLEAN DoesPathExist_UStr(_In_opt_ HANDLE RootDirectory, _In_ PCUNICODE_STRING PathName, _In_ BOOLEAN IsDirectory)
Definition: filesup.c:695
_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