How to read product code from an msi package? - c++

I want to get the product code from an msi file before installing it. I need it to remove the other version of a product if it's already installed on my computer. I mean I want to prevent an error 1638 ("Another version of this product already exists...") and to delete it manually in my code. I'm using c++.
So I want to get the product code from the msi file that is about to install and using this product code remove the existing version of the product and install a new one. But when I'm trying to open an msi file to get it's handle using
MsiOpenPackage(msiPackagePath, &d_handle);
I get an error 1638. So I can not open an msi file and can not get a product code from it. My question: is it possible to get a product code from msi file not opening it with MsiOpenPackage? Thank you in advance!

My colleague has just solved a problem. We used a function MsiOpenPackageEx and passed a flag MSIOPENPACKAGEFLAGS_IGNOREMACHINESTATE to ignore the computer state and return a handle anyway.

Related

Where is "nvinfer.h" from tensorrt located?

I have been trying to compile a basic tensorRT project on a desktop host -for now the source is literally just the following:
#include <nvinfer.h>
class Logger : nvinfer1::public ILogger
{
} glogger;
Upon running make, though, I receive the following message:
fatal error: nvinfer.h: No such file or directory #include <nvinfer.h>
The error is correct, too - I used locate to try to find it, but there's nothing on my machine that matches. I followed the install instructions for desktop installation of TensorRT 2.1 as described here: https://developer.nvidia.com/nvidia-tensorrt-download
So my question is, does anyone know where nvinfer.h is supposed to be? In other words, am I missing a needed package that contains it, or did I miss something else that's essential?
Small addendum: one thing I noticed is that libgie1 is not installed, and it was not included as a debian with the provided TensorRT download like the other packages such as gie-dev were.
Before using locate, if you recently added new files is a good practice to run sudo updatedb, if the file is on the pc you should see it after.
Anyway googling a bit it looks like the header your looking for is NvInfer.h, caps matters.

Virtual Linux under Windows with Virtualbox

I've used this in the past but I must have got lucky. Now both Linux OSes I had have been deleted or screwed up but I can't for the life of me remember how I got them installed last time.
I really haven't got a clue, but are these the right steps:
(1) Uninstall all the old stuff
(2) Download Virtualbox 5.1.8 and install it
(3) Set up a new machine (eg. "Ubuntu64") and accept most of the defaults
I now know that that doesn't give me an OS to run! I need a "VDI" file containing a suitable Linux:
(4) Download Linux VDI for Virtualbox, unzip/un7zip etc to .vdi
Now is the tricky bit: how to I link this file to the Virtualbox new VM? In Storage, it seems to be set up to this file:
c:\Users\xxxxxx\VirtualBox VMs\Ubuntu\Ubuntu.vdi
That file exists but is some 2MB. Do I just copy the big .vdi I've just downloaded into that? Because if I do, it gives me an error:
UUID {7bfdc68e-2717-4c80-8613-6a2220358337} of the medium 'C:\Users
\xxxxxx\VirtualBox VMs\Ubuntu\Ubuntu.vdi' does not match the value
{553bdd10-e133-492f-85b9-3ec2c2fa4e67} stored in the media registry
('C:\Users\xxxxxx\.VirtualBox\VirtualBox.xml').
I would have edited that .xml file to match, but the UUID figure in that is different from either of the above! Anyway it seems like there is some official way of telling VB about this vdi; what is it? And if not, what have I done wrong? I downloaded another vdi with the same result.

How to initialise a git repository with libgit2

On a Windows XP, 32-bit machine I've cloned the libgit2 repository using
git clone git://github.com/libgit2/libgit2.git trunk
Then I configured from trunk_build_debug for mingw using:
cmake ../trunk -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=-g
and build-ed it with
make
With this newly build library I'm trying to create a new repository. So I'm using
error_code = git_repository_init( &repo, path, 0 );
if ( error_code != 0 )
{
const git_error * error = giterr_last();
/* the text representation:
( error == NULL || error->message == NULL ?
"(no description)" :
error->message )
*/
}
On first attempt this fails with the error message:
Git error -1: The global file '.config/git/config' doesn't exist: The
system cannot find the file specified.
The .git directory is created and I can use git status to query it. Also, I have git installed in Program Files/git and it works just fine. The file that is mentioned does not exist in user directory, that is true. I'm not happy because I can't check the returned error code (the error may be "real").
So I've created an empty file in D:\Documents and Settings\User Name.config\git\config
The .git directory is again created but I get the same -1 error code. This time giterr_last() returns NULL.
Tracing the code in debugger seems to indicate that the library is not happy with my empty file.
However, I think this indicates that I'm doing something wrong. Is there an initialization method? Do I need to create the file and use the git_config_ functions to point the library to it?
BTW, is this the wrong place to ask this? Is there a dedicated forum where I should ask this question?
Thanks
Here is the back trace where the call fails: pastebin
It seems that the configure file inside .git directory can't be parsed (not shown in in trace is the 'config_parse()' that fails).
I've opened an issue in libgit2.
To create a new repository, one should rather rely on git_repository_init(). For more information, you can peek at the header and the tests.
git_repository_open() should rather be used when the repository already exists.
Is there a dedicated forum where I should ask this question?
It's ok to ask programming related question on StackOverflow. Beside this, some libgit2 developers hang out in the #libgit2 channel on irc.freenode.net. However, when you encounter bugs, it's recommended to submit them to the issue tracker.
Update
There had been some issues in the past with the way the configuration files are being probbed on Windows. Along with some attempts to fix them. See this issue for some background about this.
Beside the complexity of the probbing, some users may want to explictly provide alternate locations for their files. This pull request works this angle.
Considering what you discovered while debugging the libgit2, maybe now would be a good time to open a bug in the issue tracker. Beware that two issues may be at play: the probbing one and and the empty config issue.

Facebook Actionscript API examples not compiling - application descriptor not found

Trying to run some of the desktop(AIR) samples located here
http://code.google.com/p/facebook-actionscript-api/
No matter what I try get the error message
Process terminated without establishing connection to debugger.
application descriptor not found
But as far as I can tell there IS a proper descriptor file (XML) present in my bin-debug folder.
Anyone have an idea what is happening? Could the issue have something to do with the Flexsdk I am using (4.6) when combined with the latest AIR 3.4?
This is my application descriptor file WITHOUT most of the commented code
<id>MediaUploadDemo</id>
<filename>MediaUploadDemo</filename>
<name>MediaUploadDemo</name>
<version>v1</version>
<initialWindow>
<content>MediaUploadDemo.swf</content>
</initialWindow>
Found most of my answers here
http://alpha-beta-pruning.blogspot.ca/2011/06/migrating-flex-3-project-to-flex-45.html
Key paragraph
'Each AIR sdk tends to have it's own application descriptor file formatting which means that an application that was created with AIR 2.0 must "migrate" its descriptor file to the new AIR 2.7 sdk. My suggestion is creating from scratch a new project that targets the new sdk, just so we can take its descriptor file, copy/paste it to our "old" project and change the necessary values to adapt our project (such as project name, etc).'

Windows Mobile fails to uninstall

Testing my app on some WM Std 6.1 I found out that it fails to uninstall. I receive this error:
“[app] was not completely removed. Do you want to remove it from the list of installed programs?"
Checking my setup.dll I can tell that Uninstall_Init and Uninstall_Exit are being called each time but all the files stays (they are not locked, I’ve checked) and its entry doesn’t disappear from the list of installed apps (whether I choose it to stay or not).
There are really only three possible reasons for this:
Uninstall_Init doesn't return continue.
Uninstall_Exit doesn't return continue.
The installer engine failed.
If you have verified that 1 & 2 then ok then 3 is going to be tough to figure out.
Some problems that I have encounted:
Check the DLL dependencies of your setup DLL and try to remove as many as possible. I've found that dependencies to MSXML can cause problems.
Remove any registry setup in your INF file, move it into your setup dll. I've found this to cause the uninstall to fail randomly on random devices because of this.
What I needed up doing for existing customers is write a uninstall application to remove our application manually if the uninstall worked. If you do need to write a manual unistall you need to do the following:
* Remove all your registry keys
* Remove all your files
* Remove registry key HKLM\Security\AppInstall{app name}
* In WM6.1 you need to remove a database record from the EDB database "SwMgmtMetadataStore" where the SWT_INSTALL_NAME_TAG property equals your {app name}.
Another thing worth investigating is the install log created by the cab install/uninstall process.
You can find this within the \Application Data\Volatile\ directory (usually called setup.log).
Copying this file to your desktop PC and opening it in notepad may provide more clues (such as files in use during uninstall) as to why the uninstall did not succeed.
I had several CAB files that worked perfectly on WM 6.0, but stopped working in WM 6.1.
Turns out it was because either the AppName or the Manufacturer had spaces in. Removing the spaces fixed the CAB files and they now successfully uninstall in WM 6.1!!