jwasddl.pas 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536
  1. {******************************************************************************}
  2. { }
  3. { Security Descriptor Definition Language API interface Unit for Object Pascal }
  4. { }
  5. { Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft }
  6. { Corporation. All Rights Reserved. }
  7. { }
  8. { The original file is: sddl.h, released June 2000. The original Pascal }
  9. { code is: Sddl.pas, released December 2000. The initial developer of the }
  10. { Pascal code is Marcel van Brakel (brakelm att chello dott nl). }
  11. { }
  12. { Portions created by Marcel van Brakel are Copyright (C) 1999-2001 }
  13. { Marcel van Brakel. All Rights Reserved. }
  14. { }
  15. { Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) }
  16. { }
  17. { You may retrieve the latest version of this file at the Project JEDI }
  18. { APILIB home page, located at http://jedi-apilib.sourceforge.net }
  19. { }
  20. { The contents of this file are used with permission, subject to the Mozilla }
  21. { Public License Version 1.1 (the "License"); you may not use this file except }
  22. { in compliance with the License. You may obtain a copy of the License at }
  23. { http://www.mozilla.org/MPL/MPL-1.1.html }
  24. { }
  25. { Software distributed under the License is distributed on an "AS IS" basis, }
  26. { WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
  27. { the specific language governing rights and limitations under the License. }
  28. { }
  29. { Alternatively, the contents of this file may be used under the terms of the }
  30. { GNU Lesser General Public License (the "LGPL License"), in which case the }
  31. { provisions of the LGPL License are applicable instead of those above. }
  32. { If you wish to allow use of your version of this file only under the terms }
  33. { of the LGPL License and not to allow others to use your version of this file }
  34. { under the MPL, indicate your decision by deleting the provisions above and }
  35. { replace them with the notice and other provisions required by the LGPL }
  36. { License. If you do not delete the provisions above, a recipient may use }
  37. { your version of this file under either the MPL or the LGPL License. }
  38. { }
  39. { For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
  40. { }
  41. {******************************************************************************}
  42. unit JwaSddl;
  43. {$WEAKPACKAGEUNIT}
  44. {$HPPEMIT ''}
  45. {$HPPEMIT '#include "sddl.h"'}
  46. {$HPPEMIT ''}
  47. {$I jediapilib.inc}
  48. interface
  49. uses
  50. JwaWinNT, JwaWinType;
  51. //
  52. // SDDL Version information
  53. //
  54. const
  55. SDDL_REVISION_1 = 1;
  56. {$EXTERNALSYM SDDL_REVISION_1}
  57. SDDL_REVISION = SDDL_REVISION_1;
  58. {$EXTERNALSYM SDDL_REVISION}
  59. //
  60. // SDDL Component tags
  61. //
  62. SDDL_OWNER = 'O'; // Owner tag
  63. {$EXTERNALSYM SDDL_OWNER}
  64. SDDL_GROUP = 'G'; // Group tag
  65. {$EXTERNALSYM SDDL_GROUP}
  66. SDDL_DACL = 'D'; // DACL tag
  67. {$EXTERNALSYM SDDL_DACL}
  68. SDDL_SACL = 'S'; // SACL tag
  69. {$EXTERNALSYM SDDL_SACL}
  70. //
  71. // SDDL Security descriptor controls
  72. //
  73. SDDL_PROTECTED = 'P'; // DACL or SACL Protected
  74. {$EXTERNALSYM SDDL_PROTECTED}
  75. SDDL_AUTO_INHERIT_REQ = 'AR'; // Auto inherit request
  76. {$EXTERNALSYM SDDL_AUTO_INHERIT_REQ}
  77. SDDL_AUTO_INHERITED = 'AI'; // DACL/SACL are auto inherited
  78. {$EXTERNALSYM SDDL_AUTO_INHERITED}
  79. //
  80. // SDDL Ace types
  81. //
  82. SDDL_ACCESS_ALLOWED = 'A'; // Access allowed
  83. {$EXTERNALSYM SDDL_ACCESS_ALLOWED}
  84. SDDL_ACCESS_DENIED = 'D'; // Access denied
  85. {$EXTERNALSYM SDDL_ACCESS_DENIED}
  86. SDDL_OBJECT_ACCESS_ALLOWED = 'OA'; // Object access allowed
  87. {$EXTERNALSYM SDDL_OBJECT_ACCESS_ALLOWED}
  88. SDDL_OBJECT_ACCESS_DENIED = 'OD'; // Object access denied
  89. {$EXTERNALSYM SDDL_OBJECT_ACCESS_DENIED}
  90. SDDL_AUDIT = 'AU'; // Audit
  91. {$EXTERNALSYM SDDL_AUDIT}
  92. SDDL_ALARM = 'AL'; // Alarm
  93. {$EXTERNALSYM SDDL_ALARM}
  94. SDDL_OBJECT_AUDIT = 'OU'; // Object audit
  95. {$EXTERNALSYM SDDL_OBJECT_AUDIT}
  96. SDDL_OBJECT_ALARM = 'OL'; // Object alarm
  97. {$EXTERNALSYM SDDL_OBJECT_ALARM}
  98. //
  99. // SDDL Ace flags
  100. //
  101. SDDL_CONTAINER_INHERIT = 'CI'; // Container inherit
  102. {$EXTERNALSYM SDDL_CONTAINER_INHERIT}
  103. SDDL_OBJECT_INHERIT = 'OI'; // Object inherit
  104. {$EXTERNALSYM SDDL_OBJECT_INHERIT}
  105. SDDL_NO_PROPAGATE = 'NP'; // Inherit no propagate
  106. {$EXTERNALSYM SDDL_NO_PROPAGATE}
  107. SDDL_INHERIT_ONLY = 'IO'; // Inherit only
  108. {$EXTERNALSYM SDDL_INHERIT_ONLY}
  109. SDDL_INHERITED = 'ID'; // Inherited
  110. {$EXTERNALSYM SDDL_INHERITED}
  111. SDDL_AUDIT_SUCCESS = 'SA'; // Audit success
  112. {$EXTERNALSYM SDDL_AUDIT_SUCCESS}
  113. SDDL_AUDIT_FAILURE = 'FA'; // Audit failure
  114. {$EXTERNALSYM SDDL_AUDIT_FAILURE}
  115. //
  116. // SDDL Rights
  117. //
  118. SDDL_READ_PROPERTY = 'RP';
  119. {$EXTERNALSYM SDDL_READ_PROPERTY}
  120. SDDL_WRITE_PROPERTY = 'WP';
  121. {$EXTERNALSYM SDDL_WRITE_PROPERTY}
  122. SDDL_CREATE_CHILD = 'CC';
  123. {$EXTERNALSYM SDDL_CREATE_CHILD}
  124. SDDL_DELETE_CHILD = 'DC';
  125. {$EXTERNALSYM SDDL_DELETE_CHILD}
  126. SDDL_LIST_CHILDREN = 'LC';
  127. {$EXTERNALSYM SDDL_LIST_CHILDREN}
  128. SDDL_SELF_WRITE = 'SW';
  129. {$EXTERNALSYM SDDL_SELF_WRITE}
  130. SDDL_LIST_OBJECT = 'LO';
  131. {$EXTERNALSYM SDDL_LIST_OBJECT}
  132. SDDL_DELETE_TREE = 'DT';
  133. {$EXTERNALSYM SDDL_DELETE_TREE}
  134. SDDL_CONTROL_ACCESS = 'CR';
  135. {$EXTERNALSYM SDDL_CONTROL_ACCESS}
  136. SDDL_READ_CONTROL = 'RC';
  137. {$EXTERNALSYM SDDL_READ_CONTROL}
  138. SDDL_WRITE_DAC = 'WD';
  139. {$EXTERNALSYM SDDL_WRITE_DAC}
  140. SDDL_WRITE_OWNER = 'WO';
  141. {$EXTERNALSYM SDDL_WRITE_OWNER}
  142. SDDL_STANDARD_DELETE = 'SD';
  143. {$EXTERNALSYM SDDL_STANDARD_DELETE}
  144. SDDL_GENERIC_ALL = 'GA';
  145. {$EXTERNALSYM SDDL_GENERIC_ALL}
  146. SDDL_GENERIC_READ = 'GR';
  147. {$EXTERNALSYM SDDL_GENERIC_READ}
  148. SDDL_GENERIC_WRITE = 'GW';
  149. {$EXTERNALSYM SDDL_GENERIC_WRITE}
  150. SDDL_GENERIC_EXECUTE = 'GX';
  151. {$EXTERNALSYM SDDL_GENERIC_EXECUTE}
  152. SDDL_FILE_ALL = 'FA';
  153. {$EXTERNALSYM SDDL_FILE_ALL}
  154. SDDL_FILE_READ = 'FR';
  155. {$EXTERNALSYM SDDL_FILE_READ}
  156. SDDL_FILE_WRITE = 'FW';
  157. {$EXTERNALSYM SDDL_FILE_WRITE}
  158. SDDL_FILE_EXECUTE = 'FX';
  159. {$EXTERNALSYM SDDL_FILE_EXECUTE}
  160. SDDL_KEY_ALL = 'KA';
  161. {$EXTERNALSYM SDDL_KEY_ALL}
  162. SDDL_KEY_READ = 'KR';
  163. {$EXTERNALSYM SDDL_KEY_READ}
  164. SDDL_KEY_WRITE = 'KW';
  165. {$EXTERNALSYM SDDL_KEY_WRITE}
  166. SDDL_KEY_EXECUTE = 'KX';
  167. {$EXTERNALSYM SDDL_KEY_EXECUTE}
  168. //
  169. // SDDL User alias max size
  170. // - currently, upto two supported eg. "DA"
  171. // - modify this if more WCHARs need to be there in future e.g. "DAX"
  172. //
  173. SDDL_ALIAS_SIZE = 2;
  174. {$EXTERNALSYM SDDL_ALIAS_SIZE}
  175. //
  176. // SDDL User aliases
  177. //
  178. SDDL_DOMAIN_ADMINISTRATORS = 'DA'; // Domain admins
  179. {$EXTERNALSYM SDDL_DOMAIN_ADMINISTRATORS}
  180. SDDL_DOMAIN_GUESTS = 'DG'; // Domain guests
  181. {$EXTERNALSYM SDDL_DOMAIN_GUESTS}
  182. SDDL_DOMAIN_USERS = 'DU'; // Domain users
  183. {$EXTERNALSYM SDDL_DOMAIN_USERS}
  184. SDDL_ENTERPRISE_DOMAIN_CONTROLLERS = 'ED'; // Enterprise domain controllers
  185. {$EXTERNALSYM SDDL_ENTERPRISE_DOMAIN_CONTROLLERS}
  186. SDDL_DOMAIN_DOMAIN_CONTROLLERS = 'DD'; // Domain domain controllers
  187. {$EXTERNALSYM SDDL_DOMAIN_DOMAIN_CONTROLLERS}
  188. SDDL_DOMAIN_COMPUTERS = 'DC'; // Domain computers
  189. {$EXTERNALSYM SDDL_DOMAIN_COMPUTERS}
  190. SDDL_BUILTIN_ADMINISTRATORS = 'BA'; // Builtin (local ) administrators
  191. {$EXTERNALSYM SDDL_BUILTIN_ADMINISTRATORS}
  192. SDDL_BUILTIN_GUESTS = 'BG'; // Builtin (local ) guests
  193. {$EXTERNALSYM SDDL_BUILTIN_GUESTS}
  194. SDDL_BUILTIN_USERS = 'BU'; // Builtin (local ) users
  195. {$EXTERNALSYM SDDL_BUILTIN_USERS}
  196. SDDL_LOCAL_ADMIN = 'LA'; // Local administrator account
  197. {$EXTERNALSYM SDDL_LOCAL_ADMIN}
  198. SDDL_LOCAL_GUEST = 'LG'; // Local group account
  199. {$EXTERNALSYM SDDL_LOCAL_GUEST}
  200. SDDL_ACCOUNT_OPERATORS = 'AO'; // Account operators
  201. {$EXTERNALSYM SDDL_ACCOUNT_OPERATORS}
  202. SDDL_BACKUP_OPERATORS = 'BO'; // Backup operators
  203. {$EXTERNALSYM SDDL_BACKUP_OPERATORS}
  204. SDDL_PRINTER_OPERATORS = 'PO'; // Printer operators
  205. {$EXTERNALSYM SDDL_PRINTER_OPERATORS}
  206. SDDL_SERVER_OPERATORS = 'SO'; // Server operators
  207. {$EXTERNALSYM SDDL_SERVER_OPERATORS}
  208. SDDL_AUTHENTICATED_USERS = 'AU'; // Authenticated users
  209. {$EXTERNALSYM SDDL_AUTHENTICATED_USERS}
  210. SDDL_PERSONAL_SELF = 'PS'; // Personal self
  211. {$EXTERNALSYM SDDL_PERSONAL_SELF}
  212. SDDL_CREATOR_OWNER = 'CO'; // Creator owner
  213. {$EXTERNALSYM SDDL_CREATOR_OWNER}
  214. SDDL_CREATOR_GROUP = 'CG'; // Creator group
  215. {$EXTERNALSYM SDDL_CREATOR_GROUP}
  216. SDDL_LOCAL_SYSTEM = 'SY'; // Local system
  217. {$EXTERNALSYM SDDL_LOCAL_SYSTEM}
  218. SDDL_POWER_USERS = 'PU'; // Power users
  219. {$EXTERNALSYM SDDL_POWER_USERS}
  220. SDDL_EVERYONE = 'WD'; // Everyone ( World )
  221. {$EXTERNALSYM SDDL_EVERYONE}
  222. SDDL_REPLICATOR = 'RE'; // Replicator
  223. {$EXTERNALSYM SDDL_REPLICATOR}
  224. SDDL_INTERACTIVE = 'IU'; // Interactive logon user
  225. {$EXTERNALSYM SDDL_INTERACTIVE}
  226. SDDL_NETWORK = 'NU'; // Nework logon user
  227. {$EXTERNALSYM SDDL_NETWORK}
  228. SDDL_SERVICE = 'SU'; // Service logon user
  229. {$EXTERNALSYM SDDL_SERVICE}
  230. SDDL_RESTRICTED_CODE = 'RC'; // Restricted code
  231. {$EXTERNALSYM SDDL_RESTRICTED_CODE}
  232. SDDL_ANONYMOUS = 'AN'; // Anonymous Logon
  233. {$EXTERNALSYM SDDL_ANONYMOUS}
  234. SDDL_SCHEMA_ADMINISTRATORS = 'SA'; // Schema Administrators
  235. {$EXTERNALSYM SDDL_SCHEMA_ADMINISTRATORS}
  236. SDDL_CERT_SERV_ADMINISTRATORS = 'CA'; // Certificate Server Administrators
  237. {$EXTERNALSYM SDDL_CERT_SERV_ADMINISTRATORS}
  238. SDDL_RAS_SERVERS = 'RS'; // RAS servers group
  239. {$EXTERNALSYM SDDL_RAS_SERVERS}
  240. SDDL_ENTERPRISE_ADMINS = 'EA'; // Enterprise administrators
  241. {$EXTERNALSYM SDDL_ENTERPRISE_ADMINS}
  242. SDDL_GROUP_POLICY_ADMINS = 'PA'; // Group Policy administrators
  243. {$EXTERNALSYM SDDL_GROUP_POLICY_ADMINS}
  244. SDDL_ALIAS_PREW2KCOMPACC = 'RU'; // alias to allow previous windows 2000
  245. {$EXTERNALSYM SDDL_ALIAS_PREW2KCOMPACC}
  246. SDDL_LOCAL_SERVICE = 'LS'; // Local service account (for services)
  247. {$EXTERNALSYM SDDL_LOCAL_SERVICE}
  248. SDDL_NETWORK_SERVICE = 'NS'; // Network service account (for services)
  249. {$EXTERNALSYM SDDL_NETWORK_SERVICE}
  250. SDDL_REMOTE_DESKTOP = 'RD'; // Remote desktop users (for terminal server)
  251. {$EXTERNALSYM SDDL_REMOTE_DESKTOP}
  252. SDDL_NETWORK_CONFIGURATION_OPS = 'NO'; // Network configuration operators ( to manage configuration of networking features)
  253. {$EXTERNALSYM SDDL_NETWORK_CONFIGURATION_OPS}
  254. SDDL_PERFMON_USERS = 'MU'; // Performance Monitor Users
  255. {$EXTERNALSYM SDDL_PERFMON_USERS}
  256. SDDL_PERFLOG_USERS = 'LU'; // Performance Log Users
  257. {$EXTERNALSYM SDDL_PERFLOG_USERS}
  258. //
  259. // SDDL Seperators - character version
  260. //
  261. SDDL_SEPERATORC = ';';
  262. {$EXTERNALSYM SDDL_SEPERATORC}
  263. SDDL_DELIMINATORC = ':';
  264. {$EXTERNALSYM SDDL_DELIMINATORC}
  265. SDDL_ACE_BEGINC = '(';
  266. {$EXTERNALSYM SDDL_ACE_BEGINC}
  267. SDDL_ACE_ENDC = ')';
  268. {$EXTERNALSYM SDDL_ACE_ENDC}
  269. //
  270. // SDDL Seperators - string version
  271. //
  272. SDDL_SEPERATOR = ';';
  273. {$EXTERNALSYM SDDL_SEPERATOR}
  274. SDDL_DELIMINATOR = ':';
  275. {$EXTERNALSYM SDDL_DELIMINATOR}
  276. SDDL_ACE_BEGIN = '(';
  277. {$EXTERNALSYM SDDL_ACE_BEGIN}
  278. SDDL_ACE_END = ')';
  279. {$EXTERNALSYM SDDL_ACE_END}
  280. function ConvertSidToStringSidA(Sid: PSID; var StringSid: LPSTR): BOOL; stdcall;
  281. {$EXTERNALSYM ConvertSidToStringSidA}
  282. function ConvertSidToStringSidW(Sid: PSID; var StringSid: LPWSTR): BOOL; stdcall;
  283. {$EXTERNALSYM ConvertSidToStringSidW}
  284. function ConvertSidToStringSid(Sid: PSID; var StringSid: LPTSTR): BOOL; stdcall;
  285. {$EXTERNALSYM ConvertSidToStringSid}
  286. function ConvertStringSidToSidA(StringSid: LPCSTR; var Sid: PSID): BOOL; stdcall;
  287. {$EXTERNALSYM ConvertStringSidToSidA}
  288. function ConvertStringSidToSidW(StringSid: LPCWSTR; var Sid: PSID): BOOL; stdcall;
  289. {$EXTERNALSYM ConvertStringSidToSidW}
  290. function ConvertStringSidToSid(StringSid: LPCTSTR; var Sid: PSID): BOOL; stdcall;
  291. {$EXTERNALSYM ConvertStringSidToSid}
  292. function ConvertStringSecurityDescriptorToSecurityDescriptorA(StringSecurityDescriptor: LPCSTR;
  293. StringSDRevision: DWORD; var SecurityDescriptor: PSECURITY_DESCRIPTOR;
  294. SecurityDescriptorSize: PULONG): BOOL; stdcall;
  295. {$EXTERNALSYM ConvertStringSecurityDescriptorToSecurityDescriptorA}
  296. function ConvertStringSecurityDescriptorToSecurityDescriptorW(StringSecurityDescriptor: LPCWSTR;
  297. StringSDRevision: DWORD; var SecurityDescriptor: PSECURITY_DESCRIPTOR;
  298. SecurityDescriptorSize: PULONG): BOOL; stdcall;
  299. {$EXTERNALSYM ConvertStringSecurityDescriptorToSecurityDescriptorW}
  300. function ConvertStringSecurityDescriptorToSecurityDescriptor(StringSecurityDescriptor: LPCTSTR;
  301. StringSDRevision: DWORD; var SecurityDescriptor: PSECURITY_DESCRIPTOR;
  302. SecurityDescriptorSize: PULONG): BOOL; stdcall;
  303. {$EXTERNALSYM ConvertStringSecurityDescriptorToSecurityDescriptor}
  304. function ConvertSecurityDescriptorToStringSecurityDescriptorA(
  305. SecurityDescriptor: PSECURITY_DESCRIPTOR; RequestedStringSDRevision: DWORD;
  306. SecurityInformation: SECURITY_INFORMATION; var StringSecurityDescriptor: LPSTR;
  307. StringSecurityDescriptorLen: PULONG): BOOL; stdcall;
  308. {$EXTERNALSYM ConvertSecurityDescriptorToStringSecurityDescriptorA}
  309. function ConvertSecurityDescriptorToStringSecurityDescriptorW(
  310. SecurityDescriptor: PSECURITY_DESCRIPTOR; RequestedStringSDRevision: DWORD;
  311. SecurityInformation: SECURITY_INFORMATION; var StringSecurityDescriptor: LPWSTR;
  312. StringSecurityDescriptorLen: PULONG): BOOL; stdcall;
  313. {$EXTERNALSYM ConvertSecurityDescriptorToStringSecurityDescriptorW}
  314. function ConvertSecurityDescriptorToStringSecurityDescriptor(
  315. SecurityDescriptor: PSECURITY_DESCRIPTOR; RequestedStringSDRevision: DWORD;
  316. SecurityInformation: SECURITY_INFORMATION; var StringSecurityDescriptor: LPTSTR;
  317. StringSecurityDescriptorLen: PULONG): BOOL; stdcall;
  318. {$EXTERNALSYM ConvertSecurityDescriptorToStringSecurityDescriptor}
  319. implementation
  320. const
  321. advapi32 = 'advapi32.dll';
  322. {$IFDEF UNICODE}
  323. AWSuffix = 'W';
  324. {$ELSE}
  325. AWSuffix = 'A';
  326. {$ENDIF UNICODE}
  327. {$IFDEF DYNAMIC_LINK}
  328. var
  329. _ConvertSidToStringSidA: Pointer;
  330. function ConvertSidToStringSidA;
  331. begin
  332. GetProcedureAddress(_ConvertSidToStringSidA, advapi32, 'ConvertSidToStringSidA');
  333. asm
  334. MOV ESP, EBP
  335. POP EBP
  336. JMP [_ConvertSidToStringSidA]
  337. end;
  338. end;
  339. var
  340. _ConvertSidToStringSidW: Pointer;
  341. function ConvertSidToStringSidW;
  342. begin
  343. GetProcedureAddress(_ConvertSidToStringSidW, advapi32, 'ConvertSidToStringSidW');
  344. asm
  345. MOV ESP, EBP
  346. POP EBP
  347. JMP [_ConvertSidToStringSidW]
  348. end;
  349. end;
  350. var
  351. _ConvertSidToStringSid: Pointer;
  352. function ConvertSidToStringSid;
  353. begin
  354. GetProcedureAddress(_ConvertSidToStringSid, advapi32, 'ConvertSidToStringSid' + AWSuffix);
  355. asm
  356. MOV ESP, EBP
  357. POP EBP
  358. JMP [_ConvertSidToStringSid]
  359. end;
  360. end;
  361. var
  362. _ConvertStringSidToSidA: Pointer;
  363. function ConvertStringSidToSidA;
  364. begin
  365. GetProcedureAddress(_ConvertStringSidToSidA, advapi32, 'ConvertStringSidToSidA');
  366. asm
  367. MOV ESP, EBP
  368. POP EBP
  369. JMP [_ConvertStringSidToSidA]
  370. end;
  371. end;
  372. var
  373. _ConvertStringSidToSidW: Pointer;
  374. function ConvertStringSidToSidW;
  375. begin
  376. GetProcedureAddress(_ConvertStringSidToSidW, advapi32, 'ConvertStringSidToSidW');
  377. asm
  378. MOV ESP, EBP
  379. POP EBP
  380. JMP [_ConvertStringSidToSidW]
  381. end;
  382. end;
  383. var
  384. _ConvertStringSidToSid: Pointer;
  385. function ConvertStringSidToSid;
  386. begin
  387. GetProcedureAddress(_ConvertStringSidToSid, advapi32, 'ConvertStringSidToSid' + AWSuffix);
  388. asm
  389. MOV ESP, EBP
  390. POP EBP
  391. JMP [_ConvertStringSidToSid]
  392. end;
  393. end;
  394. var
  395. _ConvStrSecDescrToSecDescrA: Pointer;
  396. function ConvertStringSecurityDescriptorToSecurityDescriptorA;
  397. begin
  398. GetProcedureAddress(_ConvStrSecDescrToSecDescrA, advapi32, 'ConvertStringSecurityDescriptorToSecurityDescriptorA');
  399. asm
  400. MOV ESP, EBP
  401. POP EBP
  402. JMP [_ConvStrSecDescrToSecDescrA]
  403. end;
  404. end;
  405. var
  406. _ConvStrSecDescrToSecDescrW: Pointer;
  407. function ConvertStringSecurityDescriptorToSecurityDescriptorW;
  408. begin
  409. GetProcedureAddress(_ConvStrSecDescrToSecDescrW, advapi32, 'ConvertStringSecurityDescriptorToSecurityDescriptorW');
  410. asm
  411. MOV ESP, EBP
  412. POP EBP
  413. JMP [_ConvStrSecDescrToSecDescrW]
  414. end;
  415. end;
  416. var
  417. _ConvStrSecDescrToSecDescr: Pointer;
  418. function ConvertStringSecurityDescriptorToSecurityDescriptor;
  419. begin
  420. GetProcedureAddress(_ConvStrSecDescrToSecDescr, advapi32, 'ConvertStringSecurityDescriptorToSecurityDescriptor' + AWSuffix);
  421. asm
  422. MOV ESP, EBP
  423. POP EBP
  424. JMP [_ConvStrSecDescrToSecDescr]
  425. end;
  426. end;
  427. var
  428. _ConvSecDescrToStrSecDescrA: Pointer;
  429. function ConvertSecurityDescriptorToStringSecurityDescriptorA;
  430. begin
  431. GetProcedureAddress(_ConvSecDescrToStrSecDescrA, advapi32, 'ConvertSecurityDescriptorToStringSecurityDescriptorA');
  432. asm
  433. MOV ESP, EBP
  434. POP EBP
  435. JMP [_ConvSecDescrToStrSecDescrA]
  436. end;
  437. end;
  438. var
  439. _ConvSecDescrToStrSecDescrW: Pointer;
  440. function ConvertSecurityDescriptorToStringSecurityDescriptorW;
  441. begin
  442. GetProcedureAddress(_ConvSecDescrToStrSecDescrW, advapi32, 'ConvertSecurityDescriptorToStringSecurityDescriptorW');
  443. asm
  444. MOV ESP, EBP
  445. POP EBP
  446. JMP [_ConvSecDescrToStrSecDescrW]
  447. end;
  448. end;
  449. var
  450. _ConvSecDescrToStrSecDescr: Pointer;
  451. function ConvertSecurityDescriptorToStringSecurityDescriptor;
  452. begin
  453. GetProcedureAddress(_ConvSecDescrToStrSecDescr, advapi32, 'ConvertSecurityDescriptorToStringSecurityDescriptor' + AWSuffix);
  454. asm
  455. MOV ESP, EBP
  456. POP EBP
  457. JMP [_ConvSecDescrToStrSecDescr]
  458. end;
  459. end;
  460. {$ELSE}
  461. function ConvertSidToStringSidA; external advapi32 name 'ConvertSidToStringSidA';
  462. function ConvertSidToStringSidW; external advapi32 name 'ConvertSidToStringSidW';
  463. function ConvertSidToStringSid; external advapi32 name 'ConvertSidToStringSid' + AWSuffix;
  464. function ConvertStringSidToSidA; external advapi32 name 'ConvertStringSidToSidA';
  465. function ConvertStringSidToSidW; external advapi32 name 'ConvertStringSidToSidW';
  466. function ConvertStringSidToSid; external advapi32 name 'ConvertStringSidToSid' + AWSuffix;
  467. function ConvertStringSecurityDescriptorToSecurityDescriptorA; external advapi32 name 'ConvertStringSecurityDescriptorToSecurityDescriptorA';
  468. function ConvertStringSecurityDescriptorToSecurityDescriptorW; external advapi32 name 'ConvertStringSecurityDescriptorToSecurityDescriptorW';
  469. function ConvertStringSecurityDescriptorToSecurityDescriptor; external advapi32 name 'ConvertStringSecurityDescriptorToSecurityDescriptor' + AWSuffix;
  470. function ConvertSecurityDescriptorToStringSecurityDescriptorA; external advapi32 name 'ConvertSecurityDescriptorToStringSecurityDescriptorA';
  471. function ConvertSecurityDescriptorToStringSecurityDescriptorW; external advapi32 name 'ConvertSecurityDescriptorToStringSecurityDescriptorW';
  472. function ConvertSecurityDescriptorToStringSecurityDescriptor; external advapi32 name 'ConvertSecurityDescriptorToStringSecurityDescriptor' + AWSuffix;
  473. {$ENDIF DYNAMIC_LINK}
  474. end.