Skip to content

Commit 2f8a994

Browse files
committed
Build 1.2 Beta 2
1 parent b48c7b0 commit 2f8a994

File tree

92 files changed

+24179
-162
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+24179
-162
lines changed

DCrypt/_include_/version.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
#define DC_MAJOR_VER 1
66
#define DC_MINOR_VER 2
7-
#define DC_DRIVER_VER 847 /* driver version */
7+
#define DC_DRIVER_VER 848 /* driver version */
88
#define DC_BOOT_VER 118 /* bootloader version */
9-
#define DC_UEFI_VER 200 /* uefiloader version */
10-
#define DC_FILE_VER "1.2 Beta 1"
9+
#define DC_UEFI_VER 201 /* uefiloader version */
10+
#define DC_FILE_VER "1.2 Beta 2"
1111
#define DC_PRODUCT_VER "1.2"
1212

1313
#endif

DCrypt/changes.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
[01.02.2020] - 1.2.846.118.200
1+
2+
[14.03.2020] - 1.2.1/848.118.201
3+
[*] Wipe Mode disabled on SSD drivers (as on those its pointless and may damage the ssd)
4+
[+] Added option to mount volumes in read only mode
5+
[*] Fixed some EFI config values not getting properly loaded by the API library
6+
[*] Switched to using "fast" crypto implementation for the x64 UEFI bootloader
7+
[+] Added Hardware Crypto support to the x64 UEFI bootloader
8+
[*] Fixed issues updating the driver on Windows 10
9+
10+
[01.02.2020] - 1.2.0/847.118.200
211
[*] Project moved to Visual Studio 2017, using win 7 sdk for compatybility
312
[+] Added EFI bootloader
413
[+] Added shim bootloader to achieve secure boot compatibility (https://habr.com/ru/post/446238/)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup />
4+
</Project>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup />
4+
</Project>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup />
4+
</Project>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup />
4+
</Project>

DCrypt/dcapi/drv_ioctl.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "dcapi.h"
2929
#include <winternl.h>
3030

31+
3132
int dc_open_device()
3233
{
3334
HANDLE h_device;
@@ -786,3 +787,28 @@ int dc_restore_header(wchar_t *device, dc_pass *password, void *in)
786787

787788
return resl;
788789
}
790+
791+
int dc_is_device_ssd(wchar_t *device)
792+
{
793+
int result = 0;
794+
DWORD bytesReturned = 0;
795+
HANDLE hDevice;
796+
STORAGE_PROPERTY_QUERY spqTrim;
797+
DEVICE_TRIM_DESCRIPTOR dtd;
798+
799+
hDevice = CreateFile(device, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
800+
801+
if (hDevice != INVALID_HANDLE_VALUE)
802+
{
803+
spqTrim.PropertyId = StorageDeviceTrimProperty;
804+
spqTrim.QueryType = PropertyStandardQuery;
805+
if (DeviceIoControl(hDevice, IOCTL_STORAGE_QUERY_PROPERTY, &spqTrim, sizeof(spqTrim), &dtd, sizeof(dtd), &bytesReturned, NULL) && bytesReturned == sizeof(dtd))
806+
{
807+
result = dtd.TrimEnabled;
808+
}
809+
810+
CloseHandle(hDevice);
811+
}
812+
813+
return result;
814+
}

DCrypt/dcapi/drvinst.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,15 +193,32 @@ static DWORD make_driver_path(PTSTR pszPath, size_t cchPath, PCTSTR driver_name)
193193

194194
static DWORD save_dcrypt_driver_file()
195195
{
196-
TCHAR source_path[MAX_PATH], dest_path[MAX_PATH], *p;
196+
TCHAR source_path[MAX_PATH], dest_path[MAX_PATH], temp_path[MAX_PATH], *p;
197197
DWORD length, status;
198198

199199
if (g_inst_dll == NULL || (length = GetModuleFileName(g_inst_dll, source_path, _countof(source_path))) == 0) return ERROR_INVALID_NAME;
200200
if (length >= _countof(source_path) - 1 || (p = _tcsrchr(source_path, '\\')) == NULL) return ERROR_INVALID_NAME;
201201
if ( FAILED(StringCchCopy(p + 1, _countof(source_path) - (p - source_path) - 1, g_maindriver_filename)) ) return ERROR_INSUFFICIENT_BUFFER;
202202

203203
if ( (status = make_driver_path(dest_path, _countof(dest_path), g_maindriver_filename)) != NO_ERROR ) return status;
204+
205+
if ( (status = make_driver_path(temp_path, _countof(temp_path), _T("dcrypt_old.sys"))) != NO_ERROR ) return status;
206+
207+
// Note: we can not overwrite a driver in use we need to rename it and remove it upon reboot
208+
209+
// rename old driver if present
210+
if (_waccess(dest_path, 0) != -1) {
211+
if (MoveFileEx(dest_path, temp_path, MOVEFILE_REPLACE_EXISTING) == FALSE) return GetLastError();
212+
}
213+
214+
// copy new driver
204215
if ( CopyFile(source_path, dest_path, FALSE) == FALSE ) return GetLastError();
216+
217+
// schedule deleting of old driver
218+
if (_waccess(temp_path, 0) != -1) {
219+
if (MoveFileEx(temp_path, NULL, MOVEFILE_DELAY_UNTIL_REBOOT) == FALSE) return GetLastError();
220+
}
221+
205222
return NO_ERROR;
206223
}
207224

DCrypt/dcapi/efiinst.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,6 +1102,7 @@ int dc_efi_config_write(const wchar_t* root, ldr_config *conf)
11021102

11031103
// Other
11041104

1105+
WriteConfigInteger(configFile, configContent, "UseHardwareCrypto", (conf->options & LDR_OP_HW_CRYPTO) ? 1 : 0);
11051106

11061107
WriteConfigInteger(configFile, configContent, "VerboseDebug", (conf->logon_type & LDR_LT_DEBUG) ? 1 : 0);
11071108

@@ -1275,21 +1276,24 @@ int dc_efi_config_read(const wchar_t* root, ldr_config *conf)
12751276
// Load Boot Disk MBR "cancel" EFI_DCS_USER_CANCELED
12761277
// "shutdown" EFI_DCS_SHUTDOWN_REQUESTED
12771278
ReadConfigString(configContent, "ActionFailed", "exit", buffer, sizeof(buffer));
1278-
if (_strcmpi(buffer, "Reboot"))
1279+
if (_strcmpi(buffer, "Reboot") == 0)
12791280
conf->error_type |= LDR_ET_REBOOT;
1280-
else if (_strcmpi(buffer, "Cancel"))
1281+
else if (_strcmpi(buffer, "Cancel") == 0)
12811282
//conf->error_type |= LDR_ET_BOOT_ACTIVE;
12821283
conf->error_type |= LDR_ET_MBR_BOOT;
1283-
//else if(strcmpi(buffer, "Exit"))
1284+
//else if(_strcmpi(buffer, "Exit") == 0)
12841285
// conf->error_type |= LDR_ET_RETRY;
12851286

12861287
// Authentication Tries - new
12871288
if (ReadConfigInteger(configContent, "AuthorizeRetry", 100)) {
1288-
conf->options |= LDR_ET_RETRY;
1289+
conf->error_type |= LDR_ET_RETRY;
12891290
}
12901291

12911292
// Other
12921293

1294+
if (ReadConfigInteger(configContent, "UseHardwareCrypto", 1)) {
1295+
conf->options |= LDR_OP_HW_CRYPTO;
1296+
}
12931297

12941298
if (ReadConfigInteger(configContent, "VerboseDebug", 0)) {
12951299
conf->logon_type |= LDR_LT_DEBUG;

DCrypt/dcapi/include/drv_ioctl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,6 @@ void dc_api dc_get_bsod();
5555
int dc_api dc_backup_header(wchar_t *device, dc_pass *password, void *out);
5656
int dc_api dc_restore_header(wchar_t *device, dc_pass *password, void *in);
5757

58+
int dc_api dc_is_device_ssd(wchar_t *device);
59+
5860
#endif

0 commit comments

Comments
 (0)