English
Regulars table & Café

LsaEnumerateAccountRights

 


Description:

LsaEnumerateAccountRights Listet The to a Account added Privilegien. it go no Privilegien gelistet, The by a Gruppenzugehörigkeit consist. These function there only NT-based Windowssystemen.




Deklaration:

DEF @LsaEnumerateAccountRights(4) !advapi32,LsaEnumerateAccountRights




Parameter:

1.Parameter: With the LSAOpenPolicy sustained lever the Policy Objektes as Longint. the lever must with POLICY_LOOKUP_NAMES opened go.
2.Parameter: Memory-Variable with the SID the Accounts, which Privilegien gelistet go should.
3.Parameter: 4 byte Memory-Variable, The The address the Speicherbereichs aufnimmt, in the The Privilegien as LSA_UNICODE_STRING-aray in following shape stored go: =>
·byte 0-1 = The long the Strings the first Privilegs in Bytes.
·byte 2-3 = The length the Bereichs in Bytes, on the byte 4-7 verweist.
·byte 4-7 = address one Strings in the Unicode stature with the names the first found Privilegs.
·byte 8-9 = The long the Strings the second Privilegs in Bytes.
·byte 10-11 = The length the Bereichs in Bytes, on the byte 12-15 verweist.
·byte 12-15 = address one Strings in the Unicode stature with the names the second found Privilegs.
·etc...
If the Speicherbereich not any more needed becomes, must it with the function LsaFreeMemory again released go.
4.Parameter: 4 byte Memory-Variable, The The Number of in Parameter 3 encompassed Privilegien receiving.



Return Value:

0 with success, otherwise one NT-status Error Code (LongInt), the with LsaNtStatusToWinError in a Systemfehlercode transformed go can.


Examples:

CompileMarkSeparation
DEF @LsaOpenPolicy(4) !"advapi32","LsaOpenPolicy"
DEF @LsaClose(1) !"advapi32","LsaClose"
DEF @LsaNtStatusToWinError(1) !"advapi32","LsaNtStatusToWinError"
DEF @LsaEnumerateAccountRights(4) !"advapi32","LsaEnumerateAccountRights"
DEF @MultiByteToWideChar(6) !"kernel32","MultiByteToWideChar"
DEF @LookupAccountName(7) !"advapi32","LookupAccountNameA"
DEF @GetACP(0) !"kernel32","GetACP"
DEF @CopyMemory(3) !"kernel32","RtlMoveMemory"
DEF @WideCharToMultiByte(8) !"kernel32","WideCharToMultiByte"
DEF @LsaFreeMemory(1) !"advapi32","LsaFreeMemory"
Declare Fehler&,UNICODE#,Attribut#,POLICY_Handle#
Declare Policy_Handle&,PrivilegSET#,PRIVILEG#
Declare SID#,DOMAIN#,SID_TYPE_INDICATOR#,DOMAIN#,Attribut#,ALLPRIVS#,COUNT#,SID#,DOMAINNAME_SIZE_ADDR#
Declare SYSTEM$,DOMAIN$,SID_Size#,Account$
Declare PrivPointer#,ComparePriv#,Zähler%,Länge%,Zeiger&
Struct LSA_UNICODE_STRING=Length%,MaximumLength%,Buffer&
DIM UNICODE#,LSA_UNICODE_STRING
Clear UNICODE#
Struct LSA_OBJECT_ATTRIBUTES=Length&,RootDirectory&,Length%,MaximumLength%,Buffer&,Attributes&,SecurityDescriptor#(4),SecurityQualityOfService#(4)
DIM Attribut#,LSA_OBJECT_ATTRIBUTES
Clear Attribut#
Dim PrivPointer#,4
DIM ALLPRIVS#,2000
DIM COUNT#,4
DIM DOMAIN#,256
DIM SID#,800
DIM SID_Size#,4
DIM DOMAINNAME_SIZE_ADDR#,4
DIM SID_TYPE_INDICATOR#,256
DIM POLICY_Handle#,4
DIM PRIVILEG#,100
DIM PrivilegSET#,100
DIM ComparePriv#,100
Windowstyle 31
Windowtitle "Einem Account das Privileg zum Ändern der Systemzeit hinzufügen."
Window 0,0-640,440
CLEAR SID#,DOMAIN#,SID_TYPE_INDICATOR#,DOMAIN#,Attribut#,ALLPRIVS#,COUNT#,SID#,DOMAINNAME_SIZE_ADDR#
Long SID_Size#,0=800
LONG DOMAINNAME_SIZE_ADDR#,0=255
LET SYSTEM$=""
LET ACCOUNT$=@input$("Accountnamen eingeben (kein Alias):","Account","Gast")
LET Fehler&=@LookupAccountName(@ADDR(System$),@addr(ACCOUNT$),SID#,SID_Size#,DOMAIN#,DOMAINNAME_SIZE_ADDR#,SID_TYPE_INDICATOR#)
Print "Rückmeldung von LookupAccountName="+@STR$(Fehler&)

If Fehler&=1

    LET Fehler&=@LsaOpenPolicy(0,Attribut#,$10 | $0800,POLICY_Handle#)
    Print "Rückmeldung von LsaOpenPolicy="+@STR$(Fehler&)
    Let Fehler&=@LsaNtStatusToWinError(Fehler&)
    PRINT "LsaOpenPolicy Rückmeldung umgewandelt in Windows Fehlercode="+@STR$(Fehler&)
    LET Policy_Handle&=@LONG(POLICY_Handle#,0)
    Print "Geliefertes Handle="+@STR$(Policy_Handle&)

    IF Fehler&=0

        Clear PrivPointer#
        Clear ALLPRIVS#
        LET Fehler&=@LsaEnumerateAccountRights(Policy_Handle&,SID#,PrivPointer#,Count#)
        Print "Rückmeldung von LsaEnumerateAccountRights="+@STR$(Fehler&)
        Let Fehler&=@LsaNtStatusToWinError(Fehler&)
        PRINT "LsaEnumerateAccountRights Rückmeldung umgewandelt in Windows Fehlercode="+@STR$(Fehler&)
        PRINT "Anzahl der Privilegien: "+@str$(@long(COUNT#,0))
        Case FEHLER&=0 : @CopyMemory(ALLPRIVS#,@LONG(PrivPointer#,0),1998)

        WHILENOT Zähler%=@long(COUNT#,0)

            Clear PrivilegSet#
            Clear ComparePriv#
            Let Länge%=@Word(ALLPRIVS#,8*Zähler%)
            LET Zeiger&=@Long(ALLPRIVS#,8*Zähler%+4)
            @CopyMemory(ComparePriv#,Zeiger&,Länge%)
            Let Fehler&=@WideCharToMultiByte(@GetACP(),0,ComparePriv#,@INT(LÄnge%/2),PrivilegSet#,100,0,0)
            Print "Rückmeldung von WideCharToMultiByte="+@STR$(Fehler&)
            Addstring @String$(PrivilegSet#,0)
            inc Zähler%

        Wend

        LET FEHLER&=@LsaFreeMemory(@LONG(PrivPointer#,0))
        LET Fehler&=@LsaClose(Policy_Handle&,0)
        Print "Rückmeldung von LsaClose="+@STR$(Fehler&)
        Let Fehler&=@LsaNtStatusToWinError(Fehler&)
        PRINT "LsaClose Rückmeldung umgewandelt in Windows Fehlercode="+@STR$(Fehler&)
        @LISTBOX$("Gefundene Privilegien...",1)

    Endif

endif

Dispose PrivPointer#
Dispose POLICY_Handle#
Dispose ALLPRIVS#
Dispose COUNT#
Dispose DOMAIN#
Dispose SID#
Dispose SID_Size#
Dispose DOMAINNAME_SIZE_ADDR#
Dispose SID_TYPE_INDICATOR#
Dispose POLICY_Handle#
Dispose PRIVILEG#
Dispose PrivilegSET#
Dispose ComparePriv#

While 0=0

    Waitinput

Wend

 
04/08/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

2.454 Views

Untitledvor 0 min.

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