[DISCUSSION] Windows 8.1 termsrv.dll Patching

Discussion in 'Windows 8' started by GuryYu, Aug 31, 2013.

Tags:
  1. sbdman

    sbdman MDL Novice

    Dec 24, 2012
    2
    0
    0
    THANK YOU!!! It works (X64) for me.

    I can't fully operate my home theater pc, without concurrent login.
     
  2. binarymaster

    binarymaster MDL Member

    Jul 11, 2014
    101
    122
    10
    Greetings to all!

    This is my first post on the MDL forum, but I often visited it before for many reasons.

    I want to inform that I've found a working solution to enable RDP host on home/basic editions, such as Windows Vista / 7 Starter, Home Basic, and Windows 8 Core / Basic / Single Language and made a project which called RDP Wrapper Library (you can google it, I'm not able to post links now).

    Also, I've shared RDP Wrapper source code, so you can compile/rebuild it on your own, maybe with some modifications.

    rdpwrap.dll works as a layer between Service Control Manager (SCM) and TermService library - termsrv.dll. It wraps two exported functions from termsrv - ServiceMain and SvchostPushServiceGlobals, and it hooks SLGetWindowsInformationDWORD function, which is used to get current policy configuration values. If termsrv calls this function, the code execution of it will be redirected to the internal function, which checks for value name, and rewrites the resulting value. In this case we can get the listener working, and so the RDP.

    When the Windows 8 released, termsrv.dll (build 9200) changed the way of policy requests. Now it uses internal unexported function called SLGetWindowsInformationDWORDWrapper (got name from debugging symbols). So, the intercepting method became a little more complicated. I've implemented a signature search for it.

    So, here am I... In the termsrv build 9600 the policy requests was changed again and more complex!

    I've tried to analyse it in IDA, but it really looks too hard, and many of the processor cycles was wasted for the decompilation process :biggrin:

    First version of RDP Wrapper was released in the october 2013, but I still have no ideas... :confused: So here is the reason I'm posting this message here. I hope I've clearly explained the main idea, and shared the source code, so maybe someone finds the solution to trick the terminal service on Win 8.1.

    But I'm not going to abandon this project. I just want to take some ideas about it, then I can made a new release.
     
  3. Mr Jinje

    Mr Jinje MDL Expert

    Aug 19, 2009
    1,769
    1,106
    60
  4. fly_indiz

    fly_indiz MDL Novice

    Jul 10, 2014
    14
    10
    0
    In addition to uncertainty about my patch of new x64 dll - I want to report that today a have a first bluescreen when connecting at RDP to my computer (with active my console session).
    This error occurred only once and does not repeat.
    But very big request to experienced programmers to check this work.
     
  5. berdima

    berdima MDL Novice

    Mar 31, 2014
    1
    0
    0
    termsrv.dll

    Спасибо ! Работает для 8.1 x64 (июль 2014)


     
  6. endbase

    endbase MDL Guru

    Aug 12, 2012
    4,694
    1,718
    150
    Translate into = Thank you! Works for 8.1 x64 (July 2014) ;)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. binarymaster

    binarymaster MDL Member

    Jul 11, 2014
    101
    122
    10
    Well, I can share the decompilled .C file (termsrv 9600), but I don't know is that a good idea :)

    Here is the link: httр://stascorp.com/load/1-1-0-63
    And yes, the main discussion is started on Andrew Block's web blog.

    In the termservice build 9600 I found policy queries in the function CSLQuery::Initialize, but there is no such familiar calls as in build 9200. The query function has been integrated directly without internal/external calls, and this is the main problem. :eek:
     
  8. binarymaster

    binarymaster MDL Member

    Jul 11, 2014
    101
    122
    10
    #231 binarymaster, Jul 12, 2014
    Last edited by a moderator: Apr 20, 2017
    I've researched a bit more... and think I can do it :biggrin:

    Here is code in 6.2:
    Code:
      v1 = SLGetWindowsInformationDWORDWrapper(
             (int)L"TerminalServices-RemoteConnectionManager-AllowRemoteConnections",
             (int)&v9);
      if ( v1 == -1073418222 )
      {
        _DbgPrintMessage((int)"The SL policy for 'Allow Remote Connections' is not defined - assuming Reduced Functionality Mode");
        v1 = 0;
        v2 = CSLQuery__bServerSku != 0;
        v9 = CSLQuery__bServerSku != 0;
      }
      else
      {
        v2 = v9;
      }
    v1 - resulting value
    v9 - policy data value
    Here is code in 6.3:
    Code:
      SP_unsigned_char_SP_HLOCAL_unsigned_char____Reset((HLOCAL *)&v6741);
      if ( v119 == -1073418222 )
      {
        _DbgPrintMessage(4, "The SL policy for 'Allow Remote Connections' is not defined - assuming Reduced Functionality Mode");
        v544 = CSLQuery__bServerSku != 0;
        v119 = 0;
      }
      else
      {
        v544 = v6998;
      }
      if ( v119 < 0 )
      {
        _DbgPrintMessage(
          8,
          "CSLQuery::Initialize - SLGetWindowsInformationDWORD failed: 0x%x in %s",
          v119,
          "CSLQuery::Initialize");
        return (LPVOID)v119;
      }
      CSLQuery__bRemoteConnAllowed = v544 != 0;
    v119 - resulting value
    v544 - policy data value
    All is to do:
    a) v544 = v6998; replace with v544 = 1;
    or
    b) CSLQuery__bRemoteConnAllowed = v544 != 0; replace with CSLQuery__bRemoteConnAllowed = true;

    And so on... :rolleyes:
     
  9. Cowboy

    Cowboy MDL Member

    Oct 25, 2008
    189
    29
    10
    I did uncheck the box to use the download manager. It still wants to download the .exe file.
     
  10. bjf2000

    bjf2000 MDL Expert

    Apr 11, 2008
    1,102
    200
    60
    Try a different browser/machine. It's a RAR.
     
  11. Cowboy

    Cowboy MDL Member

    Oct 25, 2008
    189
    29
    10
    A different browser of computer is not going to make any difference!!!
     
  12. Carlos Detweiller

    Carlos Detweiller Emperor of Ice-Cream
    Staff Member

    Dec 21, 2012
    7,059
    8,359
    240
    Did you allow JavaScript on the datafilehost.com domain? Without JS you cannot disable the D/L Manager.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  13. binarymaster

    binarymaster MDL Member

    Jul 11, 2014
    101
    122
    10
    Reuploaded:
    httр://rghost.net/56865147
     
  14. sebahttp

    sebahttp MDL Novice

    Sep 3, 2013
    2
    0
    0
    rghost is not working for me. I've downloaded it from datafilehost, can't reupload it because I don't have 20 posts.

    Working like a charm with 3 clients on 8.1 (embedded industry pro) x64. (1 hour so far).

    Thanks a lot! :)

    ps: a new thread should be made that states the current status of the termsrv.dll patch.
     
  15. Mr Jinje

    Mr Jinje MDL Expert

    Aug 19, 2009
    1,769
    1,106
    60
  16. Cowboy

    Cowboy MDL Member

    Oct 25, 2008
    189
    29
    10
    Me neither, but I finally got datafilehost to work!
     
  17. Mr Jinje

    Mr Jinje MDL Expert

    Aug 19, 2009
    1,769
    1,106
    60
    #240 Mr Jinje, Jul 16, 2014
    Last edited: Jul 16, 2014