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.

294 lines
8.6 KiB

  1. #ifndef _sceExts_h_
  2. #define _sceExts_h_
  3. #include <nt.h>
  4. #include <ntrtl.h>
  5. #include <nturtl.h>
  6. #include <windows.h>
  7. #include <ntsdexts.h>
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10. #include <string.h>
  11. #include <malloc.h>
  12. #include <time.h>
  13. #include <tstr.h>
  14. #include "secedit.h"
  15. typedef enum _SECURITY_DB_TYPE {
  16. SecurityDbSam = 1,
  17. SecurityDbLsa
  18. } SECURITY_DB_TYPE, *PSECURITY_DB_TYPE;
  19. typedef struct _WELL_KNOWN_NAME_LOOKUP {
  20. PWSTR StrSid;
  21. WCHAR Name[36];
  22. } WELL_KNOWN_NAME_LOOKUP, *PWELL_KNOWN_NAME_LOOKUP;
  23. #define NAME_TABLE_SIZE 31
  24. #include <ntseapi.h>
  25. #include <ntlsa.h>
  26. #include <ntsam.h>
  27. #include <winldap.h>
  28. #include <aclapi.h>
  29. #include <dsrole.h>
  30. #include "splay.h"
  31. #include "..\server\queue.h"
  32. #include "..\server\scejetp.h"
  33. #include "..\server\scep.h"
  34. typedef struct _SCESRV_CONTEXT_LIST_ {
  35. PSCECONTEXT Context;
  36. struct _SCESRV_CONTEXT_LIST_ *Next;
  37. struct _SCESRV_CONTEXT_LIST_ *Prior;
  38. } SCESRV_CONTEXT_LIST;
  39. typedef struct _SCESRV_DBTASK_ {
  40. PSCECONTEXT Context;
  41. CRITICAL_SECTION Sync;
  42. DWORD dInUsed;
  43. BOOL bCloseReq;
  44. struct _SCESRV_DBTASK_ *Next;
  45. struct _SCESRV_DBTASK_ *Prior;
  46. } SCESRV_DBTASK;
  47. typedef struct _SCESRV_ENGINE_ {
  48. LPTSTR Database;
  49. struct _SCESRV_ENGINE_ *Next;
  50. struct _SCESRV_ENGINE_ *Prior;
  51. } SCESRV_ENGINE;
  52. typedef struct _SCEP_NOTIFYARGS_NODE {
  53. LIST_ENTRY List;
  54. SECURITY_DB_TYPE DbType;
  55. SECURITY_DB_DELTA_TYPE DeltaType;
  56. SECURITY_DB_OBJECT_TYPE ObjectType;
  57. PSID ObjectSid;
  58. } SCEP_NOTIFYARGS_NODE;
  59. #define SCEP_ADL_HTABLE_SIZE 256
  60. typedef struct _SCEP_ADL_NODE_ {
  61. PISID pSid;
  62. GUID *pGuidObjectType;
  63. GUID *pGuidInheritedObjectType;
  64. UCHAR AceType;
  65. DWORD dwEffectiveMask;
  66. DWORD dw_CI_IO_Mask;
  67. DWORD dw_OI_IO_Mask;
  68. DWORD dw_NP_CI_IO_Mask;
  69. struct _SCEP_ADL_NODE_ *Next;
  70. } SCEP_ADL_NODE, *PSCEP_ADL_NODE;
  71. //#define DbgPrint(_x_) (lpOutputRoutine) _x_
  72. #define DbgPrint(_x_)
  73. #define MAX_NAME 256
  74. #define DebuggerOut (lpOutputRoutine)
  75. #define GET_DATA(DebugeeAddr, LocalAddr, Length) \
  76. Status = ReadProcessMemory( \
  77. GlobalhCurrentProcess, \
  78. (LPVOID)DebugeeAddr, \
  79. LocalAddr, \
  80. Length, \
  81. NULL \
  82. );
  83. //
  84. // This macro copies a string from the debuggee
  85. // process, one character at a time into this
  86. // process's address space.
  87. //
  88. // CODEWORK: This macro should check the length
  89. // to make sure we don't overflow the LocalAddr
  90. // buffer. Perhaps this should be a function
  91. // rather than a macro.
  92. //
  93. #define GET_STRING(DebugeeAddr, LocalAddr, Length) \
  94. \
  95. { \
  96. WCHAR UnicodeChar; \
  97. LPWSTR pDest; \
  98. LPWSTR pSource; \
  99. pDest = LocalAddr; \
  100. pSource = DebugeeAddr; \
  101. do { \
  102. \
  103. Status = ReadProcessMemory( \
  104. GlobalhCurrentProcess, \
  105. (LPVOID)pSource, \
  106. &UnicodeChar, \
  107. sizeof(WCHAR), \
  108. NULL \
  109. ); \
  110. \
  111. *pDest = UnicodeChar; \
  112. pDest++; \
  113. pSource++; \
  114. } while (UnicodeChar != L'\0');}
  115. #define GET_DWORD(str) \
  116. { \
  117. dwValue = 0; \
  118. pvAddr = (PVOID)(lpGetExpressionRoutine)(str); \
  119. if ( pvAddr) { \
  120. \
  121. GET_DATA( pvAddr, (LPVOID)&dwValue, sizeof(DWORD)); \
  122. \
  123. } else { \
  124. DebuggerOut("\tFail to get address of %s\n", str); \
  125. dwValue = (DWORD)-1; \
  126. } \
  127. }
  128. //
  129. // globals
  130. //
  131. extern HANDLE GlobalhCurrentProcess;
  132. extern BOOL Status;
  133. //=======================
  134. // Function Prototypes
  135. //=======================
  136. extern PNTSD_OUTPUT_ROUTINE lpOutputRoutine;
  137. extern PNTSD_GET_EXPRESSION lpGetExpressionRoutine;
  138. extern PNTSD_CHECK_CONTROL_C lpCheckControlCRoutine;
  139. #define NAME_BASE_SRV "scesrv"
  140. #define NAME_BASE_CLI "scecli"
  141. //
  142. // common for both DLLs
  143. //
  144. #define SCEEXTS_PRIVILEGE_LIST "SCE_Privileges"
  145. #define SCEEXTS_WELLKNOWN_NAMES "NameTable"
  146. //
  147. // client only
  148. //
  149. #define SCEEXTS_CLIENT_SETUPDB NAME_BASE_CLI "!hSceSetupHandle"
  150. #define SCEEXTS_CLIENT_PREFIX NAME_BASE_CLI "!szCallbackPrefix"
  151. #define SCEEXTS_CLIENT_PRODUCT NAME_BASE_CLI "!dwThisMachine"
  152. #define SCEEXTS_CLIENT_UPD_FILE NAME_BASE_CLI "!szUpInfFile"
  153. #define SCEEXTS_CLIENT_ISNT5 NAME_BASE_CLI "!bIsNT5"
  154. #define SCEEXTS_CLIENT_NOTIFY_ROLE NAME_BASE_CLI "!MachineRole"
  155. #define SCEEXTS_CLIENT_NOTIFY_ROLEQUERY NAME_BASE_CLI "!bRoleQueried"
  156. #define SCEEXTS_CLIENT_NOTIFY_ROLEFLAG NAME_BASE_CLI "!DsRoleFlags"
  157. #define SCEEXTS_CLIENT_NOTIFY_COUNT NAME_BASE_CLI "!SceNotifyCount"
  158. #define SCEEXTS_CLIENT_NOTIFY_ACTIVE NAME_BASE_CLI "!gSceNotificationThreadActive"
  159. #define SCEEXTS_CLIENT_NOTIFY_LIST NAME_BASE_CLI "!ScepNotifyList"
  160. #define SCEEXTS_CLIENT_POLICY_ASYNC NAME_BASE_CLI "!gbAsyncWinlogonThread"
  161. #define SCEEXTS_CLIENT_POLICY_HRSRSOP NAME_BASE_CLI "!gHrSynchRsopStatus"
  162. #define SCEEXTS_CLIENT_POLICY_HRARSOP NAME_BASE_CLI "!gHrAsynchRsopStatus"
  163. #define SCEEXTS_CLIENT_POLICY_ISDC NAME_BASE_CLI "!gbThisIsDC"
  164. #define SCEEXTS_CLIENT_POLICY_DCQUERY NAME_BASE_CLI "!gbDCQueried"
  165. #define SCEEXTS_CLIENT_POLICY_DomName NAME_BASE_CLI "!gpwszDCDomainName"
  166. //
  167. // server only
  168. //
  169. #define SCEEXTS_POLICY_QUEUE_LOG NAME_BASE_SRV "!gdwNotificationLog"
  170. #define SCEEXTS_POLICY_QUEUE_PRODUCT_QUERY NAME_BASE_SRV "!bQueriedProductTypeForNotification"
  171. #define SCEEXTS_POLICY_QUEUE_PRODUCT NAME_BASE_SRV "!ProductTypeForNotification"
  172. #define SCEEXTS_POLICY_QUEUE_SUSPEND NAME_BASE_SRV "!gbSuspendQueue"
  173. #define SCEEXTS_POLICY_QUEUE_HEAD NAME_BASE_SRV "!pNotificationQHead"
  174. #define SCEEXTS_POLICY_QUEUE_TAIL NAME_BASE_SRV "!pNotificationQTail"
  175. #define SCEEXTS_POLICY_QUEUE_COUNT NAME_BASE_SRV "!gdwNumNotificationQNodes"
  176. #define SCEEXTS_POLICY_QUEUE_RETRY NAME_BASE_SRV "!gdwNumNotificationQRetryNodes"
  177. #define SCEEXTS_SERVER_OPEN_CONTEXT NAME_BASE_SRV "!pOpenContexts"
  178. #define SCEEXTS_SERVER_DB_CONTEXT NAME_BASE_SRV "!pDbTask"
  179. #define SCEEXTS_SERVER_ENGINE NAME_BASE_SRV "!pEngines"
  180. #define SCEEXTS_SERVER_JET_INSTANCE NAME_BASE_SRV "!JetInstance"
  181. #define SCEEXTS_SERVER_JET_INIT NAME_BASE_SRV "!JetInited"
  182. VOID
  183. SceExtspDumpSplayNodes(
  184. IN PVOID pvAddr,
  185. IN PVOID pvSentinel,
  186. IN SCEP_NODE_VALUE_TYPE Type
  187. );
  188. VOID
  189. SceExtspDumpQueueNode(
  190. IN PVOID pvAddr,
  191. IN BOOL bOneNode
  192. );
  193. VOID
  194. SceExtspReadDumpSID(
  195. IN LPSTR szPrefix,
  196. IN PSID pSid
  197. );
  198. VOID
  199. SceExtspDumpNotificationInfo(
  200. IN SECURITY_DB_TYPE DbType,
  201. IN SECURITY_DB_OBJECT_TYPE ObjectType,
  202. IN SECURITY_DB_DELTA_TYPE DeltaType
  203. );
  204. VOID
  205. SceExtspDumpADLNodes(
  206. IN PVOID pvAddr
  207. );
  208. VOID
  209. SceExtspDumpGUID(
  210. IN GUID *pGUID
  211. );
  212. VOID
  213. SceExtspGetNextArgument(
  214. IN OUT LPSTR *pszCommand,
  215. OUT LPSTR *pArg,
  216. OUT DWORD *pLen
  217. );
  218. VOID
  219. SceExtspDumpObjectTree(
  220. IN PVOID pvAddr,
  221. IN DWORD Level,
  222. IN DWORD Count,
  223. IN PWSTR wszName,
  224. IN BOOL bDumpSD
  225. );
  226. VOID
  227. SceExtspReadDumpSD(
  228. IN SECURITY_INFORMATION SeInfo,
  229. IN PVOID pvSD,
  230. IN LPSTR szPrefix
  231. );
  232. VOID
  233. SceExtspReadDumpNameList(
  234. IN PVOID pvAddr,
  235. IN LPSTR szPrefix
  236. );
  237. VOID
  238. SceExtspReadDumpObjectSecurity(
  239. IN PVOID pvAddr,
  240. IN LPSTR szPrefix
  241. );
  242. #endif