Exemplo n.º 1
0
        private static int OpenSummaryInfo(string packagePath, bool enableWrite)
        {
            int  summaryInfoHandle;
            int  maxProperties = !enableWrite ? 0 : SummaryInfo.MAX_PROPERTIES;
            uint ret           = RemotableNativeMethods.MsiGetSummaryInformation(
                0,
                packagePath,
                (uint)maxProperties,
                out summaryInfoHandle);

            if (ret != 0)
            {
                if (ret == (uint)NativeMethods.Error.FILE_NOT_FOUND ||
                    ret == (uint)NativeMethods.Error.ACCESS_DENIED)
                {
                    throw new FileNotFoundException(null, packagePath);
                }
                else
                {
                    throw InstallerException.ExceptionFromReturnCode(ret);
                }
            }
            return(summaryInfoHandle);
        }