....
invoke [_ap_rputs@8], "dddd", [esp + ep.r]
mov eax, -1
ret
mod_tut1_register_hooks:
invoke [_ap_hook_handler@20], addr mod_tut1_method_handler, 0, 0, 20
ret
.....
output:
GoAsm.Exe Version 0.56 beta - Copyright Jeremy Gordon 2001/7 - JG@JGnet.co.uk
Output file: test.obj
GoLink.Exe Version 0.26.7 - Copyright Jeremy Gordon 2002/6-JG@JGnet.co.uk
Error!
The following symbols were not defined in the object file or files:-
_ap_rputs
_ap_hook_handler
Output file not made
This doesn't happen for me.
Could you post more of your source?
D:\tool>type test.asm
#DYNAMICLINKFILE d:\tool\libhttpd.dll
.code
invoke [_ap_walk_config@12], 1, 1, 1
invoke [_ap_xml_parse_input@8], 1, 1
invoke [ap_allow_methods]
invoke [ap_allow_standard_methods], 1, 1
invoke [_ap_vrprintf@12], 1, 1, 1
D:\tool>d:\tool\goasm test.asm
GoAsm.Exe Version 0.56 beta - Copyright Jeremy Gordon 2001/7 - JG@JGnet.co.uk
Output file: test.obj
D:\tool>d:\tool\golink test.obj
GoLink.Exe Version 0.26.7 - Copyright Jeremy Gordon 2002/6-JG@JGnet.co.uk
Error!
The following symbols were not defined in the object file or files:-
ap_walk_config
ap_xml_parse_input
ap_vrprintf
Output file not made
Sorry for my poor english, a problem: "_" and "@" ?
dumppe libhttpd.dll
....
00014C20 16C 426 _ap_update_vhost_from_headers@4
00014FC0 16D 427 _ap_update_vhost_given_ip@4
00014F40 16E 428 _ap_vhost_iterate_given_conn@12
00011640 16F 429 _ap_vrprintf@12
00002E90 170 430 _ap_walk_config@12
0001B1D0 171 431 _ap_xml_parse_input@8
0000E970 172 13 ap_allow_methods
0000E9B0 173 16 ap_allow_standard_methods
0002AEE0 174 25 ap_bucket_type_eoc
0002AF00 175 26 ap_bucket_type_error
....
At assembly time try "goasm -MS test.asm"
So goasm leaves the decorations "_" and "@" unchanged and GoLink can retrive the original MicroSoft fashion names.
I have not tested it, but it is a possible answer.
Best regards.
Patrick
1rDirEctoALgran0,
Go Tools can handle decorated names without any problem.
Forget what I said.
I think that the file "libhttpd.dll" has two dependency files : LIBAPR.DLL and LIBAPRUTIL.DLL.
Have you such files ?
Declare them with #DYNAMICLINKFILE or at link time.
Patrick
#DYNAMICLINKFILE "d:\tool\libhttpd.dll" "d:\tool\libapr-1.dll" "d:\tool\libaprutil-1.dll"
.code
invoke [_ap_walk_config@12], 1, 1, 1
invoke [_ap_xml_parse_input@8], 1, 1
invoke [ap_allow_methods]
invoke [ap_allow_standard_methods], 1, 1
invoke [_ap_vrprintf@12], 1, 1, 1
GoAsm.Exe Version 0.55.14e - Copyright Jeremy Gordon 2001/6 - JG@JGnet.co.uk
Output file: test.obj
GoLink.Exe Version 0.26.7 - Copyright Jeremy Gordon 2002/6-JG@JGnet.co.uk
Error!
The following symbols were not defined in the object file or files:-
ap_walk_config
ap_xml_parse_input
ap_vrprintf
Output file not made
#DYNAMICLINKFILE "d:\tool\libhttpd.dll" "d:\tool\libapr-1.dll" "d:\tool\libaprutil-1.dll"
.code
invoke [_ap_walk_config@12], 1, 1, 1
invoke [_ap_xml_parse_input@8], 1, 1
invoke [ap_allow_methods]
invoke [ap_allow_standard_methods], 1, 1
invoke [_ap_vrprintf@12], 1, 1, 1
d:\tool\goasm /ms test.asm
GoAsm.Exe Version 0.55.14e - Copyright Jeremy Gordon 2001/6 - JG@JGnet.co.uk
Output file: test.obj
d:\tool\goasm test.obj
GoLink.Exe Version 0.26.7 - Copyright Jeremy Gordon 2002/6-JG@JGnet.co.uk
Error!
The following symbols were not defined in the object file or files:-
_ap_walk_config
_ap_xml_parse_input
_ap_vrprintf
Output file not made
lw
Could you just confirm to me whether or not libhttpd.dll is a Win32 executable in PE format (which is what GoAsm works with)?
I downloaded it with a view to looking at the actual names of the APIs using Wayne Radburn's PEView (http://www.magma.ca/~wjr), and found that it appears to be a 16-bit DOS DLL.
D:\PROGRA~1\APACHE~1\Apache2.2\bin>dumppe libhttpd.dll 1>1.txt
libhttpd.dll (hex) (dec)
.EXE size (bytes) 490 1168
Minimum load size (bytes) 450 1104
Overlay number 0 0
Initial CS:IP 0000:0000
Initial SS:SP 0000:00B8 184
Minimum allocation (para) 0 0
Maximum allocation (para) FFFF 65535
Header size (para) 4 4
Relocation table offset 40 64
Relocation entries 0 0
Portable Executable starts at e8
Signature 00004550 (PE)
Machine 014C (Intel 386)
Sections 0005
Time Date Stamp 45A476E1 Wed Jan 10 13:17:21 2007
Symbol Table 00000000
Number of Symbols 00000000
Optional header size 00E0
Characteristics 210E
Executable Image
Line numbers stripped
Local symbols stripped
32 bit word machine
DLL
Magic 010B
Linker Version 6.00
Size of Code 00029000
Size of Initialized Data 0001C000
Size of Uninitialized Data 00000000
Address of Entry Point 00029ADB
Base of Code 00001000
Base of Data 0002A000
Image Base 6FF00000
Section Alignment 00001000
File Alignment 00001000
Operating System Version 4.00
Image Version 0.00
Subsystem Version 4.00
reserved 00000000
Image Size 00046000
Header Size 00001000
Checksum 00000000
Subsystem 0002 (Windows)
DLL Characteristics 0000
Size Of Stack Reserve 00100000
Size Of Stack Commit 00001000
Size Of Heap Reserve 00100000
Size Of Heap Commit 00001000
Loader Flags 00000000
Number of Directories 00000010
Directory Name VirtAddr VirtSize
-------------------------------------- -------- --------
Export 0002DAF0 00003870
Import 0002B418 000000B4
Resource 00041000 000007C8
Exception 00000000 00000000
Security 00000000 00000000
Base Relocation 00042000 00003104
Debug 0002A640 0000001C
Decription/Architecture 00000000 00000000
Machine Value (MIPS GP) 00000000 00000000
Thread Storage 00000000 00000000
Load Configuration 00000000 00000000
Bound Import 00000000 00000000
Import Address Table 0002A000 00000638
Delay Import 00000000 00000000
COM Runtime Descriptor 00000000 00000000
(reserved) 00000000 00000000
Section Table
-------------
01 .text Virtual Address 00001000
Virtual Size 00028BB0
Raw Data Offset 00001000
Raw Data Size 00029000
Relocation Offset 00000000
Relocation Count 0000
Line Number Offset 00000000
Line Number Count 0000
Characteristics 60000020
Code
Executable
Readable
02 .rdata Virtual Address 0002A000
Virtual Size 00007360
Raw Data Offset 0002A000
Raw Data Size 00008000
Relocation Offset 00000000
Relocation Count 0000
Line Number Offset 00000000
Line Number Count 0000
Characteristics 40000040
Initialized Data
Readable
03 .data Virtual Address 00032000
Virtual Size 0000EEA4
Raw Data Offset 00032000
Raw Data Size 0000A000
Relocation Offset 00000000
Relocation Count 0000
Line Number Offset 00000000
Line Number Count 0000
Characteristics C0000040
Initialized Data
Readable
Writeable
04 .rsrc Virtual Address 00041000
Virtual Size 000007C8
Raw Data Offset 0003C000
Raw Data Size 00001000
Relocation Offset 00000000
Relocation Count 0000
Line Number Offset 00000000
Line Number Count 0000
Characteristics 40000040
Initialized Data
Readable
05 .reloc Virtual Address 00042000
Virtual Size 000034DC
Raw Data Offset 0003D000
Raw Data Size 00004000
Relocation Offset 00000000
Relocation Count 0000
Line Number Offset 00000000
Line Number Count 0000
Characteristics 42000040
Initialized Data
Discardable
Readable
Exp Addr Hint Ord Export Name by libhttpd.dll - Wed Jan 10 13:17:21 2007
-------- ---- ----- ---------------------------------------------------------
0001A250 0 1 _ap_add_cgi_vars@4
00019DA0 1 2 _ap_add_common_vars@4
000057C0 2 3 _ap_add_file_conf@8
lw
It looks like I downloaded the wrong file.
The most likely cause of your problem is that the function you are trying to call is not in the DLLs which you are giving to GoLink.
To test this could you confirm that the functions appear on your PE dumps as exports from the DLL? Or, if copyright allows maybe you could post the DLLs here, then I can test it myself.
this file:
[attachment deleted by admin]
Thanks, there does seem to be a problem - I'll come back to you.
thanks, i like GoAsm
seem to be other problem:
---------------------------------------------
#DYNAMICLINKFILE libapr-1.dll
.code
start:
ret
Error!
Line 1 of assembler source file (D:\tool\test.asm):-
Specify .dll/.ocx/.exe/.drv for dynamic linker file:-
#DYNAMICLINKFILE libapr-1.dll
OBJ file not made
----------------------------------------
but
#DYNAMICLINKFILE 'libapr-1.dll'
.code
start:
ret
output:
GoLink.Exe Version 0.26.7 - Copyright Jeremy Gordon 2002/6-JG@JGnet.co.uk
Output file: D:\tool\test.exe
Format: win32 size: 1,536 bytes
lw
This problem arose because:-
- Some of the function names in libhttpd.dll were "decorated" (name-mangled) ie. containing an underscore before the function name and "@xx" after the name, where xx was the number of bytes PUSHed before the call.
- The Microsoft system DLLs do not contain decorated symbols.
- Many compilers and assemblers add such decoration to the symbols in the object files which they create to indicate that the symbol is imported and to specify the method of call.
- The Microsoft linker expects such decoration in the case of a symbol which is imported. But in order to deal with the fact that the imported symbols will be decorated in the object file, but not decorated in the DLLs, the linker ignores such decoration when looking for the correct symbol in the DLL or any LIB file made from the DLL.
- GoLink also ignores any such decoration. This allows GoLink to link object files containing decorated symbols. Also GoAsm adds decoration to the symbols in the object file if the /ms switch is specified. This allows GoAsm object files to be linked using the Microsoft linker.
- In the case of libhttpd.dll however, this arrangement does not work because the decoration must not be ignored by the linker. Unusually, the decoration forms part of the symbol name.
- I suspect that the symbols in libhttpd.dll are decorated because the DLL is designed to be used by a specific (non-Windows) linker which works that way.
- Anyway, the solution in the case of GoAsm+GoLink is for GoAsm to inform GoLink whether the symbols in the object file are decorated because the /ms switch was specified. This is done in the latest version of GoAsm 0.56.01 beta (attached). Now if GoLink is looking for a symbol in an object file made by GoAsm it will only ignore any decoration if the /ms switch has been specified. This happens in the latest version of GoLink (0.26.8) (attached).
- With these versions of GoAsm and GoLink you can require GoLink to look for a decorated symbol in the DLL. Just give the decoration but do not specify /ms in the command line.
So, lw hopefully this will now allow you to proceed. There is no need to amend your code.
Thanks for pointing out this problem.
[attachment deleted by admin]
:))