| 22 | }; |
| 23 | |
| 24 | class FilesAPI final { |
| 25 | private: |
| 26 | HANDLE hFile; |
| 27 | NTSTATUS CreationStatus; |
| 28 | public: |
| 29 | enum CREATE_FILE_TYPE { |
| 30 | fCreateEmpty, |
| 31 | fOpenExisting, |
| 32 | fOpenOrCreate |
| 33 | }; |
| 34 | |
| 35 | FilesAPI( |
| 36 | LPCWSTR FilePath, |
| 37 | CREATE_FILE_TYPE Type, |
| 38 | ACCESS_MASK AccessMask, |
| 39 | ULONG ShareAccess |
| 40 | ); |
| 41 | ~FilesAPI() { Close(); } |
| 42 | |
| 43 | NTSTATUS GetCreationStatus() const { return CreationStatus; } |
| 44 | |
| 45 | NTSTATUS Read(OUT PVOID Buffer, ULONG Size, OPTIONAL UINT64 Offset = 0) const; |
| 46 | NTSTATUS Write(IN PVOID Buffer, ULONG Size, OPTIONAL UINT64 Offset = 0) const; |
| 47 | NTSTATUS Close(); |
| 48 | |
| 49 | static NTSTATUS CreateDir(LPCWSTR DirPath); |
| 50 | static NTSTATUS DeleteFile(LPCWSTR FilePath); |
| 51 | static NTSTATUS RenameFile(LPCWSTR OriginalFile, LPCWSTR NewName); |
| 52 | static NTSTATUS MoveFile(LPCWSTR OriginalFile, LPCWSTR Destination); |
| 53 | static NTSTATUS CopyFile(LPCWSTR OriginalFile, LPCWSTR Destination); |
| 54 | static SIZE_T GetFileSize(LPCWSTR FilePath); |
| 55 | static BOOLEAN IsFileExists(LPCWSTR FilePath); |
| 56 | static BOOLEAN IsDirExists(LPCWSTR DirPath); |
| 57 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected