[SETUPLIB] Merge DoesPathExist() and DoesFileExist() into (temporarily called) DoesPa...
[reactos.git] / base / setup / lib / filesup.h
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: Copyright 2017-2018 Hermes Belusca-Maito
6 */
7
8 #pragma once
9
10 NTSTATUS
11 SetupDeleteFile(
12 IN PCWSTR FileName,
13 IN BOOLEAN ForceDelete); // ForceDelete can be used to delete read-only files
14
15 NTSTATUS
16 SetupCopyFile(
17 IN PCWSTR SourceFileName,
18 IN PCWSTR DestinationFileName,
19 IN BOOLEAN FailIfExists);
20
21 #ifndef _WINBASE_
22
23 #define MOVEFILE_REPLACE_EXISTING 1
24 #define MOVEFILE_COPY_ALLOWED 2
25 #define MOVEFILE_WRITE_THROUGH 8
26
27 #endif
28
29 NTSTATUS
30 SetupMoveFile(
31 IN PCWSTR ExistingFileName,
32 IN PCWSTR NewFileName,
33 IN ULONG Flags);
34
35 NTSTATUS
36 ConcatPathsV(
37 IN OUT PWSTR PathBuffer,
38 IN SIZE_T cchPathSize,
39 IN ULONG NumberOfPathComponents,
40 IN va_list PathComponentsList);
41
42 NTSTATUS
43 CombinePathsV(
44 OUT PWSTR PathBuffer,
45 IN SIZE_T cchPathSize,
46 IN ULONG NumberOfPathComponents,
47 IN va_list PathComponentsList);
48
49 NTSTATUS
50 ConcatPaths(
51 IN OUT PWSTR PathBuffer,
52 IN SIZE_T cchPathSize,
53 IN ULONG NumberOfPathComponents,
54 IN /* PCWSTR */ ...);
55
56 NTSTATUS
57 CombinePaths(
58 OUT PWSTR PathBuffer,
59 IN SIZE_T cchPathSize,
60 IN ULONG NumberOfPathComponents,
61 IN /* PCWSTR */ ...);
62
63 BOOLEAN
64 DoesPathExistEx(
65 IN HANDLE RootDirectory OPTIONAL,
66 IN PCWSTR PathName,
67 IN BOOLEAN IsDirectory);
68
69 #define DoesPathExist(RootDirectory, PathName) \
70 DoesPathExistEx((RootDirectory), (PathName), TRUE)
71
72 #define DoesFileExist(RootDirectory, FileName) \
73 DoesPathExistEx((RootDirectory), (FileName), FALSE)
74
75 // FIXME: DEPRECATED! HACKish function that needs to be deprecated!
76 BOOLEAN
77 DoesFileExist_2(
78 IN PCWSTR PathName OPTIONAL,
79 IN PCWSTR FileName);
80
81 BOOLEAN
82 NtPathToDiskPartComponents(
83 IN PCWSTR NtPath,
84 OUT PULONG pDiskNumber,
85 OUT PULONG pPartNumber,
86 OUT PCWSTR* PathComponent OPTIONAL);
87
88 NTSTATUS
89 OpenAndMapFile(
90 IN HANDLE RootDirectory OPTIONAL,
91 IN PCWSTR PathNameToFile,
92 OUT PHANDLE FileHandle, // IN OUT PHANDLE OPTIONAL
93 OUT PHANDLE SectionHandle,
94 OUT PVOID* BaseAddress,
95 OUT PULONG FileSize OPTIONAL,
96 IN BOOLEAN ReadWriteAccess);
97
98 BOOLEAN
99 UnMapFile(
100 IN HANDLE SectionHandle,
101 IN PVOID BaseAddress);
102
103 /* EOF */