ReactOS 0.4.15-dev-5666-gc548b97
samsrv.c File Reference
#include "samsrv.h"
#include <samsrv/samsrv.h>
Include dependency graph for samsrv.c:

Go to the source code of this file.

Functions

static NTSTATUS SampInitHashes (VOID)
 
NTSTATUS NTAPI SamIConnect (IN PSAMPR_SERVER_NAME ServerName, OUT SAMPR_HANDLE *ServerHandle, IN ACCESS_MASK DesiredAccess, IN BOOLEAN Trusted)
 
NTSTATUS NTAPI SamIInitialize (VOID)
 
NTSTATUS NTAPI SampInitializeRegistry (VOID)
 
VOID NTAPI SamIFreeVoid (PVOID Ptr)
 
VOID NTAPI SamIFree_SAMPR_ALIAS_INFO_BUFFER (PSAMPR_ALIAS_INFO_BUFFER Ptr, ALIAS_INFORMATION_CLASS InformationClass)
 
VOID NTAPI SamIFree_SAMPR_DISPLAY_INFO_BUFFER (PSAMPR_DISPLAY_INFO_BUFFER Ptr, DOMAIN_DISPLAY_INFORMATION InformationClass)
 
VOID NTAPI SamIFree_SAMPR_DOMAIN_INFO_BUFFER (PSAMPR_DOMAIN_INFO_BUFFER Ptr, DOMAIN_INFORMATION_CLASS InformationClass)
 
VOID NTAPI SamIFree_SAMPR_ENUMERATION_BUFFER (PSAMPR_ENUMERATION_BUFFER Ptr)
 
VOID NTAPI SamIFree_SAMPR_GET_GROUPS_BUFFER (PSAMPR_GET_GROUPS_BUFFER Ptr)
 
VOID NTAPI SamIFree_SAMPR_GET_MEMBERS_BUFFER (PSAMPR_GET_MEMBERS_BUFFER Ptr)
 
VOID NTAPI SamIFree_SAMPR_GROUP_INFO_BUFFER (PSAMPR_GROUP_INFO_BUFFER Ptr, GROUP_INFORMATION_CLASS InformationClass)
 
VOID NTAPI SamIFree_SAMPR_PSID_ARRAY (PSAMPR_PSID_ARRAY Ptr)
 
VOID NTAPI SamIFree_SAMPR_RETURNED_USTRING_ARRAY (PSAMPR_RETURNED_USTRING_ARRAY Ptr)
 
VOID NTAPI SamIFree_SAMPR_SR_SECURITY_DESCRIPTOR (PSAMPR_SR_SECURITY_DESCRIPTOR Ptr)
 
VOID NTAPI SamIFree_SAMPR_ULONG_ARRAY (PSAMPR_ULONG_ARRAY Ptr)
 
VOID NTAPI SamIFree_SAMPR_USER_INFO_BUFFER (PSAMPR_USER_INFO_BUFFER Ptr, USER_INFORMATION_CLASS InformationClass)
 

Variables

ENCRYPTED_NT_OWF_PASSWORD EmptyNtHash
 
ENCRYPTED_LM_OWF_PASSWORD EmptyLmHash
 
RTL_RESOURCE SampResource
 
NT_PRODUCT_TYPE SampProductType
 

Function Documentation

◆ SamIConnect()

NTSTATUS NTAPI SamIConnect ( IN PSAMPR_SERVER_NAME  ServerName,
OUT SAMPR_HANDLE ServerHandle,
IN ACCESS_MASK  DesiredAccess,
IN BOOLEAN  Trusted 
)

Definition at line 65 of file samsrv.c.

69{
70 PSAM_DB_OBJECT ServerObject;
72
73 TRACE("SamIConnect(%p %p %lx %ld)\n",
74 ServerName, ServerHandle, DesiredAccess, Trusted);
75
76 /* Map generic access rights */
79
80 /* Open the Server Object */
82 NULL,
83 L"SAM",
84 0,
87 &ServerObject);
88 if (NT_SUCCESS(Status))
89 {
90 ServerObject->Trusted = Trusted;
91 *ServerHandle = (SAMPR_HANDLE)ServerObject;
92 }
93
94 TRACE("SamIConnect done (Status 0x%08lx)\n", Status);
95
96 return Status;
97}
void * SAMPR_HANDLE
Definition: authpackage.c:113
LONG NTSTATUS
Definition: precomp.h:26
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS SampOpenDbObject(IN PSAM_DB_OBJECT ParentObject, IN LPWSTR ContainerName, IN LPWSTR ObjectName, IN ULONG RelativeId, IN SAM_DB_OBJECT_TYPE ObjectType, IN ACCESS_MASK DesiredAccess, OUT PSAM_DB_OBJECT *DbObject)
Definition: database.c:173
@ SamDbServerObject
Definition: samsrv.h:38
Status
Definition: gdiplustypes.h:25
NTSYSAPI VOID NTAPI RtlMapGenericMask(PACCESS_MASK AccessMask, PGENERIC_MAPPING GenericMapping)
#define L(x)
Definition: ntvdm.h:50
PGENERIC_MAPPING pServerMapping
Definition: samrpc.c:56
#define TRACE(s)
Definition: solgame.cpp:4
BOOLEAN Trusted
Definition: samsrv.h:55
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
Definition: wdfdevice.h:2658

◆ SamIFree_SAMPR_ALIAS_INFO_BUFFER()

VOID NTAPI SamIFree_SAMPR_ALIAS_INFO_BUFFER ( PSAMPR_ALIAS_INFO_BUFFER  Ptr,
ALIAS_INFORMATION_CLASS  InformationClass 
)

Definition at line 163 of file samsrv.c.

166{
167 if (Ptr == NULL)
168 return;
169
170 switch (InformationClass)
171 {
173 if (Ptr->General.Name.Buffer != NULL)
174 MIDL_user_free(Ptr->General.Name.Buffer);
175
176 if (Ptr->General.AdminComment.Buffer != NULL)
177 MIDL_user_free(Ptr->General.AdminComment.Buffer);
178 break;
179
181 if (Ptr->Name.Name.Buffer != NULL)
182 MIDL_user_free(Ptr->Name.Name.Buffer);
183 break;
184
186 if (Ptr->AdminComment.AdminComment.Buffer != NULL)
187 MIDL_user_free(Ptr->AdminComment.AdminComment.Buffer);
188 break;
189
190 default:
191 FIXME("Unsupported information class: %lu\n", InformationClass);
192 break;
193 }
194
196}
#define FIXME(fmt,...)
Definition: debug.h:111
_In_ FILTER_INFORMATION_CLASS InformationClass
Definition: fltkernel.h:1713
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
void __RPC_USER MIDL_user_free(void *p)
Definition: irotp.c:376
@ AliasGeneralInformation
Definition: ntsam.h:279
@ AliasAdminCommentInformation
Definition: ntsam.h:281
@ AliasNameInformation
Definition: ntsam.h:280

◆ SamIFree_SAMPR_DISPLAY_INFO_BUFFER()

VOID NTAPI SamIFree_SAMPR_DISPLAY_INFO_BUFFER ( PSAMPR_DISPLAY_INFO_BUFFER  Ptr,
DOMAIN_DISPLAY_INFORMATION  InformationClass 
)

Definition at line 201 of file samsrv.c.

204{
205 ULONG i;
206
207 if (Ptr == NULL)
208 return;
209
210 switch (InformationClass)
211 {
213 if (Ptr->UserInformation.Buffer != NULL)
214 {
215 for (i = 0; i < Ptr->UserInformation.EntriesRead; i++)
216 {
217 if (Ptr->UserInformation.Buffer[i].AccountName.Buffer != NULL)
218 MIDL_user_free(Ptr->UserInformation.Buffer[i].AccountName.Buffer);
219
220 if (Ptr->UserInformation.Buffer[i].AdminComment.Buffer != NULL)
221 MIDL_user_free(Ptr->UserInformation.Buffer[i].AdminComment.Buffer);
222
223 if (Ptr->UserInformation.Buffer[i].FullName.Buffer != NULL)
224 MIDL_user_free(Ptr->UserInformation.Buffer[i].FullName.Buffer);
225 }
226
227 MIDL_user_free(Ptr->UserInformation.Buffer);
228 }
229 break;
230
232 if (Ptr->MachineInformation.Buffer != NULL)
233 {
234 for (i = 0; i < Ptr->MachineInformation.EntriesRead; i++)
235 {
236 if (Ptr->MachineInformation.Buffer[i].AccountName.Buffer != NULL)
237 MIDL_user_free(Ptr->MachineInformation.Buffer[i].AccountName.Buffer);
238
239 if (Ptr->MachineInformation.Buffer[i].AdminComment.Buffer != NULL)
240 MIDL_user_free(Ptr->MachineInformation.Buffer[i].AdminComment.Buffer);
241 }
242
243 MIDL_user_free(Ptr->MachineInformation.Buffer);
244 }
245 break;
246
248 if (Ptr->GroupInformation.Buffer != NULL)
249 {
250 for (i = 0; i < Ptr->GroupInformation.EntriesRead; i++)
251 {
252 if (Ptr->GroupInformation.Buffer[i].AccountName.Buffer != NULL)
253 MIDL_user_free(Ptr->GroupInformation.Buffer[i].AccountName.Buffer);
254
255 if (Ptr->GroupInformation.Buffer[i].AdminComment.Buffer != NULL)
256 MIDL_user_free(Ptr->GroupInformation.Buffer[i].AdminComment.Buffer);
257 }
258
259 MIDL_user_free(Ptr->GroupInformation.Buffer);
260 }
261 break;
262
264 if (Ptr->OemUserInformation.Buffer != NULL)
265 {
266 for (i = 0; i < Ptr->OemUserInformation.EntriesRead; i++)
267 {
268 if (Ptr->OemUserInformation.Buffer[i].OemAccountName.Buffer != NULL)
269 MIDL_user_free(Ptr->OemUserInformation.Buffer[i].OemAccountName.Buffer);
270 }
271
272 MIDL_user_free(Ptr->OemUserInformation.Buffer);
273 }
274 break;
275
277 if (Ptr->OemGroupInformation.Buffer != NULL)
278 {
279 for (i = 0; i < Ptr->OemGroupInformation.EntriesRead; i++)
280 {
281 if (Ptr->OemGroupInformation.Buffer[i].OemAccountName.Buffer != NULL)
282 MIDL_user_free(Ptr->OemGroupInformation.Buffer[i].OemAccountName.Buffer);
283 }
284
285 MIDL_user_free(Ptr->OemGroupInformation.Buffer);
286 }
287 break;
288
289 default:
290 FIXME("Unsupported information class: %lu\n", InformationClass);
291 break;
292 }
293}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int ULONG
Definition: retypes.h:1
@ DomainDisplayUser
Definition: ntsam.h:303
@ DomainDisplayMachine
Definition: ntsam.h:304
@ DomainDisplayGroup
Definition: ntsam.h:305
@ DomainDisplayOemUser
Definition: ntsam.h:306
@ DomainDisplayOemGroup
Definition: ntsam.h:307

◆ SamIFree_SAMPR_DOMAIN_INFO_BUFFER()

VOID NTAPI SamIFree_SAMPR_DOMAIN_INFO_BUFFER ( PSAMPR_DOMAIN_INFO_BUFFER  Ptr,
DOMAIN_INFORMATION_CLASS  InformationClass 
)

Definition at line 298 of file samsrv.c.

301{
302 if (Ptr == NULL)
303 return;
304
305 switch (InformationClass)
306 {
308 break;
309
311 if (Ptr->General.OemInformation.Buffer != NULL)
312 MIDL_user_free(Ptr->General.OemInformation.Buffer);
313
314 if (Ptr->General.DomainName.Buffer != NULL)
315 MIDL_user_free(Ptr->General.DomainName.Buffer);
316
317 if (Ptr->General.ReplicaSourceNodeName.Buffer != NULL)
318 MIDL_user_free(Ptr->General.ReplicaSourceNodeName.Buffer);
319 break;
320
322 break;
323
325 if (Ptr->Oem.OemInformation.Buffer != NULL)
326 MIDL_user_free(Ptr->Oem.OemInformation.Buffer);
327 break;
328
330 if (Ptr->Name.DomainName.Buffer != NULL)
331 MIDL_user_free(Ptr->Name.DomainName.Buffer);
332 break;
333
335 if (Ptr->Replication.ReplicaSourceNodeName.Buffer != NULL)
336 MIDL_user_free(Ptr->Replication.ReplicaSourceNodeName.Buffer);
337 break;
338
340 break;
341
343 break;
344
346 break;
347
349 if (Ptr->General2.I1.OemInformation.Buffer != NULL)
350 MIDL_user_free(Ptr->General2.I1.OemInformation.Buffer);
351
352 if (Ptr->General2.I1.DomainName.Buffer != NULL)
353 MIDL_user_free(Ptr->General2.I1.DomainName.Buffer);
354
355 if (Ptr->General2.I1.ReplicaSourceNodeName.Buffer != NULL)
356 MIDL_user_free(Ptr->General2.I1.ReplicaSourceNodeName.Buffer);
357 break;
358
360 break;
361
363 break;
364
365 default:
366 FIXME("Unsupported information class: %lu\n", InformationClass);
367 break;
368 }
369
371}
@ DomainLogoffInformation
Definition: ntsam.h:343
@ DomainReplicationInformation
Definition: ntsam.h:346
@ DomainOemInformation
Definition: ntsam.h:344
@ DomainNameInformation
Definition: ntsam.h:345
@ DomainServerRoleInformation
Definition: ntsam.h:347
@ DomainPasswordInformation
Definition: ntsam.h:341
@ DomainLockoutInformation
Definition: ntsam.h:352
@ DomainModifiedInformation2
Definition: ntsam.h:353
@ DomainGeneralInformation
Definition: ntsam.h:342
@ DomainGeneralInformation2
Definition: ntsam.h:351
@ DomainStateInformation
Definition: ntsam.h:349
@ DomainModifiedInformation
Definition: ntsam.h:348

◆ SamIFree_SAMPR_ENUMERATION_BUFFER()

VOID NTAPI SamIFree_SAMPR_ENUMERATION_BUFFER ( PSAMPR_ENUMERATION_BUFFER  Ptr)

Definition at line 376 of file samsrv.c.

377{
378 ULONG i;
379
380 if (Ptr == NULL)
381 return;
382
383 if (Ptr->Buffer != NULL)
384 {
385 for (i = 0; i < Ptr->EntriesRead; i++)
386 {
387 if (Ptr->Buffer[i].Name.Buffer != NULL)
388 MIDL_user_free(Ptr->Buffer[i].Name.Buffer);
389 }
390
391 MIDL_user_free(Ptr->Buffer);
392 }
393
395}

◆ SamIFree_SAMPR_GET_GROUPS_BUFFER()

VOID NTAPI SamIFree_SAMPR_GET_GROUPS_BUFFER ( PSAMPR_GET_GROUPS_BUFFER  Ptr)

Definition at line 400 of file samsrv.c.

401{
402 if (Ptr == NULL)
403 return;
404
405 if (Ptr->Groups != NULL)
406 MIDL_user_free(Ptr->Groups);
407
409}

◆ SamIFree_SAMPR_GET_MEMBERS_BUFFER()

VOID NTAPI SamIFree_SAMPR_GET_MEMBERS_BUFFER ( PSAMPR_GET_MEMBERS_BUFFER  Ptr)

Definition at line 414 of file samsrv.c.

415{
416 if (Ptr == NULL)
417 return;
418
419 if (Ptr->Members != NULL)
420 MIDL_user_free(Ptr->Members);
421
422 if (Ptr->Attributes != NULL)
423 MIDL_user_free(Ptr->Attributes);
424
426}

◆ SamIFree_SAMPR_GROUP_INFO_BUFFER()

VOID NTAPI SamIFree_SAMPR_GROUP_INFO_BUFFER ( PSAMPR_GROUP_INFO_BUFFER  Ptr,
GROUP_INFORMATION_CLASS  InformationClass 
)

Definition at line 431 of file samsrv.c.

434{
435 if (Ptr == NULL)
436 return;
437
438 switch (InformationClass)
439 {
441 if (Ptr->General.Name.Buffer != NULL)
442 MIDL_user_free(Ptr->General.Name.Buffer);
443
444 if (Ptr->General.AdminComment.Buffer != NULL)
445 MIDL_user_free(Ptr->General.AdminComment.Buffer);
446 break;
447
449 if (Ptr->Name.Name.Buffer != NULL)
450 MIDL_user_free(Ptr->Name.Name.Buffer);
451 break;
452
454 break;
455
457 if (Ptr->AdminComment.AdminComment.Buffer != NULL)
458 MIDL_user_free(Ptr->AdminComment.AdminComment.Buffer);
459 break;
460
461 default:
462 FIXME("Unsupported information class: %lu\n", InformationClass);
463 break;
464 }
465
467}
@ GroupAttributeInformation
Definition: ntsam.h:466
@ GroupGeneralInformation
Definition: ntsam.h:464
@ GroupNameInformation
Definition: ntsam.h:465
@ GroupAdminCommentInformation
Definition: ntsam.h:467

◆ SamIFree_SAMPR_PSID_ARRAY()

VOID NTAPI SamIFree_SAMPR_PSID_ARRAY ( PSAMPR_PSID_ARRAY  Ptr)

Definition at line 472 of file samsrv.c.

473{
474 if (Ptr == NULL)
475 return;
476
477 if (Ptr->Sids != NULL)
478 {
479 MIDL_user_free(Ptr->Sids);
480 }
481}

◆ SamIFree_SAMPR_RETURNED_USTRING_ARRAY()

VOID NTAPI SamIFree_SAMPR_RETURNED_USTRING_ARRAY ( PSAMPR_RETURNED_USTRING_ARRAY  Ptr)

Definition at line 486 of file samsrv.c.

487{
488 ULONG i;
489
490 if (Ptr == NULL)
491 return;
492
493 if (Ptr->Element != NULL)
494 {
495 for (i = 0; i < Ptr->Count; i++)
496 {
497 if (Ptr->Element[i].Buffer != NULL)
498 MIDL_user_free(Ptr->Element[i].Buffer);
499 }
500
501 MIDL_user_free(Ptr->Element);
502 Ptr->Element = NULL;
503 Ptr->Count = 0;
504 }
505}

Referenced by LsapLookupAccountDomainSids(), and LsapLookupBuiltinDomainSids().

◆ SamIFree_SAMPR_SR_SECURITY_DESCRIPTOR()

VOID NTAPI SamIFree_SAMPR_SR_SECURITY_DESCRIPTOR ( PSAMPR_SR_SECURITY_DESCRIPTOR  Ptr)

Definition at line 510 of file samsrv.c.

511{
512 if (Ptr == NULL)
513 return;
514
515 if (Ptr->SecurityDescriptor != NULL)
516 MIDL_user_free(Ptr->SecurityDescriptor);
517
519}

◆ SamIFree_SAMPR_ULONG_ARRAY()

VOID NTAPI SamIFree_SAMPR_ULONG_ARRAY ( PSAMPR_ULONG_ARRAY  Ptr)

Definition at line 524 of file samsrv.c.

525{
526 if (Ptr == NULL)
527 return;
528
529 if (Ptr->Element != NULL)
530 {
531 MIDL_user_free(Ptr->Element);
532 Ptr->Element = NULL;
533 Ptr->Count = 0;
534 }
535}

Referenced by LsapAddSamGroups(), LsapLookupAccountDomainSids(), LsapLookupAccountNames(), LsapLookupBuiltinDomainSids(), LsapLookupBuiltinNames(), LsapLookupIsolatedAccountNames(), LsapLookupIsolatedBuiltinNames(), MsvpChangePassword(), and SamValidateNormalUser().

◆ SamIFree_SAMPR_USER_INFO_BUFFER()

VOID NTAPI SamIFree_SAMPR_USER_INFO_BUFFER ( PSAMPR_USER_INFO_BUFFER  Ptr,
USER_INFORMATION_CLASS  InformationClass 
)

Definition at line 540 of file samsrv.c.

542{
543 if (Ptr == NULL)
544 return;
545
546 switch (InformationClass)
547 {
549 if (Ptr->General.UserName.Buffer != NULL)
550 MIDL_user_free(Ptr->General.UserName.Buffer);
551
552 if (Ptr->General.FullName.Buffer != NULL)
553 MIDL_user_free(Ptr->General.FullName.Buffer);
554
555 if (Ptr->General.AdminComment.Buffer != NULL)
556 MIDL_user_free(Ptr->General.AdminComment.Buffer);
557
558 if (Ptr->General.UserComment.Buffer != NULL)
559 MIDL_user_free(Ptr->General.UserComment.Buffer);
560 break;
561
563 if (Ptr->Preferences.UserComment.Buffer != NULL)
564 MIDL_user_free(Ptr->Preferences.UserComment.Buffer);
565
566 if (Ptr->Preferences.Reserved1.Buffer != NULL)
567 MIDL_user_free(Ptr->Preferences.Reserved1.Buffer);
568 break;
569
571 if (Ptr->Logon.UserName.Buffer != NULL)
572 MIDL_user_free(Ptr->Logon.UserName.Buffer);
573
574 if (Ptr->Logon.FullName.Buffer != NULL)
575 MIDL_user_free(Ptr->Logon.FullName.Buffer);
576
577 if (Ptr->Logon.HomeDirectory.Buffer != NULL)
578 MIDL_user_free(Ptr->Logon.HomeDirectory.Buffer);
579
580 if (Ptr->Logon.HomeDirectoryDrive.Buffer != NULL)
581 MIDL_user_free(Ptr->Logon.HomeDirectoryDrive.Buffer);
582
583 if (Ptr->Logon.ScriptPath.Buffer != NULL)
584 MIDL_user_free(Ptr->Logon.ScriptPath.Buffer);
585
586 if (Ptr->Logon.ProfilePath.Buffer != NULL)
587 MIDL_user_free(Ptr->Logon.ProfilePath.Buffer);
588
589 if (Ptr->Logon.WorkStations.Buffer != NULL)
590 MIDL_user_free(Ptr->Logon.WorkStations.Buffer);
591
592 if (Ptr->Logon.LogonHours.LogonHours != NULL)
593 MIDL_user_free(Ptr->Logon.LogonHours.LogonHours);
594 break;
595
597 if (Ptr->LogonHours.LogonHours.LogonHours != NULL)
598 MIDL_user_free(Ptr->LogonHours.LogonHours.LogonHours);
599 break;
600
602 if (Ptr->Account.UserName.Buffer != NULL)
603 MIDL_user_free(Ptr->Account.UserName.Buffer);
604
605 if (Ptr->Account.FullName.Buffer != NULL)
606 MIDL_user_free(Ptr->Account.FullName.Buffer);
607
608 if (Ptr->Account.HomeDirectory.Buffer != NULL)
609 MIDL_user_free(Ptr->Account.HomeDirectory.Buffer);
610
611 if (Ptr->Account.HomeDirectoryDrive.Buffer != NULL)
612 MIDL_user_free(Ptr->Account.HomeDirectoryDrive.Buffer);
613
614 if (Ptr->Account.ScriptPath.Buffer != NULL)
615 MIDL_user_free(Ptr->Account.ScriptPath.Buffer);
616
617 if (Ptr->Account.ProfilePath.Buffer != NULL)
618 MIDL_user_free(Ptr->Account.ProfilePath.Buffer);
619
620 if (Ptr->Account.AdminComment.Buffer != NULL)
621 MIDL_user_free(Ptr->Account.AdminComment.Buffer);
622
623 if (Ptr->Account.WorkStations.Buffer != NULL)
624 MIDL_user_free(Ptr->Account.WorkStations.Buffer);
625
626 if (Ptr->Account.LogonHours.LogonHours != NULL)
627 MIDL_user_free(Ptr->Account.LogonHours.LogonHours);
628 break;
629
631 if (Ptr->Name.UserName.Buffer != NULL)
632 MIDL_user_free(Ptr->Name.UserName.Buffer);
633
634 if (Ptr->Name.FullName.Buffer != NULL)
635 MIDL_user_free(Ptr->Name.FullName.Buffer);
636 break;
637
639 if (Ptr->AccountName.UserName.Buffer != NULL)
640 MIDL_user_free(Ptr->AccountName.UserName.Buffer);
641 break;
642
644 if (Ptr->FullName.FullName.Buffer != NULL)
645 MIDL_user_free(Ptr->FullName.FullName.Buffer);
646 break;
647
649 break;
650
652 if (Ptr->Home.HomeDirectory.Buffer != NULL)
653 MIDL_user_free(Ptr->Home.HomeDirectory.Buffer);
654
655 if (Ptr->Home.HomeDirectoryDrive.Buffer != NULL)
656 MIDL_user_free(Ptr->Home.HomeDirectoryDrive.Buffer);
657 break;
658
660 if (Ptr->Script.ScriptPath.Buffer != NULL)
661 MIDL_user_free(Ptr->Script.ScriptPath.Buffer);
662 break;
663
665 if (Ptr->Profile.ProfilePath.Buffer != NULL)
666 MIDL_user_free(Ptr->Profile.ProfilePath.Buffer);
667 break;
668
670 if (Ptr->AdminComment.AdminComment.Buffer != NULL)
671 MIDL_user_free(Ptr->AdminComment.AdminComment.Buffer);
672 break;
673
675 if (Ptr->WorkStations.WorkStations.Buffer != NULL)
676 MIDL_user_free(Ptr->WorkStations.WorkStations.Buffer);
677 break;
678
680 ERR("Information class UserSetPasswordInformation cannot be queried!\n");
681 break;
682
684 break;
685
687 break;
688
690 break;
691
693 break;
694
696 if (Ptr->Parameters.Parameters.Buffer != NULL)
697 MIDL_user_free(Ptr->Parameters.Parameters.Buffer);
698 break;
699
701 if (Ptr->All.UserName.Buffer != NULL)
702 MIDL_user_free(Ptr->All.UserName.Buffer);
703
704 if (Ptr->All.FullName.Buffer != NULL)
705 MIDL_user_free(Ptr->All.FullName.Buffer);
706
707 if (Ptr->All.HomeDirectory.Buffer != NULL)
708 MIDL_user_free(Ptr->All.HomeDirectory.Buffer);
709
710 if (Ptr->All.HomeDirectoryDrive.Buffer != NULL)
711 MIDL_user_free(Ptr->All.HomeDirectoryDrive.Buffer);
712
713 if (Ptr->All.ScriptPath.Buffer != NULL)
714 MIDL_user_free(Ptr->All.ScriptPath.Buffer);
715
716 if (Ptr->All.ProfilePath.Buffer != NULL)
717 MIDL_user_free(Ptr->All.ProfilePath.Buffer);
718
719 if (Ptr->All.AdminComment.Buffer != NULL)
720 MIDL_user_free(Ptr->All.AdminComment.Buffer);
721
722 if (Ptr->All.WorkStations.Buffer != NULL)
723 MIDL_user_free(Ptr->All.WorkStations.Buffer);
724
725 if (Ptr->All.UserComment.Buffer != NULL)
726 MIDL_user_free(Ptr->All.UserComment.Buffer);
727
728 if (Ptr->All.Parameters.Buffer != NULL)
729 MIDL_user_free(Ptr->All.Parameters.Buffer);
730
731 if (Ptr->All.LmOwfPassword.Buffer != NULL)
732 MIDL_user_free(Ptr->All.LmOwfPassword.Buffer);
733
734 if (Ptr->All.NtOwfPassword.Buffer != NULL)
735 MIDL_user_free(Ptr->All.NtOwfPassword.Buffer);
736
737 if (Ptr->All.PrivateData.Buffer != NULL)
738 MIDL_user_free(Ptr->All.PrivateData.Buffer);
739
740 if (Ptr->All.SecurityDescriptor.SecurityDescriptor != NULL)
741 MIDL_user_free(Ptr->All.SecurityDescriptor.SecurityDescriptor);
742
743 if (Ptr->All.LogonHours.LogonHours != NULL)
744 MIDL_user_free(Ptr->All.LogonHours.LogonHours);
745 break;
746
747 default:
748 FIXME("Unsupported information class: %lu\n", InformationClass);
749 break;
750 }
751
753}
#define ERR(fmt,...)
Definition: debug.h:110
@ UserScriptInformation
Definition: ntsam.h:524
@ UserAccountNameInformation
Definition: ntsam.h:520
@ UserPrimaryGroupInformation
Definition: ntsam.h:522
@ UserAccountInformation
Definition: ntsam.h:518
@ UserInternal1Information
Definition: ntsam.h:531
@ UserParametersInformation
Definition: ntsam.h:533
@ UserWorkStationsInformation
Definition: ntsam.h:527
@ UserNameInformation
Definition: ntsam.h:519
@ UserLogonHoursInformation
Definition: ntsam.h:517
@ UserLogonInformation
Definition: ntsam.h:516
@ UserSetPasswordInformation
Definition: ntsam.h:528
@ UserGeneralInformation
Definition: ntsam.h:514
@ UserFullNameInformation
Definition: ntsam.h:521
@ UserInternal2Information
Definition: ntsam.h:532
@ UserControlInformation
Definition: ntsam.h:529
@ UserAdminCommentInformation
Definition: ntsam.h:526
@ UserProfileInformation
Definition: ntsam.h:525
@ UserAllInformation
Definition: ntsam.h:534
@ UserExpiresInformation
Definition: ntsam.h:530
@ UserPreferencesInformation
Definition: ntsam.h:515
@ UserHomeInformation
Definition: ntsam.h:523

Referenced by LsaApLogonUserEx2(), and SamValidateNormalUser().

◆ SamIFreeVoid()

VOID NTAPI SamIFreeVoid ( PVOID  Ptr)

Definition at line 155 of file samsrv.c.

156{
158}

Referenced by MsvpChangePassword().

◆ SamIInitialize()

NTSTATUS NTAPI SamIInitialize ( VOID  )

Definition at line 102 of file samsrv.c.

103{
105
106 TRACE("SamIInitialize() called\n");
107
109 if (!NT_SUCCESS(Status))
111
113 if (!NT_SUCCESS(Status))
114 return Status;
115
116 if (SampIsSetupRunning())
117 {
119 if (!NT_SUCCESS(Status))
120 return Status;
121 }
122
124 if (!NT_SUCCESS(Status))
125 return Status;
126
128
129 /* Initialize the SAM database */
131 if (!NT_SUCCESS(Status))
132 return Status;
133
134 /* Start the RPC server */
136
137 return Status;
138}
BOOLEAN NTAPI RtlGetNtProductType(_Out_ PNT_PRODUCT_TYPE ProductType)
Definition: version.c:96
NTSTATUS SampInitDatabase(VOID)
Definition: database.c:21
NTSTATUS SampInitializeDisplayCache(VOID)
Definition: display.c:143
BOOL SampIsSetupRunning(VOID)
Definition: utils.c:64
@ NtProductWinNt
Definition: shellpath.c:64
NTSYSAPI VOID NTAPI RtlInitializeResource(_In_ PRTL_RESOURCE Resource)
VOID SampStartRpcServer(VOID)
Definition: samrpc.c:78
RTL_RESOURCE SampResource
Definition: samsrv.c:28
NTSTATUS NTAPI SampInitializeRegistry(VOID)
Definition: samsrv.c:143
static NTSTATUS SampInitHashes(VOID)
Definition: samsrv.c:36
NT_PRODUCT_TYPE SampProductType
Definition: samsrv.c:29
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by wWinMain().

◆ SampInitHashes()

static NTSTATUS SampInitHashes ( VOID  )
static

Definition at line 36 of file samsrv.c.

37{
38 UNICODE_STRING EmptyNtPassword = {0, 0, NULL};
39 CHAR EmptyLmPassword[15] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,};
41
42 /* Calculate the NT hash value of the empty password */
43 Status = SystemFunction007(&EmptyNtPassword,
45 if (!NT_SUCCESS(Status))
46 {
47 ERR("Calculation of the empty NT hash failed (Status 0x%08lx)\n", Status);
48 return Status;
49 }
50
51 /* Calculate the LM hash value of the empty password */
52 Status = SystemFunction006(EmptyLmPassword,
54 if (!NT_SUCCESS(Status))
55 {
56 ERR("Calculation of the empty LM hash failed (Status 0x%08lx)\n", Status);
57 }
58
59 return Status;
60}
NTSTATUS WINAPI SystemFunction006(LPCSTR password, LPSTR hash)
Definition: crypt_lmhash.c:53
ENCRYPTED_LM_OWF_PASSWORD EmptyLmHash
Definition: samsrv.c:27
ENCRYPTED_NT_OWF_PASSWORD EmptyNtHash
Definition: samsrv.c:26
NTSTATUS WINAPI SystemFunction007(const UNICODE_STRING *string, LPBYTE hash)
Definition: sysfunc.c:245
unsigned char * LPBYTE
Definition: typedefs.h:53
char * LPSTR
Definition: xmlstorage.h:182
char CHAR
Definition: xmlstorage.h:175

Referenced by SamIInitialize().

◆ SampInitializeRegistry()

NTSTATUS NTAPI SampInitializeRegistry ( VOID  )

Definition at line 143 of file samsrv.c.

144{
145 TRACE("SampInitializeRegistry() called\n");
146
148
149 return STATUS_SUCCESS;
150}
BOOL SampInitializeSAM(VOID)
Definition: setup.c:888

Referenced by SamIInitialize().

Variable Documentation

◆ EmptyLmHash

◆ EmptyNtHash

◆ SampProductType

NT_PRODUCT_TYPE SampProductType

Definition at line 29 of file samsrv.c.

Referenced by SamIInitialize(), and SampInitializeSAM().

◆ SampResource