This new small tool scans for invoked external functions and creates a file containing all the
necessary imported functions in the source file.


format MS COFF

include ''
include 'demo.imp'

section '.code' code readable executable

public start
invoke MessageBox,HWND_DESKTOP,"Hi! I'm the example program!","Win32 Assembly",MB_OK
invoke ExitProcess,0

scan demo.asm

Result: demo.imp

extrn 'MessageBoxA' as MessageBox:dword
extrn ExitProcess:dword

This tool can be usefull when a big asm source file has to be re-assembled several times during
the development stage.With a list of the just necessary API functions,the assembler will run much
more fast.This can be usefull for slow processors.

scan.exe creates an import list for Golink,while scan2.exe creates one for alink.

You will find also Privalov's template example in the attachment.

The tool uses a list of API functions( belonging to:


You can edit/modify the list to put more API functions from different DLLs.
Posted on 2003-05-14 10:33:50 by Vortex
Very nice Vortex! :alright:
Posted on 2003-05-14 11:12:02 by Tommy
Thanks Tommy.

I fixed a small bug and uploaded the attachment.
You can re-download the file.
Posted on 2003-05-14 11:47:35 by Vortex
Yes, really very nice.
Maybe you could make a feature of scanning the DLL files for imports (with automatical choosing of A or W version)?
Posted on 2003-05-14 11:50:58 by Tomasz Grysztar
Thanks! :)
Posted on 2003-05-14 11:56:16 by Tommy
Thanks Privalov,I will think of it.

Version 1.01

*Fixed bug with multiple function names.
*Printing total warnings of undefined functions.
Posted on 2003-05-14 14:32:22 by Vortex
Nice. :alright:
Posted on 2003-05-14 17:08:33 by comrade
Thanks Comrade.
Posted on 2003-05-15 01:29:48 by Vortex
Version 2.00

Now,the tool constructs directly an import section for Fasm
source files.For example,if you have a file named template.asm
you will get template.imp as:

section '.idata' import data readable writeable

library kernel32,'kernel32.dll',\

import ExitProcess,'ExitProcess',\

import CreateWindowEx,'CreateWindowExA',\

Other features:

*Support for the cinvoke macro
*Usage of Widechar
*Support for Masm
*You can add one character at the end of invoke:
So,invoke=invoke2=invokex etc... Usefull for different invoke macro
constructions.(Check the Masm example)

External function scanner for FASM/MASM
Version 2.0 by Vortex

Usage : scan <source file.ext> <output> [Widechar]
output : -f:Fasm
Widechar : -w

-F,-G,-A,-M : no warning messages

If the scanner encounters a function which is not defined in the include
file,it displays a warning message.

The scanner's include file has been renamed to
The -w parameter is optional for Widechar definitions.
You can edit/modify the include files.

Fasmw users:You need to use the old library/import macros with the
scanner.(Check Privalov's file in the attachment.)
Posted on 2003-05-20 05:12:49 by Vortex
Hi Vortex, thank you for this program.

What do you think of having the output optionally available also on 'stdout' in order to use John Found's script for fasm?

format MS COFF
script 'scan test.asm -g'

You may avoid an extra file per source file and it keeps syncronized.
Posted on 2003-05-27 03:34:43 by pelaillo
Hi pelaillo,

Yes,that's a nice idea. :alright:

There is a serious problem concerning the access to the internet in the
middle-east.Some cables has broken;here the connection is very slow.
I need to wait much during the loading of web pages.

Pelaillo,can you add the new scan command to the scripting engine?

Many thanks,

Posted on 2003-05-27 04:47:47 by Vortex
Hi Vortex.

About scripting engine requrements: Simply use stdout handle for output your file. You can make it with another command line switch. To get handle of the stdout you must use:

invoke  GetStdHandle, STD_OUTPUT_HANDLE

To compile with script support you can't use standart FASMW, but FASMWEx package of pelaillo or my modified FASMW here:

here is one script example:
Posted on 2003-05-27 07:04:57 by JohnFound
Originally posted by Vortex
Pelaillo,can you add the new scan command to the scripting engine?

OK, I will try to add it to your scan program.

BTW, do you have any advancements on scanning from dlls as per Privalov's suggestion?

I am interested on it too.

I hope your internet connection gets repaired soon.

Best Regards,
Posted on 2003-05-27 07:37:50 by pelaillo
Thanks JohnFound for the infos.


Theorically,I planned the next version.We can get easily
the function names from the export tables of DLLs.
How can I can understand if a Windows version is running with
WideChar. set?

Still,my internet connection is very slow.

Best regards,

Posted on 2003-05-28 01:29:07 by Vortex
Version 3.00

Now, the tool can scan the export table of DLLs,so there is no need anymore
of special include files.All you need is to configurate the scan.ini file which
includes the required DLL names.

Usage : scan <source file.ext> <output> [optional]

output : -f : FASM #1
-f2 : FASM #2
-g : FASM+GoLink
-a : FASM+Alink
-m : MASM
-t : TASM
-Go : GoASM

optional : -w : widechar
-n : no warning messages

The switch -f2 provides the alternate form of the import section:

section '.idata' import data readable writeable

library kernel32,'kernel32.dll',\

import kernel32,\

import user32,\

Also,the scanner supports now GoAsm and Tasm. :)

The switch -Go (GoAsm) looks only for functions originally ending with A/W

invoke MessageBox,0,... -----> MessageBox equ MessageBoxA

Switch -n disables the "undefined function x" warnings.
Posted on 2003-06-10 04:41:30 by Vortex
Very good Vortex :alright:
Posted on 2003-06-10 12:28:23 by cakmak
Thanks cakmak
Posted on 2003-06-10 12:36:59 by Vortex
Hi Vortex. This tool get better and better! :)

At first, bug report: It hangs when started without any parameters.

And so, what about output to <stdout> (scripting support). If you have no time to do this, I can try, but visibly you don't want to share sources. Isn't it? So, what you think about it?
Posted on 2003-06-11 03:21:56 by JohnFound
Vortex, John Found:

I've doing the script version for scan.exe and I am near to complete. I post the partial work to avoid unnecessary rework. I hope to finish it within tomorrow.

The features are:

+ Standard output for fasm, alink and golink same as scan.exe
+ Get names directly from dlls
+ Parse imported functions from source skipping comments and strings

While doing the script, I have figured out a possible strategy to have linking capabilities native to fasm without an external linker. Please give me your oppinion about and if it is possible, I will start coding it.

This is going to be long...sorry...

To link same sections together, it is possible to use good controlled flat pages of fixed lenght. (to preserve the flat nature of fasm)

The idea is having a new directive for fasm PE format.

Please follow the example to produce a "test.exe":
Posted on 2003-06-11 05:47:39 by pelaillo

I runned the scanner without any parameters on three different computer with different O.S:Win 95b,Win 98 and Win XP. I didn't observe any system hanging/crashing. This should not happen at all.
When you type "scan",you should get the welcome screen:

External function scanner for FASM/MASM/TASM/GoASM
Version 3.0 by Vortex

Usage : scan <source file.ext> <output> [optional]

output : -f : FASM #1
-f2 : FASM #2
-g : FASM+GoLink
-a : FASM+Alink
-m : MASM
-t : TASM
-Go : GoASM

optional : -w : widechar
-n : no warning messages

My coding languages for this tool:C & asm .(a lot of source files. :) )
Johh, how can I help you for the hanging problem?


The swith -Go for GoAsm is intented to have a kind of "pre-compiled" headers when you are
working with large GoAsm projects;the processing speed of GoAsm should reach the
maxium with big source files containing only the necessary external function declarations.
Just copy&paste all the necessary declarations from the .imp file to your source file;then
you have no need of separate .imp files.

I appreciate your works for GoAsm. :alright:

Hi pelaillo,

You wrote:

>I have figured out a possible strategy to have linking capabilities native to fasm without an external linker.

Nice idea :alright: If I understand you well,you need to study hardly the COFF specification&
documentation. You will code a kind of linker. :alright:
Posted on 2003-06-11 08:49:00 by Vortex