|
Description:
ConvertStringSidToSid GetControlParas (B a String-SID in a SID structure circa. These function there only under windows2000/XP. The sustained Speicherbereich must with LocalFree again released go.
Deklaration:
DEF @ConvertStringSidToSid(2) !ADVAPI32,ConvertStringSidToSidA
Parameter:
1.Parameter: address one Strings or Memory-Variable with a String, the whom String-SID contains. 2.Parameter: enough dimensionierte Memory-Variable, The The SID structure aufnimmt.
Return Value:
0 with success, otherwise one Error Code.
Examples:
CompileMarkSeparationDef @RegOpenKeyEx(5) !"ADVAPI32","RegOpenKeyExA"
Def @RegEnumKey(4) !"ADVAPI32","RegEnumKeyA"
Def @RegCloseKey(1) !"ADVAPI32","RegCloseKey"
DEF @ConvertStringSidToSid(2) !"ADVAPI32","ConvertStringSidToSidA"
DEF @LookupAccountSid(7) !"ADVAPI32","LookupAccountSidA"
Def @RegEnumValue(8) !"ADVAPI32","RegEnumValueA"
DEF @LocalFree(1) !"KERNEL32","LocalFree"
Windowstyle 31
Windowtitle "String-SID in Accountnamen umwandeln"
Window 0,0-640,440
declare ergebnis#,Error&,Handle&,Key$,Zähler%,SID#,SID$,Fehler&,SYSTEM$
Declare Ergebnis#,ACCOUNT_NAME#,SIZE_ACCOUNT#,Domain#,SIZE_DOMAIN#,SID_NAME_USE#
Declare VALUESIZE#,Typ#,Wert#,Buffersize#,Zähler&
dim Ergebnis#,261--Länge des zu erwartenden Namens
DIM SID#,4
DIM ACCOUNT_NAME#,256
DIM SIZE_ACCOUNT#,4
DIM Domain#,256
DIM SIZE_DOMAIN#,4
DIM SID_NAME_USE#,4
DIM TYP#,4
DIM Wert#,261
DIM Buffersize#,4
DIM VALUESIZE#,4
Key$=""
$80000003=HKEY_USERS $F003F = KEY_ALL_ACCESS
Error&=@RegOpenKeyEx($80000003,addr(Key$),0,$F003F,addr(Handle&))
PRINT "OpenKey (0=OK) : ",Error&
LET Zähler%=0
whilenot Error&
Error&=@RegEnumKey(Handle&,Zähler%,Ergebnis#,261)
IF Error& =0
PRINT @string$(Ergebnis#,0)
LET SID$=@string$(Ergebnis#,0)
CLEAR SID#
LET FEHLER&=@ConvertStringSidToSid(@ADDR(SID$),SID#)
IF Fehler&<>0
Clear SID_NAME_USE#
Clear ACCOUNT_NAME#
Clear Domain#,SYSTEM$
Long SIZE_ACCOUNT#,0=255
LONG SIZE_DOMAIN#,0=255
LET FEHLER&=@LookupAccountSid(@ADDR(System$),@LONG(SID#,0),ACCOUNT_NAME#,SIZE_ACCOUNT#,Domain#,SIZE_DOMAIN#,SID_NAME_USE#)
@LocalFree(@LONG(SID#,0))
IF @AND(FEHLER&=1,@STRING$(ACCOUNT_NAME#,0)<>"")
ADDSTRING @STRING$(ACCOUNT_NAME#,0)+": "+SID$
ENDIF
ENDIF
endif
inc Zähler%
endwhile @RegCloseKey(Handle&)
LET Key$="SoftwareMicrosoftWindowsCurrentVersionGroup PolicyGroupMembership"
$80000001=HKEY_CURRENT_USER $F003F = KEY_ALL_ACCESS
Error&=@RegOpenKeyEx($80000001,addr(Key$),0,$F003F,@addr(Handle&))
PRINT ""
Let Zähler&=0
whilenot Error&
LONG BUFFERSIZE#,0=261
LONG VALUESIZE#,0=261
Clear Ergebnis#,TYP#,Wert#
Error&=@RegEnumValue(Handle&,Zähler&,Ergebnis#,VALUESIZE#,0,TYP#,Wert#,Buffersize#)
IF Error&=0
IF @or(@LONG(TYP#,0)=$2,@LONG(TYP#,0)=$1)
PRINT @string$(Ergebnis#,0)+"="+@string$(WERT#,0)
LET SID$=@string$(WERT#,0)
CLEAR SID#
LET FEHLER&=@ConvertStringSidToSid(@ADDR(SID$),SID#)
IF Fehler&<>0
Clear SID_NAME_USE#
Clear ACCOUNT_NAME#
Clear Domain#,SYSTEM$
Long SIZE_ACCOUNT#,0=255
LONG SIZE_DOMAIN#,0=255
LET FEHLER&=@LookupAccountSid(@ADDR(System$),@LONG(SID#,0),ACCOUNT_NAME#,SIZE_ACCOUNT#,Domain#,SIZE_DOMAIN#,SID_NAME_USE#)
IF @AND(FEHLER&=1,@STRING$(ACCOUNT_NAME#,0)<>"")
ADDSTRING @STRING$(ACCOUNT_NAME#,0)+": "+SID$
ENDIF
ENDIF
endif
endif
LET Zähler&=Zähler&+1
endwhile @RegCloseKey(Handle&)
dispose Ergebnis#
Dispose SID#
Dispose ACCOUNT_NAME#
Dispose SIZE_ACCOUNT#
Dispose Domain#
Dispose SIZE_DOMAIN#
Dispose SID_NAME_USE#
Dispose TYP#
Dispose Wert#
Dispose Buffersize#
Dispose VALUESIZE#
@Listbox$( class=s3>"SID as Accountname and as SID-String", 1)
[keywords:2a2fd3ff2b] SID Show String transfiguring Registry [/keywords:2a2fd3ff2b] |
|