flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > Non-existing procedures

Author
Thread Post new topic Reply to topic
ManOfSteel



Joined: 02 Feb 2005
Posts: 1154
ManOfSteel 28 Jul 2007, 14:56
Hello,

I'm writing an in-process COM server and fasm is not assembling the methods' procedures. I added them to the .edata section and fasm could assemble them, but a normal COM server should not export anything other than the usual functions (register, unregister, unload now and get class).

By the way, the methods are defined with the interface pseudo-instruction.

So, is there any better way to compel fasm into assembling those procedures?

thanks for your suggestions.
Post 28 Jul 2007, 14:56
View user's profile Send private message Reply with quote
MichaelH



Joined: 03 May 2005
Posts: 402
MichaelH 30 Jul 2007, 02:21
Hi ManOfSteel, you haven't really explained the problem but I'll take a guess and say that perhaps ???? the problem is your understanding of the interface macro which puts all the methods of a interface in a virtual block so you can easily reference address offsets.

For example ( usecom from the fasm example)- ShellTaskBar

Code:
        ShellTaskBar dd ?
           
            virtual at 0
                        .QueryInterface dd ?
                        .AddRef dd ?
                        .Release dd ?
                       .HrInit dd ?
                        .AddTab dd ?
                        .DeleteTab dd ?
                     .ActivateTab dd ?
                   .SetActiveAlt dd ?
          end virtual


                 ; use it

                        mov eax,[ShellTaskBar]                  
                    push eax
                    
                    
                    ; Note  mov eax,[eax] below - 
                      ;this moves the "ShellTaskBar" object address that was created by windows using CoCreateInstance
                                          
                    mov eax,[eax]
                       

                        ; Hence ShellTaskBar.HrInit is an offset of 12 (0xC) from the 
                      ; memory location of the "ShellTaskBar" object 
                   ; It is not an offset of 12 (0xC) from ShellTaskBar dd ?
                    call[eax+ShellTaskBar.HrInit]

    


Do not confuse "ShellTaskBar dd ?" with the ShellTaskBar com object that windows has created somewhere else in memory .... "ShellTaskBar dd ?" just holds the address of that memory.

A virtual block is not output to the exe, it's just so memory offsets are easier to use in your code.

Hope this helped. If not, please supply more detail of your problem.
Post 30 Jul 2007, 02:21
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 30 Jul 2007, 09:28
try to insert following instead of export:

Code:
virtual at 0
 dd name_of_function
end virtual    


If FASM assembles those functions after inserting this, then you are simply not refering those functions anywhere in your sources, so PROC macro leaves them out. That is most likely bug in your code.
Post 30 Jul 2007, 09:28
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
ManOfSteel



Joined: 02 Feb 2005
Posts: 1154
ManOfSteel 30 Jul 2007, 13:40
Yes, indeed it was my misunderstanding of the interface macro. Thank you both for clarifying it.
Post 30 Jul 2007, 13:40
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.