Announcement

Collapse
No announcement yet.

WinXP x64 redirects system32 files to WOW64 directory

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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?

  • #2
    Some more info from Microsoft's site:


    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:


    Windows 2003 SDK API to turn redirect off:
    Last edited by guido666; 6 February 2006, 03:47.

    Comment


    • #3
      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

      Comment


      • #4
        Cool, so do I just call that, then call the enable function again to put it back?

        Comment


        • #5
          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

          Comment


          • #6
            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:

            The Wow64DisableWow64FsRedirection function disables file system redirection for the calling thread.
            So, disabling redirection in your installer doesn't disable redirection system wide.

            Comment


            • #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?

              Comment


              • #8
                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()"

                Comment


                • #9
                  You can also use the macros in x64.nsh, which is included with the current NSIS releases.

                  Comment

                  Working...
                  X