Gathering information about a workstation


Application Security Testing: An Integral Part of DevOps


Some times you need information about a workstation, for example if you want to know if a workstation is not running WindowsNT and you try some NT-specific job without any chance. I think this pseudo-routine can be helpful.

#include <what_you_need.h>
#include <lmcons.h>
#include <lmwksta.h>
#include <lmserver.h>
#include <lmerr.h>*/

//	Network API job - obtain network info about selected machine.
	LPBYTE lpBuf;
	LPCSTR lpcstrWkstaName = (LPCSTR)m_strWkstaName;

	int iwLength = 2 * (MAX_COMPUTERNAME_LENGTH + 1);

	lpwWkstaName[0] = '\0';
	MultiByteToWideChar(CP_ACP, 0, lpcstrWkstaName, -1, lpwWkstaName, iwLength);


	NETWKPROC _procNetWkstaGetInfo = (NETWKPROC)
		(GetProcAddress(theApp.m_hNetDLL, _T("NetWkstaGetInfo")));

		NET_API_STATUS nasRetVal = (*_procNetWkstaGetInfo)(lpwWkstaName, 100, (LPBYTE*)&lpBuf);

		if(nasRetVal == NERR_Success)
			WKSTA_INFO_100 *pWkstaInfo = (WKSTA_INFO_100 *)lpBuf;
			DWORD dwPlatformId = pWkstaInfo->wki100_platform_id;

			if(dwPlatformId != PLATFORM_ID_NT)
				//[ERROR]Not a Windows NT Workstation - if useful.
				return FALSE;
			  return TRUE;
			//[ERROR] System error. Call GetLastError, FormatMessage, etc.
			return FALSE;
		//[ERROR]Unable to find procedure NetWkstaGetInfo in netapi32.dll.
		return FALSE;



  • Please help with Error 53

    Posted by Legacy on 12/25/2002 12:00am

    Originally posted by: Maddi

    Hi all,

    I always get Error 53 back from the Funktions NetWkstaGetInfo or NetServerGetInfo, can somebody give me a hint how to fix that ? I don't know what the Error means (Network Path not found ? But the Path should be correct).

    Do I have to initialise something before this ?


  • help in VC project

    Posted by Legacy on 10/13/2002 12:00am

    Originally posted by: bhushan

    i have to make a project in vc++ which will allow a user access to all desktops on the LAN.
    i want to know how to go abt it,spclly whch feature to use and reference matrial if avalble

  • How to find a file from a networked workstation or server?

    Posted by Legacy on 06/13/2002 12:00am

    Originally posted by: Ken

    Very interesting piece of codes, I want to know "How to find a file from a networked workstation or server?"

  • windows nt administration

    Posted by Legacy on 09/25/2000 12:00am

    Originally posted by: vikas kumar sharma

    there is lot of things that can be done with network api's. we can find out the hardware details of a particular wkstn and the users that use them. info about the users in the n/w can also be found out programatically check the samples in msdn.

  • User have to be an Administrator or print or....

    Posted by Legacy on 12/15/1999 12:00am

    Originally posted by: Igor Proskuriakov

    Just one comment about this utility: you must have Print or Server operator privilege, or be a member of the Administrator or Account local groups to successfully execute the NetWkstaGetInfo function.


  • doubt

    Posted by Legacy on 09/16/1999 12:00am

    Originally posted by: s.p.manoj

    hello sir,

    Is there any any to obtain info of a workstation
    from another workstation.if so pls send me some details
    through mail.I am doing a project for obtaining info
    of a local system.It's all most over.I want to add this capablity to.

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • As all sorts of data becomes available for storage, analysis and retrieval - so called 'Big Data' - there are potentially huge benefits, but equally huge challenges...
  • The agile organization needs knowledge to act on, quickly and effectively. Though many organizations are clamouring for "Big Data", not nearly as many know what to do with it...
  • Cloud-based integration solutions can be confusing. Adding to the confusion are the multiple ways IT departments can deliver such integration...

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.