ProcessModule.EntryPointAddress Propriété

Définition

Obtient l’adresse mémoire de la fonction qui s’exécute lorsque le système charge et exécute le module.

public:
 property IntPtr EntryPointAddress { IntPtr get(); };
public IntPtr EntryPointAddress { get; }
member this.EntryPointAddress : nativeint
Public ReadOnly Property EntryPointAddress As IntPtr

Valeur de propriété

IntPtr

nativeint

Point d’entrée du module.

Exemples

L’exemple de code suivant crée un processus pour l’application Notepad.exe. Le code itère au sein de la ProcessModuleCollection classe pour obtenir un ProcessModule objet pour chaque module de la collection. Les ModuleName propriétés et EntryPointAddress le nom sont utilisés pour afficher le nom et l’adresse du point d’entrée pour chaque module.

using (Process myProcess = new Process())
{
    // Get the process start information of notepad.
    ProcessStartInfo myProcessStartInfo = new ProcessStartInfo("notepad.exe");
    // Assign 'StartInfo' of notepad to 'StartInfo' of 'myProcess' object.
    myProcess.StartInfo = myProcessStartInfo;
    // Create a notepad.
    myProcess.Start();
    System.Threading.Thread.Sleep(1000);
    ProcessModule myProcessModule;
    // Get all the modules associated with 'myProcess'.
    ProcessModuleCollection myProcessModuleCollection = myProcess.Modules;
    Console.WriteLine("Entry point addresses of the modules "
        + "associated with 'notepad' are:");
    // Display the 'EntryPointAddress' of each of the modules.
    for (int i = 0; i < myProcessModuleCollection.Count; i++)
    {
        myProcessModule = myProcessModuleCollection[i];
        Console.WriteLine(myProcessModule.ModuleName + " : "
            + myProcessModule.EntryPointAddress);
    }
    // Get the main module associated with 'myProcess'.
    myProcessModule = myProcess.MainModule;
    Console.WriteLine("The process's main module's EntryPointAddress is: "
        + myProcessModule.EntryPointAddress);
    myProcess.CloseMainWindow();
}
Using myProcess As New Process()
    ' Get the process start information of notepad.
    Dim myProcessStartInfo As New ProcessStartInfo("notepad.exe")
    ' Assign 'StartInfo' of notepad to 'StartInfo' of 'myProcess' object.
    myProcess.StartInfo = myProcessStartInfo
    ' Create a notepad.
    myProcess.Start()
    System.Threading.Thread.Sleep(1000)
    Dim myProcessModule As ProcessModule
    ' Get all the modules associated with 'myProcess'.
    Dim myProcessModuleCollection As ProcessModuleCollection = myProcess.Modules
    Console.WriteLine("Entry point addresses of the modules " +
                   "associated with 'notepad' are:")
    ' Display the 'EntryPointAddress' of each of the modules.
    Dim i As Integer
    For i = 0 To myProcessModuleCollection.Count - 1
        myProcessModule = myProcessModuleCollection(i)
        Console.WriteLine(myProcessModule.ModuleName + " : " +
                                myProcessModule.EntryPointAddress.ToString())
    Next i
    ' Get the main module associated with 'myProcess'.
    myProcessModule = myProcess.MainModule
    Console.WriteLine("The process's main module's EntryPointAddress is: " +
                         myProcessModule.EntryPointAddress.ToString())
    myProcess.CloseMainWindow()
End Using

Remarques

Le point d’entrée du module est l’emplacement de la fonction appelée lors du démarrage du processus, du démarrage du thread, de l’arrêt du processus et de l’arrêt du thread. Bien que le point d’entrée ne soit pas l’adresse de la fonction DllMain, il doit être suffisamment proche pour la plupart des fins.

Note

En raison des modifications apportées à la façon dont Windows charge des assemblys, EntryPointAddress retourne toujours 0 sur Windows 8 ou Windows 8.1 et ne doit pas être utilisé pour ces plateformes.

S’applique à