[omniORB] omniNames.exe and the -start parameter. omniNames as an NT service.
Dietmar May
dcmay@object-workshops.com
Wed, 22 Sep 1999 14:26:54 -0400
------ =_NextPart_000_01BF0506.868AA8C0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
> Actually, I was thinking more about your code, and had the=20
> thought that I
> have never investigated how to write an application as an=20
> actual NT service.
> I'd kind of like to take a look at your source as well.
Here is the source code for our NT service. What's missing is code to =
shut down the service when it stopped, as well as to register the server =
with NT.=20
We use INSTSRV.EXE, which is available in the NT Resource Kit (the 3.5 =
ResKit is - or was recently - still available on Microsoft's FTP site. =
Some of the apps don't run under 4.0, but many still do). But it would =
be a lot cleaner if the app could register itself as a service. Maybe =
someone else can contribute that code?
Regards,
Dietmar
------ =_NextPart_000_01BF0506.868AA8C0
Content-Type: application/octet-stream; name="SRVNAMES.CPP"
Content-Transfer-Encoding: base64
Ly9saW5rIHdpdGggQURWTElCMzIuTElCDQoNCiNpbmNsdWRlIDxzdGRpby5oPg0KI2luY2x1ZGUg
PHByb2Nlc3MuaD4NCiNpbmNsdWRlIDx3aW5kb3dzLmg+DQoNClZPSUQgV0lOQVBJIEN0cmxIYW5k
bGVyIChEV09SRCk7DQp2b2lkIFdJTkFQSSBTZXJ2aWNlTWFpbiAoRFdPUkQsIExQVFNUUiopOw0K
Y29uc3QgY2hhciogcHpfU2VydmljZUNtZCAgPSAib21uaU5hbWVzIjsNCmNvbnN0IGNoYXIqIHB6
X1NlcnZpY2VOYW1lID0gIm9tbmlOYW1lcyI7DQpTRVJWSUNFX1NUQVRVU19IQU5ETEUgaF9TZXJ2
aWNlID0gMDsNCmludCBiX1J1biA9IFRSVUU7DQppbnQgcGlkID0gMDsNCg0KaW50IG1haW4gKGlu
dCBhcmdjLCBjaGFyKiBhcmd2W10pDQp7DQogICAgU0VSVklDRV9UQUJMRV9FTlRSWSB0YWJsZVtd
ID0NCiAgICB7DQogICAgICAgIHsgKGNoYXIqKXB6X1NlcnZpY2VOYW1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