I created a program using Visual Studio 2010 IDE. In one part of the program it ask the user if he/she wants to reboot the computer in safemode, thus accessing bcdedit.exe from the System32 in the users file system. The following vb code runs GREAT on runtime. HOWEVER when I package the program using Cameyo, the virtual program cannot find bcdedit.exe. Is this because the isolation mode for the virtual program is in DataMode? Or if I change the isolation on the .exe in the virtual program itself, would that work? I just wanted to check before hand.
Dim process As New System.Diagnostics.Process() Dim startInfo As New System.Diagnostics.ProcessStartInfo() ' startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden
startInfo.FileName = "bcdedit.exe" If System.Environment.OSVersion.Version.Major >= 6 Then ' Windows Vista or higher startInfo.Verb = "runas" Else ' No need to prompt to run as admin End If startInfo.Arguments = "/set {current} safeboot network" process.StartInfo = startInfo process.Start()
We did some checking. This has nothing to do with isolation levels, but rather with Windows 32 / 64 redirection.
Indeed, 32-bit programs do not see the real System32 dir, but only a subset of it. As a demonstration, see attached image: run on your system the 32-bit cmd.exe (c:\windows\syswow64\cmd.exe) and list exe files from c:\windows\system32 -> you will see less files than if you do the same with your default 64-bit cmd.exe. You can do the same test with notepad.exe and syswow64\notepad.exe.
As a solution, you should preferably compile a 64-bit version of your program, or work with explicit 64-bit paths (Sysnative).
Here's some more info: http://stackoverflow.com/questions/13546833/why-the-findfirstfile-findnextfile-does-not-list-the-entire-content-of-the-syste
Well I already found that and I did build my program for a 64-bit Win OS( If installing on 64bit Win OS). I still believe the issue is with Cameyo, so I came up with a test program and then virtualized it with Camyeo to show you.
Program with outcome: I wrote a simple program, that with a click event(button) should open cmd.exe and open in the directory of C:\Windows\System32\ .Then user execute dir b*.exe and should see bcdedit.exe as one of the programs
Code in VB (VB to C#:http://converter.telerik.com/)
Dim process As New System.Diagnostics.Process() Dim startInfo As New System.Diagnostics.ProcessStartInfo() ' startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden
startInfo.FileName = "cmd.exe" If System.Environment.OSVersion.Version.Major >= 6 Then ' Windows Vista or higher startInfo.Verb = "runas" Else ' No need to prompt to run as admin End If
1.) I built the above program for a 64bit OS. Then installed the program. Ran the program. Click the button. Cmd.exe came up (C:\Windows\System32\) . Then executed dir
b*.exe and found bcdedit.exe. (Print Screen Attached) SUCCESSFULLY!
2.) NEXT, I reinstalled the program while virtualizing it with Cameyo. Ran the BootTest.cameyo.exe (not edit). Click the button. Cmd.exe came up(C:\User\test\AppData\Roaming\BootTestSetup1\%Program File%\Default Company Name\BootTestSetup1>)
As you can see the command cmd.exe did not come up with C:\Windows\Sytem32. This is why I believed it was a isolation issue. However after giving the virtualization FULL ACCESS, I found out this was not the case. Next I ran ( CD C:\Windows\System32\) . Then executed dir b*.exe and did NOT find bcdedit.exe. (Print Screen Attached)
So if you could help me find a solution or better understand why this is happening that would be great. If you need anything please let me know.
Thanks!!
-- Edited by bjones7 on Thursday 8th of August 2013 10:04:41 PM
-- Edited by bjones7 on Thursday 8th of August 2013 10:05:26 PM
But what version of cmd.exe and of yoru app is running? 32-bit or 64-bit?
In the Process list in your Task Manager, if you see a '*' next to these processes, it means they're 32-bit.
PS: you can force 64-bit execution of cmd.exe by running c:\windows\sysnative\cmd.exe