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.

574 lines
12 KiB

  1. enum STORAGE_LOCATION {
  2. LOCATION_LOCAL=0,
  3. LOCATION_REMOTE,
  4. LOCATION_GLOBAL,
  5. LOCATION_CACHE,
  6. LOCATION_FILE,
  7. };
  8. #include <polstructs.h>
  9. DWORD
  10. IPSecEnumPolicyData(
  11. HANDLE hPolicyStore,
  12. PIPSEC_POLICY_DATA ** pppIpsecPolicyData,
  13. PDWORD pdwNumPolicyObjects
  14. );
  15. DWORD
  16. IPSecSetPolicyData(
  17. HANDLE hPolicyStore,
  18. PIPSEC_POLICY_DATA pIpsecPolicyData
  19. );
  20. DWORD
  21. IPSecCreatePolicyData(
  22. HANDLE hPolicyStore,
  23. PIPSEC_POLICY_DATA pIpsecPolicyData
  24. );
  25. DWORD
  26. IPSecDeletePolicyData(
  27. HANDLE hPolicyStore,
  28. PIPSEC_POLICY_DATA pIpsecPolicyData
  29. );
  30. DWORD
  31. IPSecEnumFilterData(
  32. HANDLE hPolicyStore,
  33. PIPSEC_FILTER_DATA ** pppIpsecFilterData,
  34. PDWORD pdwNumFilterObjects
  35. );
  36. DWORD
  37. IPSecSetFilterData(
  38. HANDLE hPolicyStore,
  39. PIPSEC_FILTER_DATA pIpsecFilterData
  40. );
  41. DWORD
  42. IPSecCreateFilterData(
  43. HANDLE hPolicyStore,
  44. PIPSEC_FILTER_DATA pIpsecFilterData
  45. );
  46. DWORD
  47. IPSecDeleteFilterData(
  48. HANDLE hPolicyStore,
  49. GUID FilterIdentifier
  50. );
  51. DWORD
  52. IPSecEnumNegPolData(
  53. HANDLE hPolicyStore,
  54. PIPSEC_NEGPOL_DATA ** pppIpsecNegPolData,
  55. PDWORD pdwNumNegPolObjects
  56. );
  57. DWORD
  58. IPSecSetNegPolData(
  59. HANDLE hPolicyStore,
  60. PIPSEC_NEGPOL_DATA pIpsecNegPolData
  61. );
  62. DWORD
  63. IPSecCreateNegPolData(
  64. HANDLE hPolicyStore,
  65. PIPSEC_NEGPOL_DATA pIpsecNegPolData
  66. );
  67. DWORD
  68. IPSecDeleteNegPolData(
  69. HANDLE hPolicyStore,
  70. GUID NegPolIdentifier
  71. );
  72. DWORD
  73. IPSecCreateNFAData(
  74. HANDLE hPolicyStore,
  75. GUID PolicyIdentifier,
  76. PIPSEC_NFA_DATA pIpsecNFAData
  77. );
  78. DWORD
  79. IPSecSetNFAData(
  80. HANDLE hPolicyStore,
  81. GUID PolicyIdentifier,
  82. PIPSEC_NFA_DATA pIpsecNFAData
  83. );
  84. DWORD
  85. IPSecDeleteNFAData(
  86. HANDLE hPolicyStore,
  87. GUID PolicyIdentifier,
  88. PIPSEC_NFA_DATA pIpsecNFAData
  89. );
  90. DWORD
  91. IPSecEnumNFAData(
  92. HANDLE hPolicyStore,
  93. GUID PolicyIdentifier,
  94. PIPSEC_NFA_DATA ** pppIpsecNFAData,
  95. PDWORD pdwNumNFAObjects
  96. );
  97. DWORD
  98. IPSecGetFilterData(
  99. HANDLE hPolicyStore,
  100. GUID FilterGUID,
  101. PIPSEC_FILTER_DATA * ppIpsecFilterData
  102. );
  103. DWORD
  104. IPSecGetNegPolData(
  105. HANDLE hPolicyStore,
  106. GUID NegPolGUID,
  107. PIPSEC_NEGPOL_DATA * ppIpsecNegPolData
  108. );
  109. DWORD
  110. IPSecEnumISAKMPData(
  111. HANDLE hPolicyStore,
  112. PIPSEC_ISAKMP_DATA ** pppIpsecISAKMPData,
  113. PDWORD pdwNumISAKMPObjects
  114. );
  115. DWORD
  116. IPSecSetISAKMPData(
  117. HANDLE hPolicyStore,
  118. PIPSEC_ISAKMP_DATA pIpsecISAKMPData
  119. );
  120. DWORD
  121. IPSecCreateISAKMPData(
  122. HANDLE hPolicyStore,
  123. PIPSEC_ISAKMP_DATA pIpsecISAKMPData
  124. );
  125. DWORD
  126. IPSecDeleteISAKMPData(
  127. HANDLE hPolicyStore,
  128. GUID ISAKMPIdentifier
  129. );
  130. DWORD
  131. IPSecGetISAKMPData(
  132. HANDLE hPolicyStore,
  133. GUID ISAKMPGUID,
  134. PIPSEC_ISAKMP_DATA * ppIpsecISAKMPData
  135. );
  136. DWORD
  137. IPSecOpenPolicyStore(
  138. LPWSTR pszMachineName,
  139. DWORD dwTypeOfStore,
  140. LPWSTR pszFileName,
  141. HANDLE * phPolicyStore
  142. );
  143. DWORD
  144. RegOpenPolicyStore(
  145. LPWSTR pszMachineName,
  146. HANDLE * phPolicyStore
  147. );
  148. DWORD
  149. DirOpenPolicyStore(
  150. LPWSTR pszMachineName,
  151. HANDLE * phPolicyStore
  152. );
  153. DWORD
  154. FileOpenPolicyStore(
  155. LPWSTR pszMachineName,
  156. LPWSTR pszFileName,
  157. HANDLE * phPolicyStore
  158. );
  159. DWORD
  160. IPSecClosePolicyStore(
  161. HANDLE hPolicyStore
  162. );
  163. DWORD
  164. IPSecAssignPolicy(
  165. HANDLE hPolicyStore,
  166. GUID PolicyGUID
  167. );
  168. DWORD
  169. IPSecUnassignPolicy(
  170. HANDLE hPolicyStore,
  171. GUID PolicyGUID
  172. );
  173. DWORD
  174. ComputeDirLocationName(
  175. LPWSTR pszDirDomainName,
  176. LPWSTR * ppszDirFQPathName
  177. );
  178. DWORD
  179. IPSecGetAssignedPolicyData(
  180. HANDLE hPolicyStore,
  181. PIPSEC_POLICY_DATA * ppIpsecPolicyData
  182. );
  183. DWORD
  184. IPSecExportPolicies(
  185. HANDLE hSrcPolicyStore,
  186. HANDLE hDesPolicyStore
  187. );
  188. DWORD
  189. IPSecImportPolicies(
  190. HANDLE hSrcPolicyStore,
  191. HANDLE hDesPolicyStore
  192. );
  193. /*
  194. //////////////////////////////
  195. //
  196. // Globals
  197. //
  198. //////////////////////////////
  199. // {6A1F5C6F-72B7-11d2-ACF0-0060B0ECCA17}
  200. static const GUID GUID_POLSTORE_VERSION_INFO =
  201. { 0x6a1f5c6f, 0x72b7, 0x11d2, { 0xac, 0xf0, 0x0, 0x60, 0xb0, 0xec, 0xca, 0x17 } };
  202. // {72385230-70FA-11d1-864C-14A300000000}
  203. static const GUID GUID_BUILTIN_SECURE_INITIATOR_POLICY =
  204. { 0x72385230, 0x70fa, 0x11d1, { 0x86, 0x4c, 0x14, 0xa3, 0x0, 0x0, 0x0, 0x0 } };
  205. // {72385231-70FA-11d1-864C-14A300000000}
  206. static const GUID GUID_BUILTIN_SECURE_INITIATOR_ISAKMP =
  207. { 0x72385231, 0x70fa, 0x11d1, { 0x86, 0x4c, 0x14, 0xa3, 0x0, 0x0, 0x0, 0x0 } };
  208. // {72385232-70FA-11d1-864C-14A300000000}
  209. static const GUID GUID_BUILTIN_SECURE_INITIATOR_NFA =
  210. { 0x72385232, 0x70fa, 0x11d1, { 0x86, 0x4c, 0x14, 0xa3, 0x0, 0x0, 0x0, 0x0 } };
  211. // {72385233-70FA-11d1-864C-14A300000000}
  212. static const GUID GUID_BUILTIN_SECURE_INITIATOR_NEGPOL =
  213. { 0x72385233, 0x70fa, 0x11d1, { 0x86, 0x4c, 0x14, 0xa3, 0x0, 0x0, 0x0, 0x0 } };
  214. // {72385236-70FA-11d1-864C-14A300000000}
  215. static const GUID GUID_BUILTIN_RESPONDER_POLICY =
  216. { 0x72385236, 0x70fa, 0x11d1, { 0x86, 0x4c, 0x14, 0xa3, 0x0, 0x0, 0x0, 0x0 } };
  217. // {72385237-70FA-11d1-864C-14A300000000}
  218. static const GUID GUID_BUILTIN_RESPONDER_ISAKMP =
  219. { 0x72385237, 0x70fa, 0x11d1, { 0x86, 0x4c, 0x14, 0xa3, 0x0, 0x0, 0x0, 0x0 } };
  220. // {72385238-70FA-11d1-864C-14A300000000}
  221. static const GUID GUID_BUILTIN_L2TP_POLICY =
  222. { 0x72385238, 0x70fa, 0x11d1, { 0x86, 0x4c, 0x14, 0xa3, 0x0, 0x0, 0x0, 0x0 } };
  223. // {72385239-70FA-11d1-864C-14A300000000}
  224. static const GUID GUID_BUILTIN_L2TP_ISAKMP =
  225. { 0x72385239, 0x70fa, 0x11d1, { 0x86, 0x4c, 0x14, 0xa3, 0x0, 0x0, 0x0, 0x0 } };
  226. // {7238523a-70FA-11d1-864C-14A300000000}
  227. static const GUID GUID_BUILTIN_ME_TO_FROM_ANYONE_FILTER=
  228. { 0x7238523a, 0x70fa, 0x11d1, { 0x86, 0x4c, 0x14, 0xa3, 0x0, 0x0, 0x0, 0x0 } };
  229. // {72385235-70FA-11d1-864C-14A300000000}
  230. static const GUID GUID_BUILTIN_ICMP_FILTER =
  231. { 0x72385235, 0x70fa, 0x11d1, { 0x86, 0x4c, 0x14, 0xa3, 0x0, 0x0, 0x0, 0x0 } };
  232. // {7238523c-70FA-11d1-864C-14A300000000}
  233. static const GUID GUID_BUILTIN_LOCKDOWN_POLICY =
  234. { 0x7238523c, 0x70fa, 0x11d1, { 0x86, 0x4c, 0x14, 0xa3, 0x0, 0x0, 0x0, 0x0 } };
  235. // {7238523d-70FA-11d1-864C-14A300000000}
  236. static const GUID GUID_BUILTIN_LOCKDOWN_ISAKMP =
  237. { 0x7238523d, 0x70fa, 0x11d1, { 0x86, 0x4c, 0x14, 0xa3, 0x0, 0x0, 0x0, 0x0 } };
  238. // {7238523e-70FA-11d1-864C-14A300000000}
  239. static const GUID GUID_BUILTIN_LOCKDOWN_NFA =
  240. { 0x7238523e, 0x70fa, 0x11d1, { 0x86, 0x4c, 0x14, 0xa3, 0x0, 0x0, 0x0, 0x0 } };
  241. // {7238523f-70FA-11d1-864C-14A300000000}
  242. static const GUID GUID_BUILTIN_LOCKDOWN_NEGPOL =
  243. { 0x7238523f, 0x70fa, 0x11d1, { 0x86, 0x4c, 0x14, 0xa3, 0x0, 0x0, 0x0, 0x0 } };
  244. static const GUID GUID_BUILTIN_PERMIT_NEGPOL =
  245. { 0x7238523b, 0x70fa, 0x11d1, { 0x86, 0x4c, 0x14, 0xa3, 0x0, 0x0, 0x0, 0x0 } };
  246. //////////////////////////////
  247. //////////////////////////////
  248. // Negotiation Policy Types
  249. //////////////////////////////
  250. //////////////////////////////
  251. // {62F49E10-6C37-11d1-864C-14A300000000}
  252. static const GUID GUID_NEGOTIATION_TYPE_STANDARD =
  253. { 0x62f49e10, 0x6c37, 0x11d1, { 0x86, 0x4c, 0x14, 0xa3, 0x0, 0x0, 0x0, 0x0 } };
  254. // {62F49E11-6C37-11d1-864C-14A300000000}
  255. static const GUID GUID_NEGOTIATION_TYPE_L2TP_BASE =
  256. { 0x62f49e11, 0x6c37, 0x11d1, { 0x86, 0x4c, 0x14, 0xa3, 0x0, 0x0, 0x0, 0x0 } };
  257. // {62F49E12-6C37-11d1-864C-14A300000000}
  258. static const GUID GUID_NEGOTIATION_TYPE_L2TP_EXTENDED =
  259. { 0x62f49e12, 0x6c37, 0x11d1, { 0x86, 0x4c, 0x14, 0xa3, 0x0, 0x0, 0x0, 0x0 } };
  260. // {62F49E13-6C37-11d1-864C-14A300000000}
  261. static const GUID GUID_NEGOTIATION_TYPE_DEFAULT =
  262. { 0x62f49e13, 0x6c37, 0x11d1, { 0x86, 0x4c, 0x14, 0xa3, 0x0, 0x0, 0x0, 0x0 } };
  263. //////////////////////////////
  264. //////////////////////////////
  265. // Negotiation Policy Actions
  266. //////////////////////////////
  267. //////////////////////////////
  268. // {3F91A819-7647-11d1-864D-D46A00000000}
  269. static const GUID GUID_NEGOTIATION_ACTION_BLOCK =
  270. { 0x3f91a819, 0x7647, 0x11d1, { 0x86, 0x4d, 0xd4, 0x6a, 0x0, 0x0, 0x0, 0x0 } };
  271. // {3F91A81A-7647-11d1-864D-D46A00000000}
  272. static const GUID GUID_NEGOTIATION_ACTION_INBOUND_PASSTHRU =
  273. { 0x3f91a81a, 0x7647, 0x11d1, { 0x86, 0x4d, 0xd4, 0x6a, 0x0, 0x0, 0x0, 0x0 } };
  274. // {8A171DD2-77E3-11d1-8659-A04F00000000}
  275. static const GUID GUID_NEGOTIATION_ACTION_NO_IPSEC =
  276. { 0x8a171dd2, 0x77e3, 0x11d1, { 0x86, 0x59, 0xa0, 0x4f, 0x0, 0x0, 0x0, 0x0 } };
  277. // {8A171DD3-77E3-11d1-8659-A04F00000000}
  278. static const GUID GUID_NEGOTIATION_ACTION_NORMAL_IPSEC =
  279. { 0x8a171dd3, 0x77e3, 0x11d1, { 0x86, 0x59, 0xa0, 0x4f, 0x0, 0x0, 0x0, 0x0 } };
  280. //////////////////////////////
  281. //////////////////////////////
  282. // GUID identifying the default IKE settings to use
  283. // in case no policy is assigned.
  284. //////////////////////////////
  285. //////////////////////////////
  286. // {72385234-70FA-11d1-864C-14A300000000}
  287. static const GUID GUID_BUILTIN_DEFAULT_ISAKMP_POLICY=
  288. { 0x72385234, 0x70fa, 0x11d1, { 0x86, 0x4c, 0x14, 0xa3, 0x0, 0x0, 0x0, 0x0 } };
  289. ///////////////////////
  290. // GUIDS reserved for future use... These are handy mostly because they
  291. // are easily recognizable because of the trailing zeros. This helps out in
  292. // debugging and in manual manipulation of policies by GUID -- such as removing
  293. // built-in policies from the DS using adsvw etc.
  294. //////////////////////
  295. */
  296. #define PAS_INTERFACE_TYPE_NONE 0
  297. #define PAS_INTERFACE_TYPE_DIALUP -1
  298. #define PAS_INTERFACE_TYPE_LAN -2
  299. #define PAS_INTERFACE_TYPE_ALL -3
  300. //
  301. // Negotiation Policy Actions.
  302. //
  303. // {3F91A819-7647-11d1-864D-D46A00000000}
  304. static const GUID GUID_NEGOTIATION_ACTION_BLOCK =
  305. { 0x3f91a819, 0x7647, 0x11d1, { 0x86, 0x4d, 0xd4, 0x6a, 0x0, 0x0, 0x0, 0x0 } };
  306. // {3F91A81A-7647-11d1-864D-D46A00000000}
  307. static const GUID GUID_NEGOTIATION_ACTION_INBOUND_PASSTHRU =
  308. { 0x3f91a81a, 0x7647, 0x11d1, { 0x86, 0x4d, 0xd4, 0x6a, 0x0, 0x0, 0x0, 0x0 } };
  309. // {8A171DD2-77E3-11d1-8659-A04F00000000}
  310. static const GUID GUID_NEGOTIATION_ACTION_NO_IPSEC =
  311. { 0x8a171dd2, 0x77e3, 0x11d1, { 0x86, 0x59, 0xa0, 0x4f, 0x0, 0x0, 0x0, 0x0 } };
  312. // {8A171DD3-77E3-11d1-8659-A04F00000000}
  313. static const GUID GUID_NEGOTIATION_ACTION_NORMAL_IPSEC =
  314. { 0x8a171dd3, 0x77e3, 0x11d1, { 0x86, 0x59, 0xa0, 0x4f, 0x0, 0x0, 0x0, 0x0 } };
  315. //
  316. // Negotiation Policy Types.
  317. //
  318. // {62F49E10-6C37-11d1-864C-14A300000000}
  319. static const GUID GUID_NEGOTIATION_TYPE_STANDARD =
  320. { 0x62f49e10, 0x6c37, 0x11d1, { 0x86, 0x4c, 0x14, 0xa3, 0x0, 0x0, 0x0, 0x0 } };
  321. // {62F49E13-6C37-11d1-864C-14A300000000}
  322. static const GUID GUID_NEGOTIATION_TYPE_DEFAULT =
  323. { 0x62f49e13, 0x6c37, 0x11d1, { 0x86, 0x4c, 0x14, 0xa3, 0x0, 0x0, 0x0, 0x0 } };
  324. DWORD
  325. IPSecRestoreDefaultPolicies(
  326. HANDLE hPolicyStore
  327. );
  328. DWORD
  329. IPSecIsDomainPolicyAssigned(
  330. PBOOL pbIsDomainPolicyAssigned
  331. );
  332. //
  333. // Polstore memory management functions.
  334. //
  335. LPVOID
  336. IPSecAllocPolMem(
  337. DWORD cb
  338. );
  339. BOOL
  340. IPSecFreePolMem(
  341. LPVOID pMem
  342. );
  343. LPWSTR
  344. IPSecAllocPolStr(
  345. LPCWSTR pStr
  346. );
  347. BOOL
  348. IPSecFreePolStr(
  349. LPWSTR pStr
  350. );
  351. DWORD
  352. IPSecReallocatePolMem(
  353. LPVOID * ppOldMem,
  354. DWORD cbOld,
  355. DWORD cbNew
  356. );
  357. BOOL
  358. IPSecReallocatePolStr(
  359. LPWSTR *ppStr,
  360. LPWSTR pStr
  361. );
  362. void
  363. IPSecFreePolicyData(
  364. PIPSEC_POLICY_DATA pIpsecPolicyData
  365. );
  366. void
  367. IPSecFreeNegPolData(
  368. PIPSEC_NEGPOL_DATA pIpsecNegPolData
  369. );
  370. void
  371. IPSecFreeFilterData(
  372. PIPSEC_FILTER_DATA pIpsecFilterData
  373. );
  374. void
  375. IPSecFreeISAKMPData(
  376. PIPSEC_ISAKMP_DATA pIpsecISAKMPData
  377. );
  378. void
  379. IPSecFreeNFAData(
  380. PIPSEC_NFA_DATA pIpsecNFAData
  381. );
  382. DWORD
  383. IPSecCopyPolicyData(
  384. PIPSEC_POLICY_DATA pIpsecPolicyData,
  385. PIPSEC_POLICY_DATA * ppIpsecPolicyData
  386. );
  387. DWORD
  388. IPSecCopyNegPolData(
  389. PIPSEC_NEGPOL_DATA pIpsecNegPolData,
  390. PIPSEC_NEGPOL_DATA * ppIpsecNegPolData
  391. );
  392. DWORD
  393. IPSecCopyFilterData(
  394. PIPSEC_FILTER_DATA pIpsecFilterData,
  395. PIPSEC_FILTER_DATA * ppIpsecFilterData
  396. );
  397. DWORD
  398. IPSecCopyFilterSpec(
  399. PIPSEC_FILTER_SPEC pFilterSpecs,
  400. PIPSEC_FILTER_SPEC * ppFilterSpecs
  401. );
  402. DWORD
  403. IPSecCopyISAKMPData(
  404. PIPSEC_ISAKMP_DATA pIpsecISAKMPData,
  405. PIPSEC_ISAKMP_DATA * ppIpsecISAKMPData
  406. );
  407. DWORD
  408. IPSecCopyNFAData(
  409. PIPSEC_NFA_DATA pIpsecNFAData,
  410. PIPSEC_NFA_DATA * ppIpsecNFAData
  411. );
  412. DWORD
  413. IPSecCopyAuthMethod(
  414. PIPSEC_AUTH_METHOD pAuthMethod,
  415. PIPSEC_AUTH_METHOD * ppAuthMethod
  416. );
  417. void
  418. IPSecFreeMulPolicyData(
  419. PIPSEC_POLICY_DATA * ppIpsecPolicyData,
  420. DWORD dwNumPolicyObjects
  421. );
  422. void
  423. IPSecFreeMulNegPolData(
  424. PIPSEC_NEGPOL_DATA * ppIpsecNegPolData,
  425. DWORD dwNumNegPolObjects
  426. );
  427. void
  428. IPSecFreeMulFilterData(
  429. PIPSEC_FILTER_DATA * ppIpsecFilterData,
  430. DWORD dwNumFilterObjects
  431. );
  432. void
  433. IPSecFreeFilterSpecs(
  434. PIPSEC_FILTER_SPEC * ppIpsecFilterSpecs,
  435. DWORD dwNumFilterSpecs
  436. );
  437. void
  438. IPSecFreeFilterSpec(
  439. PIPSEC_FILTER_SPEC pIpsecFilterSpec
  440. );
  441. void
  442. IPSecFreeMulISAKMPData(
  443. PIPSEC_ISAKMP_DATA * ppIpsecISAKMPData,
  444. DWORD dwNumISAKMPObjects
  445. );
  446. void
  447. IPSecFreeMulNFAData(
  448. PIPSEC_NFA_DATA * ppIpsecNFAData,
  449. DWORD dwNumNFAObjects
  450. );