Wednesday 30 July 2008

Windows Side-by-Side Assemblies

What are WinSxS assemblies? You will find them in the C:\Windows\winsxs folder in Vista/XP. This folder is also known as the "native assembly cache".

My Vista install has over 6000 SxS assemblies (ranging from WinHTTP control to GDI+). According to MSDN, these assemblies are typically single DLLs described by a manifest (although an assemly can also bunch together DLLs, Windows classes, COM servers etc). The manifest describes the assembly AND its dependencies. I also have an XP PC which has only 1400 SxS assemblies.

From XP onwards, applications can use multiple versions of a single SxS assembly.

But what is the point of an SxS assembly?

An SxS assembly is effectively a DLL - a DLL with metadata described by a manifest - that is used by the Operating System as (to quote MSDN) "a fundamental unit of naming, binding, versioning, deployment, and configuration".

This MSDN page provides a flavour of the kinds of side-by-side assemblies that are out there.

I would define an SxS assembly as "an operating system DLL with dynamic version control". So at run-time a running program can use multiple versions of the same DLL simultaneously.

Paraphrasing, SxS assembly is a way of versioning DLLs, hosting multiple versions on the same system i.e. same machine and OS, and with versioning of course comes deployment, how do we deploy different versions of DLL on the same system, and how does our software know which version to use? It's a core part of the Windows platform.

Tuesday 29 July 2008

Embedded Scripting in Windows Applications

There's a whole host of embedded scripting technologies in commercial Windows products.
It will be interesting to see how they evolve, especially in the move from VBA to VB.NET.

MULTIAPPLICATION PROPRIETARY SCRIPTING
VB.NET
Visual Studio

VBA (of course, you can also use COM to control these applications via VB.NET)
MS Office

SINGLE APPLICATION PROPRIETARY SCRIPTING
VisualLisp
Used to automate AutoCAD

PerfectScript
WordPerfect (also supports VBA)
Here are some examples of PerfectScript macros (you will see they are a lot like batch files).

OPEN SCRIPTING
Lua - Promixis (based in Santa Barbara, CA) have a product called Girder (home automation software, control lighting, projectors etc) which uses embedded Lua scripting (smaller memory footprint than Python).
Python - Used in OpenOffice (although this is perhaps used more on Linux)

We'll keep tracking the evolution of Windows automation on this page.

Inside the MSI File Format

How do Microsoft Windows installer (.msi) files actually work?

msi files began life in 1995 as a Microsoft project codenamed "Darwin" (note: Darwin is also the name for the X-Box 360's motion controller developed by Motus Games - not related!!!). What advantages do .msi files have over simple xcopy?

The key idea behind msi/Darwin is application installation as a transaction.

.msi files are essentially structure storage files and are best analysed using orca.exe. This is part of WinInstaller SDK but some websites will let you grab the individual file.

Sunday 27 July 2008

What's on my C: drive in VISTA??!!

C:\>dir grep -v DIR

gives a listing of all the files (extensions: bat, log, sts, exe, iss (InstallShield Silent Response file), ini, txt).

The exe is junction.exe from sysinternals, a "Windows junction creator and reparse point viewer". A junction is a directory symlink in Windows, aka NTFS "junction". Reparse points are the means by which Windows symlinks are implemented.

If you do dir/a you will see all the JUNCTIONs as well as DIRs!! In my system, C:\Documents and Settings is a JUNCTION pointing to C:\Users.

Saturday 26 July 2008

DNS flaw discovered

Dan Kaminsky, a researcher with IOActive discovered a bug in DNS which allows hackers to conduct "DNS cache poisoning".

Read more on Dan's blog here.

Internet Time Synchronization in Vista

After Vista synchronised my time settings from time.windows.com (which points to pool.ntp.org) my time zone changed!!! Reset by right-clicking on the clock in the bottom right hand corner, and clicking "Adjust date time".

Friday 25 July 2008

Purify/Quanity - The Rational Story - But How Rational is Rational?

Rational is a software division of IBM that makes the Purify and Quantify products. Their products are built around the concept of Rational Unified Process (TM). Rational was founded by Paul Levy and Mike Devlin in 1981 and sold to IBM in February 2003, for $2.1 billion. On announcement of the deal, IBM SVP Steve Mills remarked: "Rational is an important element of our e-business on-demand initiative...a perfect complement to our existing four brands - WebSphere, DB2, Lotus and Tivoli."

Products Rational is known for:
  • Purify
  • Quanitfy
  • Rational Rose
  • Pure coverage

Read more from their library below.

http://www.ibm.com/developerworks/rational/library/298.html

Thursday 24 July 2008

Implementation of WPF

WPF code is rendered via MIL (Media Integration Layer). Calls in the MIL can be seen using depends.exe (dependencywalker.com), on milcore.dll (which interfaces with DirectX, latest version DX10 comes with Vista).

XAML is a very good innovation from Microsoft. They previously started separating interface logic from presentation layer using partial classes but turning the presentation layer into XML is another step forward.

.NET 3.5 doesn't provide tools for automatic XAMLification of old-school C# code. It upgrades Windows Forms source files but sticks to the Windows Forms way of doing things.

PDC 2008 in October in Los Angeles

The Microsoft PDC was where Avalon (WPF) was first announced in 2003. This year it's taking place at the LA Convention Center and will cover multi-core programming on Windows, Silverlight (MS version of Flash) and Charles Petzold presenting WPF and XAML. They will also cover F# and MS Cloud platform.

Find out more about F# here:
http://research.microsoft.com/fsharp/fsharp.aspx

Sunday 20 July 2008

Recursive Directory Listing

If you look at Java packages, you have a lot of nested directory structures. You need to be able to see subdirectory content and structure quickly.

Windows: dir /S [dirname]
Unix: ls -R [dirname]

The concept of "recursive flags" doesn't map directly to Windows programs.

Eclipse Ganymede Released

The Eclipse Project marches on with releases named after the satellites of Jupiter (IO, Europa, Ganymede, Callisto). The latest release has 18 million lines of code. It runs pretty fast with 2MB RAM.

1) Keyboard Shortcuts
The tricky thing initially (if you are used to MSVC) is to get used to a new set of keyboard shortcuts. Here is a quick summary to get started fast:

Cntrl-H search the workspace
Cntrl-F11 run
Simple F11 debug

When you debug (F11) it opens debug perspective.

F5 Step into (five-in)
F6 Step over (six-over)

The debug window at the top of the screen shows you which thread you are running in and which java runtime you are using.

2) Customizing the Editor
Alt-WP gives you the Window Preferences from where you can set line numbers. (General->Editors->Text editors, Show line numbers). Line numbers can be quite ugly but useful when debugging.

Saturday 19 July 2008

Windows Media Ad-Popups

Problem: Windows Media pops up every so often to display ads :-(. Go to IE, hit Alt-TPP and set the filter level to High.

It does mean you will need to explicitly allow pop-ups from sites like blogger.com.

Sunday 13 July 2008

Prevent Truncation of Page Borders when Printing

Format->Borders and Shading->Page Border->Options. Change "Measure from edge of page" to "Measure from text".

Text Box versus Frames in Microsoft Word

Both text boxes and frames are flexible containers for text; flexible in the sense you can reposition them and resize them. Frames historically were used when you wanted to wrap text around a graphic. These days you will probably use text boxes more often than frames. Use frames in special cases if you need to insert comments, footnotes, endnotes or fields like AUTONUM.  Text boxes can be converted to frames by clicking Format->Text Box->Convert Text Box to Frame (Alt-OOF).

Friday 11 July 2008

WZC Hijack in XP

XP comes with a feature called "Wireless Zero Configuration" which provides automatic configuration for wireless adapters. I recently installed a new broadband service which came with a management utility that hijacks the WZC facility, making it very difficult to detect and configure new wireless connections. Consequently when you travel and move to a wireless network using different WEP keys the new network is not detected. To fix this go to control panel -> network connections. Right click on "Wireless Network connection" to see Properties, then the Wireless Networks tab and activate the checkbox "Use Windows to configure my wireless network settings". This will allow you to view all wireless networks and set WEP keys.

Friday 4 July 2008

Control Windows Services

Sometimes you install a new program and it adds new services to Windows on startup. msconfig is great for configuring these services, but it doesn't let you interact (stop/start) services in an obvious way. To do that you need Control Panel->Administrative Tools->Services.

To make this function easily accessible (annoyingly it is even possible to configure Windows to hide Administrative tools) we should make a batch file and stick in a directory on our path, such as c:\bin. Here is s1.bat:

start C:\WINDOWS\system32\services.msc

Now we can use the command s1 to access services and start and stop them as appropriate.

If you are at all curious on what the default services are, such as Background Intelligent Transfer Service and IPSEC service, you may want to take a gander at The Overclockers Club.

Thursday 3 July 2008

Classic Mode Performance Advantages for XP

Switching to Windows Classic Mode in WinXP results in less intense graphics than the default display mode. To get the full benefits you need to change settings in two places:

1. Control Panel -> Taskbar and StartMenu -> Classic Start Menu
2. Control Panel -> Display -> Themes -> Windows Classic

Windows the way it used to be. Faster.

Windows Virtual Memory Paging File

When your system gets low on virtual memory (for example when you start running antivirus software), Windows will automatically try to increase the size of your virtual memory paging file. The idea is to supplement the physical RAM available to the system with "virtual RAM". The size of this virtual RAM is set by Windows to be 1.5 times physical RAM. Accessing the paging file makes more memory available but slows the system down due to disk accesses. It used to be possible, and often necessary, to expand virtual memory using 3.5 inch disks on Windows. You can't really do this trick with CD-RW or DVD-RW, which have much shorter rewrite cycles than all previous storage media.