Check error code before it is possibly clobbered. Spotted by w3seek.

svn path=/trunk/; revision=13251
This commit is contained in:
Gé van Geldorp 2005-01-24 19:32:40 +00:00
parent c396222f34
commit c011a8410e

View file

@ -146,7 +146,6 @@ _tmain(int argc, TCHAR *argv[])
if (! AdjustTokenPrivileges(hToken, FALSE, &npr, 0, 0, 0)
|| ERROR_SUCCESS != GetLastError())
{
CloseHandle(hToken);
if (ERROR_NOT_ALL_ASSIGNED == GetLastError())
{
_ftprintf(stderr, _T("You are not authorized to shutdown the system\n"));
@ -155,6 +154,7 @@ _tmain(int argc, TCHAR *argv[])
{
_ftprintf(stderr, _T("AdjustTokenPrivileges failed with error %d\n"), (int) GetLastError());
}
CloseHandle(hToken);
exit(1);
}
CloseHandle(hToken);