Click here to Skip to main content
15,920,217 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I done the coding to get the one system information that are under the current domain.

I want to read all the system information under the same domain,.,

How can i read those information..

My coding:
C
#include "stdafx.h"
#include <windows.h>
#include <lm.h>
int main(int argc, char* argv[])
{
	DWORD dwLevel = 101;
	DWORD dwPrefMaxLen = MAX_PREFERRED_LENGTH;
	LPSERVER_INFO_101 pBuf = NULL;
	DWORD dwEntriesRead = 0;
    DWORD dwTotalEntries = 0;
	DWORD dwServerType = SV_TYPE_SERVER;
	LPTSTR pszDomainName = NULL;
	//LPTSTR lpszDomain = NULL
	DWORD dwResumeHandle = 0;
	NET_API_STATUS nStatus;
	nStatus = NetServerEnum(NULL,
                            dwLevel,
                            (LPBYTE *) & pBuf,
                            dwPrefMaxLen,
                            &dwEntriesRead,
                            &dwTotalEntries,
                            dwServerType, 
                            pszDomainName, 
                            &dwResumeHandle);
	if(nStatus == NERR_Success)
	{
		printf("\n\nSucess\n");
		printf("The total entires is %d\n\n",dwEntriesRead);
		char szBuf[200] = {0};
		sprintf( szBuf, "%S", pBuf->sv101_name );
		printf("The server name %s\n",szBuf);
		printf("The serve type %d\n",pBuf->sv101_type);
		printf("\nThe server major version is %d",pBuf(->sv101_version_major);
		printf("\nThe server minor version is %d",pBuf->sv101_version_minor);
		

	}
	else
	{
		printf("\nError\n");
	}


	return 0;
}
Posted
Updated 26-Jul-11 20:05pm
v2

1 solution

The solution is..

pBuf is the pointer,
by incrementing the pBuf i can move to the next location..

pBuf++;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900