Exemplo n.º 1
0
        internal uint MsiRecordGetStringW(IntPtr hRecord, uint iField, out string szValueBuf)
        {
            uint   len    = 256;
            string sz     = new string(' ', (int)len);
            IntPtr bstr   = Marshal.StringToBSTR(sz);
            uint   retVal = CwMsiWin32.MsiRecordGetStringW(hRecord, iField, bstr, ref len);

            if (retVal == CwMsiWin32.ERROR_SUCCESS)
            {
                szValueBuf = Marshal.PtrToStringUni(bstr);
            }
            else
            {
                szValueBuf = null;
            }

            Marshal.FreeBSTR(bstr);
            bstr = IntPtr.Zero;

            return(retVal);
        }