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.

1453 lines
48 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1996.
  5. //
  6. // File: globals.cxx
  7. //
  8. // Contents: Global Variables for WinNT
  9. //
  10. // Functions:
  11. //
  12. // History: 25-March-96 KrishnaG Created.
  13. // Updated: 4-May-2000 sivaramr Added a property called Name to all
  14. // classes in order to support keys in UMI.
  15. // 13-Aug-2000 AjayR Added support to dynamically load
  16. // functions that are not on earlier NT versions.
  17. //
  18. //----------------------------------------------------------------------------
  19. #include "winnt.hxx"
  20. #pragma hdrstop
  21. //
  22. // Global variabled needed to keep track of dynamically
  23. // loaded libs.
  24. //
  25. HANDLE g_hDllNetapi32;
  26. HANDLE g_hDllAdvapi32;
  27. CRITICAL_SECTION g_csLoadLibs;
  28. BOOL g_fDllsLoaded;
  29. FRTLENCRYPTMEMORY g_pRtlEncryptMemory = NULL;
  30. FRTLDECRYPTMEMORY g_pRtlDecryptMemory = NULL;
  31. WCHAR *szProviderName = TEXT("WinNT");
  32. #define MAX_LONG (0x7FFFFFFF)
  33. #define MIN_LONG (0x80000000)
  34. #define MAX_BOOLEAN 1
  35. #define MAX_STRLEN (256)
  36. PROPERTYINFO DomainClass[] =
  37. { { TEXT("MinPasswordLength"), // FSDomainPassword
  38. TEXT(""), TEXT("Integer"), LM20_PWLEN+1, 0, FALSE,
  39. PROPERTY_RW, 0, NT_SYNTAX_ID_DWORD },
  40. { TEXT("MinPasswordAge"),
  41. TEXT(""), TEXT("Interval"), TIMEQ_FOREVER, 0, FALSE,
  42. PROPERTY_RW, 0, NT_SYNTAX_ID_DWORD },
  43. { TEXT("MaxPasswordAge"),
  44. TEXT(""),TEXT("Interval"), TIMEQ_FOREVER, ONE_DAY, FALSE,
  45. PROPERTY_RW, 0, NT_SYNTAX_ID_DWORD },
  46. { TEXT("MaxBadPasswordsAllowed"),
  47. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  48. PROPERTY_RW, 3, NT_SYNTAX_ID_DWORD },
  49. //
  50. // NetAPI state DEF_MAX_PWHIST (8), but NetAPI devlpr confirm
  51. // current is 1024. Ignore Net Account - UNIQUEPWD limit.
  52. // Use DEF_MAX_PWHIST to be safe for now
  53. //
  54. { TEXT("PasswordHistoryLength"),
  55. TEXT(""), TEXT("Integer"), DEF_MAX_PWHIST, 0, FALSE,
  56. PROPERTY_RW, 0, NT_SYNTAX_ID_DWORD},
  57. { TEXT("AutoUnlockInterval"),
  58. TEXT(""), TEXT("Interval"), MAX_LONG, 0, FALSE,
  59. PROPERTY_RW, 3, NT_SYNTAX_ID_DWORD },
  60. { TEXT("LockoutObservationInterval"),
  61. TEXT(""), TEXT("Interval"), MAX_LONG, 0, FALSE,
  62. PROPERTY_RW, 3, NT_SYNTAX_ID_DWORD },
  63. { TEXT("Name"),
  64. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  65. PROPERTY_READABLE, 0, NT_SYNTAX_ID_LPTSTR }
  66. };
  67. DWORD gdwDomainTableSize = sizeof(DomainClass)/sizeof(PROPERTYINFO);
  68. PROPERTYINFO ComputerClass[] =
  69. { { TEXT("Owner"),
  70. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  71. PROPERTY_RW, 4, NT_SYNTAX_ID_LPTSTR },
  72. { TEXT("Division"),
  73. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  74. PROPERTY_RW, 4, NT_SYNTAX_ID_LPTSTR },
  75. { TEXT("OperatingSystem"), // ro
  76. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  77. PROPERTY_RW, 4, NT_SYNTAX_ID_LPTSTR},
  78. { TEXT("OperatingSystemVersion"), // ro
  79. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  80. PROPERTY_RW, 4, NT_SYNTAX_ID_LPTSTR},
  81. { TEXT("Processor"),
  82. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  83. PROPERTY_RW, 4, NT_SYNTAX_ID_LPTSTR },
  84. { TEXT("ProcessorCount"),
  85. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  86. PROPERTY_RW, 4, NT_SYNTAX_ID_LPTSTR },
  87. { TEXT("Name"),
  88. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  89. PROPERTY_READABLE, 4, NT_SYNTAX_ID_LPTSTR }
  90. };
  91. DWORD gdwComputerTableSize = sizeof(ComputerClass)/sizeof(PROPERTYINFO);
  92. PROPERTYINFO UserClass[] =
  93. { // USER_INFO3
  94. { TEXT("Description"), // FSUserBusinessInfo
  95. TEXT(""), TEXT("String"), MAXCOMMENTSZ+1, 0, FALSE,
  96. PROPERTY_RW, 3, NT_SYNTAX_ID_LPTSTR },
  97. { TEXT("FullName"),
  98. TEXT(""), TEXT("String"), MAXCOMMENTSZ+1, 0, FALSE,
  99. PROPERTY_RW, 3, NT_SYNTAX_ID_LPTSTR},
  100. { TEXT("AccountExpirationDate"),
  101. TEXT(""), TEXT("Time"), 0, 0, FALSE,
  102. PROPERTY_RW, 3, NT_SYNTAX_ID_DATE_1970},
  103. { TEXT("PasswordAge"),
  104. TEXT(""), TEXT("Time"), 0, 0, FALSE,
  105. PROPERTY_RW, 3, NT_SYNTAX_ID_DWORD},
  106. { TEXT("UserFlags"),
  107. TEXT(""), TEXT("Integer"), 0, 0, FALSE,
  108. PROPERTY_RW, 3, NT_SYNTAX_ID_DWORD},
  109. { TEXT("LoginWorkstations"),
  110. TEXT(""), TEXT("String"), MAX_STRLEN, 0, TRUE,
  111. PROPERTY_RW, 3, NT_SYNTAX_ID_DelimitedString },
  112. { TEXT("BadPasswordAttempts"), // ro
  113. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  114. PROPERTY_READABLE, 3, NT_SYNTAX_ID_DWORD },
  115. { TEXT("MaxLogins"),
  116. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  117. PROPERTY_RW, 3, NT_SYNTAX_ID_DWORD },
  118. { TEXT("MaxStorage"),
  119. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  120. PROPERTY_RW, 3, NT_SYNTAX_ID_DWORD },
  121. // USER_MAX_STORAGE_UNLIMITED
  122. { TEXT("PasswordExpired"),
  123. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  124. PROPERTY_RW, 3, NT_SYNTAX_ID_DWORD },
  125. { TEXT("PasswordExpirationDate"),
  126. TEXT(""), TEXT("Time"), 0, 0, FALSE,
  127. PROPERTY_RW, 3, NT_SYNTAX_ID_DATE_1970 },
  128. { TEXT("LastLogin"), // ro
  129. TEXT(""), TEXT("Time"), 0, 0, FALSE,
  130. PROPERTY_READABLE, 3, NT_SYNTAX_ID_DATE_1970 },
  131. { TEXT("LastLogoff"), // ro
  132. TEXT(""), TEXT("Time"), 0, 0, FALSE,
  133. PROPERTY_READABLE, 3, NT_SYNTAX_ID_DATE_1970 },
  134. { TEXT("HomeDirectory"),
  135. TEXT(""), TEXT("Path"), MAX_PATH, 0, FALSE,
  136. PROPERTY_RW, 3, NT_SYNTAX_ID_LPTSTR },
  137. { TEXT("Profile"),
  138. TEXT(""), TEXT("Path"), MAX_PATH, 0, FALSE,
  139. PROPERTY_RW, 3, NT_SYNTAX_ID_LPTSTR},
  140. { TEXT("Parameters"),
  141. TEXT(""), TEXT("String"), MAX_PATH, 0, FALSE,
  142. PROPERTY_RW, 3, NT_SYNTAX_ID_LPTSTR},
  143. { TEXT("HomeDirDrive"),
  144. TEXT(""), TEXT("String"), MAX_PATH, 0, FALSE,
  145. PROPERTY_RW, 3, NT_SYNTAX_ID_LPTSTR},
  146. { TEXT("LoginScript"),
  147. TEXT(""), TEXT("Path"), MAX_PATH, 0, FALSE,
  148. PROPERTY_RW, 3, NT_SYNTAX_ID_LPTSTR },
  149. { TEXT("LoginHours"),
  150. TEXT(""), TEXT("OctetString"), 0, 0, FALSE,
  151. PROPERTY_RW, 3, NT_SYNTAX_ID_OCTETSTRING},
  152. { TEXT("PrimaryGroupID"),
  153. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  154. PROPERTY_RW, 3, NT_SYNTAX_ID_DWORD },
  155. //
  156. // USER_MODAL_INFO0
  157. // NOTE!! - user_modal_info0 CANNOT (!!) be changed in USER class
  158. // since they are meant for the entire domain.
  159. // - user_modal_info0 CAN (!!) be changed in DOMAIN class
  160. // only. Ref NetApi.
  161. //
  162. { TEXT("MinPasswordLength"), // FSDomainPassword
  163. TEXT(""), TEXT("Integer"), LM20_PWLEN+1, 0, FALSE,
  164. PROPERTY_READABLE, 10, NT_SYNTAX_ID_DWORD },
  165. { TEXT("MinPasswordAge"),
  166. TEXT(""), TEXT("Interval"), TIMEQ_FOREVER, 0, FALSE,
  167. PROPERTY_READABLE, 10, NT_SYNTAX_ID_DWORD },
  168. { TEXT("MaxPasswordAge"),
  169. TEXT(""),TEXT("Interval"), TIMEQ_FOREVER, ONE_DAY, FALSE,
  170. PROPERTY_READABLE, 10, NT_SYNTAX_ID_DWORD },
  171. //
  172. // NetAPI state DEF_MAX_PWHIST (8), but NetAPI devlpr confirm
  173. // current is 1024. Ignore Net Account - UNIQUEPWD limit.
  174. // Use DEF_MAX_PWHIST to be safe for now
  175. //
  176. { TEXT("PasswordHistoryLength"),
  177. TEXT(""), TEXT("Integer"), DEF_MAX_PWHIST, 0, FALSE,
  178. PROPERTY_READABLE, 10, NT_SYNTAX_ID_DWORD},
  179. //
  180. // USER_MODAL_INFO3
  181. // NOTE!! - user_modal_info3 CANNOT (!!) be changed in USER class
  182. // since they are meant for the entire domain.
  183. // - user_modal_info3 CAN (!!) be changed in DOMAIN class
  184. // only. Ref NetApi.
  185. //
  186. { TEXT("MaxBadPasswordsAllowed"),
  187. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  188. PROPERTY_READABLE, 13, NT_SYNTAX_ID_DWORD },
  189. { TEXT("AutoUnlockInterval"),
  190. TEXT(""), TEXT("Interval"), MAX_LONG, 0, FALSE,
  191. PROPERTY_READABLE, 13, NT_SYNTAX_ID_DWORD },
  192. { TEXT("LockoutObservationInterval"),
  193. TEXT(""), TEXT("Interval"), MAX_LONG, 0, FALSE,
  194. PROPERTY_READABLE, 13, NT_SYNTAX_ID_DWORD },
  195. //
  196. // Not for USER_INFO or USER_MODAL_INFO
  197. //
  198. { TEXT("objectSid"),
  199. TEXT(""), TEXT("OctetString"), 0, 0, FALSE,
  200. PROPERTY_READABLE, 20, NT_SYNTAX_ID_OCTETSTRING},
  201. { TEXT("Name"),
  202. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  203. PROPERTY_READABLE, 3, NT_SYNTAX_ID_LPTSTR }
  204. };
  205. DWORD gdwUserTableSize = sizeof(UserClass)/sizeof(PROPERTYINFO);
  206. PROPERTYINFO GroupClass[] =
  207. {
  208. { TEXT("Description"), // FSGroupGeneralInfo
  209. TEXT(""), TEXT("String"), MAXCOMMENTSZ+1, 0, FALSE,
  210. PROPERTY_RW, 1, NT_SYNTAX_ID_LPTSTR },
  211. { TEXT("objectSid"),
  212. TEXT(""), TEXT("OctetString"), 0, 0, FALSE,
  213. PROPERTY_READABLE, 20, NT_SYNTAX_ID_OCTETSTRING},
  214. { TEXT("groupType"),
  215. TEXT(""), TEXT("Integer"), 0, 0, FALSE,
  216. PROPERTY_RW, 1, NT_SYNTAX_ID_DWORD},
  217. { TEXT("Name"),
  218. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  219. PROPERTY_READABLE, 1, NT_SYNTAX_ID_LPTSTR }
  220. };
  221. DWORD gdwGroupTableSize = sizeof(GroupClass)/sizeof(PROPERTYINFO);
  222. PROPERTYINFO ServiceClass[] =
  223. { { TEXT("HostComputer"), // FSServiceConfiguration
  224. TEXT(""), TEXT("ADsPath"), MAX_STRLEN, 0, FALSE,
  225. PROPERTY_READABLE, 1, NT_SYNTAX_ID_LPTSTR },
  226. { TEXT("DisplayName"),
  227. TEXT(""), TEXT("String"), 256, 0, FALSE,
  228. PROPERTY_RW, 2, NT_SYNTAX_ID_LPTSTR },
  229. { TEXT("ServiceType"),
  230. TEXT(""), TEXT("Integer"), MAX_LONG, MIN_LONG, FALSE,
  231. PROPERTY_RW, 1, NT_SYNTAX_ID_DWORD},
  232. { TEXT("StartType"),
  233. TEXT(""), TEXT("Integer"), MAX_LONG, MIN_LONG, FALSE,
  234. PROPERTY_RW, 1, NT_SYNTAX_ID_DWORD },
  235. { TEXT("Path"),
  236. TEXT(""), TEXT("Path"), MAX_PATH, 0, FALSE,
  237. PROPERTY_RW, 1, NT_SYNTAX_ID_LPTSTR },
  238. { TEXT("ErrorControl"),
  239. TEXT(""), TEXT("Integer"), MAX_LONG, MIN_LONG, FALSE,
  240. PROPERTY_RW, 1, NT_SYNTAX_ID_DWORD },
  241. { TEXT("LoadOrderGroup"),
  242. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  243. PROPERTY_RW, 1, NT_SYNTAX_ID_LPTSTR },
  244. { TEXT("ServiceAccountName"),
  245. TEXT(""), TEXT("String"), DNLEN+UNLEN+2, 0, FALSE,
  246. PROPERTY_READABLE, 1, NT_SYNTAX_ID_LPTSTR},
  247. { TEXT("Dependencies"),
  248. TEXT(""), TEXT("String"), MAX_STRLEN, 0, TRUE,
  249. PROPERTY_RW, 1, NT_SYNTAX_ID_NulledString},
  250. { TEXT("Name"),
  251. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  252. PROPERTY_READABLE, 1, NT_SYNTAX_ID_LPTSTR }
  253. };
  254. DWORD gdwServiceTableSize = sizeof(ServiceClass)/sizeof(PROPERTYINFO);
  255. PROPERTYINFO FileServiceClass[] =
  256. { { TEXT("HostComputer"), // FSServiceConfiguration
  257. TEXT(""), TEXT("ADsPath"), MAX_STRLEN, 0, FALSE,
  258. PROPERTY_READABLE, 1, NT_SYNTAX_ID_LPTSTR },
  259. { TEXT("DisplayName"),
  260. TEXT(""), TEXT("String"), 256, 0, FALSE,
  261. PROPERTY_RW, 1, NT_SYNTAX_ID_LPTSTR },
  262. { TEXT("Version"),
  263. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  264. PROPERTY_RW, 1, NT_SYNTAX_ID_LPTSTR },
  265. { TEXT("ServiceType"),
  266. TEXT(""), TEXT("Integer"), MAX_LONG, MIN_LONG, FALSE,
  267. PROPERTY_RW, 1, NT_SYNTAX_ID_DWORD},
  268. { TEXT("StartType"),
  269. TEXT(""), TEXT("Integer"), MAX_LONG, MIN_LONG, FALSE,
  270. PROPERTY_RW, 1, NT_SYNTAX_ID_DWORD },
  271. { TEXT("Path"),
  272. TEXT(""), TEXT("Path"), MAX_PATH, 0, FALSE,
  273. PROPERTY_RW, 1, NT_SYNTAX_ID_LPTSTR },
  274. { TEXT("ErrorControl"),
  275. TEXT(""), TEXT("Integer"), MAX_LONG, MIN_LONG, FALSE,
  276. PROPERTY_RW, 1, NT_SYNTAX_ID_DWORD },
  277. { TEXT("LoadOrderGroup"),
  278. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  279. PROPERTY_RW, 1, NT_SYNTAX_ID_LPTSTR },
  280. { TEXT("ServiceAccountName"),
  281. TEXT(""), TEXT("String"), DNLEN+UNLEN+2, 0, FALSE,
  282. PROPERTY_RW, 1, NT_SYNTAX_ID_LPTSTR},
  283. { TEXT("Dependencies"),
  284. TEXT(""), TEXT("String"), MAX_STRLEN, 0, TRUE,
  285. PROPERTY_RW, 1, NT_SYNTAX_ID_NulledString},
  286. { TEXT("Description"), // FSFileServiceGeneralInfo
  287. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  288. PROPERTY_RW, 2, NT_SYNTAX_ID_LPTSTR },
  289. { TEXT("MaxUserCount"),
  290. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  291. PROPERTY_READABLE, 2, NT_SYNTAX_ID_DWORD },
  292. { TEXT("Name"),
  293. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  294. PROPERTY_READABLE, 2, NT_SYNTAX_ID_LPTSTR }
  295. };
  296. DWORD gdwFileServiceTableSize = sizeof(FileServiceClass)/sizeof(PROPERTYINFO);
  297. PROPERTYINFO SessionClass[] =
  298. { { TEXT("User"), // ro, FSSessionGeneralInfo
  299. TEXT(""), TEXT("String"), UNLEN+1, 0, FALSE,
  300. PROPERTY_READABLE, 1, NT_SYNTAX_ID_LPTSTR },
  301. { TEXT("Computer"), // ro
  302. TEXT(""), TEXT("String"), UNCLEN+1, 0, FALSE,
  303. PROPERTY_READABLE, 1, NT_SYNTAX_ID_LPTSTR},
  304. { TEXT("ConnectTime"), // ro
  305. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  306. PROPERTY_READABLE, 1, NT_SYNTAX_ID_DATE },
  307. { TEXT("IdleTime"), // ro
  308. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  309. PROPERTY_READABLE, 1, NT_SYNTAX_ID_DATE},
  310. { TEXT("Name"),
  311. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  312. PROPERTY_READABLE, 1, NT_SYNTAX_ID_LPTSTR }
  313. };
  314. DWORD gdwSessionTableSize = sizeof(SessionClass)/sizeof(PROPERTYINFO);
  315. PROPERTYINFO ResourceClass[] =
  316. { { TEXT("User"), // ro, FSResourceGeneralInfo
  317. TEXT(""), TEXT("String"), UNLEN+1, 0, FALSE,
  318. PROPERTY_READABLE, 1, NT_SYNTAX_ID_LPTSTR },
  319. { TEXT("Path"), // ro
  320. TEXT(""), TEXT("Path"), MAX_PATH, 0, FALSE,
  321. PROPERTY_READABLE, 1, NT_SYNTAX_ID_LPTSTR },
  322. { TEXT("LockCount"), // ro
  323. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  324. PROPERTY_READABLE, 1, NT_SYNTAX_ID_DWORD},
  325. { TEXT("Name"),
  326. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  327. PROPERTY_READABLE, 1, NT_SYNTAX_ID_LPTSTR }
  328. };
  329. DWORD gdwResourceTableSize = sizeof(ResourceClass)/sizeof(PROPERTYINFO);
  330. PROPERTYINFO FileShareClass[] =
  331. { { TEXT("CurrentUserCount"), // ro, FSFileShareGeneralInfo
  332. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  333. PROPERTY_READABLE, 2, NT_SYNTAX_ID_DWORD },
  334. { TEXT("Description"),
  335. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  336. PROPERTY_RW, 2, NT_SYNTAX_ID_LPTSTR },
  337. { TEXT("HostComputer"),
  338. TEXT(""), TEXT("ADsPath"), MAX_STRLEN, 0, FALSE,
  339. PROPERTY_READABLE, 2, NT_SYNTAX_ID_LPTSTR },
  340. { TEXT("Path"),
  341. TEXT(""), TEXT("Path"), MAX_PATH, 0, FALSE,
  342. PROPERTY_RW, 2, NT_SYNTAX_ID_LPTSTR },
  343. { TEXT("MaxUserCount"),
  344. TEXT(""), TEXT("Integer"), MAX_LONG, -1, FALSE,
  345. PROPERTY_RW, 2, NT_SYNTAX_ID_DWORD },
  346. { TEXT("Name"),
  347. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  348. PROPERTY_READABLE, 2, NT_SYNTAX_ID_LPTSTR }
  349. };
  350. DWORD gdwFileShareTableSize = sizeof(FileShareClass)/sizeof(PROPERTYINFO);
  351. PROPERTYINFO FPNWFileServiceClass[] =
  352. { { TEXT("HostComputer"), // FSServiceConfiguration
  353. TEXT(""), TEXT("ADsPath"), MAX_STRLEN, 0, FALSE,
  354. PROPERTY_READABLE, 1, NT_SYNTAX_ID_LPTSTR },
  355. { TEXT("DisplayName"),
  356. TEXT(""), TEXT("String"), 256, 0, FALSE,
  357. PROPERTY_RW, 1, NT_SYNTAX_ID_LPTSTR },
  358. { TEXT("Version"),
  359. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  360. PROPERTY_RW, 1, NT_SYNTAX_ID_LPTSTR },
  361. { TEXT("ServiceType"),
  362. TEXT(""), TEXT("Integer"), MAX_LONG, MIN_LONG, FALSE,
  363. PROPERTY_RW, 1, NT_SYNTAX_ID_DWORD},
  364. { TEXT("StartType"),
  365. TEXT(""), TEXT("Integer"), MAX_LONG, MIN_LONG, FALSE,
  366. PROPERTY_RW, 1, NT_SYNTAX_ID_DWORD },
  367. { TEXT("Path"),
  368. TEXT(""), TEXT("Path"), MAX_PATH, 0, FALSE,
  369. PROPERTY_RW, 1, NT_SYNTAX_ID_LPTSTR },
  370. { TEXT("ErrorControl"),
  371. TEXT(""), TEXT("Integer"), MAX_LONG, MIN_LONG, FALSE,
  372. PROPERTY_RW, 1, NT_SYNTAX_ID_DWORD },
  373. { TEXT("LoadOrderGroup"),
  374. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  375. PROPERTY_RW, 1, NT_SYNTAX_ID_LPTSTR },
  376. { TEXT("ServiceAccountName"),
  377. TEXT(""), TEXT("String"), DNLEN+UNLEN+2, 0, FALSE,
  378. PROPERTY_RW, 1, NT_SYNTAX_ID_LPTSTR},
  379. { TEXT("Dependencies"),
  380. TEXT(""), TEXT("String"), MAX_STRLEN, 0, TRUE,
  381. PROPERTY_RW, 1, NT_SYNTAX_ID_NulledString},
  382. { TEXT("Description"), // FSFileServiceGeneralInfo
  383. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  384. PROPERTY_RW, 2, NT_SYNTAX_ID_LPTSTR },
  385. { TEXT("MaxUserCount"),
  386. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  387. PROPERTY_RW, 2, NT_SYNTAX_ID_DWORD },
  388. { TEXT("Name"),
  389. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  390. PROPERTY_READABLE, 2, NT_SYNTAX_ID_LPTSTR }
  391. };
  392. DWORD gdwFPNWFileServiceTableSize = sizeof(FPNWFileServiceClass)/sizeof(PROPERTYINFO);
  393. PROPERTYINFO FPNWSessionClass[] =
  394. { { TEXT("User"), // ro, FSSessionGeneralInfo
  395. TEXT(""), TEXT("String"), UNLEN+1, 0, FALSE,
  396. PROPERTY_READABLE, 1, NT_SYNTAX_ID_LPTSTR },
  397. { TEXT("Computer"), // ro
  398. TEXT(""), TEXT("String"), UNCLEN+1, 0, FALSE,
  399. PROPERTY_READABLE, 1, NT_SYNTAX_ID_LPTSTR},
  400. { TEXT("ConnectTime"), // ro
  401. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  402. PROPERTY_READABLE, 1, NT_SYNTAX_ID_DATE },
  403. { TEXT("Name"),
  404. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  405. PROPERTY_READABLE, 1, NT_SYNTAX_ID_LPTSTR }
  406. };
  407. DWORD gdwFPNWSessionTableSize = sizeof(FPNWSessionClass)/sizeof(PROPERTYINFO);
  408. PROPERTYINFO FPNWResourceClass[] =
  409. { { TEXT("User"), // ro, FSResourceGeneralInfo
  410. TEXT(""), TEXT("String"), UNLEN+1, 0, FALSE,
  411. PROPERTY_READABLE, 1, NT_SYNTAX_ID_LPTSTR },
  412. { TEXT("Path"), // ro
  413. TEXT(""), TEXT("Path"), MAX_PATH, 0, FALSE,
  414. PROPERTY_READABLE, 1, NT_SYNTAX_ID_LPTSTR },
  415. { TEXT("LockCount"), // ro
  416. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  417. PROPERTY_READABLE, 1, NT_SYNTAX_ID_DWORD},
  418. { TEXT("Name"),
  419. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  420. PROPERTY_READABLE, 1, NT_SYNTAX_ID_LPTSTR }
  421. };
  422. DWORD gdwFPNWResourceTableSize = sizeof(FPNWResourceClass)/sizeof(PROPERTYINFO);
  423. PROPERTYINFO FPNWFileShareClass[] =
  424. { { TEXT("CurrentUserCount"), // ro, FSFileShareGeneralInfo
  425. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  426. PROPERTY_READABLE, 1, NT_SYNTAX_ID_DWORD },
  427. { TEXT("HostComputer"),
  428. TEXT(""), TEXT("ADsPath"), MAX_STRLEN, 0, FALSE,
  429. PROPERTY_READABLE, 1, NT_SYNTAX_ID_LPTSTR },
  430. { TEXT("Path"),
  431. TEXT(""), TEXT("Path"), MAX_PATH, 0, FALSE,
  432. PROPERTY_RW, 1, NT_SYNTAX_ID_LPTSTR },
  433. { TEXT("MaxUserCount"),
  434. TEXT(""), TEXT("Integer"), MAX_LONG, -1, FALSE,
  435. PROPERTY_RW, 1, NT_SYNTAX_ID_DWORD },
  436. { TEXT("Name"),
  437. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  438. PROPERTY_READABLE, 1, NT_SYNTAX_ID_LPTSTR }
  439. };
  440. DWORD gdwFPNWFileShareTableSize = sizeof(FPNWFileShareClass)/sizeof(PROPERTYINFO);
  441. PROPERTYINFO PrintQueueClass[] =
  442. { { TEXT("PrinterPath"), // FSPrintQueueGeneralInfo
  443. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  444. PROPERTY_READABLE, 2, NT_SYNTAX_ID_LPTSTR },
  445. { TEXT("PrinterName"), // friendly name
  446. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  447. PROPERTY_RW, 2, NT_SYNTAX_ID_LPTSTR },
  448. { TEXT("Model"),
  449. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  450. PROPERTY_RW, 2, NT_SYNTAX_ID_LPTSTR },
  451. { TEXT("Datatype"),
  452. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  453. PROPERTY_RW, 2, NT_SYNTAX_ID_LPTSTR },
  454. { TEXT("PrintProcessor"),
  455. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  456. PROPERTY_RW, 2, NT_SYNTAX_ID_LPTSTR },
  457. { TEXT("Description"),
  458. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  459. PROPERTY_RW, 2, NT_SYNTAX_ID_LPTSTR },
  460. { TEXT("Location"),
  461. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  462. PROPERTY_RW, 2, NT_SYNTAX_ID_LPTSTR },
  463. { TEXT("StartTime"),
  464. TEXT(""), TEXT("Time"), 0, 0, FALSE,
  465. PROPERTY_RW, 2, NT_SYNTAX_ID_DATE },
  466. { TEXT("UntilTime"),
  467. TEXT(""), TEXT("Time"), 0, 0, FALSE,
  468. PROPERTY_RW, 2, NT_SYNTAX_ID_DATE },
  469. { TEXT("DefaultJobPriority"),
  470. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  471. PROPERTY_RW, 2, NT_SYNTAX_ID_DWORD},
  472. { TEXT("JobCount"),
  473. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  474. PROPERTY_READABLE, 2, NT_SYNTAX_ID_DWORD},
  475. { TEXT("Priority"),
  476. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  477. PROPERTY_RW, 2, NT_SYNTAX_ID_DWORD },
  478. { TEXT("Attributes"),
  479. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  480. PROPERTY_RW, 2, NT_SYNTAX_ID_DWORD},
  481. { TEXT("BannerPage"),
  482. TEXT(""), TEXT("Path"), MAX_PATH, 0, FALSE,
  483. PROPERTY_RW, 2, NT_SYNTAX_ID_LPTSTR },
  484. { TEXT("PrintDevices"),
  485. TEXT(""), TEXT("String"), MAX_STRLEN, 0, TRUE,
  486. PROPERTY_RW, 2, NT_SYNTAX_ID_DelimitedString } ,
  487. { TEXT("ObjectGUID"),
  488. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  489. PROPERTY_RW, 7, NT_SYNTAX_ID_LPTSTR },
  490. { TEXT("Action"),
  491. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  492. PROPERTY_RW, 7, NT_SYNTAX_ID_DWORD },
  493. { TEXT("Name"),
  494. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  495. PROPERTY_READABLE, 2, NT_SYNTAX_ID_LPTSTR }
  496. };
  497. DWORD gdwPrinterTableSize = sizeof(PrintQueueClass)/sizeof(PROPERTYINFO);
  498. PROPERTYINFO PrintJobClass[] =
  499. { { TEXT("HostPrintQueue"), // ro, FSPrintJobGeneralInfo
  500. TEXT(""), TEXT("ADsPath"), MAX_STRLEN, 0, FALSE,
  501. PROPERTY_READABLE, 1, NT_SYNTAX_ID_LPTSTR },
  502. { TEXT("User"), // ro
  503. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  504. PROPERTY_READABLE, 1, NT_SYNTAX_ID_LPTSTR },
  505. { TEXT("TimeSubmitted"), // ro
  506. TEXT(""), TEXT("Time"), 0, 0, FALSE,
  507. PROPERTY_READABLE, 1, NT_SYNTAX_ID_SYSTEMTIME },
  508. { TEXT("TotalPages"), // ro
  509. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  510. PROPERTY_READABLE, 1, NT_SYNTAX_ID_DWORD },
  511. { TEXT("Size"), // ro
  512. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  513. PROPERTY_READABLE, 2, NT_SYNTAX_ID_DWORD},
  514. { TEXT("Description"),
  515. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  516. PROPERTY_RW, 1, NT_SYNTAX_ID_LPTSTR },
  517. { TEXT("Priority"),
  518. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  519. PROPERTY_RW, 1, NT_SYNTAX_ID_DWORD},
  520. { TEXT("StartTime"),
  521. TEXT(""), TEXT("Time"), 0, 0, FALSE,
  522. PROPERTY_RW, 2, NT_SYNTAX_ID_DATE },
  523. { TEXT("UntilTime"),
  524. TEXT(""), TEXT("Time"), 0, 0, FALSE,
  525. PROPERTY_RW, 2, NT_SYNTAX_ID_DATE },
  526. { TEXT("Notify"),
  527. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  528. PROPERTY_RW, 2, NT_SYNTAX_ID_LPTSTR },
  529. { TEXT("TimeElapsed"), // ro
  530. TEXT(""), TEXT("Interval"), MAX_LONG, 0, FALSE,
  531. PROPERTY_READABLE, 2, NT_SYNTAX_ID_DWORD },
  532. { TEXT("PagesPrinted"), // ro
  533. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  534. PROPERTY_READABLE, 2, NT_SYNTAX_ID_DWORD },
  535. { TEXT("Position"),
  536. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  537. PROPERTY_RW, 2, NT_SYNTAX_ID_DWORD },
  538. { TEXT("ObjectGUID"),
  539. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  540. PROPERTY_RW, 7, NT_SYNTAX_ID_LPTSTR },
  541. { TEXT("Action"),
  542. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  543. PROPERTY_RW, 7, NT_SYNTAX_ID_DWORD },
  544. { TEXT("Name"),
  545. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  546. PROPERTY_READABLE, 2, NT_SYNTAX_ID_LPTSTR }
  547. };
  548. DWORD gdwJobTableSize = sizeof(PrintJobClass)/sizeof(PROPERTYINFO);
  549. CLASSINFO g_aWinNTClasses[] =
  550. {
  551. // Domain
  552. { DOMAIN_SCHEMA_NAME, &CLSID_WinNTDomain, &IID_IADsDomain,
  553. TEXT(""), FALSE,
  554. NULL,
  555. TEXT("MinPasswordLength,MinPasswordAge,MaxPasswordAge,MaxBadPasswordsAllowed,")
  556. TEXT("PasswordHistoryLength,AutoUnlockInterval,LockoutObservationInterval,Name"),
  557. NULL, TEXT("Computer,User,Group"),TRUE,
  558. TEXT(""), 0,
  559. DomainClass, sizeof(DomainClass)/sizeof(PROPERTYINFO) },
  560. // Computer
  561. { COMPUTER_SCHEMA_NAME, &CLSID_WinNTComputer, &IID_IADsComputer,
  562. TEXT(""), FALSE,
  563. NULL,
  564. TEXT("Owner,Division,OperatingSystem,OperatingSystemVersion,")
  565. TEXT("Processor,ProcessorCount,Name"),
  566. TEXT("Domain"), TEXT("User,Group,Service,FileService,PrintQueue"), TRUE,
  567. TEXT(""), 0,
  568. ComputerClass, sizeof(ComputerClass)/sizeof(PROPERTYINFO) },
  569. // User
  570. { USER_SCHEMA_NAME, &CLSID_WinNTUser, &IID_IADsUser,
  571. TEXT(""), FALSE,
  572. NULL,
  573. TEXT("Description,FullName,AccountExpirationDate,")
  574. TEXT("BadPasswordAttempts,HomeDirDrive,HomeDirectory,")
  575. TEXT("LastLogin,LastLogoff,LoginHours,LoginScript,LoginWorkstations,")
  576. TEXT("MaxLogins,MaxPasswordAge,MaxStorage,")
  577. TEXT("MinPasswordAge,MinPasswordLength,objectSid,")
  578. TEXT("Parameters,PasswordAge,PasswordExpired,")
  579. TEXT("PasswordHistoryLength,PrimaryGroupID,Profile,UserFlags,")
  580. TEXT("Name"),
  581. TEXT("Domain,Computer"), NULL, FALSE,
  582. TEXT(""), 0,
  583. UserClass, sizeof(UserClass)/sizeof(PROPERTYINFO) },
  584. // Group
  585. { GROUP_SCHEMA_NAME, &CLSID_WinNTGroup, &IID_IADsGroup,
  586. TEXT(""), FALSE,
  587. TEXT("groupType"),
  588. TEXT("Description,objectSid,Name"),
  589. TEXT("Domain,Computer"), NULL, FALSE,
  590. TEXT(""), 0,
  591. GroupClass, sizeof(GroupClass)/sizeof(PROPERTYINFO) },
  592. { SERVICE_SCHEMA_NAME, &CLSID_WinNTService, &IID_IADsService,
  593. TEXT(""), FALSE,
  594. TEXT("StartType,ServiceType,")
  595. TEXT("DisplayName,Path,ErrorControl"),
  596. TEXT("HostComputer,")
  597. TEXT("LoadOrderGroup,ServiceAccountName,")
  598. TEXT("Dependencies,Name"),
  599. TEXT("Computer"), NULL, FALSE,
  600. TEXT(""), 0,
  601. ServiceClass, sizeof(ServiceClass)/sizeof(PROPERTYINFO) },
  602. { FILESERVICE_SCHEMA_NAME, &CLSID_WinNTFileService, &IID_IADsFileService,
  603. TEXT(""), FALSE,
  604. NULL,
  605. TEXT("HostComputer,DisplayName,Version,ServiceType,StartType,")
  606. TEXT("ErrorControl,LoadOrderGroup,ServiceAccountName,Dependencies,")
  607. TEXT("Description,MaxUserCount,Name"),
  608. TEXT("Computer"), TEXT("FileShare"), TRUE,
  609. TEXT(""), 0,
  610. FileServiceClass, sizeof(FileServiceClass)/sizeof(PROPERTYINFO) },
  611. { SESSION_SCHEMA_NAME, &CLSID_WinNTSession, &IID_IADsSession,
  612. TEXT(""), FALSE,
  613. NULL,
  614. TEXT("User,Computer,ConnectTime,IdleTime,Name"),
  615. NULL, NULL, FALSE,
  616. TEXT(""), 0,
  617. SessionClass, sizeof(SessionClass)/sizeof(PROPERTYINFO) },
  618. { RESOURCE_SCHEMA_NAME, &CLSID_WinNTResource, &IID_IADsResource,
  619. TEXT(""), FALSE,
  620. NULL,
  621. TEXT("User,Path,LockCount,Name"),
  622. NULL, NULL, FALSE,
  623. TEXT(""), 0,
  624. ResourceClass, sizeof(ResourceClass)/sizeof(PROPERTYINFO) },
  625. { FILESHARE_SCHEMA_NAME, &CLSID_WinNTFileShare, &IID_IADsFileShare,
  626. TEXT(""), FALSE,
  627. TEXT("Path,MaxUserCount"),
  628. TEXT("CurrentUserCount,Description,HostComputer,Name"),
  629. TEXT("FileService"),
  630. NULL, FALSE,
  631. TEXT(""), 0,
  632. FileShareClass, sizeof(FileShareClass)/sizeof(PROPERTYINFO) },
  633. { FPNW_FILESERVICE_SCHEMA_NAME, &CLSID_WinNTFileService, &IID_IADsFileService,
  634. TEXT(""), FALSE,
  635. NULL,
  636. TEXT("HostComputer,DisplayName,Version,ServiceType,")
  637. TEXT("StartType,Path,ErrorControl,LoadOrderGroup,")
  638. TEXT("Description,MaxUserCount,Name"),
  639. TEXT("Computer"), TEXT("FileShare"), TRUE,
  640. TEXT(""), 0,
  641. FileServiceClass, sizeof(FileServiceClass)/sizeof(PROPERTYINFO) },
  642. { FPNW_SESSION_SCHEMA_NAME, &CLSID_WinNTSession, &IID_IADsSession,
  643. TEXT(""), FALSE,
  644. NULL,
  645. TEXT("User,Computer,ConnectTime,Name"),
  646. NULL, NULL, FALSE,
  647. TEXT(""), 0,
  648. SessionClass, sizeof(SessionClass)/sizeof(PROPERTYINFO) },
  649. { FPNW_RESOURCE_SCHEMA_NAME, &CLSID_WinNTResource, &IID_IADsResource,
  650. TEXT(""), FALSE,
  651. NULL,
  652. TEXT("User,Path,LockCount,Name"),
  653. NULL, NULL, FALSE,
  654. TEXT(""), 0,
  655. ResourceClass, sizeof(ResourceClass)/sizeof(PROPERTYINFO) },
  656. { FPNW_FILESHARE_SCHEMA_NAME, &CLSID_WinNTFileShare, &IID_IADsFileShare,
  657. TEXT(""), FALSE,
  658. TEXT("Path,MaxUserCount"),
  659. TEXT("CurrentUserCount,HostComputer,Name"),
  660. TEXT("FileService"),
  661. NULL, FALSE,
  662. TEXT(""), 0,
  663. FileShareClass, sizeof(FileShareClass)/sizeof(PROPERTYINFO) },
  664. { PRINTER_SCHEMA_NAME, &CLSID_WinNTPrintQueue, &IID_IADsPrintQueue,
  665. TEXT(""), FALSE,
  666. TEXT("PrinterName,Model,Datatype,")
  667. TEXT("PrintProcessor,PrintDevices"),
  668. TEXT("HostComputer,Description,")
  669. TEXT("Location,StartTime,UntilTime,DefaultJobPriority,JobCount,Priority,")
  670. TEXT("Attributes,BannerPage,ObjectGUID,Action,Name"),
  671. TEXT("Computer"), NULL, FALSE,
  672. TEXT(""), 0,
  673. PrintQueueClass, sizeof(PrintQueueClass)/sizeof(PROPERTYINFO) },
  674. { PRINTJOB_SCHEMA_NAME, &CLSID_WinNTPrintJob, &IID_IADsPrintJob,
  675. TEXT(""), FALSE,
  676. NULL,
  677. TEXT("HostPrintQueue,User,TimeSubmitted,TotalPages,Size,Description,")
  678. TEXT("Priority,StartTime,UntilTime,Notify,TimeElapsed,PagesPrinted,")
  679. TEXT("Position,Name"),
  680. NULL, NULL, FALSE,
  681. TEXT(""), 0,
  682. PrintJobClass, sizeof(PrintJobClass)/sizeof(PROPERTYINFO) }
  683. };
  684. SYNTAXINFO g_aWinNTSyntax[] =
  685. { { TEXT("Boolean"), VT_BOOL },
  686. { TEXT("Counter"), VT_I4 },
  687. { TEXT("ADsPath"), VT_BSTR },
  688. { TEXT("EmailAddress"), VT_BSTR },
  689. { TEXT("FaxNumber"), VT_BSTR },
  690. { TEXT("Integer"), VT_I4 },
  691. { TEXT("Interval"), VT_I4 },
  692. { TEXT("List"), VT_VARIANT }, // VT_BSTR | VT_ARRAY
  693. { TEXT("NetAddress"), VT_BSTR },
  694. { TEXT("OctetString"), VT_VARIANT }, // VT_UI1| VT_ARRAY
  695. { TEXT("Path"), VT_BSTR },
  696. { TEXT("PhoneNumber"), VT_BSTR },
  697. { TEXT("PostalAddress"), VT_BSTR },
  698. { TEXT("SmallInterval"), VT_I4 },
  699. { TEXT("String"), VT_BSTR },
  700. { TEXT("Time"), VT_DATE }
  701. };
  702. DWORD g_cWinNTClasses = (sizeof(g_aWinNTClasses)/sizeof(g_aWinNTClasses[0]));
  703. DWORD g_cWinNTSyntax = (sizeof(g_aWinNTSyntax)/sizeof(g_aWinNTSyntax[0]));
  704. CObjNameCache * pgPDCNameCache = NULL;
  705. PROPERTYINFO g_aWinNTProperties[] =
  706. //
  707. // domain properties
  708. //
  709. { { TEXT("MinPasswordLength"), // FSDomainPassword
  710. TEXT(""), TEXT("Integer"), LM20_PWLEN+1, 0, FALSE,
  711. PROPERTY_RW, 0, NT_SYNTAX_ID_DWORD },
  712. { TEXT("MinPasswordAge"),
  713. TEXT(""), TEXT("Interval"), TIMEQ_FOREVER, 0, FALSE,
  714. PROPERTY_RW, 0, NT_SYNTAX_ID_DWORD },
  715. { TEXT("MaxPasswordAge"),
  716. TEXT(""),TEXT("Interval"), TIMEQ_FOREVER, ONE_DAY, FALSE,
  717. PROPERTY_RW, 0, NT_SYNTAX_ID_DWORD },
  718. { TEXT("MaxBadPasswordsAllowed"),
  719. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  720. PROPERTY_RW, 3, NT_SYNTAX_ID_DWORD },
  721. //
  722. // NetAPI state DEF_MAX_PWHIST (8), but NetAPI devlpr confirm
  723. // current is 1024. Ignore Net Account - UNIQUEPWD limit.
  724. // User DEF_MAX_PWHIST to be safe for now.
  725. // not repeated for user ??
  726. //
  727. { TEXT("PasswordHistoryLength"),
  728. TEXT(""), TEXT("Integer"), DEF_MAX_PWHIST, 0, FALSE,
  729. PROPERTY_RW, 0, NT_SYNTAX_ID_DWORD},
  730. { TEXT("AutoUnlockInterval"),
  731. TEXT(""), TEXT("Interval"), MAX_LONG, 0, FALSE,
  732. PROPERTY_RW, 3, NT_SYNTAX_ID_DWORD },
  733. { TEXT("LockoutObservationInterval"),
  734. TEXT(""), TEXT("Interval"), MAX_LONG, 0, FALSE,
  735. PROPERTY_RW, 3, NT_SYNTAX_ID_DWORD },
  736. // Computer Properties
  737. { TEXT("Owner"),
  738. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  739. PROPERTY_RW, 4, NT_SYNTAX_ID_LPTSTR },
  740. { TEXT("Division"),
  741. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  742. PROPERTY_RW, 4, NT_SYNTAX_ID_LPTSTR },
  743. { TEXT("OperatingSystem"), // ro
  744. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  745. PROPERTY_RW, 4, NT_SYNTAX_ID_LPTSTR},
  746. { TEXT("OperatingSystemVersion"), // ro
  747. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  748. PROPERTY_RW, 4, NT_SYNTAX_ID_LPTSTR},
  749. { TEXT("Processor"),
  750. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  751. PROPERTY_RW, 4, NT_SYNTAX_ID_LPTSTR },
  752. { TEXT("ProcessorCount"),
  753. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  754. PROPERTY_RW, 4, NT_SYNTAX_ID_LPTSTR },
  755. // User Properties
  756. { TEXT("Description"), // FSUserBusinessInfo
  757. TEXT(""), TEXT("String"), MAXCOMMENTSZ+1, 0, FALSE,
  758. PROPERTY_RW, 3, NT_SYNTAX_ID_LPTSTR },
  759. { TEXT("FullName"),
  760. TEXT(""), TEXT("String"), MAXCOMMENTSZ+1, 0, FALSE,
  761. PROPERTY_RW, 3, NT_SYNTAX_ID_LPTSTR},
  762. { TEXT("AccountExpirationDate"),
  763. TEXT(""), TEXT("Time"), 0, 0, FALSE,
  764. PROPERTY_RW, 3, NT_SYNTAX_ID_DATE_1970},
  765. { TEXT("PasswordAge"),
  766. TEXT(""), TEXT("Time"), 0, 0, FALSE,
  767. PROPERTY_RW, 3, NT_SYNTAX_ID_DATE_1970},
  768. { TEXT("UserFlags"),
  769. TEXT(""), TEXT("Integer"), 0, 0, FALSE,
  770. PROPERTY_RW, 3, NT_SYNTAX_ID_DWORD},
  771. { TEXT("LoginWorkstations"),
  772. TEXT(""), TEXT("String"), MAX_STRLEN, 0, TRUE,
  773. PROPERTY_RW, 3, NT_SYNTAX_ID_DelimitedString },
  774. { TEXT("BadPasswordAttempts"), //ro
  775. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  776. PROPERTY_READABLE, 3, NT_SYNTAX_ID_DWORD },
  777. { TEXT("MaxLogins"),
  778. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  779. PROPERTY_RW, 3, NT_SYNTAX_ID_DWORD },
  780. { TEXT("MaxStorage"),
  781. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  782. PROPERTY_RW, 3, NT_SYNTAX_ID_DWORD },
  783. // USER_MAX_STORAGE_UNLIMITED
  784. { TEXT("PasswordExpired"),
  785. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  786. PROPERTY_RW, 3, NT_SYNTAX_ID_DWORD },
  787. { TEXT("PasswordExpirationDate"),
  788. TEXT(""), TEXT("Time"), 0, 0, FALSE,
  789. PROPERTY_RW, 3, NT_SYNTAX_ID_DATE_1970 },
  790. { TEXT("LastLogin"), // ro
  791. TEXT(""), TEXT("Time"), 0, 0, FALSE,
  792. PROPERTY_READABLE, 3, NT_SYNTAX_ID_DATE_1970 },
  793. { TEXT("LastLogoff"), // ro
  794. TEXT(""), TEXT("Time"), 0, 0, FALSE,
  795. PROPERTY_READABLE, 3, NT_SYNTAX_ID_DATE_1970 },
  796. { TEXT("HomeDirectory"),
  797. TEXT(""), TEXT("Path"), MAX_PATH, 0, FALSE,
  798. PROPERTY_RW, 3, NT_SYNTAX_ID_LPTSTR },
  799. { TEXT("Profile"),
  800. TEXT(""), TEXT("Path"), MAX_PATH, 0, FALSE,
  801. PROPERTY_RW, 3, NT_SYNTAX_ID_LPTSTR},
  802. { TEXT("Parameters"),
  803. TEXT(""), TEXT("String"), MAX_PATH, 0, FALSE,
  804. PROPERTY_RW, 3, NT_SYNTAX_ID_LPTSTR},
  805. { TEXT("HomeDirDrive"),
  806. TEXT(""), TEXT("String"), MAX_PATH, 0, FALSE,
  807. PROPERTY_RW, 3, NT_SYNTAX_ID_LPTSTR},
  808. { TEXT("LoginScript"),
  809. TEXT(""), TEXT("Path"), MAX_PATH, 0, FALSE,
  810. PROPERTY_RW, 3, NT_SYNTAX_ID_LPTSTR },
  811. { TEXT("LoginHours"),
  812. TEXT(""), TEXT("OctetString"), 0, 0, FALSE,
  813. PROPERTY_RW, 3, NT_SYNTAX_ID_OCTETSTRING},
  814. { TEXT("PrimaryGroupID"),
  815. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  816. PROPERTY_RW, 3, NT_SYNTAX_ID_DWORD },
  817. { TEXT("objectSid"),
  818. TEXT(""), TEXT("OctetString"), 0, 0, FALSE,
  819. PROPERTY_READABLE, 20, NT_SYNTAX_ID_OCTETSTRING},
  820. // Group Properties
  821. { TEXT("groupType"),
  822. TEXT(""), TEXT("Integer"), 0, 0, FALSE,
  823. PROPERTY_RW, 1, NT_SYNTAX_ID_DWORD },
  824. //
  825. // Description (User)
  826. //
  827. // Service Properties
  828. { TEXT("HostComputer"), // FSServiceConfiguration
  829. TEXT(""), TEXT("ADsPath"), MAX_STRLEN, 0, FALSE,
  830. PROPERTY_READABLE, 1, NT_SYNTAX_ID_LPTSTR },
  831. { TEXT("DisplayName"),
  832. TEXT(""), TEXT("String"), 256, 0, FALSE,
  833. PROPERTY_RW, 2, NT_SYNTAX_ID_LPTSTR },
  834. { TEXT("ServiceType"),
  835. TEXT(""), TEXT("Integer"), MAX_LONG, MIN_LONG, FALSE,
  836. PROPERTY_RW, 1, NT_SYNTAX_ID_DWORD},
  837. { TEXT("StartType"),
  838. TEXT(""), TEXT("Integer"), MAX_LONG, MIN_LONG, FALSE,
  839. PROPERTY_RW, 1, NT_SYNTAX_ID_DWORD },
  840. { TEXT("Path"),
  841. TEXT(""), TEXT("Path"), MAX_PATH, 0, FALSE,
  842. PROPERTY_RW, 1, NT_SYNTAX_ID_LPTSTR },
  843. { TEXT("ErrorControl"),
  844. TEXT(""), TEXT("Integer"), MAX_LONG, MIN_LONG, FALSE,
  845. PROPERTY_RW, 1, NT_SYNTAX_ID_DWORD },
  846. { TEXT("LoadOrderGroup"),
  847. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  848. PROPERTY_RW, 1, NT_SYNTAX_ID_LPTSTR },
  849. { TEXT("ServiceAccountName"),
  850. TEXT(""), TEXT("String"), DNLEN+UNLEN+2, 0, FALSE,
  851. PROPERTY_RW, 1, NT_SYNTAX_ID_LPTSTR},
  852. { TEXT("Dependencies"),
  853. TEXT(""), TEXT("String"), MAX_STRLEN, 0, TRUE,
  854. PROPERTY_RW, 1, NT_SYNTAX_ID_NulledString},
  855. // File Service Properties
  856. //
  857. // HostComputer(Service
  858. //
  859. //
  860. // DisplayName (Service)
  861. //
  862. { TEXT("Version"),
  863. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  864. PROPERTY_RW, 1, NT_SYNTAX_ID_LPTSTR },
  865. //
  866. // ServiceType (service)
  867. //
  868. // StartType (service)
  869. //
  870. //
  871. // Path (Service)
  872. //
  873. //
  874. // ErrorControl (service)
  875. //
  876. //
  877. // LoadOrderGroup(service)
  878. //
  879. //
  880. // ServiceAccountName (service)
  881. //
  882. //
  883. // Dependencies (Service)
  884. //
  885. // Description (user)
  886. //
  887. { TEXT("MaxUserCount"),
  888. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  889. PROPERTY_READABLE, 2, NT_SYNTAX_ID_DWORD },
  890. // Session Properties
  891. { TEXT("User"), // ro, FSSessionGeneralInfo
  892. TEXT(""), TEXT("String"), UNLEN+1, 0, FALSE,
  893. PROPERTY_READABLE, 1, NT_SYNTAX_ID_LPTSTR },
  894. { TEXT("Computer"), // ro
  895. TEXT(""), TEXT("String"), UNCLEN+1, 0, FALSE,
  896. PROPERTY_READABLE, 1, NT_SYNTAX_ID_LPTSTR},
  897. { TEXT("ConnectTime"), // ro
  898. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  899. PROPERTY_READABLE, 1, NT_SYNTAX_ID_DATE },
  900. { TEXT("IdleTime"), // ro
  901. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  902. PROPERTY_READABLE, 1, NT_SYNTAX_ID_DATE},
  903. // Resource Properties
  904. //
  905. // User (session)
  906. //
  907. // Path (service)
  908. //
  909. { TEXT("LockCount"), // ro
  910. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  911. PROPERTY_READABLE, 1, NT_SYNTAX_ID_DWORD},
  912. // FileShareClass
  913. { TEXT("CurrentUserCount"), // ro, FSFileShareGeneralInfo
  914. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  915. PROPERTY_READABLE, 2, NT_SYNTAX_ID_DWORD },
  916. //
  917. // Description (User)
  918. //
  919. //
  920. // HostComputer(Service)
  921. //
  922. //
  923. // Path (service)
  924. //
  925. //
  926. // MaxUserCount(FileService)
  927. //
  928. // FPNWFileServiceClass
  929. //
  930. // HostComputer (Service)
  931. //
  932. //
  933. // DisplayName (Service)
  934. //
  935. // Version (FileService)
  936. //
  937. //
  938. // ServiceType (service)
  939. //
  940. // StartType (service)
  941. //
  942. //
  943. // Path (Service)
  944. //
  945. //
  946. // ErrorControl (Service)
  947. //
  948. //
  949. // LoadOrderGroup (Service)
  950. //
  951. //
  952. // ServiceAccountName (service)
  953. //
  954. //
  955. // Dependencies (service)
  956. //
  957. //
  958. // Description (User)
  959. //
  960. //
  961. // MaxUserCount(FileService)
  962. //
  963. // FPNWSession Class
  964. //
  965. // User (Session)
  966. //
  967. //
  968. // Computer (session)
  969. //
  970. // ConnectTime (session)
  971. // FPNWResourceClass
  972. //
  973. // User (Session)
  974. //
  975. //
  976. // Path (Service)
  977. //
  978. //
  979. // LockCount (resource)
  980. //
  981. // FPNWFileShareClass
  982. // CurrentUserCount (FileShare)
  983. //
  984. // HostComputer(Service)
  985. //
  986. //
  987. // Path (service)
  988. //
  989. //
  990. // MaxUserCount (FileService)
  991. //
  992. // PrintQueueClass
  993. { TEXT("PrinterPath"), // FSPrintQueueGeneralInfo
  994. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  995. PROPERTY_READABLE, 2, NT_SYNTAX_ID_LPTSTR },
  996. { TEXT("PrinterName"), // friendly name
  997. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  998. PROPERTY_RW, 2, NT_SYNTAX_ID_LPTSTR },
  999. { TEXT("Model"),
  1000. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  1001. PROPERTY_RW, 2, NT_SYNTAX_ID_LPTSTR },
  1002. { TEXT("Datatype"),
  1003. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  1004. PROPERTY_RW, 2, NT_SYNTAX_ID_LPTSTR },
  1005. { TEXT("PrintProcessor"),
  1006. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  1007. PROPERTY_RW, 2, NT_SYNTAX_ID_LPTSTR },
  1008. { TEXT("ObjectGUID"),
  1009. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  1010. PROPERTY_RW, 7, NT_SYNTAX_ID_LPTSTR },
  1011. { TEXT("Action"),
  1012. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  1013. PROPERTY_RW, 7, NT_SYNTAX_ID_DWORD },
  1014. //
  1015. // Description (user)
  1016. //
  1017. { TEXT("Location"),
  1018. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  1019. PROPERTY_RW, 2, NT_SYNTAX_ID_LPTSTR },
  1020. { TEXT("StartTime"),
  1021. TEXT(""), TEXT("Time"), 0, 0, FALSE,
  1022. PROPERTY_RW, 2, NT_SYNTAX_ID_DATE },
  1023. { TEXT("UntilTime"),
  1024. TEXT(""), TEXT("Time"), 0, 0, FALSE,
  1025. PROPERTY_RW, 2, NT_SYNTAX_ID_DATE },
  1026. { TEXT("DefaultJobPriority"),
  1027. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  1028. PROPERTY_RW, 2, NT_SYNTAX_ID_DWORD},
  1029. { TEXT("JobCount"),
  1030. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  1031. PROPERTY_READABLE, 2, NT_SYNTAX_ID_DWORD},
  1032. { TEXT("Priority"),
  1033. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  1034. PROPERTY_RW, 2, NT_SYNTAX_ID_DWORD },
  1035. { TEXT("Attributes"),
  1036. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  1037. PROPERTY_RW, 2, NT_SYNTAX_ID_DWORD },
  1038. { TEXT("BannerPage"),
  1039. TEXT(""), TEXT("Path"), MAX_PATH, 0, FALSE,
  1040. PROPERTY_RW, 2, NT_SYNTAX_ID_LPTSTR },
  1041. { TEXT("PrintDevices"),
  1042. TEXT(""), TEXT("String"), MAX_STRLEN, 0, TRUE,
  1043. PROPERTY_RW, 2, NT_SYNTAX_ID_DelimitedString },
  1044. // PrintJobClass
  1045. { TEXT("HostPrintQueue"), // ro, FSPrintJobGeneralInfo
  1046. TEXT(""), TEXT("ADsPath"), MAX_STRLEN, 0, FALSE,
  1047. PROPERTY_READABLE, 1, NT_SYNTAX_ID_LPTSTR },
  1048. { TEXT("TimeSubmitted"), // ro
  1049. TEXT(""), TEXT("Time"), 0, 0, FALSE,
  1050. PROPERTY_READABLE, 1, NT_SYNTAX_ID_SYSTEMTIME },
  1051. { TEXT("TotalPages"), // ro
  1052. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  1053. PROPERTY_READABLE, 1, NT_SYNTAX_ID_DWORD },
  1054. { TEXT("Size"), // ro
  1055. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  1056. PROPERTY_READABLE, 2, NT_SYNTAX_ID_DWORD},
  1057. //
  1058. // Description (User)
  1059. //
  1060. //
  1061. // Priority (PrintQueue)
  1062. //
  1063. // StartTime (PrintQueue)
  1064. //
  1065. // UntilTime (PrintQueue)
  1066. //
  1067. { TEXT("Notify"),
  1068. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  1069. PROPERTY_RW, 2, NT_SYNTAX_ID_LPTSTR },
  1070. { TEXT("TimeElapsed"), // ro
  1071. TEXT(""), TEXT("Interval"), MAX_LONG, 0, FALSE,
  1072. PROPERTY_READABLE, 2, NT_SYNTAX_ID_DWORD },
  1073. { TEXT("PagesPrinted"), // ro
  1074. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  1075. PROPERTY_READABLE, 2, NT_SYNTAX_ID_DWORD },
  1076. { TEXT("Position"),
  1077. TEXT(""), TEXT("Integer"), MAX_LONG, 0, FALSE,
  1078. PROPERTY_RW, 2, NT_SYNTAX_ID_DWORD },
  1079. // Name is common to all classes. Add one entry here for it.
  1080. { TEXT("Name"),
  1081. TEXT(""), TEXT("String"), MAX_STRLEN, 0, FALSE,
  1082. PROPERTY_READABLE, 0, NT_SYNTAX_ID_LPTSTR }
  1083. };
  1084. DWORD g_cWinNTProperties = sizeof(g_aWinNTProperties)/sizeof(PROPERTYINFO);
  1085. //
  1086. // Support routines for dynamically loading entry points.
  1087. //
  1088. void BindToDlls()
  1089. {
  1090. DWORD dwErr = 0;
  1091. if (!g_fDllsLoaded) {
  1092. //
  1093. // Construct a full path to the netapi32.dll
  1094. //
  1095. TCHAR szFullPathBufferNetAPI32[MAX_PATH + 1]; // +1 to allow for NULL terminator according to GetSystemDirectory
  1096. TCHAR szFullPathBufferADVAPI32[MAX_PATH + 1];
  1097. UINT uiPathLength = 0;
  1098. if ((uiPathLength = GetSystemDirectory(szFullPathBufferNetAPI32, MAX_PATH + 1)) == 0)
  1099. return;
  1100. //
  1101. // Only checking the length of the full path with the NETAPI32.DLL
  1102. // file. We know that ADVAPI32.DLL has the same number of characters
  1103. // as NETAPI32.DLL so if one fits in the buffer, so will the other one.
  1104. //
  1105. if ((uiPathLength + 1 + _tcslen(TEXT("NETAPI32.DLL"))) > MAX_PATH) // +1 is for slash
  1106. return;
  1107. _tcscat(szFullPathBufferNetAPI32, TEXT("\\"));
  1108. _tcscpy(szFullPathBufferADVAPI32, szFullPathBufferNetAPI32);
  1109. _tcscat(szFullPathBufferNetAPI32, TEXT("NETAPI32.DLL"));
  1110. _tcscat(szFullPathBufferADVAPI32, TEXT("ADVAPI32.DLL"));
  1111. EnterCriticalSection(&g_csLoadLibs);
  1112. if (!g_fDllsLoaded) {
  1113. g_hDllNetapi32 = LoadLibrary(szFullPathBufferNetAPI32);
  1114. if (!g_hDllNetapi32) {
  1115. dwErr = GetLastError();
  1116. }
  1117. if (g_hDllAdvapi32 = LoadLibrary(szFullPathBufferADVAPI32)) {
  1118. if (dwErr) {
  1119. //
  1120. // Set the last error for whatever it is worth.
  1121. // This does not really matter cause any dll we
  1122. // cannot load, we will not get functions on that
  1123. // dll. If secur32 load failed, then that call
  1124. // would have set a relevant last error.
  1125. //
  1126. SetLastError(dwErr);
  1127. }
  1128. }
  1129. g_fDllsLoaded = TRUE;
  1130. LeaveCriticalSection(&g_csLoadLibs);
  1131. }
  1132. }
  1133. }
  1134. //
  1135. // Locates entry points in NetApi32.
  1136. //
  1137. PVOID LoadNetApi32Function(CHAR *function)
  1138. {
  1139. if (!g_fDllsLoaded) {
  1140. BindToDlls();
  1141. }
  1142. if (g_hDllNetapi32) {
  1143. return((PVOID*) GetProcAddress((HMODULE) g_hDllNetapi32, function));
  1144. }
  1145. return NULL;
  1146. }
  1147. //
  1148. // Locates entry points in advapi32
  1149. //
  1150. PVOID LoadAdvapi32Function(CHAR *function)
  1151. {
  1152. if (!g_fDllsLoaded) {
  1153. BindToDlls();
  1154. }
  1155. if (g_hDllAdvapi32) {
  1156. return((PVOID*) GetProcAddress((HMODULE) g_hDllAdvapi32, function));
  1157. }
  1158. return NULL;
  1159. }
  1160. //
  1161. // DsUnquoteRdnValueWrapper
  1162. //
  1163. BOOL ConvertStringSidToSidWrapper(
  1164. IN LPCWSTR StringSid,
  1165. OUT PSID *Sid
  1166. )
  1167. {
  1168. static PF_ConvertStringSidToSid pfConvertStringSidToSid = NULL;
  1169. static BOOL f_LoadAttempted = FALSE;
  1170. //
  1171. // Load the fn and set the variables accordingly.
  1172. //
  1173. if (!f_LoadAttempted && pfConvertStringSidToSid == NULL) {
  1174. pfConvertStringSidToSid
  1175. = (PF_ConvertStringSidToSid)
  1176. LoadAdvapi32Function(CONVERT_STRING_TO_SID_API);
  1177. f_LoadAttempted = TRUE;
  1178. }
  1179. if (pfConvertStringSidToSid != NULL) {
  1180. return ((*pfConvertStringSidToSid)(
  1181. StringSid,
  1182. Sid
  1183. )
  1184. );
  1185. }
  1186. else {
  1187. SetLastError(ERROR_GEN_FAILURE);
  1188. return (FALSE);
  1189. }
  1190. }
  1191. BOOL ConvertSidToStringSidWrapper(
  1192. IN PSID Sid,
  1193. OUT LPWSTR *StringSid
  1194. )
  1195. {
  1196. static PF_ConvertSidToStringSid pfConvertSidToSidString = NULL;
  1197. static BOOL f_LoadAttempted = FALSE;
  1198. //
  1199. // Load the fn and set the variables accordingly.
  1200. //
  1201. if (!f_LoadAttempted && pfConvertSidToSidString == NULL) {
  1202. pfConvertSidToSidString =
  1203. (PF_ConvertSidToStringSid)
  1204. LoadAdvapi32Function(CONVERT_SID_TO_STRING_API);
  1205. f_LoadAttempted = TRUE;
  1206. }
  1207. if (pfConvertSidToSidString != NULL) {
  1208. return ((*pfConvertSidToSidString)(
  1209. Sid,
  1210. StringSid
  1211. )
  1212. );
  1213. }
  1214. else {
  1215. SetLastError(ERROR_GEN_FAILURE);
  1216. return (FALSE);
  1217. }
  1218. }