I am trying to include the shortcut routines provided by Donkey.
However, the link step can not resolve "CoInitialize",
nor can it resolve "CoCreateInstance"
I have tried searching everything I have to locate these two
modules, but still come up with nothing. Frankly, I do not
even know what these two functions accomplish.
Below, I have included my code, as well as the link information.
Can anyone tell me what I am doing wrong?
Chip
;***************************************************************************************;
#include "C:\Program Files\Assembly\Include\Files.inc"
#include "C:\Program Files\Assembly\Include\windows.inc"
#include "C:\Program Files\Assembly\Include\all_api.inc"
;The Following are included for clarity
#define IF cmp
#define If cmp
#define Yes 1
#define No 0
VK_S equ 53h
SW_SHOWMINIMIZED equ 2
FILESLIB = C:\Program Files\Assembly\Include\Files.lib
CreateLinkIndirect = FILESLIB:CreateLinkIndirect
;***************************************************************************************;
DATA Section "DShort"
lnkfile DB "C:\TestLink.LNK",0
lnktarget DB "C:\RadASM\RadASM.EXE",0
lnkDesc DB "Description",0
lnkStrt DB "C:\RadASM",0
lnkIcoLoc DB "C:\WinNT\system32\SHELL32.dll",0
lnkArgs DB "/s",0
LINK_INFO Struct
pFilename DD ?
pLinkTarget DD ?
pIconLocation DD ?
dwIconIndex DD ?
pDescBuffer DD ?
cchDesc DD ?
pArgBuffer DD ?
cchArg DD ?
pStartIn DD ?
dwHotkey DD ?
dwShowCmd DD ?
ENDS
li LINK_INFO <>
;***************************************************************************************;
;***************************************************************************************;
Code Section "CShort"
Shortcut:
invoke CoInitialize,0
mov [li.pFilename],offset lnkfile
mov [li.pLinkTarget],offset lnktarget
mov [li.pIconLocation],offset lnkIcoLoc
mov D[li.dwIconIndex],10
mov [li.pDescBuffer],offset lnkDesc
mov [li.pArgBuffer],offset lnkArgs
mov [li.pStartIn],offset lnkStrt
mov D[li.dwHotkey],VK_S
mov D[li.dwShowCmd],SW_SHOWMINIMIZED
invoke CreateLinkIndirect,offset li
End_OF_Shortcut_Module:
;***************************************************************************************;
Ret ;End of Shortcut module
;***************************************************************************************;
GoLink.Exe Version 0.26.4 - Copyright Jeremy Gordon 2002/6-JG@JGnet.co.uk
C:\Program Files\Assembly\Program\Objects\Control.obj
Made on Tuesday, October 10, 2006 at 22:08 size: 3,865 bytes
C:\Program Files\Assembly\Program\Objects\Analyse.obj
Made on Tuesday, October 10, 2006 at 22:08 size: 1,695 bytes
C:\Program Files\Assembly\Program\Objects\Calculate.obj
Made on Tuesday, October 10, 2006 at 22:08 size: 1,004 bytes
C:\Program Files\Assembly\Program\Objects\Compute.obj
Made on Tuesday, October 10, 2006 at 22:08 size: 1,156 bytes
C:\Program Files\Assembly\Program\Objects\Read.obj
Made on Tuesday, October 10, 2006 at 22:08 size: 799 bytes
C:\Program Files\Assembly\Program\Objects\Write.obj
Made on Tuesday, October 10, 2006 at 22:08 size: 789 bytes
C:\Program Files\Assembly\Program\Objects\Setup.obj
Made on Tuesday, October 10, 2006 at 22:08 size: 7,565 bytes
C:\Program Files\Assembly\Program\Objects\Log.obj
Made on Tuesday, October 10, 2006 at 22:08 size: 1,587 bytes
C:\Program Files\Assembly\Program\Objects\Shortcut.obj
Made on Tuesday, October 10, 2006 at 22:08 size: 2,633 bytes
C:\SYSTEM\system32\Kernel32.dll
Made on Wednesday, August 04, 2004 at 05:00 size: 983,552 bytes
Number of required imports found in this file: 14
C:\SYSTEM\system32\User32.dll
Made on Wednesday, March 02, 2005 at 11:09 size: 577,024 bytes
Number of required imports found in this file: none
C:\SYSTEM\system32\Gdi32.dll
Made on Wednesday, December 28, 2005 at 19:54 size: 280,064 bytes
Number of required imports found in this file: none
C:\SYSTEM\system32\COMCTL32.dll
Made on Wednesday, August 04, 2004 at 05:00 size: 611,328 bytes
Number of required imports found in this file: none
C:\SYSTEM\system32\comdlg32.dll
Made on Wednesday, August 04, 2004 at 05:00 size: 276,992 bytes
Number of required imports found in this file: none
C:\SYSTEM\system32\OLEAUT32.dll
Made on Wednesday, August 04, 2004 at 05:00 size: 553,472 bytes
Number of required imports found in this file: none
C:\SYSTEM\system32\Hhctrl.ocx
Made on Thursday, May 26, 2005 at 19:04 size: 546,304 bytes
Number of required imports found in this file: none
C:\SYSTEM\system32\winspool.drv
Made on Wednesday, August 04, 2004 at 05:00 size: 146,432 bytes
Number of required imports found in this file: none
C:\SYSTEM\system32\shell32.dll
Made on Thursday, March 16, 2006 at 21:03 size: 8,452,096 bytes
Number of required imports found in this file: none
Error!
The following symbols were not defined in the object file or files:-
CoInitialize
CoCreateInstance
Output file not made
Hi Chip
CoInitialize and CoCreateInstance are Windows APIs which are in the system file ole32.dll, so you need to add that to the list of DLLs given to the linker.
You can find out what system DLL the various Windows APIs are in, and what those APIs do, using the Microsoft SDK which is available on-line.
Here is a link to CoInitialize in the SDK:-
http://windowssdk.msdn.microsoft.com/en-us/library/ms678543.aspx (http://windowssdk.msdn.microsoft.com/en-us/library/ms678543.aspx)
and here is a link to CoCreateInstance in the SDK:-
http://windowssdk.msdn.microsoft.com/en-us/library/ms686615.aspx (http://windowssdk.msdn.microsoft.com/en-us/library/ms686615.aspx)
If you look down at the bottom of the SDK specification for these APIs you can see the words: "Library: use ole32.lib". This indicates that they are in ole32.dll (GoLink does not need the lib file referred to here, because it looks inside the DLL itself to identify the function).
Jeremy,
Thank you, that seemed to solve the problem.
When I first downloaded and installed the SDK,
I looked for directrions or information on what
was contained. I never did find anything that
made sense to me, nor explained what was
contained in all of the directories.
My best shot at finding most data has been to
do a string search on all files in masm, goasm,
and now the SDK to see if I get some sort of
"hit". I know that this sound outrageous, but
I find the overall masm and SDK documentation
absolutely appaling.
(Perhaps my shortcoming is that I have never
programmed in any of the various "C" languages.
Yet, all documentation is oriented to these
particular languages.)
Chip
Chip
You might find the "contents", "index", "search" tabs at the bottom of the left hand side of the SDK screen handy for finding the right thing. Once you have found something if you click on the "sync contents" toolbar button, this gets you to the correct place in the contents.
I agree that having the samples in "C" is a pain, but as you progress you will find that you get to understand these and are able to follow them!
Hi Chip,
You are like me, I had no experience in any languages when I began in assembler, this can actually be an advantage as you have no prejudice or preconceptions enterring into programming. I found that when I began to learn C years later that I brought alot of assembler bagage with me and had to temporarily "unlearn" certain things in order to make progress in C, I have since abandonned the effort as GoAsm provides me with just about everything I need for x86 programming, I only use C now for a small amount of ARM programming for my PDA. It did not take long however to learn to read and for the most part understand enough C to navigate and use th SDK, in that case a little goes a long way and you will soon find that you can quickly skim the examples and understand them.
Donkey