Geeks With Blogs

WinToolZone - Spelunking Microsoft Technologies
I work as a developer on the Common Language Runtime (CLR) team, specifically in the areas of exception handling and CLR hosting.

The information in this weblog is provided "AS IS" with no warranties, and confers no rights. This weblog does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion. Inappropriate comments will be deleted at the authors discretion. All code samples are provided "AS IS" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

Inside and Out... An attempt to understand technology better... Development
[Article] Authoring a Stack Walker for X86
Stack walking is second nature to debuggers. But if you had more interest in it than just debugging and either: wanted to know what stack walking is about, or wanted to know how stack walking is implemented, or wanted to know how a custom stack walker can be authored for your application then you might find the article, Authoring a Stack Walker for X86, useful. Its my attempt to help clarify the basics of stack walking and explain key concepts and show how it can be implemented on x86 platform. The ......

Posted On Monday, January 7, 2008 4:48 AM

[Download] MemAnalysis - Native memory leak analysis tool
Advanced Windows Debugging got me hooked onto Detours and that led me to experiment with it a bit more. It resulted in this. Over the past three days, I have been working on using Detours to build a memory leak detection tool. MemAnalysis is finally done (v1, that is) and can track memory allocation and release when done using the following APIs: VirtualAlloc VirtualFree HeapAlloc HeapFree HeapDestroy Once the application being analyzed exits, MemAnalysis produces a report with details on how many ......

Posted On Wednesday, December 26, 2007 2:58 PM

Using Detours for API interception
Detours is a very interesting library from Microsoft Research that allows you to intercept Windows API calls that an application makes and redirect them to your code that can then: do some pre-and-post processing work around the call to the original API, and/or customize what is returned to the caller of the API This does not involve accessing original application source code and can be done at runtime! For an example, check the screenshot below for a sample that intercepts calls to GetVersionEx ......

Posted On Sunday, December 23, 2007 11:18 AM

Advanced Windows Debugging

The book is a must have for every serious Windows developer!

Posted On Saturday, December 22, 2007 9:00 PM

Integrating Windows Live Authentication in your application
For one of my pet projects I am writing, I was contemplating how to integrate Windows Live Authentication with my standalone application, similar to Windows Live Messenger. Turns out, it is really easy! Below are the three steps that were needed for the integration: Download the Windows Live Client SDK from here and install it. Create a new project and add reference to Microsoft.WindowsLive.Id.Cl... assembly Write code similar to the one below: using System; using Microsoft.WindowsLive.Id.Cl... ......

Posted On Sunday, December 16, 2007 11:42 PM

[Article] AppDomains and Unhandled Exception Notifications
One always strives to write exception safe application but there are times when an exception can go unhandled. In the .NET Framework, the AppDomain class exposes the UnhandledException event that can be used by by the managed application to know when an exception has gone unhandled. In the writeup, AppDomains and Unhandled Exception Notifications, I discuss the specifics of when and how this notification is made, what is the relationship between the thread that had unhandled exception and the AppDomain(s) ......

Posted On Saturday, December 15, 2007 9:46 PM

Enumerating AppDomains - I
Surprisingly, enumerating AppDomains is not that straightforward. The System.AppDomain type does not expose functionality to enumerate them at all. The way to enumerate them will be to use the V1 Hosting interface, ICorRuntimeHost and then invoke the EnumDomains and NextDomain methods against it to get the list. If you are using CLR 2.0, you needn't worry as CLR 2.0 does implement the V1 interfaces as well. Below is the snippet that exemplifies the concept (note: AppDomains will only be enumerated ......

Posted On Saturday, June 9, 2007 8:45 PM

Lessons in Exception Handling
Working on the CLR's exception handling subsystem is not just challenging but also gives unique opportunities to understand how the various exception handling subsystems (e.g. SEH, C++ EH, etc) work, and in particular, how they interoperate with one another. It was such case that had me discuss one such issue with Kevin, development lead of the JIT, that he mentions here. That discussion got me exploring the interoperability aspects of EH further and resulted in the bullets listed below. Incase you ......

Posted On Sunday, May 13, 2007 4:50 PM

WinToolZone.Bluetooth - Support for authentication
[Originally posted on 10th July 2006] WinToolZone.Bluetooth now has authentication support. You can use a BluetoothDevice object (which is used represent a Bluetooth device that has been detected) and use the SendPassKey method to send a pass key for authentication: . 1: bth.Devices[ i ].SendPassKey("123", null); Also, I have added OnIncomingAuthenticationReq... event handler against a BluetoothDevice object that can be used to setup an event handler, which will be invoked when the Bluetooth device ......

Posted On Thursday, March 29, 2007 2:42 PM

WinToolZone.Bluetooth - Added device enumeration support
[Originally posted on 6th July 2006] WinToolZone.Bluetooth, the managed Bluetooth API for the desktop that I am working on, now has the support for enumerating devices as well. The snippet below exemplifies it: . 1: Bluetooth bth = new Bluetooth(); 2: 3: // EnumRadios(bth); 4: 5: if (bth.RefreshDevices(false, true, true, true, true, null) == false) 6: { 7: Console.WriteLine("Unable to enum devices"); 8: return; 9: } 10: 11: foreach (BluetoothDevice device in bth.Devices) 12: { 13: Console.WriteLine("Devicename: ......

Posted On Thursday, March 29, 2007 2:39 PM

Copyright © Gaurav Khanna | Powered by: