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.

1114 lines
29 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. secedit.h
  5. Abstract:
  6. This module defines the exported data structures and function prototypes
  7. for the security managment utility
  8. Author:
  9. Jin Huang (jinhuang) 28-Oct-1996
  10. Revision History:
  11. --*/
  12. #ifndef _secedit_
  13. #define _secedit_
  14. #ifdef __cplusplus
  15. extern "C"{
  16. #endif
  17. //
  18. // definition for areas
  19. //
  20. #ifndef SCE_AREA_DEFINED
  21. #define SCE_AREA_DEFINED
  22. typedef DWORD AREA_INFORMATION;
  23. #define AREA_SECURITY_POLICY 0x0001L
  24. #define AREA_USER_SETTINGS 0x0002L
  25. #define AREA_GROUP_MEMBERSHIP 0x0004L
  26. #define AREA_PRIVILEGES 0x0008L
  27. #define AREA_DS_OBJECTS 0x0010L
  28. #define AREA_REGISTRY_SECURITY 0x0020L
  29. #define AREA_FILE_SECURITY 0x0040L
  30. #define AREA_SYSTEM_SERVICE 0x0080L
  31. #define AREA_ATTACHMENTS 0x8000L
  32. #define AREA_ALL 0xFFFFL
  33. #endif
  34. //
  35. // Other constants
  36. //
  37. #define AREA_PASSWORD_POLICY 0x0100L
  38. #define AREA_LOCKOUT_POLICY 0x0200L
  39. #define AREA_KERBEROS_POLICY 0x0400L
  40. #define AREA_ACCOUNT_POLICY (AREA_PASSWORD_POLICY | \
  41. AREA_LOCKOUT_POLICY | \
  42. AREA_KERBEROS_POLICY)
  43. #define AREA_AUDIT_POLICY 0x0800L
  44. #define AREA_SECURITY_OPTIONS 0x1000L
  45. #define AREA_LOCAL_POLICY (AREA_AUDIT_POLICY |\
  46. AREA_PRIVILEGES |\
  47. AREA_SECURITY_OPTIONS)
  48. #define AREA_LOG_POLICY 0x2000L
  49. #define SCE_STATUS_CHECK 0
  50. #define SCE_STATUS_IGNORE 1
  51. #define SCE_STATUS_OVERWRITE 2
  52. #define SCE_STATUS_NO_AUTO_INHERIT 4
  53. #define SCE_STATUS_IN 0
  54. #define SCE_STATUS_NOT_IN 1
  55. #define SCE_STATUS_NO_ACL_SUPPORT 3
  56. #define SCE_STATUS_GOOD 0
  57. #define SCE_STATUS_MISMATCH 1
  58. #define SCE_STATUS_CHILDREN_CONFIGURED 2
  59. #define SCE_STATUS_NOT_CONFIGURED 4
  60. #define SCE_STATUS_ERROR_NOT_AVAILABLE 5
  61. #define SCE_STATUS_NEW_SERVICE 6
  62. #define SCE_STATUS_NOT_ANALYZED 7
  63. #define SCE_STATUS_PERMISSION_MISMATCH 0x40
  64. #define SCE_STATUS_AUDIT_MISMATCH 0x80
  65. #define SCE_SETUP_32KEY 0x2000L
  66. #ifndef _WIN64
  67. #define SCE_SETUP_64KEY 0x4000L
  68. #endif // _WIN64
  69. typedef enum _SCE_TYPE {
  70. SCE_ENGINE_SYSTEM=300,
  71. SCE_ENGINE_GPO,
  72. SCE_ENGINE_SCP, // effective table
  73. SCE_ENGINE_SAP, // analysis table
  74. SCE_ENGINE_SCP_INTERNAL,
  75. SCE_ENGINE_SMP_INTERNAL,
  76. SCE_ENGINE_SMP, // local table
  77. SCE_STRUCT_INF,
  78. SCE_STRUCT_PROFILE,
  79. SCE_STRUCT_USER,
  80. SCE_STRUCT_NAME_LIST,
  81. SCE_STRUCT_NAME_STATUS_LIST,
  82. SCE_STRUCT_PRIVILEGE,
  83. SCE_STRUCT_GROUP,
  84. SCE_STRUCT_OBJECT_LIST,
  85. SCE_STRUCT_OBJECT_CHILDREN,
  86. SCE_STRUCT_OBJECT_SECURITY,
  87. SCE_STRUCT_OBJECT_ARRAY,
  88. SCE_STRUCT_ERROR_LOG_INFO,
  89. SCE_STRUCT_SERVICES,
  90. SCE_STRUCT_PRIVILEGE_VALUE_LIST,
  91. SCE_ENGINE_RBK
  92. } SCETYPE;
  93. typedef enum _SCE_FORMAT_TYPE_ {
  94. SCE_INF_FORMAT=1,
  95. SCE_JET_FORMAT,
  96. SCE_JET_ANALYSIS_REQUIRED
  97. } SCE_FORMAT_TYPE, *PSCE_FORMAT_TYPE;
  98. static const WCHAR szMembers[] = L"__Members";
  99. static const WCHAR szMemberof[] = L"__Memberof";
  100. static const WCHAR szPrivileges[] = L"__Privileges";
  101. #define SCE_BUF_LEN 1024
  102. #define SCE_FOREVER_VALUE (DWORD)-1
  103. #define SCE_NO_VALUE (DWORD)-2
  104. #define SCE_KERBEROS_OFF_VALUE (DWORD)-3
  105. #define SCE_DELETE_VALUE (DWORD)-4
  106. #define SCE_SNAPSHOT_VALUE (DWORD)-5
  107. #define SCE_NOT_ANALYZED_VALUE (DWORD)-6
  108. #define SCE_ERROR_VALUE (DWORD)-7
  109. #ifndef _SCE_SHARED_HEADER
  110. #define _SCE_SHARED_HEADER
  111. typedef DWORD SCESTATUS;
  112. #define SCESTATUS_SUCCESS 0L
  113. #define SCESTATUS_INVALID_PARAMETER 1L
  114. #define SCESTATUS_RECORD_NOT_FOUND 2L
  115. #define SCESTATUS_INVALID_DATA 3L
  116. #define SCESTATUS_OBJECT_EXIST 4L
  117. #define SCESTATUS_BUFFER_TOO_SMALL 5L
  118. #define SCESTATUS_PROFILE_NOT_FOUND 6L
  119. #define SCESTATUS_BAD_FORMAT 7L
  120. #define SCESTATUS_NOT_ENOUGH_RESOURCE 8L
  121. #define SCESTATUS_ACCESS_DENIED 9L
  122. #define SCESTATUS_CANT_DELETE 10L
  123. #define SCESTATUS_PREFIX_OVERFLOW 11L
  124. #define SCESTATUS_OTHER_ERROR 12L
  125. #define SCESTATUS_ALREADY_RUNNING 13L
  126. #define SCESTATUS_SERVICE_NOT_SUPPORT 14L
  127. #define SCESTATUS_MOD_NOT_FOUND 15L
  128. #define SCESTATUS_EXCEPTION_IN_SERVER 16L
  129. #define SCESTATUS_NO_TEMPLATE_GIVEN 17L
  130. #define SCESTATUS_NO_MAPPING 18L
  131. #define SCESTATUS_TRUST_FAIL 19L
  132. #define SCESTATUS_JET_DATABASE_ERROR 20L
  133. #define SCESTATUS_TIMEOUT 21L
  134. #define SCESTATUS_PENDING_IGNORE 22L
  135. #define SCESTATUS_SPECIAL_ACCOUNT 23L
  136. //
  137. // defined for services
  138. //
  139. typedef struct _SCESVC_CONFIGURATION_LINE_ {
  140. LPTSTR Key;
  141. LPTSTR Value;
  142. DWORD ValueLen; // number of bytes
  143. } SCESVC_CONFIGURATION_LINE, *PSCESVC_CONFIGURATION_LINE;
  144. typedef struct _SCESVC_CONFIGURATION_INFO_ {
  145. DWORD Count;
  146. PSCESVC_CONFIGURATION_LINE Lines;
  147. } SCESVC_CONFIGURATION_INFO, *PSCESVC_CONFIGURATION_INFO;
  148. typedef PVOID SCE_HANDLE;
  149. typedef ULONG SCE_ENUMERATION_CONTEXT, *PSCE_ENUMERATION_CONTEXT;
  150. #define SCESVC_ENUMERATION_MAX 100L
  151. typedef enum _SCESVC_INFO_TYPE {
  152. SceSvcConfigurationInfo,
  153. SceSvcMergedPolicyInfo,
  154. SceSvcAnalysisInfo,
  155. SceSvcInternalUse // !!!do not use this type!!!
  156. } SCESVC_INFO_TYPE;
  157. // root path for SCE key
  158. #define SCE_ROOT_PATH TEXT("Software\\Microsoft\\Windows NT\\CurrentVersion\\SeCEdit")
  159. #define SCE_ROOT_SERVICE_PATH \
  160. SCE_ROOT_PATH TEXT("\\SvcEngs")
  161. #endif
  162. //
  163. // All section names defined in the SCP/SAP profiles.
  164. //
  165. static const WCHAR szDescription[] = L"Profile Description";
  166. static const WCHAR szAttachments[] = L"Attachment Sections";
  167. static const WCHAR szSystemAccess[] = L"System Access";
  168. static const WCHAR szPrivilegeRights[] = L"Privilege Rights";
  169. static const WCHAR szGroupMembership[] = L"Group Membership";
  170. static const WCHAR szAccountProfiles[] = L"Account Profiles";
  171. static const WCHAR szRegistryKeys[] = L"Registry Keys";
  172. static const WCHAR szFileSecurity[] = L"File Security";
  173. static const WCHAR szDSSecurity[] = L"DS Security";
  174. static const WCHAR szAuditSystemLog[] = L"System Log";
  175. static const WCHAR szAuditSecurityLog[] = L"Security Log";
  176. static const WCHAR szAuditApplicationLog[] = L"Application Log";
  177. static const WCHAR szAuditEvent[] = L"Event Audit";
  178. static const WCHAR szUserList[] = L"User List";
  179. static const WCHAR szServiceGeneral[] = L"Service General Setting";
  180. static const WCHAR szKerberosPolicy[] = L"Kerberos Policy";
  181. static const WCHAR szRegistryValues[] = L"Registry Values";
  182. //
  183. // A list of names (e.g., users, groups, machines, and etc)
  184. //
  185. typedef struct _SCE_NAME_LIST {
  186. PWSTR Name;
  187. struct _SCE_NAME_LIST *Next;
  188. }SCE_NAME_LIST, *PSCE_NAME_LIST;
  189. //
  190. // a list of accounts with privileges held
  191. //
  192. typedef struct _SCE_PRIVILEGE_VALUE_LIST {
  193. PWSTR Name;
  194. DWORD PrivLowPart;
  195. DWORD PrivHighPart;
  196. struct _SCE_PRIVILEGE_VALUE_LIST *Next;
  197. }SCE_PRIVILEGE_VALUE_LIST, *PSCE_PRIVILEGE_VALUE_LIST;
  198. //
  199. // structure for error info
  200. //
  201. typedef struct _SCE_ERROR_LOG_INFO{
  202. PWSTR buffer;
  203. DWORD rc;
  204. struct _SCE_ERROR_LOG_INFO *next;
  205. } SCE_ERROR_LOG_INFO, *PSCE_ERROR_LOG_INFO;
  206. //
  207. // The privileges/rights each user/group holds are saved into a INT field -
  208. // PrivilegeRights. The first bit in this field is the first right defined
  209. // in the SCE_Privileges array as above. The second bit is the second right
  210. // defined in that array, and so on.
  211. //
  212. #define cPrivCnt 39
  213. #define cPrivW2k 34
  214. typedef struct _SCE_PRIVILEGE_ASSIGNMENT {
  215. PWSTR Name;
  216. DWORD Value;
  217. // This value could be translated by SceLookupPrivByValue
  218. // The reason we define another set of privilege values is
  219. // we include both privilege and user rights into one set
  220. // (user rights do not have priv value on NT system).
  221. PSCE_NAME_LIST AssignedTo;
  222. // SCE_STATUS_GOOD
  223. // SCE_STATUS_MISMATCH
  224. // SCE_STATUS_NOT_CONFIGURED
  225. // SCE_DELETE_VALUE indicates that this priv is deleted from local table
  226. DWORD Status;
  227. struct _SCE_PRIVILEGE_ASSIGNMENT *Next;
  228. } SCE_PRIVILEGE_ASSIGNMENT, *PSCE_PRIVILEGE_ASSIGNMENT;
  229. //
  230. // A list of log on hours range
  231. //
  232. typedef struct _SCE_LOGON_HOUR {
  233. DWORD Start;
  234. DWORD End;
  235. struct _SCE_LOGON_HOUR *Next;
  236. }SCE_LOGON_HOUR, *PSCE_LOGON_HOUR;
  237. //
  238. // A list of names (e.g., users, groups, machines, and etc)
  239. // with a status (e.g., disabled )
  240. //
  241. typedef struct _SCE_NAME_STATUS_LIST {
  242. PWSTR Name;
  243. DWORD Status;
  244. struct _SCE_NAME_STATUS_LIST *Next;
  245. }SCE_NAME_STATUS_LIST, *PSCE_NAME_STATUS_LIST;
  246. //
  247. // Structure definition for service list (service dll)
  248. //
  249. #define SCE_STARTUP_BOOT 0x00
  250. #define SCE_STARTUP_SYSTEM 0x01
  251. #define SCE_STARTUP_AUTOMATIC 0x02
  252. #define SCE_STARTUP_MANUAL 0x03
  253. #define SCE_STARTUP_DISABLED 0x04
  254. typedef struct _SCE_SERVICES_ {
  255. PWSTR ServiceName;
  256. PWSTR DisplayName;
  257. BYTE Status;
  258. BYTE Startup;
  259. union {
  260. PSECURITY_DESCRIPTOR pSecurityDescriptor;
  261. PWSTR ServiceEngineName;
  262. } General;
  263. SECURITY_INFORMATION SeInfo;
  264. struct _SCE_SERVICES_ *Next;
  265. }SCE_SERVICES, *PSCE_SERVICES;
  266. //
  267. // Group memberships
  268. //
  269. #define SCE_GROUP_STATUS_MEMBERS_MISMATCH 0x01
  270. #define SCE_GROUP_STATUS_MEMBEROF_MISMATCH 0x02
  271. #define SCE_GROUP_STATUS_NC_MEMBERS 0x04
  272. #define SCE_GROUP_STATUS_NC_MEMBEROF 0x08
  273. #define SCE_GROUP_STATUS_NOT_ANALYZED 0x10
  274. #define SCE_GROUP_STATUS_ERROR_ANALYZED 0x20
  275. typedef struct _SCE_GROUP_MEMBERSHIP {
  276. PWSTR GroupName;
  277. PSCE_NAME_LIST pMembers;
  278. PSCE_NAME_LIST pMemberOf;
  279. DWORD Status;
  280. //
  281. // pPrivilegesHeld is for analysis only.
  282. // The format of each entry in this list is:
  283. // [PrivValue NULL] (directly assigned), or
  284. // [PrivValue Name] (via group "Name")
  285. // To configure privileges, use AREA_PRIVILEGES area
  286. //
  287. // This PrivValue could be translated by SceLookupPrivByValue
  288. // The reason we define another set of privilege values is
  289. // we include both privilege and user rights into one set
  290. // (user rights do not have priv value on NT system).
  291. PSCE_NAME_STATUS_LIST pPrivilegesHeld;
  292. struct _SCE_GROUP_MEMBERSHIP *Next;
  293. }SCE_GROUP_MEMBERSHIP, *PSCE_GROUP_MEMBERSHIP;
  294. //
  295. // Definition of Registry and file security
  296. //
  297. typedef struct _SCE_OBJECT_SECURITY {
  298. PWSTR Name;
  299. BYTE Status;
  300. BOOL IsContainer;
  301. PSECURITY_DESCRIPTOR pSecurityDescriptor;
  302. SECURITY_INFORMATION SeInfo;
  303. // PWSTR SDspec;
  304. // DWORD SDsize;
  305. }SCE_OBJECT_SECURITY, *PSCE_OBJECT_SECURITY;
  306. //
  307. // A list of objects (e.g., files, registry keys, and etc)
  308. //
  309. typedef struct _SCE_OBJECT_LIST {
  310. PWSTR Name;
  311. BYTE Status;
  312. // Status could be the status (mismatched/unknown) of the object
  313. // or, it could be a flag to ignore/check this ojbect
  314. //
  315. BOOL IsContainer;
  316. DWORD Count;
  317. // Total count of mismatched/unknown objects under this object
  318. struct _SCE_OBJECT_LIST *Next;
  319. }SCE_OBJECT_LIST, *PSCE_OBJECT_LIST;
  320. typedef struct _SCE_OBJECT_ARRAY_ {
  321. DWORD Count;
  322. PSCE_OBJECT_SECURITY *pObjectArray;
  323. } SCE_OBJECT_ARRAY, *PSCE_OBJECT_ARRAY;
  324. typedef union _SCE_OBJECTS_ {
  325. // for Jet databases
  326. PSCE_OBJECT_LIST pOneLevel;
  327. // for Inf files
  328. PSCE_OBJECT_ARRAY pAllNodes;
  329. } SCE_OBJECTS, *PSCE_OBJECTS;
  330. typedef struct _SCE_OBJECT_CHILDREN_NODE {
  331. PWSTR Name;
  332. BYTE Status;
  333. BOOL IsContainer;
  334. DWORD Count;
  335. } SCE_OBJECT_CHILDREN_NODE, *PSCE_OBJECT_CHILDREN_NODE;
  336. typedef struct _SCE_OBJECT_CHILDREN {
  337. DWORD nCount;
  338. DWORD MaxCount;
  339. PSCE_OBJECT_CHILDREN_NODE arrObject;
  340. } SCE_OBJECT_CHILDREN, *PSCE_OBJECT_CHILDREN;
  341. typedef struct _SCE_KERBEROS_TICKET_INFO_ {
  342. DWORD MaxTicketAge; // in hours (default 10), SCE_NO_VALUE, SCE_FOREVER_VALUE, no 0
  343. DWORD MaxRenewAge; // in days (default 7), SCE_NO_VALUE, SCE_FOREVER_VALUE, no 0
  344. DWORD MaxServiceAge; // in minutes (default 60), SCE_NO_VALUE, 10-MaxTicketAge
  345. DWORD MaxClockSkew; // in minutes (default 5), SCE_NO_VALUE
  346. // options
  347. DWORD TicketValidateClient; // 0, 1, or SCE_NO_VALUE
  348. //
  349. // all other options are not configurable.
  350. //
  351. } SCE_KERBEROS_TICKET_INFO, *PSCE_KERBEROS_TICKET_INFO;
  352. typedef struct _SCE_REGISTRY_VALUE_INFO_ {
  353. LPTSTR FullValueName;
  354. LPTSTR Value;
  355. DWORD ValueType;
  356. DWORD Status; // match, mismatch, not analyzed, error
  357. } SCE_REGISTRY_VALUE_INFO, *PSCE_REGISTRY_VALUE_INFO;
  358. //
  359. // Profile structure
  360. //
  361. typedef struct _SCE_PROFILE_INFO {
  362. // Type is used to free the structure by SceFreeMemory
  363. SCETYPE Type;
  364. //
  365. // Area: System access
  366. //
  367. DWORD MinimumPasswordAge;
  368. DWORD MaximumPasswordAge;
  369. DWORD MinimumPasswordLength;
  370. DWORD PasswordComplexity;
  371. DWORD PasswordHistorySize;
  372. DWORD LockoutBadCount;
  373. DWORD ResetLockoutCount;
  374. DWORD LockoutDuration;
  375. DWORD RequireLogonToChangePassword;
  376. DWORD ForceLogoffWhenHourExpire;
  377. PWSTR NewAdministratorName;
  378. PWSTR NewGuestName;
  379. DWORD SecureSystemPartition;
  380. DWORD ClearTextPassword;
  381. DWORD LSAAnonymousNameLookup;
  382. union {
  383. struct {
  384. // Area : user settings (scp)
  385. PSCE_NAME_LIST pAccountProfiles;
  386. // Area: privileges
  387. // Name field is the user/group name, Status field is the privilege(s)
  388. // assigned to the user/group
  389. union {
  390. // PSCE_NAME_STATUS_LIST pPrivilegeAssignedTo;
  391. PSCE_PRIVILEGE_VALUE_LIST pPrivilegeAssignedTo;
  392. PSCE_PRIVILEGE_ASSIGNMENT pInfPrivilegeAssignedTo;
  393. } u;
  394. } scp;
  395. struct {
  396. // Area: user settings (sap)
  397. PSCE_NAME_LIST pUserList;
  398. // Area: privileges
  399. PSCE_PRIVILEGE_ASSIGNMENT pPrivilegeAssignedTo;
  400. } sap;
  401. struct {
  402. // Area: user settings (smp)
  403. PSCE_NAME_LIST pUserList;
  404. // Area: privileges
  405. // See sap structure for pPrivilegeAssignedTo
  406. PSCE_PRIVILEGE_ASSIGNMENT pPrivilegeAssignedTo;
  407. } smp;
  408. } OtherInfo;
  409. // Area: group membership
  410. PSCE_GROUP_MEMBERSHIP pGroupMembership;
  411. // Area: Registry
  412. SCE_OBJECTS pRegistryKeys;
  413. // Area: System Services
  414. PSCE_SERVICES pServices;
  415. // System storage
  416. SCE_OBJECTS pFiles;
  417. //
  418. // ds object
  419. //
  420. SCE_OBJECTS pDsObjects;
  421. //
  422. // kerberos policy settings
  423. //
  424. PSCE_KERBEROS_TICKET_INFO pKerberosInfo;
  425. //
  426. // System audit 0-system 1-security 2-application
  427. //
  428. DWORD MaximumLogSize[3];
  429. DWORD AuditLogRetentionPeriod[3];
  430. DWORD RetentionDays[3];
  431. DWORD RestrictGuestAccess[3];
  432. DWORD AuditSystemEvents;
  433. DWORD AuditLogonEvents;
  434. DWORD AuditObjectAccess;
  435. DWORD AuditPrivilegeUse;
  436. DWORD AuditPolicyChange;
  437. DWORD AuditAccountManage;
  438. DWORD AuditProcessTracking;
  439. DWORD AuditDSAccess;
  440. DWORD AuditAccountLogon;
  441. DWORD CrashOnAuditFull;
  442. //
  443. // registry values
  444. //
  445. DWORD RegValueCount;
  446. PSCE_REGISTRY_VALUE_INFO aRegValues;
  447. DWORD EnableAdminAccount;
  448. DWORD EnableGuestAccount;
  449. }SCE_PROFILE_INFO, *PSCE_PROFILE_INFO;
  450. //
  451. // The definition for security user profile which is used to assign common
  452. // user settings to a group of users/groups in the security manager.
  453. //
  454. typedef struct _SCE_USER_PROFILE {
  455. SCETYPE Type;
  456. // Type is used to free the structure by SceFreeMemory
  457. DWORD ForcePasswordChange;
  458. DWORD DisallowPasswordChange;
  459. DWORD NeverExpirePassword;
  460. DWORD AccountDisabled;
  461. PWSTR UserProfile;
  462. PWSTR LogonScript;
  463. PWSTR HomeDir;
  464. PSCE_LOGON_HOUR pLogonHours;
  465. UNICODE_STRING pWorkstations;
  466. PSCE_NAME_LIST pGroupsBelongsTo;
  467. PSCE_NAME_LIST pAssignToUsers;
  468. PSECURITY_DESCRIPTOR pHomeDirSecurity;
  469. SECURITY_INFORMATION HomeSeInfo;
  470. PSECURITY_DESCRIPTOR pTempDirSecurity;
  471. SECURITY_INFORMATION TempSeInfo;
  472. } SCE_USER_PROFILE, *PSCE_USER_PROFILE;
  473. //
  474. // The definition for each user's setting
  475. //
  476. typedef struct _SCE_USER_SETTING {
  477. SCETYPE Type;
  478. // Type is used to free the structure by SceFreeMemory
  479. DWORD ForcePasswordChange;
  480. DWORD DisallowPasswordChange;
  481. DWORD NeverExpirePassword;
  482. DWORD AccountDisabled;
  483. PSCE_NAME_LIST pGroupsBelongsTo;
  484. PWSTR UserProfile;
  485. PSECURITY_DESCRIPTOR pProfileSecurity;
  486. PWSTR LogonScript;
  487. PSECURITY_DESCRIPTOR pLogonScriptSecurity;
  488. PWSTR HomeDir;
  489. PSECURITY_DESCRIPTOR pHomeDirSecurity;
  490. SECURITY_INFORMATION HomeDirSeInfo;
  491. PWSTR TempDir;
  492. PSECURITY_DESCRIPTOR pTempDirSecurity;
  493. SECURITY_INFORMATION TempDirSeInfo;
  494. PSCE_LOGON_HOUR pLogonHours;
  495. UNICODE_STRING pWorkstations;
  496. PSCE_NAME_STATUS_LIST pPrivilegesHeld;
  497. DWORD BadPasswordAttempt;
  498. } SCE_USER_SETTING, *PSCE_USER_SETTING;
  499. //
  500. // prototypes defined in sceclnt.cpp
  501. //
  502. SCESTATUS
  503. WINAPI
  504. SceGetSecurityProfileInfo(
  505. IN PVOID hProfile OPTIONAL,
  506. IN SCETYPE ProfileType,
  507. IN AREA_INFORMATION Area,
  508. IN OUT PSCE_PROFILE_INFO *ppInfoBuffer,
  509. OUT PSCE_ERROR_LOG_INFO *Errlog OPTIONAL
  510. );
  511. SCESTATUS
  512. WINAPI
  513. SceGetObjectChildren(
  514. IN PVOID hProfile,
  515. IN SCETYPE ProfileType,
  516. IN AREA_INFORMATION Area,
  517. IN PWSTR ObjectPrefix,
  518. OUT PSCE_OBJECT_CHILDREN *Buffer,
  519. OUT PSCE_ERROR_LOG_INFO *Errlog OPTIONAL
  520. );
  521. SCESTATUS
  522. WINAPI
  523. SceOpenProfile(
  524. IN PCWSTR ProfileName,
  525. IN SCE_FORMAT_TYPE ProfileFormat,
  526. OUT PVOID *hProfile
  527. );
  528. SCESTATUS
  529. WINAPI
  530. SceCloseProfile(
  531. IN PVOID *hProfile
  532. );
  533. SCESTATUS
  534. WINAPI
  535. SceGetScpProfileDescription(
  536. IN PVOID hProfile,
  537. OUT PWSTR *Description
  538. );
  539. SCESTATUS
  540. WINAPI
  541. SceGetTimeStamp(
  542. IN PVOID hProfile,
  543. OUT PWSTR *ConfigTimeStamp,
  544. OUT PWSTR *AnalyzeTimeStamp
  545. );
  546. SCESTATUS
  547. WINAPI
  548. SceGetDbTime(
  549. IN PVOID hProfile,
  550. OUT SYSTEMTIME *ConfigTime,
  551. OUT SYSTEMTIME *AnalyzeTime
  552. );
  553. SCESTATUS
  554. WINAPI
  555. SceGetObjectSecurity(
  556. IN PVOID hProfile,
  557. IN SCETYPE ProfileType,
  558. IN AREA_INFORMATION Area,
  559. IN PWSTR ObjectName,
  560. OUT PSCE_OBJECT_SECURITY *ObjSecurity
  561. );
  562. SCESTATUS
  563. WINAPI
  564. SceGetAnalysisAreaSummary(
  565. IN PVOID hProfile,
  566. IN AREA_INFORMATION Area,
  567. OUT PDWORD pCount
  568. );
  569. SCESTATUS
  570. WINAPI
  571. SceCopyBaseProfile(
  572. IN PVOID hProfile,
  573. IN SCETYPE ProfileType,
  574. IN PWSTR InfFileName,
  575. IN AREA_INFORMATION Area,
  576. OUT PSCE_ERROR_LOG_INFO *pErrlog OPTIONAL
  577. );
  578. #define SCE_OVERWRITE_DB 0x01L
  579. #define SCE_UPDATE_DB 0x02L
  580. #define SCE_CALLBACK_DELTA 0x04L
  581. #define SCE_CALLBACK_TOTAL 0x08L
  582. #define SCE_VERBOSE_LOG 0x10L
  583. #define SCE_DISABLE_LOG 0x20L
  584. #define SCE_NO_CONFIG 0x40L
  585. #define SCE_DEBUG_LOG 0x80L
  586. typedef
  587. BOOL(CALLBACK *PSCE_AREA_CALLBACK_ROUTINE)(
  588. IN HANDLE CallbackHandle,
  589. IN AREA_INFORMATION Area,
  590. IN DWORD TotalTicks,
  591. IN DWORD CurrentTicks
  592. );
  593. typedef
  594. BOOL(CALLBACK *PSCE_BROWSE_CALLBACK_ROUTINE)(
  595. IN LONG GpoID,
  596. IN PWSTR KeyName OPTIONAL,
  597. IN PWSTR GpoName OPTIONAL,
  598. IN PWSTR Value OPTIONAL,
  599. IN DWORD Len
  600. );
  601. SCESTATUS
  602. WINAPI
  603. SceConfigureSystem(
  604. IN LPTSTR SystemName OPTIONAL,
  605. IN PCWSTR InfFileName OPTIONAL,
  606. IN PCWSTR DatabaseName,
  607. IN PCWSTR LogFileName OPTIONAL,
  608. IN DWORD ConfigOptions,
  609. IN AREA_INFORMATION Area,
  610. IN PSCE_AREA_CALLBACK_ROUTINE pCallback OPTIONAL,
  611. IN HANDLE hCallbackWnd OPTIONAL,
  612. OUT PDWORD pdWarning OPTIONAL
  613. );
  614. SCESTATUS
  615. WINAPI
  616. SceAnalyzeSystem(
  617. IN LPTSTR SystemName OPTIONAL,
  618. IN PCWSTR InfFileName OPTIONAL,
  619. IN PCWSTR DatabaseName,
  620. IN PCWSTR LogFileName OPTIONAL,
  621. IN DWORD AnalyzeOptions,
  622. IN AREA_INFORMATION Area,
  623. IN PSCE_AREA_CALLBACK_ROUTINE pCallback OPTIONAL,
  624. IN HANDLE hCallbackWnd OPTIONAL,
  625. OUT PDWORD pdWarning OPTIONAL
  626. );
  627. SCESTATUS
  628. WINAPI
  629. SceGenerateRollback(
  630. IN LPTSTR SystemName OPTIONAL,
  631. IN PCWSTR InfFileName,
  632. IN PCWSTR InfRollback,
  633. IN PCWSTR LogFileName OPTIONAL,
  634. IN DWORD Options,
  635. IN AREA_INFORMATION Area,
  636. OUT PDWORD pdWarning OPTIONAL
  637. );
  638. #define SCE_UPDATE_LOCAL_POLICY 0x1L
  639. #define SCE_UPDATE_DIRTY_ONLY 0x2L
  640. #define SCE_UPDATE_SYSTEM 0x4L
  641. SCESTATUS
  642. WINAPI
  643. SceUpdateSecurityProfile(
  644. IN PVOID hProfile OPTIONAL,
  645. IN AREA_INFORMATION Area,
  646. IN PSCE_PROFILE_INFO pInfo,
  647. IN DWORD dwMode
  648. );
  649. SCESTATUS
  650. WINAPI
  651. SceUpdateObjectInfo(
  652. IN PVOID hProfile,
  653. IN AREA_INFORMATION Area,
  654. IN PWSTR ObjectName,
  655. IN DWORD NameLen, // number of characters
  656. IN BYTE ConfigStatus,
  657. IN BOOL IsContainer,
  658. IN PSECURITY_DESCRIPTOR pSD,
  659. IN SECURITY_INFORMATION SeInfo,
  660. OUT PBYTE pAnalysisStatus
  661. );
  662. SCESTATUS
  663. WINAPI
  664. SceStartTransaction(
  665. IN PVOID cxtProfile
  666. );
  667. SCESTATUS
  668. WINAPI
  669. SceCommitTransaction(
  670. IN PVOID cxtProfile
  671. );
  672. SCESTATUS
  673. WINAPI
  674. SceRollbackTransaction(
  675. IN PVOID cxtProfile
  676. );
  677. typedef enum _SCE_SERVER_TYPE_ {
  678. SCESVR_UNKNOWN = 0,
  679. SCESVR_DC_WITH_DS,
  680. SCESVR_DC,
  681. SCESVR_NT5_SERVER,
  682. SCESVR_NT4_SERVER,
  683. SCESVR_NT5_WKS,
  684. SCESVR_NT4_WKS
  685. } SCE_SERVER_TYPE, *PSCE_SERVER_TYPE;
  686. SCESTATUS
  687. WINAPI
  688. SceGetServerProductType(
  689. IN LPTSTR SystemName OPTIONAL,
  690. OUT PSCE_SERVER_TYPE pServerType
  691. );
  692. SCESTATUS
  693. WINAPI
  694. SceLookupPrivRightName(
  695. IN INT Priv,
  696. OUT PWSTR Name,
  697. OUT PINT NameLen
  698. );
  699. SCESTATUS
  700. WINAPI
  701. SceSvcUpdateInfo(
  702. IN PVOID hProfile,
  703. IN PCWSTR ServiceName,
  704. IN PSCESVC_CONFIGURATION_INFO Info
  705. );
  706. //
  707. // prototype defined in infget.c
  708. //
  709. SCESTATUS
  710. WINAPI
  711. SceSvcGetInformationTemplate(
  712. IN LPCTSTR TemplateName,
  713. IN LPCTSTR ServiceName,
  714. IN LPCTSTR Key OPTIONAL,
  715. OUT PSCESVC_CONFIGURATION_INFO *ServiceInfo
  716. );
  717. //
  718. // prototypes defined in infwrite.c
  719. //
  720. SCESTATUS
  721. WINAPI
  722. SceWriteSecurityProfileInfo(
  723. IN PCWSTR InfProfileName,
  724. IN AREA_INFORMATION Area,
  725. IN PSCE_PROFILE_INFO ppInfoBuffer,
  726. OUT PSCE_ERROR_LOG_INFO *Errlog OPTIONAL
  727. );
  728. SCESTATUS
  729. WINAPI
  730. SceAppendSecurityProfileInfo(
  731. IN PCWSTR InfProfileName,
  732. IN AREA_INFORMATION Area,
  733. IN PSCE_PROFILE_INFO ppInfoBuffer,
  734. OUT PSCE_ERROR_LOG_INFO *Errlog OPTIONAL
  735. );
  736. SCESTATUS
  737. WINAPI
  738. SceSvcSetInformationTemplate(
  739. IN LPCTSTR TemplateName,
  740. IN LPCTSTR ServiceName,
  741. IN BOOL bExact,
  742. IN PSCESVC_CONFIGURATION_INFO ServiceInfo
  743. );
  744. //
  745. // prototypes defined in common.cpp
  746. //
  747. SCESTATUS
  748. WINAPI
  749. SceFreeMemory(
  750. IN PVOID smInfo,
  751. IN DWORD Category
  752. );
  753. BOOL
  754. WINAPI
  755. SceCompareNameList(
  756. IN PSCE_NAME_LIST pList1,
  757. IN PSCE_NAME_LIST pList2
  758. );
  759. SCESTATUS
  760. WINAPI
  761. SceCompareSecurityDescriptors(
  762. IN AREA_INFORMATION Area,
  763. IN PSECURITY_DESCRIPTOR pSD1,
  764. IN PSECURITY_DESCRIPTOR pSD2,
  765. IN SECURITY_INFORMATION SeInfo,
  766. OUT PBOOL IsDifferent
  767. );
  768. SCESTATUS
  769. WINAPI
  770. SceCreateDirectory(
  771. IN PCWSTR ProfileLocation,
  772. IN BOOL FileOrDir,
  773. PSECURITY_DESCRIPTOR pSecurityDescriptor
  774. );
  775. SCESTATUS
  776. WINAPI
  777. SceFreeProfileMemory(
  778. PSCE_PROFILE_INFO pProfile
  779. );
  780. SCESTATUS
  781. WINAPI
  782. SceAddToNameStatusList(
  783. IN OUT PSCE_NAME_STATUS_LIST *pNameStatusList,
  784. IN PWSTR Name,
  785. IN ULONG Len,
  786. IN DWORD Status
  787. );
  788. SCESTATUS
  789. WINAPI
  790. SceAddToNameList(
  791. IN OUT PSCE_NAME_LIST *pNameList,
  792. IN PWSTR Name,
  793. IN ULONG Len
  794. );
  795. #define SCE_CHECK_DUP 0x01
  796. #define SCE_INCREASE_COUNT 0x02
  797. SCESTATUS
  798. WINAPI
  799. SceAddToObjectList(
  800. IN OUT PSCE_OBJECT_LIST *pObjectList,
  801. IN PWSTR Name,
  802. IN ULONG Len,
  803. IN BOOL IsContainer,
  804. IN BYTE Status,
  805. IN BYTE byFlags
  806. );
  807. DWORD
  808. WINAPI
  809. SceEnumerateServices(
  810. OUT PSCE_SERVICES *pServiceList,
  811. IN BOOL bServiceNameOnly
  812. );
  813. DWORD
  814. WINAPI
  815. SceSetupGenerateTemplate(
  816. IN LPTSTR SystemName OPTIONAL,
  817. IN LPTSTR JetDbName OPTIONAL,
  818. IN BOOL bFromMergedTable,
  819. IN LPTSTR InfTemplateName,
  820. IN LPTSTR LogFileName OPTIONAL,
  821. IN AREA_INFORMATION Area
  822. );
  823. #define SCE_REG_DISPLAY_NAME TEXT("DisplayName")
  824. #define SCE_REG_DISPLAY_TYPE TEXT("DisplayType")
  825. #define SCE_REG_VALUE_TYPE TEXT("ValueType")
  826. #define SCE_REG_DISPLAY_UNIT TEXT("DisplayUnit")
  827. #define SCE_REG_DISPLAY_CHOICES TEXT("DisplayChoices")
  828. #define SCE_REG_DISPLAY_FLAGLIST TEXT("DisplayFlags")
  829. #define SCE_REG_DISPLAY_ENABLE 0
  830. #define SCE_REG_DISPLAY_NUMBER 1
  831. #define SCE_REG_DISPLAY_STRING 2
  832. #define SCE_REG_DISPLAY_CHOICE 3
  833. #define SCE_REG_DISPLAY_MULTISZ 4
  834. #define SCE_REG_DISPLAY_FLAGS 5
  835. DWORD
  836. WINAPI
  837. SceRegisterRegValues(
  838. IN LPTSTR InfFileName
  839. );
  840. //
  841. // for service attachments
  842. //
  843. SCESTATUS
  844. WINAPI
  845. SceSvcQueryInfo(
  846. IN SCE_HANDLE sceHandle,
  847. IN SCESVC_INFO_TYPE sceType,
  848. IN LPTSTR lpPrefix OPTIONAL,
  849. IN BOOL bExact,
  850. OUT PVOID *ppvInfo,
  851. OUT PSCE_ENUMERATION_CONTEXT psceEnumHandle
  852. );
  853. SCESTATUS
  854. WINAPI
  855. SceSvcSetInfo(
  856. IN SCE_HANDLE sceHandle,
  857. IN SCESVC_INFO_TYPE sceType,
  858. IN LPTSTR lpPrefix OPTIONAL,
  859. IN BOOL bExact,
  860. IN PVOID pvInfo
  861. );
  862. SCESTATUS
  863. WINAPI
  864. SceSvcFree(
  865. IN PVOID pvServiceInfo
  866. );
  867. SCESTATUS
  868. WINAPI
  869. SceSvcConvertTextToSD (
  870. IN PWSTR pwszTextSD,
  871. OUT PSECURITY_DESCRIPTOR *ppSD,
  872. OUT PULONG pulSDSize,
  873. OUT PSECURITY_INFORMATION psiSeInfo
  874. );
  875. SCESTATUS
  876. WINAPI
  877. SceSvcConvertSDToText (
  878. IN PSECURITY_DESCRIPTOR pSD,
  879. IN SECURITY_INFORMATION siSecurityInfo,
  880. OUT PWSTR *ppwszTextSD,
  881. OUT PULONG pulTextSize
  882. );
  883. //
  884. // check service.cpp if the following constants are changed because
  885. // it has a buffer length dependency
  886. //
  887. #define SCE_ROOT_POLICY_PATH \
  888. SCE_ROOT_PATH TEXT("\\Policies")
  889. #define SCE_ROOT_REGVALUE_PATH \
  890. SCE_ROOT_PATH TEXT("\\Reg Values")
  891. // define for GPT integration
  892. #define GPTSCE_PATH TEXT("Software\\Policies\\Microsoft\\Windows NT\\SecEdit")
  893. #define GPTSCE_PERIOD_NAME TEXT("ConfigurePeriod")
  894. #define GPTSCE_TEMPLATE TEXT("Microsoft\\Windows NT\\SecEdit\\GptTmpl.inf")
  895. AREA_INFORMATION
  896. SceGetAreas(
  897. LPTSTR InfName
  898. );
  899. BOOL
  900. SceIsSystemDatabase(
  901. IN LPCTSTR DatabaseName
  902. );
  903. SCESTATUS
  904. SceBrowseDatabaseTable(
  905. IN PWSTR DatabaseName OPTIONAL,
  906. IN SCETYPE ProfileType,
  907. IN AREA_INFORMATION Area,
  908. IN BOOL bDomainPolicyOnly,
  909. IN PSCE_BROWSE_CALLBACK_ROUTINE pCallback OPTIONAL
  910. );
  911. SCESTATUS
  912. WINAPI
  913. SceGetDatabaseSetting(
  914. IN PVOID hProfile,
  915. IN SCETYPE ProfileType,
  916. IN PWSTR SectionName,
  917. IN PWSTR KeyName,
  918. OUT PWSTR *Value,
  919. OUT DWORD *pnBytes OPTIONAL
  920. );
  921. SCESTATUS
  922. WINAPI
  923. SceSetDatabaseSetting(
  924. IN PVOID hProfile,
  925. IN SCETYPE ProfileType,
  926. IN PWSTR SectionName,
  927. IN PWSTR KeyName,
  928. IN PWSTR Value OPTIONAL,
  929. IN DWORD nBytes
  930. );
  931. #ifdef __cplusplus
  932. }
  933. #endif
  934. #endif