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. How to find out remote files?

How to find out remote files?

Scheduled Pinned Locked Moved C / C++ / MFC
sysadmintutorialquestion
8 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.
  • D Offline
    D Offline
    Daniel Visan
    wrote on last edited by
    #1

    Is there anybody knows how to find the names of the shared files and folders on a remote computer like "network neighborhood" does? "FindFirstFile" function doesnt seem to work. Maybe the path i use is not correct or it doesnt work at all on the subject. Ex: FindFirstFile("\\Comp_name\\fold_name\\*.*" ,.....) PS: And more... Im very curios to find out how "network neighborhood" manages to obtain those shared files and folders? What's the mechanism it use? :eek: Thank you.

    M D 3 Replies Last reply
    0
    • D Daniel Visan

      Is there anybody knows how to find the names of the shared files and folders on a remote computer like "network neighborhood" does? "FindFirstFile" function doesnt seem to work. Maybe the path i use is not correct or it doesnt work at all on the subject. Ex: FindFirstFile("\\Comp_name\\fold_name\\*.*" ,.....) PS: And more... Im very curios to find out how "network neighborhood" manages to obtain those shared files and folders? What's the mechanism it use? :eek: Thank you.

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

      FindFirstFile("\\Comp_name\\fold_name\\*.*" ,.....) You're missing a slash at the beginning (well, two actually): FindFirstFile("\\\\Comp_name\\fold_name\\*.*" ,.....) --Mike-- http://home.inreach.com/mdunn/ "The Earth is doomed." -- Rupert Giles :love: your :bob: with :vegemite: and :beer:

      1 Reply Last reply
      0
      • D Daniel Visan

        Is there anybody knows how to find the names of the shared files and folders on a remote computer like "network neighborhood" does? "FindFirstFile" function doesnt seem to work. Maybe the path i use is not correct or it doesnt work at all on the subject. Ex: FindFirstFile("\\Comp_name\\fold_name\\*.*" ,.....) PS: And more... Im very curios to find out how "network neighborhood" manages to obtain those shared files and folders? What's the mechanism it use? :eek: Thank you.

        D Offline
        D Offline
        Daniel Visan
        wrote on last edited by
        #3

        FindFirstFile(\\\\Comp_name\\fold_name\\*.*" ,.....). I still dont get how this function works...

        N 1 Reply Last reply
        0
        • D Daniel Visan

          FindFirstFile(\\\\Comp_name\\fold_name\\*.*" ,.....). I still dont get how this function works...

          N Offline
          N Offline
          NormDroid
          wrote on last edited by
          #4

          FindFirstFile returns a handle, so one's code would look like this... (a snipped from my production code) WIN32_FIND_DATA fd; CString sQualifier = sPath; sQualifier += _T("\\*.*"); HANDLE hFindFile = FindFirstFile(sQualifier, &fd); BOOL bBool = hFindFile == INVALID_HANDLE_VALUE ? FALSE : TRUE; if (!bBool) return FALSE; int i=0; while (bBool) { if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { listFiles.insert(FileList::value_type(fd.cFileName, fd)); i++; } bBool = FindNextFile(hFindFile, &fd); } Norm Almond Chief Technical Architect FS Walker Hughes Limited

          D 1 Reply Last reply
          0
          • D Daniel Visan

            Is there anybody knows how to find the names of the shared files and folders on a remote computer like "network neighborhood" does? "FindFirstFile" function doesnt seem to work. Maybe the path i use is not correct or it doesnt work at all on the subject. Ex: FindFirstFile("\\Comp_name\\fold_name\\*.*" ,.....) PS: And more... Im very curios to find out how "network neighborhood" manages to obtain those shared files and folders? What's the mechanism it use? :eek: Thank you.

            D Offline
            D Offline
            Daniel Visan
            wrote on last edited by
            #5

            FindFirstFile("\\Comp_name\\fold_name\\*.*",... ) works fine. But FindFirstFile("\\Comp_name\\*.*,...) doesnt return anything...:mad: Then i started the "Command Prompt" and type "dir \\comp_name" and i got the following message:" The share name was not found" !!!!! i also mention that in Command prompt the following works fine: "dir \\comp_name\\fold_name" !!!! If i type in Command prompt "NET VIEW \\comp_name" i get exactly what i want. Try yourself if you think i'm jocking. So, how do i find out the parent directories on a remote computer (in my application, of course)? Thank you... again:

            1 Reply Last reply
            0
            • N NormDroid

              FindFirstFile returns a handle, so one's code would look like this... (a snipped from my production code) WIN32_FIND_DATA fd; CString sQualifier = sPath; sQualifier += _T("\\*.*"); HANDLE hFindFile = FindFirstFile(sQualifier, &fd); BOOL bBool = hFindFile == INVALID_HANDLE_VALUE ? FALSE : TRUE; if (!bBool) return FALSE; int i=0; while (bBool) { if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { listFiles.insert(FileList::value_type(fd.cFileName, fd)); i++; } bBool = FindNextFile(hFindFile, &fd); } Norm Almond Chief Technical Architect FS Walker Hughes Limited

              D Offline
              D Offline
              Daniel Visan
              wrote on last edited by
              #6

              I knew all the things you tell me.Thanx, anyway.In fact wanted to ask something else... I meant how does a function on my computer like FindFirstFile managed to find out the shared resource on a remote computer? From where that function collects theese informations? What network protocol theese function use? Why do i ask all theese questions? Just because i want to write a project... I want collect from my LAN how many information i can. All theese informations i want to monitorize on my computer. If i write a socket based client on every computer and a server on my computer then the problem is solved. BUT, I WANT TO WRITE A SINGLE APPLICATION ON MY COMPUTER IN ORDER TO GATHER INFORMATION FROM ALL COMPUTER IN MY NETWORK, ABOUT:IP ADDRESS, PROCESSES, MAC ADDRESS, FREE SPACE ON HARDDRIVES, AND MANY MANY OTHERS. Of course, i make use of SNMP (MIBII) BUT ONLY LOCAL. I dont know how to access SNMP information on remote computer. I hope i wasnt boring and i made myself clear.

              M 1 Reply Last reply
              0
              • D Daniel Visan

                I knew all the things you tell me.Thanx, anyway.In fact wanted to ask something else... I meant how does a function on my computer like FindFirstFile managed to find out the shared resource on a remote computer? From where that function collects theese informations? What network protocol theese function use? Why do i ask all theese questions? Just because i want to write a project... I want collect from my LAN how many information i can. All theese informations i want to monitorize on my computer. If i write a socket based client on every computer and a server on my computer then the problem is solved. BUT, I WANT TO WRITE A SINGLE APPLICATION ON MY COMPUTER IN ORDER TO GATHER INFORMATION FROM ALL COMPUTER IN MY NETWORK, ABOUT:IP ADDRESS, PROCESSES, MAC ADDRESS, FREE SPACE ON HARDDRIVES, AND MANY MANY OTHERS. Of course, i make use of SNMP (MIBII) BUT ONLY LOCAL. I dont know how to access SNMP information on remote computer. I hope i wasnt boring and i made myself clear.

                M Offline
                M Offline
                markkuk
                wrote on last edited by
                #7

                I think the Windows Networking (WNet) functions could be what you need. See the Platform SDK docs under Networking and Directory Services/Network Management.

                D 1 Reply Last reply
                0
                • M markkuk

                  I think the Windows Networking (WNet) functions could be what you need. See the Platform SDK docs under Networking and Directory Services/Network Management.

                  D Offline
                  D Offline
                  Daniel Visan
                  wrote on last edited by
                  #8

                  WNet is exactly what i was thinking about! i discovered WNet looking at "Computers enumeration" article. Now that you told me about WNet i have more trust in it. I have to say my WNet knowledge is zero. Did you actualy use WNet on your projects? Do you know some articles except MSDN ones? Thank you a lot! :rose:

                  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