K-Meleon's loader application (loader.exe) keeps an instance of the browser (k-meleon.exe) running in background to accelerate loading. However, the loader seems to not correctly interact with the Windows 2000 and Windows XP user environment. When you log off from such a system with the loader running, the loader process - and thus the k-meleon process - is simply killed. The effect is similar to the case where K-Meleon crashes: The disk cache is left behind in an inconsistent state and is "trashed" when K-Meleon is accessing it the next time. Your cached data is lost. This happens after each and every logoff/logon.
The easiest workaround is to manually "Exit" the loader before logoff. A more convenient way is to make a script "Exit" the loader before logoff. Unfortunately, this script can't be executed automatically by setting it up as a logoff script in your Group Policy. This is because logoff scripts are executed after exiting the user environment. In simple words: Too late, the loader process is already killed!
The second best possibility is to use the script, that is exiting the loader, itself to log off/reboot/shut down:
Download ShutdownK-M.wsf:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!-- ShutdownK-M.wsf - by kko -->
<package>
<job>
<?job error="false" debug="false" ?>
<script language="JScript">
<![CDATA[
var LinkShell = new ActiveXObject("WScript.Shell");
function LinkSave(Name,Comment,Param,HotKey) {
var File = LinkShell.SpecialFolders("Desktop") + "\\" + Name + ".lnk";
var Link = LinkShell.CreateShortcut(File);
Link.TargetPath = WScript.FullName;
Link.Arguments = "//Job:Shutdown \"" + WScript.ScriptFullName + "\" " + Param;
Link.Description = Comment;
Link.HotKey = HotKey;
Link.Save();
}
LinkSave("Exit Windows","Same as \"Start\" > \"Exit...\"","Ask","");
LinkSave("Instant Logoff","Logs you off without asking for confirmation.","0","");
LinkSave("Instant Reboot","Reboots computer without asking for confirmation.","2","");
LinkSave("Instant Shutdown","Shuts down computer without asking for confirmation.","8","Ctrl+Alt+Ext+End");
]]>
</script>
</job>
<job id="Shutdown">
<?job error="false" debug="false" ?>
<runtime>
<description>Shuts down the K-Meleon loader (if running) and then shuts down Windows.</description>
<unnamed name="//Job:Shutdown" helpstring="Shutdown" many="false" required="true" />
<unnamed name="Variant" helpstring="Variant of shutdown to perform" many="false" required="true" />
</runtime>
<script language="JScript">
<![CDATA[
if (!WScript.Arguments.length) {
WScript.Arguments.ShowUsage();
WScript.Quit();
}
function Shutdown_KML() {
// shutdown K-Meleon's loader application
var s = new ActiveXObject("WScript.Shell");
// get all instances of loader.exe
var t = new Enumerator(GetObject("winmgmts:").ExecQuery("Select * from Win32_Process where name='loader.exe'"));
// for each instance (normally there is only one)
for (t.moveFirst(); !t.atEnd(); t.moveNext()) {
// create another instance
s.Run("\"" + t.item().ExecutablePath + "\"");
// wait a moment
WScript.Sleep(50);
// a window pops up, asking whether we want to close the loader
// give it the focus
s.AppActivate("Previous Instance Detected");
// wait a moment
WScript.Sleep(50);
// the "Yes" button has the focus, so we simply send an "Enter"
s.SendKeys("~");
// wait a moment
WScript.Sleep(50);
// now the loader is properly shut down
}
}
function Shutdown_Win() {
// call "Exit Windows" dialog
var t = new ActiveXObject("Shell.Application");
t.ShutdownWindows();
}
function Shutdown_WMI(intFlag) {
// shutdown via Windows Management Instrumentation (WMI required)
// valid parameters :
// 0 : log off
// 1 : shut down Windows (not computer)
// 2 : reboot the computer
// 8 : shut down Windows and power off computer
// 4 : force flag (add to the values above)
var t = new Enumerator(GetObject("winmgmts:{(Shutdown)}").ExecQuery("Select * from Win32_OperatingSystem"));
for (t.moveFirst(); !t.atEnd(); t.moveNext()) t.item().Win32Shutdown(intFlag);
}
Shutdown_KML();
var t = parseInt(WScript.Arguments.Unnamed.Item(0));
if ((t==0)||(t==2)||(t==8)) Shutdown_WMI(t); else Shutdown_Win();
]]>
</script>
</job>
</package>
Now move the script to its final location (I suggest somewhere in you Program Files directory) and execute it there. The script will create some shortcuts on your desktop linking to itself. The shortcuts' names and comments are self-explaining. As long as you use these shortcuts to log off/reboot/shut down, your disk cache will be fine!
To watch the script shut down the loader, increase the 50 milliseconds delays in function Shutdown_KML() to one or to seconds.