Update/To answer my own question:

 

I decompiled the .NET framework function
System.Diagnostic.EventLog.CreateEventSource and looked at the source code
for the WiX extension and confirmed that there was a discrepancy.

 

I then created a test project with .NET framework debugging turned on, so I
could step into the framework and read Microsoft's own source comments (if
any).

 

Found this:

 

---snip---

    // NOTE: We shouldn't set "Sources" explicitly, the OS will
automatically set it.

    // The EventLog service doesn't use it for anything it is just an
helping hand for event viewer filters.

    // Writing this value explicitly might confuse the service as it might
perceive it as a change and 

    // start initializing again

---snip---

 

and in another branch:

 

---snip---

  // We have a race with OS EventLog here.

  // OS might update Sources as well. We should avoid writing the 

  // source name if OS beats us.

---snip---

 

Funny how the notes say that something should not be done, yet in the next
line of code, they go ahead and do it anyway.

 

So I guess the WiX way is fine and I should not care about the Sources value
not being updated explicitly by WiXUtilExtension.

 

/Joergen Bech

 

 

 

  _____  

From: Joergen Bech [mailto:joergenb...@hotmail.com] 
Sent: 11. februar 2010 12:31
To: 'wix-users@lists.sourceforge.net'
Subject: WixUtilExtension not updating Sources value when registering a new
EventLog source?

 

I am using the WixUtilExtension to register two EventLog sources:

 

<Component Id='CreateEventSources'
Guid='AEE38E60-EEC1-4A96-AE3F-37710D838B4A'>

                      <util:EventSource Log="Application" Name="MyApp1"
EventMessageFile="[NETFRAMEWORK20INSTALLROOTDIR]EventLogMessages.dll" />

                      <util:EventSource Log="Application" Name="MyApp2"
EventMessageFile="[NETFRAMEWORK20INSTALLROOTDIR]EventLogMessages.dll" />

</Component>

 

The Registry keys are correctly created, i.e.

 

HKLM\SYSTEM\CurrentControlSet\Services\Eventlog\Application\MyApp1

HKLM\SYSTEM\CurrentControlSet\Services\Eventlog\Application\MyApp2

 

However: If I were to create these sources using the .NET Framework class
System.Diagnostics.EventLogInstaller, it would also update the REG_MULTI_SZ
value named "Sources", which (provided we are using the Application log) can
be found at

 

hklm\system\currentcontrolset\services\eventlog\applicat...@sources

 

This value contains a list of event log sources and is pretty much
consistent with the list of subkeys, although some broken installers
sometimes fail to update the value at uninstall time or whatever.

 

If we look in the latest WiX source in
src\ext\UtilExtension\wixext\UtilCompiler.cs:ParseEventSourceElement, we
find

 

            string eventSourceKey =
String.Format(@"SYSTEM\CurrentControlSet\Services\EventLog\{0}\{1}",
logName, sourceName);

 

which is where the key is registered, but I see no code updating the Sources
value.

 

My questions are:

 

-          Why is WiX not updating the Sources value?

-          Is this something I should be concerned about?

 

Links to official guidelines about how event logs should be registered (at
the Registry level) would be much appreciated.

 

/Joergen Bech

 

 

 

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to