-
Nov 2nd, 2020, 07:32 PM
#1
Thread Starter
PowerPoster
[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.
-
Nov 2nd, 2020, 08:13 PM
#2
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.
-
Nov 3rd, 2020, 04:15 AM
#3
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.
-
Nov 3rd, 2020, 06:49 AM
#4
Thread Starter
PowerPoster
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.
-
Nov 4th, 2020, 02:25 AM
#5
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.
-
Nov 4th, 2020, 07:09 AM
#6
Thread Starter
PowerPoster
Re: [RESOLVED] Why can't I find this file ?
Originally Posted by digitalShaman
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.
-
Nov 4th, 2020, 08:48 AM
#7
Re: [RESOLVED] Why can't I find this file ?
Originally Posted by digitalShaman
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|