English
Regulars table & Café

ConvertStringSidToSid.

 


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:

CompileMarkSeparation
Def @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]
 
05/23/05  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.224 Views

Untitledvor 0 min.
rquindt12/06/15

Themeninformationen

this Topic has 1 subscriber:

unbekannt (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie