Delphi and .manifest files

Hello experts,

I would like some clarifications about the usage of .manifest files in Delphi for Win32 apps.

Our goal is to be able to use COM objects (DLL or OCX files) without requiring their registration on the machine.

My understanding is that providing the right manifest files the app on startup will use the manifest specifications instead looking in the registry. These files don't need to be included in the exe as resource they just need to be in the same folder than the app and the COM files.

I did some experiments and so far I'm not able to achive this goal.
I always get the error class not registered.
I'm including the 2 main ways I'm experimenting the manifest that goes with the main app.
The manifest for the COM dll is provided by the vendor and I didn't modified it.
The 2 manifest files in question are called project2.exe.manifest and xceedzip.dll.manifest
project2.exe.manifest version 1:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
  <assemblyIdentity type="win32" name="project2.exe" version="1.0.0.0" />
  <dependency> 
    <dependentAssembly> 
      <assemblyIdentity type="win32" name="xceedzip.dll" version="6.5.9562.0" /> 
    </dependentAssembly>
  </dependency>
</assembly>

and I tried this version too:
project2.exe.manifest version 2:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <assemblyIdentity
	name="project2.exe"
	version="1.0.0.0"
	type="win32"
	processorArchitecture="x86"/>
  <file name="xceedzip.dll">
    <comClass clsid="{DB797681-40E0-11D2-9BD5-0060082AE372}"/>
  </file>
</assembly>


xceedzip.dll.manifest provided by the vendor:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
          manifestVersion="1.0">
  <file hash="d2e6d584ed47e2382549255264a8e392eadfd52d"
        hashalg="SHA1"
        name="XceedZip.dll">
    <comClass clsid="{DB797690-40E0-11D2-9BD5-0060082AE372}"
              description="XceedZip Control v6.0"
              progid="XceedSoftware.XceedZip"
              threadingModel="Both"
              tlbid="{DB797681-40E0-11D2-9BD5-0060082AE372}">
      <progid>XceedSoftware.XceedZip.5</progid>
    </comClass>
    <comClass clsid="{4C836512-BB70-11D2-A5A7-00105A9C91C6}"
              description="XceedCompression Control v6.0"
              progid="XceedSoftware.XceedCompression"
              threadingModel="Both"
              tlbid="{DB797681-40E0-11D2-9BD5-0060082AE372}">
      <progid>XceedSoftware.XceedCompression.5</progid>
    </comClass>
    <comClass clsid="{AFA9FDF0-B99F-11D4-BFE7-0060082AE372}"
              description="XceedZipItem Object v6.0"
              tlbid="{DB797681-40E0-11D2-9BD5-0060082AE372}">
              </comClass>
    <comClass clsid="{AFA9FDF1-B99F-11D4-BFE7-0060082AE372}"
              description="XceedZipItems Collection v6.0"
              tlbid="{DB797681-40E0-11D2-9BD5-0060082AE372}">
              </comClass>
    <typelib flags="HASDISKIMAGE"
             helpdir=""
             tlbid="{DB797681-40E0-11D2-9BD5-0060082AE372}"
             version="5.4"></typelib>
    <asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2"
                xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
      <dsig:Transforms>
        <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity">
        </dsig:Transform>
      </dsig:Transforms>
      <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1">
      </dsig:DigestMethod>
      <dsig:DigestValue>
      ZF/ru7bst9pvdtrEdmnoOW4uTQU=</dsig:DigestValue>
    </asmv2:hash>
  </file>
  <comInterfaceExternalProxyStub iid="{4D07FC10-F931-11CE-B001-00AA006884E5}"
                                 name="ICategorizeProperties"
                                 proxyStubClsid32="{4D07FC10-F931-11CE-B001-00AA006884E5}"
                                 tlbid="{DB797681-40E0-11D2-9BD5-0060082AE372}">
                                 </comInterfaceExternalProxyStub>
  <comInterfaceExternalProxyStub iid="{8D8BE16D-8C8B-461C-9220-ADB79B5123B2}"
                                 name="IXceedZip"
                                 proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
                                 tlbid="{DB797681-40E0-11D2-9BD5-0060082AE372}">
                                 </comInterfaceExternalProxyStub>
  <comInterfaceExternalProxyStub iid="{DB79768F-40E0-11D2-9BD5-0060082AE372}"
                                 name="IXceedZip__0400"
                                 proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
                                 tlbid="{DB797681-40E0-11D2-9BD5-0060082AE372}">
                                 </comInterfaceExternalProxyStub>
  <comInterfaceExternalProxyStub iid="{A0CECD40-EB84-11D2-A5CD-00105A9C91C6}"
                                 name="IXceedZip__0401"
                                 proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
                                 tlbid="{DB797681-40E0-11D2-9BD5-0060082AE372}">
                                 </comInterfaceExternalProxyStub>
  <comInterfaceExternalProxyStub iid="{31C2DDD0-B692-11D4-BFE3-0060082AE372}"
                                 name="IXceedZip__0402"
                                 proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
                                 tlbid="{DB797681-40E0-11D2-9BD5-0060082AE372}">
                                 </comInterfaceExternalProxyStub>
  <comInterfaceExternalProxyStub iid="{CC6FD600-EE1D-11D4-801A-0060082AE372}"
                                 name="IXceedZip__0403"
                                 proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
                                 tlbid="{DB797681-40E0-11D2-9BD5-0060082AE372}">
                                 </comInterfaceExternalProxyStub>
  <comInterfaceExternalProxyStub iid="{07189400-00F2-11D5-802D-0060082AE372}"
                                 name="IXceedZip__0405"
                                 proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
                                 tlbid="{DB797681-40E0-11D2-9BD5-0060082AE372}">
                                 </comInterfaceExternalProxyStub>
  <comInterfaceExternalProxyStub iid="{BAA1401E-3F5F-47A4-870B-431D602D2488}"
                                 name="IXceedZip__0500"
                                 proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
                                 tlbid="{DB797681-40E0-11D2-9BD5-0060082AE372}">
                                 </comInterfaceExternalProxyStub>
  <comInterfaceExternalProxyStub iid="{7B78FDFA-2139-4FDC-9D81-4D4B9EF79271}"
                                 name="IXceedZip__0501"
                                 proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
                                 tlbid="{DB797681-40E0-11D2-9BD5-0060082AE372}">
                                 </comInterfaceExternalProxyStub>
  <comInterfaceExternalProxyStub iid="{6991A191-8F4D-41CB-BFEA-5F5ED909FBD5}"
                                 name="IXceedZip__0502"
                                 proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
                                 tlbid="{DB797681-40E0-11D2-9BD5-0060082AE372}">
                                 </comInterfaceExternalProxyStub>
  <comInterfaceExternalProxyStub iid="{6CC24AD7-458C-45E6-B63C-8CC268A61EF7}"
                                 name="IXceedZip__0503"
                                 proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
                                 tlbid="{DB797681-40E0-11D2-9BD5-0060082AE372}">
                                 </comInterfaceExternalProxyStub>
  <comInterfaceExternalProxyStub iid="{AAC4831F-8C1F-434E-9F80-7F1B5B0036E0}"
                                 name="IXceedZipItem"
                                 proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
                                 tlbid="{DB797681-40E0-11D2-9BD5-0060082AE372}">
                                 </comInterfaceExternalProxyStub>
  <comInterfaceExternalProxyStub iid="{31C2DDD1-B692-11D4-BFE3-0060082AE372}"
                                 name="IXceedZipItem__0405"
                                 proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
                                 tlbid="{DB797681-40E0-11D2-9BD5-0060082AE372}">
                                 </comInterfaceExternalProxyStub>
  <comInterfaceExternalProxyStub iid="{31C2DDD2-B692-11D4-BFE3-0060082AE372}"
                                 name="IXceedZipItems"
                                 proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
                                 tlbid="{DB797681-40E0-11D2-9BD5-0060082AE372}">
                                 </comInterfaceExternalProxyStub>
  <comInterfaceExternalProxyStub iid="{77243A10-00F3-11D5-802D-0060082AE372}"
                                 name="IXceedCompression"
                                 proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
                                 tlbid="{DB797681-40E0-11D2-9BD5-0060082AE372}">
                                 </comInterfaceExternalProxyStub>
  <comInterfaceExternalProxyStub iid="{4C836511-BB70-11D2-A5A7-00105A9C91C6}"
                                 name="IXceedCompression__0400"
                                 proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
                                 tlbid="{DB797681-40E0-11D2-9BD5-0060082AE372}">
                                 </comInterfaceExternalProxyStub>
  <comInterfaceExternalProxyStub iid="{05D56700-EB90-11D2-A5CD-00105A9C91C6}"
                                 name="IXceedCompression__0401"
                                 proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
                                 tlbid="{DB797681-40E0-11D2-9BD5-0060082AE372}">
                                 </comInterfaceExternalProxyStub>
  <comInterfaceExternalProxyStub iid="{99C11080-CD22-11D4-BFFA-0060082AE372}"
                                 name="IXceedCompression__0402"
                                 proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
                                 tlbid="{DB797681-40E0-11D2-9BD5-0060082AE372}">
                                 </comInterfaceExternalProxyStub>
</assembly>

Open in new window

charlesgates22Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Arthur_WoodCommented:
COM classes must ALWAYS be registered.  The manifest is only relevant with .NET dlls, which are NOT COM.  COM works because the registry entry points to the real DLL.

AW
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
charlesgates22Author Commented:
so the famous registration-free COM is only pertinent to .NET right?

for Win32 apps can I use manifest files to enable the exe to automatically use interfaces defines in a DLL w/o need to register them like in the above example?

Thanks.
0
Arthur_WoodCommented:
"Anyone familiar with .NET Framework technology will be accustomed to  the term assembly, which denotes a set of one or more modules  deployed, named, and versioned as a unit, with one module containing a manifest  that defines the set. In Registration-free COM, the terms assembly  and manifest are borrowed for ideas that are similar in concept  but not identical to their .NET counterparts.
Registration-free  COM uses assembly to mean a set of one or more PE modules (i.e.,  either native or managed) deployed, named, and versioned as a  unit. Registration-free COM uses manifest to refer to text files  with the .manifest extension containing XML, which either defines the  identity of an assembly (assembly manifest), together with the  binding and activation details of its classes, or defines the identity  of an application (application manifest), together with one or  more assembly identity references. An assembly manifest file is named  for the assembly, and an application manifest file is named for the  application."  from

http://msdn.microsoft.com/en-us/library/ms973913.aspx

This should help explain.

AW
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

charlesgates22Author Commented:
ok, thank you.
I shouldn't had mention COM in my original explanation, it looks like the correct term is side-by-side apps.

I'm after this:
http://www.mazecomputer.com/sxs/help/inside2.htm
http://msdn.microsoft.com/en-us/library/ms766454(VS.85).aspx
http://msdn.microsoft.com/en-us/library/ms997620.aspx

Is it possible share assembly with the exe in win32 apps?
Does the dll needs to be built in a certain way?
supposedly the .manifest above for xceedzip.dll should work (at least that's what xceed told me, they provided that manifest) I'm just having hard time to build the manifest file for my exe application in order to include xceedzip.dll.manifest.

thank you again for all your help.
0
developmentguruPresidentCommented:
In Delphi 2010 you can go to the

--Component

menu and click on

--Import Component

When the import component wizard opens up you choose

--Import .NET Assembly

and click NEXT.

There are a few other choices but you are normally good taking the defaults.  This will give your Win32 app access to the assembly.  You can have it create a Delphi unit for compilation into your program, include it in a package, etc.

In order for this to work the assembly must be registered in the Global Assembly Cache (GAC).
0
charlesgates22Author Commented:
thank you developmentguru,
this is what I'm talking about.

Our main goal is having the finall users not require to register anything on their machines as they don't have admin rights. At the same time we have few libraries (we built in Delphi for Win32 and few others from third party) that implements interfaces which we want to be available throughout our application.

 Now, perdon my ignorance in this field, I have a couple of questions before proceed with some testing:

1. is your approach be able to achieve our goal or it's applicable only to .NET libraries?

2. I'm not familiar with the GAC registration, does this means the end user will still need to register some libraries or just us, developers need to register GAC?

3.so if I understand correctly with this method we don't need the .manifest files at all, Delphi will create this TLB unit which will contain GUIDs to be used as interface references.

thanks again for your help.

FYI: Import .NET Assembly is available also in D2007
0
developmentguruPresidentCommented:
You will need to use two approaches.

1) for any DLLs that you have created in Delphi you can simply place those in the same directory as the application and load them from there (LoadLibrary).  No registration required.
2) GAC is the Global Assembly Cache for .NET.  It is part of .NET and would be no help to you with your DLLs.  During the install process you can register a .NET assembly with the GAC, but as with many other install type activities, you may need admin rights to do the registration.

For the method I mentioned before, you are correct.  Once the assembly is in the GAC you can just compile access to it into your Delphi application.
0
charlesgates22Author Commented:
ok, let's make it as simple as I can:

Can or can I not use .manifest files to work with Win32 DLLs in our Win32 applications (nothing to do with .NET)?

YES - how? the above examples don't work.

NO - is there any other way to make interfaces defined in a DLL available to all EXE/DLL in our applications (Win32) without registering this DLL (no loadlibrary interfaces need to be global to all EXE/DLL applications)?

Thanks.
0
developmentguruPresidentCommented:
According to what I have read, the manifest file can be used to target specific DLLs for your application.  Apparently this becomes a big issue with later versions of windows since the later versions no longer allow the installers to place the DLLs where you want to put them, instead placing them in a windows system directory.  Here is an excerpt:

Yes, I believe you do need administrative rights, because usually the
runtime DLLs are installed under c:\WINDOWS\WinSxS\

I have seen other posts that say that it is still allowable to place the DLLs somewhere in the application path too:

Again, in theory that SHOULD work! I remember reading in the Microsoft
docs about this manifest concept that an application can indeed install
the runtime DLLs locally (local = somewhere under the application
directory) - but that also depends on the manifest configuration linked
into the *.exe/*.dll itself... or so, I didn't dig too deep, because it
works with our Qt 3 application. Maybe re-compiling Qt 4 would indeed
help? Maybe the binary release of Qt 4(.2.2) does indeed expect the
runtime DLLs to be under c:\WINDOWS\WinSxS? (But to be honest I wouldn't
know how to reconfigure the Qt manifest file ...)

excerpts from here:
http://lists.trolltech.com/qt-interest/2007-02/thread00449-0.html

All of the information I have found so far refers to compiling the manifest into the DLL and EXE as a resource.  I have also found information on the newer version of DLL HELL (referred to as Manifest Hell).
http://blog.cryos.net/archives/209-Manifest-Hell...The-New-DLL-Hell.html

Normally when I want to make all of the interfaces in a DLL available to all of my applications I either 1) install the applications (with the DLLs to the same directory) or 2) create a standard SHARED or COMMON directory that they can all look to for these files.  With either approach I then create a Delphi unit that it compiled into any application that wants the standard means of communicating with this (these) DLLs.

I will continue to do more research if you think it will help, and need it.  Let me know.
0
charlesgates22Author Commented:
This was never really resolved for COM but I think the the answer is that it can only be done with .NET.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.