xref: /PHP-5.4/win32/build/deplister.c (revision c0d060f5)
1 /*
2   +----------------------------------------------------------------------+
3   | PHP Version 5                                                        |
4   +----------------------------------------------------------------------+
5   | Copyright (c) 1997-2014 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 <imagehlp.h>
26 
StatusRoutine(IMAGEHLP_STATUS_REASON reason,PSTR image_name,PSTR dll_name,ULONG va,ULONG param)27 BOOL CALLBACK StatusRoutine(IMAGEHLP_STATUS_REASON reason,
28 		PSTR image_name, PSTR dll_name,
29 		ULONG va, ULONG param)
30 {
31 	switch (reason) {
32 		case BindImportModuleFailed:
33 			printf("%s,NOTFOUND\n", dll_name);
34 			return TRUE;
35 
36 		case BindImportModule:
37 			printf("%s,OK\n", dll_name);
38 			return TRUE;
39 	}
40 	return TRUE;
41 }
42 
43 /* usage:
44  * deplister.exe path\to\module.exe path\to\symbols\root
45  * */
46 
main(int argc,char * argv[])47 int main(int argc, char *argv[])
48 {
49 	return BindImageEx(BIND_NO_BOUND_IMPORTS | BIND_NO_UPDATE | BIND_ALL_IMAGES,
50 		argv[1], NULL, argv[2], StatusRoutine);
51 }
52 
53 /*
54  * Local variables:
55  * tab-width: 4
56  * c-basic-offset: 4
57  * End:
58  * vim600: noet sw=4 ts=4 fdm=marker
59  * vim<600: noet sw=4 ts=4
60  */
61