Jump to content

Reset LiveTV DRM


Nologic

Recommended Posts

Nologic

Why:

This was the second time within a month, of having to reset the PlayReady DRM used with WMC LiveTV, do to a hardware upgrade. So being lazy as I am...I wrote a script so I wouldnt' have to hunt down the Web Pages describing the proceedure, then doing everything manually.

 

Warning:

Don't run this for giggles, any DRM content you have now, may become unusable. So only run this when shit truely has hit the fan.

 

References:

Microsoft

TheGreenButton

 

Requirements:

AutoIt

ResetDRM (Silently Downloaded if Not Found)

7-Zip (Silently Download & Installed if No Supported Unarchiver Found)

or

WinRar

 

How:

The script deletes the old DRM Keys & Cache, and sets you up to create new keys. It does this by deleting the required files, and running CleanDRM, which is a part of ResetDRM, in a manner that works with both Win7 & Win8...and may also work with Vista. To do this it must extract CleanDRM from ResetDRM along with supporting files. This is ideally done by one of your installed Archive apps (WinRar or 7-Zip), but if none are found it will download and silently install 7-Zip.

 

Instructions:

Install AutoIt and set it to execute scripts when double clicked.

 

Install one of the Archiver app's listed above.

 

Now Right Click on desktop and select "New\AutoIt v3 Script" from the context menu, and Rename it "ResetDRM.au3"

 

Now Right Click "ResetDRM.au3" & select "Edit Script" from the context menu.

 

Now paste the following code into:

#RequireAdmin

#Include <Array.au3>

Dim $aFiles[3] = ['ADVPACK.DLL' , 'CleanDRM.exe' , 'resetdrm.inf']
For $ii = 0 To UBound( $aFiles ) - 1
	If FileExists( @ScriptDir & '\' & $aFiles[$ii] ) <> 1 Then
		If FileExists( @ScriptDir & '\ResetDRM.exe' ) <> 1 Then InetGet( 'http://go.microsoft.com/fwlink?LinkId=105000' , @ScriptDir & '\ResetDRM.exe' )
		If FileExists( @ScriptDir & '\ResetDRM.exe' ) <> 1 Then
			MsgBox( 0 , 'Error:' , 'Failed to Download ResetDRM.exe' )
			Exit
		EndIf

		$s7zip   = _7zip_RegRead()
		$sWinRAR = _WinRAR_RegRead()
		Select
			Case $s7zip <> ''
				RunWait( $s7zip & ' e ResetDRM.exe -aoa' , @ScriptDir , @SW_HIDE )

			Case $sWinRAR <> ''
				RunWait( $sWinRAR & ' e -o+ ResetDRM.exe' , @ScriptDir , @SW_HIDE )

			Case Else
				If _7zip_Fetch() = -1 Then
					MsgBox( 0 , 'Error:' , 'Failed to Download 7-zip' )
					Exit
				Else
					$s7zip = _7zip_RegRead()
					RunWait( $s7zip & ' e ResetDRM.exe -aoa' , @ScriptDir , @SW_HIDE )
				EndIf
		EndSelect
		FileDelete( @ScriptDir & '\ResetDRM.exe' )
		ExitLoop
	EndIf
Next


; Stop Windows Media Center Receiver Service
RunWait( @ComSpec & ' /c net stop ehRecvr' , '' , @SW_HIDE ) 

; Remove Files
FileDelete( @AppDataCommonDir & '\Microsoft\PlayReady\mspr.hds' )
FileDelete( @AppDataCommonDir & '\Microsoft\eHome\mcendindiv.hds ' )

; Remove Folders
DirRemove( @AppDataCommonDir & '\Microsoft\PlayReady\cache\' , 1 )
DirRemove( @AppDataCommonDir & '\Microsoft\eHome\cache\'     , 1 )

; Copy Files
FileCopy( @ScriptDir & '\ADVPACK.DLL'  , @DesktopDir & '\ResetDRM\ADVPACK.DLL'  , 9 )
FileCopy( @ScriptDir & '\CleanDRM.exe' , @DesktopDir & '\ResetDRM\CleanDRM.exe' , 9 )
FileCopy( @ScriptDir & '\resetdrm.inf' , @DesktopDir & '\ResetDRM\resetdrm.inf' , 9 )

; Execute ResetDRM
RunWait( @ComSpec & ' /c CleanDRM -v' , @DesktopDir & '\ResetDRM\' , @SW_HIDE )

; Remove Files
DirRemove( @DesktopDir & '\ResetDRM\' , 1 )

; Display Message
MsgBox( 0 , 'Finished:' , 'Wait for Update PlayReady to Display' & @LF & 'Then Click "Update" & Finish Wizard.' , 5 )

; Launch WMC in LiveTV Mode
Run( @WindowsDir & '\ehome\ehshell.exe /mcesuperbar://tv?live=true' , '' )


Func _7zip_RegRead()
	$String = RegRead( 'HKLM\SOFTWARE\7-Zip' , 'Path' )
	If $String  = '' Then $String = RegRead( 'HKLM64\SOFTWARE\7-Zip' , 'Path' )
	If $String <> '' Then
		If StringRight( $String , 1 ) <> '\' Then $String &= '\'
		If FileExists( $String & '7z.exe' ) Then
			Return $String & '7z.exe'
		Else
			Return ''
		EndIf
	Else
		Return ''
	EndIf
EndFunc

Func _WinRAR_RegRead()
	$String = RegRead( 'HKLM\SOFTWARE\WinRAR' , 'exe' )
	If $String  = '' Then $String = RegRead( 'HKLM64\SOFTWARE\WinRAR' , 'exe64' )
	If $String <> '' Then
		$String = StringLeft( $String , StringInStr( $String , '\' , 0 , -1 ))
		If FileExists( $String & 'WinRAR.exe' ) Then
			Return $String & 'WinRAR.exe'
		Else
			Return ''
		EndIf
	Else
		Return ''
	EndIf
EndFunc

Func _7zip_Fetch()
	$sFile = @TempDir & '\' & _RandomString() & '.html'
	InetGet( 'http://www.7-zip.org/index.html' , $sFile )
	$sBuffer = FileRead( $sFile )
	FileDelete( $sFile )

	$RegEx = StringRegExp( $sBuffer , '(?i)<A href="([^"]+?)">Download</A></TD>' , 3 )
	If @OSArch = 'X86' Then
		$iDownload = _DownloadSevenZip( $RegEx , '.exe' , '/S' )
	Else
		$iDownload = _DownloadSevenZip( $RegEx , '.msi' , '/quiet' )
	EndIf
	Return $iDownload
EndFunc

Func _DownloadSevenZip( ByRef $sInput , $sExt , $sSwitch )
	For $ii = 0 To UBound( $sInput ) - 1
		If StringInStr( $sInput[$ii] , $sExt ) > 0 Then
			$sFileName = StringTrimLeft( $sInput[$ii] , StringInStr( $sInput[$ii] , '/' , 0 , -1 ) )
			$iFetch = InetGet( 'http://www.7-zip.org/' & $sInput[$ii] , @ScriptDir & '\' & $sFileName )
			If $iFetch = 0 Then Return -1
			RunWait( @ComSpec & ' /c ' & $sFileName & ' ' & $sSwitch , @ScriptDir , @SW_HIDE )
			FileDelete( @ScriptDir & '\' & $sFileName )
			Return 0
		EndIf
	Next
EndFunc

Func _RandomString()
	$sString = ''
	Dim $aSpace[3]
	For $i = 1 To 15
		$aSpace[0] = Chr( Random( 65 ,  90 , 1 )) ; A-Z
		$aSpace[1] = Chr( Random( 97 , 122 , 1 )) ; a-z
		$aSpace[2] = Chr( Random( 48 ,  57 , 1 )) ; 0-9
		$sString &= $aSpace[Random( 0 , 2 , 1 )]
	Next
	Return $sString
EndFunc

Now save the script & execute it by double clicking it and if all went well...then you should be greeted by WMC launched to LiveTV, given a bit of time you should be prompted to Update PlayReady DRM...Click "Update" and complete the wizard....sorry couldn't figure out a way to automate this. :(

Edited by Nologic
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...