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.

1464 lines
36 KiB

  1. //+-----------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (c) Microsoft Corporation 1992 - 1997
  6. //
  7. // File: lsaitf.c
  8. //
  9. // Contents: Routines for dynamically calling LSA & Sam routines
  10. //
  11. //
  12. // History: 21-February-1997 Created MikeSw
  13. //
  14. //------------------------------------------------------------------------
  15. #include <nt.h>
  16. #include <ntrtl.h>
  17. #include <nturtl.h>
  18. #include <windows.h>
  19. #include <lsarpc.h>
  20. #include <samrpc.h>
  21. #include <lsaisrv.h>
  22. #include <samisrv.h>
  23. #include <lsaitf.h>
  24. typedef NTSTATUS (*PI_SamrSetInformationUser)(
  25. IN SAMPR_HANDLE UserHandle,
  26. IN USER_INFORMATION_CLASS UserInformationClass,
  27. IN PSAMPR_USER_INFO_BUFFER Buffer
  28. );
  29. typedef NTSTATUS (*PI_SamrGetGroupsForUser)(
  30. IN SAMPR_HANDLE UserHandle,
  31. OUT PSAMPR_GET_GROUPS_BUFFER *Groups
  32. );
  33. typedef NTSTATUS (*PI_SamrCloseHandle)(
  34. IN OUT SAMPR_HANDLE * SamHandle
  35. );
  36. typedef NTSTATUS (*PI_SamrQueryInformationUser)(
  37. IN SAMPR_HANDLE UserHandle,
  38. IN USER_INFORMATION_CLASS UserInformationClass,
  39. OUT PSAMPR_USER_INFO_BUFFER *Buffer
  40. );
  41. typedef NTSTATUS (*PI_SamrOpenUser)(
  42. IN SAMPR_HANDLE DomainHandle,
  43. IN ACCESS_MASK DesiredAccess,
  44. IN ULONG UserId,
  45. OUT SAMPR_HANDLE * UserHandle
  46. );
  47. typedef NTSTATUS (*PI_SamrLookupNamesInDomain)(
  48. IN SAMPR_HANDLE DomainHandle,
  49. IN ULONG Count,
  50. IN RPC_UNICODE_STRING Names[],
  51. OUT PSAMPR_ULONG_ARRAY RelativeIds,
  52. OUT PSAMPR_ULONG_ARRAY Use
  53. );
  54. typedef NTSTATUS (*PI_SamrLookupIdsInDomain)(
  55. IN SAMPR_HANDLE DomainHandle,
  56. IN ULONG Count,
  57. IN PULONG RelativeIds,
  58. OUT PSAMPR_RETURNED_USTRING_ARRAY Names,
  59. OUT PSAMPR_ULONG_ARRAY Use
  60. );
  61. typedef NTSTATUS (*PI_SamrOpenDomain)(
  62. IN SAMPR_HANDLE ServerHandle,
  63. IN ACCESS_MASK DesiredAccess,
  64. IN PRPC_SID DomainId,
  65. OUT SAMPR_HANDLE * DomainHandle
  66. );
  67. typedef NTSTATUS (*PI_SamrQueryInformationDomain)(
  68. IN SAMPR_HANDLE DomainHandle,
  69. IN DOMAIN_INFORMATION_CLASS DomainInformationClass,
  70. OUT PSAMPR_DOMAIN_INFO_BUFFER *Buffer
  71. );
  72. typedef NTSTATUS (*PI_SamIConnect)(
  73. IN PSAMPR_SERVER_NAME ServerName,
  74. OUT SAMPR_HANDLE *ServerHandle,
  75. IN ACCESS_MASK DesiredAccess,
  76. IN BOOLEAN TrustedClient
  77. );
  78. typedef NTSTATUS (*PI_SamIAccountRestrictions)(
  79. IN SAM_HANDLE UserHandle,
  80. IN PUNICODE_STRING LogonWorkstation,
  81. IN PUNICODE_STRING Workstations,
  82. IN PLOGON_HOURS LogonHours,
  83. OUT PLARGE_INTEGER LogoffTime,
  84. OUT PLARGE_INTEGER KickoffTime
  85. );
  86. typedef NTSTATUS (*PI_SamIGetUserLogonInformation)(
  87. IN SAMPR_HANDLE DomainHandle,
  88. IN ULONG Flags,
  89. IN PUNICODE_STRING AccountName,
  90. OUT PSAMPR_USER_INFO_BUFFER * Buffer,
  91. OUT PSID_AND_ATTRIBUTES_LIST ReverseMembership,
  92. OUT OPTIONAL SAMPR_HANDLE * UserHandle
  93. );
  94. typedef NTSTATUS (*PI_SamIGetUserLogonInformationEx)(
  95. IN SAMPR_HANDLE DomainHandle,
  96. IN ULONG Flags,
  97. IN PUNICODE_STRING AccountName,
  98. IN ULONG WhichFields,
  99. OUT PSAMPR_USER_INFO_BUFFER * Buffer,
  100. OUT PSID_AND_ATTRIBUTES_LIST ReverseMembership,
  101. OUT OPTIONAL SAMPR_HANDLE * UserHandle
  102. );
  103. typedef VOID (*PI_SamIFree_SAMPR_GET_GROUPS_BUFFER )(
  104. PSAMPR_GET_GROUPS_BUFFER Source
  105. );
  106. typedef VOID (*PI_SamIFree_SAMPR_USER_INFO_BUFFER )(
  107. PSAMPR_USER_INFO_BUFFER Source,
  108. USER_INFORMATION_CLASS Branch
  109. );
  110. typedef VOID (*PI_SamIFree_SAMPR_ULONG_ARRAY )(
  111. PSAMPR_ULONG_ARRAY Source
  112. );
  113. typedef VOID (*PI_SamIFree_SAMPR_RETURNED_USTRING_ARRAY )(
  114. PSAMPR_RETURNED_USTRING_ARRAY Source
  115. );
  116. typedef VOID (*PI_SamIFreeSidAndAttributesList)(
  117. IN PSID_AND_ATTRIBUTES_LIST List
  118. );
  119. typedef VOID
  120. (NTAPI *PI_SamIIncrementPerformanceCounter)(
  121. IN SAM_PERF_COUNTER_TYPE CounterType
  122. );
  123. typedef VOID (*PI_SamIFreeVoid)(
  124. IN PVOID ptr
  125. );
  126. typedef NTSTATUS (*PI_SamIUPNFromUserHandle)(
  127. IN SAMPR_HANDLE UserHandle,
  128. OUT BOOLEAN *UPNDefaulted,
  129. OUT PUNICODE_STRING UPN
  130. );
  131. typedef NTSTATUS (*PI_SamIUpdateLogonStatistics)(
  132. IN SAMPR_HANDLE UserHandle,
  133. IN PSAM_LOGON_STATISTICS LogonStats
  134. );
  135. typedef NTSTATUS (*PI_LsaIOpenPolicyTrusted)(
  136. OUT PLSAPR_HANDLE PolicyHandle
  137. );
  138. typedef NTSTATUS (*PI_LsarClose)(
  139. IN OUT LSAPR_HANDLE *ObjectHandle
  140. );
  141. typedef NTSTATUS (*PI_LsaIQueryInformationPolicyTrusted)(
  142. IN POLICY_INFORMATION_CLASS InformationClass,
  143. OUT PLSAPR_POLICY_INFORMATION *Buffer
  144. );
  145. typedef NTSTATUS (*PI_LsarQueryInformationPolicy)(
  146. IN LSAPR_HANDLE PolicyHandle,
  147. IN POLICY_INFORMATION_CLASS InformationClass,
  148. OUT PLSAPR_POLICY_INFORMATION *PolicyInformation
  149. );
  150. typedef VOID (*PI_LsaIFree_LSAPR_POLICY_INFORMATION )(
  151. IN POLICY_INFORMATION_CLASS InformationClass,
  152. IN PLSAPR_POLICY_INFORMATION PolicyInformation
  153. );
  154. typedef NTSTATUS (*PI_LsarCreateSecret)(
  155. IN LSAPR_HANDLE PolicyHandle,
  156. IN PLSAPR_UNICODE_STRING SecretName,
  157. IN ACCESS_MASK DesiredAccess,
  158. OUT LSAPR_HANDLE *SecretHandle
  159. );
  160. typedef NTSTATUS (*PI_LsarOpenSecret)(
  161. IN LSAPR_HANDLE PolicyHandle,
  162. IN PLSAPR_UNICODE_STRING SecretName,
  163. IN ACCESS_MASK DesiredAccess,
  164. OUT LSAPR_HANDLE *SecretHandle
  165. );
  166. typedef NTSTATUS (*PI_LsarSetSecret)(
  167. IN LSAPR_HANDLE SecretHandle,
  168. IN PLSAPR_CR_CIPHER_VALUE EncryptedCurrentValue,
  169. IN PLSAPR_CR_CIPHER_VALUE EncryptedOldValue
  170. );
  171. typedef NTSTATUS (*PI_LsarQuerySecret)(
  172. IN LSAPR_HANDLE SecretHandle,
  173. IN OUT OPTIONAL PLSAPR_CR_CIPHER_VALUE *EncryptedCurrentValue,
  174. IN OUT OPTIONAL PLARGE_INTEGER CurrentValueSetTime,
  175. IN OUT OPTIONAL PLSAPR_CR_CIPHER_VALUE *EncryptedOldValue,
  176. IN OUT OPTIONAL PLARGE_INTEGER OldValueSetTime
  177. );
  178. typedef NTSTATUS (*PI_LsarDelete)(
  179. IN OUT LSAPR_HANDLE ObjectHandle
  180. );
  181. typedef VOID (*PI_LsaIFree_LSAPR_CR_CIPHER_VALUE) (
  182. IN PLSAPR_CR_CIPHER_VALUE CipherValue
  183. );
  184. typedef NTSTATUS
  185. (NTAPI *PI_LsaIRegisterPolicyChangeNotificationCallback)(
  186. IN pfLsaPolicyChangeNotificationCallback Callback,
  187. IN POLICY_NOTIFICATION_INFORMATION_CLASS MonitorInfoClass
  188. );
  189. typedef NTSTATUS
  190. (NTAPI *PI_LsaIUnregisterPolicyChangeNotificationCallback)(
  191. IN pfLsaPolicyChangeNotificationCallback Callback,
  192. IN POLICY_NOTIFICATION_INFORMATION_CLASS MonitorInfoClass
  193. );
  194. typedef NTSTATUS
  195. (NTAPI *PI_LsaIAuditAccountLogon)(
  196. IN ULONG AuditId,
  197. IN BOOLEAN Successful,
  198. IN PUNICODE_STRING Source,
  199. IN PUNICODE_STRING ClientName,
  200. IN PUNICODE_STRING MappedName,
  201. IN NTSTATUS Status OPTIONAL
  202. );
  203. typedef
  204. NTSTATUS
  205. (NTAPI *PI_LsaIGetLogonGuid)(
  206. IN PUNICODE_STRING pUserName,
  207. IN PUNICODE_STRING pUserDomain,
  208. IN PBYTE pBuffer,
  209. IN UINT BufferSize,
  210. OUT LPGUID pLogonGuid
  211. );
  212. typedef
  213. NTSTATUS
  214. (NTAPI *PI_LsaISetLogonGuidInLogonSession)(
  215. IN PLUID pLogonId,
  216. IN LPGUID pLogonGuid
  217. );
  218. typedef
  219. VOID
  220. (NTAPI *PI_LsaIAuditKerberosLogon)(
  221. IN NTSTATUS LogonStatus,
  222. IN NTSTATUS LogonSubStatus,
  223. IN PUNICODE_STRING AccountName,
  224. IN PUNICODE_STRING AuthenticatingAuthority,
  225. IN PUNICODE_STRING WorkstationName,
  226. IN PSID UserSid, OPTIONAL
  227. IN SECURITY_LOGON_TYPE LogonType,
  228. IN PTOKEN_SOURCE TokenSource,
  229. IN PLUID pLogonId,
  230. IN LPGUID pLogonGuid
  231. );
  232. typedef
  233. NTSTATUS
  234. (NTAPI *PI_LsaIAuditLogonUsingExplicitCreds)(
  235. IN USHORT AuditEventType,
  236. IN PSID pUser1Sid,
  237. IN PUNICODE_STRING pUser1Name,
  238. IN PUNICODE_STRING pUser1Domain,
  239. IN PLUID pUser1LogonId,
  240. IN LPGUID pUser1LogonGuid,
  241. IN PUNICODE_STRING pUser2Name,
  242. IN PUNICODE_STRING pUser2Domain,
  243. IN LPGUID pUser2LogonGuid
  244. );
  245. typedef NTSTATUS
  246. (NTAPI *PI_LsaICallPackage)(
  247. IN PUNICODE_STRING AuthenticationPackage,
  248. IN PVOID ProtocolSubmitBuffer,
  249. IN ULONG SubmitBufferLength,
  250. OUT PVOID *ProtocolReturnBuffer,
  251. OUT PULONG ReturnBufferLength,
  252. OUT PNTSTATUS ProtocolStatus
  253. );
  254. typedef NTSTATUS
  255. (NTAPI *PI_LsaIAddNameToLogonSession)(
  256. IN PLUID LogonId,
  257. IN ULONG NameFormat,
  258. IN PUNICODE_STRING Name
  259. );
  260. ///////////////////////////////////////////////////////////////////////
  261. BOOLEAN SrvDllsLoaded = FALSE;
  262. NTSTATUS DllLoadStatus = STATUS_SUCCESS;
  263. PI_SamrSetInformationUser pI_SamrSetInformationUser;
  264. PI_SamrGetGroupsForUser pI_SamrGetGroupsForUser;
  265. PI_SamrCloseHandle pI_SamrCloseHandle;
  266. PI_SamrQueryInformationUser pI_SamrQueryInformationUser;
  267. PI_SamrOpenUser pI_SamrOpenUser;
  268. PI_SamrLookupNamesInDomain pI_SamrLookupNamesInDomain;
  269. PI_SamrLookupIdsInDomain pI_SamrLookupIdsInDomain;
  270. PI_SamrOpenDomain pI_SamrOpenDomain;
  271. PI_SamrQueryInformationDomain pI_SamrQueryInformationDomain;
  272. PI_SamIConnect pI_SamIConnect;
  273. PI_SamIAccountRestrictions pI_SamIAccountRestrictions;
  274. PI_SamIGetUserLogonInformation pI_SamIGetUserLogonInformation;
  275. PI_SamIGetUserLogonInformationEx pI_SamIGetUserLogonInformationEx;
  276. PI_SamIFree_SAMPR_GET_GROUPS_BUFFER pI_SamIFree_SAMPR_GET_GROUPS_BUFFER ;
  277. PI_SamIFree_SAMPR_USER_INFO_BUFFER pI_SamIFree_SAMPR_USER_INFO_BUFFER ;
  278. PI_SamIFree_SAMPR_ULONG_ARRAY pI_SamIFree_SAMPR_ULONG_ARRAY ;
  279. PI_SamIFreeSidAndAttributesList pI_SamIFreeSidAndAttributesList ;
  280. PI_SamIFree_SAMPR_RETURNED_USTRING_ARRAY pI_SamIFree_SAMPR_RETURNED_USTRING_ARRAY;
  281. PI_SamIIncrementPerformanceCounter pI_SamIIncrementPerformanceCounter;
  282. PI_SamIFreeVoid pI_SamIFreeVoid;
  283. PI_SamIUPNFromUserHandle pI_SamIUPNFromUserHandle;
  284. PI_SamIUpdateLogonStatistics pI_SamIUpdateLogonStatistics;
  285. PI_LsaIOpenPolicyTrusted pI_LsaIOpenPolicyTrusted;
  286. PI_LsarClose pI_LsarClose;
  287. PI_LsaIQueryInformationPolicyTrusted pI_LsaIQueryInformationPolicyTrusted;
  288. PI_LsarQueryInformationPolicy pI_LsarQueryInformationPolicy;
  289. PI_LsaIFree_LSAPR_POLICY_INFORMATION pI_LsaIFree_LSAPR_POLICY_INFORMATION ;
  290. PI_LsarCreateSecret pI_LsarCreateSecret;
  291. PI_LsarOpenSecret pI_LsarOpenSecret;
  292. PI_LsarSetSecret pI_LsarSetSecret;
  293. PI_LsarQuerySecret pI_LsarQuerySecret;
  294. PI_LsarDelete pI_LsarDelete;
  295. PI_LsaIFree_LSAPR_CR_CIPHER_VALUE pI_LsaIFree_LSAPR_CR_CIPHER_VALUE;
  296. PI_LsaIRegisterPolicyChangeNotificationCallback pI_LsaIRegisterPolicyChangeNotificationCallback;
  297. PI_LsaIUnregisterPolicyChangeNotificationCallback pI_LsaIUnregisterPolicyChangeNotificationCallback;
  298. PI_LsaIAuditAccountLogon pI_LsaIAuditAccountLogon;
  299. PI_LsaIGetLogonGuid pI_LsaIGetLogonGuid;
  300. PI_LsaISetLogonGuidInLogonSession pI_LsaISetLogonGuidInLogonSession;
  301. PI_LsaIAuditKerberosLogon pI_LsaIAuditKerberosLogon;
  302. PI_LsaIAuditLogonUsingExplicitCreds pI_LsaIAuditLogonUsingExplicitCreds;
  303. PI_LsaICallPackage pI_LsaICallPackage;
  304. PI_LsaIAddNameToLogonSession pI_LsaIAddNameToLogonSession;
  305. ///////////////////////////////////////////////////////////////////////
  306. //
  307. // Macro to grab the address of the named procedure from a DLL
  308. //
  309. #if DBG
  310. #define GRAB_ADDRESS( _Y, _X ) \
  311. pI_##_X = (PI_##_X) GetProcAddress( _Y, #_X ); \
  312. \
  313. if ( pI_##_X == NULL ) { \
  314. DbgPrint("[security process] can't load " #_X " procedure. %ld\n", GetLastError()); \
  315. Status = STATUS_PROCEDURE_NOT_FOUND;\
  316. goto Cleanup; \
  317. }
  318. #else // DBG
  319. #define GRAB_ADDRESS( _Y, _X ) \
  320. pI_##_X = (PI_##_X) GetProcAddress( _Y, #_X ); \
  321. \
  322. if ( pI_##_X == NULL ) { \
  323. Status = STATUS_PROCEDURE_NOT_FOUND;\
  324. goto Cleanup; \
  325. }
  326. #endif // DBG
  327. //+-------------------------------------------------------------------------
  328. //
  329. // Function: EnsureSrvDllsLoaded
  330. //
  331. // Synopsis: Ensures that lsasrv.dll & samsrv.dll are loaded and
  332. // looks up function addresses in them.
  333. //
  334. // Effects:
  335. //
  336. // Arguments:
  337. //
  338. // Requires:
  339. //
  340. // Returns:
  341. //
  342. // Notes:
  343. //
  344. //
  345. //--------------------------------------------------------------------------
  346. NTSTATUS
  347. EnsureSrvDllsLoaded(
  348. VOID
  349. )
  350. {
  351. NTSTATUS Status = STATUS_SUCCESS;
  352. HMODULE SamsrvHandle = NULL;
  353. HMODULE LsasrvHandle = NULL;
  354. if (!NT_SUCCESS(DllLoadStatus))
  355. {
  356. return(DllLoadStatus);
  357. }
  358. //
  359. // Get handles to the DLLs. We don't want to load the DLLs - just
  360. // use them if they are present
  361. //
  362. SamsrvHandle = GetModuleHandleW(L"samsrv.dll");
  363. if (SamsrvHandle == NULL)
  364. {
  365. Status = STATUS_DLL_NOT_FOUND;
  366. goto Cleanup;
  367. }
  368. LsasrvHandle = GetModuleHandleW(L"lsasrv.dll");
  369. if (SamsrvHandle == NULL)
  370. {
  371. Status = STATUS_DLL_NOT_FOUND;
  372. goto Cleanup;
  373. }
  374. GRAB_ADDRESS( SamsrvHandle, SamrSetInformationUser );
  375. GRAB_ADDRESS( SamsrvHandle, SamrGetGroupsForUser );
  376. GRAB_ADDRESS( SamsrvHandle, SamrCloseHandle );
  377. GRAB_ADDRESS( SamsrvHandle, SamrQueryInformationUser );
  378. GRAB_ADDRESS( SamsrvHandle, SamrOpenUser );
  379. GRAB_ADDRESS( SamsrvHandle, SamrLookupNamesInDomain);
  380. GRAB_ADDRESS( SamsrvHandle, SamrLookupIdsInDomain);
  381. GRAB_ADDRESS( SamsrvHandle, SamrOpenDomain );
  382. GRAB_ADDRESS( SamsrvHandle, SamrQueryInformationDomain );
  383. GRAB_ADDRESS( SamsrvHandle, SamIConnect );
  384. GRAB_ADDRESS( SamsrvHandle, SamIAccountRestrictions );
  385. GRAB_ADDRESS( SamsrvHandle, SamIGetUserLogonInformation );
  386. GRAB_ADDRESS( SamsrvHandle, SamIGetUserLogonInformationEx );
  387. GRAB_ADDRESS( SamsrvHandle, SamIFree_SAMPR_GET_GROUPS_BUFFER );
  388. GRAB_ADDRESS( SamsrvHandle, SamIFree_SAMPR_USER_INFO_BUFFER );
  389. GRAB_ADDRESS( SamsrvHandle, SamIFree_SAMPR_ULONG_ARRAY );
  390. GRAB_ADDRESS( SamsrvHandle, SamIFree_SAMPR_RETURNED_USTRING_ARRAY );
  391. GRAB_ADDRESS( SamsrvHandle, SamIFreeSidAndAttributesList );
  392. GRAB_ADDRESS( SamsrvHandle, SamIIncrementPerformanceCounter );
  393. GRAB_ADDRESS( SamsrvHandle, SamIFreeVoid );
  394. GRAB_ADDRESS( SamsrvHandle, SamIUPNFromUserHandle );
  395. GRAB_ADDRESS( SamsrvHandle, SamIUpdateLogonStatistics );
  396. GRAB_ADDRESS( LsasrvHandle, LsaIOpenPolicyTrusted );
  397. GRAB_ADDRESS( LsasrvHandle, LsaIQueryInformationPolicyTrusted );
  398. GRAB_ADDRESS( LsasrvHandle, LsarClose );
  399. GRAB_ADDRESS( LsasrvHandle, LsarQueryInformationPolicy );
  400. GRAB_ADDRESS( LsasrvHandle, LsaIFree_LSAPR_POLICY_INFORMATION );
  401. GRAB_ADDRESS( LsasrvHandle, LsarCreateSecret );
  402. GRAB_ADDRESS( LsasrvHandle, LsarOpenSecret );
  403. GRAB_ADDRESS( LsasrvHandle, LsarSetSecret );
  404. GRAB_ADDRESS( LsasrvHandle, LsarQuerySecret );
  405. GRAB_ADDRESS( LsasrvHandle, LsarDelete );
  406. GRAB_ADDRESS( LsasrvHandle, LsaIFree_LSAPR_CR_CIPHER_VALUE );
  407. GRAB_ADDRESS( LsasrvHandle, LsaIRegisterPolicyChangeNotificationCallback );
  408. GRAB_ADDRESS( LsasrvHandle, LsaIUnregisterPolicyChangeNotificationCallback );
  409. GRAB_ADDRESS( LsasrvHandle, LsaIAuditAccountLogon );
  410. GRAB_ADDRESS( LsasrvHandle, LsaIGetLogonGuid );
  411. GRAB_ADDRESS( LsasrvHandle, LsaISetLogonGuidInLogonSession );
  412. GRAB_ADDRESS( LsasrvHandle, LsaIAuditKerberosLogon );
  413. GRAB_ADDRESS( LsasrvHandle, LsaIAuditLogonUsingExplicitCreds );
  414. GRAB_ADDRESS( LsasrvHandle, LsaICallPackage );
  415. GRAB_ADDRESS( LsasrvHandle, LsaIAddNameToLogonSession );
  416. SrvDllsLoaded = TRUE;
  417. Cleanup:
  418. if (!NT_SUCCESS(Status))
  419. {
  420. DllLoadStatus = Status;
  421. }
  422. return(Status);
  423. }
  424. ///////////////////////////////////////////////////////////////////////
  425. NTSTATUS
  426. I_SamrSetInformationUser(
  427. IN SAMPR_HANDLE UserHandle,
  428. IN USER_INFORMATION_CLASS UserInformationClass,
  429. IN PSAMPR_USER_INFO_BUFFER Buffer
  430. )
  431. {
  432. NTSTATUS Status;
  433. if (!SrvDllsLoaded)
  434. {
  435. Status = EnsureSrvDllsLoaded();
  436. if (!NT_SUCCESS(Status)) {
  437. return(Status);
  438. }
  439. }
  440. return((*pI_SamrSetInformationUser)(
  441. UserHandle,
  442. UserInformationClass,
  443. Buffer
  444. ));
  445. }
  446. NTSTATUS
  447. I_SamrGetGroupsForUser(
  448. IN SAMPR_HANDLE UserHandle,
  449. OUT PSAMPR_GET_GROUPS_BUFFER *Groups
  450. )
  451. {
  452. NTSTATUS Status;
  453. if (!SrvDllsLoaded)
  454. {
  455. Status = EnsureSrvDllsLoaded();
  456. if (!NT_SUCCESS(Status)) {
  457. return(Status);
  458. }
  459. }
  460. return((*pI_SamrGetGroupsForUser)(
  461. UserHandle,
  462. Groups
  463. ));
  464. }
  465. NTSTATUS
  466. I_SamrCloseHandle(
  467. IN OUT SAMPR_HANDLE * SamHandle
  468. )
  469. {
  470. NTSTATUS Status;
  471. if (!SrvDllsLoaded)
  472. {
  473. Status = EnsureSrvDllsLoaded();
  474. if (!NT_SUCCESS(Status)) {
  475. return(Status);
  476. }
  477. }
  478. return((*pI_SamrCloseHandle)( SamHandle ));
  479. }
  480. NTSTATUS
  481. I_SamrQueryInformationUser(
  482. IN SAMPR_HANDLE UserHandle,
  483. IN USER_INFORMATION_CLASS UserInformationClass,
  484. OUT PSAMPR_USER_INFO_BUFFER *Buffer
  485. )
  486. {
  487. NTSTATUS Status;
  488. if (!SrvDllsLoaded)
  489. {
  490. Status = EnsureSrvDllsLoaded();
  491. if (!NT_SUCCESS(Status)) {
  492. return(Status);
  493. }
  494. }
  495. return((*pI_SamrQueryInformationUser)(
  496. UserHandle,
  497. UserInformationClass,
  498. Buffer
  499. ));
  500. }
  501. NTSTATUS
  502. I_SamrOpenUser(
  503. IN SAMPR_HANDLE DomainHandle,
  504. IN ACCESS_MASK DesiredAccess,
  505. IN ULONG UserId,
  506. OUT SAMPR_HANDLE * UserHandle
  507. )
  508. {
  509. NTSTATUS Status;
  510. if (!SrvDllsLoaded)
  511. {
  512. Status = EnsureSrvDllsLoaded();
  513. if (!NT_SUCCESS(Status)) {
  514. return(Status);
  515. }
  516. }
  517. return((*pI_SamrOpenUser)(
  518. DomainHandle,
  519. DesiredAccess,
  520. UserId,
  521. UserHandle
  522. ));
  523. }
  524. NTSTATUS
  525. I_SamrLookupNamesInDomain(
  526. IN SAMPR_HANDLE DomainHandle,
  527. IN ULONG Count,
  528. IN RPC_UNICODE_STRING Names[],
  529. OUT PSAMPR_ULONG_ARRAY RelativeIds,
  530. OUT PSAMPR_ULONG_ARRAY Use
  531. )
  532. {
  533. NTSTATUS Status;
  534. if (!SrvDllsLoaded)
  535. {
  536. Status = EnsureSrvDllsLoaded();
  537. if (!NT_SUCCESS(Status)) {
  538. return(Status);
  539. }
  540. }
  541. return((*pI_SamrLookupNamesInDomain)(
  542. DomainHandle,
  543. Count,
  544. Names,
  545. RelativeIds,
  546. Use
  547. ));
  548. }
  549. NTSTATUS
  550. I_SamrLookupIdsInDomain(
  551. IN SAMPR_HANDLE DomainHandle,
  552. IN ULONG Count,
  553. IN PULONG RelativeIds,
  554. OUT PSAMPR_RETURNED_USTRING_ARRAY Names,
  555. OUT PSAMPR_ULONG_ARRAY Use
  556. )
  557. {
  558. NTSTATUS Status;
  559. if (!SrvDllsLoaded)
  560. {
  561. Status = EnsureSrvDllsLoaded();
  562. if (!NT_SUCCESS(Status)) {
  563. return(Status);
  564. }
  565. }
  566. return((*pI_SamrLookupIdsInDomain)(
  567. DomainHandle,
  568. Count,
  569. RelativeIds,
  570. Names,
  571. Use
  572. ));
  573. }
  574. NTSTATUS
  575. I_SamrOpenDomain(
  576. IN SAMPR_HANDLE ServerHandle,
  577. IN ACCESS_MASK DesiredAccess,
  578. IN PRPC_SID DomainId,
  579. OUT SAMPR_HANDLE * DomainHandle
  580. )
  581. {
  582. NTSTATUS Status;
  583. if (!SrvDllsLoaded)
  584. {
  585. Status = EnsureSrvDllsLoaded();
  586. if (!NT_SUCCESS(Status)) {
  587. return(Status);
  588. }
  589. }
  590. return((*pI_SamrOpenDomain)(
  591. ServerHandle,
  592. DesiredAccess,
  593. DomainId,
  594. DomainHandle
  595. ));
  596. }
  597. NTSTATUS
  598. I_SamrQueryInformationDomain(
  599. IN SAMPR_HANDLE DomainHandle,
  600. IN DOMAIN_INFORMATION_CLASS DomainInformationClass,
  601. OUT PSAMPR_DOMAIN_INFO_BUFFER *Buffer
  602. ){
  603. NTSTATUS Status;
  604. if (!SrvDllsLoaded)
  605. {
  606. Status = EnsureSrvDllsLoaded();
  607. if (!NT_SUCCESS(Status)) {
  608. return(Status);
  609. }
  610. }
  611. return((*pI_SamrQueryInformationDomain)(
  612. DomainHandle,
  613. DomainInformationClass,
  614. Buffer
  615. ));
  616. }
  617. NTSTATUS
  618. I_SamIConnect(
  619. IN PSAMPR_SERVER_NAME ServerName,
  620. OUT SAMPR_HANDLE *ServerHandle,
  621. IN ACCESS_MASK DesiredAccess,
  622. IN BOOLEAN TrustedClient
  623. )
  624. {
  625. NTSTATUS Status;
  626. if (!SrvDllsLoaded)
  627. {
  628. Status = EnsureSrvDllsLoaded();
  629. if (!NT_SUCCESS(Status)) {
  630. return(Status);
  631. }
  632. }
  633. return((*pI_SamIConnect)(
  634. ServerName,
  635. ServerHandle,
  636. DesiredAccess,
  637. TrustedClient
  638. ));
  639. }
  640. NTSTATUS
  641. I_SamIAccountRestrictions(
  642. IN SAM_HANDLE UserHandle,
  643. IN PUNICODE_STRING LogonWorkstation,
  644. IN PUNICODE_STRING Workstations,
  645. IN PLOGON_HOURS LogonHours,
  646. OUT PLARGE_INTEGER LogoffTime,
  647. OUT PLARGE_INTEGER KickoffTime
  648. )
  649. {
  650. NTSTATUS Status;
  651. if (!SrvDllsLoaded)
  652. {
  653. Status = EnsureSrvDllsLoaded();
  654. if (!NT_SUCCESS(Status)) {
  655. return(Status);
  656. }
  657. }
  658. return((*pI_SamIAccountRestrictions)(
  659. UserHandle,
  660. LogonWorkstation,
  661. Workstations,
  662. LogonHours,
  663. LogoffTime,
  664. KickoffTime
  665. ));
  666. }
  667. NTSTATUS
  668. I_SamIGetUserLogonInformation(
  669. IN SAMPR_HANDLE DomainHandle,
  670. IN ULONG Flags,
  671. IN PUNICODE_STRING AccountName,
  672. OUT PSAMPR_USER_INFO_BUFFER * Buffer,
  673. OUT PSID_AND_ATTRIBUTES_LIST ReverseMembership,
  674. OUT OPTIONAL SAMPR_HANDLE * UserHandle
  675. )
  676. {
  677. NTSTATUS Status;
  678. if (!SrvDllsLoaded)
  679. {
  680. Status = EnsureSrvDllsLoaded();
  681. if (!NT_SUCCESS(Status)) {
  682. return(Status);
  683. }
  684. }
  685. return((*pI_SamIGetUserLogonInformation)(
  686. DomainHandle,
  687. Flags,
  688. AccountName,
  689. Buffer,
  690. ReverseMembership,
  691. UserHandle
  692. ));
  693. }
  694. NTSTATUS
  695. I_SamIGetUserLogonInformationEx(
  696. IN SAMPR_HANDLE DomainHandle,
  697. IN ULONG Flags,
  698. IN PUNICODE_STRING AccountName,
  699. IN ULONG WhichFields,
  700. OUT PSAMPR_USER_INFO_BUFFER * Buffer,
  701. OUT PSID_AND_ATTRIBUTES_LIST ReverseMembership,
  702. OUT OPTIONAL SAMPR_HANDLE * UserHandle
  703. )
  704. {
  705. NTSTATUS Status;
  706. if (!SrvDllsLoaded)
  707. {
  708. Status = EnsureSrvDllsLoaded();
  709. if (!NT_SUCCESS(Status)) {
  710. return(Status);
  711. }
  712. }
  713. return((*pI_SamIGetUserLogonInformationEx)(
  714. DomainHandle,
  715. Flags,
  716. AccountName,
  717. WhichFields,
  718. Buffer,
  719. ReverseMembership,
  720. UserHandle
  721. ));
  722. }
  723. VOID
  724. I_SamIFree_SAMPR_GET_GROUPS_BUFFER (
  725. PSAMPR_GET_GROUPS_BUFFER Source
  726. )
  727. {
  728. NTSTATUS Status;
  729. if (!SrvDllsLoaded)
  730. {
  731. Status = EnsureSrvDllsLoaded();
  732. if (!NT_SUCCESS(Status)) {
  733. return;
  734. }
  735. }
  736. (*pI_SamIFree_SAMPR_GET_GROUPS_BUFFER)( Source );
  737. }
  738. VOID
  739. I_SamIFree_SAMPR_USER_INFO_BUFFER (
  740. PSAMPR_USER_INFO_BUFFER Source,
  741. USER_INFORMATION_CLASS Branch
  742. )
  743. {
  744. NTSTATUS Status;
  745. if (!SrvDllsLoaded)
  746. {
  747. Status = EnsureSrvDllsLoaded();
  748. if (!NT_SUCCESS(Status)) {
  749. return;
  750. }
  751. }
  752. (*pI_SamIFree_SAMPR_USER_INFO_BUFFER)(
  753. Source,
  754. Branch
  755. );
  756. }
  757. VOID
  758. I_SamIFree_SAMPR_ULONG_ARRAY (
  759. PSAMPR_ULONG_ARRAY Source
  760. )
  761. {
  762. NTSTATUS Status;
  763. if (!SrvDllsLoaded)
  764. {
  765. Status = EnsureSrvDllsLoaded();
  766. if (!NT_SUCCESS(Status)) {
  767. return;
  768. }
  769. }
  770. (*pI_SamIFree_SAMPR_ULONG_ARRAY)( Source );
  771. }
  772. VOID
  773. I_SamIFree_SAMPR_RETURNED_USTRING_ARRAY(
  774. PSAMPR_RETURNED_USTRING_ARRAY Source
  775. )
  776. {
  777. NTSTATUS Status;
  778. if (!SrvDllsLoaded)
  779. {
  780. Status = EnsureSrvDllsLoaded();
  781. if (!NT_SUCCESS(Status)) {
  782. return;
  783. }
  784. }
  785. (*pI_SamIFree_SAMPR_RETURNED_USTRING_ARRAY)( Source );
  786. }
  787. VOID
  788. I_SamIFreeSidAndAttributesList(
  789. IN PSID_AND_ATTRIBUTES_LIST List
  790. )
  791. {
  792. NTSTATUS Status;
  793. if (!SrvDllsLoaded)
  794. {
  795. Status = EnsureSrvDllsLoaded();
  796. if (!NT_SUCCESS(Status)) {
  797. return;
  798. }
  799. }
  800. (*pI_SamIFreeSidAndAttributesList)( List );
  801. }
  802. VOID
  803. I_SamIIncrementPerformanceCounter(
  804. IN SAM_PERF_COUNTER_TYPE CounterType
  805. )
  806. {
  807. NTSTATUS Status;
  808. if (!SrvDllsLoaded)
  809. {
  810. Status = EnsureSrvDllsLoaded();
  811. if (!NT_SUCCESS(Status)) {
  812. return;
  813. }
  814. }
  815. (*pI_SamIIncrementPerformanceCounter)( CounterType );
  816. }
  817. VOID
  818. I_SamIFreeVoid(
  819. IN PVOID ptr
  820. )
  821. {
  822. NTSTATUS Status;
  823. if (!SrvDllsLoaded)
  824. {
  825. Status = EnsureSrvDllsLoaded();
  826. if (!NT_SUCCESS(Status)) {
  827. return;
  828. }
  829. }
  830. (*pI_SamIFreeVoid)( ptr );
  831. }
  832. NTSTATUS
  833. I_SamIUPNFromUserHandle(
  834. IN SAMPR_HANDLE UserHandle,
  835. OUT BOOLEAN *UPNDefaulted,
  836. OUT PUNICODE_STRING UPN
  837. )
  838. {
  839. NTSTATUS Status;
  840. if (!SrvDllsLoaded)
  841. {
  842. Status = EnsureSrvDllsLoaded();
  843. if (!NT_SUCCESS(Status)) {
  844. return Status;
  845. }
  846. }
  847. return (*pI_SamIUPNFromUserHandle)( UserHandle, UPNDefaulted, UPN );
  848. }
  849. NTSTATUS
  850. I_SamIUpdateLogonStatistics(
  851. IN SAMPR_HANDLE UserHandle,
  852. IN PSAM_LOGON_STATISTICS LogonStats
  853. )
  854. {
  855. NTSTATUS Status;
  856. if (!SrvDllsLoaded)
  857. {
  858. Status = EnsureSrvDllsLoaded();
  859. if (!NT_SUCCESS(Status)) {
  860. return Status;
  861. }
  862. }
  863. return (*pI_SamIUpdateLogonStatistics)( UserHandle, LogonStats );
  864. }
  865. NTSTATUS
  866. I_LsaIOpenPolicyTrusted(
  867. OUT PLSAPR_HANDLE PolicyHandle
  868. )
  869. {
  870. NTSTATUS Status;
  871. if (!SrvDllsLoaded)
  872. {
  873. Status = EnsureSrvDllsLoaded();
  874. if (!NT_SUCCESS(Status)) {
  875. return(Status);
  876. }
  877. }
  878. return((*pI_LsaIOpenPolicyTrusted)( PolicyHandle ));
  879. }
  880. NTSTATUS
  881. I_LsaIQueryInformationPolicyTrusted(
  882. IN POLICY_INFORMATION_CLASS InformationClass,
  883. OUT PLSAPR_POLICY_INFORMATION *Buffer
  884. )
  885. {
  886. NTSTATUS Status;
  887. if (!SrvDllsLoaded)
  888. {
  889. Status = EnsureSrvDllsLoaded();
  890. if (!NT_SUCCESS(Status)) {
  891. return(Status);
  892. }
  893. }
  894. return((*pI_LsaIQueryInformationPolicyTrusted)(
  895. InformationClass,
  896. Buffer
  897. ));
  898. }
  899. NTSTATUS
  900. I_LsarClose(
  901. IN OUT LSAPR_HANDLE * LsaHandle
  902. )
  903. {
  904. NTSTATUS Status;
  905. if (!SrvDllsLoaded)
  906. {
  907. Status = EnsureSrvDllsLoaded();
  908. if (!NT_SUCCESS(Status)) {
  909. return(Status);
  910. }
  911. }
  912. return((*pI_LsarClose)( LsaHandle ));
  913. }
  914. NTSTATUS
  915. I_LsarQueryInformationPolicy(
  916. IN LSAPR_HANDLE PolicyHandle,
  917. IN POLICY_INFORMATION_CLASS InformationClass,
  918. OUT PLSAPR_POLICY_INFORMATION *PolicyInformation
  919. )
  920. {
  921. NTSTATUS Status;
  922. if (!SrvDllsLoaded)
  923. {
  924. Status = EnsureSrvDllsLoaded();
  925. if (!NT_SUCCESS(Status)) {
  926. return(Status);
  927. }
  928. }
  929. return((*pI_LsarQueryInformationPolicy)(
  930. PolicyHandle,
  931. InformationClass,
  932. PolicyInformation
  933. ));
  934. }
  935. VOID
  936. I_LsaIFree_LSAPR_POLICY_INFORMATION (
  937. IN POLICY_INFORMATION_CLASS InformationClass,
  938. IN PLSAPR_POLICY_INFORMATION PolicyInformation
  939. )
  940. {
  941. NTSTATUS Status;
  942. if (!SrvDllsLoaded)
  943. {
  944. Status = EnsureSrvDllsLoaded();
  945. if (!NT_SUCCESS(Status)) {
  946. return;
  947. }
  948. }
  949. (*pI_LsaIFree_LSAPR_POLICY_INFORMATION)(
  950. InformationClass,
  951. PolicyInformation
  952. );
  953. }
  954. NTSTATUS
  955. I_LsarCreateSecret(
  956. IN LSAPR_HANDLE PolicyHandle,
  957. IN PLSAPR_UNICODE_STRING SecretName,
  958. IN ACCESS_MASK DesiredAccess,
  959. OUT LSAPR_HANDLE *SecretHandle
  960. )
  961. {
  962. NTSTATUS Status;
  963. if (!SrvDllsLoaded)
  964. {
  965. Status = EnsureSrvDllsLoaded();
  966. if (!NT_SUCCESS(Status)) {
  967. return(Status);
  968. }
  969. }
  970. return((*pI_LsarCreateSecret)(
  971. PolicyHandle,
  972. SecretName,
  973. DesiredAccess,
  974. SecretHandle ));
  975. }
  976. NTSTATUS
  977. I_LsarOpenSecret(
  978. IN LSAPR_HANDLE PolicyHandle,
  979. IN PLSAPR_UNICODE_STRING SecretName,
  980. IN ACCESS_MASK DesiredAccess,
  981. OUT LSAPR_HANDLE *SecretHandle
  982. )
  983. {
  984. NTSTATUS Status;
  985. if (!SrvDllsLoaded)
  986. {
  987. Status = EnsureSrvDllsLoaded();
  988. if (!NT_SUCCESS(Status)) {
  989. return(Status);
  990. }
  991. }
  992. return((*pI_LsarOpenSecret)(
  993. PolicyHandle,
  994. SecretName,
  995. DesiredAccess,
  996. SecretHandle ));
  997. }
  998. NTSTATUS
  999. I_LsarSetSecret(
  1000. IN LSAPR_HANDLE SecretHandle,
  1001. IN PLSAPR_CR_CIPHER_VALUE EncryptedCurrentValue,
  1002. IN PLSAPR_CR_CIPHER_VALUE EncryptedOldValue
  1003. )
  1004. {
  1005. NTSTATUS Status;
  1006. if (!SrvDllsLoaded)
  1007. {
  1008. Status = EnsureSrvDllsLoaded();
  1009. if (!NT_SUCCESS(Status)) {
  1010. return(Status);
  1011. }
  1012. }
  1013. return((*pI_LsarSetSecret)(
  1014. SecretHandle,
  1015. EncryptedCurrentValue,
  1016. EncryptedOldValue
  1017. ));
  1018. }
  1019. NTSTATUS
  1020. I_LsarQuerySecret(
  1021. IN LSAPR_HANDLE SecretHandle,
  1022. IN OUT OPTIONAL PLSAPR_CR_CIPHER_VALUE *EncryptedCurrentValue,
  1023. IN OUT OPTIONAL PLARGE_INTEGER CurrentValueSetTime,
  1024. IN OUT OPTIONAL PLSAPR_CR_CIPHER_VALUE *EncryptedOldValue,
  1025. IN OUT OPTIONAL PLARGE_INTEGER OldValueSetTime
  1026. )
  1027. {
  1028. NTSTATUS Status;
  1029. if (!SrvDllsLoaded)
  1030. {
  1031. Status = EnsureSrvDllsLoaded();
  1032. if (!NT_SUCCESS(Status)) {
  1033. return(Status);
  1034. }
  1035. }
  1036. return((*pI_LsarQuerySecret)(
  1037. SecretHandle,
  1038. EncryptedCurrentValue,
  1039. CurrentValueSetTime,
  1040. EncryptedOldValue,
  1041. OldValueSetTime));
  1042. }
  1043. NTSTATUS
  1044. I_LsarDelete(
  1045. IN LSAPR_HANDLE ObjectHandle
  1046. )
  1047. {
  1048. NTSTATUS Status;
  1049. if (!SrvDllsLoaded)
  1050. {
  1051. Status = EnsureSrvDllsLoaded();
  1052. if (!NT_SUCCESS(Status)) {
  1053. return(Status);
  1054. }
  1055. }
  1056. return((*pI_LsarDelete)( ObjectHandle ));
  1057. }
  1058. VOID
  1059. I_LsaIFree_LSAPR_CR_CIPHER_VALUE (
  1060. IN PLSAPR_CR_CIPHER_VALUE CipherValue
  1061. )
  1062. {
  1063. NTSTATUS Status;
  1064. if (!SrvDllsLoaded)
  1065. {
  1066. Status = EnsureSrvDllsLoaded();
  1067. if (!NT_SUCCESS(Status)) {
  1068. return;
  1069. }
  1070. }
  1071. (*pI_LsaIFree_LSAPR_CR_CIPHER_VALUE)(
  1072. CipherValue
  1073. );
  1074. }
  1075. NTSTATUS NTAPI
  1076. I_LsaIRegisterPolicyChangeNotificationCallback(
  1077. IN pfLsaPolicyChangeNotificationCallback Callback,
  1078. IN POLICY_NOTIFICATION_INFORMATION_CLASS MonitorInfoClass
  1079. )
  1080. {
  1081. NTSTATUS Status;
  1082. if (!SrvDllsLoaded)
  1083. {
  1084. Status = EnsureSrvDllsLoaded();
  1085. if (!NT_SUCCESS(Status)) {
  1086. return(Status);
  1087. }
  1088. }
  1089. return((*pI_LsaIRegisterPolicyChangeNotificationCallback)(
  1090. Callback,
  1091. MonitorInfoClass
  1092. ));
  1093. }
  1094. NTSTATUS NTAPI
  1095. I_LsaIUnregisterPolicyChangeNotificationCallback(
  1096. IN pfLsaPolicyChangeNotificationCallback Callback,
  1097. IN POLICY_NOTIFICATION_INFORMATION_CLASS MonitorInfoClass
  1098. )
  1099. {
  1100. NTSTATUS Status;
  1101. if (!SrvDllsLoaded)
  1102. {
  1103. Status = EnsureSrvDllsLoaded();
  1104. if (!NT_SUCCESS(Status)) {
  1105. return(Status);
  1106. }
  1107. }
  1108. return((*pI_LsaIUnregisterPolicyChangeNotificationCallback)(
  1109. Callback,
  1110. MonitorInfoClass
  1111. ));
  1112. }
  1113. NTSTATUS
  1114. I_LsaIAuditAccountLogon(
  1115. IN ULONG AuditId,
  1116. IN BOOLEAN Successful,
  1117. IN PUNICODE_STRING Source,
  1118. IN PUNICODE_STRING ClientName,
  1119. IN PUNICODE_STRING MappedName,
  1120. IN NTSTATUS Status OPTIONAL
  1121. )
  1122. {
  1123. NTSTATUS NtStatus;
  1124. if (!SrvDllsLoaded)
  1125. {
  1126. NtStatus = EnsureSrvDllsLoaded();
  1127. if (!NT_SUCCESS(NtStatus)) {
  1128. return(NtStatus);
  1129. }
  1130. }
  1131. return((*pI_LsaIAuditAccountLogon)(
  1132. AuditId,
  1133. Successful,
  1134. Source,
  1135. ClientName,
  1136. MappedName,
  1137. Status
  1138. ));
  1139. }
  1140. NTSTATUS
  1141. I_LsaIGetLogonGuid(
  1142. IN PUNICODE_STRING pUserName,
  1143. IN PUNICODE_STRING pUserDomain,
  1144. IN PBYTE pBuffer,
  1145. IN UINT BufferSize,
  1146. OUT LPGUID pLogonGuid
  1147. )
  1148. {
  1149. NTSTATUS NtStatus;
  1150. if (!SrvDllsLoaded)
  1151. {
  1152. NtStatus = EnsureSrvDllsLoaded();
  1153. if (!NT_SUCCESS(NtStatus)) {
  1154. return(NtStatus);
  1155. }
  1156. }
  1157. return (*pI_LsaIGetLogonGuid)(
  1158. pUserName,
  1159. pUserDomain,
  1160. pBuffer,
  1161. BufferSize,
  1162. pLogonGuid
  1163. );
  1164. }
  1165. NTSTATUS
  1166. I_LsaISetLogonGuidInLogonSession(
  1167. IN PLUID pLogonId,
  1168. IN LPGUID pLogonGuid
  1169. )
  1170. {
  1171. NTSTATUS NtStatus;
  1172. if (!SrvDllsLoaded)
  1173. {
  1174. NtStatus = EnsureSrvDllsLoaded();
  1175. if (!NT_SUCCESS(NtStatus)) {
  1176. return(NtStatus);
  1177. }
  1178. }
  1179. return (*pI_LsaISetLogonGuidInLogonSession)(
  1180. pLogonId,
  1181. pLogonGuid
  1182. );
  1183. }
  1184. VOID
  1185. I_LsaIAuditKerberosLogon(
  1186. IN NTSTATUS LogonStatus,
  1187. IN NTSTATUS LogonSubStatus,
  1188. IN PUNICODE_STRING AccountName,
  1189. IN PUNICODE_STRING AuthenticatingAuthority,
  1190. IN PUNICODE_STRING WorkstationName,
  1191. IN PSID UserSid, OPTIONAL
  1192. IN SECURITY_LOGON_TYPE LogonType,
  1193. IN PTOKEN_SOURCE TokenSource,
  1194. IN PLUID pLogonId,
  1195. IN LPGUID pLogonGuid
  1196. )
  1197. {
  1198. NTSTATUS NtStatus;
  1199. if (!SrvDllsLoaded)
  1200. {
  1201. NtStatus = EnsureSrvDllsLoaded();
  1202. if (!NT_SUCCESS(NtStatus)) {
  1203. return;
  1204. }
  1205. }
  1206. (*pI_LsaIAuditKerberosLogon)(
  1207. LogonStatus,
  1208. LogonSubStatus,
  1209. AccountName,
  1210. AuthenticatingAuthority,
  1211. WorkstationName,
  1212. UserSid,
  1213. LogonType,
  1214. TokenSource,
  1215. pLogonId,
  1216. pLogonGuid
  1217. );
  1218. }
  1219. NTSTATUS
  1220. I_LsaIAuditLogonUsingExplicitCreds(
  1221. IN USHORT AuditEventType,
  1222. IN PSID pUser1Sid,
  1223. IN PUNICODE_STRING pUser1Name,
  1224. IN PUNICODE_STRING pUser1Domain,
  1225. IN PLUID pUser1LogonId,
  1226. IN LPGUID pUser1LogonGuid,
  1227. IN PUNICODE_STRING pUser2Name,
  1228. IN PUNICODE_STRING pUser2Domain,
  1229. IN LPGUID pUser2LogonGuid
  1230. )
  1231. {
  1232. NTSTATUS NtStatus;
  1233. if (!SrvDllsLoaded)
  1234. {
  1235. NtStatus = EnsureSrvDllsLoaded();
  1236. if (!NT_SUCCESS(NtStatus)) {
  1237. return NtStatus;
  1238. }
  1239. }
  1240. return (*pI_LsaIAuditLogonUsingExplicitCreds)(
  1241. AuditEventType,
  1242. pUser1Sid,
  1243. pUser1Name,
  1244. pUser1Domain,
  1245. pUser1LogonId,
  1246. pUser1LogonGuid,
  1247. pUser2Name,
  1248. pUser2Domain,
  1249. pUser2LogonGuid
  1250. );
  1251. }
  1252. NTSTATUS
  1253. I_LsaICallPackage(
  1254. IN PUNICODE_STRING AuthenticationPackage,
  1255. IN PVOID ProtocolSubmitBuffer,
  1256. IN ULONG SubmitBufferLength,
  1257. OUT PVOID *ProtocolReturnBuffer,
  1258. OUT PULONG ReturnBufferLength,
  1259. OUT PNTSTATUS ProtocolStatus
  1260. )
  1261. {
  1262. NTSTATUS NtStatus;
  1263. if (!SrvDllsLoaded)
  1264. {
  1265. NtStatus = EnsureSrvDllsLoaded();
  1266. if (!NT_SUCCESS(NtStatus)) {
  1267. return(NtStatus);
  1268. }
  1269. }
  1270. return((*pI_LsaICallPackage)(
  1271. AuthenticationPackage,
  1272. ProtocolSubmitBuffer,
  1273. SubmitBufferLength,
  1274. ProtocolReturnBuffer,
  1275. ReturnBufferLength,
  1276. ProtocolStatus
  1277. ));
  1278. }
  1279. NTSTATUS
  1280. I_LsaIAddNameToLogonSession(
  1281. IN PLUID LogonId,
  1282. IN ULONG NameFormat,
  1283. IN PUNICODE_STRING Name
  1284. )
  1285. {
  1286. NTSTATUS NtStatus;
  1287. if (!SrvDllsLoaded)
  1288. {
  1289. NtStatus = EnsureSrvDllsLoaded();
  1290. if (!NT_SUCCESS(NtStatus)) {
  1291. return(NtStatus);
  1292. }
  1293. }
  1294. return((*pI_LsaIAddNameToLogonSession)(
  1295. LogonId,
  1296. NameFormat,
  1297. Name));
  1298. }