My favorites
▼
|
Sign in
user32hooking
USER32.dll Hooking DLL (Disable Gesture API)
Project Home
Downloads
Wiki
Issues
Source
Checkout
Browse
Changes
Source path:
svn
/
trunk
/
listexport.patch
r5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
--- listexport_old.cpp 2009-02-15 16:41:24.000000000 +0900
+++ listexport_new.cpp 2010-06-13 19:16:58.062500000 +0900
@@ -123,6 +123,7 @@
// printfɽÀÌbZ[W{bNX
DWORD PrintMsg(char *pszFormat, ...)
{
+#define MYDEBUG
#ifdef MYDEBUG
va_list argList;
va_start(argList, pszFormat);
@@ -351,7 +352,7 @@
(offset + p_export_directory->AddressOfNameOrdinals - dir_left),
offset, p_export_directory->AddressOfNameOrdinals, dir_left);
- for(DWORD i=0; i < MIN(name_num, func_num); i++){
+ for(DWORD i=0; i < /*MIN(*/name_num/*, func_num)*/; i++){
char *name = (char *)(p_export_data + p_export_names[i] - dir_left);
pp_list_name[p_export_name_ordinal[i]] = (char *)malloc(strlen(name) + 1);
if(pp_list_name[p_export_name_ordinal[i]] == NULL){
@@ -361,14 +362,24 @@
strcpy(pp_list_name[p_export_name_ordinal[i]], name);
}
+ int NONAMECnt = 0;
+ for (int i=0; i<func_num; i++)
+ {
+ if(pp_list_name[i]==NULL)
+ {
+ pp_list_name[i] = (char*)malloc(50);
+ sprintf(pp_list_name[i], "NONAME%u", ++NONAMECnt);
+ }
+ }
+
// ##########################################
// f[^oͪ
// ##########################################
// GNX|[gf[^ð\¦ioÍj
if(option_flag == 0){
- for(DWORD i=0; i < MIN(name_num, func_num); i++)
- printf(": %04X ¼O: %s\n", p_list_ordinal[i], pp_list_name[i]);
+ for(DWORD i=0; i < /*MIN(name_num,*/ func_num/*)*/; i++)
+ printf(": %04X ¼O: %s\n", p_list_ordinal[i], pp_list_name[i]);
}
// GNX|[gf[^ð³ÉDLL\[X¶¬
@@ -393,12 +404,14 @@
// include <windows.h>
fprintf(outfp, "#include <windows.h>\n");
// FARPROC p_function
- for(DWORD i=0; i < MIN(name_num, func_num); i++)
+ for(DWORD i=0; i < /*MIN(name_num,*/ func_num/*)*/; i++)
+ {
fprintf(outfp, "FARPROC p_%s;\n", pp_list_name[i]);
+ }
// extern "C"
fprintf(outfp, "extern \"C\" {\n");
// __declspec( naked ) void d_function() { _asm{ jmp p_function } }
- for(DWORD i=0; i < MIN(name_num, func_num); i++){
+ for(DWORD i=0; i < /*MIN(name_num,*/ func_num/*)*/; i++){
fprintf(outfp,
"__declspec( naked ) void WINAPI d_%s() { _asm{ jmp p_%s } }\n",
pp_list_name[i], pp_list_name[i]);
@@ -418,10 +431,17 @@
" if(h_original == NULL)\n"
" return FALSE;\n", file_name);
// p_function = GetProcAddress(h_original, "function");
- for(DWORD i=0; i < MIN(name_num, func_num); i++){
- fprintf(outfp, " "
- "p_%s = GetProcAddress(h_original, \"%s\");\n",
- pp_list_name[i], pp_list_name[i]);
+ for(DWORD i=0; i < /*MIN(name_num,*/ func_num/*)*/; i++){
+ if(strncmp(pp_list_name[i], "NONAME", 6)==0)
+ {
+ fprintf(outfp, " "
+ "p_%s = GetProcAddress(h_original, MAKEINTRESOURCE(%u));\n",
+ pp_list_name[i], i+p_export_directory->Base);
+ } else {
+ fprintf(outfp, " "
+ "p_%s = GetProcAddress(h_original, \"%s\");\n",
+ pp_list_name[i], pp_list_name[i]);
+ }
}
fprintf(outfp,
" break;\n"
@@ -450,11 +470,11 @@
// project_name©ç".def"ðr
project_name[strlen(project_name) - strlen(".def")] = '\0';
// LIBRARY DLLfile...
- fprintf(outfp, "LIBRARY %s\n", project_name);
+ fprintf(outfp, "LIBRARY %s ;BASE=%u\n", project_name, p_export_directory->Base);
fprintf(outfp, "EXPORTS\n");
// function=d_function @ 1
- for(DWORD i=0; i < MIN(name_num, func_num); i++)
- fprintf(outfp, " %s=d_%s @ %d\n", pp_list_name[i], pp_list_name[i], i + 1);
+ for(DWORD i=0; i < /*MIN(name_num,*/ func_num/*)*/; i++)
+ fprintf(outfp, " %s=d_%s @ %d %s\n", pp_list_name[i], pp_list_name[i], i+p_export_directory->Base/* + 1*/, strncmp(pp_list_name[i], "NONAME", 6)==0?"NONAME":"");
fclose(outfp);
printf("\[Xt@C %s.cpp, %s.def 𶬵ܵ½\n",
@@ -462,13 +482,13 @@
}
// mÛµ½Ö¼pÌððú
- for(DWORD i=0; i < name_num; i++){
+ for(DWORD i=0; i < func_num/*name_num*/; i++){
if(pp_list_name[i])
free(pp_list_name[i]);
}
// ÌJú
- free(pp_list_name);
+ //free(pp_list_name);
free(p_list_ordinal);
free(p_section_header);
free(p_export_data);
Show details
Hide details
Change log
r5
by teraapi on Jun 18, 2010
Diff
add patch for listexport
Go to:
/trunk/listexport.patch
Project members,
sign in
to write a code review
Older revisions
All revisions of this file
File info
Size: 4732 bytes, 116 lines
View raw file
Powered by
Google Project Hosting