UPDATED
I'm trying to programmatic-ally set a COM+ component's ConstructorString with a value for later initialization.
The code in question works fine on WinXP, Win2k3, Vista and Win2k8.
I'm failing on Win7 - Home Premium version.
I've determined by trial and error that there seems to be a size limit on the constructor string - if the string is 512 characters (wchar) or less, it saves. Longer, and the SaveChanges call on the CatalogCollection object fails with a 0x80110437 - COMADMIN_E_PROPERTYSAVEFAILED error.
Turns out, all systems have that limit - 512 characters.
We use CryptProtectData to encrypt a password before putting it into the string.
On win7 (x64) the output of the string is longer than on XP (x32) and W2k3 (x64).
So - CryptProtectData has changed - why is the output longer?
if (!CryptProtectData(&dataIn,L" ",&optionalEntropy,NULL,NULL,
CRYPTPROTECT_LOCAL_MACHINE | CRYPTPROTECT_UI_FORBIDDEN, &dataOut))
What do you do with dataOut
to turn it into a string? I can't remember the exact details now, but I assume the constructor string is a BSTR
. dataOut
is a byte buffer, so you need to be very careful when converting it to a string, so you don't trip on embedded NUL characters, etc.
Could you update your question to include the conversion from the output buffer of CryptProtectData
to string?