Skip to content

Commit

Permalink
1.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidXanatos committed Oct 19, 2023
1 parent f12a9e0 commit 838c86a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
14 changes: 9 additions & 5 deletions SandboxiePlus/QSbieAPI/SbieAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ extern "C" {
NTSTATUS NTAPI RtlSetThreadErrorMode(IN ULONG NewMode, OUT PULONG OldMode);
}

ULONG CSbieAPI__GetVolumeSN(wchar_t* path)
quint32 CSbieAPI::GetVolumeSN(const wchar_t* path, std::wstring* pLabel)
{
ULONG sn = 0;
HANDLE handle;
Expand Down Expand Up @@ -849,8 +849,10 @@ ULONG CSbieAPI__GetVolumeSN(wchar_t* path)
FILE_FS_VOLUME_INFORMATION volumeInfo;
BYTE volumeInfoBuff[64];
} u;
if (NT_SUCCESS(NtQueryVolumeInformationFile(handle, &iosb, &u.volumeInfo, sizeof(u), FileFsVolumeInformation)))
sn = u.volumeInfo.VolumeSerialNumber;
if (NT_SUCCESS(NtQueryVolumeInformationFile(handle, &iosb, &u.volumeInfo, sizeof(u), FileFsVolumeInformation))) {
sn = u.volumeInfo.VolumeSerialNumber;
if (pLabel) *pLabel = std::wstring(u.volumeInfo.VolumeLabel, u.volumeInfo.VolumeLabelLength/sizeof(wchar_t));
}

NtClose(handle);
}
Expand Down Expand Up @@ -925,7 +927,7 @@ void CSbieAPI::UpdateDriveLetters()
}
else {
Drive.Type = SDrive::EVolume;
if (ULONG sn = CSbieAPI__GetVolumeSN(lpTargetPath))
if (quint32 sn = GetVolumeSN(lpTargetPath))
Drive.Aux = QString("%1-%2").arg((ushort)HIWORD(sn), 4, 16, QChar('0')).arg((ushort)LOWORD(sn), 4, 16, QChar('0')).toUpper();
}
Key.append("\\");
Expand Down Expand Up @@ -2141,7 +2143,7 @@ SB_STATUS CSbieAPI::SetSecureParam(const QString& Name, const void* data, size_t
return SB_OK;
}

SB_STATUS CSbieAPI::GetSecureParam(const QString& Name, void* data, size_t size)
SB_STATUS CSbieAPI::GetSecureParam(const QString& Name, void* data, size_t size, quint32* size_out, bool bVerify)
{
__declspec(align(8)) ULONG64 parms[API_NUM_ARGS];
API_SECURE_PARAM_ARGS *args = (API_SECURE_PARAM_ARGS*)parms;
Expand All @@ -2153,6 +2155,8 @@ SB_STATUS CSbieAPI::GetSecureParam(const QString& Name, void* data, size_t size)
args->param_name.val = (WCHAR*)name.c_str();
args->param_data.val = (void*)data;
args->param_size.val = size;
args->param_size_out.val = (ULONG*)size_out;
args->param_verify.val = bVerify;

NTSTATUS status = m->IoControl(parms);
if (!NT_SUCCESS(status))
Expand Down
3 changes: 2 additions & 1 deletion SandboxiePlus/QSbieAPI/SbieAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class QSBIEAPI_EXPORT CSbieAPI : public QThread

virtual void UpdateDriveLetters();
virtual QString Nt2DosPath(QString NtPath, bool* pOk = NULL) const;
static quint32 GetVolumeSN(const wchar_t* path, std::wstring* pLabel = NULL);

virtual SB_STATUS ReloadBoxes(bool bForceUpdate = false);
static SB_STATUS ValidateName(const QString& BoxName);
Expand Down Expand Up @@ -155,7 +156,7 @@ class QSBIEAPI_EXPORT CSbieAPI : public QThread
virtual quint32 GetSessionID() const;

virtual SB_STATUS SetSecureParam(const QString& Name, const void* data, size_t size);
virtual SB_STATUS GetSecureParam(const QString& Name, void* data, size_t size);
virtual SB_STATUS GetSecureParam(const QString& Name, void* data, size_t size, quint32* size_out = NULL, bool bVerify = false);


enum ESbieQueuedRequests
Expand Down

0 comments on commit 838c86a

Please sign in to comment.