Gathering information about a workstation

.

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>
/*Usually:
#include <lmcons.h>
#include <lmwksta.h>
#include <lmserver.h>
#include <lmerr.h>*/

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

	int iwLength = 2 * (MAX_COMPUTERNAME_LENGTH + 1);
	WCHAR lpwWkstaName[2 * (MAX_COMPUTERNAME_LENGTH + 1)];

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

	typedef NET_API_STATUS (NET_API_FUNCTION *NETWKPROC)(LPWSTR, DWORD, LPBYTE *);

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

	if(_procNetWkstaGetInfo)
	{
		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;
			}
			else
			  return TRUE;
		}
		else
		{
			//[ERROR] System error. Call GetLastError, FormatMessage, etc.
			return FALSE;
		}
	}
	else
	{
		//[ERROR]Unable to find procedure NetWkstaGetInfo in netapi32.dll.
		return FALSE;
	}
}


History



Comments

  • Ghd Peacock vil bringe deg mer overraskelse

    Posted by pletchertlo on 06/14/2013 04:51am

    [url=http://bestghdrettetangtilbud.devhub.com/] Kjøp ghd rettetang[/url] Selskapet har gitt ut serien av rettetang med glossy og elegant finish.The konvensjonelle GHD hår straighteners er vanligvis utgitt i matt finish og kommer i enten begrenset rosa GHD edition eller standard svart farge. For å lette mens styling, produktet har blitt designet med dreibar ledning vedlegg slik at ledningen knuten av håret verktøyet vil overnatte gratis som du stil. Jevn fordeling av trykket over håret oppnås ved den flytende plater funksjonen i tangen. [url=http://www.rettetangnorgenews.net/]rettetang ghd[/url] Det gjorde sin liste (og mine) fordi den når 450 grader på under 20 sekunder, noe som betyr det groveste av håret er flatt med bare en pull-through av dette jern. Annen teknologi setter dette jernet bortsett fra andre. Den kommuniserer med deg via smart lyd når du er klar til bruk, og kan automatisk slås av hvis den ikke brukes etter 30 minutter. [url=http://ghdrettetangtilbud.webgarden.com/]ghd rettetang norge[/url] Som flere og flere mennesker over hele verden ønsker for rett hår, er GHD hår rettetang blitt svært populære de siste årene. Denne hair rette er definitivt ikke et nytt konsept, og det var svært aktiv i på 60- og 70-tallet til store krøller cane i mote i åttiårene. Men den beste delen av disse GHD skjønnhetsprodukter er at de kan benyttes for styling håret bare om en eller annen form, enten det er poker bølgete, rette eller buede. Og hva er det du velger å gjøre, er du sikker på å gjøre mange en hodet sving.

    Reply
  • If you like the accessory bass, tickety-boo, that’s your choice

    Posted by motherdhmm on 06/03/2013 07:57pm

    [url=http://www.headphonescheaponlineaustralia.com/]beats by dre Australia[/url] The most overt idiosyncrasy is that this headphone is developed at near Dr.Dre who won the Grammy Awards and Deformity audio expert group. Beats can lay down 110dB adaptability to elucidate every fatigue in Rock, Perceptive Fervent and R&B which ask for strictly in aspect velocity. Into the bargain, specially designed earcups space users be sorry for much more serene and support aural secretiveness as well. The ultra-soft breathable cushions can keep an eye on you composed while enjoying the music, reducing perspiration. Swallow actual beats nigh Dre, enjoy the cheerfulness of music, in Australia online cumulate! [url=http://blog.cheapbeatsbydre.co.nz/]beats by dre[/url] Where is the sorcery beauty of spell resemble headphones? Nightmarishness headphones is why varied of my friends loved, why the Freak is the be featured of the moment presentation headphones? Hype, publicity, or what? Hanker after to conscious that the Monster would like to identify the monster headphones of it with me to get it the next. The most famous Troll headphones style is not vested with the brute recording engineer, not a helpful simple to impel Barbarity Solo HD and people agree the handle can be linked to look like lusus naturae of noodles. Speaking of the dragon of noodles would like to have him a drawing of people absolutely, monster noodles in a time sold manifest of this why? This is because the wizardry of the allure of the undisturbed, the magic sound of noodles series headphones, Giant Beats Justbeats Unaccompanied HD Purple on-ear headphones, names such as tangible, headphone line, not in any degree intertwined friends prefer to use headphones to solve a irritating problem. Is the perfect bring up, the headset intrinsic. Small headphones can genuinely carouse a significant effect. The blow-out reviews of this headset, I imagine the-ear headphones is not a can and comparable to the miraculous be activated of noodles no affair the remodel, or internal. The mo is the trend update of fast-paced society. I on that the trice the missing link is also in the supplementary products, trends and resemble combination. This is the hypnotize of monster. [url=http://www.headphonescheaponlineaustralia.com/]beats headphones Australia[/url] Sale-priced beats by dre Dreuncomfortable tenderness. Your nearby hearing tend to be redress it accomplishable in favour of affect with regard to since expeditiously for those who require inseparable special associates animal is more safely a improved than earphones. Moreover, it really is appropriate to be proficient to churn out to obtain the power to get that Is better than doctor dre. beats beside dre Is better than hea.The certain affectivity involving Nightmarishness Beats next to Generate. Dre Studio is drastically much ripping in juxtaposition with Hideousness Beats Individual Hi-def. Specifically, Beats Headphone assignation damned reasonably surely right with reduced regularity, cut-price beats by dre furthermore while striper mightiness and adaptability.

    Reply
  • El mercado al contado planchas ghd baratas

    Posted by hanmeihm on 05/30/2013 05:09am

    [url=http://www.comprar-ghd.manifo.com/]Comprar ghd[/url] Este importante para ayudar a que el movimiento de las planchas para el pelo y peinar el cabello largo de todos ellos porque lquida, as como elegante porque alcanzable. En caso de abandonar las planchas para el pelo reales bloqueados en cualquier tipo de un lugar durante el perodo tamao Cmo se puede alargar Locks Junto con alisadores de pelo GHD, podr¢s localizar resumen de los problemas directamente en tu cabello ghd nz, bastante en comparacin con las ondas, lo que podra ser muy difcil de metales de distancia. [url=http://www.ghdchheapoutlet.moonfruit.com/]Planchas ghd[/url] He experimentado Remington, as como planchas para el pelo Babyliss antes sin embargo absolutamente nada, incluso se compara con imo de GHD. A pesar de que debera basarse en el pelo, la ma es muy pesado y feo y absolutamente nada de lo contrario actuar¢ como muy bien para m. He vivido mi GHD de personal de alrededor de 5 aos, sin embargo, la partida de gran alcance! [url=http://www.ghdplanchasonline.manifo.com/]planchas ghd baratas[/url] He experimentado Remington, as como planchas para el pelo Babyliss antes sin embargo absolutamente nada, incluso se compara con imo de GHD. A pesar de que debera basarse en el pelo, la ma es muy pesado y feo y absolutamente nada de lo contrario actuar¢ como muy bien para m. He vivido mi GHD de personal de alrededor de 5 aos, sin embargo, la partida de gran alcance!

    Reply
  • Jordan shoes mentioned Gene to buy the brand, a margin of Nike

    Posted by TaddyGaffic on 04/24/2013 01:30pm

    Where did that get us? A bunch of banks writing loans that they didnt care if poeple would be able to pay for because they were conforming [url=http://markwarren.org.uk/goodbuy.cfm]nike free uk[/url] loans and Fannie and Freddie would back them. And their $150+ billion losses show that they are just as unable to predict or control the market as the rest of us. It won't work because it doesn't reward investors for taking the risks involved. In order to set a good example of following your dreams, you may wish to consider strictly limiting, or eliminating TV from your life. When people are involved in pursuing their dreams they often find that they do not have the time to watch TV. TV just gets in the way of pursuing other dreams.. Take a limousine ride with Aerosmith on one of the fastest rollercoaster you have to face. Live shows throughout the day from Beauty and the Beast [url=http://markwarren.org.uk/property-waet.cfm]nike air max 90[/url] will bring memories flooding back for young and old. You can get closer to the action and feel that he wanted to be in the spotlight. Other technology advancements are the midsole. It has a compression molded EVA for lasting impact protection. A Vibrakill shock-absorber in the heel provides a lot of [url=http://northernroofing.co.uk/roofins.cfm]nike free run[/url] comfort, and the Exact Pro technology combines a pebax plate and a Dynamic camflex in the forefoot for improved energy return on every step. Meindl Borneo Lady Pro - This shoe is just one of my wifes most popular hiking boots. It is appropriate for lengthy outdoor hikes and you can actually do a tiny stretch of hill hiking whilst sporting them. This product also includes memory foam

    Reply
  • Lightweight smart – Nike Unshackled TR Befit in spring 2013 3 series

    Posted by Tufffruntee on 04/22/2013 06:58am

    Nike Free TR Trim 3 unmistakable features is to exploit the brand-new scheme: Nike Let off 5 soles improved bending Groove; new tractor pattern making training more focused when; lighter preponderance, the permeability is stronger, and more smart shoe designs not only aim for shoes [url=http://markwarren.org.uk/goodbuy.cfm]nike free run[/url] more pleasant wearing, barefoot training feel, but also more in vogue appearance. Nike Relieve TR Fit 3 provides excellent lateral solidity, you can take the legs in the untenable during training. Strong vamp upper breathable mesh, lower soap up's one of a kind lay out can be [url=http://fossilsdirect.co.uk/glossarey.cfm]nike huarache[/url] seen from stem to stern it. Lightweight, demanding, pinched soap up means familiar through entirely only one seams, more flexible, forward is stronger. Need more mainstay, role of a training exercise, froth close in more parts of the need championing give, bubbles loose. Say two-ply tongue moisture wicking synthetic materials, tiresome on your feet, help maintain feet desiccated and comfortable. Phylite [url=http://fossilsdirect.co.uk/glossarey.cfm]nike huarache free[/url] midsole offers lightweight revolt unceasing, outstanding durability and sedate outsole can do to greatly reduce the comprehensive weight of the shoe. Qianzhang pods on the outsole and heel-shaped Grassland rubber enhances the shoe multi-directional drag on different surfaces.

    Reply
  • 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 ?

    Thx,
    Maddi

    Reply
  • 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

    Reply
  • 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?"

    Reply
  • 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.

    Reply
  • 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.

    Regards,
    Igor


    Reply
  • Loading, Please Wait ...

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

Top White Papers and Webcasts

  • Live Event Date: December 11, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT Market pressures to move more quickly and develop innovative applications are forcing organizations to rethink how they develop and release applications. The combination of public clouds and physical back-end infrastructures are a means to get applications out faster. However, these hybrid solutions complicate DevOps adoption, with application delivery pipelines that span across complex hybrid cloud and non-cloud environments. Check out this …

  • CentreCorp is a fully integrated and diversified property management and real estate service company, specializing in the "shopping center" segment, and is one of the premier retail service providers in North America. Company executives travel a great deal, carrying a number of traveling laptops with critical current business data, and no easy way to back up to the network outside the office. Read this case study to learn how CentreCorp implemented a suite of business continuity services that included …

Most Popular Programming Stories

More for Developers

RSS Feeds