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.

88 lines
1.8 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. ChangeAuthenticationLevel.cpp
  5. Abstract:
  6. Sets the dwAuthnLevel for CoInitializeSecurity() to RPC_C_AUTHN_LEVEL_CONNECT.
  7. This fixes problems associated with a change with Windows 2000 and above where
  8. RPC_C_AUTHN_LEVEL_NONE is nolonger promoted for local calls to PRIVACY.
  9. Notes:
  10. Only needed where app sets level to RPC_C_AUTHN_LEVEL_NONE.
  11. History:
  12. 07/19/2000 jpipkins Created
  13. --*/
  14. #include "precomp.h"
  15. IMPLEMENT_SHIM_BEGIN(ChangeAuthenticationLevel)
  16. #include "ShimHookMacro.h"
  17. APIHOOK_ENUM_BEGIN
  18. APIHOOK_ENUM_ENTRY(CoInitializeSecurity)
  19. APIHOOK_ENUM_END
  20. /*++
  21. Adjust security level.
  22. --*/
  23. HRESULT
  24. APIHOOK(CoInitializeSecurity)(
  25. PSECURITY_DESCRIPTOR pVoid,
  26. LONG cAuthSvc,
  27. SOLE_AUTHENTICATION_SERVICE *asAuthSvc,
  28. void *pReserved1,
  29. DWORD dwAuthnLevel,
  30. DWORD dwImpLevel,
  31. SOLE_AUTHENTICATION_LIST *pAuthList,
  32. DWORD dwCapabilities,
  33. void *pReserved3
  34. )
  35. {
  36. HRESULT hResult;
  37. DPFN( eDbgLevelInfo, "CoInitializeSecurity called");
  38. if (RPC_C_AUTHN_LEVEL_NONE == dwAuthnLevel)
  39. {
  40. LOGN( eDbgLevelWarning, "[APIHook_CoInitializeSecurity] Increasing authentication level");
  41. dwAuthnLevel = RPC_C_AUTHN_LEVEL_CONNECT;
  42. }
  43. hResult = ORIGINAL_API(CoInitializeSecurity)(
  44. pVoid,
  45. cAuthSvc,
  46. asAuthSvc,
  47. pReserved1,
  48. dwAuthnLevel,
  49. dwImpLevel,
  50. pAuthList,
  51. dwCapabilities,
  52. pReserved3);
  53. return hResult;
  54. }
  55. /*++
  56. Register hooked functions
  57. --*/
  58. HOOK_BEGIN
  59. APIHOOK_ENTRY(OLE32.DLL, CoInitializeSecurity)
  60. HOOK_END
  61. IMPLEMENT_SHIM_END