共用方式為


Overlapped.UnsafePack 方法

定義

將目前的執行個體封裝到 NativeOverlapped 結構。 不會散佈呼叫堆疊。

多載

UnsafePack(IOCompletionCallback)
已淘汰.
已淘汰.
已淘汰.

將目前的執行個體封裝到 NativeOverlapped 結構,指定非同步的 I/O 作業完成時所要叫用的委派。 不會散佈呼叫堆疊。

UnsafePack(IOCompletionCallback, Object)

將目前的執行個體封裝到 NativeOverlapped 結構,指定非同步的 I/O 作業完成時所叫用的委派,以及當做緩衝區的 Managed 物件。 不會散佈呼叫堆疊。

UnsafePack(IOCompletionCallback)

來源:
Overlapped.cs
來源:
Overlapped.cs
來源:
Overlapped.cs

警告

This method is not safe. Use UnsafePack (iocb, userData) instead. https://go.microsoft.com/fwlink/?linkid=14202

警告

This overload is not safe and has been deprecated. Use UnsafePack(IOCompletionCallback?, object?) instead.

警告

This method is not safe. Use UnsafePack (iocb, userData) instead. http://go.microsoft.com/fwlink/?linkid=14202

重要

此 API 不符合 CLS 規範。

將目前的執行個體封裝到 NativeOverlapped 結構,指定非同步的 I/O 作業完成時所要叫用的委派。 不會散佈呼叫堆疊。

public:
 System::Threading::NativeOverlapped* UnsafePack(System::Threading::IOCompletionCallback ^ iocb);
[System.CLSCompliant(false)]
[System.Obsolete("This method is not safe.  Use UnsafePack (iocb, userData) instead.  https://go.microsoft.com/fwlink/?linkid=14202")]
public System.Threading.NativeOverlapped* UnsafePack (System.Threading.IOCompletionCallback? iocb);
[System.CLSCompliant(false)]
[System.Obsolete("This overload is not safe and has been deprecated. Use UnsafePack(IOCompletionCallback?, object?) instead.")]
public System.Threading.NativeOverlapped* UnsafePack (System.Threading.IOCompletionCallback? iocb);
[System.CLSCompliant(false)]
[System.Obsolete("This method is not safe.  Use UnsafePack (iocb, userData) instead.  http://go.microsoft.com/fwlink/?linkid=14202")]
public System.Threading.NativeOverlapped* UnsafePack (System.Threading.IOCompletionCallback iocb);
[System.CLSCompliant(false)]
public System.Threading.NativeOverlapped* UnsafePack (System.Threading.IOCompletionCallback iocb);
[System.CLSCompliant(false)]
[System.Obsolete("This method is not safe.  Use UnsafePack (iocb, userData) instead.  http://go.microsoft.com/fwlink/?linkid=14202")]
[System.Security.SecurityCritical]
public System.Threading.NativeOverlapped* UnsafePack (System.Threading.IOCompletionCallback iocb);
[System.CLSCompliant(false)]
[System.Obsolete("This method is not safe.  Use UnsafePack (iocb, userData) instead.  https://go.microsoft.com/fwlink/?linkid=14202")]
public System.Threading.NativeOverlapped* UnsafePack (System.Threading.IOCompletionCallback iocb);
[<System.CLSCompliant(false)>]
[<System.Obsolete("This method is not safe.  Use UnsafePack (iocb, userData) instead.  https://go.microsoft.com/fwlink/?linkid=14202")>]
member this.UnsafePack : System.Threading.IOCompletionCallback -> nativeptr<System.Threading.NativeOverlapped>
[<System.CLSCompliant(false)>]
[<System.Obsolete("This overload is not safe and has been deprecated. Use UnsafePack(IOCompletionCallback?, object?) instead.")>]
member this.UnsafePack : System.Threading.IOCompletionCallback -> nativeptr<System.Threading.NativeOverlapped>
[<System.CLSCompliant(false)>]
[<System.Obsolete("This method is not safe.  Use UnsafePack (iocb, userData) instead.  http://go.microsoft.com/fwlink/?linkid=14202")>]
member this.UnsafePack : System.Threading.IOCompletionCallback -> nativeptr<System.Threading.NativeOverlapped>
[<System.CLSCompliant(false)>]
member this.UnsafePack : System.Threading.IOCompletionCallback -> nativeptr<System.Threading.NativeOverlapped>
[<System.CLSCompliant(false)>]
[<System.Obsolete("This method is not safe.  Use UnsafePack (iocb, userData) instead.  http://go.microsoft.com/fwlink/?linkid=14202")>]
[<System.Security.SecurityCritical>]
member this.UnsafePack : System.Threading.IOCompletionCallback -> nativeptr<System.Threading.NativeOverlapped>

參數

iocb
IOCompletionCallback

IOCompletionCallback 委派,表示非同步的 I/O 作業完成時所要叫用的回呼方法。

傳回

NativeOverlapped 結構的 Unmanaged 指標。

屬性

例外狀況

目前的 Overlapped 已被封裝。

備註

這個方法所傳回的 Unmanaged 指標可以傳遞至重迭 I/O 作業中的作業系統。 結構 NativeOverlapped 會在實體記憶體中固定,直到 Unpack 呼叫 為止。

呼叫端負責釘選緩衝區。 不過,如果卸載應用程式域,則會終結固定緩衝區的控制碼,並釋放緩衝區,讓 I/O 作業寫入釋放的位址。 因此,最好使用 UnsafePack(IOCompletionCallback, Object) 方法多載,其中執行時間會釘選緩衝區。

警告

UnsafePack使用 方法可能會不小心開啟安全性漏洞。 程式碼存取安全性會根據其許可權檢查堆疊上所有呼叫端的許可權。 方法 UnsafePack 不會傳播呼叫堆疊。 惡意程式碼可能會利用此專案來避免許可權檢查。

適用於

UnsafePack(IOCompletionCallback, Object)

來源:
Overlapped.cs
來源:
Overlapped.cs
來源:
Overlapped.cs

重要

此 API 不符合 CLS 規範。

將目前的執行個體封裝到 NativeOverlapped 結構,指定非同步的 I/O 作業完成時所叫用的委派,以及當做緩衝區的 Managed 物件。 不會散佈呼叫堆疊。

public:
 System::Threading::NativeOverlapped* UnsafePack(System::Threading::IOCompletionCallback ^ iocb, System::Object ^ userData);
[System.CLSCompliant(false)]
public System.Threading.NativeOverlapped* UnsafePack (System.Threading.IOCompletionCallback? iocb, object? userData);
[System.CLSCompliant(false)]
public System.Threading.NativeOverlapped* UnsafePack (System.Threading.IOCompletionCallback iocb, object userData);
[System.CLSCompliant(false)]
[System.Runtime.InteropServices.ComVisible(false)]
public System.Threading.NativeOverlapped* UnsafePack (System.Threading.IOCompletionCallback iocb, object userData);
[System.CLSCompliant(false)]
[System.Runtime.InteropServices.ComVisible(false)]
[System.Security.SecurityCritical]
public System.Threading.NativeOverlapped* UnsafePack (System.Threading.IOCompletionCallback iocb, object userData);
[<System.CLSCompliant(false)>]
member this.UnsafePack : System.Threading.IOCompletionCallback * obj -> nativeptr<System.Threading.NativeOverlapped>
[<System.CLSCompliant(false)>]
[<System.Runtime.InteropServices.ComVisible(false)>]
member this.UnsafePack : System.Threading.IOCompletionCallback * obj -> nativeptr<System.Threading.NativeOverlapped>
[<System.CLSCompliant(false)>]
[<System.Runtime.InteropServices.ComVisible(false)>]
[<System.Security.SecurityCritical>]
member this.UnsafePack : System.Threading.IOCompletionCallback * obj -> nativeptr<System.Threading.NativeOverlapped>

參數

iocb
IOCompletionCallback

IOCompletionCallback 委派,表示非同步的 I/O 作業完成時所要叫用的回呼方法。

userData
Object

物件或物件陣列,表示作業的輸入或輸出緩衝區。 每個物件代表一個緩衝區,例如位元組陣列。

傳回

NativeOverlapped 結構的 Unmanaged 指標。

屬性

例外狀況

呼叫端沒有必要的權限。

目前的 Overlapped 已被封裝。

備註

這個方法所傳回的 Unmanaged 指標可以傳遞至重迭 I/O 作業中的作業系統。 結構 NativeOverlapped 會在實體記憶體中固定,直到 Unpack 呼叫 為止。

中指定的 userData 緩衝區或緩衝區必須與傳遞至執行非同步 I/O 之 Unmanaged 作業系統函式的緩衝區相同。

執行時間會在 I/O 作業期間釘選 中指定的 userData 緩衝區或緩衝區。 如果卸載應用程式域,執行時間會保留固定記憶體,直到 I/O 作業完成為止。

警告

UnsafePack使用 方法可能會不小心開啟安全性漏洞。 程式碼存取安全性會根據其許可權檢查堆疊上所有呼叫端的許可權。 方法 UnsafePack 不會傳播呼叫堆疊。 惡意程式碼可能會利用此專案來避免許可權檢查。

適用於