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.

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