Banner
Windows 7: Error 2869
This is my site Written by ywhitaker on December 4, 2009 – 6:18 pm

Problem: Your installer works on Windows XP but suddenly starts giving you the following error when you run it on Windows 7 or Vista:

“The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2869″ 

If your installer contains a custom action, it could be causing the error message. Starting with Windows Vista, it is necessary to set the NoImpersonate flag for custom actions that modify the system. This can be done with a simple script.

Create a script named NoImpersonate.js:

// This script performs a post-build fixup of an msi to change all deferred custom actions to NoImpersonate

// Constant values from Windows Installer

var msiOpenDatabaseModeTransact = 1;

var msiViewModifyInsert = 1

var msiViewModifyUpdate = 2

var msiViewModifyAssign = 3

var msiViewModifyReplace = 4

var msiViewModifyDelete = 6

var msidbCustomActionTypeInScript = 0×00000400;

var msidbCustomActionTypeNoImpersonate = 0×00000800

if (WScript.Arguments.Length != 1)

{

WScript.StdErr.WriteLine(WScript.ScriptName + ” file”);

WScript.Quit(1);

}

var filespec = WScript.Arguments(0);

var installer = WScript.CreateObject(“WindowsInstaller.Installer”);

var database = installer.OpenDatabase(filespec, msiOpenDatabaseModeTransact);

var sql

var view

var record

try

{

sql = “SELECT `Action`, `Type`, `Source`, `Target` FROM `CustomAction`”;

view = database.OpenView(sql);

view.Execute();

record = view.Fetch();

while (record)

{

if (record.IntegerData(2) & msidbCustomActionTypeInScript)

{

record.IntegerData(2) = record.IntegerData(2) | msidbCustomActionTypeNoImpersonate;

view.Modify(msiViewModifyReplace, record);

}

record = view.Fetch();

}

view.Close();

database.Commit();

}

catch(e)

{

WScript.StdErr.WriteLine(e);

WScript.Quit(1);

}

Save the script in the same directory as your Setup project. Next, enter the following in your Setup project’s Post Build event:

cscript.exe “$(ProjectDir)CustomAction_NoImpersonate.js” “$(BuiltOuputPath)”

Build the project and try running it again.

You can read more about this issue and also download a sample script at Aaron Stebner’s Weblog. 

For even more detail, look at Microsoft’s topic Custom Action In-Script Execution Options.

2 Responses »

  1. nice:)

  2. YES! I finally found this website! I’ve been searching for this post for so long!!

Leave a Reply