COM-Inspection
|
|
Thread rating:  |
Alexander Mueller - 28 Sep 2007 17:53 GMT Hi
I am looking for boiler-plate code to examines the interior of COM-DLLs, in order to enum Interfaces and CoClasses exposed, getting the names of the Interfaces, the IID. Also for CoClasses the Name, the CLSID, the Inproc-Server-file the associated Typelib, its GUID and the Typelib version.
I want to check if the GUIDs got properly registred during a setup We had some issues with registration and non-binary compatible DLLs.
Its probaly doable with Win32-regfunctions, but quite a lot of code for resolving all the associations.
The alternative, Typelibinfo-DLL, is it kind of a built-in DLL, located on probably any XP/Win2000 system, or does it ship with Dev-Tools only?
Any hints much appreciated!
MfG, Alex
Tony Proctor - 28 Sep 2007 18:00 GMT There's a very useful DLL called TLBINF32.DLL Alex. If you have it then it will appear as "Typelib Information" in your Project References list. There is a *.chm file for it but I'm not sure where I found it now
Tony Proctor
> Hi > [quoted text clipped - 19 lines] > MfG, > Alex Ken Halter - 28 Sep 2007 18:18 GMT > Hi > [quoted text clipped - 6 lines] > MfG, > Alex Tlbinfo32.dll's not installed by default, so you'll have to package it along with your app.
I have an addin that will generate an XML file that contains interface info... like properties, methods, events, enums, types, whatever. If interested in something like that, download the (fully functional) trial version http://www.vbsight.com/ComGuard.htm It'll also generate a class module you can add to your app that'll verify the presence and registered state of every reference in your project.... plus a bunch of other stuff (more on the way)
If you want to "roll your own", here's a good start... be sure to grab all dependencies (shown in the "Related" section of the page)... and there is a bug in the way he displays the results... but, it can still be used as a starting point.
ActiveX Documenter http://www.vbaccelerator.com/home/VB/Utilities/ActiveX_Documenter/article.asp
 Signature Ken Halter - MS-MVP-VB - Please keep all discussions in the groups.. In Loving Memory - http://www.vbsight.com/Remembrance.htm
Tony Proctor - 28 Sep 2007 20:02 GMT I swear mine came with the VS6 installation Ken. In fact I had to use the version that came with VB6 SP6 (even though I still use SP5) because it had an important bug fix
Tony Proctor
> > Hi > > [quoted text clipped - 24 lines] > > ActiveX Documenter http://www.vbaccelerator.com/home/VB/Utilities/ActiveX_Documenter/article.asp
Ken Halter - 28 Sep 2007 21:01 GMT >I swear mine came with the VS6 installation Ken. In fact I had to use the > version that came with VB6 SP6 (even though I still use SP5) because it > had > an important bug fix > > Tony Proctor You're correct... I should've been clearer <g> It's not installed by the OS installation CDs or part of any OS service pack (that I've heard of, anyway)
It *has* to be installed as part of the VB6 installation, cuz that's the DLL VBs object browser uses.
Sorry for the corn-fusion <g>
 Signature Ken Halter - MS-MVP-VB - Please keep all discussions in the groups.. In Loving Memory - http://www.vbsight.com/Remembrance.htm
Jim Carlock - 29 Sep 2007 00:35 GMT "Tony Proctor" wrote...
> I swear mine came with the VS6 installation Ken. In fact I had to > use the version that came with VB6 SP6 (even though I still use SP5) > because it had an important bug fix "Ken Halter" wrote...
: You're correct... I should've been clearer <g> It's not installed : by the OS installation CDs or part of any OS service pack (that : I've heard of, anyway) : : It *has* to be installed as part of the VB6 installation, cuz that's : the DLL VBs object browser uses. I see it in a VS6 beta edition. 07/16/2003 04:11 PM 150,528 tlbinf32.dll MD5: 286ab8edbef7a53c1d0767439ccd0f5a *tlbinf32.dll This is the same file that is found in the InnoScript folder below.
And I see it in %ProgramFiles%\Randem Systems\InnoScript\SP6RT 07/16/2003 04:11 PM 150,528 tlbinf32.dll MD5: 286ab8edbef7a53c1d0767439ccd0f5a *tlbinf32.dll Version: 6.00.9763 Copyright: Copyright © 1996 Matthew Curland, 1997-2000 Microsoft Corp.
I do NOT see it in %systemroot%\system32. I do NOT see it in any of the Visual Studio\*.* folders.
Oops, I see it in %systemroot%\system32 as an older version.
07/15/2000 01:00 AM 148,480 TLBINF32.DLL MD5: 445ca9eea4c2d703a113f23104b67236 *tlbinf32.dll Version: 6.00.8804 Copyright: Copyright © 1996 Matthew Curland, 1997-2000 Microsoft Corp.
It looks like I need to download the service pack again. I can't find a .chm file in the stuff I'm looking through at the moment.
 Signature Jim Carlock North Carolina Swimming Pools, Spas and Custom Water Features http://www.aquaticcreationsnc.com/
Jim Carlock - 29 Sep 2007 02:44 GMT "Jim Carlock" wrote...
Apologies about repeating the stuff I had before, but I thought it works well together, so here's everything I currently have:
Z:\VS6\beta\ 07/16/2003 04:11 PM 150,528 tlbinf32.dll MD5: 286ab8edbef7a53c1d0767439ccd0f5a *tlbinf32.dll This is the same file that is found in the InnoScript folder below.
%ProgramFiles%\Randem Systems\InnoScript\SP6RT 07/16/2003 04:11 PM 150,528 tlbinf32.dll MD5: 286ab8edbef7a53c1d0767439ccd0f5a *tlbinf32.dll File Version: 1.10.9763 Product Version: 6.00.9763 Copyright: Copyright © 1996 Matthew Curland, 1997-2000 Microsoft Corp.
%systemroot%\System32 07/15/2000 01:00 AM 148,480 TLBINF32.DLL MD5: 445ca9eea4c2d703a113f23104b67236 *tlbinf32.dll File Version: 1.10.8804 Product Version: 6.00.8804 Copyright: Copyright © 1996 Matthew Curland, 1997-2000 Microsoft Corp.
After download of the service pack and manually installing to %systemroot%\System32\ 02/23/2004 04:31 PM 150,528 tlbinf32.dll MD5: 62cc2c6b200d995791acfc527ca4cc58 *tlbinf32.dll File Version: 1.10.8804 Product Version: 6.00.8804 Copyright: Copyright © 1996 Matthew Curland, 1997-2000 Microsoft Corp.
I've got a feeling that the stuff in the InnoScript folder was probably put there in 2003 or 2004. I have not updated InnoScript in a long time and I might have placed that there myself.
I'm having problems getting the XP compression routine to compress the older version of that file. Perhaps that's why the newer versions failed to install? This is strange.
If anyone wants to download on this file and then extract it, then right click upon the file, then click on the Properties menu item, then click upon the Advanced button when the dialog appears, then place a checkmark into Compress, then OK, then OK, then let me know if you can get it to compress? <shrug> I can't get it to compress for some reason.
http://www.microcosmotalk.com/tech/ms/TLBINF32.zip 145c87bf1b0c6810970008d31e0ec719 *TLBINF32.zip
Perhaps that's the bug Tony referenced?
 Signature Jim Carlock North Carolina Swimming Pools, Spas and Custom Water Features http://www.aquaticcreationsnc.com/
mayayana - 29 Sep 2007 04:14 GMT > It looks like I need to download the service pack again. I > can't find a .chm file in the stuff I'm looking through at the > moment. I have a copy of that if you need it. A quick search of Google turned up only one link to it, at Microsoft. But as usual the MS link led to a 404 page. :)
The help file is certainly worth having if you're going to work with type libraries. It's called tlbinf32.chm. I don't know where I got my copy.
Although the CHM is quite good, the whole system it's dealing with is awkward and complex, and Matthew Curland used a somewhat customized structure. So the tlbinf32.chm documentation is specific to tlbinf32.dll, which differs somewhat from the ITypeInfo interface that it's based on.
Jim Carlock - 29 Sep 2007 05:07 GMT "mayayana" wrote...
: I have a copy of that if you need it. A quick search : of Google turned up only one link to it, at Microsoft. : But as usual the MS link led to a 404 page. :) That would be nice. I think the link I posted comes from Visual Studio. It's dated 2000.
http://support.microsoft.com/dllhelp/?dlltype=file&l=55&alpha=tlbinf32.dll&S=1&x =0&y=0
That shows the following:
tlbinf32.dll is found in the following products: Microsoft Visual FoxPro 8.0 (2002.02.11) Microsoft Visual Studio Service Pack 4 (2000.03.14) Microsoft Visual Studio 6.0 Enterprise Edition (1998.06.18) Microsoft Office 2000 Professional (1998.07.14)
They duplicate the content for some odd reason, meaning they list the Office 2000 / VS 6.0 EE twice. They fail to list the SP6 file in their DLL database.
I downloaded the SP6 installer earlier and extracted the latest from the SP6 installer (I think).
Based upon the Office 2000, it might be in that product?
 Signature Jim Carlock Microsoft (MSNBC) refuses to write 100,000 people parade in Washington, D.C. (2007.09.15) http://www.wildleathers.com/
mayayana - 29 Sep 2007 14:14 GMT > : I have a copy of that if you need it. A quick search > : of Google turned up only one link to it, at Microsoft. > : But as usual the MS link led to a 404 page. :) > > That would be nice. OK. It's on its way. I'd be happy to post it online but I'm slightly concerned about whether I have a right to. From what I can gather, the help file was written by Matthew Curland. But the old links I found to it are actually all at MS. I'm guessing that it must have been posted as something like an SDK a few years ago and I must have found the download when I was trying to work on my own object browser.
I ended up switching to oleaut32.dll (using the ITypeInfo and ITypeLib interfaces) in part to avoid the dependency on tlbinf32.dll and in part to avoid any possible bugs in it. But this help file dilemma demonstrates another reason to use oleaut32.dll: Curland's help file is all there is for tlbinf32.dll, and tlbinf32.dll doesn't correspond to the interfaces, for which there is at least some documentation aimed at C++.
For anyone interested in understanding the whole thing in "its natural state" (API interfaces) this is the only *really* good link that I know of:
http://spec.winprog.org/typeinfo/
-----------
> I think the link I posted comes from > Visual Studio. It's dated 2000. http://support.microsoft.com/dllhelp/?dlltype=file&l=55&alpha=tlbinf32.dll&S =1&x=0&y=0
> That shows the following: > [quoted text clipped - 12 lines] > > Based upon the Office 2000, it might be in that product? I don't know. I also don't know whether any of those versions matter. I searched around and found some info. about the different versions, but no details about specific bugs in specific versions.
mayayana - 29 Sep 2007 14:50 GMT Woops. I sent that from the wrong address. If you happen to Re, do it to the mayayana address (without the Xs). My website email is set to auto-delete anything from hotmail, live.com, yahoo, or gmail.
I like your website, by the way. It reminds me of a Dr. Bronner's bottle ... lots of little varied odds and ends here and there. :)
mayayana - 28 Sep 2007 19:34 GMT In addition to the tlbinf32.dll option, you can go direct using oleaut32.dll. Tlbinf32.dll is really just a wrapper for oleaut32.dll. It presents slightly more friendly data types and includes some simplifying functions for dumping typelib data. But other than that it's the same thing, so tlbinf32.dll is really unnecessary.
Tlbinf32.dll needs to be shipped (about 150 KB, I think). It is redistributable. The only issue with it that I know of is that I *think* I once read the VB6 version of it will mess up VB5. Oleaut32.dll can be assumed to be present, since it's included in the VB runtime package.
For code to use oleaut32.dll directly see here:
http://www.jsware.net/jsware/vbcode.php3#tlbc
> Also for CoClasses the Name, the CLSID, the Inproc-Server-file > the associated Typelib, its GUID and the Typelib version. You probably already know this, but some of that stuff is in the Registry. For instance, you won't get the InProcServer32 path from the typelib. You get it from the CLSID key.
Alexander Mueller - 29 Sep 2007 14:03 GMT mayayana schrieb:
> In addition to the tlbinf32.dll option, you > can go direct using oleaut32.dll. Tlbinf32.dll [quoted text clipped - 22 lines] > the InProcServer32 path from the typelib. You get it from > the CLSID key. Hi all
much thanks to everyone for the support. I made a TliInf32 solution now, though it has some disadvantages, e. g. it doesn't show the right datatype for params that are enums or UDTs, they are considered VT_EMPTY. The oleaut32.dll-jsware project returns the right enumeration type or record-type ;-)
Since my main goal is to check if the DLL-registration is valid, that doesn't really matter.
Also mayayana is right, that getting the InprocServer32 from a given ProgID, and also getting the ProgID itself from a CoClassInfo, needs additional API like ProgIdFromClsid, StringFromClsid etc and also RegQueryValue etc.
Also i found some bizarr behaviour of a special DLL/Typelib called 'Redemption', that is used to supress security warnings in MS-Outlook-automation. All CoClass-Clsids it exposes don't seem to get registered at all, and can't be found by a manual regedit-search, though DllRegisterServer succeeds and though all its creatable objects can be created through CreateObject. Strange!
Does anyone know the mechanism behind that?
MfG, Alex
mayayana - 30 Sep 2007 01:33 GMT > I made a TliInf32 solution now, though it has > some disadvantages, e. g. it doesn't show the right > datatype for params that are enums or UDTs, they > are considered VT_EMPTY. > The oleaut32.dll-jsware project returns the right > enumeration type or record-type ;-) There's this in the help file:
"The VarType property does not necessarily give the variant type as recorded in the type library. TLI automatically resolves any VT_USERDEFINED types into non-intrinsic types, and VT_PTR types are reflected in the PointerLevel and ElementPointerLevel properties."
I'm guessing that you can probably dig down to straighten out the wrong return. It's probably the same issue that's dealt with in the GetRetType function of ClsTLB with the oleaut32 code. (The data structure holding the paramater return type can represent different things depending on what the return type is.)
Unfortunately, that's an example of the confusion that Matthew Curland created by making up his own names and object model to wrap the ITypeInfo interface. He mixed and matched names, making it difficult to translate between the two systems. It looks like what he calls a "VarType" object actually corresponds to something like an ELEMDESC.TYPEDESC in ITypeInfo.
mayayana - 30 Sep 2007 16:35 GMT If you're using tlbinf32.dll with VBAccelerator's Typeinfo project, you can ignore my former post. It looks like you can fix the return type with a built-in function that tlbinf32 provides to do the dirty work:
In frmDocHelp of the VBAccelerator project add this line at the top of Sub Form_Load:
tli.ResolveAliases = False
That fixes the listed return type of a method when it's an enum. It doesn't do anything to clean up the aliased enum listings. (For instance, scrrun.dll will still show several enums named as __MIDL.....
The oleaut32 code sorts out the names with the enums. With tlbinf32, in the past I've used the method of just dropping any TKIND_ENUM TypeInfo with a name starting with "_". That seems to work, but I don't know if it's dependable in all cases. For a simple example of that, see: www.jsware.net/jsware/scripts.php3#obbro
That points to an object browser, based on tlbinf32.dll, that's written in VBScript and rendered as a webpage in IE. Loading scrrun.dll into that yields the right enum names by just dropping the ones with an underscore starting the name. (VBScript can actually handle most of what's available in tlbinf32.dll.)
|
|
|