flat assembler
Message board for the users of flat assembler.

Index > Windows > "unused" import removed (bug or optional?)

Author
Thread Post new topic Reply to topic
matefkr



Joined: 02 Sep 2007
Posts: 1291
Location: Ukraine, Beregovo
matefkr
So, i made a small thing, so that sometimes, it would use one kind of api function then another. both of them defined, but one is not used directly as the label, (but throught the previous label+ecx, where ecx is either 0 or four depending). As i disassamble the compiled cod,e there is no trace of the import, the label of which was not referenced directly in the code.

I think it removes all "unused" imports, is there any way to disable that?
Post 26 Jan 2012, 10:38
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17280
Location: In your JS exploiting you and your system
revolution
matefkr wrote:
I think it removes all "unused" imports, is there any way to disable that?
Yes. Find IMPORT32.INC and replace all occurrences of "if used label" with "if 1".
Post 26 Jan 2012, 10:55
View user's profile Send private message Visit poster's website Reply with quote
matefkr



Joined: 02 Sep 2007
Posts: 1291
Location: Ukraine, Beregovo
matefkr
what would be 1? true?
Post 26 Jan 2012, 11:34
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17280
Location: In your JS exploiting you and your system
revolution
1 == always used. Then every import would appear in the section regardless of its actual use.

But an alternative solution to what you asked for would be to actually make it used, and still have the macros remove all the other unused imports.
Code:
virtual
 invoke TheAPIiWantToUse,0
end virtual    
Post 26 Jan 2012, 11:37
View user's profile Send private message Visit poster's website Reply with quote
matefkr



Joined: 02 Sep 2007
Posts: 1291
Location: Ukraine, Beregovo
matefkr
i get it, the statement in the if is normally a result of a logical statement. if i put in just 1 it equals true.

anyway, its a hacked together thing. im just tryng necessary building for later program.

it crashes now.

i attach file (i want to realloc memory for me, if i need more. thats for a test if ican do reallocation).

EDIT: among other things, the problem was that messageboxa screwed up ecx, and left it like that.


Description:
Download
Filename: zolydebug.ASM
Filesize: 5.79 KB
Downloaded: 37 Time(s)

Post 26 Jan 2012, 11:43
View user's profile Send private message Reply with quote
l_inc



Joined: 23 Oct 2009
Posts: 881
l_inc
matefkr
For the future, if you need to prevent ignoring unused imports, you should just refer the symbols somehow. I'd suggest you to use something like this:
Code:
;refers a symbol, so that used-directive returns true
;e.g., allows to prevent omitting unused imports
macro refer [arg*] { times arg-arg }    

E.g., if you need to add statical dependencies on let's say ws2_32.dll and comctl32.dll (which is a common situation) without calling their functions, you just need to write:
refer WSAStartup,InitCommonControls. Of course you also should have them (explicitly or implicitly) described in your import directory.
Post 26 Jan 2012, 21:44
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.