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. Visual Basic
  4. Path/File access error

Path/File access error

Scheduled Pinned Locked Moved Visual Basic
securityhelpquestion
10 Posts 6 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.
  • N Offline
    N Offline
    No e
    wrote on last edited by
    #1

    Have a VB6 legacy program that has been running for years and never saw this before. It opens a text file, reads the contents and closes the file, code is:

    f1 = FreeFile
    Open filename For Binary As #f1 'Open the file
    RawData = Input$(fileLen(filename), #f1) 'read it
    Close #f1 'Close it

    When a user logs on with a non administrator account and tries to run this they get a "Path/File access error". If they log in using an administrator account it works fine. Interestingly enough, it does appear to actually read the file, but the warning is bothersome (removing the warning is not an option) I tried every combination of security on the the file permissions, enabling/disabling Modify, Read and Execute, Read, Write and so-on, the best I can do is generate a "file not found" error, not an access error. Any ideas what else to look at? Thanks in advance no-e

    D L D 3 Replies Last reply
    0
    • N No e

      Have a VB6 legacy program that has been running for years and never saw this before. It opens a text file, reads the contents and closes the file, code is:

      f1 = FreeFile
      Open filename For Binary As #f1 'Open the file
      RawData = Input$(fileLen(filename), #f1) 'read it
      Close #f1 'Close it

      When a user logs on with a non administrator account and tries to run this they get a "Path/File access error". If they log in using an administrator account it works fine. Interestingly enough, it does appear to actually read the file, but the warning is bothersome (removing the warning is not an option) I tried every combination of security on the the file permissions, enabling/disabling Modify, Read and Execute, Read, Write and so-on, the best I can do is generate a "file not found" error, not an access error. Any ideas what else to look at? Thanks in advance no-e

      D Offline
      D Offline
      derek9999
      wrote on last edited by
      #2

      If the file is in a 'my documents' directory which is not the logged in user then you will get a permissions error. You could try moving the file to a directory outside of 'my documents'

      Like developing Commodore software? CBM prg Studio

      N P 2 Replies Last reply
      0
      • D derek9999

        If the file is in a 'my documents' directory which is not the logged in user then you will get a permissions error. You could try moving the file to a directory outside of 'my documents'

        Like developing Commodore software? CBM prg Studio

        N Offline
        N Offline
        No e
        wrote on last edited by
        #3

        Thanks, but the file is in a short path off the root of the C: drive No-e

        S 1 Reply Last reply
        0
        • N No e

          Have a VB6 legacy program that has been running for years and never saw this before. It opens a text file, reads the contents and closes the file, code is:

          f1 = FreeFile
          Open filename For Binary As #f1 'Open the file
          RawData = Input$(fileLen(filename), #f1) 'read it
          Close #f1 'Close it

          When a user logs on with a non administrator account and tries to run this they get a "Path/File access error". If they log in using an administrator account it works fine. Interestingly enough, it does appear to actually read the file, but the warning is bothersome (removing the warning is not an option) I tried every combination of security on the the file permissions, enabling/disabling Modify, Read and Execute, Read, Write and so-on, the best I can do is generate a "file not found" error, not an access error. Any ideas what else to look at? Thanks in advance no-e

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          No-e wrote:

          When a user logs on with a non administrator account and tries to run this they get a "Path/File access error". If they log in using an administrator account it works fine.

          Hence, it must be something that's bound to the profile. Are you using any environment-variables? What is the path based on? Can you show an example? Any other relevant code in there that might cause errors, like reading your path from a key in the registry?

          No-e wrote:

          Interestingly enough, it does appear to actually read the file

          It "appears"? Please verify the actual behaviour; print out the contents of the file or write it to a temp location right after reading. Does or doesn't it read the file? My guess is that it didn't.

          Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

          N 1 Reply Last reply
          0
          • D derek9999

            If the file is in a 'my documents' directory which is not the logged in user then you will get a permissions error. You could try moving the file to a directory outside of 'my documents'

            Like developing Commodore software? CBM prg Studio

            P Offline
            P Offline
            Paul Conrad
            wrote on last edited by
            #5

            derek9999 wrote:

            Like developing Commodore software? CBM prg Studio

            That looks really cool and brings me back memories of programming back in the Commodore days.

            "Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus

            D 1 Reply Last reply
            0
            • N No e

              Have a VB6 legacy program that has been running for years and never saw this before. It opens a text file, reads the contents and closes the file, code is:

              f1 = FreeFile
              Open filename For Binary As #f1 'Open the file
              RawData = Input$(fileLen(filename), #f1) 'read it
              Close #f1 'Close it

              When a user logs on with a non administrator account and tries to run this they get a "Path/File access error". If they log in using an administrator account it works fine. Interestingly enough, it does appear to actually read the file, but the warning is bothersome (removing the warning is not an option) I tried every combination of security on the the file permissions, enabling/disabling Modify, Read and Execute, Read, Write and so-on, the best I can do is generate a "file not found" error, not an access error. Any ideas what else to look at? Thanks in advance no-e

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              Since you're getting a Path/Access Violation error, you've got one of two causes. Either the path you built in "filename" is invalid, or the user that's running the code doesn't have appropriate permissions to the folderpath the file is in.

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak

              1 Reply Last reply
              0
              • N No e

                Thanks, but the file is in a short path off the root of the C: drive No-e

                S Offline
                S Offline
                slam Iqbal
                wrote on last edited by
                #7

                Commonly, non administrator user can't access C: drive. U have to set access right for the limited user from admin.

                1 Reply Last reply
                0
                • L Lost User

                  No-e wrote:

                  When a user logs on with a non administrator account and tries to run this they get a "Path/File access error". If they log in using an administrator account it works fine.

                  Hence, it must be something that's bound to the profile. Are you using any environment-variables? What is the path based on? Can you show an example? Any other relevant code in there that might cause errors, like reading your path from a key in the registry?

                  No-e wrote:

                  Interestingly enough, it does appear to actually read the file

                  It "appears"? Please verify the actual behaviour; print out the contents of the file or write it to a temp location right after reading. Does or doesn't it read the file? My guess is that it didn't.

                  Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

                  N Offline
                  N Offline
                  No e
                  wrote on last edited by
                  #8

                  No environment variables, path is read from a configuration file, fairly straight forward. Not sure about additional code, it is very simple procedure, this one reads it and converts it from hex to binary and returns it in an array (of small blocks to be shoved down a serial port in the calling routing). I could have been more clear on appears, by appears, the file must be read because the system converts it and sends it to a bunch of hardware. The operator tells me they see this happening (the system shows the file being loaded in blocks), and the hardware subsequently goes off and does its thing with this new data, which works correctly. No-e

                  1 Reply Last reply
                  0
                  • P Paul Conrad

                    derek9999 wrote:

                    Like developing Commodore software? CBM prg Studio

                    That looks really cool and brings me back memories of programming back in the Commodore days.

                    "Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus

                    D Offline
                    D Offline
                    derek9999
                    wrote on last edited by
                    #9

                    Thanks, did you give it a try?

                    Like developing Commodore software? CBM prg Studio

                    P 1 Reply Last reply
                    0
                    • D derek9999

                      Thanks, did you give it a try?

                      Like developing Commodore software? CBM prg Studio

                      P Offline
                      P Offline
                      Paul Conrad
                      wrote on last edited by
                      #10

                      Yes, I've given it a try, and looks to be something to mess around with on some free time.

                      "Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus

                      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