Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Windows cannot find file
#1
Why does Windows raise the following error "Windows cannot find 'c:\windows\system32\msconfig.exe'. Make sure that you typed the name correctly, and then try again.", if I try to run this program from its orginal location. But when I copy the exe file to another location no problems occur, e.g.
run "d:\desktop\msconfig.exe" "" "" "" 0x10000

Thanks in advance.

My OS: Windows 7 64-bit Ultimate
Version Quick Macros: 2.3.3.7
#2
Windows redirects 32-bit apps to the SysWOW64 folder. It is the 32-bit system folder version. But msconfig.exe is only in the 64-bit folder (system32).

Temporarily disable redirection: Run programs from 64-bit system folder (disable redirection)
#3
Thanks for clarifying. Downloaded your example and it worked after I added a 0x10000 flag to the run function.
I wish there was a more elegant solution to this 32/64 nuisance. Maybe someday a 64-bit QM? :wink:
#4
64 bit QM only when Windows will not run 32-bit apps.

The problem with run is that it may use other thread in other process to launch the app. Then redirection is not disabled in that thread.
run uses same thread when need to launch the app with same integrity level (IL) as QM. These levels are User/uiAccess/Admin. Else uses other process.
Maybe in next QM run will have a "disable redirection" flag. Then it will always work.
#5
Flag 0x30000 probably will be more reliable than 0x10000.
#6
Thanks for the advice. I still believe this whole redirection stuff is quite annoying (not your fault). Even the simplest menu's can be hard to make.
E.g. I have a main shortcut menu as a container for (expandable) sub-menu's. Each sub-menu contains a lot of run commands in menu form.
Amongst them msconfig.exe as we discussed earlier.
Trying to be smart (yeah, I know, my first mistake) I encapsulated the menu with your redirection solution.
Macro Macro
Code:
Copy      Help
#compile "____Wow64DisableWow64FsRedirection" ;;command 1
__Wow64DisableWow64FsRedirection x.DisableRedirection ;;command 2
Templatemenu "MenuMain" ;;command 3
x.Revert ;;command 4
Of course, that didn't work.
Than I put your solution in a single line, commands separated by semicolons.
Macro Macro
Code:
Copy      Help
System Configuration :<command1>;<command2>;<command3>;<command4>
That didn't work either. Created a little macro "msconfig" with the above commands:
Macro Macro
Code:
Copy      Help
System Configuration :mac "msconfig"
That worked! But to give it a nice icon I failed again.
Macro Macro
Code:
Copy      Help
System Configuration :mac "msconfig" * $system$\msconfig.exe,0
Of course for the same reasons described earlier. (Btw it is not possible to add comments behind that line, so
Macro Macro
Code:
Copy      Help
System Configuration :mac "msconfig" * $system$\msconfig.exe,0 ;;Some comments
doesn't work.)
Nevertheless, I appreciate you are trying to make QM more 64-bit friendly. Smile
#7
Function RunSystem64BitApp
Code:
Copy      Help
;/
function $file_ [$par] [$verb] [$dir_] [flags]

;Runs a program or other file in system32 folder on 64-bit Windows.
;The same as <help>run</help>, but temporarily disables redirection to the 32-bit folder SysWOW64.
;On 32-bit Windows also works.

;Everything is same as with run(), except:
;;;1. The program will run with same integrity level (Admin/uiAccess/User) as current process (QM or exe). Ignores flags 0x10000 and 0x20000.
;;;2. Does not have window_ and hwnd parameters.


#compile "____Wow64DisableWow64FsRedirection"
__Wow64DisableWow64FsRedirection x.DisableRedirection

run file_ par verb dir_ flags|0x30000
err end _error

Menu RunSystem64BitApp in menu
Code:
Copy      Help
msconfig :RunSystem64BitApp "$system$\msconfig.exe" * $my qm$\msconfig_exe.ico
;QM also cannot extract icons from files in the 64-bit system folder.
;In QM Icons dialog you can capture icon image of the program that is displayed in Windows Explorer. Drag the small icon preview rectangle in the icon editor. Save as icon file and use it in menu.

Quote:Btw it is not possible to add comments behind that line
Add comments before *.
#8
This is better.

Create symbolic link to system32 somewhere, and run files through it. Then file system redirection is not applied.

This macro creates symbolic link system64 on desktop. QM must be admin.

Macro Macro1676
Code:
Copy      Help
CreateSymLink "$desktop$\system64" "$system$" 1

The function is somewhere in forum and archive.qml, and here it is again:
Function CreateSymLink
Code:
Copy      Help
;/
function $symlink $target [flags] ;;flags: 1 folder

;Creates symbolic link.
;Error if fails.
;If symlink exists and is not folder, deletes.
;Symbolic links are supported on Vista and later.


dll- kernel32 !CreateSymbolicLinkW @*lpSymlinkFileName @*lpTargetFileName dwFlags
str s1.expandpath(symlink)
if(dir(symlink)) del symlink; err
str s2.expandpath(target)
if(!CreateSymbolicLinkW(@s1 @s2 flags)) end _s.dllerror
SHChangeNotify SHCNE_CREATE SHCNF_PATHW +@s1 0

menu example
Menu Menu38
Code:
Copy      Help
msconfig :run "$desktop$\system64\msconfig.exe"

You see folder path as "$desktop$\system64", but actually it is "c:\windows\system32".


Forum Jump:


Users browsing this thread: 1 Guest(s)