Local Computer Membership

Acest forum este dedicat intrebarilor de Windows API, folosing C/C++
Post Reply
User avatar
Ovidiu Cucu
Fondator
Fondator
Posts: 3778
Joined: 11 Jul 2007, 16:10
Judet: Iaşi
Location: Iasi
Contact:

Local Computer Membership

Post by Ovidiu Cucu » 17 Jul 2007, 10:26

Stie cineva cum aflu informatiile din poza de mai jos?
Respectiv "XYZ" daca, computerul este "Member of Domain" si "WORKGROUP" daca este "Member of Workgroup".

Please!
Attachments
ComputerMembership.gif
ComputerMembership.gif (8.6 KiB) Viewed 4424 times



User avatar
Ovidiu Cucu
Fondator
Fondator
Posts: 3778
Joined: 11 Jul 2007, 16:10
Judet: Iaşi
Location: Iasi
Contact:

Re: Local Computer Membership

Post by Ovidiu Cucu » 17 Jul 2007, 11:35

L-am gasit: NetWkstaGetInfo.

Code: Select all

#include <LM.h>
#pragma comment(lib, "Netapi32.lib")
// ...
   LPWKSTA_INFO_100 pBuff = NULL;
   DWORD dwLevel = 100;
   NET_API_STATUS status = ::NetWkstaGetInfo(NULL, dwLevel, (LPBYTE*)&pBuff);
   if(NERR_Success == status)
   {
      ::MessageBoxW(NULL, (LPCWSTR)pBuff->wki100_langroup, L"Got you!", MB_OK);
   }
   ::NetApiBufferFree(pBuff);
Scuze! :)

User avatar
Marius Bancila
Fondator
Fondator
Posts: 2344
Joined: 11 Jul 2007, 11:45
Judet: Timiş
Location: Timisoara
Contact:

Re: Local Computer Membership

Post by Marius Bancila » 17 Jul 2007, 11:52

Poti citi informatiile respective (si modifica) din Registry:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters.

Te intereseaza WMI?

http://msdn2.microsoft.com/en-us/library/aa394586.aspx
Marius Bancila
Fondator Codexpert, Microsoft MVP VC++
Site personal | Blog

User avatar
Ovidiu Cucu
Fondator
Fondator
Posts: 3778
Joined: 11 Jul 2007, 16:10
Judet: Iaşi
Location: Iasi
Contact:

Re: Local Computer Membership

Post by Ovidiu Cucu » 17 Jul 2007, 12:10

Marius Bancila wrote: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters.
Te referi la valoarea "Domain"?
La mine e empty, pentru ca nu sunt intr-un domeniu.
Totusi functia NetWkstaGetInfo imi zice corect "WORKGROUP" ca-n poza.

Vrei, te rog, sa verifici la tine daca merge bucatica mea de cod de mai sus (afiseaza corect domain name)?

User avatar
Marius Bancila
Fondator
Fondator
Posts: 2344
Joined: 11 Jul 2007, 11:45
Judet: Timiş
Location: Timisoara
Contact:

Re: Local Computer Membership

Post by Marius Bancila » 17 Jul 2007, 12:37

Nu, nu merge. Domeniul meu (dupa cum e afisat si de la my computer si in Registry) e de forma prefix.domeniu.ext. Cu functia aia imi zice ca wki100_langroup e doar prefix.
Marius Bancila
Fondator Codexpert, Microsoft MVP VC++
Site personal | Blog

Post Reply