English
Regulars table & Café

LookupAccountName.

 


Description:

declared LookupAccountName determined from the Accountnamen and the names the Systems whom dazugehörigen SID (Security Identifier).
These API there only NT-based Windowssystemen.




Deklaration:

DEF @LookupAccountName(7) !advapi32,LookupAccountNameA




Parameter:

1.Parameter: address the Strings, the whom Systemnamen contains or 0 for actually computer.
2.Parameter: address the Strings, the whom Accountnamen contains.
3.Parameter: an enough large Memory-Variable, The whom SID aufnimmt.
4.Parameter: an four byte large Memory-Variable, in the The Size the in Parameter 3 angegebenen Bereichs standing.
5.Parameter: an enough large Memory-Variable, The whom Domainnamen aufnimmt, on the the Accountname gelistet is.
6.Parameter: an four byte large Memory-Variable, in the The Size the in Parameter 5 angegebenen Bereichs standing.
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:

DEF @LookupAccountName(7) !"advapi32","LookupAccountNameA"
DEF @LogonUser(6) !"advapi32","LogonUserA"
DEF @CreateProcessAsUser(11) !"advapi32","CreateProcessAsUserA"
DEF @SetLastError(1) !"kernel32","SetLastError"
DEF @GetLastError(0) !"kernel32","GetLastError" supply last API Error.
DEF @ZeroMemory(2) ! "Kernel32","RtlZeroMemory"
DEF @CloseHandle(1) !"kernel32","CloseHandle" closes one lever (Program).
DEF @CreateProcessWithLogonW(11) !"advapi32","CreateProcessWithLogonW"
DEF @MultiByteToWideChar(6) !"kernel32","MultiByteToWideChar"
DEF @GetACP(0) !"kernel32","GetACP"
Declare Protokoll&,FEHLER&,DOMAIN$,SID_Size#,lpStartupInfo#,lpProcessInformation#
Declare lpCommandLine#,DOMAINNAME_SIZE_ADDR#
Declare SID#,DOMAIN#,SID_TYPE_INDICATOR#,DOMAIN#,Attribut#,ALLPRIVS#,COUNT#,SID#
DIM DOMAIN#,256
DIM SID#,800
DIM SID_Size#,4
DIM DOMAINNAME_SIZE_ADDR#,4
DIM SID_TYPE_INDICATOR#,256

Proc StartWithUserRights

    @ADDSTRING(Protokoll&,"Start the procedure to that Impersonifizieren another User")
    Parameters PUSERNAME$,PPASSWORT$,PPROGRAMM$
    Declare PUSERNAME#,PPASSWORT#,PPROGRAMM#,Domainw#
    CLEAR SID#,DOMAIN#,SID_TYPE_INDICATOR#,DOMAIN#,SID#,DOMAINNAME_SIZE_ADDR#
    Long SID_Size#,0=800
    LONG DOMAINNAME_SIZE_ADDR#,0=255
    LET Fehler&=@LookupAccountName(0,@addr(PUSERNAME$),SID#,SID_Size#,DOMAIN#,DOMAINNAME_SIZE_ADDR#,SID_TYPE_INDICATOR#)
    @ADDSTRING(Protokoll&,"Error LookupAccountName: "+@st$(Fehler&))
    LET DOMAIN$=@STRING$(DOMAIN#,0)
    @ADDSTRING(Protokoll&,"Domain: "+DOMAIN$)
    LET PPROGRAMM$=@ShortName$(PPROGRAMM$)
    DIM PPROGRAMM#,(@LEN(PPROGRAMM$)*2)+1
    DIM PUSERNAME#,(@LEN(PUSERNAME$)*2)+1
    DIM PPASSWORT#,(@LEN(PPASSWORT$)*2)+1
    DIM Domainw#,(@LEN(Domain$)*2)+1
    LET Fehler&=@MultiByteToWideChar(@GetACP(),2,@addr(PPROGRAMM$),-1,PPROGRAMM#,(@LEN(PPROGRAMM$)*2)+1)
    @ADDSTRING(Protokoll&,"Rückgabe of MultiByteToWideChar: "+@STR$(Fehler&))
    LET Fehler&=@MultiByteToWideChar(@GetACP(),2,@addr(Domain$),-1,Domainw#,(@LEN(Domain$)*2)+1)
    @ADDSTRING(Protokoll&,"Rückgabe of MultiByteToWideChar: "+@STR$(Fehler&))
    LET Fehler&=@MultiByteToWideChar(@GetACP(),2,@addr(PUSERNAME$),-1,PUSERNAME#,(@LEN(PUSERNAME$)*2)+1)
    @ADDSTRING(Protokoll&,"Rückgabe of MultiByteToWideChar: "+@STR$(Fehler&))
    LET Fehler&=@MultiByteToWideChar(@GetACP(),2,@addr(PPASSWORT$),-1,PPASSWORT#,(@LEN(PPASSWORT$)*2)+1)
    @ADDSTRING(Protokoll&,"Rückgabe of MultiByteToWideChar: "+@STR$(Fehler&))
    @SetLastError(0)
    @ADDSTRING(Protokoll&,"Letzter API Error: "+@st$(@GetLastError()))
    Dim lpStartupInfo#,68
    ZeroMemory(lpStartupinfo#,68)
    Long lpStartupInfo#,0=68
    Dim lpProcessInformation#,16
    Dim lpCommandLine#,@len(PPROGRAMM$)+1
    ZeroMemory(lpProcessInformation#,16)
    String lpCommandLine#,0=PPROGRAMM$
    @CreateProcessWithLogonW(PUSERNAME#,Domainw#,PPASSWORT#,0,0,PPROGRAMM#,0,0,0,lpStartupInfo#,lpProcessInformation#)
    @ADDSTRING(Protokoll&,"Letzter API Error: "+@st$(@GetLastError()))
    Dispose Domainw#
    Dispose PPROGRAMM#
    Dispose PUSERNAME#
    Dispose PPASSWORT#
    Dispose lpStartupInfo#
    Dispose lpProcessInformation#
    Dispose lpCommandLine#
    @ADDSTRING(Protokoll&,"Ende the procedure to that Impersonifizieren another User")

ENDPROC

CLS
LET Protokoll&=@createlistbox(%HWND,"",10,10,600,400)
StartWithUserRights @INPUT$("Bitte a Usernamen prompt: ","Login name?",""),@INPUT$("Bitte the Password moreover prompt: ","Passwort?",""),,@LoadFile $("EXE auswählen","*.EXE")
Dispose DOMAIN#
Dispose SID_Size#
Dispose DOMAINNAME_SIZE_ADDR#
Dispose SID_TYPE_INDICATOR#
Dispose SID#
Waitinput

[keywords:9dad938fef]
SID Security Identifier User user Domain detect herausbekommen experienced group groups Groups Usernamen Accountnamen Account User String Text
[/keywords:9dad938fef]
 
03/04/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.737 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