DefaultDllImportSearchPathsAttribute クラス

定義

プラットフォーム呼び出しの機能を提供する DLL の検索に使用されるパスを指定します。

public ref class DefaultDllImportSearchPathsAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Method, AllowMultiple=false)]
public sealed class DefaultDllImportSearchPathsAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Method, AllowMultiple=false)]
[System.Runtime.InteropServices.ComVisible(false)]
public sealed class DefaultDllImportSearchPathsAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Method, AllowMultiple=false)>]
type DefaultDllImportSearchPathsAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Method, AllowMultiple=false)>]
[<System.Runtime.InteropServices.ComVisible(false)>]
type DefaultDllImportSearchPathsAttribute = class
    inherit Attribute
Public NotInheritable Class DefaultDllImportSearchPathsAttribute
Inherits Attribute
継承
DefaultDllImportSearchPathsAttribute
属性

注釈

アセンブリに適用される場合、この属性は、プラットフォーム呼び出しの関数を提供する DLL をアセンブリ内の任意のコードで検索するために既定で使用されるパスを指定します。 個々のプラットフォーム呼び出しに適用すると、この属性はアセンブリに指定された既定の検索パスをオーバーライドします。

この属性は、絶対パスを指定するプラットフォーム呼び出しでは無視されます。

Win32 LoadLibraryEx 関数が現在の作業ディレクトリを検索できないようにするには、この属性を使用します。 これにより、悪意のあるソフトウェアが現在の作業ディレクトリに DLL を配置する攻撃からアプリケーションを保護できます。これにより、プラットフォーム呼び出しで Win32 LoadLibraryEx 関数が呼び出されると、関数の既定の検索順序で、検索対象のシステム DLL ではなく悪意のある DLL が検出されます。

共通言語ランタイムは、次のアルゴリズムに従って LoadLibraryEx 関数の呼び出しを処理します。

  1. 属性が個々のプラットフォーム呼び出しに適用される場合は、その属性のインスタンスで指定された値を使用します。

  2. それ以外の場合、プラットフォーム呼び出しを含むアセンブリに属性が適用される場合は、その属性のインスタンスで指定された値を使用します。

  3. それ以外の場合は、アセンブリ ディレクトリを検索し、フラグを使用して LoadLibraryEx 関数を LOAD_WITH_ALTERED_SEARCH_PATH 呼び出します。

この属性は、Windows以外のプラットフォームや Mono ランタイムには影響しません。

コンストラクター

DefaultDllImportSearchPathsAttribute(DllImportSearchPath)

プラットフォームの対象の検索を呼び出すときに使用するパスを指定して、DefaultDllImportSearchPathsAttribute クラスの新しいインスタンスを初期化します。

プロパティ

Paths

LoadLibraryEx 関数がプラットフォーム呼び出しの間に検索するパスを指定する列挙値のビットごとの組み合わせを取得します。

TypeId

派生クラスで実装されると、この Attribute の一意の識別子を取得します。

(継承元 Attribute)

メソッド

Equals(Object)

このインスタンスが、指定されたオブジェクトと等価であるかどうかを示す値を返します。

(継承元 Attribute)
GetHashCode()

このインスタンスのハッシュ コードを返します。

(継承元 Attribute)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
IsDefaultAttribute()

派生クラスでオーバーライドされるとき、このインスタンスの値が派生クラスの既定値であるかどうかを示します。

(継承元 Attribute)
Match(Object)

派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。

(継承元 Attribute)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

明示的なインターフェイスの実装

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

一連の名前を対応する一連のディスパッチ識別子に割り当てます。

(継承元 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

オブジェクトの型情報を取得します。この情報はインターフェイスの型情報の取得に使用できます。

(継承元 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。

(継承元 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

オブジェクトによって公開されたプロパティおよびメソッドへのアクセスを提供します。

(継承元 Attribute)

適用対象

こちらもご覧ください