From a3a01c16c4bb1393d3c4c9013ae44f80b41e899b Mon Sep 17 00:00:00 2001 From: DavidXanatos Date: Sun, 8 Aug 2021 14:00:07 +0200 Subject: [PATCH] Build 0.9.3 --- CHANGELOG.md | 2 +- Sandboxie/common/win32_ntddk.h | 2 ++ Sandboxie/core/dll/file_init.c | 3 +++ SandboxiePlus/QSbieAPI/QSbieAPI.vcxproj | 2 ++ SandboxiePlus/QSbieAPI/SbieAPI.cpp | 9 ++++++++- 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8c10712..5843a67a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - fixed issue with language auto detection [#1018](https://github.com/sandboxie-plus/Sandboxie/issues/1018) - fixed issue with multiple files with same name, by always showing the extension [#1041](https://github.com/sandboxie-plus/Sandboxie/issues/1041) - fixed multiple program grouping issues with the sandman ui [#1054](https://github.com/sandboxie-plus/Sandboxie/issues/1054) - +- fixed no disk error [#966](https://github.com/sandboxie-plus/Sandboxie/issues/966) ## [0.9.2 / 5.51.2] - 2021-08-07 diff --git a/Sandboxie/common/win32_ntddk.h b/Sandboxie/common/win32_ntddk.h index d679f9a9..64146a3f 100644 --- a/Sandboxie/common/win32_ntddk.h +++ b/Sandboxie/common/win32_ntddk.h @@ -2419,6 +2419,8 @@ RtlNtStatusToDosError(NTSTATUS Status); __declspec(dllimport) void __stdcall RtlRaiseStatus(NTSTATUS Status); +NTSTATUS NTAPI RtlSetThreadErrorMode(IN ULONG NewMode, OUT PULONG OldMode); + __declspec(dllimport) PULONG __stdcall RtlSubAuthoritySid( _In_ PSID Sid, diff --git a/Sandboxie/core/dll/file_init.c b/Sandboxie/core/dll/file_init.c index cdc0b8ad..0f59c171 100644 --- a/Sandboxie/core/dll/file_init.c +++ b/Sandboxie/core/dll/file_init.c @@ -357,12 +357,15 @@ _FX ULONG File_GetVolumeSN(const FILE_DRIVE *drive) InitializeObjectAttributes( &objattrs, &objname, OBJ_CASE_INSENSITIVE, NULL, NULL); + ULONG OldMode; + RtlSetThreadErrorMode(0x10u, &OldMode); NTSTATUS status = NtCreateFile( &handle, GENERIC_READ | SYNCHRONIZE, &objattrs, &iosb, NULL, 0, FILE_SHARE_VALID_FLAGS, FILE_OPEN, FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT, NULL, 0); + RtlSetThreadErrorMode(OldMode, 0i64); Dll_Free(objname.Buffer); diff --git a/SandboxiePlus/QSbieAPI/QSbieAPI.vcxproj b/SandboxiePlus/QSbieAPI/QSbieAPI.vcxproj index 5194a4d5..0e71b124 100644 --- a/SandboxiePlus/QSbieAPI/QSbieAPI.vcxproj +++ b/SandboxiePlus/QSbieAPI/QSbieAPI.vcxproj @@ -132,6 +132,7 @@ $(IntDir)$(TargetName).pch QSBIEAPI_LIB;UNICODE;_UNICODE;WIN32;WIN64;%(PreprocessorDefinitions) .;%(AdditionalIncludeDirectories) + false Windows @@ -178,6 +179,7 @@ $(IntDir)$(TargetName).pch QSBIEAPI_LIB;UNICODE;_UNICODE;WIN32;WIN64;%(PreprocessorDefinitions) .;%(AdditionalIncludeDirectories) + false Windows diff --git a/SandboxiePlus/QSbieAPI/SbieAPI.cpp b/SandboxiePlus/QSbieAPI/SbieAPI.cpp index 055ba705..11bd252d 100644 --- a/SandboxiePlus/QSbieAPI/SbieAPI.cpp +++ b/SandboxiePlus/QSbieAPI/SbieAPI.cpp @@ -812,6 +812,10 @@ typedef struct _FILE_FS_VOLUME_INFORMATION { WCHAR VolumeLabel[1]; } FILE_FS_VOLUME_INFORMATION, *PFILE_FS_VOLUME_INFORMATION; +extern "C" { + NTSTATUS NTAPI RtlSetThreadErrorMode(IN ULONG NewMode, OUT PULONG OldMode); +} + ULONG CSbieAPI__GetVolumeSN(wchar_t* path) { ULONG sn = 0; @@ -831,13 +835,16 @@ ULONG CSbieAPI__GetVolumeSN(wchar_t* path) OBJECT_ATTRIBUTES objattrs; InitializeObjectAttributes( &objattrs, &objname, OBJ_CASE_INSENSITIVE, NULL, NULL); - + + ULONG OldMode; + RtlSetThreadErrorMode(0x10u, &OldMode); NTSTATUS status = NtCreateFile( &handle, GENERIC_READ | SYNCHRONIZE, &objattrs, &iosb, NULL, 0, FILE_SHARE_VALID_FLAGS, FILE_OPEN, FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT, NULL, 0); + RtlSetThreadErrorMode(OldMode, 0i64); delete [] objname.Buffer;