Alle Dlls mit Adressen einer Anwendung auflisten

Gast #2575643
Lesenswert?

Hallo Leute,

Möchte mir ein Tool schreiben, mit dem ich alle Dlls's (Name und 
Start/Endadresse) einer Anwendung ermitteln kann.

Bis jetzt habe ich dafür immer IDA genutzt.
Das Programm ist mir aber zu "überladen". Es kann weit mehr, als ich 
benötige.

Weis jemand die von mir benötiften API aaufrufe, damit ich mich einlesen 
kann?
(Firma: Basta) #2575688
Lesenswert?

Nunja, du öffnet die EXE, liest im PE Header nach wo der Import Table 
liegt, und liest dort Dll-Namen und Adressen aus. Der Import Table mit 
seinen parallelen Arrays ist nicht die hübscheste Datenstruktur, aber 
ok. Spezielle APIs (außer CreateFile,ReadFile) brauchst dafür keine.
Persönliche Seite #2575767
Lesenswert?

Wenn ein MS-Compiler installiert ist, dann gibt es das Tool dumpbin, das 
solche Aufgaben für einen erledigt.

Das sieht dann auf einem 64-Bit-Windows mit VS2010 so aus:
1
c:\>dumpbin c:\windows\system32\notepad.exe /imports
2

3
Microsoft (R) COFF/PE Dumper Version 10.00.40219.01
4
Copyright (C) Microsoft Corporation.  All rights reserved.
5

6

7
Dump of file C:\Windows\system32\notepad.exe
8

9
File Type: EXECUTABLE IMAGE
10

11
  Section contains the following imports:
12

13
    ADVAPI32.dll
14
             10000C000 Import Address Table
15
             10000D1E8 Import Name Table
16
              FFFFFFFF time date stamp
17
              FFFFFFFF Index of first forwarder reference
18

19
           7FF7FF21ED0   27E RegSetValueExW
20
           7FF7FF2C2D0   26E RegQueryValueExW
21
           7FF7FF21F00   23C RegCreateKeyW
22
           7FF7FF30710   230 RegCloseKey
23
           7FF7FF306F0   261 RegOpenKeyExW
24
           7FF7FF30720   180 IsTextUnicode
25
           7FF7FF27E04    57 CloseServiceHandle
26
           7FF7FF1C2A8   1F9 OpenSCManagerW
27
           7FF7FF1C2C0   1FB OpenServiceW
28
           7FF7FF1C6FC   224 QueryServiceConfigW
29

30
    KERNEL32.dll
31
             10000C058 Import Address Table
32
             10000D240 Import Name Table
33
              FFFFFFFF time date stamp
34
              FFFFFFFF Index of first forwarder reference
35

36
              78D2CF20   209 GetLocalTime
37
              78D2D3F0   1CF GetDateFormatW
38
              78D2DDE0   29E GetTimeFormatW
39
              78D6EC10   2C6 GlobalLock
40
              78D6EA20   2CD GlobalUnlock

Korrespondierend gibt es auch die Option /exports, die mit DLLs 
aufgerufen interessante Resultate liefert:
1
Microsoft (R) COFF/PE Dumper Version 10.00.40219.01
2
Copyright (C) Microsoft Corporation.  All rights reserved.
3

4

5
Dump of file mspdb100.dll
6

7
File Type: DLL
8

9
  Section contains the following exports for mspdb100.dll
10

11
    00000000 characteristics
12
    4BA1D68B time date stamp Thu Mar 18 08:30:19 2010
13
        0.00 version
14
           1 ordinal base
15
         193 number of functions
16
         193 number of names
17

18
    ordinal hint RVA      name
19

20
          1    0 0002F180 ??0SymTiIter@@QAE@PAUSYMTYPE@@@Z
21
          2    1 0002F1C0 ??0TypeTiIter@@QAE@PAUTYPTYPE@@@Z
22
          3    2 00027B20 ?CloseAllTimeoutPDB@PDB@@SAHXZ
23
          4    3 00027AE0 ?ExportValidateImplementation@PDB@@SAHK@Z
24
          5    4 00027A90 ?ExportValidateInterface@PDB@@SAHK@Z
25
          6    5 00019070 ?FCreateSrcHash@SrcHash@@SA_NAAPAU1@W4HID@1@@Z
26
          7    6 00027BE0 ?FOpen@MREngine@@SGHPAPAU1@PAUMreToPdb@@HH@Z
27
          8    7 00027B90 ?FOpen@MREngine@@SGHPAPAU1@PAUPDB@@PAUNameMap@@HH@Z
28
          9    8 00018BD0 ?FOpen@MREngine@@SGHPAPAU1@PBDAAJQADHH@Z
29
         10    9 00027C20 ?FOpenW@MREngine@@SGHPAPAU1@PBGAAJPAGIHH@Z
30
         11    A 000174C0 ?MapLeafStToSz@@YAII@Z
31
         12    B 000175B0 ?MapSymRecStToSz@@YAII@Z
32
         13    C 00027990 ?Open2W@PDB@@SAHPBGPBDPAJPAGIPAPAU1@@Z
33
         14    D 000279C0 ?OpenEx2W@PDB@@SAHPBGPBDJPAJPAGIPAPAU1@@Z
34
         15    E 00027920 ?OpenInStream@PDB@@SAHPAUIStream@@PBDPAJPAGIPAPAU1@@Z
35
         16    F 00027960 ?OpenNgenPdb@PDB@@SAHPBG0PAJPAGIPAPAU1@@Z

(Und man erkennt, daß das offensichtlich eine C++-DLL ist, der 
dekorierten Namen wegen)

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren