Reactos
at listview 127 lines 2.9 kB view raw
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 11NTSTATUS 12SetupCreateDirectory( 13 _In_ PCWSTR PathName); 14 15NTSTATUS 16SetupDeleteFile( 17 IN PCWSTR FileName, 18 IN BOOLEAN ForceDelete); // ForceDelete can be used to delete read-only files 19 20NTSTATUS 21SetupCopyFile( 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 34NTSTATUS 35SetupMoveFile( 36 IN PCWSTR ExistingFileName, 37 IN PCWSTR NewFileName, 38 IN ULONG Flags); 39 40NTSTATUS 41ConcatPathsV( 42 IN OUT PWSTR PathBuffer, 43 IN SIZE_T cchPathSize, 44 IN ULONG NumberOfPathComponents, 45 IN va_list PathComponentsList); 46 47NTSTATUS 48CombinePathsV( 49 OUT PWSTR PathBuffer, 50 IN SIZE_T cchPathSize, 51 IN ULONG NumberOfPathComponents, 52 IN va_list PathComponentsList); 53 54NTSTATUS 55ConcatPaths( 56 IN OUT PWSTR PathBuffer, 57 IN SIZE_T cchPathSize, 58 IN ULONG NumberOfPathComponents, 59 IN /* PCWSTR */ ...); 60 61NTSTATUS 62CombinePaths( 63 OUT PWSTR PathBuffer, 64 IN SIZE_T cchPathSize, 65 IN ULONG NumberOfPathComponents, 66 IN /* PCWSTR */ ...); 67 68BOOLEAN 69DoesPathExist_UStr( 70 _In_opt_ HANDLE RootDirectory, 71 _In_ PCUNICODE_STRING PathName, 72 _In_ BOOLEAN IsDirectory); 73 74BOOLEAN 75DoesPathExist( 76 _In_opt_ HANDLE RootDirectory, 77 _In_ PCWSTR PathName, 78 _In_ BOOLEAN IsDirectory); 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! 87BOOLEAN 88DoesFileExist_2( 89 IN PCWSTR PathName OPTIONAL, 90 IN PCWSTR FileName); 91 92BOOLEAN 93NtPathToDiskPartComponents( 94 IN PCWSTR NtPath, 95 OUT PULONG pDiskNumber, 96 OUT PULONG pPartNumber, 97 OUT PCWSTR* PathComponent OPTIONAL); 98 99NTSTATUS 100OpenAndMapFile( 101 _In_opt_ HANDLE RootDirectory, 102 _In_ PCWSTR PathNameToFile, 103 _Out_opt_ PHANDLE FileHandle, 104 _Out_opt_ PULONG FileSize, 105 _Out_ PHANDLE SectionHandle, 106 _Out_ PVOID* BaseAddress, 107 _In_ BOOLEAN ReadWriteAccess); 108 109NTSTATUS 110MapFile( 111 _In_ HANDLE FileHandle, 112 _Out_ PHANDLE SectionHandle, 113 _Out_ PVOID* BaseAddress, 114 _In_ BOOLEAN ReadWriteAccess); 115 116BOOLEAN 117UnMapFile( 118 _In_ HANDLE SectionHandle, 119 _In_ PVOID BaseAddress); 120 121#define UnMapAndCloseFile(FileHandle, SectionHandle, BaseAddress) \ 122do { \ 123 UnMapFile((SectionHandle), (BaseAddress)); \ 124 NtClose(FileHandle); \ 125} while (0) 126 127/* EOF */