Tuesday, February 24, 2009

64bit Windows file redirection

64bit Windows needs to be backward compatible with 32bit Windows world, so the existing 32bit Windows apps can run fine on a 64bit Windows.This is a fair and obvious requirement.

Obviously the system DLLs have to be different for the 32bit and the 64bit apps. As of 32bit windows, the system DLLs were loaded from %windir%\system32 folder (that's why named system32?). But contrary to one's expectation of a %windir%\system64 folder, MS has chosen to use the existing system32 (mind it, it is 32) folder to contain the new 64bit system DLLs (this I believe would have seemed contrary to MS too, but they probably had a architectural constraint that forced them to do so). Ok, so what happens to the 32bit DLLs? this is even more interesting. Unfortunately MS has not renamed the 64bit versions of the existing system DLLs; so the 32bit DLLs cannot be put into the same folder as the 64bit ones (system32); yes, so there is a 64bit version of user32.dll which resides in the system32 folder (you should make sure to remember that system32 is not a 32bit folder and user32.dll does not mean a 32bit DLL -- man this is really ugly). Ok, now that we've no choice, let's get on to the business. The 32bit DLLs reside at %windir%\sysWoW64 folder (did you notice the 64?). WoW64 probably means something like 'Windows on Windows 64', so it kinda make sense once you understand what is wow64 -- but at a first glance and to many, this nomenclature is confusing. You just need to get used to it.

The problem is not over yet. A 32bit application might try to load a system DLL from %windir%\system32 folder but the 32bit DLLs actually reside in sysWoW64 folder -- so yes, MS has implemented a redirector in WOW64 that redirects any file operation on %windir%\system32 by a 32bit application to %windir%\sysWoW64. A file operation by a 64bit application isn't redirected. But what if a 32bit app wants to access the "real" system32 folder -- then it needs access %windir%\sysnative which is a special virtual directory (shall be used only by 32bit apps) which would get mapped to the "real" 64bit system32 folder. To add to the confusion, there are few folders like catroot, drivers\etc, spool etc., which are not redirected to sysWoW64 and are shared by both the 32bit and 64bit applications. A relief here is that, these files can be accessed by both %windir%\system32\x and %windir%\sysnative\x -- this at least allows the applications to use %windir%\sysnative unambiguously.

sigh!!!

4 comments:

  1. whew !!!! sounds like a college guy programming technique :-))

    but all 32bit applications doesn't seems to run on the 64bit windows :-(( obviously an ideal backward compatibility can't be given only by microsoft, even the application developers might have contribute in this..

    WoW64 -- goiyaley microsoft.. WoW-ah..WoW.. adhaa naanga solanumada ;-)


    Sigh!!! this word verification :-(

    (i've been trying to get this comment in for the past 2 days.. because of this word verification)

    ReplyDelete
  2. "obviously an ideal backward compatibility can't be given only by microsoft, even the application developers might have contribute in this" --
    true, that is mostly specific to the nature of the applications. just an e.g: an application which wanted to access the "real" system32 would no longer work. An app change is required.

    Congrats for successfully getting through the word verification :)

    ReplyDelete
  3. Mortgage Loan Software is very important when you are working in a mortgage industry. All the loan officers, mortgage brokers and loan processors need a way to organize and keep track of all their loans in their pipelines.

    ReplyDelete
  4. Hello Everybody,
    My name is Mrs Sharon Sim. I live in Singapore and i am a happy woman today? and i told my self that any lender that rescue my family from our poor situation, i will refer any person that is looking for loan to him, he gave me happiness to me and my family, i was in need of a loan of $250,000.00 to start my life all over as i am a single mother with 3 kids I met this honest and GOD fearing man loan lender that help me with a loan of $250,000.00 SG. Dollar, he is a GOD fearing man, if you are in need of loan and you will pay back the loan please contact him tell him that is Mrs Sharon, that refer you to him. contact Dr Purva Pius, call/whats-App Contact Number +918929509036 via email:(urgentloan22@gmail.com) Thank you.

    ReplyDelete