xboxscene.org forums

Author Topic: Windows Media Center On Windows Xp  (Read 83 times)

xxwillisxx

  • Archived User
  • Sr. Member
  • *
  • Posts: 364
Windows Media Center On Windows Xp
« on: December 30, 2005, 06:27:00 PM »

QUOTE

Required:
- MCE software (either CAB or ripped from XPSP2)
- A \Windows\eHome directory
- .Net Framework v1.x or v2.x plus equiv. SDK tools
(you'll just need sn.exe, msdis130.dll, and ildasm.exe if you want to grab them from a friend)
Warning! If you decide to use the files buried within' your service pack executable (xpsp2.exe), you need to ensure you grab all the required files in the other directories (such as /i386)! You can obtain a list of files required by opening /windows/inf/medctroc.inf and looking under the [SourceDisksFiles] heading. Keep in mind you will not have all of the files such as the sample DVR videos, the hi-resolution backgrounds, and the introductory/assistance videos (wmv)!

If you are installing from a Windows MCE CAB you snatched from CD2, just extract the contents into the newly created eHome directory and skip over the below instructions. If were not fortunate enough to obtain a CAB and decided to use the files within' your XPSP2 redist., gather the necessary files and dump them into a temporary folder then execute the following (from within' this directory) in a command prompt:
expand -r * C:\Windows\eHome\

After doing so, you should have a bunch of files within' your eHome directory. Look for ehShell.exe and verify that it has the pretty green-button icon. If it doesn't, stop right now as you did something wrong.

Ok, if you're using a non-MCE 2005 compilation of files, go ahead and launch mcintro.wmv (in media player classic), set it to loop, and minimize for some soothing music while you keep working. Sadly, this introductory video changed in Symphony.

It's time to do some quick integration with the operating system. Jump into the command prompt, if it's not already open, jump into the eHome\ directory and leave it open for the remainder of this guide - We'll be using it alot.
Warning! For the remainder of the guide, I will assume you have installed the SDK tools required properly (or put the files in a public directory) and set up your PATH environmental variables correctly to execute these tools without having to specify full paths - If you don't know what the heck I'm talking about, consult your nearest tuning fork.

Execute:
sn -Vl

You should be greeted with "No verification entries registered". If so, your sn.exe tool is working correctly - Excellent. To prevent future strong name errors, go ahead and issue:
sn -Vr *

You should be presented "Verification entry added for assembly '*,*'". Strong-name verification will no longer occur for any .net assemblies now (could pose security issues). Now go ahead and issue the following commands (list from 2005, ignore files that do not exist):
ngen /silent /nologo ehiwmp.dll
ngen /silent /nologo ehiExtens.dll
ngen /silent /nologo ehRecObj.dll
ngen /silent /nologo ehCIR.dll
ngen /silent /nologo ehepgdat.dll
ngen /silent /nologo ehiEPG.dll
ngen /silent /nologo ehiPlay.dll
ngen /silent /nologo ehiProxy.dll
ngen /silent /nologo ehiTuner.dll
ngen /silent /nologo ehiuserxp.dll
ngen /silent /nologo ehiVidCtl.dll
ngen /silent /nologo ehepg.dll
ngen /silent /nologo EhCM.dll
ngen /silent /nologo ehcommon.dll
ngen /silent /nologo bdatunepia.dll

Let's now register some needed assembly types by issuing the following commands:
regasm ehRecObj.dll
regasm ehCIR.dll
regasm ehepgdat.dll
regasm ehepg.dll

Almost done, let's finish up by registering some libraries and codecs by issuing the following commands (ignoring files that you do not have):
regsvr32 /s sbe.dll
regsvr32 /s quartz.dll
regsvr32 /s encdec.dll
regsvr32 /s VBICodec.ax
regsvr32 /s WSTPager.ax
regsvr32 /s WSTRenderer.ax
regsvr32 /s Mpeg2Data.ax
regsvr32 /s msvidctl.dll
regsvr32 /s bdaplgin.ax
regsvr32 /s msdvbnp.ax
regsvr32 /s PsisDecd.dll
regsvr32 /s Psisrndr.ax
regsvr32 /s qdvd.dll

Ok we're pretty much done with the half-assed installation of MCE. I won't go further into what needs to be present/running for MCE to work - That's for a later time.
Oh no, we're not on Windows XP MCE!
Last revised: Jul. 21, 11:43AM
Warning! MS Windows MCE 2005 Beta 1 users should not have to do his as oddly enough the protection does not exist! Skip to the warning box above Crashes, errors, and bears - Oh my!

If the above actually worked for you (thank god), you should be able to execute ehshell.exe and receive this wonderful error (may differ between versions): "Media Center only works on Windows XP Media Center Edition." Whoo hoo! We wasted our time right? Wrong. Let's find out where it's checking the OS we're on, and 'fix' it.

This error message is obviously coming from somewhere, but where? Keep in mind English is not the only language in the world, therefore all the strings used within' this application are likely localized. Looking around, you should find a ehres.dll file that contains all the resources used within' MCE. Opening it with your favorite resource editor, you'll find STRINGS.XML (within' the file) contains localized strings. Go ahead and search for our error string - You'll find it with an ID of StartupError.NotFreestylePID. Jot this down, we'll need it later.

Ok put your thinking cap on - Let's see... we run ehshell.exe, it does some magic on our PID, and loads this localized error from ehres.dll. Ok so obviously the PID check is within' ehshell.exe or something it accesses. Let's fire up ildasm.exe and drag ehshell.exe onto the window. Go to File > Dump and in the options dialog that appears afterwards make sure only 'Dump IL Code' and 'Expand try/catch' checkboxes are checked. Click ok and save the resulting IL file in a separate directory (resources will fall out hence the new directory) and call it ehshell.il. It should be a whopping 20-30MB depending on what version of MCE we're working with here. Open this file in a proper editor such as UltraEdit, or if you're brave and have enough RAM, in Wordpad (jEdit rox). Find the first instance of our annoying StartupError.NotFreestylePID. You should come to something that looks somewhat like:

IL_0015: starg.s id
IL_0017: ldc.i4.s 87
IL_0019: call int32 [EhCM]eHome.Native.Win32::GetSystemMetrics(int32)
IL_001e: brtrue.s IL_002d

IL_0020: ldc.i4.1
IL_0021: stloc.0
IL_0022: ldstr "#StartupError.NotFreestylePID"
IL_0027: starg.s id
IL_0029: br.s IL_002d

As you can see from this IL code, the function GetSystemMetrics() is called (from user32.dll) with an argument of 87 - What the heck is 87 you ask?

Look at the documentation on this function. You'll see the function takes in an argument and spits out a return value. In this case, 87 (the value of constant SM_MEDIACENTER) is passed in. The function returns and I quote: "Nonzero if the current operating system is the Windows XP, Media Center Edition, zero if not.". I whipped up some sample implementation code for you to play with, if you become bored.

Ok, so now knowing this, here's our same IL dump with comments:

IL_0015: starg.s id
IL_0017: ldc.i4.s 87 < SM_MEDIACENTER
IL_0019: call int32 [EhCM]eHome.Native.Win32::GetSystemMetrics(int32)
^ Call GetSystemMetrics(SM_MEDIACENTER)

IL_001e: brtrue.s IL_002d
^ Did we get a boolean value of True back? If so jump over error code.

IL_0020: ldc.i4.1
IL_0021: stloc.0
IL_0022: ldstr "#StartupError.NotFreestylePID"
IL_0027: starg.s id
IL_0029: br.s IL_002d

Although we could get efficient and entirely skip over this check regardless of OS, let's just get this over with and reverse the check (MCE OS users will get the error now). Using your text editor, change:

IL_001e: brtrue.s IL_002d

... to read:

IL_001e: brfalse.s IL_002d

Now save the bugger and close your editor to free precious memory. Did you close your command prompt? Hope not. Browse to where you saved the IL code (and it's attached res file) and now execute:

ilasm /resource:ehshell.res /exe ehshell.il

Warning! If you received "File cannot be found" or "Could not create output file" errors at the end of your compilation, delete your .res file and replace it with mine.

Ok now you SHOULD have your new, patched executable with the purty icon sitting in your IL dump directory. Go ahead and replace the ehshell.exe in your eHome\ directory with this one. You're done with the patching.
Warning! To fix some interface issues (with EhiProxy/EPG/etc.) and to generally Make Things Better ™, execute install.bat within' the registry support archive. Executing uninstall.bat will wipe the registry entries, should you decide to remove MCE from your system.
Crashes, errors and bears - Oh my!
Last revised: Jul. 21, 12:03PM

Current troubleshooting advice/notes:

System.Runtime.InteropServices.COMException (0x80040155): Interface not registered
^ Currently being investigated

System.Xml.XmlException: '.', hexadecimal value 0x00, is an invalid character. Line 8, position 1.
^Currently being investigated (wierdness with recording XML files (located in C:\Documents and Settings\All Users\Application Data\MS\eHome\Recording))

System.InvalidCastException: Specified cast is not valid.
at ehiProxy.ResourceMgrClass.GetEhepgdatDispatcher(EhepgdatDispatcher& ppEhepgdatDisp)
^ Currently being investigated - Did you try the INFs above yet?

[ insert app/feature here ] crashes!
^ Can you be more specific?

If MCE is still crashing (and you've merged in my new registry entries above), you should have an event log in the "Media Center" category within' your Event Log viewer. If you don't, or it doesn't provide useful information, you can dig into ehshell.crash in the same directory as the executable. Send this information to me and I'll look into it.
Plugs n' Credits
Last revised: Jul. 21, 11:07AM

+ Thanks to an anonymous chap that provided Media Center 2005 for testing (much more stable than 2004!), and thanks to my primary testers DD2K5 and DryRayvin.

+ Shouts go to Iexbeta for a friendly forum, Winbeta for being stupid, Betas for harboring the world's biggest newbies, Neowin for having an immensely shitty portal, and TheGreenButton for implementing a forum search feature that let me search for some valuable hardware requirement information.
Logged

Ryanlash

  • Archived User
  • Newbie
  • *
  • Posts: 11
Windows Media Center On Windows Xp
« Reply #1 on: December 31, 2005, 12:52:00 AM »

has anyone tried the mce torrent it has only a few steps supposedly to get it work it's two cds.. I was gonna try it but was afraid it would screw up my OS ... would have to back up everything first..
Logged

ssj4android

  • Archived User
  • Full Member
  • *
  • Posts: 185
Windows Media Center On Windows Xp
« Reply #2 on: December 31, 2005, 11:18:00 AM »

I put all that stuff in a bat. Installing now, I'll let you know how it turns out. Just in case, anyone know how to uninstall?
Logged

ssj4android

  • Archived User
  • Full Member
  • *
  • Posts: 185
Windows Media Center On Windows Xp
« Reply #3 on: December 31, 2005, 12:22:00 PM »

Bah, anyone have that registery support archive thing? I suppose MCE just can't work on XP Home. "Faulting application eshell.exe, version 5.1.2700.2180, stamp 4118a677, faulting module kernel32.dll, version 5.1.2600.2180, stamp 411096b4, debug? 0, fault address 0x0001eb33."
BTW, I goofed up with the whole deasseble/edit/reasseble thing, so I used that hex edit.
EDIT: Alright, I reassembled (actually made the file smaller?), and it launces. Video doesn't play though.
Logged