22#include <samsrv/samsrv.h>
39 CHAR EmptyLmPassword[15] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,};
47 ERR(
"Calculation of the empty NT hash failed (Status 0x%08lx)\n",
Status);
56 ERR(
"Calculation of the empty LM hash failed (Status 0x%08lx)\n",
Status);
73 TRACE(
"SamIConnect(%p %p %lx %ld)\n",
90 ServerObject->
Trusted = Trusted;
94 TRACE(
"SamIConnect done (Status 0x%08lx)\n",
Status);
106 TRACE(
"SamIInitialize() called\n");
145 TRACE(
"SampInitializeRegistry() called\n");
173 if (
Ptr->General.Name.Buffer !=
NULL)
176 if (
Ptr->General.AdminComment.Buffer !=
NULL)
181 if (
Ptr->Name.Name.Buffer !=
NULL)
186 if (
Ptr->AdminComment.AdminComment.Buffer !=
NULL)
213 if (
Ptr->UserInformation.Buffer !=
NULL)
215 for (
i = 0;
i <
Ptr->UserInformation.EntriesRead;
i++)
217 if (
Ptr->UserInformation.Buffer[
i].AccountName.Buffer !=
NULL)
220 if (
Ptr->UserInformation.Buffer[
i].AdminComment.Buffer !=
NULL)
223 if (
Ptr->UserInformation.Buffer[
i].FullName.Buffer !=
NULL)
232 if (
Ptr->MachineInformation.Buffer !=
NULL)
234 for (
i = 0;
i <
Ptr->MachineInformation.EntriesRead;
i++)
236 if (
Ptr->MachineInformation.Buffer[
i].AccountName.Buffer !=
NULL)
239 if (
Ptr->MachineInformation.Buffer[
i].AdminComment.Buffer !=
NULL)
248 if (
Ptr->GroupInformation.Buffer !=
NULL)
250 for (
i = 0;
i <
Ptr->GroupInformation.EntriesRead;
i++)
252 if (
Ptr->GroupInformation.Buffer[
i].AccountName.Buffer !=
NULL)
255 if (
Ptr->GroupInformation.Buffer[
i].AdminComment.Buffer !=
NULL)
264 if (
Ptr->OemUserInformation.Buffer !=
NULL)
266 for (
i = 0;
i <
Ptr->OemUserInformation.EntriesRead;
i++)
268 if (
Ptr->OemUserInformation.Buffer[
i].OemAccountName.Buffer !=
NULL)
277 if (
Ptr->OemGroupInformation.Buffer !=
NULL)
279 for (
i = 0;
i <
Ptr->OemGroupInformation.EntriesRead;
i++)
281 if (
Ptr->OemGroupInformation.Buffer[
i].OemAccountName.Buffer !=
NULL)
311 if (
Ptr->General.OemInformation.Buffer !=
NULL)
314 if (
Ptr->General.DomainName.Buffer !=
NULL)
317 if (
Ptr->General.ReplicaSourceNodeName.Buffer !=
NULL)
325 if (
Ptr->Oem.OemInformation.Buffer !=
NULL)
330 if (
Ptr->Name.DomainName.Buffer !=
NULL)
335 if (
Ptr->Replication.ReplicaSourceNodeName.Buffer !=
NULL)
349 if (
Ptr->General2.I1.OemInformation.Buffer !=
NULL)
352 if (
Ptr->General2.I1.DomainName.Buffer !=
NULL)
355 if (
Ptr->General2.I1.ReplicaSourceNodeName.Buffer !=
NULL)
385 for (
i = 0;
i <
Ptr->EntriesRead;
i++)
387 if (
Ptr->Buffer[
i].Name.Buffer !=
NULL)
441 if (
Ptr->General.Name.Buffer !=
NULL)
444 if (
Ptr->General.AdminComment.Buffer !=
NULL)
449 if (
Ptr->Name.Name.Buffer !=
NULL)
457 if (
Ptr->AdminComment.AdminComment.Buffer !=
NULL)
495 for (
i = 0;
i <
Ptr->Count;
i++)
515 if (
Ptr->SecurityDescriptor !=
NULL)
549 if (
Ptr->General.UserName.Buffer !=
NULL)
552 if (
Ptr->General.FullName.Buffer !=
NULL)
555 if (
Ptr->General.AdminComment.Buffer !=
NULL)
558 if (
Ptr->General.UserComment.Buffer !=
NULL)
563 if (
Ptr->Preferences.UserComment.Buffer !=
NULL)
566 if (
Ptr->Preferences.Reserved1.Buffer !=
NULL)
571 if (
Ptr->Logon.UserName.Buffer !=
NULL)
574 if (
Ptr->Logon.FullName.Buffer !=
NULL)
577 if (
Ptr->Logon.HomeDirectory.Buffer !=
NULL)
580 if (
Ptr->Logon.HomeDirectoryDrive.Buffer !=
NULL)
583 if (
Ptr->Logon.ScriptPath.Buffer !=
NULL)
586 if (
Ptr->Logon.ProfilePath.Buffer !=
NULL)
589 if (
Ptr->Logon.WorkStations.Buffer !=
NULL)
592 if (
Ptr->Logon.LogonHours.LogonHours !=
NULL)
597 if (
Ptr->LogonHours.LogonHours.LogonHours !=
NULL)
602 if (
Ptr->Account.UserName.Buffer !=
NULL)
605 if (
Ptr->Account.FullName.Buffer !=
NULL)
608 if (
Ptr->Account.HomeDirectory.Buffer !=
NULL)
611 if (
Ptr->Account.HomeDirectoryDrive.Buffer !=
NULL)
614 if (
Ptr->Account.ScriptPath.Buffer !=
NULL)
617 if (
Ptr->Account.ProfilePath.Buffer !=
NULL)
620 if (
Ptr->Account.AdminComment.Buffer !=
NULL)
623 if (
Ptr->Account.WorkStations.Buffer !=
NULL)
626 if (
Ptr->Account.LogonHours.LogonHours !=
NULL)
631 if (
Ptr->Name.UserName.Buffer !=
NULL)
634 if (
Ptr->Name.FullName.Buffer !=
NULL)
639 if (
Ptr->AccountName.UserName.Buffer !=
NULL)
644 if (
Ptr->FullName.FullName.Buffer !=
NULL)
652 if (
Ptr->Home.HomeDirectory.Buffer !=
NULL)
655 if (
Ptr->Home.HomeDirectoryDrive.Buffer !=
NULL)
660 if (
Ptr->Script.ScriptPath.Buffer !=
NULL)
665 if (
Ptr->Profile.ProfilePath.Buffer !=
NULL)
670 if (
Ptr->AdminComment.AdminComment.Buffer !=
NULL)
675 if (
Ptr->WorkStations.WorkStations.Buffer !=
NULL)
680 ERR(
"Information class UserSetPasswordInformation cannot be queried!\n");
696 if (
Ptr->Parameters.Parameters.Buffer !=
NULL)
701 if (
Ptr->All.UserName.Buffer !=
NULL)
704 if (
Ptr->All.FullName.Buffer !=
NULL)
707 if (
Ptr->All.HomeDirectory.Buffer !=
NULL)
710 if (
Ptr->All.HomeDirectoryDrive.Buffer !=
NULL)
713 if (
Ptr->All.ScriptPath.Buffer !=
NULL)
716 if (
Ptr->All.ProfilePath.Buffer !=
NULL)
719 if (
Ptr->All.AdminComment.Buffer !=
NULL)
722 if (
Ptr->All.WorkStations.Buffer !=
NULL)
725 if (
Ptr->All.UserComment.Buffer !=
NULL)
728 if (
Ptr->All.Parameters.Buffer !=
NULL)
731 if (
Ptr->All.LmOwfPassword.Buffer !=
NULL)
734 if (
Ptr->All.NtOwfPassword.Buffer !=
NULL)
737 if (
Ptr->All.PrivateData.Buffer !=
NULL)
740 if (
Ptr->All.SecurityDescriptor.SecurityDescriptor !=
NULL)
743 if (
Ptr->All.LogonHours.LogonHours !=
NULL)
wchar_t * PSAMPR_SERVER_NAME
#define NT_SUCCESS(StatCode)
BOOLEAN NTAPI RtlGetNtProductType(_Out_ PNT_PRODUCT_TYPE ProductType)
NTSTATUS WINAPI SystemFunction006(LPCSTR password, LPSTR hash)
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)
NTSTATUS SampInitDatabase(VOID)
NTSTATUS SampInitializeDisplayCache(VOID)
BOOL SampIsSetupRunning(VOID)
BOOL SampInitializeSAM(VOID)
enum _NT_PRODUCT_TYPE NT_PRODUCT_TYPE
_In_ FILTER_INFORMATION_CLASS InformationClass
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
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
void __RPC_USER MIDL_user_free(void *p)
NTSYSAPI VOID NTAPI RtlInitializeResource(_In_ PRTL_RESOURCE Resource)
NTSYSAPI VOID NTAPI RtlMapGenericMask(PACCESS_MASK AccessMask, PGENERIC_MAPPING GenericMapping)
@ DomainLogoffInformation
@ DomainReplicationInformation
@ DomainServerRoleInformation
@ DomainPasswordInformation
@ DomainLockoutInformation
@ DomainModifiedInformation2
@ DomainGeneralInformation
@ DomainGeneralInformation2
@ DomainModifiedInformation
@ AliasGeneralInformation
@ AliasAdminCommentInformation
enum _GROUP_INFORMATION_CLASS GROUP_INFORMATION_CLASS
enum _DOMAIN_DISPLAY_INFORMATION DOMAIN_DISPLAY_INFORMATION
@ UserAccountNameInformation
@ UserPrimaryGroupInformation
@ UserInternal1Information
@ UserParametersInformation
@ UserWorkStationsInformation
@ UserLogonHoursInformation
@ UserSetPasswordInformation
@ UserFullNameInformation
@ UserInternal2Information
@ UserAdminCommentInformation
@ UserPreferencesInformation
enum _DOMAIN_INFORMATION_CLASS DOMAIN_INFORMATION_CLASS
enum _ALIAS_INFORMATION_CLASS ALIAS_INFORMATION_CLASS
enum _USER_INFORMATION_CLASS USER_INFORMATION_CLASS
@ GroupAttributeInformation
@ GroupGeneralInformation
@ GroupAdminCommentInformation
VOID SampStartRpcServer(VOID)
PGENERIC_MAPPING pServerMapping
VOID NTAPI SamIFree_SAMPR_USER_INFO_BUFFER(PSAMPR_USER_INFO_BUFFER Ptr, USER_INFORMATION_CLASS InformationClass)
VOID NTAPI SamIFree_SAMPR_DISPLAY_INFO_BUFFER(PSAMPR_DISPLAY_INFO_BUFFER Ptr, DOMAIN_DISPLAY_INFORMATION InformationClass)
VOID NTAPI SamIFree_SAMPR_GET_MEMBERS_BUFFER(PSAMPR_GET_MEMBERS_BUFFER Ptr)
NTSTATUS NTAPI SamIConnect(IN PSAMPR_SERVER_NAME ServerName, OUT SAMPR_HANDLE *ServerHandle, IN ACCESS_MASK DesiredAccess, IN BOOLEAN Trusted)
RTL_RESOURCE SampResource
VOID NTAPI SamIFree_SAMPR_ENUMERATION_BUFFER(PSAMPR_ENUMERATION_BUFFER Ptr)
NTSTATUS NTAPI SamIInitialize(VOID)
NTSTATUS NTAPI SampInitializeRegistry(VOID)
VOID NTAPI SamIFree_SAMPR_ULONG_ARRAY(PSAMPR_ULONG_ARRAY Ptr)
VOID NTAPI SamIFree_SAMPR_DOMAIN_INFO_BUFFER(PSAMPR_DOMAIN_INFO_BUFFER Ptr, DOMAIN_INFORMATION_CLASS InformationClass)
VOID NTAPI SamIFree_SAMPR_GROUP_INFO_BUFFER(PSAMPR_GROUP_INFO_BUFFER Ptr, GROUP_INFORMATION_CLASS InformationClass)
VOID NTAPI SamIFree_SAMPR_SR_SECURITY_DESCRIPTOR(PSAMPR_SR_SECURITY_DESCRIPTOR Ptr)
ENCRYPTED_LM_OWF_PASSWORD EmptyLmHash
static NTSTATUS SampInitHashes(VOID)
ENCRYPTED_NT_OWF_PASSWORD EmptyNtHash
VOID NTAPI SamIFreeVoid(PVOID Ptr)
VOID NTAPI SamIFree_SAMPR_GET_GROUPS_BUFFER(PSAMPR_GET_GROUPS_BUFFER Ptr)
NT_PRODUCT_TYPE SampProductType
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_ALIAS_INFO_BUFFER(PSAMPR_ALIAS_INFO_BUFFER Ptr, ALIAS_INFORMATION_CLASS InformationClass)
NTSTATUS WINAPI SystemFunction007(const UNICODE_STRING *string, LPBYTE hash)
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess