183 points · by taude · 13y ago · 125 comments
"Program Files" and "Documents and Settings" have spaces to force software to support spaces in paths.
system32 for the Win32 version of system makes perfect sense. 64-bit Windows continues to use the Win32 API, and renaming system32 would have broken compatibility with dumb programs that hardcoded the name. SysWOW64 is the system32 directory for Windows 32-bit on Windows 64-bit. WOW64 is perhaps an overly cutesy name, but it's actually fairly descriptive.
And yet the platform where it's hardest to support spaces in paths is... windows!
On UNIX the process-creation API (execve) explicitly takes an array of arguments. There really aren't any special characters as far as the API is concerned (except \0): what you pass to execve will be the same as what the new process sees in main()
In windows, CreateProcessW() just is given a command line with space-separated argument names. Then the CRT in the new process will split that back up before main() is called. To be sure to get the arguments you want in main() you need to carefully quote the parameter you pass to CreateProcess using the exact rules that the CRT will use to unquote them -- in my experience this wasn't well documented, either.
Worse, since that splitting is the responsibility of the new process, programs can skip the CRT and do it themselves. If they don't follow exactly the same rules the CRT does things break if you try to send an argument with an escaped metacharacter.
HN should too, :p. Put it in http://eeemo.net/ to see what I mean.
Yes - OP just posted them. :) (for the record: your explanations, while they may be true, are not much better than the OP's)
Anyway, Unix naming scheme is also pretty unintuitive so I guess it's a hard problem.
"compatible with dumb" makes short-term business sense, but I'm not sure I'd call it /perfectly/ sensible...
You basically get ranked on how visible your stuff is to management, so you:
1) name your project as patriotically as possible. It's gotta include one of "Windows", "Microsoft", "XML", "COM", ".NET", "Modern" -- preferably all of them multiple times, especially if it has nothing to do with any of them.
2) make sure to stick the name in as many places as possible. A great place is the default filesystem structure, where everyone is bound to come across it.
3) earn bonus points if you can massage it into a de-facto standard (hello, XHR)
With any luck, Microsoft Modern framework for Windows Azure .NET connectivity with Windows Azure 8.1 will show up on your reviewer's radar and you can enjoy your juicy bonus until the same time next year.
Source: used to work there
P.S. I'm not a Microsoft cynic -- just having a bit of fun :).
("Ballmer's Law" has a nice ring to it..)
/etc isnt called /conf or configuration because it contains examples, scripts and other small stuff as well, which is etcetera.
/var is for variable data like logs and pid files, not meant to be changed by the user directly
/opt sucks and is for losers who dont know about /usr/local or how to install stuff in ~
The Linux way makes much more sense than Windows or MacOSX way. binaries are in bin libraries are in lib, whats not to like?
It did mean "user" originally. Home directories were usually put there.
However, the root filesystem was typically very small. So very early on in UNIXs evolution things that were large and not needed during system boot ended up finding homes in /usr, simply because it was where the bulk of the disk space was. So you got /usr/bin, /usr/dict, ...
Eventually /usr got so full of non-user content, UNIX-based OSes started putting home directories somewhere else entirely (i.e. /home on linux for example) Because the user to home directory mapping was just held in /etc/passwd, it was much easier to move the users than everything else. Later, the "Unix System Resources" backronym was coined.
So mintplant is right: /usr is very much a historic wart on the UNIX filesystem layout.
I disagree. /opt is for systemwide installations of monolithic software by dumb companies that can't fit their software into the standard layout. In the Linux FHS /usr/local/ is supposed to be for non distribution installed software that nonetheless uses the standard layout with /usr/local/{lib,bin,doc} etc. In /opt you usually have something like /opt/somesoftware/ and some non-standard hierarchy underneath.
One would certainly never dream of keeping entire web sites in there!
Doesn't it stand for 'Extended ToolChest' ?
They both use UNIX architecture...
http://lists.busybox.net/pipermail/busybox/2010-December/074...
I guess there are still some fears to try it again, considering that current file systems in mainstream OS' are "good enough".
To me, it's even more funny when you realize "WOW" actually means "Windows on Windows." Say what??
It's NT's syscall translation layer, CPU mode switching backend and entry point front end. It was originally used to run 16-bit apps on 32-bit platforms but is now WOW64 so is to run 32-bit apps on 64-bit machines.
Basically it's a very light weight virtualisation layer.
And it works well. My circa 1996 RPN calculator I wrote in VC++ works perfectly on 2013 x64 machine.
Recently Microsoft went full Keanu with Windows on ARM or WOA -- but eventually they changed that to Windows RT (which might be actually worse).
One could argue that someone who knew Unix 30 years ago could still use command line in today's Linux without much problems.
$ mkdir ".. "
$ ls -a
. .. ..
Fun eh? $ touch ./~
# Much later I noticed the "~" file in the directory
# so I mindlessly decided to cleanup:
$ rm -rf ~
Luckily $HOME was on a _really_ slow NFS mount so I didn't manage to remove anything too important before I killed it.https://isc.sans.edu/diary/Help+eliminate+unquoted+path+vuln...
http://xato.net/hardening/the-programexe-problem/
"The problem is that it doesn't know. It just starts
at the beginning and tries finding an executable until
it finds a match. So in this case, it will try these
files every time you run the command:
C:\Program.exe
C:\Program Files\Internet.exe
C:\Program Files\Internet Explorer\iexplore.exe
"You might see where I'm going with this: if you
place an executable named program.exe in the root
directory, it will probably end up running quite
a bit. In fact, it will run anytime Windows
launches a Program Files executable that does not
have quotes around the path." [1]
[1] http://www.securityfocus.com/columnists/301> Batch files ran programs from C:\Windows\System32 with the expectation that the resulting program would match the native OS. These expectations were not explicit, but they were implied by the nature of the activity. If the System32 directory were filled with 32-bit programs, then a batch file that ran the C:\Windows\System32\REG.EXE program to upset a system registry setting would be running the 32-bit version of REG.EXE, which means that it would be updating the 32-bit simulated version of the registry instead of the real 64-bit version. Other types of scripting files (such as REG files) have the same problem.
http://technet.microsoft.com/en-us/magazine/ff955767.aspx
How did Linux handle this problem?
Why do I need something like that? (I expect some binary compatibility, but we're just opening a can of worms...)
By comparison, most of the configuration files / registry equivalent info in linux are saved in plain text, and AFAIK all of them did not care about the 32/64 bit version of the executables.
in /usr/bin of course
- But it's kinda personal stuff...
so put it in /usr/local/bin
- Oh right, but now I have more stuff that's not really important but still useful
that's what we have /opt for
- but... what if it's optional and only on my machine
oh hell, just create /opt/local/bin and be done with it already!
You can't blame *nix for having too much choice. Especially when it's coherent.
Though, really, I have never seen /opt/local/bin – /usr/bin for package-manager owned stuff, /usr/local/bin for stuff not owned by the package manager and /opt/<Vendor> for weird things…
Why is there a 'WOW' in the middle of the name?
—I was typing System64 and half way through I just thought: "WOW, nature is beautiful!"
But hey, they exist, so someone had the glorious idea to translate these already terrible names into whatever is appropiate for your localized Windows, and create links for stuff like Documents and Settings. Confusion complete.
https://gist.github.com/dchest/800407/raw/48fd662716b7d446e7...
bad name => earlier limit reach
</synergy>
Okay, it's sounds like a fine idea - having multiple DLL versions, allowing applications to link to them. But look, the idea of DLL was to save memory, where two or more applications accessing them would reuse the same hw memory (if they are not relocated). Now maybe on modern PC's that doesn't matter much (although it's still problematic if two MSVCRT libs are used from two different DLLs).
Anyway, but on mobile devices - memory and storage space are important - so make sure all your apps use the same DLL, so you don't lose to storage space, and it's loaded only once (virtually for every process, but due to COW only once in memory).
Have fun, go to Best Buy/Costco/anywhere where they sell the Windows RT/Pro tablets. Go to the command prompt (cmd.exe), c:\windows\winsxs, and type "dir /s" - you can see how much space is wasted there. And this would get even more and more with more updates coming.