Results 1 to 9 of 9

Thread: [RESOLVED] How to grant application access to read files in the windows folder?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2010
    Posts
    131

    Resolved [RESOLVED] How to grant application access to read files in the windows folder?

    How do I give my program access to check if some files exist in the windows and its subfolders?
    As it is, I check for a file that exists, and the program says it doesn't exist, so I'm guessing it has no access to read there, so how would I go to give it permissions to read and/or write there?

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: How to grant application access to read files in the windows folder?

    If it was an access problem then you'd get an error. As usual with no code given it's impossible to make any further comment.
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2010
    Posts
    131

    Re: How to grant application access to read files in the windows folder?

    lets make it simple, the code below will say file doesn't exist.

    vb.net Code:
    1. If File.Exists("C:\Windows\system32\tapilua.dll") Then
    2.             MsgBox("File exists")
    3.         Else
    4.             MsgBox("File doesnt exist")
    5.         End If

  4. #4
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: How to grant application access to read files in the windows folder?

    Will it?

    Name:  a.png
Views: 85
Size:  21.7 KB
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Apr 2010
    Posts
    131

    Re: How to grant application access to read files in the windows folder?

    See, the thing is I definitely don't have permissions there, that's why I get file doesnt exist, I'm certain about that. Even running as admin won't change things.
    Btw, are you using 64bit version or 32bit version of windows 7, and do you have uac on or off?
    I have uac off and am on win7 64bit.


  6. #6
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: How to grant application access to read files in the windows folder?

    The 64 bit OS doesn't really acknowledge the existence of System32 as I understand it, which would be a pretty good reason for being told that the file doesn't exist. If you can open the folder in Explorer then you should have access through IO.File but it might be worth trying the My.Computer.FileSystem equivalent if there's still a problem. If you're running with admin privileges and UAC off there really aren't any privilege questions involved. Take Ownership is your last recourse if you think otherwise but if you can't open the folder in Explorer then there's nothing that can be done to grant you access unfortunately (well not within the OS anyway).
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Apr 2010
    Posts
    131

    Re: How to grant application access to read files in the windows folder?

    I can access it in explorer without any problems. I tried listing all the files in the system32 folder, and even though that dll exists when I check in explorer, in my listbox it is not listed. hmm this is just wow. Took ownership of that file, still says doesn't exist.
    Last edited by Legjendat; Feb 23rd, 2013 at 04:32 PM.

  8. #8
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: How to grant application access to read files in the windows folder?

    Have you tried a complete Explorer search for the file. I suppose it is just possible that the one you're seeing is a 'virtual' copy that shows up in the file listing but actually is situated somewhere else. Other than that, I'm out of ideas.
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Apr 2010
    Posts
    131

    Re: How to grant application access to read files in the windows folder?

    OMG, I fixed it. Went into properties-compile. Changed target cpu from x86 to Any CPU. Unbelievable.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width