I have a new installer that allows the same product to be installed
multiple times on the same machine. I also have a configuration
program in .NET 2.0 SP1. I would like the config program to be able to
display a list of installed instances for the user to be able to pick
which instance they would like to configure. I was hoping to do this
by calling MsiEnumProducts Ex passing in the product code of my
application. However, I receive the following error.
FatalExecutionE ngineError was detected
Message: The runtime has encountered a fatal error.
The address of the error was at 0x79e71bd7, on thread 0x16d4.
The error code is 0xc0000005.
This error may be a bug in the CLR or in the unsafe or non-verifiable
portions of user code.
Common sources of this bug include user marshaling errors for COM-
interop or PInvoke, which may corrupt the stack.
I guess I must be calling the API incorrectly so any help would be
appreciated. The relevant bits of CSharp code are:
private const string MSI_LIB = "msi";
[DllImport(MSI_L IB, CharSet = CharSet.Auto)]
extern static public MsiError MsiEnumProducts Ex(string product,
string
userSid,
MsiInstallConte xt context,
uint index,
out string
installedProduc tCode,
out
MsiInstallConte xt installedContex t,
out string
szSid,
out uint
pcchSid);
internal enum MsiInstallConte xt : int
{
FIRSTVISIBLE = 0,
NONE = 0,
USERMANAGED = 1,
USERUNMANAGED = 2,
MACHINE = 4,
ALL = (MsiInstallCont ext.USERMANAGED |
MsiInstallConte xt.USERUNMANAGE D | MsiInstallConte xt.MACHINE),
ALLUSERMANAGED= 8,
}
uint index = 0;
MsiError result = MsiError.Succes s;
string productCode = "{3ACF577E-E488-4DFD-925E-A5846EA35EAF}";
string installedProduc tCode = null;
MsiInstallConte xt installedContex t;
string sid = null;
uint sidSize = 0;
result = MsiInterop.MsiE numProductsEx(p roductCode,
null,
MsiInstallConte xt.MACHINE | MsiInstallConte xt.USERMANAGED |
MsiInstallConte xt.USERUNMANAGE D,
index,
out
installedProduc tCode,
out
installedContex t,
out sid,
out sidSize);
Thanks in advance,
Mike.
multiple times on the same machine. I also have a configuration
program in .NET 2.0 SP1. I would like the config program to be able to
display a list of installed instances for the user to be able to pick
which instance they would like to configure. I was hoping to do this
by calling MsiEnumProducts Ex passing in the product code of my
application. However, I receive the following error.
FatalExecutionE ngineError was detected
Message: The runtime has encountered a fatal error.
The address of the error was at 0x79e71bd7, on thread 0x16d4.
The error code is 0xc0000005.
This error may be a bug in the CLR or in the unsafe or non-verifiable
portions of user code.
Common sources of this bug include user marshaling errors for COM-
interop or PInvoke, which may corrupt the stack.
I guess I must be calling the API incorrectly so any help would be
appreciated. The relevant bits of CSharp code are:
private const string MSI_LIB = "msi";
[DllImport(MSI_L IB, CharSet = CharSet.Auto)]
extern static public MsiError MsiEnumProducts Ex(string product,
string
userSid,
MsiInstallConte xt context,
uint index,
out string
installedProduc tCode,
out
MsiInstallConte xt installedContex t,
out string
szSid,
out uint
pcchSid);
internal enum MsiInstallConte xt : int
{
FIRSTVISIBLE = 0,
NONE = 0,
USERMANAGED = 1,
USERUNMANAGED = 2,
MACHINE = 4,
ALL = (MsiInstallCont ext.USERMANAGED |
MsiInstallConte xt.USERUNMANAGE D | MsiInstallConte xt.MACHINE),
ALLUSERMANAGED= 8,
}
uint index = 0;
MsiError result = MsiError.Succes s;
string productCode = "{3ACF577E-E488-4DFD-925E-A5846EA35EAF}";
string installedProduc tCode = null;
MsiInstallConte xt installedContex t;
string sid = null;
uint sidSize = 0;
result = MsiInterop.MsiE numProductsEx(p roductCode,
null,
MsiInstallConte xt.MACHINE | MsiInstallConte xt.USERMANAGED |
MsiInstallConte xt.USERUNMANAGE D,
index,
out
installedProduc tCode,
out
installedContex t,
out sid,
out sidSize);
Thanks in advance,
Mike.