Fixed: When a file was selected for the Convolution command in the Configuration Editor that was not readable by the audio service, no warning appeared.

This commit is contained in:
jthedering committed 2016-01-03 17:24:33 +00:00
1 parent 420b7f0e11
commit b0671221e5
9 files changed
+141 -62

No files matched your search

+4 -4
View File
@@ -97,7 +97,7 @@
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>muparserxd.lib;version.lib;Shlwapi.lib;libsndfile-1.lib;libfftw3f-3.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>muparserxd.lib;version.lib;Shlwapi.lib;authz.lib;libsndfile-1.lib;libfftw3f-3.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@@ -110,7 +110,7 @@
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>muparserxd.lib;version.lib;Shlwapi.lib;libsndfile-1.lib;libfftw3f-3.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>muparserxd.lib;version.lib;Shlwapi.lib;authz.lib;libsndfile-1.lib;libfftw3f-3.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -128,7 +128,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>muparserx.lib;version.lib;Shlwapi.lib;libsndfile-1.lib;libfftw3f-3.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>muparserx.lib;version.lib;Shlwapi.lib;authz.lib;libsndfile-1.lib;libfftw3f-3.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@@ -146,7 +146,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>muparserx.lib;version.lib;Shlwapi.lib;libsndfile-1.lib;libfftw3f-3.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>muparserx.lib;version.lib;Shlwapi.lib;authz.lib;libsndfile-1.lib;libfftw3f-3.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
+4 -4
View File
@@ -138,7 +138,7 @@
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>audioeng.lib;version.lib;Shlwapi.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>audioeng.lib;version.lib;Shlwapi.lib;authz.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@@ -151,7 +151,7 @@
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>audioeng.lib;version.lib;Shlwapi.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>audioeng.lib;version.lib;Shlwapi.lib;authz.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -168,7 +168,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>audioeng.lib;version.lib;Shlwapi.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>audioeng.lib;version.lib;Shlwapi.lib;authz.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@@ -185,7 +185,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>audioeng.lib;version.lib;Shlwapi.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>audioeng.lib;version.lib;Shlwapi.lib;authz.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+1 -1
View File
@@ -234,7 +234,7 @@ FORMS += \
guis/StageFilterGUI.ui
INCLUDEPATH += $$PWD/.. "C:/Program Files/libsndfile/include" "C:/Program Files/fftw3" "C:/Program Files/muparserx_v3_0_1/parser"
LIBS += advapi32.lib version.lib ole32.lib Shlwapi.lib libsndfile-1.lib libfftw3f-3.lib
LIBS += advapi32.lib version.lib ole32.lib Shlwapi.lib authz.lib libsndfile-1.lib libfftw3f-3.lib
build_pass:CONFIG(debug, debug|release) {
LIBS += muparserxd.lib
+33 -14
View File
@@ -21,6 +21,7 @@
#define ENABLE_SNDFILE_WINDOWS_PROTOTYPES 1
#include <sndfile.h>
#include "helpers/RegistryHelper.h"
#include "ConvolutionFilterGUI.h"
#include "ui_ConvolutionFilterGUI.h"
@@ -102,27 +103,45 @@ void ConvolutionFilterGUI::updateFileInfo()
}
else
{
path = fileInfo.absoluteFilePath();
path = QDir::toNativeSeparators(fileInfo.absoluteFilePath());
SF_INFO info;
SNDFILE* file = sf_wchar_open(path.toStdWString().c_str(), SFM_READ, &info);
if (file == NULL)
ACCESS_MASK mask = GENERIC_READ;
try
{
error = tr("Unsupported file format");
mask = RegistryHelper::getFileAccessForUser(path.toStdWString(), SECURITY_LOCAL_SERVICE_RID);
}
catch (RegistryException e)
{
// ignore
}
if ((mask & GENERIC_READ) != GENERIC_READ && (mask & FILE_GENERIC_READ) != FILE_GENERIC_READ)
{
error = tr("The file is not readable for the audio service.\nChange the file permissions or copy the file to the config directory.");
labelsVisible = false;
}
else
{
int sampleRate = info.samplerate;
double length = info.frames * 1000.0 / sampleRate;
ui->labelLengthValue->setText(tr("%0 ms (%1 samples)").arg(length).arg(info.frames));
ui->labelSampleRateValue->setText(tr("%0 Hz").arg(sampleRate));
sf_close(file);
if (sampleRate != deviceSampleRate)
SF_INFO info;
SNDFILE* file = sf_wchar_open(path.toStdWString().c_str(), SFM_READ, &info);
if (file == NULL)
{
error = tr("The file sample rate does not match the device sample rate (%0 Hz)!\nSelect a different file or change the device configuration.").arg(deviceSampleRate);
error = tr("Unsupported file format");
labelsVisible = false;
}
else
{
int sampleRate = info.samplerate;
double length = info.frames * 1000.0 / sampleRate;
ui->labelLengthValue->setText(tr("%0 ms (%1 samples)").arg(length).arg(info.frames));
ui->labelSampleRateValue->setText(tr("%0 Hz").arg(sampleRate));
sf_close(file);
if (sampleRate != deviceSampleRate)
{
error = tr("The file sample rate does not match the device sample rate (%0 Hz)!\nSelect a different file or change the device configuration.").arg(deviceSampleRate);
}
}
}
}
Binary file not shown.
+42 -35
View File
@@ -293,7 +293,7 @@
<message>
<location filename="../guis/ConvolutionFilterGUI.ui" line="79"/>
<location filename="../guis/ConvolutionFilterGUI.ui" line="137"/>
<location filename="../guis/ConvolutionFilterGUI.cpp" line="90"/>
<location filename="../guis/ConvolutionFilterGUI.cpp" line="91"/>
<source>No file selected</source>
<translation>Keine Datei gewählt</translation>
</message>
@@ -303,41 +303,48 @@
<translation>Länge:</translation>
</message>
<message>
<location filename="../guis/ConvolutionFilterGUI.cpp" line="57"/>
<location filename="../guis/ConvolutionFilterGUI.cpp" line="58"/>
<source>Select impulse response file</source>
<translation>Impulsantwort auswählen</translation>
</message>
<message>
<location filename="../guis/ConvolutionFilterGUI.cpp" line="59"/>
<location filename="../guis/ConvolutionFilterGUI.cpp" line="60"/>
<source>Impulse response (*.wav *.flac *.ogg)</source>
<translation>Impulsantwort (*.wav *.flac *.ogg)</translation>
</message>
<message>
<location filename="../guis/ConvolutionFilterGUI.cpp" line="100"/>
<location filename="../guis/ConvolutionFilterGUI.cpp" line="101"/>
<source>File not found</source>
<translation>Datei nicht gefunden</translation>
</message>
<message>
<location filename="../guis/ConvolutionFilterGUI.cpp" line="111"/>
<location filename="../guis/ConvolutionFilterGUI.cpp" line="120"/>
<source>The file is not readable for the audio service.
Change the file permissions or copy the file to the config directory.</source>
<translation>Die Datei ist für den Audiodienst nicht lesbar.
Ändern Sie die Dateiberechtigungen oder kopieren Sie die Datei in das config-Verzeichnis.</translation>
</message>
<message>
<location filename="../guis/ConvolutionFilterGUI.cpp" line="129"/>
<source>Unsupported file format</source>
<translation>Nicht unterstütztes Dateiformat</translation>
</message>
<message>
<location filename="../guis/ConvolutionFilterGUI.cpp" line="119"/>
<location filename="../guis/ConvolutionFilterGUI.cpp" line="137"/>
<source>%0 ms (%1 samples)</source>
<translation>%0 ms (%1 Samples)</translation>
</message>
<message>
<location filename="../guis/ConvolutionFilterGUI.cpp" line="120"/>
<location filename="../guis/ConvolutionFilterGUI.cpp" line="138"/>
<source>%0 Hz</source>
<translation>%0 Hz</translation>
</message>
<message>
<location filename="../guis/ConvolutionFilterGUI.cpp" line="125"/>
<location filename="../guis/ConvolutionFilterGUI.cpp" line="143"/>
<source>The file sample rate does not match the device sample rate (%0 Hz)!
Select a different file or change the device configuration.</source>
<translation>Die Abtastrate der Datei stimmt nicht mit der Abtastrate des Geräts (%0 Hz) überein!
Wählen Sie eine andere Datei or ändern Sie die Konfiguration des Geräts.</translation>
Wählen Sie eine andere Datei oder ändern Sie die Konfiguration des Geräts.</translation>
</message>
</context>
<context>
@@ -773,18 +780,18 @@ Wählen Sie eine andere Datei or ändern Sie die Konfiguration des Geräts.</tra
</message>
<message>
<location filename="../guis/GraphicEQFilterGUI.cpp" line="298"/>
<location filename="../guis/GraphicEQFilterGUI.cpp" line="365"/>
<location filename="../guis/GraphicEQFilterGUI.cpp" line="371"/>
<source>Frequency response (*.csv)</source>
<translation>Frequenzgang (*.csv)</translation>
</message>
<message>
<location filename="../guis/GraphicEQFilterGUI.cpp" line="299"/>
<location filename="../guis/GraphicEQFilterGUI.cpp" line="366"/>
<location filename="../guis/GraphicEQFilterGUI.cpp" line="372"/>
<source>All files (*.*)</source>
<translation>Alle Dateien (*.*)</translation>
</message>
<message>
<location filename="../guis/GraphicEQFilterGUI.cpp" line="361"/>
<location filename="../guis/GraphicEQFilterGUI.cpp" line="367"/>
<source>Export frequency response</source>
<translation>Frequenzgang exportieren</translation>
</message>
@@ -1137,8 +1144,8 @@ Möchten Sie die Configurator-Anwendung starten, um das Problem zu beheben?</tra
</message>
<message>
<location filename="../MainWindow.cpp" line="262"/>
<location filename="../MainWindow.cpp" line="344"/>
<location filename="../MainWindow.cpp" line="358"/>
<location filename="../MainWindow.cpp" line="342"/>
<location filename="../MainWindow.cpp" line="356"/>
<source>Error</source>
<translation>Fehler</translation>
</message>
@@ -1148,23 +1155,23 @@ Möchten Sie die Configurator-Anwendung starten, um das Problem zu beheben?</tra
<translation>Fehler beim Lesen der Konfigurationsdatei: %0</translation>
</message>
<message>
<location filename="../MainWindow.cpp" line="344"/>
<location filename="../MainWindow.cpp" line="342"/>
<source>Error while writing configuration file: %0</source>
<translation>Fehler beim Schreiben der Konfigurationsdatei: %0</translation>
</message>
<message>
<location filename="../MainWindow.cpp" line="358"/>
<location filename="../MainWindow.cpp" line="356"/>
<source>Only %0/%1 bytes have been written!</source>
<translation>Nur %0/%1 Bytes wurden geschrieben!</translation>
</message>
<message>
<location filename="../MainWindow.cpp" line="424"/>
<location filename="../MainWindow.cpp" line="426"/>
<location filename="../MainWindow.cpp" line="428"/>
<source>From device</source>
<translation>Von Gerät</translation>
</message>
<message>
<location filename="../MainWindow.cpp" line="705"/>
<location filename="../MainWindow.cpp" line="702"/>
<source>%0 dB</source>
<translation>%0 dB</translation>
</message>
@@ -1173,7 +1180,7 @@ Möchten Sie die Configurator-Anwendung starten, um das Problem zu beheben?</tra
<translation type="vanished">%0 ms (%1 Samp.)</translation>
</message>
<message>
<location filename="../MainWindow.cpp" line="708"/>
<location filename="../MainWindow.cpp" line="705"/>
<source>%0 ms (%1 s.)</source>
<translation>%0 ms (%1 S.)</translation>
</message>
@@ -1182,46 +1189,46 @@ Möchten Sie die Configurator-Anwendung starten, um das Problem zu beheben?</tra
<translation type="vanished">%0 ms (%1 Samples)</translation>
</message>
<message>
<location filename="../MainWindow.cpp" line="710"/>
<location filename="../MainWindow.cpp" line="707"/>
<source>%0 ms</source>
<translation>%0 ms</translation>
</message>
<message>
<location filename="../MainWindow.cpp" line="713"/>
<location filename="../MainWindow.cpp" line="710"/>
<source>%0 % (one core)</source>
<translation>%0 % (ein Kern)</translation>
</message>
<message>
<location filename="../MainWindow.cpp" line="751"/>
<location filename="../MainWindow.cpp" line="778"/>
<location filename="../MainWindow.cpp" line="797"/>
<location filename="../MainWindow.cpp" line="748"/>
<location filename="../MainWindow.cpp" line="775"/>
<location filename="../MainWindow.cpp" line="794"/>
<source>Restart required</source>
<translation>Neustart erforderlich</translation>
</message>
<message>
<location filename="../MainWindow.cpp" line="751"/>
<location filename="../MainWindow.cpp" line="778"/>
<location filename="../MainWindow.cpp" line="797"/>
<location filename="../MainWindow.cpp" line="748"/>
<location filename="../MainWindow.cpp" line="775"/>
<location filename="../MainWindow.cpp" line="794"/>
<source>Configuration Editor will be restarted to apply the changed settings. Proceed?</source>
<translation>Konfigurationseditor wird neugestartet, um die geänderten Einstellungen zu übernehmen. Fortsetzen?</translation>
</message>
<message>
<location filename="../MainWindow.cpp" line="856"/>
<location filename="../MainWindow.cpp" line="854"/>
<source>Unsaved changes</source>
<translation>Ungespeicherte Änderungen</translation>
</message>
<message>
<location filename="../MainWindow.cpp" line="857"/>
<location filename="../MainWindow.cpp" line="855"/>
<source>The configuration file %0 has unsaved changes.</source>
<translation>Die Konfigurationsdatei %0 hat ungespeicherte Änderungen.</translation>
</message>
<message>
<location filename="../MainWindow.cpp" line="858"/>
<location filename="../MainWindow.cpp" line="856"/>
<source>Do you want to save the changes before closing the file?</source>
<translation>Möchten Sie die Änderungen speichern, bevor die Datei geschlossen wird?</translation>
</message>
<message>
<location filename="../MainWindow.cpp" line="529"/>
<location filename="../MainWindow.cpp" line="527"/>
<source>Open file</source>
<translation>Datei öffnen</translation>
</message>
@@ -1231,18 +1238,18 @@ Möchten Sie die Configurator-Anwendung starten, um das Problem zu beheben?</tra
<translation>Automatisch (%0)</translation>
</message>
<message>
<location filename="../MainWindow.cpp" line="531"/>
<location filename="../MainWindow.cpp" line="584"/>
<location filename="../MainWindow.cpp" line="529"/>
<location filename="../MainWindow.cpp" line="582"/>
<source>E-APO configurations (*.txt)</source>
<translation>E-APO-Konfigurationen (*.txt)</translation>
</message>
<message>
<location filename="../MainWindow.cpp" line="581"/>
<location filename="../MainWindow.cpp" line="579"/>
<source>Save file as</source>
<translation>Datei speichern unter</translation>
</message>
<message>
<location filename="../MainWindow.cpp" line="603"/>
<location filename="../MainWindow.cpp" line="601"/>
<source>Unsaved</source>
<translation>Ungespeichert</translation>
</message>
+4 -4
View File
@@ -99,7 +99,7 @@
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>muparserxd.lib;audioeng.lib;version.lib;wmcodecdspuuid.lib;AudioBaseProcessingObject.lib;audiomediatypecrt.lib;Shlwapi.lib;libsndfile-1.lib;libfftw3f-3.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>muparserxd.lib;audioeng.lib;version.lib;wmcodecdspuuid.lib;AudioBaseProcessingObject.lib;audiomediatypecrt.lib;Shlwapi.lib;authz.lib;libsndfile-1.lib;libfftw3f-3.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>EqualizerAPO.def</ModuleDefinitionFile>
</Link>
<Midl>
@@ -116,7 +116,7 @@
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>muparserxd.lib;audioeng.lib;version.lib;wmcodecdspuuid.lib;AudioBaseProcessingObject.lib;audiomediatypecrt.lib;Shlwapi.lib;libsndfile-1.lib;libfftw3f-3.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>muparserxd.lib;audioeng.lib;version.lib;wmcodecdspuuid.lib;AudioBaseProcessingObject.lib;audiomediatypecrt.lib;Shlwapi.lib;authz.lib;libsndfile-1.lib;libfftw3f-3.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>EqualizerAPO.def</ModuleDefinitionFile>
</Link>
<Midl>
@@ -138,7 +138,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>muparserx.lib;audioeng.lib;version.lib;wmcodecdspuuid.lib;AudioBaseProcessingObject.lib;audiomediatypecrt.lib;Shlwapi.lib;libsndfile-1.lib;libfftw3f-3.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>muparserx.lib;audioeng.lib;version.lib;wmcodecdspuuid.lib;AudioBaseProcessingObject.lib;audiomediatypecrt.lib;Shlwapi.lib;authz.lib;libsndfile-1.lib;libfftw3f-3.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>EqualizerAPO.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
@@ -157,7 +157,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>muparserx.lib;audioeng.lib;version.lib;wmcodecdspuuid.lib;AudioBaseProcessingObject.lib;audiomediatypecrt.lib;Shlwapi.lib;libsndfile-1.lib;libfftw3f-3.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>muparserx.lib;audioeng.lib;version.lib;wmcodecdspuuid.lib;AudioBaseProcessingObject.lib;audiomediatypecrt.lib;Shlwapi.lib;authz.lib;libsndfile-1.lib;libfftw3f-3.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>EqualizerAPO.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
+52
View File
@@ -22,6 +22,7 @@
#include <sstream>
#include <ObjBase.h>
#include <aclapi.h>
#include <authz.h>
#include "StringHelper.h"
#include "RegistryHelper.h"
@@ -410,6 +411,57 @@ void RegistryHelper::takeOwnership(wstring key)
LocalFree(sd);
}
ACCESS_MASK RegistryHelper::getFileAccessForUser(std::wstring path, unsigned long rid)
{
ACCESS_MASK result;
PSECURITY_DESCRIPTOR sd;
if (GetNamedSecurityInfoW(path.c_str(), SE_FILE_OBJECT, DACL_SECURITY_INFORMATION | OWNER_SECURITY_INFORMATION
| GROUP_SECURITY_INFORMATION, NULL, NULL, NULL, NULL, &sd) != ERROR_SUCCESS)
throw RegistryException(L"Error in GetNamedSecurityInfoW while getting file access");
AUTHZ_RESOURCE_MANAGER_HANDLE manager;
if (!AuthzInitializeResourceManager(AUTHZ_RM_FLAG_NO_AUDIT, NULL, NULL, NULL, NULL, &manager))
throw RegistryException(L"Error in AuthzInitializeResourceManager while getting file access");
PSID sid = NULL;
SID_IDENTIFIER_AUTHORITY authority = SECURITY_NT_AUTHORITY;
if (!AllocateAndInitializeSid(&authority, 1, rid, 0, 0, 0, 0, 0, 0, 0, &sid))
throw RegistryException(L"Error in AllocateAndInitializeSid while getting file access");
LUID unusedId = {0};
AUTHZ_CLIENT_CONTEXT_HANDLE context;
if (!AuthzInitializeContextFromSid(0, sid, manager, NULL, unusedId, NULL, &context))
throw RegistryException(L"Error in AuthzInitializeContextFromSid while getting file access");
AUTHZ_ACCESS_REQUEST request = {0};
request.DesiredAccess = MAXIMUM_ALLOWED;
request.PrincipalSelfSid = NULL;
request.ObjectTypeList = NULL;
request.ObjectTypeListLength = 0;
request.OptionalArguments = NULL;
AUTHZ_ACCESS_REPLY reply = {0};
BYTE buf[1024];
RtlZeroMemory(buf, sizeof(buf));
reply.ResultListLength = 1;
reply.GrantedAccessMask = (ACCESS_MASK*)buf;
reply.Error = (DWORD*)(buf + sizeof(ACCESS_MASK));
if (!AuthzAccessCheck(0, context, &request, NULL, sd, NULL, 0, &reply, NULL))
throw RegistryException(L"Error in AuthzAccessCheck while getting file access");
result = *reply.GrantedAccessMask;
AuthzFreeContext(context);
FreeSid(sid);
AuthzFreeResourceManager(manager);
LocalFree(sd);
return result;
}
bool RegistryHelper::keyExists(wstring key)
{
bool result;
+1
View File
@@ -49,6 +49,7 @@ public:
static void deleteKey(std::wstring key);
static void makeWritable(std::wstring key);
static void takeOwnership(std::wstring key);
static ACCESS_MASK getFileAccessForUser(std::wstring path, unsigned long rid);
static std::vector<std::wstring> enumSubKeys(std::wstring key);
static bool keyExists(std::wstring key);
static bool valueExists(std::wstring key, std::wstring valuename);