mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug 913953 - Part x: Remove unused GetUserSidString function; r=ehsan
This commit is contained in:
parent
d476eebff5
commit
98911170b0
@ -163,34 +163,6 @@ bool AddAccessToKernelObject(HANDLE handle, WELL_KNOWN_SID_TYPE known_sid,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetUserSidString(std::wstring* user_sid) {
|
|
||||||
// Get the current token.
|
|
||||||
HANDLE token = NULL;
|
|
||||||
if (!::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &token))
|
|
||||||
return false;
|
|
||||||
ScopedHandle token_scoped(token);
|
|
||||||
|
|
||||||
DWORD size = sizeof(TOKEN_USER) + SECURITY_MAX_SID_SIZE;
|
|
||||||
scoped_ptr<TOKEN_USER> user(reinterpret_cast<TOKEN_USER*>(new BYTE[size]));
|
|
||||||
|
|
||||||
if (!::GetTokenInformation(token, TokenUser, user.get(), size, &size))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!user->User.Sid)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Convert the data to a string.
|
|
||||||
wchar_t* sid_string;
|
|
||||||
if (!::ConvertSidToStringSid(user->User.Sid, &sid_string))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
*user_sid = sid_string;
|
|
||||||
|
|
||||||
::LocalFree(sid_string);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsShiftPressed() {
|
bool IsShiftPressed() {
|
||||||
return (::GetKeyState(VK_SHIFT) & 0x80) == 0x80;
|
return (::GetKeyState(VK_SHIFT) & 0x80) == 0x80;
|
||||||
}
|
}
|
||||||
|
@ -42,9 +42,6 @@ void GetServicePackLevel(int* major, int* minor);
|
|||||||
bool AddAccessToKernelObject(HANDLE handle, WELL_KNOWN_SID_TYPE known_sid,
|
bool AddAccessToKernelObject(HANDLE handle, WELL_KNOWN_SID_TYPE known_sid,
|
||||||
ACCESS_MASK access);
|
ACCESS_MASK access);
|
||||||
|
|
||||||
// Returns the string representing the current user sid.
|
|
||||||
bool GetUserSidString(std::wstring* user_sid);
|
|
||||||
|
|
||||||
// Returns true if the shift key is currently pressed.
|
// Returns true if the shift key is currently pressed.
|
||||||
bool IsShiftPressed();
|
bool IsShiftPressed();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user