Partager via


App-V 5 – COM Mode Functionality

Hi all,

Following on from my colleagues post about COM Mode it would be good to understand how COM Mode actually works when you deploy an App-V 5 package with COM Mode set to “Integrated” or “Isolated”.

https://blogs.technet.microsoft.com/gladiatormsft/2015/01/13/app-v-5-further-into-com-and-dynamic-virtualization/

I’m going to be using an application called Microsoft MapPoint 2004 to show how this works on the client.

appv_mappoint

The first question is what is COM Mode and its functionality? COM is a registry based subsystem which provides an interface for applications to interact with an object whether it be an EXE or DLL.

“Each COM class is identified by a CLSID, a unique 128-bit GUID, which the server must register. COM uses this CLSID, at the request of a client, to associate specific data with the DLL or EXE containing the code that implements the class, thus creating an instance of the object.”

https://msdn.microsoft.com/en-us/library/windows/desktop/ms678406(v=vs.85).aspx

All COM classes are stored in the registry “HKEY_LOCAL_MACHINE\SOFTWARE\Classes”.

If you view the Virtual Registry for the package you will see that MapPoint has a COM entry and a CLSID specified which means applications can interact with it via a COM Call.

Seq_MapPoint_COM

If you then browse to the CLSID specified above, you will see the “LocalServer32” is set to point to MapPoint.exe.

Seq_MapPoint_CLSID

So that’s a COM object captured during the sequencing process but what happens when you deploy the package to your machine?

The first thing to remember is that App-V 5 is an isolation technology which means by default, when you sequence an application COM Mode functionality will be set to “Isolated” which means the CLSID won’t be written to the local operating system.

Sequencer_COMMode

You can also see this setting in your “_DeploymentConfig.xml” file.

COM_Isolated

Once you have added your package and deployed it to the machine you will see the following entry in the “native” registry. Note the CLSID reference isn’t set / available.

 HKEY_LOCAL_MACHINE\SOFTWARE\Classes\MapPoint.Application

COM_Isolated_MP

If your testing COM Mode functionality for your application there is a PowerShell command that you can use to load / test the COM Object:

 New-Object -ComObject MapPoint.Application

If you run the command in a PowerShell window, as the package is set as “Isolated” then the COM call fails.

MapPoint_CM_Isolated

Let’s see what happens when you change the COM Mode functionality in the “_DeploymentConfig.xml” to “Integrated” and be aware I’ve left “OutOfProcessEnabled” and “InProcessEnabled” to false on purpose.

COM_Integrated_FF

You will see exactly the same as the package being “Isolated” no CLSID for the package because we don’t integrate COM into the OS until “OutOfProcessEnabled” is set to true.

https://blogs.technet.microsoft.com/appv/2013/01/03/microsoft-application-virtualization-5-0-integration/ COM_Isolated_MP

Now I’ve changed the configuration file for OOP to "true", so what happens on the Operating System?

COM_Integrated_TF

The CLSID is now set in the “native” registry which means you can manipulate it via a COM Object call.

Seq_MapPoint_CLSID_Set

If you run the same command as above the COM object call from PowerShell now works.

MapPoint_CM_Integrated

If you look in Task Manager you will see the MapPoint.exe process running but no GUI available to the user.

TM_MapPoint

So MapPoint.exe is loaded, what can you do with the object? You can see below the object can be manipulated and MapPoint methods can be used to “OpenMap” etc.

MapPoint_Objects

Hope this shows how COM integrates from an App-V 5 Package sequence to a client deployment.

David Falkus | Senior Premier Field Engineer | Application Virtualization, PowerShell, Windows Shell

Comments

  • Anonymous
    May 06, 2016
  1. If you have COM set to Isolated, but open regedit in the bubble of your app (/appvve) will the COM objects be exposed to that bubble?2) If you create the COM object in an 'integrated' scenario, do you get 'moved into the bubble' automatically (like launching a .exe in the packageinstallationroot path)?