示例#1
0
        //
        //The hotfix that is checked here depends on the system. WinXP:912817,  Win2k3:912818
        //
        public static void CheckQfe()
        {
            bool qfeInstalled = false;
            int  hr           = SafeNativeMethods.CoInitializeEx(IntPtr.Zero, SafeNativeMethods.COINIT_APARTMENTTHREADED);

            if (hr >= 0)
            {
                try
                {
                    SafeIUnknown pClassFactory = null;

                    hr = SafeNativeMethods.CoGetClassObject(new Guid(CLSID_CGatewayProtocol),
                                                            SafeNativeMethods.CLSCTX.CLSCTX_INPROC_SERVER,
                                                            IntPtr.Zero,
                                                            new Guid(IID_IClassFactory),
                                                            out pClassFactory);

                    if (hr >= 0 && pClassFactory != null)
                    {
                        qfeInstalled = true;
                    }
                    else
                    {
                        qfeInstalled = RegistryEntryExists();
                    }
                }
                finally
                {
                    SafeNativeMethods.CoUninitialize();
                }
            }

            if (!qfeInstalled)
            {
                throw new WsatAdminException(WsatAdminErrorCode.CANNOT_ENABLE_NETWORK_SUPPORT_WHEN_QFE_IS_NOT_INSTALLED, SR.GetString(SR.ErrorNoQFE));
            }
        }
示例#2
0
 internal static extern int CoGetClassObject(
     [In, MarshalAs(UnmanagedType.LPStruct)] Guid rclsid,
     [In] CLSCTX dwClsContext,
     [In] IntPtr pServerInfo,
     [In, MarshalAs(UnmanagedType.LPStruct)] Guid riid,
     [Out] out SafeIUnknown ppv);