The MASM Forum

General => The Campus => Topic started by: shaikkareem on October 03, 2014, 06:19:10 PM

Title: Linking problem
Post by: shaikkareem on October 03, 2014, 06:19:10 PM
Hello every one...while reading specification of COM on msdn i want to do some accessing thing in provided shell32.dll or in some in- process servers. So by default as you all know about com we need guids of classes and interfaces built in them to make use of them...but for now i want to access shell32.dll server's classes and interfaces...for that most or all of their guids are provided in uuid.lib file in ms sdk dir. So the problem is how to link this lib file for resolving extranal references with my asm file...
Title: Re: Linking problem
Post by: jj2007 on October 03, 2014, 06:36:02 PM
By including it maybe?

include \masm32\include\masm32rt.inc
includelib "C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib\Uuid.Lib"

.code
AppName db "Masm32:", 0

start: MsgBox 0, "Hello World", addr AppName, MB_OK
exit

ExternDef BHID_Filter:DWORD
mov eax, BHID_Filter  ; just a test

end start
Title: Re: Linking problem
Post by: shaikkareem on October 03, 2014, 06:54:50 PM
Thanks jj.., i did that early but no use... at ml.exe stage where still showing that the symbols are undefined...
Is there any way to link it with my prog externally...?
Title: Re: Linking problem
Post by: Gunther on October 03, 2014, 07:14:14 PM
Hi shaikkareem,

could you post the critical code, please? So we can test it and find the errors.

Gunther
Title: Re: Linking problem
Post by: jj2007 on October 03, 2014, 10:00:53 PM
Quote from: shaikkareem on October 03, 2014, 06:54:50 PM
Thanks jj.., i did that early but no use... at ml.exe stage where still showing that the symbols are undefined...
Is there any way to link it with my prog externally...?

You need to define them, as I did tentatively with the ExternDef
Often, you need only a few, so you can dig into the *.h and translate them "by hand". Otherwise, search the forum for header threads posted by vortex
Title: Re: Linking problem
Post by: dedndave on October 03, 2014, 11:18:55 PM
uuid.lib is filled with numerous GUID's and CLSID's
as far as i know, it has no code or other data in it
generally, you can google the specific one you want and add it to the data section
Title: Re: Linking problem
Post by: shaikkareem on October 04, 2014, 12:07:48 AM
Thanks ded and jj but as you said defining them manually or googling them and entering in data section is not good as you think, i had tried that way but most of that given bad result...simply googling with CLSID_ or IID_  prefixes dont give result as my experience. Could you guys know an utility which explores the content of a lib file so that i get the ids encoded in uuid and then manually drfine them....?
Title: Re: Linking problem
Post by: dedndave on October 04, 2014, 12:47:57 AM
well - the library (libraries, actually - there are a few different ones) is designed for use with the MS C compilers
the compiler code "knows" which GUID's are in the library

but, you can use Erol's lib2def tool to generate a list of exports
from that DEF file, you can easily make an include file

http://vortex.masmcode.com/ (http://vortex.masmcode.com/)

wouldn't be hard to write a little program to dump the contents   :P
Title: Re: Linking problem
Post by: TouEnMasm on October 04, 2014, 02:01:18 AM

correct syntax
includelib uuid.lib ;or another
EXTERNDEF  IID_MYIID:GUID

Title: Re: Linking problem
Post by: Gunther on October 04, 2014, 02:01:34 AM
Hi Dave,

Quote from: dedndave on October 04, 2014, 12:47:57 AM
but, you can use Erol's lib2def tool to generate a list of exports
from that DEF file, you can easily make an include file

http://vortex.masmcode.com/ (http://vortex.masmcode.com/)

that's the way to go. By the way, Erol's tool is very helpful.

Gunther
Title: Re: Linking problem
Post by: dedndave on October 04, 2014, 02:08:51 AM
i guess i could write a little program to dump the contents of these libraries
then, you can grab the one you need and add it to your code
there are other similar libraries besides uuid.lib, like dxguid, wbemuuid, wiaguid, etc
Title: Re: Linking problem
Post by: TouEnMasm on October 04, 2014, 02:21:45 AM
here a mixed content of further uuid lib,syntax masm
Title: Re: Linking problem
Post by: shaikkareem on October 04, 2014, 04:56:36 PM
Guys really your help is appreciable and the vortex tools are very helpfull to solve my problem with libraries inclussion ... i used the tools available at vortex page and had overcome the problem. Now the ml.exe and link.exe recognizing the extranal symbols provided in prog.
Genarally used lib2inc .exe which generated a uuid.inc file, and i included both the .lib and .inc versions of uuid and the error was no longer appeared during compilation and execution. :icon14: