Event Viewer Message File

So I’ve seen this question asked in the past, but so far have not seen any answers as to how it can be resolved.

From within a console or service application when I write to the log:

System.Log(System.LogLevelInformation, "Service Started")

The event is shown in the Windows Application log. The issue is the beginning of the log entry states the following:

The description for Event ID 1000 from source DebugTestDebugWindowsService cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

I have created my own event message file following the directions found here:
https://www.eventsentry.com/blog/2010/11/creating-your-very-own-event-m.html

My simple message file contains the following:

;// Header
MessageIdTypedef=DWORD

LanguageNames=(
    English=0x409:MSG00409
)

;// Messages
MessageId=1000
SymbolicName=TASK_INFO
Language=English
Task Information: %1
.

I successfully compiled this into an event message file DLL, using the following commands:

mc.exe xojo_msgfile.mc
rc.exe /r xojo_msgfile.rc
link -dll -noentry -out:xojo_msgfile.dll xojo_msgfile.res

After creating the message file dll, I created the following registry entry for my service application that is running as DebugTestDebugWindowsService:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application\DebugTestDebugWindowsService]
"EventMessageFile"=hex(2):43,00,3a,00,5c,00,56,00,53,00,54,00,53,00,2d,00,44,\
  00,65,00,6e,00,6e,00,61,00,72,00,64,00,73,00,5c,00,44,00,65,00,6e,00,6e,00,\
  61,00,72,00,64,00,73,00,2d,00,45,00,70,00,69,00,63,00,6f,00,72,00,53,00,79,\
  00,6e,00,63,00,5c,00,4e,00,41,00,53,00,5f,00,45,00,76,00,65,00,6e,00,74,00,\
  56,00,69,00,65,00,77,00,65,00,72,00,5f,00,4d,00,73,00,67,00,46,00,69,00,6c,\
  00,65,00,5c,00,6e,00,61,00,73,00,5f,00,6d,00,73,00,66,00,69,00,6c,00,65,00,\
  2e,00,64,00,6c,00,6c,00,00,00
"TypesSupported"=dword:00000007

The EventMessageFile above actually points to the proper locatoin of the DLL created above. The key is supposed to be of type REG_EXPAND_SZ, which causes the export to contain hex.

When running the service and writing to the log, it appears to be using the correct event message dll since it does not allow me to delete the message file dll unless I close the event viewer because it in use when viewing the log entry.

I have tried many different combinations to try to get this to work, including setting the MessageId to both 1000 and 0x1000, as well as compiling the message file with and without the -c switch (mc.exe -c).

Multiple applications can use the same event message file, and it seems if we can figure out the correct way to create it, anyone using Xojo could use this message DLL since Xojo always creates the log entries with the ID of 1000. It would be nice if this generic message file could be included with Xojo so that others would not run into this issue.

I’m wondering if anyone here has ever been able to resolve this issue or has any idea of what I might be doing wrong. I know @Wayne_Golding has a lot of knowledge with Windows services, and I have watched and read his available content - but have not come across the answer to this Windows Event Log issue.

Thanks for any help you might be able to offer.