July 31, 2008

Windows XP Home Edition (HE) does not come with or support Remote Desktop, or Terminal Services feature. There is Remote Desktop Connection (RDC) client which allows user to connect to remote host, but now accepting any remote desktop connection to the Windows XP Home PC. However, there is way to install and enable Remote Desktop Protocol (RDP) in Windows XP using the trick below.

Note that if you just want to be able to remote control the desktop of the computer running on Windows XP Home Edition, it may be easier and wiser to use the free VNC as alternative instead. One such VNC server and client is UltraVNC.

To run Remote Desktop Terminal Services (server component) in Windows XP Home Edition, the operating system must first made to recognize itself as Windows XP Professional Edition. To do so, follow the guide to convert Windows XP Home to Windows XP Professional.

Confirm that the OS is now Windows XP Professional Edition by going to System Properties, by right clicking on “My Computer” and select “Properties”. Then download and install DevCon (direct download link to devcon.exe), a command-line utility functions as an alternative to Device Manager.

devcon.exe is a self-extractor executable. Execute “devcon.exe” and choose a folder to unpack the content. devcon.exe will create two folders inside the selected path - i386 and ia64.

Open a command prompt window (Cmd), and the change directory into the i386 folder extracted by DevCon. Then run the following command to reinstall rdpdr driver:

devcon.exe -r install %windir%\inf\machine.inf root\rdpdr

Restart the computer after running the command.

At this stage, Windows XP ‘Professional’ which is converted still does not have the necessary Terminal Services related settings in the registry to run the Remote Desktop. To reinstall and enable Terminal Services in Windows XP Home turned Professional OS, download and run the enable_tsxp.bat batch script (also support enable TS in Windows 2000), which will create a .reg file to merge the required Terminal Services values to registry and bootlog. Reboot after patching the registry.

After reboot, the Terminal Services is running and ready to accept incoming Remote Desktop Connection session. To verify the Terminal Services is actually running, go to Control Panel -> Administrator Tools -> Services, and locate the “Terminal Services” entry. If the service is not started, start it manually. There won’t be a “Remote” tab in System Properties, and ensure that the port 3389 (the default port for Remote Desktop) is open in firewall.

Note that the registry settings enable the automatic logon feature, where the system will auto login administrator on local console on every system startup without prompting for password, nor allowing user to select account to log on. To disable this feature, run Registry Editor (regedit), and navigate to the following registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon

Change the value data for “AutoAdminLogin” from “1″ to “0″.

Convert and Upgrade Windows XP Home to Professional Without Reinstalling


After installing Windows XP Home Edition or Windows XP Professional Edition onto a computer, officially it’s impossible for user to convert, or upgrade from Windows XP Home to Pro edition, or downgrade from Windows XP Professional to Home edition without reformatting and reinstalling the operating system from clean and fresh state.

A lot of people always associate conversion of Windows XP edition to illegitimate or privacy reason, but sometimes, there may be legitimate and genuine reason for change, such as customer, who all the while using Windows XP Home Edition (HE) finally buy a genuine license product key for Professional edition to replace the illegal pirated version installed, or user receives additional license as gift, but don’t want to go through clean install Windows XP again, or want to keep using the computer with all data intact without interruption.

Here’s a trick to convert and turn Windows XP Home Edition to Windows XP Pro Edition, from within the operating system without going through installation again. Ok, let’s be frank. The hack doesn’t actually install and add in all the features from Windows XP Professional that Windows XP Home lacks of, such as Remote Desktop Server (see guide to install Remote Desktop on XP Home) and Group Policy Editor (GPedit) utility tools, which has been removed on Windows XP Home edition. Some functions which turned off and disabled via integrated switches which read from registry flag whether it’s Home or Professional edition, such as EFS, RAID support and ability to join domain, may or may not work after migration. Basically, the trick only work to let Windows XP recognizes itself as Professional edition.

To convert and upgrade Windows XP Home to Windows XP Professional, follow procedure below.

  1. Open Registry Editor (regedit).
  2. Navigate to HKEY_LOCAL_MACHINE/SYSTEM/ControlSet00X/Control/ProductOptions, where ControlSet00X is the one with the highest number.
  3. Delete the ProductSuite registry key.
  4. Then, create a new DWORD value and named it as Brand.
  5. Set the “Brand” value data as 0.
  6. Reboot the system.
  7. On boot up after the BIOS screen, press F8 to display Windows XP Startup Menu.
  8. Choose Last Known Good Configuration (LNG) and hit Enter.

Windows XP will start up as usual. After logging into the desktop, check the system properties to verify that it’s now Windows XP Professional.

July 29, 2008

timeout for connect()

How can I set the timeout for the connect() system call?

First, create the socket and put it into non-blocking mode, then call connect(). There are three possibilities:

  • connect succeeds: the connection has been successfully made (this usually only happens when connecting to the same machine)
  • connect fails: obvious
  • connect returns -1/EINPROGRESS. The connection attempt has begun, but not yet completed.

If the connection succeeds:

  • the socket will select() as writable (and will also select as readable if data arrives)

If the connection fails:

  • the socket will select as readable *and* writable, but either a read or write will return the error code from the connection attempt. Also, you can use getsockopt(SO_ERROR) to get the error status - but be careful; some systems return the error code in the result parameter of getsockopt, but others (incorrectly) cause the getsockopt call *itself* to fail with the stored value as the error.
More at : http://docs.linux.cz/programming/c/sock-faq/unix-socket-faq-3.html#ss3.5

write multiple lines into a file in script

cat (refereed to as HERE document), see more at http://en.wikipedia.org/wiki/Heredoc:

cat >tempfile.txt < abc
> def
> acb
> DELIM
tzhang@colinux:~/temp$ cat abc
abc
def
acb
tzhang@colinux:~/temp$


By default variables and also commands in backticks are evaluated:

 $ cat <<> Working dir $PWD
> EOF
Working dir /home/user

This can be disabled by setting the label in the command line in single or double quotes:

 $ cat << "EOF"
> Working dir $PWD
> EOF

Working dir $PWD

Appending a minus sign to the <<>

---------------------------------
echo with quote:

echo "abc
def
acb" >tempfile.txt

----------------------------

July 25, 2008

VIM New Trick

'' (two single '): Go back to position before Jump
'" (one single, one double): go back to position at last edit

More info at: http://tnerual.eriogerg.free.fr/vimqrc.html

July 1, 2008

Skype with automatic exention dialing for conference

I have created this program, named MySkype, to use enable skype to automatically dial conference extensions.

Simply type "myskype phonenumber,extension" to use it.

You can add multiple "," between the phone number and the extension. Every "," causes 1 extra second of sleep before the extension is dialed.

Download it Now at http://yufengtu.com/pub/myskype/myskype.exe

Example use:

myskype.exe 1800goog411,,90630

will dial google 411, wait 2 seconds, and put in 90630 as the zip code.