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. それ以外の場合は、アセンブリ ディレクトリを検索し、LOAD_WITH_ALTERED_SEARCH_PATH フラグを指定してLoadLibraryEx関数を呼び出します。

この属性は、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)

適用対象

こちらもご覧ください