Results 1 to 7 of 7

Thread: [RESOLVED] Why can't I find this file ?

  1. #1

    Thread Starter
    PowerPoster Poppa Mintin's Avatar
    Join Date
    Mar 2009
    Location
    Bottesford, North Lincolnshire, England.
    Posts
    2,423

    Resolved [RESOLVED] Why can't I find this file ?

    Hi,

    I'm trying to start the Malicious software Removal Tool, MRT.exe from my application thus:
    Code:
    Public Class Form1
    
        Private filePath As String = "C:\Windows\System32\MRT.exe"
    
        Private Sub Form1_Load() Handles MyBase.Load
            Label1.Text = "Starting MRT.exe"
        End Sub
    
        Private Sub Button1_Click() Handles Button1.Click
            Button1.Hide()
            Label1.Show()
            If My.Computer.FileSystem.FileExists(filePath) Then
                Process.Start(filePath)
            End If
        End Sub
    
    End Class
    But the app. can't find the file.
    However, if I just open File Explorer, and navigate to C: > Windows > System32, I can see the file "MRT.exe" is in there.
    Using a breakpoint I can see that 'filePath' contains the correct file path.
    So I don't understand what's going on.


    Poppa

    PS.
    Using Windows Key + R, and entering 'MRT' also starts the app.

    Pop
    Last edited by Poppa Mintin; Nov 2nd, 2020 at 07:35 PM. Reason: PS Added
    Along with the sunshine there has to be a little rain sometime.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Why can't I find this file ?

    Off the top of my head, I suspect that the system is virtualising that folder, just as is done for certain Registry keys. That means that applications are assigned their own virtual copy of the folder to prevent them from messing with critical system files. You may need elevated privileges to gain access to the physical folder. That's just an educated guess though. Try running your app as an administrator and that should tell you if I'm right.

  3. #3
    Frenzied Member
    Join Date
    May 2014
    Location
    Central Europe
    Posts
    1,372

    Re: Why can't I find this file ?

    thats correct. but i do not think that running as admin will change it. as far as i know your app running as 32/64 bit makes a difference. syswow64 or sysnative should get you to the path you see in explorer.

  4. #4

    Thread Starter
    PowerPoster Poppa Mintin's Avatar
    Join Date
    Mar 2009
    Location
    Bottesford, North Lincolnshire, England.
    Posts
    2,423

    Re: Why can't I find this file ?

    Thanks digitalShaman,

    Finding how to use that took some time, I tried to find 'syswow64' in MSDB but the only examples were in C++, very helpful! So then I tried 'sysnative +vb.NET' in MSDB but gave up trying to find something relative at page 54.
    I eventually found the answer to be: Change:
    Code:
    Private filePath As String = "C:\Windows\System32\MRT.exe"
    to...
    Code:
    Private filePath As String = "C:\Windows\sysnative\MRT.exe"
    and the file was found immediately.

    Thanks again


    Poppa
    Along with the sunshine there has to be a little rain sometime.

  5. #5
    Frenzied Member
    Join Date
    May 2014
    Location
    Central Europe
    Posts
    1,372

    Re: [RESOLVED] Why can't I find this file ?

    Finding how to use that took some time
    hmm, throwing "sysnative" at google gives this as first hit: https://www.samlogic.net/articles/sy...it-windows.htm and that article explains it very well.

  6. #6

    Thread Starter
    PowerPoster Poppa Mintin's Avatar
    Join Date
    Mar 2009
    Location
    Bottesford, North Lincolnshire, England.
    Posts
    2,423

    Re: [RESOLVED] Why can't I find this file ?

    Quote Originally Posted by digitalShaman View Post
    hmm, throwing "sysnative" at google gives this as first hit: https://www.samlogic.net/articles/sy...it-windows.htm and that article explains it very well.
    I'm sure you're right, I must get out of the habit of looking in MSDB first !

    Pop.
    Along with the sunshine there has to be a little rain sometime.

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: [RESOLVED] Why can't I find this file ?

    Quote Originally Posted by digitalShaman View Post
    hmm, throwing "sysnative" at google gives this as first hit: https://www.samlogic.net/articles/sy...it-windows.htm and that article explains it very well.
    That's interesting. I just tried using the System32 folder name in a Console app and it found the file when I targeted x64 but if I targeted Any CPU and unchecked Prefer 32-bit it didn't find the file. That seems kinda weird because I'd expect that second test to be running in a 64-bit process and to find the file.

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