internal void FinishPatching()
        {
            // Close file
            Stream.Close();

            if (FilePath.Contains(':'))
            {
                FileInfo fileInfo = new(FilePath);

                // Restore original owner and access rules.
                // The OriginalACL cannot be reused directly.
                FileSecurity NewACL = fileInfo.GetAccessControl();
                NewACL.SetSecurityDescriptorBinaryForm(OriginalACL.GetSecurityDescriptorBinaryForm());
                fileInfo.SetAccessControl(NewACL);

                // Revert to self
                RestorePrivilege.Revert();
                RestorePrivilege.Disable();

                if ((Environment.OSVersion.Version.Major == 6) && (Environment.OSVersion.Version.Minor <= 1))
                {
                    // On Vista or 7
                    TakeOwnershipPrivilege.Revert();
                    TakeOwnershipPrivilege.Disable();
                }
            }
        }