mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[SHELL32][SDK] Implement SHTestTokenPrivilegeW (#5725)
and modify shell32.spec.
This commit is contained in:
parent
1b3eed58ca
commit
d1e9fe13de
4 changed files with 65 additions and 12 deletions
|
@ -232,7 +232,7 @@
|
|||
233 stdcall -noname SHGetUserPicturePathW(wstr long ptr)
|
||||
234 stdcall -noname SHSetUserPicturePathW(wstr long ptr)
|
||||
235 stdcall -noname SHOpenEffectiveToken(ptr)
|
||||
236 stdcall -noname SHTestTokenPrivilegeW(ptr ptr)
|
||||
236 stdcall -noname SHTestTokenPrivilegeW(ptr wstr)
|
||||
237 stdcall -noname SHShouldShowWizards(ptr)
|
||||
238 stdcall InternalExtractIconListW(ptr wstr ptr)
|
||||
239 stdcall PathIsSlowW(wstr long)
|
||||
|
|
|
@ -1099,17 +1099,6 @@ SHSetUserPicturePathW(LPCWSTR lpPath, int csidl, LPVOID lpUnknown)
|
|||
return E_FAIL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unimplemented
|
||||
*/
|
||||
EXTERN_C BOOL
|
||||
WINAPI
|
||||
SHTestTokenPrivilegeW(HANDLE hToken, LPDWORD ReturnLength)
|
||||
{
|
||||
FIXME("SHTestTokenPrivilegeW() stub\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unimplemented
|
||||
*/
|
||||
|
|
|
@ -103,6 +103,67 @@ SHInvokePrivilegedFunctionW(
|
|||
return hr;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* SHTestTokenPrivilegeW (SHELL32.236)
|
||||
*
|
||||
* @see http://undoc.airesoft.co.uk/shell32.dll/SHTestTokenPrivilegeW.php
|
||||
*/
|
||||
EXTERN_C
|
||||
BOOL WINAPI
|
||||
SHTestTokenPrivilegeW(_In_opt_ HANDLE hToken, _In_z_ LPCWSTR lpName)
|
||||
{
|
||||
LUID Luid;
|
||||
DWORD dwLength;
|
||||
PTOKEN_PRIVILEGES pTokenPriv;
|
||||
HANDLE hNewToken = NULL;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
TRACE("(%p, %s)\n", hToken, debugstr_w(lpName));
|
||||
|
||||
if (!lpName)
|
||||
return FALSE;
|
||||
|
||||
if (!hToken)
|
||||
{
|
||||
if (!SHOpenEffectiveToken(&hNewToken))
|
||||
goto Quit;
|
||||
|
||||
if (!hNewToken)
|
||||
return FALSE;
|
||||
|
||||
hToken = hNewToken;
|
||||
}
|
||||
|
||||
if (!LookupPrivilegeValueW(NULL, lpName, &Luid))
|
||||
return FALSE;
|
||||
|
||||
dwLength = 0;
|
||||
if (!GetTokenInformation(hToken, TokenPrivileges, NULL, 0, &dwLength))
|
||||
goto Quit;
|
||||
|
||||
pTokenPriv = (PTOKEN_PRIVILEGES)LocalAlloc(LPTR, dwLength);
|
||||
if (!pTokenPriv)
|
||||
goto Quit;
|
||||
|
||||
if (GetTokenInformation(hToken, TokenPrivileges, pTokenPriv, dwLength, &dwLength))
|
||||
{
|
||||
UINT iPriv, cPrivs;
|
||||
cPrivs = pTokenPriv->PrivilegeCount;
|
||||
for (iPriv = 0; !ret && iPriv < cPrivs; ++iPriv)
|
||||
{
|
||||
ret = RtlEqualLuid(&Luid, &pTokenPriv->Privileges[iPriv].Luid);
|
||||
}
|
||||
}
|
||||
|
||||
LocalFree(pTokenPriv);
|
||||
|
||||
Quit:
|
||||
if (hToken == hNewToken)
|
||||
CloseHandle(hNewToken);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* SHGetShellStyleHInstance (SHELL32.749)
|
||||
*/
|
||||
|
|
|
@ -695,6 +695,9 @@ SHInvokePrivilegedFunctionW(
|
|||
_In_ PRIVILEGED_FUNCTION fn,
|
||||
_In_opt_ LPARAM lParam);
|
||||
|
||||
BOOL WINAPI
|
||||
SHTestTokenPrivilegeW(_In_opt_ HANDLE hToken, _In_z_ LPCWSTR lpName);
|
||||
|
||||
/*****************************************************************************
|
||||
* Shell32 resources
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue