I'm completely out of my depth with this, so need some asistance please. I'm trying to use MsiGetSummaryInformation and MsiSummaryInfoGetProperty
I'm not from a C++ background, so you'll have to bear with me. Here is my attempt:
UINT sisStatus = MsiGetSummaryInformation(0,originalTransform,0,&sumh);
//UINT sisStatus = MsiGetSummaryInformation(hDbObject,0,0,&sumh);
if (ERROR_SUCCESS == sisStatus)
{
//success - start getting/setting SIS
//UINT property_type = VT_LPSTR;
UINT pcount;
MsiSummaryInfoGetPropertyCount(sumh,&pcount);
wcout << "PCount " << pcount << endl;
UINT getpropertyid = 2;
UINT returnpropertyid;
int returnedIntPropData;
FILETIME fileValPtr;
LPDWORD stringDataLength = 0;
LPWSTR propdata = L"";
MsiSummaryInfoGetProperty(sumh,getpropertyid,&returnpropertyid,&returnedIntPropData,&fileValPtr,propdata, stringDataLength);
wcout << "Propdata " << propdata << endl;
wcout << "Stringlength " << stringDataLength << endl;
}
It doesn't appear to work though. The values returned don't seem to be correct. Can anybody shed any light please?
UPDATE
Here's my new (updated) example:
UINT getpropertyid = 2;
UINT returnpropertyid;
int returnedIntPropData;
FILETIME fileValPtr;
LPDWORD stringDataLength = new DWORD();
LPWSTR propdata = new TCHAR[];
UINT gps = MsiSummaryInfoGetProperty(sumh,getpropertyid,&returnpropertyid,&returnedIntPropData,&fileValPtr,propdata, stringDataLength);
if (ERROR_SUCCESS == gps)
{
wcout << "RETURN CODE: " << gps << endl;
wcout << "Propdata " << propdata << endl;
wcout << "Stringlength " << stringDataLength << endl;
}
else
{
wcout << "RETURN CODE EXPAND: " << gps << endl;
int num = (int)stringDataLength;
wcout << "Buffer size: " << num << endl;
propdata = new TCHAR[num];
stringDataLength = new DWORD(num);
MsiSummaryInfoGetProperty(sumh,getpropertyid,&returnpropertyid,&returnedIntPropData,&fileValPtr,propdata, stringDataLength);
wcout << "Propdata " << propdata << endl;
wcout << "Stringlength " << stringDataLength << endl;
}
This line: wcout << "Buffer size: " << num << endl;
returns 3873856, which seems a bit large? I think my coding's got a bit messy. Your example would be a great help!