[USETUP] Move Setup[Delete|Copy|Move]File() from usetup code into the setuplib's...
[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 DoesPathExist(
65 IN HANDLE RootDirectory OPTIONAL,
66 IN PCWSTR PathName);
67
68 BOOLEAN
69 DoesFileExist(
70 IN HANDLE RootDirectory OPTIONAL,
71 IN PCWSTR PathNameToFile);
72
73 // FIXME: DEPRECATED! HACKish function that needs to be deprecated!
74 BOOLEAN
75 DoesFileExist_2(
76 IN PCWSTR PathName OPTIONAL,
77 IN PCWSTR FileName);
78
79 BOOLEAN
80 NtPathToDiskPartComponents(
81 IN PCWSTR NtPath,
82 OUT PULONG pDiskNumber,
83 OUT PULONG pPartNumber,
84 OUT PCWSTR* PathComponent OPTIONAL);
85
86 NTSTATUS
87 OpenAndMapFile(
88 IN HANDLE RootDirectory OPTIONAL,
89 IN PCWSTR PathNameToFile,
90 OUT PHANDLE FileHandle, // IN OUT PHANDLE OPTIONAL
91 OUT PHANDLE SectionHandle,
92 OUT PVOID* BaseAddress,
93 OUT PULONG FileSize OPTIONAL,
94 IN BOOLEAN ReadWriteAccess);
95
96 BOOLEAN
97 UnMapFile(
98 IN HANDLE SectionHandle,
99 IN PVOID BaseAddress);
100
101 /* EOF */