재우니의 블로그



dll 참조할때, HRESULT 예외 : 0x8007007E 에러 로그는 대부분 해당 dll 에서 사용하는 의존하는 dll 이 존재하지 않을 경우 발생합니다.



그래서 Windows에서는 dll에 대한 검색 순서는 다음과 같습니다.

1. 현재 디렉토리
2. 시스템 폴더 C:\windows\system32 or c:\windows\SysWOW64(64 비트 상자의 32 비트 프로세스 용).
3. Path환경 변수 읽기

의존성 dll 파일이 체크하기 위해서는 dumpbin 도구를 사용하여 필요한 DLL 종속성을 찾을 수 있습니다.

dumpbin /DEPENDENTS my.dll

예를 들어 INIcrypto.dll 이 의존하는 dll 이 어떤게 있는지 조회 해 보겠습니다.

D:\UNIV Developer Center\Development\Event\EventVersion2\UnivDefault.Web\bin>dumpbin /DEPENDENTS INIcrypto.dll
Microsoft (R) COFF/PE Dumper Version 14.16.27026.1
Copyright (C) Microsoft Corporation. All rights reserved.


Dump of file INIcrypto.dll

File Type: DLL

Image has the following dependencies:

MFC71.DLL
MSVCR71.dll
KERNEL32.dll
USER32.dll
GDI32.dll
ADVAPI32.dll

Summary

E000 .data
1B000 .rdata
8000 .reloc
1000 .rsrc
55000 .text

확인해 보니 아래의 6가지 dll 을 의존합니다. 이 dll 이 위에 언급한 검색순서 폴더에 존재하는지 찾아보시면 되겠습니다.

MFC71.DLL
MSVCR71.dll
KERNEL32.dll
USER32.dll
GDI32.dll
ADVAPI32.dll

dumpbin /all INIcrypto.dll 를 사용하면 모든 상세내역이 나오며, 64 or 32 비트인지도 확인이 가능합니다.

D:\UNIV Developer Center\Development\Event\EventVersion2\UnivDefault.Web\bin>dumpbin /all INIcrypto.dll
Microsoft (R) COFF/PE Dumper Version 14.16.27026.1
Copyright (C) Microsoft Corporation. All rights reserved.


Dump of file INIcrypto.dll

PE signature found

File Type: DLL

FILE HEADER VALUES
14C machine (x86)
5 number of sections
54865CF4 time date stamp Tue Dec 9 11:22:44 2014
0 file pointer to symbol table
0 number of symbols
E0 size of optional header
210E characteristics
Executable
Line numbers stripped
Symbols stripped
32 bit word machine
DLL

OPTIONAL HEADER VALUES
10B magic # (PE32)
7.10 linker version
55000 size of code
32000 size of initialized data
0 size of uninitialized data
556AA entry point (100556AA)
1000 base of code
56000 base of data
10000000 image base (10000000 to 10087FFF)
1000 section alignment
1000 file alignment
4.00 operating system version
0.00 image version
4.00 subsystem version
0 Win32 version
88000 size of image
1000 size of headers
0 checksum
2 subsystem (Windows GUI)
0 DLL characteristics
100000 size of stack reserve
1000 size of stack commit
100000 size of heap reserve
1000 size of heap commit
0 loader flags
10 number of directories
701E0 [ 19B] RVA [size] of Export Directory
6F8F4 [ 8C] RVA [size] of Import Directory
7F000 [ 308] RVA [size] of Resource Directory
0 [ 0] RVA [size] of Exception Directory
0 [ 0] RVA [size] of Certificates Directory
80000 [ 5FB0] RVA [size] of Base Relocation Directory
562F0 [ 1C] RVA [size] of Debug Directory
0 [ 0] RVA [size] of Architecture Directory
0 [ 0] RVA [size] of Global Pointer Directory
0 [ 0] RVA [size] of Thread Storage Directory
0 [ 0] RVA [size] of Load Configuration Directory
0 [ 0] RVA [size] of Bound Import Directory
56000 [ 2EC] RVA [size] of Import Address Table Directory
0 [ 0] RVA [size] of Delay Import Directory
0 [ 0] RVA [size] of COM Descriptor Directory
0 [ 0] RVA [size] of Reserved Directory


SECTION HEADER #1
.text name
54FDE virtual size
1000 virtual address (10001000 to 10055FDD)
55000 size of raw data
1000 file pointer to raw data (00001000 to 00055FFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
60000020 flags
Code
Execute Read

RAW DATA #1
10001000: B8 0C 63 05 10 C3 CC CC CC CC CC CC CC CC CC CC ¸.c..ÃÌÌÌÌÌÌÌÌÌÌ
10001010: 56 6A 00 8B F1 E8 D2 41 05 00 C7 06 30 63 05 10 Vj..ñèÒA..Ç.0c..
10001020: 8B C6 5E C3 CC CC CC CC CC CC CC CC CC CC CC CC .Æ^ÃÌÌÌÌÌÌÌÌÌÌÌÌ
...............