Saturday, October 18, 2008

Hibernate Button in ShoutdownBox

Today we will try to play with a system file “msgina.dll”. We will modify that file to enable hibernate button in shutdown box.



Files with .dll extensions are precompiled system files of windows and it can only be modified by software Resource Hacker ( Or, you can get it from here). Also, we have to replace the original system file with the new one. This is a bit tricky.
Windows file protection (WFP) service prevents programs from replacing the critical Windows system files. Program must not overwrite these files because they are used be operating system and by other programs.

Still, it can be achieved by a software called Replacer.
After downloading these 2 softwares, now comes the most important part.
Before you go and start modifying the file “msgina.dll”, it is EXTREMELY EXTREMELY important that you make a backup of the file. Go to your Windows/System32/ directory and you see the file there. Make a copy of it (Right-click, “Copy”) and then store it somewhere else, wherever you like. In case your file gets corrupted, it can easily be recovered by recovery console( A Windows CD is required for this). If this part is not clear, please tell me, I will explain each and every step.
So, now let’s concentrate on modifying the file as per our requirement.
1) Start Resource Hacker and open the msgina.dll file by selecting “File”, then “Open” (or Ctrl + O).Alternately, you can open %windir%\system32\msgina.dll file into Resource Hacker.
2) Goto Dialog -> 20100 -> 1033.
3) Replace existing code with the following code:-


20100 DIALOGEX 0, 0, 208, 122
STYLE DS_SYSMODAL DS_SETFOREGROUND WS_POPUP WS_BORDER
CAPTION “”
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, “MS Shell Dlg”
{
CONTROL “Flag”, 20101, STATIC, SS_OWNERDRAW WS_CHILD WS_VISIBLE, 176, 0, 32, 26
CONTROL “Turn off computer”, 20102, STATIC, SS_OWNERDRAW WS_CHILD WS_VISIBLE, 7, 0, 162, 26
CONTROL “&Stand By”, 20104, BUTTON, BS_OWNERDRAW BS_NOTIFY WS_CHILD WS_VISIBLE WS_TABSTOP, 47, 48, 22, 20
CONTROL “T&urn Off”, 20103, BUTTON, BS_OWNERDRAW BS_NOTIFY WS_CHILD WS_VISIBLE WS_TABSTOP, 93, 48, 22, 20
CONTROL “&Restart”, 20105, BUTTON, BS_OWNERDRAW BS_NOTIFY WS_CHILD WS_VISIBLE WS_TABSTOP, 142, 48, 22, 20
CONTROL “&Hibernate”, 20106, BUTTON, BS_PUSHBUTTON BS_NOTIFY WS_CHILD WS_VISIBLE WS_TABSTOP, 79, 94, 48, 20
CONTROL “”, 20108, STATIC, SS_OWNERDRAW WS_CHILD WS_VISIBLE WS_DISABLED, 22, 73, 50, 8
CONTROL “”, 20107, STATIC, SS_OWNERDRAW WS_CHILD WS_VISIBLE WS_DISABLED, 79, 73, 50, 8
CONTROL “”, 20109, STATIC, SS_OWNERDRAW WS_CHILD WS_VISIBLE WS_DISABLED, 136, 73, 50, 8
}
Now, save that file in some other location say, at the desktop. Remember to give the new file the same name i.e. msgina.dll.
Once you are done with modifying the system file and saving it at some other location with the same name, you would need to replace the old file with the new one.
Start Replacer and follow the steps:-
1) Drag the original file into the command prompt window.
2) Hit ENTER
3) Now drag the newly created file (which you have saved to some other location) into the command prompt.
4) Press Y (yes)
5) Restart your computer


That’s it after restarting you will see a hibernate button enabled in the shutdown dialog box.
If you face any problem related to the procedure mentioned above, please feel free to ask me.DON’T FORGET TO MAKE A BACKUP COPY OF THE ORIGINAL SYSTEM FILE.
My upcoming posts will put more light on Resource Hacker. The things we could do by this great little system files modification utility. Stay tuned.

No comments: