Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you programmatically interact with Component-Based Servicing (TrustedInstaller)? [closed]

I have been trying to find out how to programmatically interact with Component-Based Servicing (CBS) which is basically the TrustedInstaller and other services. With the goal to be able to query CBS for what packages are installed and get any other information they may have on installed packages. Here is a link to a overview of it.

Basically using C/C++/C# (not picky) I would like to interact with this via an API. This link is the best documentation from MSDN that is API related that I could find and it isn't much. Then here is another MSDN documentation area that that gives some details but nothing really about an API I can use to interact with it. This one is under package manager which is how you can interact via command line in a limited way to install CBS based packages. The best quote from that last link is:

"CBS provides various APIs (which are not publicly available) to its client installers to service the operating system components."

Which may say it all, but I am not ready to give up yet. The home for all or at least most of this is %WINDIR%\servicing which has CbsApi.dll for starters, while it appears to be registered as a COM DLL it doesn't publicly expose any classes or functions to do anything. It seems also that most of the details that the API access are in the sub-folders such as Packages, Sessions, Editions, Version, etc.

I know not many people would be trying to do this except for myself and Greg Lambert who has a couple blog posts from a two years back basically asking the same questions and trying to figure out this "not public" API. It didn't look like he cracked this nut yet either.

So now I am at the point to reach out for help and ask the community if anyone has worked out the hidden API for this, or may want to take on the challenge and see want they can find out. Any information that helps me to take a step closer is appreciated.

like image 607
Rodney S. Foley Avatar asked Jul 27 '10 21:07

Rodney S. Foley


1 Answers

The correct way to programatically access the CBS is through the API's to its clients. Depending on what you are trying to accomplish, this would involve the Windows Installer or the Windows Update Agent API, both of which are documented in the Windows SDK. The CBS instelf is an implementation detail and shouldn't be used directly. Thr reason there is so little information publically avaiable is a combination of the fact that relying on implementation details rather than contracts is a bad practice and there is simply easier and more reliable ways to accomplish anything you'd do with CBS directly.

This part of the Windows Installer SDK deals with querying for installed components.

like image 144
Joseph Bongaarts Avatar answered Oct 18 '22 07:10

Joseph Bongaarts