Originally developed to support Fasm, scan.exe looks for external functions and creates a listing of declarations. Now, the tool has the capacity to create listings for MASM :

.386
.model flat, stdcall
option casemap:none

Include \masm32\include\windows.inc  ; Include with uppercase I to skip windows.inc
include msgbox.imp

includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib

.data
MsgCaption      db "Iczelion's tutorial no.2",0
MsgBoxText      db "Win32 Assembly is Great!",0

.code
start:
invoke MessageBox, NULL,addr MsgBoxText, addr MsgCaption, MB_OK
invoke ExitProcess,NULL
end start


scan msgbox.asm -m5

msgbox.imp :

ExitProcess PROTO :DWORD
MessageBoxA PROTO :DWORD,:DWORD,:DWORD,:DWORD
MessageBox equ <MessageBoxA>


scan msgbox.asm -m2

msgbox.imp :

externdef _imp__ExitProcess@4:PTR pr1
ExitProcess equ <_imp__ExitProcess@4>

externdef _imp__MessageBoxA@16:PTR pr4
MessageBox equ <_imp__MessageBoxA@16>


Scan available from :

http://vortex.masmcode.com/files/Scan338.zip
Posted on 2005-10-14 09:04:29 by Vortex
hi, Vortex!

thanks for your good job!

some wishes:
1.if it is possible to look firstly current dir for scan.ini, and if there is no then look scan.exe home dir - to override defaults for different project

2.do not add "section..." line for fasm mode: it will be extra when you place import into ".flat" or ".data" section directly

3.a switch -u to provide unicode aliases instead of ansi

thanks a lot!
Posted on 2005-10-17 04:35:48 by Shoo
Hi Shoo,

Thanks for your kind words.

Scan supports unicode :
External function scanner for FASM/MASM/TASM/GoASM/LzASM/HLA
Version 3.38 by Vortex

Usage    : scan <source file.ext> <output>

OUTPUT  :
-f  : FASM
-g  : FASM+GoLink
-a  : FASM+Alink
-dc : FASM+MS Link\PoLink (Direct call)
-ic : FASM+MS Link\PoLink (Indirect call)
-m  : MASM #1
-m2 : MASM #2
-m3 : MASM #3
-m4 : MASM #4
-m5 : MASM #5
-t  : TASM/LzASM
-go : GoASM
-h  : HLA

OPTIONAL :
-w  : Unicode
-n  : No warning messages
-is : Case insensitive search


To get a unicode output :
scan filename.asm -f -w


The other two wishes , they are on my to do list.
Posted on 2005-10-17 11:48:25 by Vortex
thanks! hope you will find these other two suggestions also useful in future ;)
Posted on 2005-10-18 00:13:25 by Shoo
Vortex > look there: http://www.winasm.net/forum/index.php?showtopic=633 ;)

corrected :) (prev was working for me as for the author :))
Posted on 2005-10-18 09:12:39 by Shoo
Hi Shoo,

Sorry, I am not able to display the link you posted, I receive an error message saying This page cannot be displayed. Later, I will try once more.
Posted on 2005-10-18 11:57:00 by Vortex
hi! i posted an addin for winasm studio wich provides project scaning with your tool. here is it. also, a 2 additionl wishes while using: non-zero return code on error and optional custom or fixed name for output (not name of passed file + .imp). put dll into winasm\addins and turn scan for import on in add-ins manager, then use shift+f8 or menu make\scan... . regards!
Attachments:
Posted on 2005-10-19 04:24:58 by Shoo
Hi Shoo,

Thanks for the addin, I will try it.

OK, for an optional name, I will add a new command line switch. I will look also for the return code on code.

Erol
Posted on 2005-10-19 04:52:53 by Vortex
i was wrong - shift+f9  :O very usefull tool!
Posted on 2005-10-19 04:55:12 by Shoo
Here is V3.40 Beta 1

Shoo, many thanks for your suggestions.

The three new features :

With the -o switch, you can give other names to the output file instead of the default name of listing file with the .imp extension :

scan filename.asm -f -o:functions.inc


The optional switch -cd forces the tool to read scan.ini from the current directory. By default, scan gets scan.ini from the directory where the tool is executed. This switch allows the user to create custom scan.ini files for different asm projects.

The -f2 switch emits a Fasm listing file without the statement section...

Here are the error codes returned by scan.exe :

1 - Unable to open filename.ext
2 - Error in command line parameters
3 - File name without extension
4 - Unable to open scan.ini
5 - Unable to open filename.dll
6 - filename.dll doesn't export any function(s)
7 - No any imported function(s) or check scan.ini for a missing DLL name(s)
8 - Unable to create destination file


http://vortex.masmcode.com/files/Scan340Beta1.zip
Posted on 2005-10-23 10:26:09 by Vortex
thx a lot! i'll update addin as soon as i'll be free a little
Posted on 2005-10-24 00:22:19 by Shoo
Here is V3.40 Beta 2

- Fixed bug concerning the output created with -m4
- A demonstration with the new switch -o
Attachments:
Posted on 2005-10-25 05:03:04 by Vortex