|
-
Jun 8th, 2024, 02:10 PM
#1
Thread Starter
Member
Creating a Manifest
I have an issue with an old VB6 application. It uses a 3rd-party dll but one user already has a newer version of the dll installed. The dll checks the version using the unlock key. When it finds a newer version than my unlock allows it fails. The only way I can think of to get over this is via a side-by-side manifest, but I know absolutely nothing of the format of a manifest to do this.
Can anyone give me an example please? Or is there an easier way to do it?
Last edited by IanBrooke; Jun 8th, 2024 at 02:24 PM.
-
Jun 8th, 2024, 05:46 PM
#2
Re: Creating a Manifest
There are multiple threads about creating manifests.
wqweto and Elroy have created tools/tutorials to help creating a manifest.
https://www.vbforums.com/showthread....ke-My-Manifest
https://www.vbforums.com/showthread....xS-information
Last edited by Arnoutdv; Jun 8th, 2024 at 05:51 PM.
-
Jun 9th, 2024, 03:52 AM
#3
Re: Creating a Manifest
Manifests are usually used for RegFree instantiation of objects from ActiveX DLLs. You want to use them for checking versions?
-
Jun 9th, 2024, 10:27 AM
#4
Addicted Member
Re: Creating a Manifest
I use Manifest Creator II from LaVolpe : https://www.vbforums.com/showthread....est-Creator-II
It's very practical and well documented in the thread
This allows me in particular to use the Chilkat dll in side-by-side deployment
Besides, my renewed thanks to LaVolpe who is missed on this forum!
-
Jun 9th, 2024, 11:59 AM
#5
Re: Creating a Manifest
-
Jun 9th, 2024, 12:24 PM
#6
Fanatic Member
Re: Creating a Manifest
There's a guy on the internet named "Chilkat" who sells VB code. Has a compete suite.
-
Jun 9th, 2024, 12:56 PM
#7
Re: Creating a Manifest
Ahh I've found it now, seems to be a collection of various classes much like RC6. Bit pricy for what it offers though and most of that stuff can be found for free in these very forums...
-
Jun 10th, 2024, 03:07 AM
#8
Addicted Member
Re: Creating a Manifest
 Originally Posted by VanGoghGaming
What's a chilkat dll?
it's an activeX dll containing a ton of classes and tools, perfectly debugged. There are many examples, including in VB6.
Certainly, some classes of this dll can be replaced by free code on this forum, but for many others I have not found a match. Some of the tools available in this dll are free and do not require a license.
This component saved me a ton of headache!
-
Jun 10th, 2024, 02:04 PM
#9
Re: Creating a Manifest
I see the free version of the Chilkat dll already comes with an included manifest file for RegFree usage but since it's an ActiveX DLL it is possible to use it RegFree without the manifest. You should use manifests only when absolutely necessary, such as in case of OCX controls.
-
Jun 11th, 2024, 09:46 AM
#10
Addicted Member
Re: Creating a Manifest
 Originally Posted by VanGoghGaming
I see the free version of the Chilkat dll already comes with an included manifest file for RegFree usage but since it's an ActiveX DLL it is possible to use it RegFree without the manifest. You should use manifests only when absolutely necessary, such as in case of OCX controls.
I have never been able to use the Chilkat Dll Regfree without the manifest.
If you say it's possible, then you should have tried it. How did you do ?
-
Jun 11th, 2024, 11:24 PM
#11
Re: Creating a Manifest
I just went off the assumption that any ActiveX DLL can be used RegFree without a manifest but this doesn't seem to be the case with the Chilkat DLL... This comes as a surprise since this "RegFree" function always worked for me so far with any other ActiveX DLL:
Code:
Private Const MEMBERID_NIL As Long = -1, DllGetClassObject As String = "DllGetClassObject"
Private ParamTypes(0 To 10) As Integer, ParamValues(0 To 10) As Long, lParamCount As Long, pInterface As Long, vParams As Variant, IID_IClassFactory As oleexp.UUID, IID_IUnknown As oleexp.UUID
Public Function RegFree(sLibName As String, sClassName As String) As Object
Dim RegFreeIUnknown As IUnknown, tliTypeLibInfo As oleexp.ITypeLib, tTypeInfo As oleexp.ITypeInfo, objClassFactory As oleexp.IClassFactory, lpTypeAttr As Long, _
rgMemId As Long, pcFound As Integer, lpDllGetClassObject As Long
Set tliTypeLibInfo = LoadTypeLibEx(sLibName, REGKIND_NONE) ' REGKIND_NONE calls LoadTypeLib without the registration process enabled
With tliTypeLibInfo
pcFound = 1 ' We want to find only one instance of this class name (there shouldn't be duplicates anyway)
.FindName sClassName, 0, tTypeInfo, rgMemId, pcFound ' Search the TypeLib for our class name
If rgMemId = MEMBERID_NIL Then ' If the class name is found then "rgMemId" will return MEMBERID_NIL
lpDllGetClassObject = GetModuleHandle(ByVal StrPtr(sLibName)) ' Check if the library had already been loaded
If lpDllGetClassObject = 0 Then lpDllGetClassObject = CoLoadLibrary(sLibName, True) ' If not then we load it
lpDllGetClassObject = GetProcAddress(lpDllGetClassObject, DllGetClassObject) ' Get the pointer to the DllGetClassObject function
If IID_IClassFactory.Data1 = 0 Then CopyMemory IID_IClassFactory.Data4(0), 504403158265495.5712@, 8: IID_IUnknown = IID_IClassFactory: IID_IClassFactory.Data1 = 1
With tTypeInfo
lpTypeAttr = .GetTypeAttr ' The first member of the "TypeAttr" structure is the class GUID so we don't need to CopyMemory its contents
If lpTypeAttr Then InvokeObj Nothing, lpDllGetClassObject, lpTypeAttr, VarPtr(IID_IClassFactory), VarPtr(objClassFactory) ' Call DllGetClassObject to retrieve the class object from the DLL object handler
.ReleaseTypeAttr lpTypeAttr ' Release the previously allocated "TypeAttr" structure
End With
objClassFactory.CreateInstance Nothing, IID_IUnknown, RegFreeIUnknown ' Create an instance of this class
Set RegFree = RegFreeIUnknown ' Get the IDispatch implementation of this class
End If
End With
End Function
Private Function InvokeObj(Interface As IUnknown, vtbOffset As Long, ParamArray ParamsArray() As Variant) As Variant
Dim lRet As Long
InvokeObj = S_FALSE: pInterface = ObjPtr(Interface): vParams = ParamsArray
For lParamCount = 0 To UBound(vParams): ParamTypes(lParamCount) = VarType(vParams(lParamCount)): ParamValues(lParamCount) = VarPtr(vParams(lParamCount)): Next lParamCount
If pInterface Then
lRet = DispCallFunc(ByVal pInterface, vtbOffset, CC_STDCALL, vbLong, lParamCount, ParamTypes(0), ParamValues(0), InvokeObj)
ElseIf vtbOffset > 1024 Then
lRet = DispCallFunc(ByVal pInterface, vtbOffset, CC_STDCALL, vbLong, lParamCount, ParamTypes(0), ParamValues(0), InvokeObj)
End If
If lRet Then Debug.Print Hex$(lRet)
End Function
It does create an object successfully but you can't call any of its methods (you just get run-time error &H8002801D "Automation Error, Library not registered"), very strange indeed especially since we don't want the library to be registered...
Code:
Dim objChilkat As Object
Set objChilkat = RegFree("ChilkatAx-9.5.0-win32.dll", "ChilkatHashtable")
Everything works correctly with a SxS manifest though so I'm at a loss here. Maybe someone more knowledgeable could shed some light into the matter.
-
Jun 12th, 2024, 02:47 AM
#12
Re: Creating a Manifest
> Everything works correctly with a SxS manifest though so I'm at a loss here.
Does your test manifest include comInterfaceExternalProxyStub tags? Try removing these to see if failing in similar fashion without them.
These are need for multi-threading support usually employing COM's standard automation interface marshaller (or standard dispatch marshaller for events source interfaces) -- not sure if DirectCOM handles such scenarios.
cheers,
</wqw>
-
Jun 12th, 2024, 09:15 AM
#13
Re: Creating a Manifest
I have narrowed down the manifest to the bare minimum to see if it fails.
This works correctly:
Code:
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<assemblyIdentity name="Native.ChilkatAxRegFree" version="1.0.0.0" type="win32"/>
<file name="ChilkatAx-9.5.0-win32.dll">
<typelib version="1.0" helpdir="" resourceid="0" tlbid="{004cb902-f437-4d01-bd85-9e18836da5c2}"/>
<comClass clsid="{f28d37f7-f537-45b0-bd88-a5877fc649dd}" threadingModel="Apartment" progid="Chilkat.Hashtable" description="ChilkatHashtable Class"/>
</file>
</assembly>
If I remove the "typelib" line above then it will fail with the same run-time error &H8002801D "Automation Error, Library not registered". I have checked both GUIDs above with ITypeLib, they are correct but I don't know how to specify the typelib GUID in code to be used by the "RegFree" function...
This works with the manifest (if the "typelib" line is present):
Code:
Set objChilkat = CreateObject("Chilkat.Hashtable")
With objChilkat
If .AddStr("FirstKey", "FirstItem") Then MsgBox .LookupStr("FirstKey") & vbNewLine & .Count & " items in the Hashtable.", vbOKOnly + vbInformation
End With
Same code fails with the "RegFree" function posted above:
Code:
Set objChilkat = RegFree("ChilkatAx-9.5.0-win32.dll", "ChilkatHashtable")
With objChilkat
If .AddStr("FirstKey", "FirstItem") Then MsgBox .LookupStr("FirstKey") & vbNewLine & .Count & " items in the Hashtable.", vbOKOnly + vbInformation
End With
Last edited by VanGoghGaming; Jun 12th, 2024 at 10:32 AM.
-
Jun 12th, 2024, 11:37 AM
#14
Thread Starter
Member
Re: Creating a Manifest
As it's the Chilkat library that I am trying to uses SxS (I use the purchased, not the free version) I'm interested in this. Are you using an embedded manifest or a standalone (a .manifest file)?
-
Jun 12th, 2024, 11:54 AM
#15
Re: Creating a Manifest
I've only tested the short manifest posted above as a separate file but it should work the same when embedded in the executable. I am more interested in the RegFree version without manifests though.
I might be able to learn something new if someone more knowledgeable could figure out what's going on there with the "typelib" element. All I've been able to find out about it online was that it is optional...
-
Jun 13th, 2024, 10:27 AM
#16
Addicted Member
Re: Creating a Manifest
 Originally Posted by IanBrooke
As it's the Chilkat library that I am trying to uses SxS (I use the purchased, not the free version) I'm interested in this. Are you using an embedded manifest or a standalone (a .manifest file)?
I use an embedded manifest
-
Jun 13th, 2024, 02:07 PM
#17
Re: Creating a Manifest
Okay, I've played around with it some more and got it to work RegFree without the manifest! The catch is that the Chilkat DLL needs to be registered on the developer's machine and objects must be declared early bound (strong typed):
Code:
' Dim objChilkatHashtable As Object ' Late bound
Dim objChilkatHashtable As ChilkatHashtable ' Early bound
Set objChilkatHashtable = RegFree("ChilkatAx-9.5.0-win32.dll", "ChilkatHashtable")
With objChilkatHashtable
If .AddStr("FirstKey", "FirstItem") Then MsgBox .LookupStr("FirstKey") & vbNewLine & .Count & " items in the Hashtable.", vbOKOnly + vbInformation
End With
Once you do that, the resulting executable works fine on other machines that do not have the Chilkat DLL registered!
This is still a somewhat strange behavior that doesn't apply to other ActiveX DLLs where you can declare RegFree objects late bound (As Object) just fine so something still eludes me... Anyway I'm glad it's not an issue with the RegFree code!
Last edited by VanGoghGaming; Jun 13th, 2024 at 02:38 PM.
-
Jun 14th, 2024, 07:42 PM
#18
Re: Creating a Manifest
You can create a tlb file for him first. The lb file is exported.
Maybe he wants to, uh, dynamically generate a TLB.
-
Jun 14th, 2024, 08:08 PM
#19
Re: Creating a Manifest
The TLB is included in the DLL, look at the code above (post #11) to see how it loads the TLB from the DLL!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|