Search code examples
inno-setupevent-log

Install Application EventLog with InnoSetup


I want to install/create my own event log at install time using Inno Setup.

After a little bit of searching I found the key that needs to be created for nt source ...

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\eventlog\Application\[Source]

And it has an EventMessageFile value to log the messages themselves, (I think).

But I want the event source to be created during setup, (and run elevated if need be).

How can this be done?

And if the correct way is indeed to use the registry, what EventMessageFile must I use?

NB: When the app is running it is not elevated so it cannot happen at run time.


Solution

  • Yes, indeed, you create a key like

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\eventlog\Application\MyLog
    

    And set value EventMessageFile to point to a DLL file that contain description strings for your events.

    [Registry]
    Root: HKLM; \
        Subkey: "SYSTEM\CurrentControlSet\Services\EventLog\Application\MyLog"; \
        ValueType: string; ValueName: "EventMessageFile"; ValueData: "{app}\MyLog.dll"
    

    See Message Files article.