Old 6th February 2006, 03:03   #1
guido666
Junior Member
 
Join Date: Dec 2003
Location: Ashland
Posts: 6
Send a message via ICQ to guido666 Send a message via AIM to guido666 Send a message via Yahoo to guido666
Unhappy WinXP x64 redirects system32 files to WOW64 directory

I have tried these three different commands to write a file to the C:/Windows/System32/ directory under WinXP x64.

InstallDir "C:\windows\system32" ; Won't work with 9x
InstallDir "$WINDIR\system32" ; Won't work with 9x
InstallDir "$SYSDIR"

Every single time it will write the file to the C:\Windows\WOW64\ directory (only on x64 machines, not XP/2003/9x).

I figure it is a self protection measure by Windows x64 to keep 32-bit software from mingling with the 64-bit software.

I'm trying to make a program that installs the system OEM info, in the system properties box. This costists of two files, "oeminfo.ini" and "oemlogo.bmp", and they must be placed in the system directory (C:\Windows\System\ on 9x, and C:\Windows\System32\ on XP\2000\2003\x64).

Any help or ideas how to circumvent this?
guido666 is offline   Reply With Quote
Old 6th February 2006, 03:15   #2
guido666
Junior Member
 
Join Date: Dec 2003
Location: Ashland
Posts: 6
Send a message via ICQ to guido666 Send a message via AIM to guido666 Send a message via Yahoo to guido666
Some more info from Microsoft's site:
http://www.microsoft.com/windowsxp/u...el_x64faq.mspx

Q.
What is the SysWOW64 directory?
A.
The \Windows\SysWOW64 directory is where 32-bit system files are installed. 64-bit system files are in the \Windows\system32 directory for compatibility reasons.

Q.
Why do some of my programs install into the Program Files Directory, and others into the Program Files (X86) directory?
A.
Windows XP Professional x64 Edition redirects the \Program Files directory for all programs that are 32-bit during the installation to the \Program Files(x86) directory. Programs that 64-bit are installed into the \Program Files directory.

More here too:
http://www.sysinternals.com/blog/200...t-windows.html

Windows 2003 SDK API to turn redirect off:
http://msdn.microsoft.com/library/de...edirection.asp

Last edited by guido666; 6th February 2006 at 03:47.
guido666 is offline   Reply With Quote
Old 7th February 2006, 17:38   #3
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
You can call Wow64DisableWow64FsRedirection using the System plug-in:
code:
System::Call "kernel32::Wow64DisableWow64FsRedirection(*i)"

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 7th February 2006, 17:43   #4
guido666
Junior Member
 
Join Date: Dec 2003
Location: Ashland
Posts: 6
Send a message via ICQ to guido666 Send a message via AIM to guido666 Send a message via Yahoo to guido666
Cool, so do I just call that, then call the enable function again to put it back?
guido666 is offline   Reply With Quote
Old 7th February 2006, 17:50   #5
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Yes, that should work. Just make sure you call it before $SYSDIR is actually parsed. In InstallDir's case, that's impossible. InstallDir is parsed before any of your code is executed. You'd have to call this in .onInit, copy $SYSDIR into $INSTDIR (using StrCpy) and then call the enable function.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 17th July 2006, 17:56   #6
vbguy
Junior Member
 
Join Date: Jul 2006
Posts: 30
Quote:
Originally posted by guido666
Cool, so do I just call that, then call the enable function again to put it back?
Actually, unless you want your installer to redirect again there is no need to enable redirection again.

From MSDN documentation:

Quote:
The Wow64DisableWow64FsRedirection function disables file system redirection for the calling thread.
So, disabling redirection in your installer doesn't disable redirection system wide.
vbguy is offline   Reply With Quote
Old 6th October 2008, 21:29   #7
landaquinn
Junior Member
 
Join Date: May 2008
Posts: 7
This is not working for me, using System::Call "kernel32::Wow64DisableWow64FsRedirection(*i)"
Is there any way to get a return value from this instruction? documentation says the function returns a bool. Is there a way to tell if there is an error in the syntax?
landaquinn is offline   Reply With Quote
Old 10th October 2008, 16:25   #8
landaquinn
Junior Member
 
Join Date: May 2008
Posts: 7
I got it working, i don't know what stupid thing I must have been doing before. It also works with simply:

System::call "kernel32::Wow64DisableWow64FsRedirection()"
landaquinn is offline   Reply With Quote
Old 11th October 2008, 12:01   #9
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
You can also use the macros in x64.nsh, which is included with the current NSIS releases.
Joost Verburg is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump