Click here to Skip to main content
15,885,985 members
Articles / Programming Languages / C#
Article

Windows Messenger Private API

Rate me:
Please Sign up or sign in to vote.
1.73/5 (4 votes)
2 Oct 20053 min read 60.8K   583   26   8
Explains how to use Windows Messenger's private API, and provides a wrapper class for the challenge-response process

Introduction

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.

Troubleshooting

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.

Disclaimer

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.

Thanks

Special thanks goes to http://www.hypothetic.org/docs/msn/, 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 :)

License

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


Written By
DL!
Web Developer
Israel Israel
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
Generalbad word filter to protect my kids. with [***********] 's Pin
ZUPERKOOL7-Feb-10 10:20
ZUPERKOOL7-Feb-10 10:20 
Generalmessages events Pin
nadavg10-Jul-07 12:22
nadavg10-Jul-07 12:22 
GeneralBad Locking Pin
The Limey22-Jan-06 10:14
The Limey22-Jan-06 10:14 
GeneralRecording Transmited Voice Pin
triplebit6-Jan-06 5:55
triplebit6-Jan-06 5:55 
I work on VOIP recording software - on the transmitter part.
I can easily record most voip applications since they all use DirectSHow.
Since DitectShow capturing doesn't implement a special capture filter but
use classic multimedia functions, I simply hook these functions and
implement my own recording.
Problem is with MSN Messenger (and also Windows Messenger) which implement
something else. It uses waveInOpen only for query, and I don't know how to
trace the blocks being sent to the other side.
I saw somewhere (probably in this group) that its using full-duplex com
object, but this information
doesn't help me, since it doesn't exports any helpful function for hooking.

Does anyone have some experience with that and/or can some suggestions?

Regards

Kalish

GeneralUnable to download Pin
Nathan Gloyn24-Oct-05 3:11
Nathan Gloyn24-Oct-05 3:11 
GeneralCodeProject issues Pin
DL!25-Oct-05 3:08
DL!25-Oct-05 3:08 
QuestionRe: CodeProject issues Pin
yangzw_cn29-May-06 14:43
yangzw_cn29-May-06 14:43 
AnswerRe: CodeProject issues Pin
DL!29-May-06 21:04
DL!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.