Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Emulate 32-Bit OS On 64-Bit Windows: System32 Is The Name of The Folder That Contains Important Operating System Files

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Trong windowns 64bit.

Không có file system64 mà chỉ có system32 + wow64 (windows on


windows64)

System32 is the name of the folder that contains important operating system files.
Early versions of 64-bit Windows XP only ran 64-bit applications. This made sense:

 you run 16-bit applications on 16-bit Windows


 you run 32-bit applications on 32-bit Windows
 you run 64-bit applications on 64-bit Windows
And early versions of 64-bit Windows XP were 64-bit, and only supported running 64-bit
applications.

And since all the folders names stay the same, you can simply recompile your application
as 64-bit (and not have to change anything else - including your accidentally hard-coded
paths), and it will just work.
Emulate 32-bit OS on 64-bit Windows
Very quickly it became obvious that only being able to run 64-bit applications on 64-bit
Windows, would prevent some people from upgrading to 64-bit Windows. So an emulation
layer was created to allow you to run 32-bit applications on a 64-bit operating system.
It was called WOW64: Windows on Windows64:
 This emulation layer simulates the x86 architecture, virtualizing the CPU, the file system, the
registry, the environment variables, the system information functions, all that stuff.
 If a 32-bit program tries to look at the system, it will see a 32-bit system.
 For example, if the program calls the GetSystemInfo function to see what processor is
running, it will be told that it's running on a 32-bit processor, with a 32-bit address space, in a
world with a 32-bit sky and 32-bit birds in the 32-bit trees.
 And that's the point of the emulation: To keep the 32-bit program happy by simulating a 32-
bit execution environment.
The problem is where should these 32-bit applications store all their 32-bit files, and
configure the locations of their 32-bit DLLs, and load 32-bit operating system support files?

We already know where native applications store their stuff.


| Native Application |
|---------------------|
| C:\Windows\System32 |
| C:\Program Files |
| HKCU\Software |
This is all correct and right; if you simply recompile your 32-bit application as 64-bit:
everything works. All these locations are still correct.

32-bit in a 64-bit world


But now since we're going to bend-over backwards in order to accomdoate non-64 bit
applications, we have to find someplace for them to have their old 32-bit OS files, and store
their 32-bit data, and have their 32-bit programs, with 32-bit shared components:

| Native Application | Emulated 32-bit |


|---------------------|---------------------------|
| C:\Windows\System32 | C:\Windows\SysWOW64 |
| C:\Program Files | C:\Program Files (x86) |
| HKCU\Software | HKCU\Software\Wow6432Node |
A problem is that:

 if a 64-bit program asks for C:\Windows\System32, it damn well better get 64-bit files


 if a 32-bit program asks for C:\Windows\System32, it damn well better get 32-bit files
This means that if a 32-bit process ask for some of these file locations, Windows has to
transparently redirect the call to the 32-bit folders and registry keys.
If a 32-bit program, that thinks it's running on an old 32-bit operating system, asks for a 32-
bit location, it needs to be given the "real" location:
| Native Application | Emulated 32-bit asks for | Is actually given |
|---------------------|---------------------------|---------------------------|
| C:\Windows\System32 | C:\Windows\System32 | C:\Windows\SysWOW64 |
| C:\Program Files | C:\Program Files | C:\Program Files (x86) |
| HKCU\Software | HKCU\Software | HKCU\Software\Wow6432Node |
If you don't want your 32-bit application to be subject to all this emulation and thunking, then
the solution is obvious:

 create a 64-bit application for a 64-bit operating system


Stop creating a 32-bit application, and then complaining when the emulation layer causes
you to go through emulation. Your application is the misbehaving oddball; fix it.

What Is System32?
RELATED: What Are DLL Files, and Why Is One Missing From My PC?

The System32 directory contains Windows system files, both .DLL library files used by
programs and .EXE program utilities which are a part of Windows. While most of the
files you find in here are part of the Windows operating system, third-party software
programs sometimes install their own DLL files to this folder as well.

Applications running on your system may be installed in your Program Files folder or
elsewhere, but they often load system-wide libraries from the System32 folder.

Separating 32-bit and 64-bit Libraries

RELATED: What's the Difference Between the "Program Files (x86)" and


"Program Files" Folders in Windows?

On a 64-bit version of Windows, you have a C:\Program Files folder containing 64-bit
programs and their files, and a C:\Program Files (x86) folder containing 32-bit programs
and their files. It’s helpful for these files to be separated because 64-bit programs need
64-bit DLL files, and 32-bit programs need 32-bit DLL files.

If a 32-bit program goes to load a DLL file it needs, finds a 64-bit version, and tries to
load it, it will crash. By separating 64-bit and 32-bit software into two different Program
Files folders, Windows ensures that they won’t get mixed up and caused problems.

However, not all DLL files are stored in Program Files. Many system-wide libraries
included with Windows are stored in C:\System32, and some programs also dump their
own library files here. So, just as Windows has separate 32-bit and 64-bit Program Files
folders, it also has separate 32-bit and 64-bit versions of the System32 folder.

System32 and SysWOW64


On a 32-bit computer, all 32-bit programs store their files in C:\Program Files, and the
system-wide library location is C:\System32.

On a 64-bit computer, 64-bit programs store their files in C:\Program Files, and the
system-wide C:\Windows\System32 folder contains 64-bit libraries. 32-bit programs
store their files in C:\Program Files (x86), and the system-wide folder is
C:\Windows\SysWOW64.

This is definitely counterintuitive. Despite the “32” in the name, the System32 folder
contains 64-bit libraries. And, despite the 64 in the name, the SysWOW64 folder
contains 32-bit libraries—at least on 64-bit versions of Windows.

In general, you won’t need to know this. The Windows operating system and programs
you use automatically place their files in the correct location and use the correct folder.
However, if you ever need to manually install a DLL file in the correct location or find
where one is installed—which is very rare—you’ll need to know which is which.

WOW64, Explained

RELATED: Why Are Most Programs Still 32-bit on a 64-bit Version of Windows?

The “WOW64” part of the name here refers to Microsoft’s “Windows 32-bit on Windows
64-bit” software, which is a part of the operating system. This allows Windows to run 32-
bit programs on a 64-bit version of Windows. WoW64 redirects file access to ensure
programs will work properly.
For example, if you install a 32-bit program on a 64-bit version of Windows and it tries to
write to the C:\Program Files folder, WoW64 points it at C:\Program Files (x86). And, if it
wants to access the C:\Windows\System32 folder, WoW64 points it at
C:\Windows\SysWOW64. Windows does this using a file system redirector.

This all happens automatically and transparently in the background. The program
doesn’t even have to know it’s running on a 64-bit operating system, which allows older
32-bit programs to run without modification on 64-bit versions of Windows. WOW64 also
redirects registry access, ensuring there are separate areas of the registry for 64-bit and
32-bit programs.

So Why Is System32 64-bit, and SysWOW64 32-


bit?
All that brings us back to the million-dollar question: Why is the “System32” folder 64-bit,
and SysWOW64 32-bit?

The answer seems to be that many 32-bit applications were hardcoded to use the
C:\Windows\System32 directory. When developers recompiled these applications for
64-bit versions of Windows, they continued to use the C:\Windows\System32 directory.

Rather than renaming the directory and forcing developers to move to the new one,
breaking many applications in the process, Microsoft left “System32” as the standard
system library directory. They created a new library directory for applications running
under the WoW64 layer, which they named “SysWOW64”. When you think about it this
way, the name makes more sense.

Yes, it is a bit silly that a directory with “32” in the name is now 64-bit. Perhaps Microsoft
should have seen that coming when they named it C:\Windows\System32 in the 90’s.
But, although a more straightforward naming scheme would be nice, it’s not worth
breaking a bunch of programs and creating more work for developers just to get there.
That means we’re stuck with System32 and SysWOW64 for the foreseeable future.

You might also like