[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.sdk

Various options installing Service

Eugene Lerner

10/15/2003 12:57:00 PM

I have a 'Windows Service' application with service
installer. I'd like to know -

1. Installer successfully creates private NT event log
(additionally to 'Application', 'Security',
and 'System'). I need to set maximum log size
and 'Overwrite events as needed' option programmatically.
There seems to be no way to do this from Framework
library although both options are available from standard
event log viewer.

2. I need to set "Allow Service to interact with the
desktop" option from service installer.

Please advice who knows how to accomplish these tasks.

Thank you very much in advance.

1 Answer

jslin

10/16/2003 11:44:00 AM

0


Hi Eugene,

The Windows NT/Windows 2000 Event Log service currently maintains three log
files: Application, Security, and System. Each of these log files has a
section in the Windows NT/Windows 2000 registry under the following
hierarchy of keys:

HKEY_LOCAL_MACHINE
SYSTEM
CurrentControlSet
Services
Eventlog

Within each section, there are four values: File, MaxSize, Retention, and
Sources. The following table lists these values.


File

REG_SZ_EXPAND

Path to the log file. This value can include environment variables.

MaxSize

REG_DWORD

The log file's maximum size in bytes. This value must be between 64K and
419,240K and can only be incremented in 64K chunks.

Retention

REG_DWORD

Overwrite policy of the log file.

Sources

REG_MULTI_SZ

List of sources from which logged events can come.



The Retention value can be set to:

* 0, indicating that any entry can be overwritten when necessary.
* 1 through 365, indicating that events that have been in the log file for
one year or less can be overwritten.
* 4294967295, indicating that nothing can be overwritten.


2. There is no way to do that in .Net. This is a major security risk -
windows services running in the background, logged on as a user different
than the
desktop user (and in the worst case, as LocalSystem), can be attacked from
the
desktop if they open UI. When they open UI, a rogue desktop app can send
corrupted
window messages to it, overrun buffers, and elevate privileges.

If you would still like to do it, you can use unmanaged way of calling
CreateService with the necessary flag. Pleas refer to KB Q115825 give below.

http://support.microsoft.com/...

Thanks

Jian Shen

This posting is provided "AS IS" with no warranties, and confers no rights.