flat assembler
Message board for the users of flat assembler.

Index > Windows > A problem linking my .obj File With ALink

Author
Thread Post new topic Reply to topic
Jesse Redick



Joined: 11 Jan 2011
Posts: 15
Jesse Redick
Hello again,

Sorry, but I have another problem. It seems I can't get my .obj file to compile in Alink. Here is my code:

Code:
format ms coff

extrn '__imp__ShellExecuteA@24' as ShellExecute:dword

section '.text' code readable executable

public Shell

Shell:

push    5
push       0
push       0
push       a
push       0
push       0
call   [ShellExecute]
ret

section '.data' data readable writeable

a db 'notepad',0    


FASM turns it into an object file just fine. The problem is with Alinker. When I try to compile it like this:

Code:
alink.exe -oPE -subsys gui Shell.obj    


I get an "Unresolved external __imp__ShellExecuteA@24" error. Can anyone tell me what the problem is? Thanks again for your time.
Post 12 Jan 2011, 17:27
View user's profile Send private message Reply with quote
guignol



Joined: 06 Dec 2008
Posts: 720
guignol
Where is your ShellExecute?
Post 12 Jan 2011, 17:35
View user's profile Send private message Reply with quote
Jesse Redick



Joined: 11 Jan 2011
Posts: 15
Jesse Redick
guignol wrote:
Where is your ShellExecute?


Not sure I understand the question Confused . I am fairly new at this. I think I am calling ShellExecute correctly?
Post 12 Jan 2011, 17:39
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17341
Location: In your JS exploiting you and your system
revolution
Have you told Alink where to find "__imp__ShellExecuteA@24"? Which object file defines "__imp__ShellExecuteA@24"?
Post 12 Jan 2011, 17:43
View user's profile Send private message Visit poster's website Reply with quote
guignol



Joined: 06 Dec 2008
Posts: 720
guignol
Where's the address labeled ShellExecute which you try to call?
Post 12 Jan 2011, 17:45
View user's profile Send private message Reply with quote
Jesse Redick



Joined: 11 Jan 2011
Posts: 15
Jesse Redick
revolution wrote:
Have you told Alink where to find "__imp__ShellExecuteA@24"? Which object file defines "__imp__ShellExecuteA@24"?


Ah, no I did not. I was using the MS Coff demo from the FASM package as my base and so I didn't know had to do that. How would I go about telling Alink where it is?
Post 12 Jan 2011, 17:47
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17341
Location: In your JS exploiting you and your system
revolution
guignol wrote:
Where's the address labeled ShellExecute which you try to call?
It has been aliased to __imp__ShellExecuteA@24 with the extrn directive.
Post 12 Jan 2011, 17:48
View user's profile Send private message Visit poster's website Reply with quote
Jesse Redick



Joined: 11 Jan 2011
Posts: 15
Jesse Redick
guignol wrote:
Where's the address labeled ShellExecute which you try to call?


I will be trying to figure that out now Smile.
Post 12 Jan 2011, 17:48
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17341
Location: In your JS exploiting you and your system
revolution
Jesse Redick wrote:
revolution wrote:
Have you told Alink where to find "__imp__ShellExecuteA@24"? Which object file defines "__imp__ShellExecuteA@24"?


Ah, no I did not. I was using the MS Coff demo from the FASM package as my base and so I didn't know had to do that. How would I go about telling Alink where it is?
It is probably in a library file somewhere that came with Alink. Do you have other examples that come with Alink to show how to link things to the Windows API?
Post 12 Jan 2011, 17:51
View user's profile Send private message Visit poster's website Reply with quote
Jesse Redick



Joined: 11 Jan 2011
Posts: 15
Jesse Redick
revolution wrote:
Jesse Redick wrote:
revolution wrote:
Have you told Alink where to find "__imp__ShellExecuteA@24"? Which object file defines "__imp__ShellExecuteA@24"?


Ah, no I did not. I was using the MS Coff demo from the FASM package as my base and so I didn't know had to do that. How would I go about telling Alink where it is?
It is probably in a library file somewhere that came with Alink. Do you have other examples that come with Alink to show how to link things to the Windows API?


Yes I do, but they all are for NASM. I do understand what you are saying though Smile. Looks like I will have to work on this a bit more.
Post 12 Jan 2011, 17:56
View user's profile Send private message Reply with quote
Jesse Redick



Joined: 11 Jan 2011
Posts: 15
Jesse Redick
Well everyone,

I had thought I was close. The example that Alink gives for Coff files seems to need NASM syntax. Alink doesn't seem to want to compile an .obj file made with FASM syntax. I tried everything!

I will just have to find another linker instead. Thanks for putting me on the right path though revolution and guignol Smile.
Post 12 Jan 2011, 18:32
View user's profile Send private message Reply with quote
ProphetOfDoom



Joined: 08 Aug 2008
Posts: 120
Location: UK
ProphetOfDoom
Hi,

I've been using GoLink to link my Fasm programs.

http://www.godevtool.com/

It has good documentation. You just need to provide it with a text file telling it what system .dlls to link to (Shell32.dll I think, in your case).
Post 12 Jan 2011, 21:08
View user's profile Send private message Reply with quote
Jesse Redick



Joined: 11 Jan 2011
Posts: 15
Jesse Redick
ProphetOfDoom wrote:
Hi,

I've been using GoLink to link my Fasm programs.

http://www.godevtool.com/

It has good documentation. You just need to provide it with a text file telling it what system .dlls to link to (Shell32.dll I think, in your case).


ProphetOfDoom,

Wow thanks so much! I have been looking for a working linker all day and this one worked. Thank you again! Smile
Post 12 Jan 2011, 23:20
View user's profile Send private message Reply with quote
ProphetOfDoom



Joined: 08 Aug 2008
Posts: 120
Location: UK
ProphetOfDoom
You're welcome Smile Glad to have helped.
Post 13 Jan 2011, 01:18
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.