Inheritance: System.MarshalByRefObject, INiRegistrationContext
Beispiel #1
0
        private void PerformRegistration(string packageId, string fileSystemRoot, INiPackage package)
        {
            var registrationContext = new NiRegistrationContext(Context, packageId, fileSystemRoot);

            // Unregister when this package is already installed.

            bool isInstalled;

            using (var rootKey = OpenContextRegistry(false))
                using (var packageKey = rootKey.OpenSubKey("InstalledProducts\\" + packageId))
                {
                    isInstalled = packageKey != null;
                }

            if (isInstalled)
            {
                Marshal.ThrowExceptionForHR((int)package.Unregister(registrationContext));
            }

            // Perform the registration process.

            Marshal.ThrowExceptionForHR((int)package.Register(registrationContext));
        }
Beispiel #2
0
        private void PerformRegistration(string packageId, string fileSystemRoot, INiPackage package)
        {
            var registrationContext = new NiRegistrationContext(Context, packageId, fileSystemRoot);

            // Unregister when this package is already installed.

            bool isInstalled;

            using (var rootKey = OpenContextRegistry(false))
            using (var packageKey = rootKey.OpenSubKey("InstalledProducts\\" + packageId))
            {
                isInstalled = packageKey != null;
            }

            if (isInstalled)
                Marshal.ThrowExceptionForHR((int)package.Unregister(registrationContext));

            // Perform the registration process.

            Marshal.ThrowExceptionForHR((int)package.Register(registrationContext));
        }
Beispiel #3
0
        private bool PerformUnregistration(string fileSystemRoot, INiPackage package)
        {
            // Unregister when this package is already installed.

            using (var contextKey = OpenContextRegistry(false))
            using (var key = contextKey.OpenSubKey("InstalledProducts\\" + _packageId))
            {
                if (key == null)
                    return false;
            }

            var registrationContext = new NiRegistrationContext(Context, _packageId, fileSystemRoot);

            Marshal.ThrowExceptionForHR((int)package.Unregister(registrationContext));

            return true;
        }