Breaking Up (shared services) Is(n't) Hard To Do

The last time I wrote, I talked about shared services. One of the problems of working with shared services is that sometimes one service in the process gets in the way of other services.

For the audio service, it lives in the "networking services" service host (because the networking services svchost is used for all services that run as LocalSystem).  But, because it runs in the same process as the networking functionality, it means that it can be quite difficult to debug the audio service, especially if you're using a source level debugger - if your debugger has to talk to the network, and portions of the networking stack are suspended (by the debugger) it can be hard to make things work...

It turns out that there's a remarkably clever trick that can be used to split a normally shared service into its own process. 

From a Windows command prompt, simply type:

C:\>sc config <servicename> type= own

To move the service back into its normal shared config, type:

C:\>sc config <servicename> type= share

The SC tool should be in the system32 directory on all XP installations, if not, it's in the platform SDK (I believe), and obviously you need to be an administrator to make this work.

I can't take credit for this, it was shown to me by one of the NT perf guys, but I like it sufficiently that it's worth sharing.

 

One more caveat: Before people start trying this on their XP system, please note that there's a reason that those services are in the same process.  Splitting them up will cause your system to use a LOT more memory, and WILL make your system unstable.  I'm posting this trick because it can be quite useful for people who are developing their own shared services.

Several of the built-in services assume that they're in the same address space as other services, and if they start running in separate processes, they will crash in strange and mysterious ways, if you're not careful, you can render your machine unbootable.

Just don't go there, it wouldn't be prudent.