SafeRegistryHandle 類別

定義

表示 Windows 登錄的安全控制代碼。

public ref class SafeRegistryHandle sealed : Microsoft::Win32::SafeHandles::SafeHandleZeroOrMinusOneIsInvalid
public ref class SafeRegistryHandle sealed : System::Runtime::InteropServices::SafeHandle
public sealed class SafeRegistryHandle : Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid
[System.Security.SecurityCritical]
public sealed class SafeRegistryHandle : System.Runtime.InteropServices.SafeHandle
[System.Security.SecurityCritical]
public sealed class SafeRegistryHandle : Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid
type SafeRegistryHandle = class
    inherit SafeHandleZeroOrMinusOneIsInvalid
[<System.Security.SecurityCritical>]
type SafeRegistryHandle = class
    inherit SafeHandle
[<System.Security.SecurityCritical>]
type SafeRegistryHandle = class
    inherit SafeHandleZeroOrMinusOneIsInvalid
Public NotInheritable Class SafeRegistryHandle
Inherits SafeHandleZeroOrMinusOneIsInvalid
Public NotInheritable Class SafeRegistryHandle
Inherits SafeHandle
繼承
繼承
SafeRegistryHandle
屬性

備註

您可以在原生 RegCreateKeyEx Windows 函式上使用平台調用來取得 SafeRegistryHandle 對象,然後使用它搭配 方法建立登錄機碼 RegistryKey.FromHandle

重要

此型別代表 IDisposable 介面。 當您完成使用型別時,您應該直接或間接處置它。 若要直接處置型別,請呼叫其 try/catch 區塊中的 Dispose 方法。 若要間接處置它,請使用語言建構函式,例如 using (在 C# 中) 或 Using (在 Visual Basic 中)。 如需詳細資訊,請參閱 IDisposable 介面文章中的<使用實作 IDisposable 的物件>一節。

建構函式

SafeRegistryHandle()

建立 SafeRegistryHandle

SafeRegistryHandle(IntPtr, Boolean)

初始化 SafeRegistryHandle 類別的新執行個體。

欄位

handle

指定要包裝的控制代碼。

(繼承來源 SafeHandle)

屬性

IsClosed

取得值,指出控制代碼是否已關閉。

(繼承來源 SafeHandle)
IsInvalid

取得值,表示控制代碼是否無效。

IsInvalid

取得值,表示控制代碼是否無效。

(繼承來源 SafeHandleZeroOrMinusOneIsInvalid)

方法

Close()

標記要釋出和釋放資源的控制代碼。

(繼承來源 SafeHandle)
DangerousAddRef(Boolean)

手動遞增 SafeHandle 執行個體上的參考計數器。

(繼承來源 SafeHandle)
DangerousGetHandle()

傳回 handle 欄位的值。

(繼承來源 SafeHandle)
DangerousRelease()

手動遞減 SafeHandle 執行個體上的參考計數器。

(繼承來源 SafeHandle)
Dispose()

釋放 SafeHandle 類別所使用的所有資源。

(繼承來源 SafeHandle)
Dispose(Boolean)

釋放 SafeHandle 類別所使用的 Unmanaged 資源,指定是否要執行一般處置作業。

(繼承來源 SafeHandle)
Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ReleaseHandle()

在衍生類別中覆寫時,執行釋放控制代碼所需的程式碼。

(繼承來源 SafeHandle)
SetHandle(IntPtr)

將控制代碼設定為指定的既有控制代碼。

(繼承來源 SafeHandle)
SetHandleAsInvalid()

將控制代碼標記為不再使用。

(繼承來源 SafeHandle)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於