Here is the code sequence (not complete, error checking and buffer allocation is stripped):
rc = MsiDatabaseOpenView(hDB, _T("SELECT * FROM Registry"), &hView);
rc = MsiViewExecute(hView, 0);
rc = MsiViewFetch(hView, &hRecord);
rc = MsiRecordGetString(hRecord, 3, pBuff, &BuffLen);
PMSIHANDLE hTmpRec;
hTmpRec = MsiCreateRecord(1);
rc = MsiRecordSetString(hTmpRec, 1, pBuff);
DWORD BuffLen = MSIBUFFLEN;
rc = MsiFormatRecord(MsiHandle, hTmpRec, pBuff, &BuffLen);
All return codes are ok. My problem is that MsiFormatRecord return the following in pBuff after return (note the spaces and the 1:):
"1: SOFTWARE\Linum\DCF77\2.10\rxserial "
The original entry in the registry table is:
Root: 2
Key: "SOFTWARE\Linum\DCF77\2.10\rxserial"
After reading the MSI SDK documentation I would assume the I get "SOFTWARE\Linum\DCF77\2.10\rxserial" in pBuff. The string return looks nearly like the result from MsiGetComponentPath().
My question are:
1) Why is the returned string formatted this way?
2) Is this behaviour documented somewhere? I can't find information about this.
3) What can I elso do to expand all properties in a string?
PS: I want to use the code to create temporary entries in the registry table during an upgrade. Before removing the old product I walk through the registry and add all keys that are not included in the registry table as temporary entries. To compare the values from the registry scan with the values in the registry database I need to expand possible properties in the key and name coloum with MsiFormatRecord.