Dusty Cables dot com

a tech blog

Tag Archives: Windows

Install any Windows application as a service

December 24th, 2008. Published under Uncategorized. No Comments.

This is very handy for making applications run before user login on a Windows box.  The instructions are pretty simple:

  1. Acquire instsrv.exe and srvany.exe from the Windows Server 2003 Resource Kit.  You can put these files wherever you want, but it is probably best to dump them into %WINDIR%\System32 (which is usually “C:\Windows\System32″ on Windows XP.  The srvany.exe application must remain where you put it because the service is going to use it to run your application.
  2. Open a command prompt (Start -> Run -> type “cmd”) and change directory to where you put these files.
  3. Type “instsrv ServiceName PathToSrvany.exe.  For example, if I desire the name of the service to be BiteMe and I saved the executables where I suggested in Step 1, I would type “instsrv BiteMe C:\Windows\System32\srvany.exe”.
  4. Lauch the Registry Editor (Start -> Run -> type “regedit.exe”) and navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ServiceName.  Right-click the key named ServiceName and select New -> Key.  Name the new key “Parameters” and click it.  Right-click the new Parameters key and select New -> String Value.  Name this new String (REG_SZ) Value “Application” and set the value data to the path to the executable of the application you desire to make a service.  So if I wanted to make Firefox run as a service, I would put “C:\Program Files\Mozilla Firefox\firefox.exe” in the value data field.
  5. OPTIONAL: Services usually just run in the background and do not need to be messed with.  However, if you must interact with this service, you’ll want to open the Services snap-in (I like to use Start -> Run -> type “services.msc” to launch it) and find your new service in the alphabetical list.  Right-click it and select Properties (or just double-click it).  On the Log On tab, check the checkbox that says “Allow service to interact with desktop”.  This will allow you to interact with the GUI of the application.
  6. ALSO OPTIONAL: You can add dependencies, which are other services that must be running prior to this service to start, by adding a Multi-String value to the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ServiceName key called “DependOnService”.  In this value you put the actual service name (not the “display”) service name, one service name per line.  You can see the actual service name by opening the properties of the service from the Services application.  For example, if you wanted to add a dependency for the Windows Time service, you would add “w32time” to the DependOnService value.

That’s about it.  The service you just made will show up as srvany.exe in the process list, just like many Windows services run under svchost.exe.  If you want to see what services are running under either of these processes, you can use the following command in a comand prompt:

tasklist /svc /fi “Imagename eq svchost.exe”

or

tasklist /svc /fi “Imagename eq srvany.exe”

Try it out.

Oh, also worth mentioning is removing your service if desired.  You can do this by typing “instsrv ServiceName remove”.

Quickly enable and disable Aero in Windows Vista

November 21st, 2008. Published under Uncategorized. No Comments.

There are many articles out there on this already, but I think this one on Tweaking with Vishal is one of the better.  Vishal lists not only the command line arguments…

Activate Aero:

rundll32 dwmApi #102

Deactivate Aero:

rundll32 dwmApi #104

…but also gives directions to add these commands to both the Desktop context menu and the My Computer context menu.  Very cool.

Remote Desktop (Server) in Windows XP Home Edition

November 14th, 2008. Published under Uncategorized. No Comments.

The folks over at My Digital Life have a blog post that explains how to install the necessary files for Terminal Services and trick the OS so Windows XP Home Edition will allow incoming Remote Desktop sessions.  Frankly, the lack of Remote Desktop in Home edition is the biggest drawback to this version of XP.  Still, I’m a huge fan and pretty much an everyday user of UltraVNC, but that isn’t as easy to set up for non-technical persons like the built-in Remote Desktop application.  Anyway, go check out the article.

Windows 7 news

October 29th, 2008. Published under Uncategorized. No Comments.

There have been a number of Windows 7 articles recently, due to Microsoft flaunting it the Professional Developers Conference in LA this week.  I’ve been reading up on a few of them and am a bit excited about Windows 7.  But then again I was excited about Vista before it was released, and we won’t talk about how that went.  Still, as Gizmodo is pointing out, Windows 7 is looking like what Vista should have been.  Check out these two Gizmodo articles:

Windows 7 Walkthrough, Boot Video and Impressions

Giz Explains: Why Windows 7 Will Smash Vista

Old Java packages are still a security risk

October 1st, 2008. Published under Software Tools. No Comments.

This baffles me. Sun Microsystems, the company who produces Java, which is commonly used as a web browser plugin, occasionally offers updates to Java. These updates are almost always due to someone discovering an exploitable security hole and Sun patching that hole. This makes perfect sense and frankly is a necessity. However, what I don’t get is why Sun would then leave the old, insecure versions of Java installed. ALL of the old versions. I’ve seen Windows computers with ten or so versions of Java installed. What’s worse, malicious users who know how to exploit these security holes can easily access the older versions of Java still present, thereby defeating the entire purpose of upgrading Java to the most recent version. What’s with this, Sun?

The old versions of Java should be removed unless you know you have software that requires an older version. If that is the case, then you are stuck with the security issue as well. If not the case, which should be most people, then all of the old Java packages should be uninstalled. This used to be a tedious process using Add/Remove Programs, uninstalling one at a time. No longer!

Javara is a tiny utility that removes all old Java packages with the click of a few buttons. It logs all changes it makes as well. You can also use it to make sure you have the latest version of Java. I’ve recently discovered this utility and I now use it regularly. Go check it out and make your computer more secure!

Bad USB cable knocks out other USB devices

July 3rd, 2008. Published under Uncategorized. No Comments.

Here’s a lesson learned that took a few hours.  Just last week, someone asked me to help them with their iPhone suddenly not synching their Outlook info.  I confirmed this was actually working previously.  When plugging in the iPhone, Windows XP gives the standard “USB Device not recognized” error message balloon.  Hmm, ok, let’s begin troubleshooting.

I install iTunes and restart.  No go.  I uninstall iTunes, restart, reinstall iTunes, restart.  No go.

Someone else has an iPhone in the office, so let’s see if the first iPhone works with the other computer.  Yes, it does, so the iPhone is OK.  Let’s try this other person’s iPhone USB cable on the computer giving the error.  No, it doesn’t work either, so the USB cable is OK.

Its starting to look like a USB issue, so I pull out my Cruzer Titanium USB thumb drive.  Ah ha!  The thumb drive fails, so there is definitely a USB issue here.  I try the thumb drive and the iPhone in different USB ports.  No go.  I download the latest Intel chipset drivers, pull out all USB connections (there was also an HP LaserJet 3050 All-in-one plugged in), and restart.  After logging in, I plug in the iPhone.  It’s recognized – bingo!  I plug in my thumb drive and it is also recognized.  OK, at this point I’m thinking there was a corrupted USB driver and the issue is gone.  I plug in the USB cable for the HP LaserJet 3050 again and send a test print.  Test print works.

OK, let’s restart one more time to make sure everything is going to work after I walk away.  Unplug the iPhone and put my thumb drive back in my pocket.  Restart.  Plug in iPhone.  USB device not recognized.  What?  But it all just worked fine?!??!

Try my thumb drive again.  No go.  Send a test print.  Test print comes out fine, so the printer is still working.  What the heck is going on here?  I’m two hours into this by now (iTunes installs were slow and restart and logging in isn’t the fastest thing either), and I’m still scratching my head.  I unplug the printer again, and the iPhone and thumb drive work!  I plug in the printer again and the test print works, but the iPhone and thumb drive do not.

Then I notice the USB cable for the LaserJet was rather stretched, since the printer was somewhat far from the comptuer.  The cable didn’t touch the floor anywhere, so coming out of the computer the cable was bent about 90 degrees.  Could it be a bad cable?  I grab another USB cable and swap.  Test page prints fine AND the iPhone and thumb drive work as well!  Bingo.  This is the first time I have ever seen a bad USB cable actually work for the perhiperal it is plugged into but make all other USB devices on the computer fail.

I just hope this post saves someone else from 2.5 hours of frustration.