Results 1 to 19 of 19

Thread: Creating a Manifest

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2018
    Posts
    56

    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.

  2. #2
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    6,092

    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.

  3. #3
    Frenzied Member VanGoghGaming's Avatar
    Join Date
    Jan 2020
    Location
    Eve Online - Mining, Missions & Market Trading!
    Posts
    1,747

    Question Re: Creating a Manifest

    Manifests are usually used for RegFree instantiation of objects from ActiveX DLLs. You want to use them for checking versions?

  4. #4
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    87

    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!

  5. #5

  6. #6
    Fanatic Member
    Join Date
    Feb 2017
    Posts
    897

    Re: Creating a Manifest

    There's a guy on the internet named "Chilkat" who sells VB code. Has a compete suite.

  7. #7
    Frenzied Member VanGoghGaming's Avatar
    Join Date
    Jan 2020
    Location
    Eve Online - Mining, Missions & Market Trading!
    Posts
    1,747

    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...

  8. #8
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    87

    Re: Creating a Manifest

    Quote Originally Posted by VanGoghGaming View Post
    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!

  9. #9
    Frenzied Member VanGoghGaming's Avatar
    Join Date
    Jan 2020
    Location
    Eve Online - Mining, Missions & Market Trading!
    Posts
    1,747

    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.

  10. #10
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    87

    Re: Creating a Manifest

    Quote Originally Posted by VanGoghGaming View Post
    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 ?

  11. #11
    Frenzied Member VanGoghGaming's Avatar
    Join Date
    Jan 2020
    Location
    Eve Online - Mining, Missions & Market Trading!
    Posts
    1,747

    Lightbulb 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.

  12. #12
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,346

    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>

  13. #13
    Frenzied Member VanGoghGaming's Avatar
    Join Date
    Jan 2020
    Location
    Eve Online - Mining, Missions & Market Trading!
    Posts
    1,747

    Lightbulb 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

  14. #14

    Thread Starter
    Member
    Join Date
    Jan 2018
    Posts
    56

    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)?

  15. #15
    Frenzied Member VanGoghGaming's Avatar
    Join Date
    Jan 2020
    Location
    Eve Online - Mining, Missions & Market Trading!
    Posts
    1,747

    Lightbulb 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...

  16. #16
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    87

    Re: Creating a Manifest

    Quote Originally Posted by IanBrooke View Post
    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

  17. #17
    Frenzied Member VanGoghGaming's Avatar
    Join Date
    Jan 2020
    Location
    Eve Online - Mining, Missions & Market Trading!
    Posts
    1,747

    Talking 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!

  18. #18
    PowerPoster
    Join Date
    Jan 2020
    Posts
    4,063

    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.

  19. #19
    Frenzied Member VanGoghGaming's Avatar
    Join Date
    Jan 2020
    Location
    Eve Online - Mining, Missions & Market Trading!
    Posts
    1,747

    Talking 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
  •  



Click Here to Expand Forum to Full Width