1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-11 19:08:26 -06:00

Windows: code refactoring and convert NTSTATUS error code to WIN32 equivalent before displaying error message.

This commit is contained in:
Mounir IDRASSI
2019-10-27 01:39:37 +02:00
parent 89e2547851
commit 2722b46530
2 changed files with 26 additions and 41 deletions

View File

@@ -29,6 +29,10 @@ typedef NTSTATUS (WINAPI *NtQuerySystemInformationFn)(
PULONG ReturnLength
);
typedef ULONG (WINAPI *RtlNtStatusToDosErrorFn)(
NTSTATUS Status
);
using namespace std;
namespace VeraCrypt
@@ -193,7 +197,7 @@ namespace VeraCrypt
static BOOL IsPostExecFileField (const string& szFieldValue, wstring& filePath);
};
void GetVolumeESP(wstring& path);
void GetVolumeESP(wstring& path, wstring& bootVolumePath);
std::string ReadESPFile (LPCWSTR szFilePath, bool bSkipUTF8BOM);
void WriteESPFile (LPCWSTR szFilePath, LPBYTE pbData, DWORD dwDataLen, bool bAddUTF8BOM);
@@ -221,7 +225,6 @@ namespace VeraCrypt
BOOL UpdateConfig (const wchar_t* name, int pim, int hashAlgo, HWND hwndDlg);
BOOL WriteConfig (const wchar_t* name, bool preserveUserConfig, int pim, int hashAlgo, const char* passPromptMsg, HWND hwndDlg);
BOOL DelDir(const wchar_t* name);
void SelectBootVolumeESP();
PSTORAGE_DEVICE_NUMBER GetStorageDeviceNumber () { if (bDeviceInfoValid) return &sdn; else { SetLastError (ERROR_INVALID_DRIVE); throw SystemException(SRC_POS);}}
protected:
@@ -231,7 +234,6 @@ namespace VeraCrypt
PARTITION_INFORMATION_EX partInfo;
bool bDeviceInfoValid;
WCHAR tempBuf[1024];
bool bBootVolumePathSelected;
std::wstring BootVolumePath;
};