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.

102 lines
2.4 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. HrAllocateSecurityDescriptorAllowAccessToWorld (
  49. OUT PSECURITY_DESCRIPTOR* ppSd);
  50. HRESULT
  51. HrEnablePrivilege (
  52. IN PCWSTR pszPrivilegeName);
  53. HRESULT
  54. HrEnableAllPrivileges (
  55. OUT TOKEN_PRIVILEGES** pptpOld);
  56. HRESULT
  57. HrRestorePrivileges (
  58. IN TOKEN_PRIVILEGES* ptpRestore);
  59. // FHasPermission flags are defined in netconp.idl/.h
  60. //
  61. BOOL
  62. FHasPermission(
  63. IN ULONG ulPermMask,
  64. IN /*const*/ CGroupPolicyBase* pGPBase = NULL);
  65. BOOL
  66. FHasPermissionFromCache(
  67. IN ULONG ulPermMask);
  68. VOID
  69. RefreshAllPermission();
  70. BOOL
  71. FProhibitFromAdmins();
  72. BOOL
  73. IsHNetAllowed(
  74. IN DWORD dwPerm
  75. );
  76. BOOL
  77. FIsPolicyConfigured(
  78. IN DWORD ulPerm);
  79. BOOL
  80. IsSameNetworkAsGroupPolicies();
  81. #endif // _NCPERMS_H_