Protocols/MSNP/Activities

From NINA Wiki
Revision as of 10:48, 13 March 2021 by AD (talk | contribs) (Created page with "Convert from markdown: <pre> Here is some information on the inner workings of MSN Messenger Activities. ## How it works The `MsgrConfig` XML that is retrieved from the Esc...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Convert from markdown:

Here is some information on the inner workings of MSN Messenger Activities.

## How it works

The `MsgrConfig` XML that is retrieved from the Escargot server contains 3 Activity-related URLs:

```
<AppDirConfig>
  <AppDirPageURL>
    http://appdirectory.messenger.msn.com/AppDirectory/Directory.aspx?L=en-us
  </AppDirPageURL>
  <AppDirSeviceURL>
    http://appdirectory.messenger.msn.com/AppDirectory/AppDirectory.asmx
  </AppDirSeviceURL>
  <AppDirVersionURL>
    http://appdirectory.messenger.msn.com/AppDirectory/GetAppdirVersion.aspx
  </AppDirVersionURL>
</AppDirConfig>
```

The App Directory Service is a SOAP service. It's mainly used for loading Activity info and starting with MSN 7.0, loading featured Activities. Along with that, its WSDL (the XML interface definition XML that describes the SOAP service's requests and responses) is available to read at this archived link from the Wayback Machine:

http://web.archive.org/web/20050311202052id_/http://appdirectory.messenger.msn.com:80/AppDirectory/AppDirectory.asmx?WSDL

There is also some information regarding the `Entry` node defined by the WSDL here: http://web.archive.org/web/20110424131207/http://msdn.microsoft.com/en-us/library/aa751073.aspx

Here's part of the Activity documentation from the "Windows Live Messenger Activity SDK" MSDN page: http://web.archive.org/web/20110905024714/http://msdn.microsoft.com/en-us/library/aa751024.aspx

The SDK itself is available here, archived on the Wayback Machine too: http://web.archive.org/web/20051104052000/http://download.microsoft.com/download/2/c/3/2c300000-e774-4e80-9682-9a01109fd309/messengerActivitySDK.zip

## The App Directory

### MSN 6

The App Directory page (The pane that was loaded when you clicked on the "Activities" button in 6.0 - 6.2) is archived on the Wayback Machine as well: http://web.archive.org/web/20051220110746id_/http://appdirectory.messenger.msn.com:80/AppDirectory/Directory.aspx?L=en-us

Speaking of which, it needs 5 images it uses for its layout:

http://web.archive.org/web/20051220110746id_/http://appdirectory.messenger.msn.com:80/AppDirectory/images/spacer.gif<br/>
http://web.archive.org/web/20051220110746id_/http://appdirectory.messenger.msn.com:80/AppDirectory/images/icon_star.png<br/>
http://web.archive.org/web/20051220110746id_/http://appdirectory.messenger.msn.com:80/AppDirectory/images/defentry.png<br/>
http://web.archive.org/web/20051220110746id_/http://appdirectory.messenger.msn.com:80/AppDirectory/images/icon_arrow.png<br/>
http://web.archive.org/web/20051220110746id_/http://appdirectory.messenger.msn.com:80/AppDirectory/images/defentry.png

Our understanding of how this page worked is when a user clicked on the "Activities" menu:

1. Because the `Activities` menu is actually an HTML page, a JavaScript function would transmit the Activity ID to MSN Messenger (via `window.external`). 

2. MSN Messenger would query the App Directory SOAP Service using the `GetAppEntry` method with the requested Activity ID as a parameter.

3. The App Directory SOAP Service will reply with info from the `Entry` node, which also includes the URL field which should be the URL tied to the Activity ID.

4. MSN Messenger enlarges the chat window and loads the URL as a web page to the right of the chat pane.

### MSN 7

Starting with MSN 7.0, application entries are `POST`ed from the App Directory service using the SOAP service `GetFilteredDataSet2`. Before it does that however, it queries an App Directory page named `GetAppdirVersion.aspx` which contains random data. This is then cached and treated as a flag that determines whether MSN will query the SOAP service or not. If MSN queries the page and finds out its data is the same as the copy it's cached before, it will refuse to call the SOAP service directly and show the entry results it obtained last time unless you clear IE's cache. 

The `GetFilteredDataSet2` service doesn't have clear documentation anywhere online, but a few people from our development team have been able to piece together what the response is probably supposed to be. The response is a DiffGram with a `DataInstance` named `NewDataSet` that contains numerous `Entry` and `Category` nodes. An example `Category` node is shown below:

```
<Category diffgr:id="Category1" msdata:rowOrder="0" diffgr:hasChanges="inserted">
  <CategoryID>ID</CategoryID>
  <Locale>LOCALE</Locale>
  <CategoryIconURL>ICON_URL</CategoryIconURL> <!-- Optional -->
  <CategoryName>Name</CategoryName>
  <CategoryDescription>Description</CategoryDescription> <!-- Optional -->
</Category>
```

MSN will then organize the entries by application type (Activity or Game) and then by category to display to the user. When a user clicks on an item, the client will query and load the activity with the `GetAppEntry` SOAP method on the same App Directory service in the same manner MSN 6 does.

### WLM 8+

The services WLM 8+ use for the App Directory aren't dissimilar to the ones MSN 7 uses and use the same App Directory service. However, there are three differences to how WLM carries out the calls. First, it doesn't query the `GetAppdirVersion.aspx` page before calling the SOAP service anymore, so no more caching. Second, instead of using `POST`, it uses `GET`, and arguments are passed as query string parameters in the URL. The response this version of the service returns is different in that the root node (the name of this varies on the service called) has two attributes, `code` and `ver`. `code` is the bitwise code of the operation's status, and has to AND with `2` (or `3`?) in order for WLM to consider the response successful. `ver` is just the `ver` query parameter passed through when calling the service.

`GetFilteredDataSet2`'s response has a root node named `AppDir` that contains the `Entry` and `Category` nodes like the DiffGram. `GetAppEntry`'s response has a root node named `Entry` that contains the entry info. Other than that, there aren't many differences with the WLM version of the App Directory service.

### WLM 2009+

The Activities tab and webservices for WLM 2009 and onward haven't changed at all. However, a new MsgrConfig setting is introduced named `GamesBrowserURL` that when present, makes the Games tab in a conversation window open a pane to the right side of it (as if it were loading an Activity) with the URL specified in the setting. This is supposed to be a page with all the MSN games listed on it, and a screenshot of how it looked in '09 is shown below:

![](https://livesino.net/images/farm13/3WindowsLiveWriter_9BBD/messenger_games.png)

This Games window also persisted in 2011/2012 with little changes:

![](https://sm.pcmag.com/pcmag_au/photo/w/windows-live-messenger-games/windows-live-messenger-games_f4qb.jpg)

(There was also an unrelated Games tab in 2011/2012 that essentially acted as a bigger portal for games and activity related to them, but that is possibly a more complicated topic that we won't touch here)

For the page set by `GamesBrowserURL`, the designated browser that loads the page doesn't contain any internal functions to aid in loading any Activities, and it's most likely the original page utilized a separate ActiveX control (`MSNMessenger.P4QuickLaunch`) to do this. Regardless, we believe this works in a similar manner to the App Directory page loaded in MSN 6: ActiveX control has a function that triggers WLM to query info about an Activity -> WLM calls App Directory service to get Activity info -> WLM loads Activity

## Activities

### File Sharing

Funnily enough, this activity is also archived on the Wayback Machine:

http://web.archive.org/web/20031016044839id_/http://appdirectory.messenger.msn.com:80/AppDirectory/P4Apps/FileSharing/en/fileSharingCtrl.htm

It requires an ActiveX control, which is the meat of the Activity: http://web.archive.org/web/20031016044839id_/http://appdirectory.messenger.msn.com:80/AppDirectory/P4Apps/FileSharing/en/filesharingctrl.cab. The HTML page also references a background image named `background.jpg`, but it is unknown what this image was or if it was important to the interface of the activity.

(If you want to test this Activity, just know that this page loads on Internet Explorer only, as it requires an ActiveX control, as stated before. One of the Escargot devs, tristanleboss, tested it with IE 11 under Windows 7, and works without fail. If you load it on Firefox or Chrome, the page will be blank due to their obvious lack of ActiveX support)

Unfortunately, with this activity, it crashes WLM 8+ clients, so it only works with peers using versions up to 7.5. Not that it makes much of a difference as Sharing Folders were introduced by WLM 8 anyway.

### Tic-Tac-Toe

This Activity, out of all the Activities we've found, is an interesting find, as it's actually an HTML/JavaScript game. No ActiveX! This can be a good start for debugging Activities.

Here is the Activity's HTML page, along with (almost all of) its components:

http://web.archive.org/web/20031226111945id_/http://appdirectory.messenger.msn.com/AppDirectory/P4Apps/TicTacToe/tictactoe_en.htm<br/>
http://web.archive.org/web/20070323200437id_/http://appdirectory.messenger.msn.com/AppDirectory/P4Apps/TicTacToe/empty.gif<br/>
http://web.archive.org/web/20030731204453id_/http://appdirectory.messenger.msn.com/AppDirectory/P4Apps/TicTacToe/images/redo.bmp<br/>
http://web.archive.org/web/20130703174717id_/http://appdirectory.messenger.msn.com/AppDirectory/P4Apps/TicTacToe/images/redx.bmp<br/>
http://web.archive.org/web/20070831083510id_/http://appdirectory.messenger.msn.com/AppDirectory/P4Apps/TicTacToe/images/redxanim.gif<br/>
http://web.archive.org/web/20070323200356id_/http://appdirectory.messenger.msn.com/AppDirectory/P4Apps/TicTacToe/label.bmp

It's only missing both the `redoanim.gif` image in the `images` directory and the `grid.gif` image in the main directory.

`redoanim.gif` was a 65x70 GIF file and `grid.gif` was a 210x210 GIF file. Both files luckily exist in an MSN Activity sandbox program as part of a sample Tic Tac Toe game, which is available for download [here](https://wink.messengergeek.com/uploads/short-url/bwBFosxqQ4XTknVLJrKczmjakqm.rar).

In terms of other activities, we've found Bankshot, Chess, Minesweeper, Solitaire Showdown, Upwords, and WoF so far, which are all MSN Games Activites (more on that in a second). Those all use ActiveX controls that load the game components and code needed to allow communication between the game and the Activity API. We also found Media Player and Photo Swap, along with some other Activities, but they lack some crucial files.

### MSN Games Activities

The typical URL that was used to host these Activities was `http://messenger.zone.msn.com/(language code)/(game code)/`

At least 2 ActiveX controls are involved, with those controls being:
- `ZIntro.cab`: Preloads other ActiveX controls
- `MessengerStatsClient.cab`: Links the MSN Games game and MSN Messenger together so that they can interface with each other.

These 2 ActiveX controls will install, but they won't start if the domain name they are activated from doesn't end with `zone.msn.com`.

Sometimes, a game will require an additional ActiveX control for its game logic, but they mainly used a Flash file, usually  named `(game code).swf` for their user interface. This Flash file is loaded by another Flash file named `AdLoader.swf`.

Some games try to load additional XML files, but with the help of SWF decompilers, like Sothink, you can read the ActionScript embedded inside to closely emulate their node structures.

Here is the loading order for a typical MSN Games game:

    - outerframe.aspx
    --- gateway.aspx
    ----- main.aspx
    ------- buddylist.aspx
    ------- help.aspx
    ------- about.aspx
    ------- LoadAd.aspx
    ------- preloader.aspx?Version=2
    ------- msngame.aspx (THE GAME)
    --------- AdLoader.swf
    ------------ (game code).swf
    --------- GameEndTVProxy.aspx
    ------- IntermissionAd.aspx
    ----- PremiumAccessStatus.aspx

Globally, these files are the same for each game (if you skip language strings and small things like game code, etc.), except for `msngame.aspx`, which is the main game file that contains game-specific code.

Unfortunately, this specific `msngame.aspx` file has been poorly preserved on the Wayback Machine, and only 10 copies of it are available, covering only 5 games:

Solitaire Showdown:<br/>
http://web.archive.org/web/20080420190307id_/http://messenger.zone.msn.com:80/ZH-TW/MSOL/msngame.aspx
<br/>
http://web.archive.org/web/20070402084917id_/http://messenger.zone.msn.com:80/ES-MX/MSOL/msngame.aspx

Reversi:<br/>
http://web.archive.org/web/20080416172841id_/http://messenger.zone.msn.com:80/ZH-HK/RVSI/msngame.aspx
<br/>
http://web.archive.org/web/20080405213817id_/http://messenger.zone.msn.com:80/ES-CL/RVSI/msngame.aspx
<br/>
http://web.archive.org/web/20080402025823id_/http://messenger.zone.msn.com:80/PT-BR/RVSI/msngame.aspx

"MJS2" (don't know the official name for this):<br/>
http://web.archive.org/web/20080417024826id_/http://messenger.zone.msn.com:80/ES-AR/a-MJS2/msngame.aspx

Minesweeper Flags:<br/>
http://web.archive.org/web/20080401133917id_/http://messenger.zone.msn.com:80/HU-HU/MINE/msngame.aspx
<br/>
http://web.archive.org/web/20040415151606id_/http://messenger.zone.msn.com:80/SChinese/mine/msngame.aspx
<br/>
http://web.archive.org/web/20030906030041id_/http://messenger.zone.msn.com:80/Spanish/mine/msngame.aspx

Bejeweled:<br/>
http://web.archive.org/web/20060509212630id_/http://messenger.zone.msn.com:80/English/dimi/msngame.aspx