4.1 Creating a User Account
The following sequence of methods and parameters creates a user account given a network address of "msdc-1", a domain name of "ms", and a user name of "testuser".
Send SamrConnect.
Parameter field
Parameter value
ServerName
msdc-1
DesiredAccess
0x31
Receive SamrConnect.
Parameter field
Parameter value
Status
0
ServerHandle
[implementation-specific value] serverHandle
Send SamrLookupDomainInSamServer.
Parameter field
Parameter value
ServerHandle
serverHandle
Name.Length
4
Name.MaximumLength
4
Name.Buffer
ms
Receive SamrLookupDomainInSamServer.
Parameter field
Parameter value
Status
0
DomainId
[implementation-specific SID]. For example: S-1-5-21-3448151421-356457007-600757626
Send SamrOpenDomain.
Parameter field
Parameter value
ServerHandle
serverHandle
DesiredAccess
0x00000010
DomainId
S-1-5-21-3448151421-356457007-600757626
Receive SamrOpenDomain.
Parameter field
Parameter value
Status
0
DomainHandle
[implementation-specific value] domainHandle
Send SamrCreateUser2InDomain.
Parameter field
Parameter value
DomainHandle
domainHandle
Name.Length
16
Name.MaximumLength
16
Name.Buffer
testuser
AccountType
0x00000080
DesiredAccess
0x02000000
Receive SamrCreateUser2InDomain.
Parameter field
Parameter value
Status
0
UserHandle
[implementation-specific value] userHandle
GrantedAccess
0xf07ff
RelativeId
2810
Send SamrCloseHandle.
Parameter field
Parameter value
Handle
userHandle
Receive SamrCloseHandle.
Parameter field
Parameter value
Status
0
Handle
0
Send SamrCloseHandle.
Parameter field
Parameter value
Handle
domainHandle
Receive SamrCloseHandle.
Parameter field
Parameter value
Status
0
Handle
0
Send SamrCloseHandle.
Parameter field
Parameter value
Handle
serverHandle
Receive SamrCloseHandle.
Parameter field
Parameter value
Status
0
Handle
0