Click here to Skip to main content
13,557,707 members
Click here to Skip to main content
Add your own
alternative version


26 bookmarked
Posted 2 Oct 2005

Windows Messenger Private API

, 2 Oct 2005
Rate this:
Please Sign up or sign in to vote.
Explains how to use Windows Messenger's private API, and provides a wrapper class for the challenge-response process


Windows Messenger provides API for accessing some of its internal objects, e.g. enumerate the logged-on user's contact list. This API is exposed as a COM object, through the Messenger API Type Library (msmsgs.exe).

A major drawback of this API is that it lacks some basic functionality. For example, it is impossible to programmatically add a given user to the contact list without the need for user interaction (we can only launch the "Add a contact..." dialog box).

This article suggests a solution to this unfortunate issue, through the use of Windows Messenger Private APIs.

Windows Messenger's Private API

Windows Messenger has another set of APIs, which is probably intended for internal MS use only. This API is also exposed as a COM object, through the Messenger Private Type Library (msmsgs.exe). Among other things, the API provides the ability to programmatically add a user to the contact list, with no user interaction whatsoever.

However, attempting to use this API reveals that each and every method throws an exception, claiming that the object wasn't "unlocked". MSDN documentation explains that applications need to authenticate themselves in a challenge-response process, which requires the use of an ID / KEY pair. The latter might have been issued by MS in the past, but no more.

The attached C# source code package demonstrates how the private API can be unlocked.

What's Inside?

The source code package consists of a single VS2003 project (console application) and two C# classes:

  • MessengerUnlocker unlocks a given MessengerPriv object, by performing the challenge-response process. This is the nuts-and-bolts of this article.
  • MessengerUnlockerDemo is nothing but a Main method that creates, unlocks and uses a MessengerPriv object. To prove that the latter is indeed unlocked, a hard-coded user is added to the running user's contact list.

Source code is documented in a standard C# style. Here and there, the source links to external Internet sites for further explanations regarding the challenge-response process.


Make sure you have Windows Messenger installed, running and signed-in before running the demo.

Before running the demo a second time, remove the newly added user from the contact list. Attempting to add an already-added contact causes an exception to be thrown.


This code heavily relies on private and unsupported APIs, which are subject to change at any given moment (assessing the likeliness of the API actually changing in the future is left for the reader). This article is the product of my curiosity and free time. If you base your production code on this, you are mad.

The code was tested against Windows Messenger 4.7.3001, but might as well work perfectly against other versions of Windows Messenger (4.6 in particular). It would probably not work against MSN Messenger of any version.


Special thanks goes to, for their great documentation of the Messenger Protocol. These wonderful guys provided me with the last missing piece of the puzzle - a valid ApplicationId / ApplicationKey pair :)


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Web Developer
Israel Israel
No Biography provided

You may also be interested in...


Comments and Discussions

Generalbad word filter to protect my kids. with [***********] 's Pin
ZUPERKOOL7-Feb-10 10:20
memberZUPERKOOL7-Feb-10 10:20 
Generalmessages events Pin
nadavg10-Jul-07 12:22
membernadavg10-Jul-07 12:22 
GeneralBad Locking Pin
The Limey22-Jan-06 10:14
memberThe Limey22-Jan-06 10:14 
GeneralRecording Transmited Voice Pin
triplebit6-Jan-06 5:55
membertriplebit6-Jan-06 5:55 
GeneralUnable to download Pin
Lowest of the Low24-Oct-05 3:11
memberLowest of the Low24-Oct-05 3:11 
GeneralCodeProject issues Pin
DL!25-Oct-05 3:08
memberDL!25-Oct-05 3:08 
QuestionRe: CodeProject issues Pin
yangzw_cn29-May-06 14:43
memberyangzw_cn29-May-06 14:43 
AnswerRe: CodeProject issues Pin
DL!29-May-06 21:04
memberDL!29-May-06 21:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.180515.1 | Last Updated 2 Oct 2005
Article Copyright 2005 by DL!
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid