我对此完全不了解,所以需要一些帮助。我正在尝试使用MsiGetSummaryInformation和MsiSummaryInfoGetProperty
我不是来自 C++ 背景,所以你必须忍受我。这是我的尝试:
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;
}
但它似乎不起作用。返回的值似乎不正确。任何人都可以解释一下吗?
更新
这是我的新(更新)示例:
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;
}
这一行: wcout << "缓冲区大小:" << num << endl;
返回 3873856,看起来有点大?我觉得我的编码有点乱。你的例子将是一个很大的帮助!