Friday, November 16, 2012

A shortcut to launch a recent download

When download files in a browser, I prefer to save all the files to a specific location instead of allowing the browser to "open" the file. This means that to invoke the download I have to go to an Explorer window or command prompt and manually select/run the file.

So I chose to create a shortcut on my Quick Launch (yes I still use it in Windows 7) to automatically launch my "most recent download".

This isn't a particularly complex task or hard to figure out, but I thought I'd document it here anyway. There are probably better ways to do it too, but I'm most familiar with Windows Batch approaches to automation.

Step 1: Write a Batch File

I created a NEW_DOWNLOAD.BAT file and placed it on my system somewhere. The contents are:

@echo off

call :latest e:\download\*.exe ^
             e:\download\*.rar ^
             e:\download\*.zip ^
             e:\download\*.pdf

if "%LATEST%"=="" goto :eof
echo E:\DOWNLOAD\%LATEST%

if "%1"=="" "E:\DOWNLOAD\%LATEST%"
if not "%1"=="" copy /y "E:\DOWNLOAD\%LATEST%" "%1"
goto :eof


:latest
FOR /F "delims=" %%I IN ('DIR %* /B /O:-D') DO (
   SET "LATEST=%%I"& goto :eof
)
goto :eof



Basically what this does, is search my E:\DOWNLOAD folder for all .EXE, .ZIP and .RAR files, and launches the most recent one. You could add additional file types here if you wanted to.

Step 2: Add a Shortcut

I added a shortcut to NEW_DOWNLOAD.BAT and placed it on my Quick Launch bar. I configured it to launch Minimized, and gave it a custom icon from SHELL32.DLL to distinguish it. I also added a keyboard hotkey for the shortcut (CTRL-SHIFT-L.)


Step 3: Set it and Forget it

Now, when I download something, I just click on the Quick Launch shortcut or press my keyboard hotkey, and automatically my most recent download starts running.


For reference, I use a similar script now to "Display the most recent PDF file" in another folder, in combination with CreatePDF as my default print driver, to print/save and verify document output.

Tuesday, September 4, 2012

Linux "Welcome to GRUB" hang on IBM x3200 Server

I recently had to migrate a working linux/debian server image over to a "new" machine, an IBM x-Series M3 x3200 (machine type m/t 4362-PAT.)

Normally server installations of Linux are decent about body transplants across the same architectures, so I was surprised to find that the disk wouldn't boot on the new system.

The symptom was a very slow display of "GRUB" then "GRUB loading" then finally a hang on the "Welcome to GRUB" screen.

The first thing I did was boot on the Debian netinst CD for my install and choose the rescue option, and re-install GRUB onto the boot partition, but this did not fix the problem.

After further research, I cam across this post which suggested the cure to my problem: I needed to disable the graphical mode for GRUB and only use the traditional console mode boot. On my system, this was done by editing the file /etc/default/grub, and enabling the following setting:

# Uncomment to disable graphical terminal (grub-pc only)
GRUB_TERMINAL=console                               

After making this change, the system boots like a champ!

Monday, August 13, 2012

A canonical list of Windows service names for antivirus and antimalware tools

I had a need to modify some code to check for the presence of a range of anti-virus and anti-malware tools running as a service on a Windows system.

As a background, my purpose was to find different AV services and, if multiple AV tools are starting up and running, to delay an operation until the services had finished initialising (ie, in the RUNNING state.)

As part of this exercise, I could not find a list of Windows services names for the common anti-virus tools available [let me know if you know where one is!] So while the information is not too hard to dig up for each tool, I decided to document this list here for future reference.

  • symantec antivirus:: Symantec Endpoint Protection
  • mcshield:: McAfee Security
  • windefend:: Windows Defender
  • msmpsvc:: Microsoft Security Essentials
  • msmpeng:: Microsoft Security Essentials
  • savservice:: Sophos Antivirus
  • aveservice:: Avast!
  • avast! antivirus:: Avast!
  • immunetprotect:: Immunet Protect
  • fsma:: F-Secure
  • antivirservice:: AntiVir
  • avguard:: Avira
  • fpavserver:: F-Protect
  • pshost:: Panda Security
  • pavsrv:: Panda AntiVirus
  • bdss:: BitDefender
  • abmainsv:: ArcaBit/ArcaVir
  • ikarus-guardx:: IKARUS
  • ekrn:: ESET Smart Security
  • avkproxy:: G Data Antivirus
  • klblmain:: Kaspersky Lab Antivirus
  • vbservprof:: Symantec VirusBlast
  • clamav:: ClamAV
New additions:
  • SBAMSvc:: Vipre / GFI managed AV
  • navapsvc:: Norton
  • AVP:: Kaspersky

Note that this is a reference to the Windows "Service name" value for the tool, as opposed to the Display name or Executable/Process name.

Many of these are based on web searches and information found online and have not been verified personally. Certainly, this list is by no means complete or guaranteed accurate!

If I receive corrections or additions to this list or need to extend it, I will edit this post!


Thursday, July 12, 2012

Windows does not use my VPN connection DNS!

I have  problem on one of my systems where I frequently use my VPN connection to link to the office. The problem is that the DNS resolution always seemed to go through the main WAN connection system, and never defer to the VPN connection DNS servers.

It may be related to newer WAN DNS that return results and do web redirection for "unknown" connections, instead of returning no match.

After some basic searching, I cam across this post that had a solution:

Force Windows to Use a VPN's DNS Server

Going through these instructions solved my problem. I am running Windows 7 x64 and the solution took effect immediately upon restarting my VPN client.

For reference, this is what I did:

  1. Open Regedit.
  2. Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Linkage
  3. In the right pane, double-click Bind
  4. In the value text box, select the "\Device\NdisWanIp" item, press CTRL+X, click the top of the list of devices, and then press CTRL+V.
  5. Click OK, and then quit Registry Editor.
  6. Restart your VPN connection.

Friday, March 16, 2012

New iexplore.exe processes exit immediately and the page loads in a different process!

As part of some process management software that handles multiple web pages and web-based applications, I recently encountered some problems with Internet Explorer.

The symptoms of my problem:

  1. Attempt to launch a new page/web-app in a separate iexplore.exe process for Internet Explorer
  2. The process launches successfully but very quickly exits with rc=0.
  3. A new iexplore.exe is created that is not a child of the process I created, but of another existing Internet Explorer session.
  4. The requested content appears successfully under that other process
  5. My process/handle management logic is confused since it thinks something is broken!

After a brief amount of research, it turns out this is due to a change in Internet Explorer 8 (IE8) regarding how UI components, frames, tabs, and plug-ins are isolated into different processes. This is called "loosely-coupled Internet Explorer" or LCIE, and this is documented in two MSDN IE blog posts from Microsoft:

  • http://blogs.msdn.com/b/ie/archive/2008/03/11/ie8-and-loosely-coupled-ie-lcie.aspx
  • http://blogs.msdn.com/b/askie/archive/2009/03/20/how-to-i-determine-which-ie-tabs-go-to-which-iexplore-exe-process-when-using-internet-explorer-8.aspx

While these changes are very useful from an end user point of view, for security and robustness reasons, they aren't what I need. Thankfully, Microsoft included a way of avoiding some aspects of this change in IE8 to mimic the process behaviour of previous versions:


The simple solution:

When manually launching an iexplore.exe process, add the following "-nomerge" command line option as part of the request.

"iexplore.exe -k -nomerge C:\path\app\index.html"

Once I modified my process manager to use this option, my existing logic that worked fine under IE6 and IE7 also works with IE8!