[DISCUSSION] Patch WMC to run on Windows 10 final & possible alternatives

Discussion in 'Windows 10' started by ricktendo64, May 8, 2015.

  1. edechamps

    edechamps MDL Novice

    Dec 29, 2015
    19
    3
    0
    Suggestion to add to one of the help files in the archive:

    If getting the following message when trying to start WMC:

    This error is caused by C:\WINDOWS\ehome\ehuihlp.dll being replaced with its original version (for example during a SFC scan). The fix consists in putting back the working version from the package, in WMC64\bin\MediaCenter\Windows\ehome\ehuihlp.dll.

    (By the way, where does the ehuihlp.dll file in the archive come from? It is different from the one in the DISM packages, and the modification time in the installer archive is quite telling. From the looks of it it seems like it was hacked to allow WMC to start on Win10.)
     
  2. edechamps

    edechamps MDL Novice

    Dec 29, 2015
    19
    3
    0
    I see. Impressive :) In that case I guess the doc I'm suggesting should mention ehrecvr.exe and ehsched.exe as well. This is probably an issue people are going to hit because Windows likes to restore original versions of files sometimes.
     
  3. crash2009

    crash2009 MDL Expert

    Dec 8, 2015
    1,369
    199
    60
    I suppose it's possible, but I doubt they would bother replacing files in something that doesn't exist.
     
  4. edechamps

    edechamps MDL Novice

    Dec 29, 2015
    19
    3
    0
    What do you mean? It does exist, and Windows keeps track of these files since they are part of registered WMC DISM packages from the installer. If you run SFC /SCANNOW for example these files will be overwritten with their original versions and WMC will stop working.
     
  5. crash2009

    crash2009 MDL Expert

    Dec 8, 2015
    1,369
    199
    60
    #2986 crash2009, Jan 1, 2016
    Last edited: Jan 1, 2016
    I thought, that since WMC was removed by M$, the OS would think WMC does not exist, so therefore nothing to repair by SFC.

    If that is not correct, thanks for the correction.

    EDIT... thinking about this a little more....

    If SFC is going to replace a file, wouldn't it use the original patched file from the WMC_v11 package?
     
  6. crash2009

    crash2009 MDL Expert

    Dec 8, 2015
    1,369
    199
    60
    #2987 crash2009, Jan 1, 2016
    Last edited: Jan 1, 2016
    1 eth=yes, live drm=yes
    2 eth=no, viewing or listening conflict (no network tuner)
    3 eth=no, viewing or listening conflict (no network tuner)
    4 eth=yes
    5 live drm=yes

    The above test was performed by disconnecting eth at location A.
    I should re-run test disconnecting from B, to eliminate no tuner error.

    I did get a Copying Prohibited error in a different session, I'll have to experiment a bit to reproduce it.
     

    Attached Files:

  7. Graznok

    Graznok MDL Member

    Jan 29, 2013
    214
    120
    10
    Raw data from /join/ request, not from tunnelling step!
     
  8. edechamps

    edechamps MDL Novice

    Dec 29, 2015
    19
    3
    0
    #2989 edechamps, Jan 1, 2016
    Last edited by a moderator: Apr 20, 2017
    Noticed a few more thingsā€¦

    ALTERNATIVE TASK PERMISSION FIX

    Regarding the scheduled task permission problem, I came up with a way to actually set the permissions on the Media Center task folder itself, by altering the ACL in the internals of the scheduler:

    Code:
    # Note: this needs to be run with maximum privileges such as TrustedInstaller
    $RegistryKey = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows\Media Center"
    $SDHelper = ([WMIClass] "Win32_SecurityDescriptorHelper")
    $SDBinary = (Get-ItemProperty -Path $RegistryKey -Name SD).SD
    $SDDL = $SDHelper.BinarySDToSDDL($sdbinary).SDDL
    $SDDL += "(A;;0x1f019f;;;BA)(A;;0x1f019f;;;SY)(A;;0x1701ff;;;NS)(A;;0x1200a9;;;AU)(A;;FR;;;SY)"
    $SDBinary = $SDHelper.SDDLToBinarySD($SDDL).BinarySD
    Set-ItemProperty -Path $RegistryKey -Name SD -Value $SDBinary
    After this is done (no need to reboot), WMC is able to successfully create the StartRecording and mcupdate_scheduler tasks on-the-fly, just like a normal installation.

    There might be a cleaner way to do this, since I just noticed after writing this that a "TaskFolder.SetSecurityDescriptor" API exists. "TaskFolder.CreateFolder" also exists and takes a SDDL, that's worth a look too.

    dism-x64 DISM FAILURE

    On a clean system (fresh Win10 VM), I noticed that the following command from the installer fails:

    Code:
    dism /Online /NoRestart /Add-Package:dism-x64\update.mum
    It fails with error code 0x800f0922, which is CBS_E_INSTALLERS_FAILED. CBS.log contains the following:

    Code:
    [...]
    Info                  CSI    0000010c Begin executing advanced installer phase 38 (0x00000026) index 59 (0x000000000000003b) (sequence 95)
        Old component: [l:0]""
        New component: [l:164 ml:165]"Microsoft-Windows-ehome-services-ehrecvr, Culture=neutral, Version=6.3.9600.16384, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=amd64, versionScope=NonSxS"
        Install mode: install
        Smart installer: FALSE
        Installer ID: {386b5911-b69e-4d2d-a3ab-796d2ec6af38}
        Installer name: [14]"Task Scheduler"
    [...]
    Error                 CSI    00000115 (F) Logged @2015/12/31:22:28:10.557 : [l:49 ml:50]"InstallTaskOnline: RegisterTask failed 0x800700b7"
    [...]
    Error                 CSI    0000011c@2015/12/31:22:28:10.650 (F) CMIADAPTER: Exiting with HRESULT code = HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS).
    [gle=0x80004005]
    [...]
    Error      [0x018003] CSI    0000011e (F) Failed execution of queue item Installer: Task Scheduler ({386b5911-b69e-4d2d-a3ab-796d2ec6af38}) with HRESULT HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS).  Failure will not be ignored: A rollback will be initiated after all the operations in the installer queue are completed; installer is reliable[gle=0x80004005]
    [...]
    I determined that the issue was caused by the Task Scheduler getting confused with regard to the "Media Center" scheduled task folder - apparently the DISM installer creates the folder behind the scheduler's back, which causes task creation to fail with ERROR_ALREADY_EXISTS.

    I found a workaround: if the folder is manually created (through the task scheduler UI) before the DISM package installer runs, the dism command succeeds. (In practice I also put a dummy task inside the folder, but in retrospect I'm not sure if that's necessary.)

    CLEANER DISM-ONLY INSTALL

    With the above in mind and experimenting in a fresh clean VM, I determined that a lot of what the current v11 installer does is mostly unnecessary. I managed to get a mostly working WMC installation just by doing the following:

    1. Create "Media Center" scheduled task folder (see above)
    2. Run Powershell script to set up the task folder permissions (see above)
    3. Run a condensed version of the first phase of v11 install.bat (as TrustedInstaller):
      Code:
      %windir%\System32\reg.exe import dism.reg
      xcopy .\dism\* %windir%\servicing\Packages\ /chriky
      %windir%\System32\dism.exe /online /norestart /add-package:dism-x64-en-US\update.mum
      %windir%\System32\reg.exe delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-MediaCenter-Package-avcore~31bf3856ad364e35~amd64~~6.3.9600.16384" /f
      %windir%\System32\reg.exe delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Microsoft-Windows-MediaCenter-Package~31bf3856ad364e35~amd64~~6.3.9600.16384" /f
      del /f /q "%windir%\servicing\Packages\Microsoft-Windows-MediaCenter-Package*~amd64~~6.3.9600.16384*"
      %windir%\System32\dism.exe /online /norestart /add-package:dism-x64\update.mum
    4. In WINDOWS\ehome, copy from archive: ehuihlp.dll, ehrecvr.exe, ehsched.exe, and the language directory if other than English
    5. Done!

    There was no need to do any of the massive copying/ACL setting/registry editing/assembly generating/scheduled task changing that the current v11 installer script does - it's all taken care of by the DISM installer. Isn't that wonderful? I believe there is potential to come up with a very clean install procedure that way.

    After installing WMC that way on a fresh Windows install, I can attest that everything seems to work, including TV setup, live TV and scheduled recordings. I think the only problem I saw was a crash while trying to install PlayReady - I had to refuse the PlayReady license to ensure it wouldn't install it, otherwise the install would get corrupted. That's fine as far as I'm concerned since I'm not interested in playing DRM-protected content. Other people might want to investigate though.
     
  9. Graznok

    Graznok MDL Member

    Jan 29, 2013
    214
    120
    10
    v11 and v10 installers are actually a mix between files copy and DISM online integration. Before that only files copy was done, and since v10 the DISM process could be done thanks to @xinso help. This is why many file operation might be unneeded.

    Congratulations if you found the issue!
     
  10. crash2009

    crash2009 MDL Expert

    Dec 8, 2015
    1,369
    199
    60
    I booted and turned on Fiddler. Appears to me there is more to it than the example in the previous text file. Lines 10-24 are included in the attached txt
     

    Attached Files:

  11. edechamps

    edechamps MDL Novice

    Dec 29, 2015
    19
    3
    0
    It won't use the files from the Media Center directory in the package, it will use the files from the DISM packages. Which contain the original files from Microsoft. I don't think it's possible to put the modified files inside DISM packages because they are digitally signed.
     
  12. jeff2012

    jeff2012 MDL Member

    Mar 31, 2010
    152
    6
    10
    #2993 jeff2012, Jan 1, 2016
    Last edited: Jan 1, 2016
    Is there a revision history for the different versions of the WMC patch?

    After a fresh Win 10 install, everything works initially , however after a couple of days, System files modified error.

    Just installed V 11, hopefully it gets better.
     
  13. T-S

    T-S MDL Guru

    Dec 14, 2012
    3,984
    1,331
    120
    #2994 T-S, Jan 1, 2016
    Last edited: Jan 1, 2016

    That's a right assumption for v8, but not for w10 (and possibly v11), given there the integration is made mostly using DISM.

    Not sure about SFC scannow but surely Dism /Online /Cleanup-Image /RestoreHealth, surely gets the files from WU, unless you use the /limitaccess switch, so possibly SFC does the same thing.
     
  14. noslack

    noslack MDL Novice

    Jul 31, 2009
    2
    0
    0
    Please do that, it would help a lot to have an automated tool for that..
     
  15. Graznok

    Graznok MDL Member

    Jan 29, 2013
    214
    120
    10
    Sean's WMC Backup totally fails on non-English systems.
     
  16. Delphiwizard

    Delphiwizard MDL Novice

    Sep 12, 2015
    39
    5
    0
    When i have made such tool i'd be happy to share it here.
    I'm thinking of a simple program with 2 buttons, 'backup wmc settings' and 'restore wmc settings', where the 'backup' lets u chose a folder where to put the backup and the backup would stop the services, copy all the files from ehome to a zipfile, add the registry settings in the zip file and restart the services when done.

    Restore then does the same but copy all files from the zipfile and put it back into ehome folder, and adds the registry keys again from backup
     
  17. Graznok

    Graznok MDL Member

    Jan 29, 2013
    214
    120
    10
    Backup successfully worked from a v9 to a v10, but failed on a v10/v11 to a v10/v11. On both computers last scenario failed, I don't know why. So you may encounter issues while you make your program.
     
  18. noslack

    noslack MDL Novice

    Jul 31, 2009
    2
    0
    0
    It is not just non-english systems it doesn't work on, I still have to use one of the first releases of his to get my series to be transferred to WMC, so a loader would be great.