0

I am developing a vb.net application.

I have made my own file and put in the system32 folder.

Now,I am trying to read same file which I have put in the folder with below code...

         Try
            Dim FileData As String = ""
            Dim line As String = "'"
            Dim readFile As System.IO.TextReader = New StreamReader("C:\Windows\System32\winApps.dll")
            While True
            .
            .
            .
        Catch ex As Exception
            Me.Close()
        End Try

But whenever I run above code, its gives an error - at readFile statement...

Could not find file 'C:\Windows\System32\winApps.dll'.

but file do exist there...but if I change the files location code runs without an error.

enter image description here

I have administrative rights.

What I am missing ?

bnil
  • 1,531
  • 6
  • 35
  • 68
  • 6
    [File System Redirector](https://msdn.microsoft.com/en-us/library/windows/desktop/aa384187.aspx). – IInspectable May 16 '16 at 16:39
  • Try running the application "as administrator", though file system redirection sounds more likely. – Todd Hartman May 16 '16 at 16:47
  • checked, Not working... – bnil May 16 '16 at 16:56
  • 1
    Does your file *really* belong in a subdirectory of "Windows", or would it be better if it was somewhere in "Program Files" (or "Program Data" as it appears you are regarding it as a text file)? – Andrew Morton May 16 '16 at 17:07
  • 1
    Trying to read text from a DLL is not a sensible thing to do. The default settings of a VB project will get you to read only files from c:\windows\syswow64. – Hans Passant May 16 '16 at 17:56

0 Answers0