I was looking for a way to log down messages the installer log using JScript and stumbled upon this answer:
How to debug an MSI Custom Action that is implemented in Javascript?
It works great. However there is something intriguing in the code that I haven't been able to figure out. In this method:
// spool an informational message into the MSI log, if it is enabled.
function LogMessage(msg) {
var record = Session.Installer.CreateRecord(0);
record.StringData(0) = "CustomAction:: " + msg;
Session.Message(MsgKind.Log, record);
}
How does the line record.StringData(0) = "CustomAction:: " + msg;
work, from a syntax/semantic perspective? It looks to me this is trying to assign a value to the return value of a function call, which should be illegal or a no-op at best? Yet it works, and the message is printed out in the log.
What am I missing?