Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Kako saznati user accounte u windows xp-u?

[es] :: C++ programiranje :: Kako saznati user accounte u windows xp-u?

[ Pregleda: 808 | Odgovora: 2 ]

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

maximus_1
Max Maximus

Član broj: 46848
Poruke: 276
*.tel.net.ba.



Profil

icon Kako saznati user accounte u windows xp-u?19.08.2006. u 14:06

Treba mi neka funkcija kojom bih mogao saznati koji su sve user accounti na xpu i koji je trenutno aktivan (sa kojeg se izvodi aplikacija).
19.08.2006. u 14:06 

icobh
Igor Pejašinović
PEJAŠINOVIĆ LTD.
Stara Dubrava, RS, BiH

Član broj: 18738
Poruke: 1171
*.inecco.net.

Sajt: localhost


Profil

icon Re: Kako saznati user accounte u windows xp-u?19.08.2006. u 14:26
Koji sve useri postoje ne znam kako a koji je trenutno aktivan, imaš ovaj dole napisani kod u basicu, možeš ga prevesti u C++ veoma lako:

Code:
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Private Declare Function IsIconic Lib "user32" (ByVal hwnd As Long) As Long

Private Sub Form_Load()

    Dim strTemp As String, strUserName As String

    'Create a buffer
    strTemp = String(100, Chr$(0))

    'Get the temporary path
    GetTempPath 100, strTemp

    'strip the rest of the buffer
    strTemp = Left$(strTemp, InStr(strTemp, Chr$(0)) - 1)

    'Create a buffer
    strUserName = String(100, Chr$(0))

    'Get the username
    GetUserName strUserName, 100

    'strip the rest of the buffer
    strUserName = Left$(strUserName, InStr(strUserName, Chr$(0)) - 1)

    'Show the temppath and the username
    MsgBox "Hello " + strUserName + Chr$(13) + "The temp. path is " + strTemp

End Sub


Izvor: VB API Guide 3.7
I ♥ ♀

Ovaj post je zlata vrijedan!
19.08.2006. u 14:26 

X Files
Vladimir Stefanovic
Pozarevac

SuperModerator
Član broj: 15100
Poruke: 3395
*.static.po.sbb.co.yu.

Jabber: xfiles@elitesecurity.org
Sajt: www.antivari.com


Profil

icon Re: Kako saznati user accounte u windows xp-u?19.08.2006. u 15:14
Probaj ovako:
Code:

// ...
#include <lmaccess.h>
#include <lmapibuf.h>
// ...
void __fastcall TForm1::Button1Click(TObject *Sender)
{
   ListBox1->Items->Clear();
   DWORD EntriesRead, TotalEntries;
   USER_INFO_1 *UserInfo = NULL;
   DWORD ResumeHandle = 0;
   NET_API_STATUS NetApiStatus;

   do
   {
      NetApiStatus = NetUserEnum( NULL, 1, 0, (LPBYTE*)&UserInfo, 0, &EntriesRead, &TotalEntries, &ResumeHandle );

      for ( DWORD Counter = 0; Counter < EntriesRead; Counter++ )
      {
         AnsiString UserDetails = WideString( UserInfo[Counter].usri1_name ) + ", " +
                                  IntToStr( UserInfo[Counter].usri1_flags ) + ", " +
                                  WideString(UserInfo[Counter].usri1_comment );
         ListBox1->Items->Add( UserDetails );
      }

      NetApiBufferFree( UserInfo );
   }

   while( NetApiStatus == ERROR_MORE_DATA );
}



[Ovu poruku je menjao X Files dana 19.08.2006. u 17:30 GMT+1]
FREEWARE
Di rečnik, v1.0.058 (srp-eng/eng-srp priručni rečnik)
http://www.antivari.com
19.08.2006. u 15:14 

[es] :: C++ programiranje :: Kako saznati user accounte u windows xp-u?

[ Pregleda: 808 | Odgovora: 2 ]

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.