2017-05-23 11:39:12 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS Setup Library
|
|
|
|
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
|
|
|
|
* PURPOSE: File support functions.
|
2018-01-05 00:56:23 +00:00
|
|
|
* COPYRIGHT: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
|
|
|
* Copyright 2017-2018 Hermes Belusca-Maito
|
2017-05-23 11:39:12 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2018-01-05 00:56:23 +00:00
|
|
|
NTSTATUS
|
|
|
|
SetupCreateDirectory(
|
|
|
|
IN PCWSTR DirectoryName);
|
|
|
|
|
2017-06-30 22:28:06 +00:00
|
|
|
NTSTATUS
|
|
|
|
SetupDeleteFile(
|
|
|
|
IN PCWSTR FileName,
|
|
|
|
IN BOOLEAN ForceDelete); // ForceDelete can be used to delete read-only files
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
SetupCopyFile(
|
|
|
|
IN PCWSTR SourceFileName,
|
|
|
|
IN PCWSTR DestinationFileName,
|
|
|
|
IN BOOLEAN FailIfExists);
|
2017-05-23 11:39:12 +00:00
|
|
|
|
2017-06-30 22:28:06 +00:00
|
|
|
#ifndef _WINBASE_
|
|
|
|
|
|
|
|
#define MOVEFILE_REPLACE_EXISTING 1
|
|
|
|
#define MOVEFILE_COPY_ALLOWED 2
|
|
|
|
#define MOVEFILE_WRITE_THROUGH 8
|
2017-05-23 11:39:12 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2017-06-30 22:28:06 +00:00
|
|
|
NTSTATUS
|
|
|
|
SetupMoveFile(
|
|
|
|
IN PCWSTR ExistingFileName,
|
|
|
|
IN PCWSTR NewFileName,
|
|
|
|
IN ULONG Flags);
|
|
|
|
|
2017-05-23 22:30:54 +00:00
|
|
|
NTSTATUS
|
|
|
|
ConcatPathsV(
|
|
|
|
IN OUT PWSTR PathBuffer,
|
|
|
|
IN SIZE_T cchPathSize,
|
|
|
|
IN ULONG NumberOfPathComponents,
|
|
|
|
IN va_list PathComponentsList);
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
CombinePathsV(
|
|
|
|
OUT PWSTR PathBuffer,
|
|
|
|
IN SIZE_T cchPathSize,
|
|
|
|
IN ULONG NumberOfPathComponents,
|
|
|
|
IN va_list PathComponentsList);
|
|
|
|
|
2017-05-23 11:39:12 +00:00
|
|
|
NTSTATUS
|
|
|
|
ConcatPaths(
|
2017-05-23 22:30:54 +00:00
|
|
|
IN OUT PWSTR PathBuffer,
|
|
|
|
IN SIZE_T cchPathSize,
|
|
|
|
IN ULONG NumberOfPathComponents,
|
|
|
|
IN /* PCWSTR */ ...);
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
CombinePaths(
|
|
|
|
OUT PWSTR PathBuffer,
|
2017-05-23 11:39:12 +00:00
|
|
|
IN SIZE_T cchPathSize,
|
2017-05-23 22:30:54 +00:00
|
|
|
IN ULONG NumberOfPathComponents,
|
|
|
|
IN /* PCWSTR */ ...);
|
2017-05-23 11:39:12 +00:00
|
|
|
|
|
|
|
BOOLEAN
|
2017-08-21 19:41:40 +00:00
|
|
|
DoesPathExist(
|
2017-05-23 11:39:12 +00:00
|
|
|
IN HANDLE RootDirectory OPTIONAL,
|
2017-08-21 19:14:33 +00:00
|
|
|
IN PCWSTR PathName,
|
|
|
|
IN BOOLEAN IsDirectory);
|
2017-05-23 11:39:12 +00:00
|
|
|
|
2017-08-21 19:41:40 +00:00
|
|
|
#define DoesDirExist(RootDirectory, DirName) \
|
|
|
|
DoesPathExist((RootDirectory), (DirName), TRUE)
|
2017-08-21 19:14:33 +00:00
|
|
|
|
|
|
|
#define DoesFileExist(RootDirectory, FileName) \
|
2017-08-21 19:41:40 +00:00
|
|
|
DoesPathExist((RootDirectory), (FileName), FALSE)
|
2017-05-24 16:37:49 +00:00
|
|
|
|
|
|
|
// FIXME: DEPRECATED! HACKish function that needs to be deprecated!
|
|
|
|
BOOLEAN
|
|
|
|
DoesFileExist_2(
|
2017-05-23 11:39:12 +00:00
|
|
|
IN PCWSTR PathName OPTIONAL,
|
|
|
|
IN PCWSTR FileName);
|
|
|
|
|
|
|
|
BOOLEAN
|
|
|
|
NtPathToDiskPartComponents(
|
|
|
|
IN PCWSTR NtPath,
|
|
|
|
OUT PULONG pDiskNumber,
|
|
|
|
OUT PULONG pPartNumber,
|
|
|
|
OUT PCWSTR* PathComponent OPTIONAL);
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
OpenAndMapFile(
|
2017-05-31 00:18:13 +00:00
|
|
|
IN HANDLE RootDirectory OPTIONAL,
|
|
|
|
IN PCWSTR PathNameToFile,
|
2017-05-23 11:39:12 +00:00
|
|
|
OUT PHANDLE FileHandle, // IN OUT PHANDLE OPTIONAL
|
|
|
|
OUT PHANDLE SectionHandle,
|
|
|
|
OUT PVOID* BaseAddress,
|
2017-05-31 00:18:13 +00:00
|
|
|
OUT PULONG FileSize OPTIONAL,
|
|
|
|
IN BOOLEAN ReadWriteAccess);
|
2017-05-23 11:39:12 +00:00
|
|
|
|
|
|
|
BOOLEAN
|
|
|
|
UnMapFile(
|
|
|
|
IN HANDLE SectionHandle,
|
|
|
|
IN PVOID BaseAddress);
|
|
|
|
|
2017-08-23 12:20:15 +00:00
|
|
|
#define UnMapAndCloseFile(FileHandle, SectionHandle, BaseAddress) \
|
|
|
|
do { \
|
|
|
|
UnMapFile((SectionHandle), (BaseAddress)); \
|
|
|
|
NtClose(FileHandle); \
|
|
|
|
} while (0)
|
|
|
|
|
2017-05-23 11:39:12 +00:00
|
|
|
/* EOF */
|