Question : MFC Net API's to enumerate machines in a domain

hi,
    i have been slogging days together to get names of machines in a particular domain , but all in vain. What i have got is list of all domains in my network using NetServerEnum API in MFC. now i need to get the machines under them for each domain . I tried NetGedDC,NetQueryDisplayInformation , etc, but dosent work , as buffer fetches no info. Though i hard-coded to give name of Primary domain controller to NetQueryDisplayInformation, it doesnt seem to work.
A help in this area would be greatly appreciated.
kiran

Answer : MFC Net API's to enumerate machines in a domain

From the MSDN Documentation:
servername
[in] Reserved; must be NULL.
and
domain
[in] Pointer to a constant string that specifies the name of the domain for which a list of servers is to be returned. The domain name must be a NetBIOS domain name (for example, microsoft). NetServerEnum does not support DNS-style names (for example, microsoft.com). If this parameter is NULL, the primary domain is implied.
Both of these are defined as LPCWSTR (Wide string) so you must convert your NETBIOS domain name to a wide string before this API will understand it.

.. Alan
Random Solutions  
 
programming4us programming4us