1 /*
2 +----------------------------------------------------------------------+
3 | PHP Version 7 |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 1997-2018 The PHP Group |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
15 | Author: Wez Furlong <wez@thebrainroom.com> |
16 +----------------------------------------------------------------------+
17 */
18
19 /* $Id$ */
20
21 /* This little application will list the DLL dependencies for a PE
22 * module to it's stdout for use by distro/installer building tools */
23
24 #include <windows.h>
25 #include <stdio.h>
26 #include <imagehlp.h>
27
StatusRoutine(IMAGEHLP_STATUS_REASON reason,PSTR image_name,PSTR dll_name,ULONG va,ULONG param)28 BOOL CALLBACK StatusRoutine(IMAGEHLP_STATUS_REASON reason,
29 PSTR image_name, PSTR dll_name,
30 ULONG va, ULONG param)
31 {
32 switch (reason) {
33 case BindImportModuleFailed:
34 printf("%s,NOTFOUND\n", dll_name);
35 return TRUE;
36
37 case BindImportModule:
38 printf("%s,OK\n", dll_name);
39 return TRUE;
40 }
41 return TRUE;
42 }
43
44 /* usage:
45 * deplister.exe path\to\module.exe path\to\symbols\root
46 * */
47
main(int argc,char * argv[])48 int main(int argc, char *argv[])
49 {
50 return BindImageEx(BIND_NO_BOUND_IMPORTS | BIND_NO_UPDATE | BIND_ALL_IMAGES,
51 argv[1], NULL, argv[2], StatusRoutine);
52 }
53
54 /*
55 * Local variables:
56 * tab-width: 4
57 * c-basic-offset: 4
58 * End:
59 * vim600: noet sw=4 ts=4 fdm=marker
60 * vim<600: noet sw=4 ts=4
61 */
62