| |
|
|
|
Description:
LookupAccountSid determined from the Security Identifier (SID) whom dazugehörigen User or Gruppennamen and the first Domain, on the this SID found watts.
Deklaration:
DEF @LookupAccountSid(7) !ADVAPI32,LookupAccountSidA
Parameter:
1.Parameter: address the Strings, the whom Systemnamen contains or 0 for actually computer. 2.Parameter: Memory-Variable with the SID. 3.Parameter: Memory-Variable, The whom groups- or Usernamen as String aufnimmt. 4.Parameter: 4 byte large Memory-Variable, The the stature the Bereichs of Parameter 3 contains. watts Parameter 3 To small dimensioniert, standing here later The erforderliche Size of Parameter 3, if The function zurückkehrt. 5.Parameter: an enough large Memory-Variable, The whom Domainnamen aufnimmt. 6.Parameter: 4 byte large Memory-Variable, The the stature the Bereichs of Parameter 5 contains. watts Parameter 5 To small dimensioniert, standing here later The erforderliche Size of Parameter 5, if The function zurückkehrt. 7.Parameter: SID_NAME_USE Structure or 4 byte large Memory-Variable, The a Flag for manner the Accounts aufnimmt, if The function zurückkehrt..=> -$1 = Username (SidTypeUser) -$2 = Gruppenname (SidTypeGroup) -$3 = Domain (SidTypeDomain) -$4 = SidTypeAlias -$5 = SidTypeWellKnownGroup -$6 = Gelöschter Account (SidTypeDeletedAccount) -$7 = SidTypeInvalid -$8 = SidTypeUnknown
Return Value:
1 with success, 0 with Error
Examples:
CompileMarkSeparationDEF @LookupAccountSid(7) !"ADVAPI32","LookupAccountSidA"
DEF @GetLastError(0) !"KERNEL32","GetLastError"
DEF @IsValidSid(1) !"ADVAPI32","IsValidSid"
Declare Fehler&
Proc GET_Group_Name
Parameters Name$
Declare SYS$,SEC_ID#,CBNAME_SIZE#,CBNAME#,ReferencedDomainName#,RDN_SIZE#
Declare SID_NAME_USE#,CBNAME$
SID wird erstellt.
IF @UPPER$(Name$)="JEDER"
DIM SEC_ID#,12
ElseIF @UPPER$(Name$)="ADMINISTRATOREN"
DIM SEC_ID#,16
else
DIM SEC_ID#,12
@Messagebox("Falscher Parameter!","Fehler",16)
endif
DIM CBNAME_SIZE#,4
DIM CBNAME#,256
DIM ReferencedDomainName#,256
DIM RDN_SIZE#,4
DIM SID_NAME_USE#,4
Clear SYS$,SID_NAME_USE#,CBNAME#,ReferencedDomainName#,SEC_ID#
IF @UPPER$(Name$)="JEDER"
LONG SEC_ID#,0=257
LONG SEC_ID#,4=16777216
LONG SEC_ID#,8=0
elseIF @UPPER$(Name$)="ADMINISTRATOREN"
LONG SEC_ID#,0=513
LONG SEC_ID#,4=83886080
LONG SEC_ID#,8=32
LONG SEC_ID#,12=544
endif
LONG CBNAME_SIZE#,0=255
LONG RDN_SIZE#,0=255
LET Fehler&=@IsValidSid(SEC_ID#)
ADDSTRING "Fehlercode IsValidSid="+@STR$(FEHLER&)
ADDSTRING "Letzter API Fehler="+@STR$(@GetLastError())
CASE FEHLER&=1 : LET FEHLER&=@LookupAccountSid(@ADDR(SYS$),SEC_ID#,CBNAME#,CBNAME_SIZE#,ReferencedDomainName#,RDN_SIZE#,SID_NAME_USE#)
ADDSTRING "Fehlercode LookupAccountSid="+@STR$(FEHLER&)
ADDSTRING "Letzter API Fehler="+@STR$(@GetLastError())
ADDSTRING @STRING$(CBNAME#,0)
LET CBNAME$=@STRING$(CBNAME#,0)
Dispose SID_NAME_USE#
Dispose RDN_SIZE#
Dispose ReferencedDomainName#
Dispose CBNAME#
DISPOSE SEC_ID#
DISPOSE CBNAME_SIZE#
Return CBNAME$
endproc
GET_Group_Name "Jeder"
PRINT @$(0)
@Editbox(&quo gaben", 1)
[keywords:b6ef792c9b] SID Security Identifier User user Domain detect herausbekommen experienced group groups Groups [/keywords:b6ef792c9b] |
|
|
| |
|
|