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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Share names

Share names

Scheduled Pinned Locked Moved C / C++ / MFC
help
10 Posts 4 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.
  • K Offline
    K Offline
    kelprinc
    wrote on last edited by
    #1

    I am using NetShareGetInfo and i am getting a NERR_NetNameNotFound.I am using the folder path as the share name e.g "C:\\WINNT\\profiles\\chikomok\\My Documents\\Open_Shares" and the sever is the remote P.C were the program is running Can some please tell me what the problem could be. Kelvin Chikomo

    V 1 Reply Last reply
    0
    • K kelprinc

      I am using NetShareGetInfo and i am getting a NERR_NetNameNotFound.I am using the folder path as the share name e.g "C:\\WINNT\\profiles\\chikomok\\My Documents\\Open_Shares" and the sever is the remote P.C were the program is running Can some please tell me what the problem could be. Kelvin Chikomo

      V Offline
      V Offline
      vallikumar
      wrote on last edited by
      #2

      If the share name does not exist, then system will return NERR_NetNameNotFound error message. So please check your share name exactly with the shared device in the server. And also server name should begins with \\. If this parameter is NULL, the local computer is used. best of luck regards Vallikumar A

      K _ 2 Replies Last reply
      0
      • V vallikumar

        If the share name does not exist, then system will return NERR_NetNameNotFound error message. So please check your share name exactly with the shared device in the server. And also server name should begins with \\. If this parameter is NULL, the local computer is used. best of luck regards Vallikumar A

        K Offline
        K Offline
        kelprinc
        wrote on last edited by
        #3

        When i try to use \\. i get an error 53 which i do not know what it means. Any help Here is my code // test2.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "test2.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // The one and only application object CWinApp theApp; using namespace std; void wmain( int argc, TCHAR *lpszArgv[ ]) { PSHARE_INFO_502 BufPtr; NET_API_STATUS res; LPTSTR lpszServer = NULL, lpszShare; // // Check command line arguments. // switch(argc) { case 3: lpszServer = lpszArgv[2]; case 2: lpszShare = lpszArgv[1]; break; default: printf("Usage: NetShareGetInfo sharename \n"); return; } // // Call the NetShareGetInfo function, specifying level 502. // cout<shi502_netname, BufPtr->shi502_path, BufPtr->shi502_current_uses); // // Validate the value of the // shi502_security_descriptor member. // if (IsValidSecurityDescriptor(BufPtr->shi502_security_descriptor)) printf("It has a valid Security Descriptor.\n"); else printf("It does not have a valid Security Descriptor.\n"); // // Free the allocated memory. // NetApiBufferFree(BufPtr); } else { if(res == NERR_NetNameNotFound) cout<<"Netnamenotfound"<

        1 Reply Last reply
        0
        • V vallikumar

          If the share name does not exist, then system will return NERR_NetNameNotFound error message. So please check your share name exactly with the shared device in the server. And also server name should begins with \\. If this parameter is NULL, the local computer is used. best of luck regards Vallikumar A

          _ Offline
          _ Offline
          _AnsHUMAN_
          wrote on last edited by
          #4

          You didn't specify that to which machine have you connected to, so it is throwing that error. Use NetResource structure and WNetAddConnection to open the connection so that you can have access to the shared folders on the remote machine . You can also try and check other return values. Remember WNetAddConnection returns a DWORD value eg ERROR_ACCESS_DENIED etc. Does this solve your problem Wishes Anshuman

          K 1 Reply Last reply
          0
          • _ _AnsHUMAN_

            You didn't specify that to which machine have you connected to, so it is throwing that error. Use NetResource structure and WNetAddConnection to open the connection so that you can have access to the shared folders on the remote machine . You can also try and check other return values. Remember WNetAddConnection returns a DWORD value eg ERROR_ACCESS_DENIED etc. Does this solve your problem Wishes Anshuman

            K Offline
            K Offline
            kelprinc
            wrote on last edited by
            #5

            I thought all i had to do was to call the netsharegetinfo method. i am just trying to get information from my computer thats all. The method description says put //. to access shares on the remote machine. I really need to get this going Help please Kelvin Chikomo

            V _ 2 Replies Last reply
            0
            • K kelprinc

              I thought all i had to do was to call the netsharegetinfo method. i am just trying to get information from my computer thats all. The method description says put //. to access shares on the remote machine. I really need to get this going Help please Kelvin Chikomo

              V Offline
              V Offline
              vallikumar
              wrote on last edited by
              #6

              If you want to access the information from your machine then no need to give the share name(Server) with \\. Instead this give NULL. This will get the information from your local machine. regards Vallikumar A

              K 1 Reply Last reply
              0
              • V vallikumar

                If you want to access the information from your machine then no need to give the share name(Server) with \\. Instead this give NULL. This will get the information from your local machine. regards Vallikumar A

                K Offline
                K Offline
                kelprinc
                wrote on last edited by
                #7

                I have tried that, thats when i get the NERR_NetNameNotFound error. should i give the full path of my shared folder or just the share name. It seems logical to use the share name.

                1 Reply Last reply
                0
                • K kelprinc

                  I thought all i had to do was to call the netsharegetinfo method. i am just trying to get information from my computer thats all. The method description says put //. to access shares on the remote machine. I really need to get this going Help please Kelvin Chikomo

                  _ Offline
                  _ Offline
                  _AnsHUMAN_
                  wrote on last edited by
                  #8

                  The NetShareGetInfo function retrieves information about a particular shared resource on a server.??To what extent do you want to have the control??. SO if you need the control of the files/folders/printers that are residing on the other machine use NETRESOURCE structure and pass it to WNetAddConnection2 function. This opens the connection and you can get the control to the shared folders. Can you tell me what exactly do you want to do because there are a lot of roads that lead to somewhere from here but that would be useless mentioning here if they are of no use to you Wishes Anshuman

                  K 1 Reply Last reply
                  0
                  • _ _AnsHUMAN_

                    The NetShareGetInfo function retrieves information about a particular shared resource on a server.??To what extent do you want to have the control??. SO if you need the control of the files/folders/printers that are residing on the other machine use NETRESOURCE structure and pass it to WNetAddConnection2 function. This opens the connection and you can get the control to the shared folders. Can you tell me what exactly do you want to do because there are a lot of roads that lead to somewhere from here but that would be useless mentioning here if they are of no use to you Wishes Anshuman

                    K Offline
                    K Offline
                    kelprinc
                    wrote on last edited by
                    #9

                    I am creating a tool to check the attributes of all the shares on my computer. just my computer. So basically i need to get all the information about the shares on my PC using NetShareGetInfo. So far i have been trying to get info for one specific share but it keeps saying the the shre does not exist(NERR_NetNameNotFound) Thanks for the help hey. Kelvin Chikomo

                    D 1 Reply Last reply
                    0
                    • K kelprinc

                      I am creating a tool to check the attributes of all the shares on my computer. just my computer. So basically i need to get all the information about the shares on my PC using NetShareGetInfo. So far i have been trying to get info for one specific share but it keeps saying the the shre does not exist(NERR_NetNameNotFound) Thanks for the help hey. Kelvin Chikomo

                      D Offline
                      D Offline
                      David Crow
                      wrote on last edited by
                      #10

                      kelprinc wrote:

                      So basically i need to get all the information about the shares on my PC using NetShareGetInfo.

                      Use NetShareEnum(NULL, ...) instead. If you need information about a particular share, use NetShareGetInfo(NULL, _T("NameOfShare"), ...).


                      "The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb

                      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