Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8267943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:42:42+00:00 2026-06-08T05:42:42+00:00

a file is located in C:\program files (x86)\my app\myexe.exe FileExists(‘C:\program files (x86)\my app\myexe.exe’) returns

  • 0

a file is located in C:\program files (x86)\my app\myexe.exe

  1. FileExists(‘C:\program files (x86)\my app\myexe.exe’) returns true;

  2. FileExists(‘C:\program files\my app\myexe.exe’) returns false;
    in both cases, if I use Wow64DisableWow64FsRedirection or not.

Why ? Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T05:42:43+00:00Added an answer on June 8, 2026 at 5:42 am

    File system redirection is only there for the %windir%\system32 directory. The description of the File System Redirector seems to make this obvious.

    Note the comment in the page

    Applications should use the SHGetSpecialFolderPath function to determine the %ProgramFiles% directory name.

    Edit Turns out that the FOLDERID_ProgramFilesx64 does not work on 32bit applications running on 64bit windows. In this case, you can use the environment variable %ProgramW6432% instead. Note that this variable is only available on Windows 7 and later for 32bit applications.

    The following delphi snippet allows accessing the variable:

    function GetEnvironmentString(aString : string) : string;
    var
      dest : string;
      retSize : integer;
    begin
      SetLength(dest, MAX_PATH);
      retSize := ExpandEnvironmentStrings(pchar(aString), pchar(dest), MAX_PATH);
      if retSize > 0 then
          SetLength(dest, retSize - 1);
      result := dest;
    end;
    

    Called as:

    GetEnvironmentString('%ProgramW6432%');
    

    IF you’re on a 64bit version of windows, then a 32bit application cannot use FOLDERID_ProgramFilesX64 to explicitly get the 64bit location of Program Files, but can use the environment variable expansion instead. On a 32bit version of windows, this location is invalid, and will not get you a value. You need to check the bitness of the system before attempting to access this variable.

    You can use the function IsWow64Process to determine this. The following snippet should allow you to check this:

    function IsWow64: Boolean;
    type
      TIsWow64Process = function(Handle: Windows.THandle; var Res: Windows.BOOL): Windows.BOOL; stdcall;
    var
      IsWow64Result: Windows.BOOL;
      IsWow64Process: TIsWow64Process;
    begin
      // Try to load required function from kernel32
      IsWow64Process := Windows.GetProcAddress(Windows.GetModuleHandle('kernel32.dll'), 'IsWow64Process');
      if Assigned(IsWow64Process) then
      begin
        // Function is implemented: call it
        if not IsWow64Process(Windows.GetCurrentProcess, IsWow64Result) then
          raise SysUtils.Exception.Create('IsWow64: bad process handle');
        // Return result of function
        Result := IsWow64Result;
      end
      else
        // Function not implemented: can't be running on Wow64
        Result := False;
    end;
    

    In summary: FOLDERID_ProgramFiles gives you the 32/64 bit variant when accessed from a 32/64 bit program, FOLDERID_ProgramFilesX64 gives you the 64bit version explicitly on a 64-bit application, and FOLDERID_ProgramFilesX86 gives you the 32bit variant explicitly. You can use the environment variable expansion to get the 64bit value on a 32bit application

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program that processes files and returns another file as output. When
I am trying to access a dll located in the c:/Program Files (x86) folder
I have a small C# program to modify a xml file which is located
I am trying to run a batch file. the file is located here: C:\Program
ft2build.h is located here: C:\Program Files\GnuWin32\include Initially, I made the same mistake as here:
Here is my test code below. //This correctly prints C:\Program Files from 64 app
I have a file located at [application]/config/routing.yml, when I change something in there, the
How can I read a text file located in relative path of my site
I am attempting to edit the default file located at .. /etc/apache2/sites-available/default on my
I'm trying to edit the httpd.conf file located in /private/etc/apache2, and I can't figure

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.