Forum posts for spoolsv.exe

Limiting an ATL exe server to one process (instance) only

I have an ATL exe server written with C++ (Visual Studio 2010, with merging the proxy-stud dll). The executable is compiled for Windows 7 x86 & x64. The following happens on both architectures:

The ATL exe server should function as a 'server process', that is - one process (MyATLServer.exe, ONLY one!) should exists per machine and many clients (let's keep it simple: on the same machine) are consuming COM objects from it. The server saves application state (in memory) and all clients should 'share' this sate, by using the server's exposed COM objects.

The exe server usually starts when the system starts because it is invoked by a COM call to create one of it's hosted objects. The call originates from within the spoolsv.exe process (Print spooler service). This causes the server process to run under the 'SYSTEM' user (I guess due to the fact that spoolsv.exe runs with 'SYSTEM').

When one of the clients creates a COM object from the ATL server, another process (MyATLServer.exe again) is instantiated (running under the user who's logged in to Windows), thus, it cannot share application state with the 'original' one (which is running under 'SYSTEM'). A second client will connect to the one instantiated by the logged in user (the 'second one').

After searching countless forums on the WEB I've managed to get to the following conclusions:

1) My ATL server uses the default (auto-generated by VS2010) ATL-Module which inherits from ATL::CAtlExeModuleT<>. Digging into the ATL headers I'm positive that this module calls AtlComModuleRegisterClassObjects with the correct flags for this kind of use (dwClsContext = CLSCTX_LOCAL_SERVER, flags = REGCLS_MULTIPLEUSE | REGCLS_SUSPENDED). So it rules this one out.

2) Using start -> run -> dcomcnfg -> DCOM Config -> MyATLServer -> Properties I've set the 'This user' option under the 'Identity' tab (with the local administrator user). In the 'Location' tab, the option 'Run application on this computer' is not selected and grayed-out. This caused me to search again and I got here: http://social.technet.microsoft.com/Forums/en-US/w7itprosecurity/thread/4f63ee11-e472-40f9-85db-a6b235d7579c.
The link explains that the x64 version of the dcomcnfg utility is buggy and one should use the 32-bit version of it on x64 Windows (start->run->'mmc comexp.msc /32'). After checking it on two system (one of each) I found out that the 'Run application on this computer' option is grayed out and not selected on both.

From this point I'm totally lost (and trying to suppress the frustration... :-)).
Am I on the correct path? Did anyone do this before?

Or the original intent - How do I make my ATL exe server 'singled-processed'?

Thanks!

Omri

View complete forum thread with replies

Other posts related to spoolsv.exe

See Related Forum Messages: Follow the Links Below to View Complete Thread

How can I automate the Tasklist command on my workstation to check a specific process on X n&hellip;
Calling fopen on Windows core files returns NULL pointer
How to check if service spoolsv.exe is responding to requests without printing?
Spooler memory increases when System.Printing.Printqueue object is created
Limiting an ATL exe server to one process (instance) only
Squeezing more speed out of Windows print spooler

What is the carbon footprint of your coffee?

Is it low? Is it high? Can this things really kill the planet Earth? Maybe the answer will surprise you. Maybe not.