Same path – different files

You probably know from DOS / Windows / Linux / Mac OS, that it is impossible to create two files with the same name and extension in the same folder / directory.

Yesterday, I saw a miracle – two programs show the same file differently. One program was PHP interpreter (fread funciton), other FAR Manager.

First reaction – PHP must be mishandling binary data. Quick search – fread is Binary-safe file read… second thought – PHP ord is converting using Windows code page… no bin2hex is giving the same result.

Second reaction – if two programs show this file differently, and as an example I was using .exe file, this must be some virus or worm, that has installed some poorly coded rootkit.

Today, with fresh view on this strange behavior, I started to get picture from memory. PHP is 32-bit program, FAR that I am using is 64-bit. Raymond Chen or someone else from Microsoft has written, that Windows does not allow 32-bit programs access 64-bit dlls, so that must be it.

A little search and – Registry and file redirection (Article ID: 896456):

The WOW64 subsystem isolates 32-bit binaries from 64-bit binaries by redirecting registry calls and some file system calls. The WOW64 subsystem isolates the binaries to prevent a 32-bit binary from accidentally accessing data from a 64-bit binary. For example, a 32-bit binary that runs a .dll file from the %systemroot%\System32 folder might accidentally try to access a 64-bit .dll file that is not compatible with the 32-bit binary. To prevent this, the WOW64 subsystem redirects the access from the %systemroot%\System32 folder to the %systemroot%\SysWOW64 folder. This redirection prevents compatibility errors because it requires the .dll file to be specifically designed to work with 32-bit programs.

My test file path was: C:\Windows\System32\Notepad.exe and 32-bit application accessed redirected version – C:\Windows\SysWOW64\notepad.exe. This is by design in 64-bit world.

P.S. OS version Windows 7 Ultimate 64-bit.

November 2010, links

The Zero One or Infinity (ZOI) rule is a rule of thumb in software design.

Agile programming 10 years on: Did it deliver? from infoworld.com

F# under Apache license.

A look at C# 5.0 vNext – New Asynchronous Pattern by Abhishek Sur.

Clues Suggest Stuxnet Virus Was Built for Subtle Nuclear Sabotage.

The Plastic SCM blog – The version control timeline (CVS, SVN, Git, …)

Comprehensive JavaScript Guide from Mozilla.

Free C# / .NET Profiler with Silverlight support

World is still lacking a good free .NET / C# / VB.NET / F# Profiler. There are plenty of overpriced tools (some very useful, but expensive).

I need simple profiler for one of my free / hobby projects, so I do not want to pay a premium.

First I tried to download open source project called Prof-It for C#. I was unable to profile anything. Why this is so complicated?

Second, also open source, called slimtune. They say it support .NET 2.0, but I was able to profile .NET 3.5 w/o problems. However no luck with Silverlight.

Third, I download free version of EQATEC profiler. They ask for your name and email address (I HATE TO GIVE MY EMAIL). In lack of options, I surrender my email address. Also, it says, that there is limit of “how many DLLs…”. I didn’t get, what this limit is about, perhaps need to use it a little more, but currently I already got profiling details I needed. The good news is, that EQATEC can profile Silverlight applications with a few easy clicks.

P.S. if you are looking for native C++ profiler, read about Very Sleepy.