Main Webpage

Features

    Terminal Services Bulletin Board
    Links and Downloads
    Matthew Harris' Resume
    Contact the admin

Hacks

    Disable the X box on the Terminal Services Client
    Change the client version of the Terminal Services Client
    Add the clock to the taskbar through the registry
    Make all processes appear in the Task Manager through a registry hack
    Prevent disconnects and stabilize your terminal services connection
    Fix your TSAdmin application when it becomes nonfunctional on the taskbar
    Disable/Enable all terminal services logons through the registry

Scripts

    Restrict users to one session and reconnect them
    Share the redirected printer automatically
    Map your client's printer to an LPT port
    Rename client redirected printers
    Restrict users to only one terminal services session
    Automatically connect disconnected users back to their sessions
    Force software license compliance through a script
    How to reset all your TS sessions at once

Hard to Diagnose Problems

    Incorrect IE permissions can disable opening new IE windows

Disabling the X box on the Terminal Services client


In this article, I'll discuss how you can customize the terminal services client to prevent users from disconnecting using the X box.

Prerequisites:
•The latest version of the RDP client, build 2600 or higher
•Any resource hacker. I'm using Resource Hacker. It is free and quite useful.

Step 1: Backup your main files
•After you have installed your client, make a backup copy of mstsc.exe. This is for good measure. It can be found in your %SystemRoot%\System32 directory.

Step 2: Hack the mstsc.exe
•Open up your resource hacker and open up mstsc.exe from within the hacker.
•On the left side of the resource hacker, click on the 'Dialog' folder, then on the 404 folder, then on 1033 item.
•The 1033 item contains all the elements of the disconnection window, as seen in Figure 1 below.


Figure 1. The unedited disconnection window.
Click the image for a larger version

•The disconnection window is defined in the script presented by the resource hacker. By editing the script, you can make the disconnection window into an error window, disallowing the user to disconnect from an active session.
•To do this, first change the line "Control 401..." to "Control 400...". This will change the picture of a question mark on that window to a white X mark on a red background.
•Next, delete the OK button. Do this by clicking on the OK button and hitting delete.
•Next, click on the Cancel button and move it so that it is centered on the disconnection window. To change the text of the button from Cancel to OK, click onto the resource hacker's script section and edit the word Cancel to say OK.
•While you are editing the script of that window, you may also want to change the caption of that window to say "Restrictions" rather than "Disconnect Windows session".
•Lastly, change the main text box of the window. Instead of it saying "This will disconnect your Windows session..." you can put a custom warning message in there.
•If you feel like it, you can further customize that window by moving the button or icon around, making the text box smaller, or making the entire window smaller.
•After you are all done, click the Compile Script button near the top of the resource hacker's window. Figure 2, below, shows what my window looked like after I finished.


Figure 2. The edited disconnection window.
Click the image for a larger version

•Don't forget to save your edited mstsc.exe.

All done! Now when you log on using the hacked client and attempt to disconnect using the X box, you get the error shown below in Figure 3.
Just distribute this hacked mstsc.exe to your clients, and none of them will be able to disconnect using the X box. You could write a simple batch script that would push the mstsc.exe out to your users. Just be sure that the hacked mstsc.exe is compatible with the user's mstscax.dll.


Figure 3. The window we edited in previous steps now prevents the user from disconnecting.
Click the image for a larger version

Caveats: Creative users can still disconnect
•While this hack will disable the X box on the terminal services client, a creative user can still kill the mstsc.exe process and disconnect the session. By going into your terminal services configuration, you can force all disconnected sessions to be reset, rather than being moved into the disconnected state.

And...no tutorial would be complete without a download, so here is the version I created (compressed):
MSTSC.zip