Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. NetWkstaGetInfo ()

NetWkstaGetInfo ()

Scheduled Pinned Locked Moved C / C++ / MFC
helpjsonperformancetutorialquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vin
    wrote on last edited by
    #1

    How to use this API to get the info of remote machines? Here is my sample code.. I am getting a memory error . Can anyone suggest me where i went wrong. Is there any other way to pass the first argument(machine name) to the API? //////////////////// //getting details of machines wchar_t *tmp4=(wchar_t *)malloc(sizeof( wchar_t )); strcat(mbstr2,tempname[snum]); mbstr2[strlen(mbstr2)]='\0'; size_t x=strlen(mbstr2); mbstowcs(tmp4,mbstr2,x); WKSTA_INFO_101 *level=NULL; LPTSTR tmp7=(LPTSTR)tmp4; NET_API_STATUS nwData=NetWkstaGetInfo(tmp7,101,(LPBYTE*)&level); if(nwData==NERR_Success) { int iLen3=wcslen ((unsigned short *)level->wki101_computername); for(int j=0;jwki101_computername); level->wki101_computername++; level->wki101_computername++; } name[j]='\0'; AfxMessageBox(name); ////////////////// Kindly help. Regards, Vini

    M 1 Reply Last reply
    0
    • V vin

      How to use this API to get the info of remote machines? Here is my sample code.. I am getting a memory error . Can anyone suggest me where i went wrong. Is there any other way to pass the first argument(machine name) to the API? //////////////////// //getting details of machines wchar_t *tmp4=(wchar_t *)malloc(sizeof( wchar_t )); strcat(mbstr2,tempname[snum]); mbstr2[strlen(mbstr2)]='\0'; size_t x=strlen(mbstr2); mbstowcs(tmp4,mbstr2,x); WKSTA_INFO_101 *level=NULL; LPTSTR tmp7=(LPTSTR)tmp4; NET_API_STATUS nwData=NetWkstaGetInfo(tmp7,101,(LPBYTE*)&level); if(nwData==NERR_Success) { int iLen3=wcslen ((unsigned short *)level->wki101_computername); for(int j=0;jwki101_computername); level->wki101_computername++; level->wki101_computername++; } name[j]='\0'; AfxMessageBox(name); ////////////////// Kindly help. Regards, Vini

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      I don't understand all that string manipulation at the beginning. :confused: The first param is either NULL to use the local computer, or a Unicode string holding the name of the computer to get info for, for example L"\\Servername" --Mike--    THERE IS NO     THERE IS NO    BUT THERE IS MAGIC PIXIE DUST  BUSINESS GENIE  CODE PROJECT BUY MY SOFTWARE!! (please?) RightClick-Encrypt | 1ClickPicGrabber My IntarWeb Homepgae!!!11

      V 1 Reply Last reply
      0
      • M Michael Dunn

        I don't understand all that string manipulation at the beginning. :confused: The first param is either NULL to use the local computer, or a Unicode string holding the name of the computer to get info for, for example L"\\Servername" --Mike--    THERE IS NO     THERE IS NO    BUT THERE IS MAGIC PIXIE DUST  BUSINESS GENIE  CODE PROJECT BUY MY SOFTWARE!! (please?) RightClick-Encrypt | 1ClickPicGrabber My IntarWeb Homepgae!!!11

        V Offline
        V Offline
        vin
        wrote on last edited by
        #3

        Michael Dunn wrote: don't understand all that string manipulation at the beginning. The first param is either NULL to use the local computer, or a Unicode string holding the name of the computer to get info for, for example L"\\Servername" I want to give the first argument at run time(not a NULL value),means give the selected machine name from a list box or edit box. The initial string manipulations were used to convert the value in a CString variable to the type of the first parameter . is it not required? Kidly help.. Vini

        M 1 Reply Last reply
        0
        • V vin

          Michael Dunn wrote: don't understand all that string manipulation at the beginning. The first param is either NULL to use the local computer, or a Unicode string holding the name of the computer to get info for, for example L"\\Servername" I want to give the first argument at run time(not a NULL value),means give the selected machine name from a list box or edit box. The initial string manipulations were used to convert the value in a CString variable to the type of the first parameter . is it not required? Kidly help.. Vini

          M Offline
          M Offline
          Michael Dunn
          wrote on last edited by
          #4

          Use the T2CW macro to do that

          #include <atlconv.h> // need this header for the macro

          {
          USES_CONVERSION;

          NetWkstaGetInfo ( T2CW(LPCTSTR(sComputerName)), ... );
          }

          --Mike--    THERE IS NO     THERE IS NO    BUT THERE IS MAGIC PIXIE DUST  BUSINESS GENIE  CODE PROJECT :bob: Homepage | RightClick-Encrypt | 1ClickPicGrabber

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups