Source code of Windows XP (NT5)
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.

105 lines
2.3 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: N C P E R M S . H
  7. //
  8. // Contents: Common routines for dealing with permissions.
  9. //
  10. // Notes: Pollute this under penalty of death.
  11. //
  12. // Author: shaunco 10 Oct 1997
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #ifndef _NCPERMS_H_
  17. #define _NCPERMS_H_
  18. #include "ncdefine.h" // for NOTHROW
  19. #include "gpbase.h"
  20. #ifdef DBG
  21. extern DWORD g_dwDbgPermissionsFail; // Debug flag to force permissions to fail
  22. #endif
  23. // Apply Masks
  24. typedef enum tagNCPERM_APPLY_TO
  25. {
  26. APPLY_TO_ADMIN = 0x00000001,
  27. APPLY_TO_NETCONFIGOPS = 0x00000002,
  28. APPLY_TO_POWERUSERS = 0x00000004,
  29. APPLY_TO_USER = 0x00000008,
  30. APPLY_TO_GUEST = 0x00000010,
  31. APPLY_TO_LOCATION = 0x00010000,
  32. APPLY_TO_ALL_USERS = APPLY_TO_ADMIN | APPLY_TO_NETCONFIGOPS | APPLY_TO_POWERUSERS | APPLY_TO_USER,
  33. APPLY_TO_OPS_OR_ADMIN = APPLY_TO_ADMIN | APPLY_TO_NETCONFIGOPS,
  34. APPLY_TO_NON_ADMINS = APPLY_TO_NETCONFIGOPS | APPLY_TO_USER | APPLY_TO_POWERUSERS,
  35. APPLY_TO_POWERUSERSPLUS = APPLY_TO_POWERUSERS | APPLY_TO_NETCONFIGOPS | APPLY_TO_ADMIN,
  36. APPLY_TO_EVERYBODY = APPLY_TO_ALL_USERS | APPLY_TO_GUEST,
  37. APPLY_TO_ALL = APPLY_TO_ADMIN | APPLY_TO_NETCONFIGOPS | APPLY_TO_POWERUSERS | APPLY_TO_USER | APPLY_TO_LOCATION
  38. } NCPERM_APPLY_TO;
  39. BOOL
  40. FIsUserAdmin ();
  41. BOOL
  42. FIsUserNetworkConfigOps ();
  43. BOOL
  44. FIsUserPowerUser();
  45. BOOL
  46. FIsUserGuest();
  47. HRESULT
  48. HrSetPermissionsOnTcpIpRegKeys (BOOL bAllowPermission);
  49. HRESULT
  50. HrAllocateSecurityDescriptorAllowAccessToWorld (
  51. PSECURITY_DESCRIPTOR* ppSd);
  52. HRESULT
  53. HrEnablePrivilege (
  54. PCWSTR pszPrivilegeName);
  55. HRESULT
  56. HrEnableAllPrivileges (
  57. TOKEN_PRIVILEGES** pptpOld);
  58. HRESULT
  59. HrRestorePrivileges (
  60. TOKEN_PRIVILEGES* ptpRestore);
  61. // FHasPermission flags are defined in netconp.idl/.h
  62. //
  63. BOOL
  64. FHasPermission(
  65. ULONG ulPermMask,
  66. CGroupPolicyBase* pGPBase = NULL);
  67. BOOL
  68. FHasPermissionFromCache(
  69. ULONG ulPermMask);
  70. VOID
  71. RefreshAllPermission();
  72. BOOL
  73. FProhibitFromAdmins();
  74. BOOL
  75. IsHNetAllowed(
  76. DWORD dwPerm
  77. );
  78. BOOL
  79. FIsPolicyConfigured(
  80. DWORD ulPerm);
  81. BOOL
  82. IsSameNetworkAsGroupPolicies();
  83. #endif // _NCPERMS_H_