Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.1 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. ForceAdminAccess.cpp
  5. Abstract:
  6. Pretend the token is a member. Typically used to see if we have
  7. administrator access...
  8. Notes:
  9. This is a general purpose shim.
  10. History:
  11. 12/07/2000 linstev Created
  12. --*/
  13. #include "precomp.h"
  14. IMPLEMENT_SHIM_BEGIN(ForceAdminAccess)
  15. #include "ShimHookMacro.h"
  16. APIHOOK_ENUM_BEGIN
  17. APIHOOK_ENUM_ENTRY(CheckTokenMembership)
  18. APIHOOK_ENUM_END
  19. /*++
  20. Pretend the token is a member.
  21. --*/
  22. BOOL
  23. APIHOOK(CheckTokenMembership)(
  24. HANDLE TokenHandle, // handle to an access token
  25. PSID SidToCheck, // SID to check for
  26. PBOOL IsMember // receives results of the check
  27. )
  28. {
  29. BOOL bRet = ORIGINAL_API(CheckTokenMembership)(
  30. TokenHandle, SidToCheck, IsMember);
  31. if (bRet && IsMember)
  32. {
  33. *IsMember = TRUE;
  34. }
  35. return bRet;
  36. }
  37. /*++
  38. Register hooked functions
  39. --*/
  40. HOOK_BEGIN
  41. APIHOOK_ENTRY(USER32.DLL, CheckTokenMembership)
  42. HOOK_END
  43. IMPLEMENT_SHIM_END