Find the Windows Installation Date

Launch a new Command prompt (Start > Run, cmd) and type systeminfo.  Wait for a bit, and eventually it'll spit out a slew of useful information.  You're looking for about the 10th line from the top, Original Install Date.

C:\>systeminfo

Host Name:                 xxxx
OS Name:                   Microsoftr Windows VistaT Enterprise
OS Version:                6.0.6001 Service Pack 1 Build 6001
OS Manufacturer:           Microsoft Corporation
OS Configuration:          Standalone Workstation
OS Build Type:             Multiprocessor Free
Registered Owner:          xxxxx
Registered Organization:
Product ID:                xxxxxx-xxx-xxxxxxx-xxxxxx
Original Install Date:     11/9/2008, 9:00:50 PM

It actually does say "Microsoftr" and "VistaT", because obviously a random "r" or "T" tacked onto a word is just as clear as (r) or (TM).

Windows drags like crap

Vista - Dragging

Vista - Dragging

I'm cheery if you can't tell.  This is something I mean to write about a while ago, but never got around to.  If you've got Show window contents while dragging enabled on Windows (tested on XP and Vista) and try to select and drag a group of icons more than 5 icons tall, the ghosted icons fade into nothingness.  It really is a pain when you're dragging a large number of icons and the 'hidden' icons end up moving icons at your target destination.

You know what doesn't have the same problem? OS X.

OS X - Drag and Drop

OS X - Drag and Drop

Symbolic links on Windows

One of the most useful things you'll find on any Linux/UNIX variant is the ability to create symbolic links. Rather than copying a file or directory you can create a pointer to it. It's very similar to a Shortcut in Windows, but much more powerful because a symlink behaves like a normal file.

Shortcuts vs links

For example, assume you use a program that will only store it's files in C:\MUSIC. If you wanted to move the MUSIC directory to a different drive, you couldn't. If you create a shortcut called MUSIC on the C:\ drive to D:\MUSIC that won't work because the shortcut is actually a file called "MUSIC.lnk"

You could create a symbolic link from C:\MUSIC to D:\MUSIC and the program would function as expected, allowing you to move the MUSIC directory to a new drive.

Symlinks on Windows

Support for symbolic links on Windows is all over the board. Out of the box on Windows 2000 and XP you can only create links to files, and you need a separate program for linking to directories. Vista provides a new utility, but you still need to specify if you are linking to a directory or file.

fsutil

fsutil is available on Windows 2000, XP and Vista. There's actually quite a bit you can do with it, but for creating links the syntax is:

fsutil hardlink create new_filename existing_filename

If you wanted to create a link to c:\secret\passwords.txt on your desktop you'd run the following command

fsutil hardlink create %userprofiledir%\desktop\passwords.txt c:\secret\passwords.txt

You must provide the filename of the link.

Junction

Junction was created Mark Russinovich, and allows you to create links (actually junctions) to directories. It runs on Win2k, XP and Vista. To create a junction the syntax is:

junction junction directory junction target

So to create a link (junction) to c:\lodo_conversations\ on your desktop you would run:

junction %userprofile%\desktop\lodo_conversations\ c:\lodo_conversations\

junction.exe must be in your PATH and you must provide the name of the link.

To delete a junction:

junction -d %userprofile%\desktop\lodo_conversations\

mklink

mklink was introduced with Vista and allows you to create links to both directories and files, with a switch.

To link to c:\lodo_conversations\ on your desktop you would run:

mklink /d %userprofile%\desktop\lodo_conversations\ c:\lodo_conversations\

To remove that link

rmdir %userprofile%\desktop\lodo_conversations\

To create a link to c:\secret\passwords.txt on your desktop you'd run the following command

mklink %userprofiledir%\desktop\passwords.txt c:\secret\passwords.txt

The application failed to initialize properly (0xc0000022).

I started receiving the error The application failed to initialize properly (0xc0000022) on my primary development machine (running Windows XP SP3) whenever I tried to launch select applications (cmd.exe, SecureCRT, runas.exe, mmc.exe, etc).  It had been a while since my last reboot and I had installed a some new programs and the latest Windows Updates, so I assumed it was related to that.

One reboot later and some applications (cmd.exe) would launch, but many others still wouldn't.  A quick Google search showed that this was often related to the permissions being incorrect on some core system DLLs.  No problem, find the DLLs, right click, properties.  And the Security tab was missing.  The most common cause of this is that Simple File Sharing is enabled.  Except it wasn't. I toggled that off/on, and still the Security tab was missing.  Enter CACLS – a command line utility to view/edit file ACLs.

Fixing Windows DLL Permissions

Windows is trying to load a DLL that the application depends on, and something is preventing it.  Given that the Security tab was missing from an Explorer Properties window, my guess would be that a DLL that controls ACLs and permissions had restrictive or corrupted permissions.

The CACLS commands below modify all .dll and .ocx files inside the system32 directory and grant members of the Users group Read access.

  • As an Administrator open a command prompt – Start > Run > cmd
  • Inside the command prompt window type:
    CACLS %systemroot%\System32\*.dll /E /G BUILTIN\Users:R
    And press Enter.  This will take a minute or so and will display a slew of processed file: C:\WINDOWS\System32\blah.dll messages.
  • Then type:
    CACLS %systemroot%\System32\*.ocx /E /G BUILTIN\Users:R
    And press Enter.

After both commands completed I was immediately able to launch all of the previously non-functional applications.

Application DLL Dependencies

Here are the top-level dependencies for some of the applications that were not working properly.

The reason I chose to modify all of the DLLs was pure laziness – SecureCRT has 135 DLLs it depends on, VMware Workstation has 157, cmd.exe has 130.  If you are aiming for precision use the excellent Dependency Walker and load each application.  Copy the DLLs with full paths, remove anything outside of %systemroot%\system32 and then find the common shared DLLs from list.  Use the same CACLS command (CACLS %systemroot%\System32\FILENAME /E /G BUILTIN\Users:R) for each of those files.


© 2007-2010, Corey Gilmore | Posts RSS Feed | Comments RSS Feed | Contact

 

The views expressed on these pages are mine alone and not those of any past or present employer. All information presented on this site was obtained lawfully and not through disclosure under the terms of an NDA.