From bd6336c629841c6db3a6ca53a936d629d34db53b Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:15:16 +0200 Subject: 4.1 --- shared/privilege.h | 59 ------------------------------------------------------ 1 file changed, 59 deletions(-) delete mode 100644 shared/privilege.h (limited to 'shared/privilege.h') diff --git a/shared/privilege.h b/shared/privilege.h deleted file mode 100644 index 09fe0d08..00000000 --- a/shared/privilege.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef PRIVILEGE_H_INCLUDED -#define PRIVILEGE_H_INCLUDED - -#include -#include "zstring.h" -#include "file_error.h" -#include //includes "windows.h" - - -namespace zen -{ -#ifdef FFS_WIN -class Privileges -{ -public: - static Privileges& getInstance(); - - void ensureActive(LPCTSTR privilege) //throw FileError - { - if (activePrivileges.find(privilege) != activePrivileges.end()) - return; //privilege already active - - if (privilegeIsActive(privilege)) //privilege was already active before starting this tool - activePrivileges.insert(std::make_pair(privilege, false)); - else - { - setPrivilege(privilege, true); - activePrivileges.insert(std::make_pair(privilege, true)); - } - } - -private: - Privileges() {} - Privileges(Privileges&); - void operator=(Privileges&); - - ~Privileges() //clean up: deactivate all privileges that have been activated by this application - { - for (PrivBuffType::const_iterator i = activePrivileges.begin(); i != activePrivileges.end(); ++i) - try - { - if (i->second) - Privileges::setPrivilege(i->first.c_str(), false); - } - catch (...) {} - } - - static bool privilegeIsActive(LPCTSTR privilege); //throw FileError - static void setPrivilege(LPCTSTR privilege, bool enable); //throw FileError - - typedef std::map PrivBuffType; //bool: enabled by this application - - PrivBuffType activePrivileges; -}; -#endif -} - - -#endif // PRIVILEGE_H_INCLUDED -- cgit