summaryrefslogtreecommitdiff
path: root/shared/privilege.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:11:56 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:11:56 +0200
commit98ecf620f7de377dc8ae9ad7fbd1e3b24477e138 (patch)
treefaadc6d8822c20cd3bc6f50b2a98e6c580585949 /shared/privilege.cpp
parent3.16 (diff)
downloadFreeFileSync-98ecf620f7de377dc8ae9ad7fbd1e3b24477e138.tar.gz
FreeFileSync-98ecf620f7de377dc8ae9ad7fbd1e3b24477e138.tar.bz2
FreeFileSync-98ecf620f7de377dc8ae9ad7fbd1e3b24477e138.zip
3.17
Diffstat (limited to 'shared/privilege.cpp')
-rw-r--r--shared/privilege.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/shared/privilege.cpp b/shared/privilege.cpp
index 5cb664e1..c854ad4e 100644
--- a/shared/privilege.cpp
+++ b/shared/privilege.cpp
@@ -1,9 +1,9 @@
#include "privilege.h"
-#include "system_func.h"
+#include "last_error.h"
#include "i18n.h"
#include "loki/ScopeGuard.h"
-using namespace ffs3;
+using namespace zen;
Privileges& Privileges::getInstance()
@@ -20,8 +20,8 @@ bool Privileges::privilegeIsActive(LPCTSTR privilege) //throw (FileError)
TOKEN_QUERY, //__in DWORD DesiredAccess,
&hToken)) //__out PHANDLE TokenHandle
{
- const wxString errorMessage = wxString(_("Error setting privilege:")) + wxT(" \"") + privilege + wxT("\"") + wxT("\n\n");
- throw FileError(errorMessage + ffs3::getLastErrorFormatted());
+ const wxString errorMessage = wxString(_("Error setting privilege:")) + wxT(" \"") + privilege + wxT("\"");
+ throw FileError(errorMessage + wxT("\n\n") + zen::getLastErrorFormatted());
}
Loki::ScopeGuard dummy = Loki::MakeGuard(::CloseHandle, hToken);
(void)dummy; //silence warning "unused variable"
@@ -33,8 +33,8 @@ bool Privileges::privilegeIsActive(LPCTSTR privilege) //throw (FileError)
privilege, //__in LPCTSTR lpName,
&luid )) //__out PLUID lpLuid
{
- const wxString errorMessage = wxString(_("Error setting privilege:")) + wxT(" \"") + privilege + wxT("\"") + wxT("\n\n");
- throw FileError(errorMessage + ffs3::getLastErrorFormatted());
+ const wxString errorMessage = wxString(_("Error setting privilege:")) + wxT(" \"") + privilege + wxT("\"");
+ throw FileError(errorMessage + wxT("\n\n") + zen::getLastErrorFormatted());
}
PRIVILEGE_SET priv = {};
@@ -49,8 +49,8 @@ bool Privileges::privilegeIsActive(LPCTSTR privilege) //throw (FileError)
&priv, //__inout PPRIVILEGE_SET RequiredPrivileges,
&alreadyGranted)) //__out LPBOOL pfResult
{
- const wxString errorMessage = wxString(_("Error setting privilege:")) + wxT(" \"") + privilege + wxT("\"") + wxT("\n\n");
- throw FileError(errorMessage + ffs3::getLastErrorFormatted());
+ const wxString errorMessage = wxString(_("Error setting privilege:")) + wxT(" \"") + privilege + wxT("\"");
+ throw FileError(errorMessage + wxT("\n\n") + zen::getLastErrorFormatted());
}
return alreadyGranted == TRUE;
@@ -64,8 +64,8 @@ void Privileges::setPrivilege(LPCTSTR privilege, bool enable) //throw (FileError
TOKEN_ADJUST_PRIVILEGES, //__in DWORD DesiredAccess,
&hToken)) //__out PHANDLE TokenHandle
{
- const wxString errorMessage = wxString(_("Error setting privilege:")) + wxT(" \"") + privilege + wxT("\"") + wxT("\n\n");
- throw FileError(errorMessage + ffs3::getLastErrorFormatted());
+ const wxString errorMessage = wxString(_("Error setting privilege:")) + wxT(" \"") + privilege + wxT("\"");
+ throw FileError(errorMessage + wxT("\n\n") + zen::getLastErrorFormatted());
}
Loki::ScopeGuard dummy = Loki::MakeGuard(::CloseHandle, hToken);
(void)dummy; //silence warning "unused variable"
@@ -76,8 +76,8 @@ void Privileges::setPrivilege(LPCTSTR privilege, bool enable) //throw (FileError
privilege, //__in LPCTSTR lpName,
&luid )) //__out PLUID lpLuid
{
- const wxString errorMessage = wxString(_("Error setting privilege:")) + wxT(" \"") + privilege + wxT("\"") + wxT("\n\n");
- throw FileError(errorMessage + ffs3::getLastErrorFormatted());
+ const wxString errorMessage = wxString(_("Error setting privilege:")) + wxT(" \"") + privilege + wxT("\"");
+ throw FileError(errorMessage + wxT("\n\n") + zen::getLastErrorFormatted());
}
TOKEN_PRIVILEGES tp = {};
@@ -93,13 +93,13 @@ void Privileges::setPrivilege(LPCTSTR privilege, bool enable) //throw (FileError
NULL, //__out_opt PTOKEN_PRIVILEGES PreviousState,
NULL)) //__out_opt PDWORD ReturnLength
{
- const wxString errorMessage = wxString(_("Error setting privilege:")) + wxT(" \"") + privilege + wxT("\"") + wxT("\n\n");
- throw FileError(errorMessage + ffs3::getLastErrorFormatted());
+ const wxString errorMessage = wxString(_("Error setting privilege:")) + wxT(" \"") + privilege + wxT("\"");
+ throw FileError(errorMessage + wxT("\n\n") + zen::getLastErrorFormatted());
}
if (::GetLastError() == ERROR_NOT_ALL_ASSIGNED) //check although previous function returned with success!
{
- const wxString errorMessage = wxString(_("Error setting privilege:")) + wxT(" \"") + privilege + wxT("\"") + wxT("\n\n");
- throw FileError(errorMessage + ffs3::getLastErrorFormatted());
+ const wxString errorMessage = wxString(_("Error setting privilege:")) + wxT(" \"") + privilege + wxT("\"");
+ throw FileError(errorMessage + wxT("\n\n") + zen::getLastErrorFormatted());
}
}
bgstack15