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

Kako saznati user accounte u windows xp-u?

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

[ Pregleda: 3172 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

maximus_1
Max Maximus

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



Profil

icon Kako saznati user accounte u windows xp-u?19.08.2006. u 14:06 - pre 215 meseci
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).
 
Odgovor na temu

icobh
Igor Pejašinović
Network Admin
Navigo SC d.o.o.
Banja Luka

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

Sajt: www.nsc.ba


+4 Profil

icon Re: Kako saznati user accounte u windows xp-u?19.08.2006. u 14:26 - pre 215 meseci
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!
 
Odgovor na temu

X Files
Vladimir Stefanovic
Pozarevac

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

Jabber: xfiles@elitesecurity.org


+638 Profil

icon Re: Kako saznati user accounte u windows xp-u?19.08.2006. u 15:14 - pre 215 meseci
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]
 
Odgovor na temu

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

[ Pregleda: 3172 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

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