Remove MSW code targeted at versions prior to WinXP.

In 3.1 WinXP is required so remove checks and code for prior versions.
This commit is contained in:
Tobias Taschner
2015-08-06 09:44:20 +02:00
parent 0b821adf90
commit 388e82e70c
7 changed files with 26 additions and 80 deletions

View File

@@ -891,36 +891,33 @@ bool wxShutdown(int WXUNUSED_IN_WINCE(flags))
#else
bool bOK = true;
if ( wxGetOsVersion(NULL, NULL) == wxOS_WINDOWS_NT ) // if is NT or 2K
// Get a token for this process.
HANDLE hToken;
bOK = ::OpenProcessToken(GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
&hToken) != 0;
if ( bOK )
{
// Get a token for this process.
HANDLE hToken;
bOK = ::OpenProcessToken(GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
&hToken) != 0;
TOKEN_PRIVILEGES tkp;
// Get the LUID for the shutdown privilege.
bOK = ::LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME,
&tkp.Privileges[0].Luid) != 0;
if ( bOK )
{
TOKEN_PRIVILEGES tkp;
tkp.PrivilegeCount = 1; // one privilege to set
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
// Get the LUID for the shutdown privilege.
bOK = ::LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME,
&tkp.Privileges[0].Luid) != 0;
// Get the shutdown privilege for this process.
::AdjustTokenPrivileges(hToken, FALSE, &tkp, 0,
(PTOKEN_PRIVILEGES)NULL, 0);
if ( bOK )
{
tkp.PrivilegeCount = 1; // one privilege to set
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
// Get the shutdown privilege for this process.
::AdjustTokenPrivileges(hToken, FALSE, &tkp, 0,
(PTOKEN_PRIVILEGES)NULL, 0);
// Cannot test the return value of AdjustTokenPrivileges.
bOK = ::GetLastError() == ERROR_SUCCESS;
}
::CloseHandle(hToken);
// Cannot test the return value of AdjustTokenPrivileges.
bOK = ::GetLastError() == ERROR_SUCCESS;
}
::CloseHandle(hToken);
}
if ( bOK )