Thursday, October 30, 2008

Visual Studio 2010

Click here or on the image below for an overview of Visual Studio 2010 and .NET Framework 4.0. I heard rumors that a pre-Beta CTP was externally available for download, perhaps via Microsoft Connect. I'll won't get to use it anyway because my team uses Source Insight. Don't read anything into that though! Visual Studio is the tool of choice for working with .NET and Team System.  The application lifecycle tools in VSTS 2010 look really good!

[11-4-2008: The rumors are true. You can access the CTP on Microsoft Connect.]


Wednesday, October 29, 2008

Windows 7 Public Debut

So Windows 7 had it's first public showing this week at the PDC conference in Los Angeles. Here's an article about it in the Seattle Times. One of the things that strikes me about Windows 7 is how lean it is! MS has trimmed a lot of fat from Vista, removing applications like Contacts and instead making them available as Live downloads. The OS just feels lighter and sleeker, even running with VDI, the whole experience is very responsive. The disk footprint is low and the OS installs faster than expected.

Sidebar has been reworked so you can position gadgets anywhere on the desktop. The task bar has had a major facelift too! Now you can pin running programs and documents so you don't really need the quick launch toolbar. Overall, the interface is more inductive.

UAC is configurable so you can limit the number of elevation prompts when running as an Administrator. The default setting is to only bother you when a program attempts to modify a protected resource but you can adjust this using a sliding scale, similar to Internet Explorer's security tab. This is probably the best improvement on Windows Vista.

However, many of these features are cosmetic and since Windows 7 is still alpha, things will be different in the RTM. But the overall picture will stay the same with improvements to performance,  compatibility, stability and security. It looks really good.

As someone who was hit twice by SLAMMER on XP, I really appreciate the security enhancements in Vista including the phishing  & spyware detection, firewall, resource protection, UAC and session isolation. Windows 7 makes this medicine a lot easier to swallow.

Technorati Tags: ,

Monday, October 27, 2008

Google Android

It was only a matter of time...

Technorati Tags: ,

Session Isolation for Services and Devices

While reviewing a software design specification this morning, I noted that Windows Vista enables session isolation for services and drivers. This is just another way that Vista provides a more secure operating environment than earlier versions of Windows, including Windows Server 2003 and Windows XP. Here is a link to a useful whitepaper if you'd like a high level understanding of how to modify application and driver services to run in Windows Vista.

Prior to Windows Vista, all services would run in the session of the first user who logs onto the machine. The first session is called session 0 and the unfortunate side effect is that applications have ready access to services that are running with elevated permissions. Windows Vista mitigates this security risk by isolating services in session 0 and making this session non-interactive. The first user who logs onto the machine is granted session 1, as shown in the diagram below. Services running in session 0 do not have access to the video driver, so any attempt to render graphics fails. This is one reason why many print services did not initially work in Windows Vista.

Services and applications must communicate using remote protocols, such as RPC, rather than via Windows Messages. However, Windows Vista provides some basic APIs that allow session 0 services to create a message box on a user desktop and to create a process in an interactive session. Obviously, this architecture shift created some compatibility problems for many software vendors but the net affect is a more secure operating environment.


Cyril Voisin has published an excellent article on this subject if you require a deeper understanding.

Friday, October 24, 2008

Windows Vista Service Pack 2

It looks like Microsoft will release a second service pack for Windows Vista before Windows 7 RTM. You can expect SP2 to be very similar in nature to SP1, few or no new features, primarily bug fixes and performance optimizations.

It's confusing because Windows XP Service Pack 2 was such a tremendous change and introduced many new features. You almost expect a second service pack to include more than just bug fixes. In actual fact, XP SP2 included code from the original Longhorn source, so it was practically a major release. Microsoft could have slapped the Energy Blue Theme on the desktop and shipped it as Windows XP2.

However, things have changed within the Windows group at Microsoft. The team is using a revised software development lifecycle with a goal of releasing a new version of both client and server every 2 years. It's certainly working with the group on schedule for Windows 7, so get used to the idea of smaller service packs.

A final word on Internet Explorer 8 - install beta 2 and start using it now. I'm not saying that IT should roll it out with WSUS but it's great for use at home and even the office. Click the screen-shot below and try it out.


Wednesday, October 22, 2008

Ring Buffer

During a recent interview, I was asked an algorithm question about buffering data with circularly linked lists. The problem wasn't especially difficult, just some pointer arithmetic so I won't relay the details here, but I remember wondering about useful applications for cyclic data structures. First-In-First-Out (FIFO) queues are an obvious application, but if a Windows kernel developer is taking the time to ask, there's got to be something behind the question.

So I was reading a design specification the other day for a virtual device driver and stumbled upon the following, written by another Windows developer:

"...the [virtual device provider] and [virtual device client] act as endpoints on a VMBus channel and communicate using upstream and downstream ring buffers."

All of a sudden, a light switched on. Here's what wikipedia has to say about Ring Buffers. Circular data structures are especially useful for streaming data between sockets. In my case, here is the most pertinent point:

"An example that could possibly use an overwriting circular buffer is with multimedia. If the buffer is used as the bounded buffer in the producer-consumer problem then it is probably desired for the producer (e.g., an audio generator) to overwrite old data if the consumer (e.g., the sound card) is unable to momentarily keep up."

The wikipedia article has a POSIX implementation of a ring buffer if you'd like to try it out.

How to Debug VBScript

Windows Script Host (WSH) is the standard scripting environment on all versions of Windows since Windows 98. You can use it to execute scripts written in a variety of languages, JScript, VBScript, Perl, Python - any language that has a compliant WSH engine. WSH will more or less be superceded by PowerShell V2 which will ship with Windows 7 - there's even a cool new Integrated Script Environment (ISE) in the box. However, WSH will still be around for a while and it's a simple solution for working with Windows Management Interface (WMI) so I figure it's worth a mention.

If you're working with VBScript or JScript and running within the Windows Shell , debugging is a piece of cake. Just pass /X on the command line to cscript.exe and WSH will break into the debugger. Make sure you have Visual Studio or similar installed.

cscript.exe /X myScript.vbs

Monday, October 20, 2008

Rebuild the BCD Store

I was testing some different debug settings today with the Windows Boot Manager on my development machine and accidentally set the debug transport provider to a non-existent DLL. This is pretty easy to do when using the BCDEDIT utility on your Windows Vista machine so be warned. Once I restarted my machine, Windows would no longer boot and I couldn't even enter safe mode. My only option was to rebuild the Boot Configuration Data (BCD) after booting from a Windows install disk and entering the recovery environment.

If you find yourself in a similar situation and have corrupted your BCD, the steps to recover your machine are pretty straight forward. First of all, you need a copy of a Windows Vista Install disk. If you can't find one of these, you've got a problem!

  1. Restart your machine, enter the Bios <F2> and make sure you can boot from CD/DVD.
  2. Insert your licensed Windows Vista Install disk
  3. Once Windows Vista boots, choose Repair your computer
  4. Choose Advanced recovery options and click Command Prompt
  5. At the console, enter bootrec /rebuildbcd
  6. Restart your computer

If the rebuild does not succeed in the above, you will need to remove the current BCD before attempting to rebuild. Here's what to do:

bcdedit /export c:\bcd.bak
rename c:\boot\bcd bcd.old
bootrec /rebuildbcd

Good luck! :)

Windows Mobile 6.0 GPS

A few weeks ago, I posted about my HTC TyTN II with Windows Mobile 6 and said that I'd follow up with a review of its GPS capability. I've installed Google Maps for Mobile on the device and I'm really impressed with the available features, however, it's not a useful driving aid. Google Maps for Mobile doesn't have audible directions and my AT&T Tilt doesn't have a dash mount. In short, I'm really glad, I also bought a Garmin Nuvi for GPS navigation while driving.

That said, my Windows Mobile 6 HTC has well and truly exceeded expectations. Even my wife wants one! It's the best way to Skype/IM/Facebook/Email/Call/SMS your friends when you're on the move.

Windows Kernel Debugging

Most Windows developers are familiar with the debugging functionality inside Microsoft Visual Studio and have few troubles stepping through code and using the watch windows. Visual Studio works great for the majority of applications which run in user mode on both local and remote machines. It also supports pure managed debugging,  where all the runtime details are hidden, simplifying debugging for .NET developers. Best of all, you don't need to leave the comfort of your IDE to attach a debugger and locate symbol files.

Microsoft also offers a number of stand-alone debuggers including CBD, NTSD, KD and WINDBG. These debuggers are included in the Windows SDK and you may also download them from the WHDC portal. Most user mode application developers will never want to use these stand alone debuggers because they expose a lot of information through a console interface. However, Visual Studio does not support kernel mode debugging and therefore has limited application for driver developers. This is where the stand-alone debuggers come into play.

If you'd like to learn more about debugging device drivers, the WHDC portal is great place to start. I'm not going to describe the inner workings of any particular debugger. However, I would like to describe how to setup a remote kernel debugging session using Firewire (IEEE 1394 interface) and KD. You can also debug using a serial or USB cable. For more details, I recommend  this MSDN article.

To start off, you will need a Firewire cable and two physical machines with 1394 host controllers. The first machine is your development box which will HOST the KD debugger. The second machine is the TARGET, which will run Windows in debug mode. This article assumes that you are using Windows Vista or later on the HOST machine and Windows Server 2003 or later on the TARGET machine.

  1. Connect the Firewire cable between you HOST and TARGET machines.
  2. Install KD on your HOST machine. Note that there are 64 bit versions of the debuggers.
  3. You also need to install the 1394 debugger driver. The first time you start a KD session over 1394, you will be prompted to install this driver so make sure you run as Administrator.
  4. Open an Administrator console and set the following environment variables:
    set _NT_DEBUG_BUS = 1394
    set _NT_DEBUG_1394_CHANNEL = 44
    REM if TARGET machine is Windows Server 2003 or later
    set _NT_DEBUG_1394_SYMLINK = instance
    REM else if TARGET machine is Windows XP or later
    set _NT_DEBUG_1394_SYMLINK = channel
  5. Change to the debugger install directory and run the following:
  6. Install the 1394 debugger driver if prompted
  7. KD will display a message saying "Waiting to reconnect"

At this point, your HOST machine is ready to go. Now you need to boot your TARGET machine into debug mode. You can do this a couple of different ways; the first using BCDEDIT and the second using MSCONFIG. I'll show you both.

To use BCDEDIT, open an Administrator console on the TARGET machine and type the following commands:

bcdedit /debug on
bcdedit /dbgsettings 1394 channel:44
shutdown -r

To use MSCONFIG, open the start menu and type msconfig in the search/run box. Browse to the Boot tab and choose Advanced Options. Check the Debug box, change the Port to 1394 and set the Channel to 44. Save the changes and reboot the machine.

If everything is configured correctly, you should see the KD session connect when the Windows splash screen is displayed as the TARGET machine reboots. If it doesn't work at first, try reconnecting the Firewire cable and press <ctrl>/<break> in the KD console.


Tuesday, October 14, 2008

Windows Server Directions

So I hope everyone knows that Windows 7 is approaching Beta and if you're lucky enough to participate in the Windows TAP or to attend PDC or WinHEC, you'll get an early glimpse of the new features in this latest release. Everyone else outside MS will have to wait for the public Beta or RTM.

The Windows 7 source is compiled into server and client editions so you can expect to see staged releases for both of these products in the near future. If you'd like a better understanding of where the server edition is heading, I can recommend this excellent whitepaper over on the WHDC portal.

I think Windows XP users will be really impressed with Windows 7 client. Rest assured that MS has listened to your feedback and has made some subtle changes that deliver outstanding performance, rock solid security, and a great user experience. If you've been holding off on Windows Vista, you'll want to take a look at Windows 7.

Head on over to the unofficial Windows 7 News site for news, rumors and dubious screenshots. :D