
Ящик для предложений: sales@blogslov.ru
Send Wix-commits mailing list submissions to
wix-commits@lists.sourceforge.net
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.sourceforge.net/lists/listinfo/wix-commits
or, via email, send a message with subject or body 'help' to
wix-commits-request@lists.sourceforge.net
You can reach the person managing the list at
wix-commits-owner@lists.sourceforge.net
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Wix-commits digest..."
Today's Topics:
1. wix/toolsrc/XsdStitch XsdStitch.cs,1.3,1.4 (Rob Mensching)
2. wix/src/ca/serverca/scasched scacert.cpp, NONE, 1.1
scacert.h, NONE, 1.1 scahttpheader.cpp, NONE, 1.1
scahttpheader.h, NONE, 1.1 scaperf.cpp, NONE, 1.1 scasql.cpp,
1.2, 1.3 precomp.h, 1.2, 1.3 scaapppool.cpp, 1.5, 1.6
scaapppool.h, 1.5, 1.6 scadb.cpp, 1.4, 1.5 scadb.h, 1.2, 1.3
scafilter.cpp, 1.3, 1.4 scaiis.cpp, 1.5, 1.6 scaiis.h, 1.3, 1.4
scasched.build, 1.3, 1.4 scasched.cpp, 1.7, 1.8 scasched.def,
1.2, 1.3 scasched.vcproj, 1.2, 1.3 scasqlstr.cpp, 1.4, 1.5
scasqlstr.h, 1.3, 1.4 scassl.cpp, 1.6, 1.7 scassl.h, 1.2, 1.3
scauser.cpp, 1.4, 1.5 scauser.h, 1.4, 1.5 scavdir.cpp, 1.4, 1.5
scavdir.h, 1.4, 1.5 scaweb.cpp, 1.10, 1.11 scaweb.h, 1.5, 1.6
scawebappext.cpp, 1.5, 1.6 scawebappext.h, 1.3, 1.4 scawebdir.h,
1.2, 1.3 scawebsvcext.cpp, 1.6, 1.7 scawebsvcext.h, 1.3, 1.4
scasql.h, 1.2, NONE (Rob Mensching)
----------------------------------------------------------------------
Message: 1
Date: Wed, 27 Jun 2007 05:39:32 +0000
From: Rob Mensching
Subject: [WiX-commits] wix/toolsrc/XsdStitch XsdStitch.cs,1.3,1.4
To: wix-commits@lists.sourceforge.net
Message-ID:
Update of /cvsroot/wix/wix/toolsrc/XsdStitch
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv1332/toolsrc/XsdStitch
Modified Files:
XsdStitch.cs
Log Message:
Benxing: Number of patch related bug fix
*Update FeatureComponent table when ComponentRef in the selected PatchFamily
*File Sequence problem
PMarcu: Allowing extension attributes on DirectoryRef and PropertyRef
Adding extension attributes to the VSExtension Refs
PMarcu: Adding UIRef and DirectoryRef to possible PatchFamily Children
Allowing extension attributes on CustomAction elements.
JRock: Added support for setting pre- and post-build event command lines via a
property page in Votive. This gets me one step closer to restoring the
inter-project variables that we had in V2 but had to pull in V3 to get
it out the door (e.g. $(var.MyProject.TargetPath)).
JRock: Added support for SolutionX variables in the wix.targets file. So, you
can now use $(var.SolutionDir) in your .wxs files and have the variables
automatically added to the preprocessor definitions when building with
wix.targets and MSBuild.
Benxing: Regardless of differences in the MST, we will compare underlying files before
copying data into the patch. Extensions can override CompareFiles to provide
custom file diffing behavior.
AaronSte: Updating Heat to use HKCU instead of HKLM when harvesting registry
information on Windows Vista to avoid UAC issues
PMarcu: Making XsdStitch only output a single prefix for each extension namespace.
Benxing: Fixing null reference exception in the binder when the file table is empty.
RobMen: Default File/@Name to File/@Id.
MikeHo: Fix bug with Setup.exe when trying to install and TEMP and AppData
folders are not on same drive, setup fails
MikeHo: Add fallback to Caching the MSI.
RobMen: SFBUG:1680666 - Correctly modularize RemoveIniFile.DirProperites.
PMarcu: Removing FragmentRef's
AaronSte: SFBUG:1675664 - Marking ComboBox value attribute as localizable.
PMarcu: Adding BinaryRef as a child of PatchFamily.
Benxing: Give warning when removing component from feature during the patch build.
PMarcu: Changing namespace keys in the VSExtension help tables to not be modularized.
PMarcu: Adding some targeted checks to patch transforms to catch possible error
conditions as early as possible.
AaronSte: Adding Visual Studio Codename Orcas detection properties.
AaronSte: SFBUG:1687207 - Update Heat so DllRegisterServer captures will work
on Windows Vista from an elevated cmd prompt.
PMarcu: Fix for DocCompiler to handle ref attributes in attribute definitions under
elements.
BobArnso: Resize and combine some controls to better fit localized strings
(affects all UI sets, dialogs UserExit, OutOfRbDiskDlg, OutOfDiskDlg)
Benxing: Skipping unreal tables when binding transforms to improve patch build
perfomance.
Adding active substorage into binder extension to give the ability to
access corresponding transform information.
JRock: SFBUG:1673425 - Cannot access the VS menu using the alt key
SFBUG:1576283 - Unable to enter 'c' or 'm' in proj properties screen fields
SFBUG:1570392 - Project Designer - Index was outside the bounds of the array
SFBUG:1566296 - Setting 'Cultures' field in project properties has no effect
SFBUG:1576287 - Modifying project properties does not force rebuild
Benxing: Ignore rows without section id in ReduceTransform.
MikeHo: Allow for multiple files to be extracted from chainer.
AaronSte: Adding Visual Studio Team Test project system detection properties.
FGrohn: Support for PubCA in WiX v3.
HeathS: Added extension support to the Validator.
Exposed extension support for the Validator through light.exe.
Exposed extension support for the Validator through smoke.exe.
Exposed multiple .cub file support through smoke.exe.
HeathS: Exposed multiple .cub file support through light.exe.
Added a test for the Validator and multiple .cub support in light.exe.
MikeHo: Add error messages for Windows Installer service can't start or Install
blocked by system policy
BobArnso: Add WixQueryOsInfo CA to detect system suite info and "special
folders" as properties over and above the MSI set
BobArnso: Default to removing library rows from decompiled output in
WixUtilExtension
PMarcu: Refactoring patch buld system to use Pyro instead of Light for filtering
and binding. Other target patch specific bug fixes are in the mix as well.
PMarcu: Adding more command line options to Pyro, specifically the ones that
provide settings for the binder.
PMarcu: Adding error and warning preprocessor instructions.
PMarcu: Fixing an exception thrown when Dark is run and no extensions are defined
in the config file or the config file is absent.
Also, bug where Customtable columns that are not foreign keys have the
keytable attribute defined on the column as keytable="". This results in
an invalid table reference to "".
PMarcu: Switching order on Pyro commandline.
Jordanf: Adding support to WixUnit for Pyro. Fixing the qtest patch.minorupgrade
to use Pyro.
BrianRe: Added code to detect a namespace prefix that is already in use and if
so it will append it with its' position within the "duplicates" for
that specific prefix; eg. sql, sql2, sql3, and so on.
RobMen: Add support for PerformanceCounters (including managed code).
FGrohn: Added COM+ and MSMQ extensions to the zip file.
FGrohn: Move to Windows Vista SDK.
JRock: SFBUG:1566807 - Display full version in about dialog.
SFBUG:1697089 - MSBuild WiX taskscannot resolve WiX tool paths automatically
SFBUG:1689830 - Error when using Wix3 when not installed on C drive
Benxing: Handle Sequence tables when building the patch.
Don't allow empty patch.
HeathS: Added an extension for installing PowerShell snap-ins.
PMarcu: Adding Melt as a tool to decompile MSM's to ComponentGroups.
PMarcu: Adding warning for when a non keypath file is updated and the keypath file
of that component is not.
Benxing: Adding information into _SummaryInformation table for patch build.
PMarcu: Adding a check to assure no duplicate fragment Id's exist.
JKuhne: Fixing a GC issue with the Validator. (Locals are rooted until last reference, not
end of scope.)
BobArnso: Add DiskId attribute to Directory and DirectoryRef to provide default
DiskId for contained components and files.
MikeHo: Fix language matching in Setup.exe
PMarcu: Making sdut and tsa defaults when passing xo to light.exe
AaronSte: Adding more CSIDL values to WixQueryOsDirs custom action
RobMen: Reverse integrate WiX v2 CustomAction fixes.
BobArnso: Add element-extensibility points to Directory and DirectoryRef.
Jordanf: Add a new test for preprocessor .
Mikeho: Add NewFolder UIText element.
AaronSte: Adding custom actions to run devenv.exe /InstallVSTemplates to the
WixVSExtension
BobArnso: Pass directory ID to Directory and DirectoryRef extension elements.
RobMen: Introducing smart-cabbing.
RobMen: SFBUG:1707259 - fix nasty memory violation
HeathS: Added patch-specific property to identify client patches and
if they can be removed.
Mikeho: Fix manifests for setupbld.exe/setup.exe
JordanF: Add the -update option to automatically update a test. Make MSI/MSI
validation explicit in the tests.
JRock: Adding back project references to Votive V3! Actually, I'm adding them
to the wix.targets MSBuild file to be exact. Votive uses it, but you get
the goodness without using Votive also. Basically, this is the feature
where if you reference other projects in your Visual Studio solution,
you can reference the output of those projects from within your wixproj
project. For example, $(var.MyCSharpApp.TargetPath). This will work for
any managed project in Visual Studio (at least it does for VC#, VB, and
VC++ managed). You have to build from within Visual Studio or from the
command line. If you build just the .wixproj, then you won't get the
project variables defined.
SFBUG:1585281 - Add solution and project variables back to Votive v3
MikeHo: Fix support for more than 10 MSIs/MSTs
JRock: SFBUG:1588291 - Support response files for MSBuild candle/light/lit
tasks
BobArnso: Have heat generate a default ComponentGroup when harvesting
directories in a fragment.
JRock: SFBUG:1717966 - Solution Build Issues (build 2911)
When a wixproj is the only thing in the solution, the SolutionX
variables aren't defined when building within Visual Studio. This
is because normally C#/VB define these variables for us. The fix
is to define them ourself.
HeathS: SFBUG:1716160 - ICE03 string overflow error, xmlFile
RobMen: SFBUG:1716160 - fix string overflow error for XmlConfig
BrianRe: Fixing wix.xsd to use W3C recognized regular expressions.
PMarcu: Defaulting Media\@Source to a form of the patchId if not specified
when Media is a child of a patch.
RobMen: SFBUG:1724535 - correctly integrate a few more fixes from WiX v2 to
WiX v3.
JordanF: WixUnit now compares the transforms inside a patch when it is diffing
two patches. Previously, only the tables in the patch were compared.
AaronSte: Added documentation for properties and custom actions in the
WixVSExtension.
PMarcu: Fix for ServiceConfig CA's to call correct rollback entrypoint.
BMurri: Add support for bound wixouts/wixmsts to torch and pyro.
PMarcu: Fix for ServiceConfig CA's to call correct rollback entrypoint.
RobMen: Schema tweaks to enable simple references on FeatureRef and
FeatureGroupRef plus tweaks to enable floating Components.
AaronSte: Added documentation for Votive functionality.
AaronSte: Fixing variable resolution problem in WiX Product item template
in Votive.
PMarcu: Updating flags in XmlConfig to match with CA after the 2.0 to
3.0 integration.
JRock: Integrated the VS SDK 4.0 into Votive.
AaronSte: Merged WiX 2.0 documentation changes into 3.0. Updated instances
of deprecated src attributes in examples in the docs.
MikeHo: Add reinstall support & logging to Chainer + fix bug when using
transforms other than Chinese.
HeathS: SFBUG:1739868 - Pyro does not find .AllowRemoval property
PMarcu: Removing primary key from EnsureTable to support patching.
Fixing documentation for XmlConfig.
RobMen: SFBUG:1739194 - Preserve whitespace when using XmlFile or XmlConfig
JKuhne: Fix a GC related bug in the cab enumeration callback. (Cab.WixEnumerateCab.Enumerate)
Index: XsdStitch.cs
===================================================================
RCS file: /cvsroot/wix/wix/toolsrc/XsdStitch/XsdStitch.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** XsdStitch.cs 11 Oct 2006 06:25:49 -0000 1.3
--- XsdStitch.cs 27 Jun 2007 05:39:30 -0000 1.4
***************
*** 111,127 ****
finally
{
! mainSchemaReader.Close();
}
// load the extension schemas
foreach (string extensionSchemaFile in this.extensionSchemaFiles)
{
XmlTextReader reader = null;
-
try
{
reader = new XmlTextReader(extensionSchemaFile);
XmlSchema extensionSchema = XmlSchema.Read(reader, null);
!
schemas.Add(extensionSchema);
--- 111,145 ----
finally
{
! if (null != mainSchemaReader)
! {
! mainSchemaReader.Close();
! }
}
+ StringCollection addedSchemas = new StringCollection();
+
// load the extension schemas
foreach (string extensionSchemaFile in this.extensionSchemaFiles)
{
XmlTextReader reader = null;
try
{
+ string schemaFilename = Path.GetFileNameWithoutExtension(extensionSchemaFile);
+ if (addedSchemas.Contains(schemaFilename))
+ {
+ int duplicateNameCounter = 2;
+
+ while (addedSchemas.Contains(String.Concat(schemaFilename,duplicateNameCounter)))
+ {
+ duplicateNameCounter++;
+ }
+
+ schemaFilename = String.Concat(schemaFilename, duplicateNameCounter);
+ }
+
+ addedSchemas.Add(schemaFilename);
reader = new XmlTextReader(extensionSchemaFile);
XmlSchema extensionSchema = XmlSchema.Read(reader, null);
! mainSchema.Namespaces.Add(schemaFilename, extensionSchema.TargetNamespace);
schemas.Add(extensionSchema);
***************
*** 134,138 ****
finally
{
! reader.Close();
}
}
--- 152,159 ----
finally
{
! if (null != reader)
! {
! reader.Close();
! }
}
}
------------------------------
Message: 2
Date: Wed, 27 Jun 2007 05:36:02 +0000
From: Rob Mensching
Subject: [WiX-commits] wix/src/ca/serverca/scasched scacert.cpp, NONE,
1.1 scacert.h, NONE, 1.1 scahttpheader.cpp, NONE, 1.1 scahttpheader.h,
NONE, 1.1 scaperf.cpp, NONE, 1.1 scasql.cpp, 1.2, 1.3 precomp.h, 1.2,
1.3 scaapppool.cpp, 1.5, 1.6 scaapppool.h, 1.5, 1.6 scadb.cpp, 1.4,
1.5 scadb.h, 1.2, 1.3 scafilter.cpp, 1.3, 1.4 scaiis.cpp, 1.5, 1.6
scaiis.h, 1.3, 1.4 scasched.build, 1.3, 1.4 scasched.cpp, 1.7, 1.8
scasched.def, 1.2, 1.3 scasched.vcproj, 1.2, 1.3 scasqlstr.cpp, 1.4,
1.5 scasqlstr.h, 1.3, 1.4 scassl.cpp, 1.6, 1.7 scassl.h, 1.2, 1.3
scauser.cpp, 1.4, 1.5 scauser.h, 1.4, 1.5 scavdir.cpp, 1.4, 1.5
scavdir.h, 1.4, 1.5 scaweb.cpp, 1.10, 1.11 scaweb.h, 1.5, 1.6
scawebappext.cpp, 1.5, 1.6 scawebappext.h, 1.3, 1.4 scawebdir.h, 1.2,
1.3 scawebsvcext.cpp, 1.6, 1.7 scawebsvcext.h, 1.3, 1.4 scasql.h, 1.2,
NONE
To: wix-commits@lists.sourceforge.net
Message-ID:
Update of /cvsroot/wix/wix/src/ca/serverca/scasched
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv1332/src/ca/serverca/scasched
Modified Files:
precomp.h scaapppool.cpp scaapppool.h scadb.cpp scadb.h
scafilter.cpp scaiis.cpp scaiis.h scasched.build scasched.cpp
scasched.def scasched.vcproj scasqlstr.cpp scasqlstr.h
scassl.cpp scassl.h scauser.cpp scauser.h scavdir.cpp
scavdir.h scaweb.cpp scaweb.h scawebappext.cpp scawebappext.h
scawebdir.h scawebsvcext.cpp scawebsvcext.h
Added Files:
scacert.cpp scacert.h scahttpheader.cpp scahttpheader.h
scaperf.cpp scasql.cpp
Removed Files:
scasql.h
Log Message:
Benxing: Number of patch related bug fix
*Update FeatureComponent table when ComponentRef in the selected PatchFamily
*File Sequence problem
PMarcu: Allowing extension attributes on DirectoryRef and PropertyRef
Adding extension attributes to the VSExtension Refs
PMarcu: Adding UIRef and DirectoryRef to possible PatchFamily Children
Allowing extension attributes on CustomAction elements.
JRock: Added support for setting pre- and post-build event command lines via a
property page in Votive. This gets me one step closer to restoring the
inter-project variables that we had in V2 but had to pull in V3 to get
it out the door (e.g. $(var.MyProject.TargetPath)).
JRock: Added support for SolutionX variables in the wix.targets file. So, you
can now use $(var.SolutionDir) in your .wxs files and have the variables
automatically added to the preprocessor definitions when building with
wix.targets and MSBuild.
Benxing: Regardless of differences in the MST, we will compare underlying files before
copying data into the patch. Extensions can override CompareFiles to provide
custom file diffing behavior.
AaronSte: Updating Heat to use HKCU instead of HKLM when harvesting registry
information on Windows Vista to avoid UAC issues
PMarcu: Making XsdStitch only output a single prefix for each extension namespace.
Benxing: Fixing null reference exception in the binder when the file table is empty.
RobMen: Default File/@Name to File/@Id.
MikeHo: Fix bug with Setup.exe when trying to install and TEMP and AppData
folders are not on same drive, setup fails
MikeHo: Add fallback to Caching the MSI.
RobMen: SFBUG:1680666 - Correctly modularize RemoveIniFile.DirProperites.
PMarcu: Removing FragmentRef's
AaronSte: SFBUG:1675664 - Marking ComboBox value attribute as localizable.
PMarcu: Adding BinaryRef as a child of PatchFamily.
Benxing: Give warning when removing component from feature during the patch build.
PMarcu: Changing namespace keys in the VSExtension help tables to not be modularized.
PMarcu: Adding some targeted checks to patch transforms to catch possible error
conditions as early as possible.
AaronSte: Adding Visual Studio Codename Orcas detection properties.
AaronSte: SFBUG:1687207 - Update Heat so DllRegisterServer captures will work
on Windows Vista from an elevated cmd prompt.
PMarcu: Fix for DocCompiler to handle ref attributes in attribute definitions under
elements.
BobArnso: Resize and combine some controls to better fit localized strings
(affects all UI sets, dialogs UserExit, OutOfRbDiskDlg, OutOfDiskDlg)
Benxing: Skipping unreal tables when binding transforms to improve patch build
perfomance.
Adding active substorage into binder extension to give the ability to
access corresponding transform information.
JRock: SFBUG:1673425 - Cannot access the VS menu using the alt key
SFBUG:1576283 - Unable to enter 'c' or 'm' in proj properties screen fields
SFBUG:1570392 - Project Designer - Index was outside the bounds of the array
SFBUG:1566296 - Setting 'Cultures' field in project properties has no effect
SFBUG:1576287 - Modifying project properties does not force rebuild
Benxing: Ignore rows without section id in ReduceTransform.
MikeHo: Allow for multiple files to be extracted from chainer.
AaronSte: Adding Visual Studio Team Test project system detection properties.
FGrohn: Support for PubCA in WiX v3.
HeathS: Added extension support to the Validator.
Exposed extension support for the Validator through light.exe.
Exposed extension support for the Validator through smoke.exe.
Exposed multiple .cub file support through smoke.exe.
HeathS: Exposed multiple .cub file support through light.exe.
Added a test for the Validator and multiple .cub support in light.exe.
MikeHo: Add error messages for Windows Installer service can't start or Install
blocked by system policy
BobArnso: Add WixQueryOsInfo CA to detect system suite info and "special
folders" as properties over and above the MSI set
BobArnso: Default to removing library rows from decompiled output in
WixUtilExtension
PMarcu: Refactoring patch buld system to use Pyro instead of Light for filtering
and binding. Other target patch specific bug fixes are in the mix as well.
PMarcu: Adding more command line options to Pyro, specifically the ones that
provide settings for the binder.
PMarcu: Adding error and warning preprocessor instructions.
PMarcu: Fixing an exception thrown when Dark is run and no extensions are defined
in the config file or the config file is absent.
Also, bug where Customtable columns that are not foreign keys have the
keytable attribute defined on the column as keytable="". This results in
an invalid table reference to "".
PMarcu: Switching order on Pyro commandline.
Jordanf: Adding support to WixUnit for Pyro. Fixing the qtest patch.minorupgrade
to use Pyro.
BrianRe: Added code to detect a namespace prefix that is already in use and if
so it will append it with its' position within the "duplicates" for
that specific prefix; eg. sql, sql2, sql3, and so on.
RobMen: Add support for PerformanceCounters (including managed code).
FGrohn: Added COM+ and MSMQ extensions to the zip file.
FGrohn: Move to Windows Vista SDK.
JRock: SFBUG:1566807 - Display full version in about dialog.
SFBUG:1697089 - MSBuild WiX taskscannot resolve WiX tool paths automatically
SFBUG:1689830 - Error when using Wix3 when not installed on C drive
Benxing: Handle Sequence tables when building the patch.
Don't allow empty patch.
HeathS: Added an extension for installing PowerShell snap-ins.
PMarcu: Adding Melt as a tool to decompile MSM's to ComponentGroups.
PMarcu: Adding warning for when a non keypath file is updated and the keypath file
of that component is not.
Benxing: Adding information into _SummaryInformation table for patch build.
PMarcu: Adding a check to assure no duplicate fragment Id's exist.
JKuhne: Fixing a GC issue with the Validator. (Locals are rooted until last reference, not
end of scope.)
BobArnso: Add DiskId attribute to Directory and DirectoryRef to provide default
DiskId for contained components and files.
MikeHo: Fix language matching in Setup.exe
PMarcu: Making sdut and tsa defaults when passing xo to light.exe
AaronSte: Adding more CSIDL values to WixQueryOsDirs custom action
RobMen: Reverse integrate WiX v2 CustomAction fixes.
BobArnso: Add element-extensibility points to Directory and DirectoryRef.
Jordanf: Add a new test for preprocessor .
Mikeho: Add NewFolder UIText element.
AaronSte: Adding custom actions to run devenv.exe /InstallVSTemplates to the
WixVSExtension
BobArnso: Pass directory ID to Directory and DirectoryRef extension elements.
RobMen: Introducing smart-cabbing.
RobMen: SFBUG:1707259 - fix nasty memory violation
HeathS: Added patch-specific property to identify client patches and
if they can be removed.
Mikeho: Fix manifests for setupbld.exe/setup.exe
JordanF: Add the -update option to automatically update a test. Make MSI/MSI
validation explicit in the tests.
JRock: Adding back project references to Votive V3! Actually, I'm adding them
to the wix.targets MSBuild file to be exact. Votive uses it, but you get
the goodness without using Votive also. Basically, this is the feature
where if you reference other projects in your Visual Studio solution,
you can reference the output of those projects from within your wixproj
project. For example, $(var.MyCSharpApp.TargetPath). This will work for
any managed project in Visual Studio (at least it does for VC#, VB, and
VC++ managed). You have to build from within Visual Studio or from the
command line. If you build just the .wixproj, then you won't get the
project variables defined.
SFBUG:1585281 - Add solution and project variables back to Votive v3
MikeHo: Fix support for more than 10 MSIs/MSTs
JRock: SFBUG:1588291 - Support response files for MSBuild candle/light/lit
tasks
BobArnso: Have heat generate a default ComponentGroup when harvesting
directories in a fragment.
JRock: SFBUG:1717966 - Solution Build Issues (build 2911)
When a wixproj is the only thing in the solution, the SolutionX
variables aren't defined when building within Visual Studio. This
is because normally C#/VB define these variables for us. The fix
is to define them ourself.
HeathS: SFBUG:1716160 - ICE03 string overflow error, xmlFile
RobMen: SFBUG:1716160 - fix string overflow error for XmlConfig
BrianRe: Fixing wix.xsd to use W3C recognized regular expressions.
PMarcu: Defaulting Media\@Source to a form of the patchId if not specified
when Media is a child of a patch.
RobMen: SFBUG:1724535 - correctly integrate a few more fixes from WiX v2 to
WiX v3.
JordanF: WixUnit now compares the transforms inside a patch when it is diffing
two patches. Previously, only the tables in the patch were compared.
AaronSte: Added documentation for properties and custom actions in the
WixVSExtension.
PMarcu: Fix for ServiceConfig CA's to call correct rollback entrypoint.
BMurri: Add support for bound wixouts/wixmsts to torch and pyro.
PMarcu: Fix for ServiceConfig CA's to call correct rollback entrypoint.
RobMen: Schema tweaks to enable simple references on FeatureRef and
FeatureGroupRef plus tweaks to enable floating Components.
AaronSte: Added documentation for Votive functionality.
AaronSte: Fixing variable resolution problem in WiX Product item template
in Votive.
PMarcu: Updating flags in XmlConfig to match with CA after the 2.0 to
3.0 integration.
JRock: Integrated the VS SDK 4.0 into Votive.
AaronSte: Merged WiX 2.0 documentation changes into 3.0. Updated instances
of deprecated src attributes in examples in the docs.
MikeHo: Add reinstall support & logging to Chainer + fix bug when using
transforms other than Chinese.
HeathS: SFBUG:1739868 - Pyro does not find .AllowRemoval property
PMarcu: Removing primary key from EnsureTable to support patching.
Fixing documentation for XmlConfig.
RobMen: SFBUG:1739194 - Preserve whitespace when using XmlFile or XmlConfig
JKuhne: Fix a GC related bug in the cab enumeration callback. (Cab.WixEnumerateCab.Enumerate)
--- NEW FILE: scaperf.cpp ---
//-------------------------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// The use and distribution terms for this software are covered by the
// Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
// which can be found in the file CPL.TXT at the root of this distribution.
// By using this software in any fashion, you are agreeing to be bound by
// the terms of this license.
//
// You must not remove this notice, or any other, from this software.
//
//
//
// Windows Installer XML Server Performance Counter CustomActions.
//
//-------------------------------------------------------------------------------------------------
#include "precomp.h"
LPCWSTR vcsPerfCounterDataQuery = L"SELECT `PerformanceCategory`, `Component_`, `Name`, `IniData`, `ConstantData` FROM `PerformanceCategory`";
enum ePerfCounterDataQuery { pcdqId = 1, pcdqComponent, pcdqName, pcdqIniData, pcdqConstantData };
LPCWSTR vcsPerfMonQuery = L"SELECT `Component_`, `File`, `Name` FROM `Perfmon`";
enum ePerfMonQuery { pmqComponent = 1, pmqFile, pmqName };
static HRESULT ProcessPerformanceCategory(
__in MSIHANDLE hInstall,
__in BOOL fInstall
);
/********************************************************************
InstallPerfCounterData - CUSTOM ACTION ENTRY POINT for installing
Performance Counters.
********************************************************************/
extern "C" UINT __stdcall InstallPerfCounterData(
__in MSIHANDLE hInstall
)
{
// AssertSz(FALSE, "debug InstallPerfCounterData{}");
HRESULT hr;
UINT er = ERROR_SUCCESS;
hr = WcaInitialize(hInstall, "InstallPerfCounterData");
ExitOnFailure(hr, "Failed to initialize InstallPerfCounterData.");
hr = ProcessPerformanceCategory(hInstall, TRUE);
MessageExitOnFailure(hr, msierrInstallPerfCounterData, "Failed to process PerformanceCategory table.");
LExit:
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
return WcaFinalize(er);
}
/********************************************************************
UninstallPerfCounterData - CUSTOM ACTION ENTRY POINT for installing
Performance Counters.
********************************************************************/
extern "C" UINT __stdcall UninstallPerfCounterData(
__in MSIHANDLE hInstall
)
{
// AssertSz(FALSE, "debug UninstallPerfCounterData{}");
HRESULT hr;
UINT er = ERROR_SUCCESS;
hr = WcaInitialize(hInstall, "UninstallPerfCounterData");
ExitOnFailure(hr, "Failed to initialize UninstallPerfCounterData.");
hr = ProcessPerformanceCategory(hInstall, FALSE);
MessageExitOnFailure(hr, msierrUninstallPerfCounterData, "Failed to process PerformanceCategory table.");
LExit:
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
return WcaFinalize(er);
}
/********************************************************************
RegisterPerfmon - CUSTOM ACTION ENTRY POINT for installing Perfmon counters
********************************************************************/
extern "C" UINT __stdcall ConfigurePerfmonInstall(
__in MSIHANDLE hInstall
)
{
// Assert(FALSE);
HRESULT hr;
UINT er = ERROR_SUCCESS;
PMSIHANDLE hView, hRec;
LPWSTR pwzData = NULL, pwzName = NULL, pwzFile = NULL;
INSTALLSTATE isInstalled, isAction;
hr = WcaInitialize(hInstall, "ConfigurePerfmonInstall");
ExitOnFailure(hr, "Failed to initialize");
// check to see if necessary tables are specified
if (S_OK != WcaTableExists(L"Perfmon"))
{
WcaLog(LOGMSG_VERBOSE, "Skipping RegisterPerfmon() because Perfmon table not present");
ExitFunction1(hr = S_FALSE);
}
hr = WcaOpenExecuteView(vcsPerfMonQuery, &hView);
ExitOnFailure(hr, "failed to open view on PerfMon table");
while ((hr = WcaFetchRecord(hView, &hRec)) == S_OK)
{
// get component install state
hr = WcaGetRecordString(hRec, pmqComponent, &pwzData);
ExitOnFailure(hr, "failed to get Component for PerfMon");
er = ::MsiGetComponentStateW(hInstall, pwzData, &isInstalled, &isAction);
hr = HRESULT_FROM_WIN32(er);
ExitOnFailure(hr, "failed to get Component state for PerfMon");
if (!WcaIsInstalling(isInstalled, isAction))
{
continue;
}
hr = WcaGetRecordString(hRec, pmqName, &pwzName);
ExitOnFailure(hr, "failed to get Name for PerfMon");
hr = WcaGetRecordFormattedString(hRec, pmqFile, &pwzFile);
ExitOnFailure(hr, "failed to get File for PerfMon");
WcaLog(LOGMSG_VERBOSE, "ConfigurePerfmonInstall's CustomActionData: '%S', '%S'", pwzName, pwzFile);
hr = WcaDoDeferredAction(L"RegisterPerfmon", pwzFile, COST_PERFMON_REGISTER);
ExitOnFailure(hr, "failed to schedule RegisterPerfmon action");
hr = WcaDoDeferredAction(L"RollbackRegisterPerfmon", pwzName, COST_PERFMON_UNREGISTER);
ExitOnFailure(hr, "failed to schedule RollbackRegisterPerfmon action");
}
if (hr == E_NOMOREITEMS)
{
hr = S_OK;
}
ExitOnFailure(hr, "Failure while processing PerfMon");
hr = S_OK;
LExit:
ReleaseStr(pwzData);
ReleaseStr(pwzName);
ReleaseStr(pwzFile);
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
return WcaFinalize(er);
}
/********************************************************************
ConfigurePerfmonUninstall - CUSTOM ACTION ENTRY POINT for uninstalling
Perfmon counters
********************************************************************/
extern "C" UINT __stdcall ConfigurePerfmonUninstall(
__in MSIHANDLE hInstall
)
{
// Assert(FALSE);
HRESULT hr;
UINT er = ERROR_SUCCESS;
PMSIHANDLE hView, hRec;
LPWSTR pwzData = NULL, pwzName = NULL, pwzFile = NULL;
INSTALLSTATE isInstalled, isAction;
hr = WcaInitialize(hInstall, "ConfigurePerfmonUninstall");
ExitOnFailure(hr, "Failed to initialize");
// check to see if necessary tables are specified
if (WcaTableExists(L"Perfmon") != S_OK)
{
WcaLog(LOGMSG_VERBOSE, "Skipping UnregisterPerfmon() because Perfmon table not present");
ExitFunction1(hr = S_FALSE);
}
hr = WcaOpenExecuteView(vcsPerfMonQuery, &hView);
ExitOnFailure(hr, "failed to open view on PerfMon table");
while ((hr = WcaFetchRecord(hView, &hRec)) == S_OK)
{
// get component install state
hr = WcaGetRecordString(hRec, pmqComponent, &pwzData);
ExitOnFailure(hr, "failed to get Component for PerfMon");
er = ::MsiGetComponentStateW(hInstall, pwzData, &isInstalled, &isAction);
hr = HRESULT_FROM_WIN32(er);
ExitOnFailure(hr, "failed to get Component state for PerfMon");
if (!WcaIsUninstalling(isInstalled, isAction))
{
continue;
}
hr = WcaGetRecordString(hRec, pmqName, &pwzName);
ExitOnFailure(hr, "failed to get Name for PerfMon");
hr = WcaGetRecordFormattedString(hRec, pmqFile, &pwzFile);
ExitOnFailure(hr, "failed to get File for PerfMon");
WcaLog(LOGMSG_VERBOSE, "ConfigurePerfmonUninstall's CustomActionData: '%S', '%S'", pwzName, pwzFile);
hr = WcaDoDeferredAction(L"UnregisterPerfmon", pwzName, COST_PERFMON_UNREGISTER);
ExitOnFailure(hr, "failed to schedule UnregisterPerfmon action");
hr = WcaDoDeferredAction(L"RollbackUnregisterPerfmon", pwzFile, COST_PERFMON_REGISTER);
ExitOnFailure(hr, "failed to schedule RollbackUnregisterPerfmon action");
}
if (hr == E_NOMOREITEMS)
{
hr = S_OK;
}
ExitOnFailure(hr, "Failure while processing PerfMon");
hr = S_OK;
LExit:
ReleaseStr(pwzData);
ReleaseStr(pwzName);
ReleaseStr(pwzFile);
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
return WcaFinalize(er);
}
static HRESULT ProcessPerformanceCategory(
__in MSIHANDLE hInstall,
__in BOOL fInstall
)
{
HRESULT hr = S_OK;
DWORD er = ERROR_SUCCESS;
PMSIHANDLE hView, hRec;
LPWSTR pwzId = NULL;
LPWSTR pwzComponent = NULL;
LPWSTR pwzName = NULL;
LPWSTR pwzData = NULL;
INSTALLSTATE isInstalled, isAction;
LPWSTR pwzCustomActionData = NULL;
// check to see if necessary tables are specified
if (S_OK != WcaTableExists(L"PerformanceCategory"))
{
ExitFunction1(hr = S_FALSE);
}
hr = WcaOpenExecuteView(vcsPerfCounterDataQuery, &hView);
ExitOnFailure(hr, "failed to open view on PerformanceCategory table");
while (S_OK == (hr = WcaFetchRecord(hView, &hRec)))
{
hr = WcaGetRecordString(hRec, pcdqId, &pwzId);
ExitOnFailure(hr, "Failed to get id for PerformanceCategory.");
// Check to see if the Component is being installed or uninstalled
// when we are processing the same.
hr = WcaGetRecordString(hRec, pcdqComponent, &pwzComponent);
ExitOnFailure1(hr, "Failed to get Component for PerformanceCategory: %S", pwzId);
er = ::MsiGetComponentStateW(hInstall, pwzComponent, &isInstalled, &isAction);
hr = HRESULT_FROM_WIN32(er);
ExitOnFailure1(hr, "Failed to get Component state for PerformanceCategory: %S", pwzId);
if ((fInstall && !WcaIsInstalling(isInstalled, isAction)) ||
(!fInstall && !WcaIsUninstalling(isInstalled, isAction)))
{
continue;
}
hr = WcaGetRecordString(hRec, pcdqName, &pwzName);
ExitOnFailure1(hr, "Failed to get Name for PerformanceCategory: %S", pwzId);
hr = WcaWriteStringToCaData(pwzName, &pwzCustomActionData);
ExitOnFailure1(hr, "Failed to add Name to CustomActionData for PerformanceCategory: %S", pwzId);
hr = WcaGetRecordString(hRec, pcdqIniData, &pwzData);
ExitOnFailure1(hr, "Failed to get IniData for PerformanceCategory: %S", pwzId);
hr = WcaWriteStringToCaData(pwzData, &pwzCustomActionData);
ExitOnFailure1(hr, "Failed to add IniData to CustomActionData for PerformanceCategory: %S", pwzId);
hr = WcaGetRecordString(hRec, pcdqConstantData, &pwzData);
ExitOnFailure1(hr, "Failed to get ConstantData for PerformanceCategory: %S", pwzId);
hr = WcaWriteStringToCaData(pwzData, &pwzCustomActionData);
ExitOnFailure1(hr, "Failed to add ConstantData to CustomActionData for PerformanceCategory: %S", pwzId);
}
if (hr == E_NOMOREITEMS)
{
hr = S_OK;
}
ExitOnFailure(hr, "Failure while processing PerformanceCategory table.");
// If there was any data built up, schedule it for execution.
if (pwzCustomActionData)
{
if (fInstall)
{
hr = WcaDoDeferredAction(L"RegisterPerfCounterData", pwzCustomActionData, COST_PERFMON_REGISTER);
ExitOnFailure1(hr, "Failed to schedule RegisterPerfCounterData action for PerformanceCategory: %S", pwzId);
hr = WcaDoDeferredAction(L"RollbackRegisterPerfCounterData", pwzCustomActionData, COST_PERFMON_UNREGISTER);
ExitOnFailure1(hr, "Failed to schedule RollbackRegisterPerfCounterData action for PerformanceCategory: %S", pwzId);
}
else
{
hr = WcaDoDeferredAction(L"UnregisterPerfCounterData", pwzCustomActionData, COST_PERFMON_UNREGISTER);
ExitOnFailure1(hr, "Failed to schedule UnregisterPerfCounterData action for PerformanceCategory: %S", pwzId);
hr = WcaDoDeferredAction(L"RollbackUnregisterPerfCounterData", pwzCustomActionData, COST_PERFMON_REGISTER);
ExitOnFailure1(hr, "Failed to schedule RollbackUnregisterPerfCounterData action for PerformanceCategory: %S", pwzId);
}
}
LExit:
ReleaseStr(pwzCustomActionData);
ReleaseStr(pwzData);
ReleaseStr(pwzName);
ReleaseStr(pwzComponent);
ReleaseStr(pwzId);
return hr;
}
Index: scasched.def
===================================================================
RCS file: /cvsroot/wix/wix/src/ca/serverca/scasched/scasched.def,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** scasched.def 3 May 2005 15:18:43 -0000 1.2
--- scasched.def 27 Jun 2007 05:35:59 -0000 1.3
***************
*** 18,26 ****
EXPORTS
! ConfigureIIs
! ConfigureSql
! ConfigurePerfmonInstall
! ConfigurePerfmonUninstall
! ConfigureSmb
! ConfigureUsers
!
--- 18,28 ----
EXPORTS
! ConfigureIIs
! InstallSqlData
! UninstallSqlData
! InstallCertificates
! UninstallCertificates
! ConfigurePerfmonInstall
! ConfigurePerfmonUninstall
! ConfigureSmb
! ConfigureUsers
Index: scaapppool.h
===================================================================
RCS file: /cvsroot/wix/wix/src/ca/serverca/scasched/scaapppool.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** scaapppool.h 19 Apr 2006 08:54:26 -0000 1.5
--- scaapppool.h 27 Jun 2007 05:35:59 -0000 1.6
***************
*** 28,55 ****
struct SCA_APPPOOL
{
! // iis app pool configuation information
! WCHAR wzAppPool[MAX_DARWIN_KEY + 1];
! WCHAR wzName[METADATA_MAX_NAME_LEN + 1];
! WCHAR wzKey[METADATA_MAX_NAME_LEN + 1];
! WCHAR wzComponent[METADATA_MAX_NAME_LEN + 1];
! BOOL fHasComponent;
! INSTALLSTATE isInstalled;
! INSTALLSTATE isAction;
! INT iAttributes;
! SCA_USER suUser;
!
! INT iRecycleRequests;
! INT iRecycleMinutes;
! WCHAR wzRecycleTimes[MAX_DARWIN_KEY + 1];
! INT iVirtualMemory;
! INT iPrivateMemory;
! INT iIdleTimeout;
! INT iQueueLimit;
! WCHAR wzCpuMon[MAX_DARWIN_KEY + 1];
! INT iMaxProcesses;
! SCA_APPPOOL *psapNext;
};
--- 28,55 ----
struct SCA_APPPOOL
{
! // iis app pool configuation information
! WCHAR wzAppPool[MAX_DARWIN_KEY + 1];
! WCHAR wzName[METADATA_MAX_NAME_LEN + 1];
! WCHAR wzKey[METADATA_MAX_NAME_LEN + 1];
! WCHAR wzComponent[METADATA_MAX_NAME_LEN + 1];
! BOOL fHasComponent;
! INSTALLSTATE isInstalled;
! INSTALLSTATE isAction;
! INT iAttributes;
! SCA_USER suUser;
! INT iRecycleRequests;
! INT iRecycleMinutes;
! WCHAR wzRecycleTimes[MAX_DARWIN_KEY + 1];
! INT iVirtualMemory;
! INT iPrivateMemory;
! INT iIdleTimeout;
! INT iQueueLimit;
! WCHAR wzCpuMon[MAX_DARWIN_KEY + 1];
! INT iMaxProcesses;
!
! SCA_APPPOOL *psapNext;
};
***************
*** 58,94 ****
HRESULT ScaAppPoolRead(
! __inout SCA_APPPOOL** ppsapList
! );
void ScaAppPoolFreeList(
! SCA_APPPOOL* psapList
! );
HRESULT ScaFindAppPool(
! __in IMSAdminBase* piMetabase,
! __in LPCWSTR wzAppPool,
! __out_ecount(cchName) LPWSTR wzName,
! __in DWORD cchName,
! __in SCA_APPPOOL *psapList
! );
HRESULT ScaAppPoolInstall(
! IMSAdminBase* piMetabase,
! SCA_APPPOOL* psapList
! );
HRESULT ScaAppPoolUninstall(
! IMSAdminBase* piMetabase,
! SCA_APPPOOL* psapList
! );
HRESULT ScaWriteAppPool(
! IMSAdminBase* piMetabase,
! SCA_APPPOOL* psap
! );
HRESULT ScaRemoveAppPool(
! IMSAdminBase* piMetabase,
! SCA_APPPOOL* psap
! );
!
--- 58,93 ----
HRESULT ScaAppPoolRead(
! __inout SCA_APPPOOL** ppsapList
! );
void ScaAppPoolFreeList(
! __in SCA_APPPOOL* psapList
! );
HRESULT ScaFindAppPool(
! __in IMSAdminBase* piMetabase,
! __in LPCWSTR wzAppPool,
! __out_ecount(cchName) LPWSTR wzName,
! __in DWORD cchName,
! __in SCA_APPPOOL *psapList
! );
HRESULT ScaAppPoolInstall(
! __in IMSAdminBase* piMetabase,
! __in SCA_APPPOOL* psapList
! );
HRESULT ScaAppPoolUninstall(
! __in IMSAdminBase* piMetabase,
! __in SCA_APPPOOL* psapList
! );
HRESULT ScaWriteAppPool(
! __in IMSAdminBase* piMetabase,
! __in SCA_APPPOOL* psap
! );
HRESULT ScaRemoveAppPool(
! __in IMSAdminBase* piMetabase,
! __in SCA_APPPOOL* psap
! );
Index: scawebappext.h
===================================================================
RCS file: /cvsroot/wix/wix/src/ca/serverca/scasched/scawebappext.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** scawebappext.h 19 Apr 2006 08:54:26 -0000 1.3
--- scawebappext.h 27 Jun 2007 05:35:59 -0000 1.4
***************
*** 21,31 ****
struct SCA_WEB_APPLICATION_EXTENSION
{
! WCHAR wzExtension[MAX_DARWIN_COLUMN + 1];
! WCHAR wzVerbs[MAX_DARWIN_COLUMN + 1];
! WCHAR wzExecutable[MAX_DARWIN_COLUMN + 1];
! int iAttributes;
! SCA_WEB_APPLICATION_EXTENSION* pswappextNext;
};
--- 21,31 ----
struct SCA_WEB_APPLICATION_EXTENSION
{
! WCHAR wzExtension[MAX_DARWIN_COLUMN + 1];
! WCHAR wzVerbs[MAX_DARWIN_COLUMN + 1];
! WCHAR wzExecutable[MAX_DARWIN_COLUMN + 1];
! int iAttributes;
! SCA_WEB_APPLICATION_EXTENSION* pswappextNext;
};
***************
*** 33,48 ****
// prototypes
HRESULT ScaWebAppExtensionsRead(
! LPCWSTR wzApplication,
! SCA_WEB_APPLICATION_EXTENSION** ppswappextList
! );
HRESULT ScaWebAppExtensionsWrite(
! IMSAdminBase* piMetabase,
! LPCWSTR wzRootOfWeb,
! SCA_WEB_APPLICATION_EXTENSION* pswappextList
! );
void ScaWebAppExtensionsFreeList(
! SCA_WEB_APPLICATION_EXTENSION* pswappextList
! );
!
--- 33,47 ----
// prototypes
HRESULT ScaWebAppExtensionsRead(
! __in LPCWSTR wzApplication,
! __inout SCA_WEB_APPLICATION_EXTENSION** ppswappextList
! );
HRESULT ScaWebAppExtensionsWrite(
! __in IMSAdminBase* piMetabase,
! __in LPCWSTR wzRootOfWeb,
! __in SCA_WEB_APPLICATION_EXTENSION* pswappextList
! );
void ScaWebAppExtensionsFreeList(
! __in SCA_WEB_APPLICATION_EXTENSION* pswappextList
! );
Index: scaweb.cpp
===================================================================
RCS file: /cvsroot/wix/wix/src/ca/serverca/scasched/scaweb.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** scaweb.cpp 29 Nov 2006 20:55:15 -0000 1.10
--- scaweb.cpp 27 Jun 2007 05:35:59 -0000 1.11
***************
*** 46,64 ****
// prototypes for private helper functions
static SCA_WEB* NewWeb();
! static SCA_WEB* AddWebToList(SCA_WEB* pswList, SCA_WEB* psw);
! static HRESULT ScaWebFindBase(__in IMSAdminBase* piMetabase, __in SCA_WEB* pswList,
! __in LPCWSTR wzWeb, __in LPCWSTR wzIP, int iPort,
! __in LPCWSTR wzHeader, __in BOOL fSecure,
! __out_ecount(*pcchWebBase) LPWSTR wzWebBase, __inout DWORD* pcchWebBase);
! static HRESULT ScaWebFindFreeBase(__in IMSAdminBase* piMetabase, __in_xcount(unknown) SCA_WEB* pswList,
! __out_ecount(cchWebBase) LPWSTR wzWebBase, __in DWORD cchWebBase);
! static HRESULT ScaWebWrite(IMSAdminBase* piMetabase, SCA_WEB* psw, SCA_APPPOOL * psapList);
! static HRESULT ScaWebRemove(IMSAdminBase* piMetabase, SCA_WEB* psw);
! static void Sort(DWORD dwArray[], int cArray);
!
! HRESULT ScaWebsRead(IMSAdminBase* piMetabase,
! SCA_WEB** ppswList, SCA_WEB_ERROR** ppsweList)
{
Assert(piMetabase && ppswList);
--- 46,90 ----
// prototypes for private helper functions
static SCA_WEB* NewWeb();
! static SCA_WEB* AddWebToList(
! __in SCA_WEB* pswList,
! __in SCA_WEB* psw
! );
! static HRESULT ScaWebFindBase(
! __in IMSAdminBase* piMetabase,
! __in SCA_WEB* pswList,
! __in LPCWSTR wzWeb,
! __in LPCWSTR wzIP,
! __in int iPort,
! __in LPCWSTR wzHeader,
! __in BOOL fSecure,
! __out_ecount(*pcchWebBase) LPWSTR wzWebBase,
! __inout DWORD* pcchWebBase
! );
! static HRESULT ScaWebFindFreeBase(
! __in IMSAdminBase* piMetabase,
! __in_xcount(unknown) SCA_WEB* pswList,
! __out_ecount(cchWebBase) LPWSTR wzWebBase,
! __in DWORD cchWebBase
! );
! static HRESULT ScaWebWrite(
! __in IMSAdminBase* piMetabase,
! __in SCA_WEB* psw,
! __in SCA_APPPOOL * psapList
! );
! static HRESULT ScaWebRemove(
! __in IMSAdminBase* piMetabase,
! __in const SCA_WEB* psw);
! static void Sort(
! __in_ecount(cArray) DWORD dwArray[],
! __in int cArray
! );
! HRESULT ScaWebsRead(
! __in IMSAdminBase* piMetabase,
! __in SCA_WEB** ppswList,
! __in SCA_HTTP_HEADER** ppshhList,
! __in SCA_WEB_ERROR** ppsweList
! )
{
Assert(piMetabase && ppswList);
***************
*** 191,195 ****
{
hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
! break;
}
--- 217,221 ----
{
hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
! ExitOnFailure(hr, "Failure to get more extra web addresses, max exceeded.");
}
***************
*** 200,222 ****
if (0 != lstrcmpW(pwzData, psw->swaKey.wzKey))
{
! StringCchCopyW(psw->swaExtra[psw->cExtraAddresses].wzKey,
! countof(psw->swaExtra[psw->cExtraAddresses].wzKey), pwzData);
hr = WcaGetRecordFormattedString(hRecAddresses, waqIP, &pwzData);
ExitOnFailure(hr, "Failed to get extra web IP");
! StringCchCopyW(psw->swaExtra[psw->cExtraAddresses].wzIP, countof(psw->swaExtra[psw->cExtraAddresses].wzIP), pwzData);
hr = WcaGetRecordFormattedString(hRecAddresses, waqPort, &pwzData);
ExitOnFailure(hr, "Failed to get port for extra web IP");
! psw->swaExtra[psw->cExtraAddresses].iPort= wcstol(pwzData, NULL, 10);
hr = WcaGetRecordFormattedString(hRecAddresses, waqHeader, &pwzData);
ExitOnFailure(hr, "Failed to get header for extra web IP");
! StringCchCopyW(psw->swaExtra[psw->cExtraAddresses].wzHeader, countof(psw->swaExtra[psw->cExtraAddresses].wzHeader), pwzData);
! hr = WcaGetRecordInteger(hRecAddresses, waqSecure, &psw->swaExtra[psw->cExtraAddresses].fSecure);
ExitOnFailure(hr, "Failed to get if secure extra web IP");
if (S_FALSE == hr)
! psw->swaExtra[psw->cExtraAddresses].fSecure = FALSE;
psw->cExtraAddresses++;
--- 226,248 ----
if (0 != lstrcmpW(pwzData, psw->swaKey.wzKey))
{
! StringCchCopyW(psw->swaExtraAddresses[psw->cExtraAddresses].wzKey,
! countof(psw->swaExtraAddresses[psw->cExtraAddresses].wzKey), pwzData);
hr = WcaGetRecordFormattedString(hRecAddresses, waqIP, &pwzData);
ExitOnFailure(hr, "Failed to get extra web IP");
! StringCchCopyW(psw->swaExtraAddresses[psw->cExtraAddresses].wzIP, countof(psw->swaExtraAddresses[psw->cExtraAddresses].wzIP), pwzData);
hr = WcaGetRecordFormattedString(hRecAddresses, waqPort, &pwzData);
ExitOnFailure(hr, "Failed to get port for extra web IP");
! psw->swaExtraAddresses[psw->cExtraAddresses].iPort= wcstol(pwzData, NULL, 10);
hr = WcaGetRecordFormattedString(hRecAddresses, waqHeader, &pwzData);
ExitOnFailure(hr, "Failed to get header for extra web IP");
! StringCchCopyW(psw->swaExtraAddresses[psw->cExtraAddresses].wzHeader, countof(psw->swaExtraAddresses[psw->cExtraAddresses].wzHeader), pwzData);
! hr = WcaGetRecordInteger(hRecAddresses, waqSecure, &psw->swaExtraAddresses[psw->cExtraAddresses].fSecure);
ExitOnFailure(hr, "Failed to get if secure extra web IP");
if (S_FALSE == hr)
! psw->swaExtraAddresses[psw->cExtraAddresses].fSecure = FALSE;
psw->cExtraAddresses++;
***************
*** 250,253 ****
--- 276,286 ----
hr = HRESULT_FROM_WIN32(er);
ExitOnFailure(hr, "Failed to get Source/TargetPath for Directory");
+
+ if (dwLen > countof(wzPath))
+ {
+ hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
+ ExitOnFailure(hr, "Failed because Source/TargetPath for Directory was greater than MAX_PATH.");
+ }
+
// remove traling backslash
if (dwLen > 0 && wzPath[dwLen-1] == L'\\')
***************
*** 284,289 ****
}
// get the errors
! if ( *ppsweList)
{
hr = ScaGetWebError(weptWeb, psw->wzKey, ppsweList, &(psw->psweList));
--- 317,333 ----
}
+ // get the SSL certificates
+ hr = ScaSslCertificateRead(psw->wzKey, &(psw->pswscList));
+ ExitOnFailure(hr, "Failed to get SSL Certificates.");
+
+ // get the custom headers
+ if (*ppshhList)
+ {
+ hr = ScaGetHttpHeader(hhptWeb, psw->wzKey, ppshhList, &(psw->pshhList));
+ ExitOnFailure(hr, "Failed to get Custom HTTP Headers");
+ }
+
// get the errors
! if (*ppsweList)
{
hr = ScaGetWebError(weptWeb, psw->wzKey, ppsweList, &(psw->psweList));
***************
*** 320,325 ****
! HRESULT ScaWebsGetBase(__in IMSAdminBase* piMetabase, __in SCA_WEB* pswList,
! __in LPCWSTR wzWeb, __out_ecount(*pcchWebBase)LPWSTR wzWebBase, __inout DWORD* pcchWebBase)
{
HRESULT hr = S_OK;
--- 364,374 ----
! HRESULT ScaWebsGetBase(
! __in IMSAdminBase* piMetabase,
! __in SCA_WEB* pswList,
! __in LPCWSTR wzWeb,
! __out_ecount(*pcchWebBase)LPWSTR wzWebBase,
! __inout DWORD* pcchWebBase
! )
{
HRESULT hr = S_OK;
***************
*** 389,393 ****
! HRESULT ScaWebsInstall(IMSAdminBase* piMetabase, SCA_WEB* pswList, SCA_APPPOOL * psapList)
{
HRESULT hr = S_OK;
--- 438,446 ----
! HRESULT ScaWebsInstall(
! __in IMSAdminBase* piMetabase,
! __in SCA_WEB* pswList,
! __in SCA_APPPOOL * psapList
! )
{
HRESULT hr = S_OK;
***************
*** 411,415 ****
! HRESULT ScaWebsUninstall(IMSAdminBase* piMetabase, SCA_WEB* pswList)
{
HRESULT hr = S_OK;
--- 464,471 ----
! HRESULT ScaWebsUninstall(
! __in IMSAdminBase* piMetabase,
! __in SCA_WEB* pswList
! )
{
HRESULT hr = S_OK;
***************
*** 433,437 ****
! void ScaWebsFreeList(SCA_WEB* pswList)
{
SCA_WEB* pswDelete = pswList;
--- 489,495 ----
! void ScaWebsFreeList(
! __in SCA_WEB* pswList
! )
{
SCA_WEB* pswDelete = pswList;
***************
*** 441,445 ****
pswList = pswList->pswNext;
! // Free the errors list first
ScaWebErrorFreeList(pswDelete->psweList);
MemFree(pswDelete);
--- 499,505 ----
pswList = pswList->pswNext;
! // Free the SSL, headers and errors list first
! ScaSslCertificateFreeList(pswDelete->pswscList);
! ScaHttpHeaderFreeList(pswDelete->pshhList);
ScaWebErrorFreeList(pswDelete->psweList);
MemFree(pswDelete);
***************
*** 458,462 ****
! static SCA_WEB* AddWebToList(SCA_WEB* pswList, SCA_WEB* psw)
{
if (pswList)
--- 518,525 ----
! static SCA_WEB* AddWebToList(
! __in SCA_WEB* pswList,
! __in SCA_WEB* psw
! )
{
if (pswList)
***************
*** 464,473 ****
--- 527,540 ----
SCA_WEB* pswTemp = pswList;
while (pswTemp->pswNext)
+ {
pswTemp = pswTemp->pswNext;
+ }
pswTemp->pswNext = psw;
}
else
+ {
pswList = psw;
+ }
return pswList;
***************
*** 475,482 ****
! static HRESULT ScaWebFindBase(__in IMSAdminBase* piMetabase, __in SCA_WEB* pswList,
! __in LPCWSTR wzWeb, __in LPCWSTR wzIP, __in int iPort,
! __in LPCWSTR wzHeader, __in BOOL fSecure,
! __out_ecount(*pcchWebBase) LPWSTR wzWebBase, __inout DWORD* pcchWebBase)
{
Assert(piMetabase && pcchWebBase);
--- 542,556 ----
! static HRESULT ScaWebFindBase(
! __in IMSAdminBase* piMetabase,
! __in SCA_WEB* pswList,
! __in LPCWSTR wzWeb,
! __in LPCWSTR wzIP,
! __in int iPort,
! __in LPCWSTR wzHeader,
! __in BOOL fSecure,
! __out_ecount(*pcchWebBase) LPWSTR wzWebBase,
! __inout DWORD* pcchWebBase
! )
{
Assert(piMetabase && pcchWebBase);
***************
*** 552,556 ****
// loop through the "web keys" looking for the "IIsWebServer" key that matches wzWeb
for (dwIndex = 0; SUCCEEDED(hr); dwIndex++)
! {
hr = piMetabase->EnumKeys(METADATA_MASTER_ROOT_HANDLE, L"/LM/W3SVC", wzSubkey, dwIndex);
if (SUCCEEDED(hr))
--- 626,630 ----
// loop through the "web keys" looking for the "IIsWebServer" key that matches wzWeb
for (dwIndex = 0; SUCCEEDED(hr); dwIndex++)
! {
hr = piMetabase->EnumKeys(METADATA_MASTER_ROOT_HANDLE, L"/LM/W3SVC", wzSubkey, dwIndex);
if (SUCCEEDED(hr))
***************
*** 580,599 ****
// break down the first address into parts
! pwzIPExists = (LPWSTR)mrAddress.pbMDData;
pwzExists = const_cast(wcsstr(pwzIPExists, L":"));
- if (!pwzExists)
- {
- // It's a malformed address, skip it and move on to the next one
- continue;
- }
*pwzExists = L'\0';
pwzPortExists = pwzExists + 1;
pwzExists = const_cast(wcsstr(pwzPortExists, L":"));
- if (!pwzExists)
- {
- // It's a malformed address, skip it and move on to the next one
- continue;
- }
*pwzExists = L'\0';
iPortExists = wcstol(pwzPortExists, NULL, 10);
--- 654,663 ----
// break down the first address into parts
! pwzIPExists = (LPCWSTR)mrAddress.pbMDData;
pwzExists = const_cast(wcsstr(pwzIPExists, L":"));
*pwzExists = L'\0';
pwzPortExists = pwzExists + 1;
pwzExists = const_cast(wcsstr(pwzPortExists, L":"));
*pwzExists = L'\0';
iPortExists = wcstol(pwzPortExists, NULL, 10);
***************
*** 619,623 ****
}
}
! }
if (E_NOMOREITEMS == hr)
--- 683,687 ----
}
}
! }
if (E_NOMOREITEMS == hr)
***************
*** 639,644 ****
! static HRESULT ScaWebFindFreeBase(__in IMSAdminBase* piMetabase, __in_xcount(unknown) SCA_WEB* pswList,
! __out_ecount(cchWebBase) LPWSTR wzWebBase, __in DWORD cchWebBase)
{
Assert(piMetabase);
--- 703,712 ----
! static HRESULT ScaWebFindFreeBase(
! __in IMSAdminBase* piMetabase,
! __in_xcount(unknown) SCA_WEB* pswList,
! __out_ecount(cchWebBase) LPWSTR wzWebBase,
! __in DWORD cchWebBase
! )
{
Assert(piMetabase);
***************
*** 648,652 ****
WCHAR wzKey[METADATA_MAX_NAME_LEN];
WCHAR wzSubkey[METADATA_MAX_NAME_LEN];
! DWORD* prgdwSubKeys;
DWORD cSubKeys = 128;
DWORD cSubKeysFilled = 0;
--- 716,720 ----
WCHAR wzKey[METADATA_MAX_NAME_LEN];
WCHAR wzSubkey[METADATA_MAX_NAME_LEN];
! DWORD* prgdwSubKeys = NULL;
DWORD cSubKeys = 128;
DWORD cSubKeysFilled = 0;
***************
*** 752,756 ****
! static HRESULT ScaWebWrite(IMSAdminBase* piMetabase, SCA_WEB* psw, SCA_APPPOOL * psapList)
{
HRESULT hr = S_OK;
--- 820,827 ----
! static HRESULT ScaWebWrite(
! __in IMSAdminBase* piMetabase,
! __in SCA_WEB* psw,
! __in SCA_APPPOOL * psapList)
{
HRESULT hr = S_OK;
***************
*** 812,823 ****
{
// set the IP address appropriately
! if (0 == lstrcmpW(psw->swaExtra[ui].wzIP, L"*"))
::ZeroMemory(wzIP, sizeof(wzIP));
else
! StringCchCopyW(wzIP, countof(wzIP), psw->swaExtra[ui].wzIP);
! StringCchPrintfW(wzBinding, countof(wzBinding), L"%s:%d:%s", wzIP,
! psw->swaExtra[ui].iPort, psw->swaExtra[ui].wzHeader);
! if (psw->swaExtra[ui].fSecure)
{
StringCchCopyW(pcchSecureNext, cchPcchSecureNext, wzBinding);
--- 883,893 ----
{
// set the IP address appropriately
! if (0 == lstrcmpW(psw->swaExtraAddresses[ui].wzIP, L"*"))
::ZeroMemory(wzIP, sizeof(wzIP));
else
! StringCchCopyW(wzIP, countof(wzIP), psw->swaExtraAddresses[ui].wzIP);
! StringCchPrintfW(wzBinding, countof(wzBinding), L"%s:%d:%s", wzIP, psw->swaExtraAddresses[ui].iPort, psw->swaExtraAddresses[ui].wzHeader);
! if (psw->swaExtraAddresses[ui].fSecure)
{
StringCchCopyW(pcchSecureNext, cchPcchSecureNext, wzBinding);
***************
*** 901,904 ****
--- 971,988 ----
}
+ // write the SSL certificate information
+ if (psw->pswscList)
+ {
+ hr = ScaSslCertificateWriteMetabase(piMetabase, psw->wzWebBase, psw->pswscList);
+ ExitOnFailure1(hr, "Failed to write SSL certificates for Web site: %S", psw->wzKey);
+ }
+
+ // write the headers
+ if (psw->pshhList)
+ {
+ hr = ScaWriteHttpHeader(piMetabase, hhptWeb, psw->wzWebBase, psw->pshhList);
+ ExitOnFailure1(hr, "Failed to write custom HTTP headers for Web site: %S", psw->wzKey);
+ }
+
// write the errors
if (psw->psweList)
***************
*** 920,924 ****
! static HRESULT ScaWebRemove(IMSAdminBase* piMetabase, SCA_WEB* psw)
{
HRESULT hr = S_OK;
--- 1004,1011 ----
! static HRESULT ScaWebRemove(
! __in IMSAdminBase* piMetabase,
! __in const SCA_WEB* psw
! )
{
HRESULT hr = S_OK;
***************
*** 934,938 ****
// insertion sort
! static void Sort(DWORD dwArray[], int cArray)
{
int i, j;
--- 1021,1028 ----
// insertion sort
! static void Sort(
! __in_ecount(cArray) DWORD dwArray[],
! __in int cArray
! )
{
int i, j;
Index: scafilter.cpp
===================================================================
RCS file: /cvsroot/wix/wix/src/ca/serverca/scasched/scafilter.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** scafilter.cpp 19 Apr 2006 08:54:26 -0000 1.3
--- scafilter.cpp 27 Jun 2007 05:35:59 -0000 1.4
***************
*** 21,34 ****
// sql queries
! LPCWSTR vcsFilterQuery = L"SELECT `Web_`, `Name`, `Component_`, `Path`, `Description`, `Flags`, `LoadOrder` "
! L"FROM `IIsFilter`";
enum eFilterQuery { fqWeb = 1, fqFilter, fqComponent , fqPath, fqDescription, fqFlags, fqLoadOrder };
// prototypes
! static HRESULT AddFilterToList(SCA_FILTER** ppsfList);
! UINT __stdcall ScaFiltersRead(IMSAdminBase* piMetabase,
! SCA_WEB* pswList, SCA_FILTER** ppsfList)
{
HRESULT hr = S_OK;
--- 21,52 ----
// sql queries
! LPCWSTR vcsFilterQuery = L"SELECT `Web_`, `Name`, `Component_`, `Path`, `Description`, `Flags`, `LoadOrder` FROM `IIsFilter` ORDER BY `Web_`";
enum eFilterQuery { fqWeb = 1, fqFilter, fqComponent , fqPath, fqDescription, fqFlags, fqLoadOrder };
// prototypes
! static HRESULT AddFilterToList(
! __in SCA_FILTER** ppsfList
! );
! static HRESULT ReadFilterLoadOrder(
! __in IMSAdminBase* piMetabase,
! __in LPCWSTR wzFilterRoot,
! __out LPWSTR *ppwzLoadOrder
! );
! static HRESULT AddFilterToLoadOrder(
! __in LPCWSTR wzFilter,
! __in int iLoadOrder,
! __inout LPWSTR *ppwzLoadOrder
! );
! static HRESULT RemoveFilterFromLoadOrder(
! __in LPCWSTR wzFilter,
! __inout LPWSTR *ppwzLoadOrder
! );
! UINT __stdcall ScaFiltersRead(
! __in IMSAdminBase* piMetabase,
! __in SCA_WEB* pswList,
! __inout SCA_FILTER** ppsfList
! )
{
HRESULT hr = S_OK;
***************
*** 111,115 ****
--- 129,135 ----
if (E_NOMOREITEMS == hr)
+ {
hr = S_OK;
+ }
ExitOnFailure(hr, "Failure while processing filters");
***************
*** 120,127 ****
! HRESULT ScaFiltersInstall(IMSAdminBase* piMetabase, SCA_FILTER* psfList)
{
HRESULT hr = S_OK;
SCA_FILTER* psf = psfList;
while (psf)
--- 140,152 ----
! HRESULT ScaFiltersInstall(
! __in IMSAdminBase* piMetabase,
! __in SCA_FILTER* psfList
! )
{
HRESULT hr = S_OK;
SCA_FILTER* psf = psfList;
+ LPCWSTR wzPreviousFilterRoot = NULL;
+ LPWSTR pwzLoadOrder = NULL;
while (psf)
***************
*** 129,132 ****
--- 154,173 ----
if (WcaIsInstalling(psf->isInstalled, psf->isAction))
{
+ if (!wzPreviousFilterRoot || CSTR_EQUAL != ::CompareStringW(LOCALE_INVARIANT, 0, wzPreviousFilterRoot, -1, psf->wzFilterRoot, -1))
+ {
+ if (pwzLoadOrder)
+ {
+ hr = ScaWriteMetabaseValue(piMetabase, wzPreviousFilterRoot, L"", MD_FILTER_LOAD_ORDER, METADATA_NO_ATTRIBUTES, IIS_MD_UT_SERVER, STRING_METADATA, (LPVOID)pwzLoadOrder);
+ ExitOnFailure(hr, "Failed to write filter load order to metabase");
+
+ ReleaseNullStr(pwzLoadOrder);
+ }
+
+ hr = ReadFilterLoadOrder(piMetabase, psf->wzFilterRoot, &pwzLoadOrder);
+ ExitOnFailure(hr, "Failed to read filter load order.");
+
+ wzPreviousFilterRoot = psf->wzFilterRoot;
+ }
+
hr = ScaCreateMetabaseKey(piMetabase, psf->wzFilterRoot, psf->wzKey);
ExitOnFailure1(hr, "Failed to create key for filter '%S'", psf->wzKey);
***************
*** 141,145 ****
// filter description
hr = ScaWriteMetabaseValue(piMetabase, psf->wzFilterRoot, psf->wzKey, MD_FILTER_DESCRIPTION, METADATA_NO_ATTRIBUTES, IIS_MD_UT_SERVER, STRING_METADATA, (LPVOID)psf->wzDescription);
! ExitOnFailure1(hr, "Failed to write Description for filter ''%S", psf->wzKey);
// filter flags
--- 182,186 ----
// filter description
hr = ScaWriteMetabaseValue(piMetabase, psf->wzFilterRoot, psf->wzKey, MD_FILTER_DESCRIPTION, METADATA_NO_ATTRIBUTES, IIS_MD_UT_SERVER, STRING_METADATA, (LPVOID)psf->wzDescription);
! ExitOnFailure1(hr, "Failed to write Description for filter '%S'", psf->wzKey);
// filter flags
***************
*** 153,158 ****
if (MSI_NULL_INTEGER != psf->iLoadOrder)
{
! hr = ScaAddFilterToLoadOrder(piMetabase, psf->wzFilterRoot, psf->wzKey, psf->iLoadOrder);
! ExitOnFailure1(hr, "Failed to add filter '%S' to load order", psf->wzKey);
}
}
--- 194,199 ----
if (MSI_NULL_INTEGER != psf->iLoadOrder)
{
! hr = AddFilterToLoadOrder(psf->wzKey, psf->iLoadOrder, &pwzLoadOrder);
! ExitOnFailure1(hr, "Failed to add filter '%S' to load order.", psf->wzKey);
}
}
***************
*** 161,173 ****
}
LExit:
return hr;
}
! HRESULT ScaFiltersUninstall(IMSAdminBase* piMetabase, SCA_FILTER* psfList)
{
HRESULT hr = S_OK;
SCA_FILTER* psf = psfList;
while (psf)
--- 202,228 ----
}
+ if (pwzLoadOrder)
+ {
+ Assert(wzPreviousFilterRoot && *wzPreviousFilterRoot);
+
+ hr = ScaWriteMetabaseValue(piMetabase, wzPreviousFilterRoot, L"", MD_FILTER_LOAD_ORDER, METADATA_NO_ATTRIBUTES, IIS_MD_UT_SERVER, STRING_METADATA, (LPVOID)pwzLoadOrder);
+ ExitOnFailure(hr, "Failed to write filter load order to metabase");
+ }
+
LExit:
+ ReleaseStr(pwzLoadOrder);
return hr;
}
! HRESULT ScaFiltersUninstall(
! __in IMSAdminBase* piMetabase,
! __in SCA_FILTER* psfList
! )
{
HRESULT hr = S_OK;
SCA_FILTER* psf = psfList;
+ LPCWSTR wzPreviousFilterRoot = NULL;
+ LPWSTR pwzLoadOrder = NULL;
while (psf)
***************
*** 175,179 ****
if (WcaIsUninstalling(psf->isInstalled, psf->isAction))
{
! hr = ScaRemoveFilterFromLoadOrder(piMetabase, psf->wzFilterRoot, psf->wzKey);
ExitOnFailure1(hr, "Failed to remove filter '%S' from load order", psf->wzKey);
--- 230,250 ----
if (WcaIsUninstalling(psf->isInstalled, psf->isAction))
{
! if (!wzPreviousFilterRoot || CSTR_EQUAL != ::CompareStringW(LOCALE_INVARIANT, 0, wzPreviousFilterRoot, -1, psf->wzFilterRoot, -1))
! {
! if (pwzLoadOrder)
! {
! hr = ScaWriteMetabaseValue(piMetabase, wzPreviousFilterRoot, L"", MD_FILTER_LOAD_ORDER, METADATA_NO_ATTRIBUTES, IIS_MD_UT_SERVER, STRING_METADATA, (LPVOID)pwzLoadOrder);
! ExitOnFailure(hr, "Failed to write filter load order to metabase");
!
! ReleaseNullStr(pwzLoadOrder);
! }
!
! hr = ReadFilterLoadOrder(piMetabase, psf->wzFilterRoot, &pwzLoadOrder);
! ExitOnFailure(hr, "Failed to read filter load order.");
!
! wzPreviousFilterRoot = psf->wzFilterRoot;
! }
!
! hr = RemoveFilterFromLoadOrder(psf->wzKey, &pwzLoadOrder);
ExitOnFailure1(hr, "Failed to remove filter '%S' from load order", psf->wzKey);
***************
*** 186,189 ****
--- 257,268 ----
}
+ if (pwzLoadOrder)
+ {
+ Assert(wzPreviousFilterRoot && *wzPreviousFilterRoot);
+
+ hr = ScaWriteMetabaseValue(piMetabase, wzPreviousFilterRoot, L"", MD_FILTER_LOAD_ORDER, METADATA_NO_ATTRIBUTES, IIS_MD_UT_SERVER, STRING_METADATA, (LPVOID)pwzLoadOrder);
+ ExitOnFailure(hr, "Failed to write filter load order to metabase");
+ }
+
LExit:
return hr;
***************
*** 191,195 ****
! void ScaFiltersFreeList(SCA_FILTER* psfList)
{
SCA_FILTER* psfDelete = psfList;
--- 270,276 ----
! void ScaFiltersFreeList(
! __in SCA_FILTER* psfList
! )
{
SCA_FILTER* psfDelete = psfList;
***************
*** 205,214 ****
// private helper functions
! static HRESULT AddFilterToList(SCA_FILTER** ppsfList)
{
HRESULT hr = S_OK;
SCA_FILTER* psf = (SCA_FILTER*)MemAlloc(sizeof(SCA_FILTER), TRUE);
ExitOnNull(psf, hr, E_OUTOFMEMORY, "failed to add filter to filter list");
!
psf->psfNext = *ppsfList;
*ppsfList = psf;
--- 286,296 ----
// private helper functions
! static HRESULT AddFilterToList(
! __inout SCA_FILTER** ppsfList)
{
HRESULT hr = S_OK;
SCA_FILTER* psf = (SCA_FILTER*)MemAlloc(sizeof(SCA_FILTER), TRUE);
ExitOnNull(psf, hr, E_OUTOFMEMORY, "failed to add filter to filter list");
!
psf->psfNext = *ppsfList;
*ppsfList = psf;
***************
*** 217,218 ****
--- 299,502 ----
return hr;
}
+
+
+ static HRESULT ReadFilterLoadOrder(
+ __in IMSAdminBase* piMetabase,
+ __in LPCWSTR wzFilterRoot,
+ __out LPWSTR *ppwzLoadOrder
+ )
+ {
+ HRESULT hr = S_OK;
+ METADATA_HANDLE mhRoot = NULL;
+
+ METADATA_RECORD mr;
+ DWORD dwRequired = 0;
+ DWORD cchData = 255;
+
+ ::ZeroMemory(&mr, sizeof(mr));
+ mr.dwMDIdentifier = MD_FILTER_LOAD_ORDER;
+ mr.dwMDAttributes = METADATA_NO_ATTRIBUTES;
+ mr.dwMDUserType = IIS_MD_UT_SERVER;
+ mr.dwMDDataType = ALL_METADATA;
+ mr.dwMDDataLen = cchData;
+ mr.pbMDData = static_cast(MemAlloc(mr.dwMDDataLen * sizeof(WCHAR), TRUE));
+ ExitOnNull(mr.pbMDData, hr, E_OUTOFMEMORY, "failed to allocate memory for MDData in metadata record");
+
+ hr = piMetabase->OpenKey(METADATA_MASTER_ROOT_HANDLE, wzFilterRoot, METADATA_PERMISSION_READ | METADATA_PERMISSION_WRITE, 10, &mhRoot);
+ for (int i = 0; i < 30 && HRESULT_FROM_WIN32(ERROR_PATH_BUSY) == hr; i++)
+ {
+ ::Sleep(1000);
+ WcaLog(LOGMSG_STANDARD, "Failed to open root key, retrying %d time(s)...", i);
+ hr = piMetabase->OpenKey(METADATA_MASTER_ROOT_HANDLE, wzFilterRoot, METADATA_PERMISSION_READ | METADATA_PERMISSION_WRITE, 10, &mhRoot);
+ }
+
+ if (SUCCEEDED(hr))
+ {
+ hr = piMetabase->GetData(mhRoot, L"", &mr, &dwRequired);
+ if (HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) == hr)
+ {
+ mr.dwMDDataLen = cchData = dwRequired;
+
+ LPVOID pv = MemReAlloc(mr.pbMDData, mr.dwMDDataLen * sizeof(WCHAR), TRUE);
+ ExitOnNull(pv, hr, E_OUTOFMEMORY, "failed to allocate memory for MDData in metadata record");
+ mr.pbMDData = static_cast(pv);
+
+ hr = piMetabase->GetData(mhRoot, L"", &mr, &dwRequired);
+ }
+ }
+
+ // The /Filters node or /Filters/FilterLoadOrder property might not exist (yet).
+ if (HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) == hr || MD_ERROR_DATA_NOT_FOUND == hr)
+ {
+ hr = S_OK;
+ }
+ ExitOnFailure(hr, "Failed to get filter load order.");
+
+ hr = StrAllocString(ppwzLoadOrder, reinterpret_cast(mr.pbMDData), 0);
+ ExitOnFailure(hr, "Failed to allocate string for filter load order.");
+
+ LExit:
+ ReleaseMem(mr.pbMDData);
+
+ if (mhRoot)
+ {
+ piMetabase->CloseKey(mhRoot);
+ }
+
+ return hr;
+ }
+
+
+ static HRESULT AddFilterToLoadOrder(
+ __in LPCWSTR wzFilter,
+ __in int iLoadOrder,
+ __inout LPWSTR *ppwzLoadOrder
+ )
+ {
+ HRESULT hr = S_OK;
+ LPCWSTR wzLoadOrder = *ppwzLoadOrder;
+ int cchFilter = lstrlenW(wzFilter);
+ LPWSTR pwzTemp = NULL;
+
+ // If the filter name ends with '\0' or ',' and
+ // the filter name begins at the beginning of the list or with ','
+ // Then we've found the exact filter by name.
+ //
+ // If the filter isn't already in the load order, add it
+ if (wzLoadOrder && *wzLoadOrder)
+ {
+ LPCWSTR pwz = wcsstr(wzLoadOrder, wzFilter);
+
+ if (NULL != pwz &&
+ (L'\0' == *(pwz + cchFilter) || L',' == *(pwz + cchFilter)) &&
+ (pwz == wzLoadOrder || L',' == *(pwz - 1)))
+ {
+ // Filter already in the load order, no work to do.
+ }
+ else
+ {
+ pwz = NULL;
+ if (0 pshhNext;
MemFree(pshhDelete);
}
}
HRESULT ScaHttpHeaderRead(
__in SCA_HTTP_HEADER** ppshhList
)
{
Assert(ppshhList);
HRESULT hr = S_OK;
UINT er = 0;
PMSIHANDLE hView, hRec;
LPWSTR pwzData = NULL;
SCA_HTTP_HEADER* pshh = NULL;
// bail quickly if the IIsHttpHeader table isn't around
if (S_OK != WcaTableExists(L"IIsHttpHeader"))
{
WcaLog(LOGMSG_VERBOSE, "Skipping ScaGetHttpHeaders() - required tables not present.");
ExitFunction1(hr = S_FALSE);
}
// loop through all the HTTP headers
hr = WcaOpenExecuteView(vcsHttpHeaderQuery, &hView);
ExitOnFailure(hr, "Failed to open view on IIsHttpHeader table");
while (S_OK == (hr = WcaFetchRecord(hView, &hRec)))
{
hr = AddHttpHeaderToList(ppshhList);
ExitOnFailure(hr, "failed to add http header to list");
pshh = *ppshhList;
hr = WcaGetRecordInteger(hRec, hhqParentType, &(pshh->iParentType));
ExitOnFailure(hr, "failed to get IIsHttpHeader.ParentType");
hr = WcaGetRecordString(hRec, hhqParentValue, &pwzData);
ExitOnFailure(hr, "Failed to get IIsHttpHeader.ParentValue");
hr = ::StringCchCopyW(pshh->wzParentValue, countof(pshh->wzParentValue), pwzData);
ExitOnFailure(hr, "Failed to copy IIsHttpHeader.ParentValue");
hr = WcaGetRecordString(hRec, hhqName, &pwzData);
ExitOnFailure(hr, "Failed to get IIsHttpHeader.Name");
hr = ::StringCchCopyW(pshh->wzName, countof(pshh->wzName), pwzData);
ExitOnFailure(hr, "Failed to copy IIsHttpHeader.Name");
hr = WcaGetRecordFormattedString(hRec, hhqValue, &pwzData);
ExitOnFailure(hr, "Failed to get IIsHttpHeader.Value");
hr = ::StringCchCopyW(pshh->wzValue, countof(pshh->wzValue), pwzData);
ExitOnFailure(hr, "Failed to copy IIsHttpHeader.Value");
hr = WcaGetRecordInteger(hRec, hhqAttributes, &(pshh->iAttributes));
ExitOnFailure(hr, "failed to get IIsHttpHeader.Attributes");
}
if (E_NOMOREITEMS == hr)
{
hr = S_OK;
}
ExitOnFailure(hr, "Failure while processing web errors");
LExit:
ReleaseNullStr(pwzData);
return hr;
}
HRESULT ScaGetHttpHeader(
__in int iParentType,
__in LPCWSTR wzParentValue,
__in SCA_HTTP_HEADER** ppshhList,
__out SCA_HTTP_HEADER** ppshhOut
)
{
HRESULT hr = S_OK;
SCA_HTTP_HEADER* pshhAdd = NULL;
SCA_HTTP_HEADER* pshhLast = NULL;
*ppshhOut = NULL;
if (!*ppshhList)
{
return hr;
}
SCA_HTTP_HEADER* pshh = *ppshhList;
while (pshh)
{
if (iParentType == pshh->iParentType && CSTR_EQUAL == ::CompareStringW(LOCALE_SYSTEM_DEFAULT, 0, wzParentValue, 0, pshh->wzParentValue, 0))
{
// Found a match, take this one out of the list and add it to the matched out list
pshhAdd = pshh;
if (pshhLast)
{
// If we're not at the beginning of the list tell the last node about it's new next (since we're taking away it's current next)
pshhLast->pshhNext = pshhAdd->pshhNext;
}
else
{
// If we are at the beginning (no pshhLast) update the beginning (since we're taking it)
*ppshhList = pshh->pshhNext;
}
pshh = pshh->pshhNext; // move on
// Add the one we've removed to the beginning of the out list
pshhAdd->pshhNext = *ppshhOut;
*ppshhOut = pshhAdd;
}
else
{
pshhLast = pshh; // remember the last we that didn't match
pshh = pshh->pshhNext; // move on
}
}
return hr;
}
HRESULT ScaWriteHttpHeader(
__in IMSAdminBase* piMetabase,
__in int iParentType,
__in LPCWSTR wzRoot,
__in SCA_HTTP_HEADER* pshhList
)
{
Assert(piMetabase && wzRoot && *wzRoot && pshhList);
HRESULT hr = S_OK;
METADATA_RECORD mr = { 0 };
DWORD cchData = 0;
LPWSTR pwzSearchKey = NULL;
LPWSTR pwz = NULL;
LPWSTR pwzHeaders = NULL;
LPWSTR pwzNewHeader = NULL;
DWORD dwFoundHeaderIndex = 0;
LPCWSTR wzFoundHeader = NULL;
BOOL fOldValueFound = FALSE;
// Check if HTTP header already exist here.
mr.dwMDIdentifier = MD_HTTP_CUSTOM;
mr.dwMDAttributes = METADATA_INHERIT;
mr.dwMDUserType = IIS_MD_UT_SERVER;
mr.dwMDDataType = ALL_METADATA;
mr.dwMDDataLen = cchData = 0;
mr.pbMDData = NULL;
hr = MetaGetValue(piMetabase, METADATA_MASTER_ROOT_HANDLE, wzRoot, &mr);
if (HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) == hr || MD_ERROR_DATA_NOT_FOUND == hr)
{
//
// If we don't have any HTTP Headers already, move up to get the parent headers.
// TODO: Make it configurable to not inherit HTTP Headers
//
hr = StrAllocConcat(&pwzSearchKey, wzRoot, 0);
ExitOnFailure1(hr, "Failed to copy root string: %S", wzRoot);
pwz = pwzSearchKey + lstrlenW(pwzSearchKey);
while (NULL == pwzHeaders)
{
// find the last slash
while (*pwz != '/' && pwz != pwzSearchKey)
{
--pwz;
}
if (pwz == pwzSearchKey)
{
break;
}
*pwz = L'\0';
// Try here. If it's not found, keep walking up the path
hr = MetaGetValue(piMetabase, METADATA_MASTER_ROOT_HANDLE, pwzSearchKey, &mr);
if (HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) == hr || MD_ERROR_DATA_NOT_FOUND == hr)
{
hr = S_FALSE;
}
ExitOnFailure1(hr, "Failed to find search for HTTP headers for web root: %S while walking up the tree", wzRoot);
if (S_OK == hr)
{
pwzHeaders = reinterpret_cast(mr.pbMDData);
break;
}
}
}
else
{
pwzHeaders = reinterpret_cast(mr.pbMDData);
}
ExitOnFailure1(hr, "Failed while searching for default HTTP headers to start with for web root: %S", wzRoot);
if (!pwzHeaders)
{
hr = StrAlloc(&pwzHeaders, 0);
ExitOnFailure(hr, "Failed to allocate empty string for headers.");
}
// Loop through the HTTP headers
for (SCA_HTTP_HEADER* pshh = pshhList; pshh; pshh = pshh->pshhNext)
{
fOldValueFound = FALSE; // assume a HTTP Header match will not be found
hr = StrAllocFormatted(&pwzNewHeader, L"%s: ", pshh->wzName);
ExitOnFailure(hr, "Failed to allocate header name");
// Try to find a matching header already in the list
do
{
hr = MultiSzFindSubstring(pwzHeaders, pwzNewHeader, &dwFoundHeaderIndex, &wzFoundHeader);
ExitOnFailure(hr, "Failed while searching for existing HTTP header.");
// If there was a substring HTTP header match, make sure the match was at the beginning
// of the string because that is the HTTP header name.
if (S_OK == hr)
{
DWORD cchMatch = lstrlenW(pwzNewHeader);
if (CSTR_EQUAL == ::CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, pwzNewHeader, cchMatch, wzFoundHeader, cchMatch))
{
fOldValueFound = TRUE;
break;
}
}
} while (hr == S_OK);
Assert(S_FALSE == hr || S_OK == hr);
// Add the value on to the header name now.
hr = StrAllocConcat(&pwzNewHeader, pshh->wzValue, 0);
ExitOnFailure(hr, "Failed to add value on to HTTP header name.");
// If we have something to replace, replace it, otherwise, put it at the beginning (order shouldn't matter)
if (fOldValueFound)
{
hr = MultiSzReplaceString(&pwzHeaders, dwFoundHeaderIndex, pwzNewHeader);
ExitOnFailure(hr, "Failed to replace old HTTP header with new HTTP header");
}
else
{
hr = MultiSzPrepend(&pwzHeaders, NULL, pwzNewHeader);
ExitOnFailure(hr, "Failed to prepend new HTTP header");
}
}
// now write the HttpCustom to the metabase
if (hhptWeb == iParentType)
{
hr = ScaWriteMetabaseValue(piMetabase, wzRoot, L"/Root", MD_HTTP_CUSTOM, METADATA_INHERIT, IIS_MD_UT_FILE, MULTISZ_METADATA, pwzHeaders);
ExitOnFailure(hr, "Failed to write HTTP Header to web site.");
}
else
{
hr = ScaWriteMetabaseValue(piMetabase, wzRoot, NULL, MD_HTTP_CUSTOM, METADATA_INHERIT, IIS_MD_UT_FILE, MULTISZ_METADATA, pwzHeaders);
ExitOnFailure(hr, "Failed to write HTTP Headers to VDir.");
}
LExit:
ReleaseNullStr(pwzNewHeader);
ReleaseNullStr(pwzHeaders);
ReleaseNullStr(pwzSearchKey);
return hr;
}
HRESULT ScaHttpHeaderCheckList(
__in SCA_HTTP_HEADER* pshhList
)
{
if (!pshhList)
{
return S_OK;
}
while (pshhList)
{
WcaLog(LOGMSG_STANDARD, "Http Header: %s for parent: %S not used!",pshhList->wzName, pshhList->wzParentValue);
pshhList = pshhList->pshhNext;
}
return E_FAIL;
}
static HRESULT AddHttpHeaderToList(
__in SCA_HTTP_HEADER** ppshhList
)
{
HRESULT hr = S_OK;
SCA_HTTP_HEADER* pshh = (SCA_HTTP_HEADER*)MemAlloc(sizeof(SCA_HTTP_HEADER), TRUE);
ExitOnNull(pshh, hr, E_OUTOFMEMORY, "failed to allocate memory for new http header list element");
pshh->pshhNext = *ppshhList;
*ppshhList = pshh;
LExit:
return hr;
}
--- NEW FILE: scacert.cpp ---
//-------------------------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// The use and distribution terms for this software are covered by the
// Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
// which can be found in the file CPL.TXT at the root of this distribution.
// By using this software in any fashion, you are agreeing to be bound by
// the terms of this license.
//
// You must not remove this notice, or any other, from this software.
//
//
//
// Certificate functions for CustomActions
//
//-------------------------------------------------------------------------------------------------
#include "precomp.h"
[...1411 lines suppressed...]
}
if (pCertCtxExisting)
{
CertFreeCertificateContext(pCertCtxExisting);
pCertCtxExisting = NULL;
}
// order is important for store
if (hCertStore)
{
CertCloseStore(hCertStore, 0);
hCertStore = NULL;
}
if (hPfxCertStore)
{
CertCloseStore(hPfxCertStore, 0);
hPfxCertStore = NULL;
}
return hr;
}
*/
Index: scawebsvcext.cpp
===================================================================
RCS file: /cvsroot/wix/wix/src/ca/serverca/scasched/scawebsvcext.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** scawebsvcext.cpp 19 Apr 2006 08:54:26 -0000 1.6
--- scawebsvcext.cpp 27 Jun 2007 05:35:59 -0000 1.7
***************
*** 27,36 ****
// prototypes for private helper functions
! static HRESULT AddWebSvcExtToList(SCA_WEBSVCEXT** ppsWseList);
! static HRESULT ScaCheckWebSvcExtValue(IMSAdminBase* piMetabase, DWORD dwMDIdentifier);
! static HRESULT ScaWebSvcExtInstall( __in LPWSTR *pwzWebSvcExtList, __in DWORD_PTR *pcchWebSvcExtList, __in SCA_WEBSVCEXT* psWseList);
! static HRESULT ScaWebSvcExtUninstall( __in LPWSTR *pwzWebSvcExtList, __in const DWORD *pcchWebSvcExtList, __in SCA_WEBSVCEXT* psWseList);
! HRESULT __stdcall ScaWebSvcExtRead(SCA_WEBSVCEXT** ppsWseList)
{
Assert(ppsWseList);
--- 27,56 ----
// prototypes for private helper functions
! static HRESULT AddWebSvcExtToList(
! __in SCA_WEBSVCEXT** ppsWseList
! );
! static HRESULT ScaCheckWebSvcExtValue(
! __in IMSAdminBase* piMetabase,
! __in DWORD dwMDIdentifier
! );
!
! static HRESULT ScaWebSvcExtInstall(
! __in LPWSTR *pwzWebSvcExtList,
! __in DWORD_PTR *pcchWebSvcExtList,
! __in SCA_WEBSVCEXT* psWseList
! );
!
! static HRESULT ScaWebSvcExtUninstall(
! __in LPWSTR *pwzWebSvcExtList,
! __in const DWORD *pcchWebSvcExtList,
! __in SCA_WEBSVCEXT* psWseList
! );
!
! // functions
!
! HRESULT __stdcall ScaWebSvcExtRead(
! __in SCA_WEBSVCEXT** ppsWseList
! )
{
Assert(ppsWseList);
***************
*** 38,45 ****
HRESULT hr = S_OK;
UINT er = ERROR_SUCCESS;
! PMSIHANDLE hView, hRec;
! SCA_WEBSVCEXT* psWebSvcExt = NULL;
!
LPWSTR pwzData = NULL;
// check to see if necessary tables are specified
--- 58,67 ----
HRESULT hr = S_OK;
UINT er = ERROR_SUCCESS;
! PMSIHANDLE hView;
! PMSIHANDLE hRec;
LPWSTR pwzData = NULL;
+ INSTALLSTATE isInstalled = INSTALLSTATE_UNKNOWN;
+ INSTALLSTATE isAction = INSTALLSTATE_UNKNOWN;
+ SCA_WEBSVCEXT* psWebSvcExt = NULL;
// check to see if necessary tables are specified
***************
*** 56,59 ****
--- 78,97 ----
while (S_OK == (hr = WcaFetchRecord(hView, &hRec)))
{
+ // Get the Component first. If the Component is not being modified during
+ // this transaction, skip processing this whole record.
+ hr = WcaGetRecordString(hRec, ldqComponent, &pwzData);
+ ExitOnFailure(hr, "Failed to get Component for WebSvcExt");
+
+ er = ::MsiGetComponentStateW(WcaGetInstallHandle(), pwzData, &isInstalled, &isAction);
+ hr = HRESULT_FROM_WIN32(er);
+ ExitOnFailure(hr, "Failed to get Component state for WebSvcExt");
+
+ if (!WcaIsInstalling(isInstalled, isAction) &&
+ !WcaIsReInstalling(isInstalled, isAction) &&
+ !WcaIsUninstalling(isInstalled, isAction))
+ {
+ continue; // skip this record.
+ }
+
hr = AddWebSvcExtToList(ppsWseList);
ExitOnFailure(hr, "failed to add element to web svc ext list");
***************
*** 62,72 ****
Assert(psWebSvcExt);
! // get component install state
! hr = WcaGetRecordString(hRec, ldqComponent, &pwzData);
! ExitOnFailure(hr, "Failed to get Component for WebSvcExt");
!
! er = ::MsiGetComponentStateW(WcaGetInstallHandle(), pwzData, &(psWebSvcExt->isInstalled), &(psWebSvcExt->isAction));
! hr = HRESULT_FROM_WIN32(er);
! ExitOnFailure(hr, "Failed to get Component state for WebSvcExt");
hr = WcaGetRecordFormattedString(hRec, ldqFile, &pwzData);
--- 100,105 ----
Assert(psWebSvcExt);
! psWebSvcExt->isInstalled = isInstalled;
! psWebSvcExt->isAction = isAction;
hr = WcaGetRecordFormattedString(hRec, ldqFile, &pwzData);
***************
*** 101,105 ****
// Commit does both install and uninstall
! HRESULT __stdcall ScaWebSvcExtCommit(IMSAdminBase* piMetabase, SCA_WEBSVCEXT* psWseList)
{
Assert(piMetabase);
--- 134,141 ----
// Commit does both install and uninstall
! HRESULT __stdcall ScaWebSvcExtCommit(
! __in IMSAdminBase* piMetabase,
! __in SCA_WEBSVCEXT* psWseList
! )
{
Assert(piMetabase);
***************
*** 128,132 ****
hr = piMetabase->GetData(METADATA_MASTER_ROOT_HANDLE, vcsWebSvcExtRoot, &mr, &cbWebSvcExtList);
! if( MD_ERROR_DATA_NOT_FOUND == hr)
{
WcaLog(LOGMSG_VERBOSE, "Skipping ScaWebSvcExtCommit() because WebSvcExtRestrictionList value is not present");
--- 164,168 ----
hr = piMetabase->GetData(METADATA_MASTER_ROOT_HANDLE, vcsWebSvcExtRoot, &mr, &cbWebSvcExtList);
! if (MD_ERROR_DATA_NOT_FOUND == hr)
{
WcaLog(LOGMSG_VERBOSE, "Skipping ScaWebSvcExtCommit() because WebSvcExtRestrictionList value is not present");
***************
*** 179,183 ****
! HRESULT __stdcall ScaWebSvcExtInstall(__in LPWSTR *ppwzWebSvcExtList, __in DWORD_PTR *pcchWebSvcExtList, __in SCA_WEBSVCEXT* psWseList)
{
Assert( ppwzWebSvcExtList && pcchWebSvcExtList && psWseList);
--- 215,223 ----
! HRESULT __stdcall ScaWebSvcExtInstall(
! __in LPWSTR *ppwzWebSvcExtList,
! __in DWORD_PTR *pcchWebSvcExtList,
! __in SCA_WEBSVCEXT* psWseList
! )
{
Assert( ppwzWebSvcExtList && pcchWebSvcExtList && psWseList);
***************
*** 199,240 ****
ExitOnFailure1(hr, "failed to search for string:%S in web service extension MULTISZ", psWseList->wzFile);
! if (S_FALSE != hr)
{
! // we found a match on the File now check for Group and Description
! LPWSTR pwzGroupAndDescription = NULL;
! hr = StrAllocFormatted(
! &pwzGroupAndDescription,
! L"%s,%s",
! psWseList->wzGroup,
! psWseList->wzDescription);
! ExitOnFailure(hr, "Failure allocating space for Group & Description string");
!
! if(NULL != wcsistr(wzFoundString, pwzGroupAndDescription))
! fAlreadyExists = TRUE;
!
! ReleaseStr(pwzGroupAndDescription);
}
! // Construct the single string in the format required for the WebSvc Ext list in metabase
! iAllow = (psWseList->iAttributes & 1);
! iUiDeletable = ((psWseList->iAttributes >> 1) & 1);
! hr = StrAllocFormatted(
! &pwzWebSvcExt,
! L"%d,%s,%d,%s,%s",
! iAllow,
! psWseList->wzFile,
! iUiDeletable,
! psWseList->wzGroup,
! psWseList->wzDescription);
! ExitOnFailure(hr, "Failure allocating space for web service extensions");
!
! // If it already exist then update it else add it
! if (fAlreadyExists)
! {
! hr =MultiSzReplaceString(ppwzWebSvcExtList, dwIndex, pwzWebSvcExt);
! ExitOnFailure2(hr, "failed to replace web service extention string: %S with %S", wzFoundString, pwzWebSvcExt);
! }
! else
{
hr = MultiSzPrepend(ppwzWebSvcExtList, pcchWebSvcExtList, pwzWebSvcExt);
ExitOnFailure1(hr, "failed to prepend web service extention string: %S", pwzWebSvcExt);
--- 239,256 ----
ExitOnFailure1(hr, "failed to search for string:%S in web service extension MULTISZ", psWseList->wzFile);
! if (S_FALSE != hr && NULL != wcsstr(wzFoundString, psWseList->wzGroup) && NULL != wcsstr(wzFoundString, psWseList->wzDescription))
{
! fAlreadyExists = TRUE;
}
! // If it doesn't already exist, add it
! if (!fAlreadyExists)
{
+ // Construct the single string in the format required for the WebSvc Ext list in metabase
+ iAllow = (psWseList->iAttributes & 1);
+ iUiDeletable = ((psWseList->iAttributes >> 1) & 1);
+ hr = StrAllocFormatted(&pwzWebSvcExt, L"%d,%s,%d,%s,%s",iAllow, psWseList->wzFile, iUiDeletable, psWseList->wzGroup, psWseList->wzDescription);
+ ExitOnFailure(hr, "Failure allocating space for web service extensions");
+
hr = MultiSzPrepend(ppwzWebSvcExtList, pcchWebSvcExtList, pwzWebSvcExt);
ExitOnFailure1(hr, "failed to prepend web service extention string: %S", pwzWebSvcExt);
***************
*** 243,252 ****
LExit:
ReleaseStr(pwzWebSvcExt);
!
return hr;
}
! HRESULT __stdcall ScaWebSvcExtUninstall( __in LPWSTR *ppwzWebSvcExtList, __in const DWORD *pcchWebSvcExtList, __in SCA_WEBSVCEXT* psWseList)
{
Assert(ppwzWebSvcExtList && *ppwzWebSvcExtList && pcchWebSvcExtList && psWseList);
--- 259,273 ----
LExit:
ReleaseStr(pwzWebSvcExt);
!
return hr;
}
! HRESULT __stdcall ScaWebSvcExtUninstall(
! __in LPWSTR *ppwzWebSvcExtList,
! __in const DWORD
! *pcchWebSvcExtList,
! __in SCA_WEBSVCEXT* psWseList
! )
{
Assert(ppwzWebSvcExtList && *ppwzWebSvcExtList && pcchWebSvcExtList && psWseList);
***************
*** 269,290 ****
LExit:
-
return hr;
}
! static HRESULT ScaCheckWebSvcExtValue(IMSAdminBase* piMetabase, DWORD dwMDIdentifier)
{
if (!piMetabase)
return E_INVALIDARG;
HRESULT hr = S_OK;
! METADATA_RECORD mr;
DWORD cch = 0;
- ::ZeroMemory(&mr, sizeof(mr));
mr.dwMDIdentifier = dwMDIdentifier;
mr.dwMDUserType = IIS_MD_UT_SERVER;
- cch = 0;
hr = piMetabase->GetData(METADATA_MASTER_ROOT_HANDLE, vcsWebSvcExtRoot, &mr, &cch);
--- 290,313 ----
LExit:
return hr;
}
! static HRESULT ScaCheckWebSvcExtValue(
! __in IMSAdminBase* piMetabase,
! __in DWORD dwMDIdentifier
! )
{
if (!piMetabase)
+ {
return E_INVALIDARG;
+ }
HRESULT hr = S_OK;
! METADATA_RECORD mr = { 0 };
DWORD cch = 0;
mr.dwMDIdentifier = dwMDIdentifier;
mr.dwMDUserType = IIS_MD_UT_SERVER;
hr = piMetabase->GetData(METADATA_MASTER_ROOT_HANDLE, vcsWebSvcExtRoot, &mr, &cch);
***************
*** 297,304 ****
hr = S_FALSE;
}
return hr;
}
! void ScaWebSvcExtFreeList(SCA_WEBSVCEXT* psWseList)
{
SCA_WEBSVCEXT* psWseDelete = psWseList;
--- 320,331 ----
hr = S_FALSE;
}
+
return hr;
}
!
! void ScaWebSvcExtFreeList(
! __in SCA_WEBSVCEXT* psWseList
! )
{
SCA_WEBSVCEXT* psWseDelete = psWseList;
***************
*** 312,324 ****
! static HRESULT AddWebSvcExtToList(SCA_WEBSVCEXT** ppsWseList)
{
HRESULT hr = S_OK;
SCA_WEBSVCEXT* psWse = (SCA_WEBSVCEXT*)MemAlloc(sizeof(SCA_WEBSVCEXT), TRUE);
ExitOnNull(psWse, hr, E_OUTOFMEMORY, "failed to allocate element for web svc ext list");
!
psWse->psWseNext = *ppsWseList;
*ppsWseList = psWse;
!
LExit:
return hr;
--- 339,354 ----
! static HRESULT AddWebSvcExtToList(
! __in SCA_WEBSVCEXT** ppsWseList
! )
{
HRESULT hr = S_OK;
+
SCA_WEBSVCEXT* psWse = (SCA_WEBSVCEXT*)MemAlloc(sizeof(SCA_WEBSVCEXT), TRUE);
ExitOnNull(psWse, hr, E_OUTOFMEMORY, "failed to allocate element for web svc ext list");
!
psWse->psWseNext = *ppsWseList;
*ppsWseList = psWse;
!
LExit:
return hr;
--- scasql.h DELETED ---
Index: scawebappext.cpp
===================================================================
RCS file: /cvsroot/wix/wix/src/ca/serverca/scasched/scawebappext.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** scawebappext.cpp 19 Apr 2006 08:54:26 -0000 1.5
--- scawebappext.cpp 27 Jun 2007 05:35:59 -0000 1.6
***************
*** 20,35 ****
// sql queries
! LPCWSTR vcsWebAppExtensionQuery = L"SELECT `Extension`, `Verbs`, `Executable`, "
! L"`Attributes` FROM `IIsWebApplicationExtension` WHERE `Application_`=?";
! enum eWebAppExtensionQuery { wappextqExtension = 1, wappextqVerbs,
! wappextqExecutable, wappextqAttributes };
// prototypes for private helper functions
static HRESULT NewAppExt(
! SCA_WEB_APPLICATION_EXTENSION** ppswappext
);
! SCA_WEB_APPLICATION_EXTENSION* AddAppExtToList(
! SCA_WEB_APPLICATION_EXTENSION* pswappextList,
! SCA_WEB_APPLICATION_EXTENSION* pswappext
);
--- 20,33 ----
// sql queries
! LPCWSTR vcsWebAppExtensionQuery = L"SELECT `Extension`, `Verbs`, `Executable`, `Attributes` FROM `IIsWebApplicationExtension` WHERE `Application_`=?";
! enum eWebAppExtensionQuery { wappextqExtension = 1, wappextqVerbs, wappextqExecutable, wappextqAttributes };
// prototypes for private helper functions
static HRESULT NewAppExt(
! __out SCA_WEB_APPLICATION_EXTENSION** ppswappext
);
! static SCA_WEB_APPLICATION_EXTENSION* AddAppExtToList(
! __in SCA_WEB_APPLICATION_EXTENSION* pswappextList,
! __in SCA_WEB_APPLICATION_EXTENSION* pswappext
);
***************
*** 37,42 ****
HRESULT ScaWebAppExtensionsRead(
! LPCWSTR wzApplication,
! SCA_WEB_APPLICATION_EXTENSION** ppswappextList
)
{
--- 35,40 ----
HRESULT ScaWebAppExtensionsRead(
! __in LPCWSTR wzApplication,
! __inout SCA_WEB_APPLICATION_EXTENSION** ppswappextList
)
{
***************
*** 98,107 ****
--- 96,109 ----
if (E_NOMOREITEMS == hr)
+ {
hr = S_OK;
+ }
LExit:
// if anything was left over after an error clean it all up
if (pswappext)
+ {
ScaWebAppExtensionsFreeList(pswappext);
+ }
ReleaseStr(pwzData);
***************
*** 112,117 ****
! HRESULT ScaWebAppExtensionsWrite(IMSAdminBase* piMetabase, LPCWSTR wzRootOfWeb,
! SCA_WEB_APPLICATION_EXTENSION* pswappextList
)
{
--- 114,121 ----
! HRESULT ScaWebAppExtensionsWrite(
! __in IMSAdminBase* piMetabase,
! __in LPCWSTR wzRootOfWeb,
! __in SCA_WEB_APPLICATION_EXTENSION* pswappextList
)
{
***************
*** 125,129 ****
--- 129,135 ----
if (!pswappextList)
+ {
ExitFunction();
+ }
::ZeroMemory(wzAppExtensions, sizeof(wzAppExtensions));
***************
*** 135,143 ****
--- 141,155 ----
{
if (0 == lstrcmpW(wzAppExtension, L"*"))
+ {
StringCchPrintfW(wzAppExtension, countof(wzAppExtension), L"*,%s,%d", pswappext->wzExecutable, pswappext->iAttributes);
+ }
else if (*pswappext->wzExtension)
+ {
StringCchPrintfW(wzAppExtension, countof(wzAppExtension), L".%s,%s,%d", pswappext->wzExtension, pswappext->wzExecutable, pswappext->iAttributes);
+ }
else // blank means "*" (all)
+ {
StringCchPrintfW(wzAppExtension, countof(wzAppExtension), L"*,%s,%d", pswappext->wzExecutable, pswappext->iAttributes);
+ }
// if verbs were specified and not the keyword "all"
***************
*** 166,170 ****
void ScaWebAppExtensionsFreeList(
! SCA_WEB_APPLICATION_EXTENSION* pswappextList
)
{
--- 178,182 ----
void ScaWebAppExtensionsFreeList(
! __in SCA_WEB_APPLICATION_EXTENSION* pswappextList
)
{
***************
*** 184,188 ****
static HRESULT NewAppExt(
! SCA_WEB_APPLICATION_EXTENSION** ppswappext
)
{
--- 196,200 ----
static HRESULT NewAppExt(
! __out SCA_WEB_APPLICATION_EXTENSION** ppswappext
)
{
***************
*** 190,194 ****
SCA_WEB_APPLICATION_EXTENSION* pswappext = (SCA_WEB_APPLICATION_EXTENSION*)MemAlloc(sizeof(SCA_WEB_APPLICATION_EXTENSION), TRUE);
ExitOnNull(pswappext, hr, E_OUTOFMEMORY, "failed to allocate memory for new web app ext element");
!
*ppswappext = pswappext;
--- 202,206 ----
SCA_WEB_APPLICATION_EXTENSION* pswappext = (SCA_WEB_APPLICATION_EXTENSION*)MemAlloc(sizeof(SCA_WEB_APPLICATION_EXTENSION), TRUE);
ExitOnNull(pswappext, hr, E_OUTOFMEMORY, "failed to allocate memory for new web app ext element");
!
*ppswappext = pswappext;
***************
*** 198,204 ****
! SCA_WEB_APPLICATION_EXTENSION* AddAppExtToList(
! SCA_WEB_APPLICATION_EXTENSION* pswappextList,
! SCA_WEB_APPLICATION_EXTENSION* pswappext
)
{
--- 210,216 ----
! static SCA_WEB_APPLICATION_EXTENSION* AddAppExtToList(
! __in SCA_WEB_APPLICATION_EXTENSION* pswappextList,
! __in SCA_WEB_APPLICATION_EXTENSION* pswappext
)
{
***************
*** 207,218 ****
SCA_WEB_APPLICATION_EXTENSION* pswappextT = pswappextList;
while (pswappextT->pswappextNext)
pswappextT = pswappextT->pswappextNext;
pswappextT->pswappextNext = pswappext;
}
else
pswappextList = pswappext;
return pswappextList;
}
-
--- 219,233 ----
SCA_WEB_APPLICATION_EXTENSION* pswappextT = pswappextList;
while (pswappextT->pswappextNext)
+ {
pswappextT = pswappextT->pswappextNext;
+ }
pswappextT->pswappextNext = pswappext;
}
else
+ {
pswappextList = pswappext;
+ }
return pswappextList;
}
--- NEW FILE: scacert.h ---
#pragma once
//-------------------------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// The use and distribution terms for this software are covered by the
// Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
// which can be found in the file CPL.TXT at the root of this distribution.
// By using this software in any fashion, you are agreeing to be bound by
// the terms of this license.
//
// You must not remove this notice, or any other, from this software.
//
//
//
// Certificate functions for CustomActions
//
//-------------------------------------------------------------------------------------------------
#define CB_CERTIFICATE_HASH 20
// Certificate.Attribute
enum SCA_CERT_ATTRIBUTES
{
SCA_CERT_ATTRIBUTE_DEFAULT = 0,
SCA_CERT_ATTRIBUTE_REQUEST = 1,
SCA_CERT_ATTRIBUTE_BINARYDATA = 2,
SCA_CERT_ATTRIBUTE_OVERWRITE = 4,
};
// Certificate.StoreLocation
enum SCA_CERTSYSTEMSTORE
{
SCA_CERTSYSTEMSTORE_CURRENTUSER = 1,
SCA_CERTSYSTEMSTORE_LOCALMACHINE = 2,
};
--- NEW FILE: scahttpheader.h ---
#pragma once
//-------------------------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// The use and distribution terms for this software are covered by the
// Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
// which can be found in the file CPL.TXT at the root of this distribution.
// By using this software in any fashion, you are agreeing to be bound by
// the terms of this license.
//
// You must not remove this notice, or any other, from this software.
//
//
//
// IIS HTTP Header functions for CustomActions
//
//-------------------------------------------------------------------------------------------------
enum eHttpHeaderParentType { hhptVDir = 1, hhptWeb };
struct SCA_HTTP_HEADER
{
int iParentType;
WCHAR wzParentValue[MAX_DARWIN_KEY + 1];
WCHAR wzName[MAX_PATH];
WCHAR wzValue[MAX_PATH];
int iAttributes;
SCA_HTTP_HEADER* pshhNext;
};
// prototypes
HRESULT ScaHttpHeaderRead(
__in SCA_HTTP_HEADER **ppshhList
);
void ScaHttpHeaderFreeList(
__in SCA_HTTP_HEADER *pshhList
);
HRESULT ScaHttpHeaderCheckList(
__in SCA_HTTP_HEADER* pshhList
);
HRESULT ScaGetHttpHeader(
__in int iParentType,
__in LPCWSTR wzParentValue,
__in SCA_HTTP_HEADER** ppshhList,
__out SCA_HTTP_HEADER** ppshhOut
);
HRESULT ScaWriteHttpHeader(
__in IMSAdminBase* piMetabase,
int iParentType,
LPCWSTR wzRoot,
SCA_HTTP_HEADER* pshhList
);
Index: scauser.h
===================================================================
RCS file: /cvsroot/wix/wix/src/ca/serverca/scasched/scauser.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** scauser.h 19 Apr 2006 08:54:26 -0000 1.4
--- scauser.h 27 Jun 2007 05:35:59 -0000 1.5
***************
*** 21,48 ****
struct SCA_GROUP
{
! WCHAR wzKey[MAX_DARWIN_KEY + 1];
! WCHAR wzComponent[MAX_DARWIN_KEY + 1];
! WCHAR wzDomain[MAX_DARWIN_COLUMN + 1];
! WCHAR wzName[MAX_DARWIN_COLUMN + 1];
! SCA_GROUP *psgNext;
};
struct SCA_USER
{
! WCHAR wzKey[MAX_DARWIN_KEY + 1];
! WCHAR wzComponent[MAX_DARWIN_KEY + 1];
! INSTALLSTATE isInstalled;
! INSTALLSTATE isAction;
! WCHAR wzDomain[MAX_DARWIN_COLUMN + 1];
! WCHAR wzName[MAX_DARWIN_COLUMN + 1];
! WCHAR wzPassword[MAX_DARWIN_COLUMN + 1];
! INT iAttributes;
! SCA_GROUP *psgGroups;
! SCA_USER *psuNext;
};
--- 21,48 ----
struct SCA_GROUP
{
! WCHAR wzKey[MAX_DARWIN_KEY + 1];
! WCHAR wzComponent[MAX_DARWIN_KEY + 1];
! WCHAR wzDomain[MAX_DARWIN_COLUMN + 1];
! WCHAR wzName[MAX_DARWIN_COLUMN + 1];
! SCA_GROUP *psgNext;
};
struct SCA_USER
{
! WCHAR wzKey[MAX_DARWIN_KEY + 1];
! WCHAR wzComponent[MAX_DARWIN_KEY + 1];
! INSTALLSTATE isInstalled;
! INSTALLSTATE isAction;
! WCHAR wzDomain[MAX_DARWIN_COLUMN + 1];
! WCHAR wzName[MAX_DARWIN_COLUMN + 1];
! WCHAR wzPassword[MAX_DARWIN_COLUMN + 1];
! INT iAttributes;
! SCA_GROUP *psgGroups;
! SCA_USER *psuNext;
};
***************
*** 50,76 ****
// prototypes
HRESULT __stdcall ScaGetUser(
! LPCWSTR wzUser,
! SCA_USER* pscau
! );
HRESULT __stdcall ScaGetGroup(
! LPCWSTR wzGroup,
! SCA_GROUP* pscag
! );
HRESULT ScaBuildDomainUserName(
! __out_ecount(cchDest) WCHAR* wzDest,
! __in int cchDest,
! __in SCA_USER* pscau
! );
void ScaUserFreeList(
! SCA_USER* psuList
! );
void ScaGroupFreeList(
! SCA_GROUP* psgList
! );
HRESULT ScaUserRead(
! SCA_USER** ppsuList
! );
HRESULT ScaUserExecute(
! SCA_USER *psuList
! );
!
--- 50,75 ----
// prototypes
HRESULT __stdcall ScaGetUser(
! __in LPCWSTR wzUser,
! __out SCA_USER* pscau
! );
HRESULT __stdcall ScaGetGroup(
! __in LPCWSTR wzGroup,
! __out SCA_GROUP* pscag
! );
HRESULT ScaBuildDomainUserName(
! __out_ecount(cchDest) WCHAR* wzDest,
! __in int cchDest,
! __in SCA_USER* pscau
! );
void ScaUserFreeList(
! __in SCA_USER* psuList
! );
void ScaGroupFreeList(
! __in SCA_GROUP* psgList
! );
HRESULT ScaUserRead(
! __inout SCA_USER** ppsuList
! );
HRESULT ScaUserExecute(
! __in SCA_USER *psuList
! );
Index: scasqlstr.h
===================================================================
RCS file: /cvsroot/wix/wix/src/ca/serverca/scasched/scasqlstr.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** scasqlstr.h 19 Apr 2006 08:54:26 -0000 1.3
--- scasqlstr.h 27 Jun 2007 05:35:59 -0000 1.4
***************
*** 23,41 ****
struct SCA_SQLSTR
{
! // darwin information
! WCHAR wzKey[MAX_DARWIN_KEY + 1];
! WCHAR wzComponent[MAX_DARWIN_KEY + 1];
! INSTALLSTATE isInstalled, isAction;
! WCHAR wzSqlDb[MAX_DARWIN_COLUMN + 1];
! BOOL fHasUser;
! SCA_USER scau;
! LPWSTR pwzSql;
! int iAttributes;
! int iSequence; //used to sequence SqlString and SqlScript tables together
! SCA_SQLSTR* psssNext;
};
--- 23,41 ----
struct SCA_SQLSTR
{
! // darwin information
! WCHAR wzKey[MAX_DARWIN_KEY + 1];
! WCHAR wzComponent[MAX_DARWIN_KEY + 1];
! INSTALLSTATE isInstalled, isAction;
! WCHAR wzSqlDb[MAX_DARWIN_COLUMN + 1];
! BOOL fHasUser;
! SCA_USER scau;
! LPWSTR pwzSql;
! int iAttributes;
! int iSequence; //used to sequence SqlString and SqlScript tables together
! SCA_SQLSTR* psssNext;
};
***************
*** 43,65 ****
// prototypes
HRESULT ScaSqlStrsRead(
! SCA_SQLSTR** ppsssList
! );
HRESULT ScaSqlStrsReadScripts(
! SCA_SQLSTR** ppsssList
! );
HRESULT ScaSqlStrsInstall(
! SCA_DB* psdList,
! SCA_SQLSTR* psssList
! );
HRESULT ScaSqlStrsUninstall(
! SCA_DB* psdList,
! SCA_SQLSTR* psssList
! );
void ScaSqlStrsFreeList(
! SCA_SQLSTR* psssList
! );
--- 43,67 ----
// prototypes
HRESULT ScaSqlStrsRead(
! __inout SCA_SQLSTR** ppsssList,
! __in SCA_ACTION saAction
! );
HRESULT ScaSqlStrsReadScripts(
! __inout SCA_SQLSTR** ppsssList,
! __in SCA_ACTION saAction
! );
HRESULT ScaSqlStrsInstall(
! __in SCA_DB* psdList,
! __in SCA_SQLSTR* psssList
! );
HRESULT ScaSqlStrsUninstall(
! __in SCA_DB* psdList,
! __in SCA_SQLSTR* psssList
! );
void ScaSqlStrsFreeList(
! __in SCA_SQLSTR* psssList
! );
Index: scaweb.h
===================================================================
RCS file: /cvsroot/wix/wix/src/ca/serverca/scasched/scaweb.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** scaweb.h 19 Apr 2006 08:54:26 -0000 1.5
--- scaweb.h 27 Jun 2007 05:35:59 -0000 1.6
***************
*** 21,97 ****
#include "scawebapp.h"
#include "scawebprop.h"
#include "scaweberr.h"
#include "scaapppool.h"
#include "scaweblog.h"
// globals
! #define MAX_COMPUTER_NAME 256
! #define MAX_DISTINGUISHED_NAME 256
! #define MAX_CERTIFICATE_AUTHORITY 256
! #define MAX_SSL_CERTIFICATE 256
! // globals
! #define MAX_ADDRESSES_PER_WEB 10
! enum SCA_WEB_ATTRIBUTES { SWATTRIB_NOCONFIGUREIFEXISTS = 2 };
// structs
struct SCA_WEB
{
! // darwin information
! WCHAR wzKey[MAX_DARWIN_KEY + 1];
! WCHAR wzComponent[MAX_DARWIN_KEY + 1];
! BOOL fHasComponent;
! INSTALLSTATE isInstalled;
! INSTALLSTATE isAction;
! // metabase information
! WCHAR wzWebBase[METADATA_MAX_NAME_LEN + 1];
! BOOL fBaseExists;
! // iis configuation information
! SCA_WEB_ADDRESS swaKey;
! DWORD cExtraAddresses;
! SCA_WEB_ADDRESS swaExtra[MAX_ADDRESSES_PER_WEB + 1];
! WCHAR wzDirectory[MAX_PATH];
! WCHAR wzDescription[MAX_DARWIN_COLUMN + 1];
! int iState;
! int iAttributes;
! BOOL fHasProperties;
! SCA_WEB_PROPERTIES swp;
! BOOL fHasApplication;
! SCA_WEB_APPLICATION swapp;
! BOOL fHasSecurity;
! WCHAR wzComputerName[MAX_COMPUTER_NAME];
! WCHAR wzDistinguishedName[MAX_DISTINGUISHED_NAME];
! WCHAR wzCertificateAuthority[MAX_CERTIFICATE_AUTHORITY];
! WCHAR wzSslCertificate[MAX_SSL_CERTIFICATE];
! int dwAccessPermissions;
! int iConnectionTimeout;
! SCA_WEB_ERROR* psweList;
! BOOL fHasLog;
! SCA_WEB_LOG swl;
! SCA_WEB* pswNext;
};
// prototypes
! HRESULT ScaWebsRead(IMSAdminBase* piMetabase,
! SCA_WEB** ppswList, SCA_WEB_ERROR** psweList);
! HRESULT ScaWebsGetBase(__in IMSAdminBase* piMetabase, __in SCA_WEB* pswList,
! __in LPCWSTR wzWeb, __out_ecount(*pcchWebBase) LPWSTR wzWebBase, __inout DWORD* pcchWebBase);
! HRESULT ScaWebsInstall(IMSAdminBase* piMetabase, SCA_WEB* pswList, SCA_APPPOOL * psapList);
! HRESULT ScaWebsUninstall(IMSAdminBase* piMetabase, SCA_WEB* pswList);
! void ScaWebsFreeList(SCA_WEB* pswHead);
--- 21,113 ----
#include "scawebapp.h"
#include "scawebprop.h"
+ #include "scahttpheader.h"
#include "scaweberr.h"
+ #include "scassl.h"
#include "scaapppool.h"
#include "scaweblog.h"
// globals
! #define MAX_ADDRESSES_PER_WEB 10
! enum SCA_WEB_ATTRIBUTES
! {
! SWATTRIB_NOCONFIGUREIFEXISTS = 2
! };
// structs
struct SCA_WEB
{
! // darwin information
! WCHAR wzKey[MAX_DARWIN_KEY + 1];
! WCHAR wzComponent[MAX_DARWIN_KEY + 1];
! BOOL fHasComponent;
! INSTALLSTATE isInstalled;
! INSTALLSTATE isAction;
! // metabase information
! WCHAR wzWebBase[METADATA_MAX_NAME_LEN + 1];
! BOOL fBaseExists;
! // iis configuation information
! SCA_WEB_ADDRESS swaKey;
! SCA_WEB_ADDRESS swaExtraAddresses[MAX_ADDRESSES_PER_WEB + 1];
! DWORD cExtraAddresses;
! WCHAR wzDirectory[MAX_PATH];
! WCHAR wzDescription[MAX_DARWIN_COLUMN + 1];
! int iState;
! int iAttributes;
! BOOL fHasProperties;
! SCA_WEB_PROPERTIES swp;
! BOOL fHasApplication;
! SCA_WEB_APPLICATION swapp;
! BOOL fHasSecurity;
! int dwAccessPermissions;
! int iConnectionTimeout;
! SCA_WEB_SSL_CERTIFICATE* pswscList;
! SCA_HTTP_HEADER* pshhList;
! SCA_WEB_ERROR* psweList;
! BOOL fHasLog;
! SCA_WEB_LOG swl;
! SCA_WEB* pswNext;
};
// prototypes
! HRESULT ScaWebsRead(
! __in IMSAdminBase* piMetabase,
! __in SCA_WEB** ppswList,
! __in SCA_HTTP_HEADER** pshhList,
! __in SCA_WEB_ERROR** psweList
! );
! HRESULT ScaWebsGetBase(
! __in IMSAdminBase* piMetabase,
! __in SCA_WEB* pswList,
! __in LPCWSTR wzWeb,
! __out_ecount(*pcchWebBase) LPWSTR wzWebBase,
! __inout DWORD* pcchWebBase
! );
! HRESULT ScaWebsInstall(
! __in IMSAdminBase* piMetabase,
! __in SCA_WEB* pswList,
! __in SCA_APPPOOL * psapList
! );
! HRESULT ScaWebsUninstall(
! __in IMSAdminBase* piMetabase,
! __in SCA_WEB* pswList
! );
! void ScaWebsFreeList(
! __in SCA_WEB* pswHead
! );
Index: scavdir.h
===================================================================
RCS file: /cvsroot/wix/wix/src/ca/serverca/scasched/scavdir.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** scavdir.h 19 Apr 2006 08:54:26 -0000 1.4
--- scavdir.h 27 Jun 2007 05:35:59 -0000 1.5
***************
*** 25,72 ****
struct SCA_VDIR
{
! // darwin information
! WCHAR wzKey[MAX_DARWIN_KEY + 1];
! WCHAR wzComponent[MAX_DARWIN_KEY + 1];
! INSTALLSTATE isInstalled;
! INSTALLSTATE isAction;
!
! // metabase information
! WCHAR wzWebKey[MAX_DARWIN_KEY + 1];
! WCHAR wzWebBase[METADATA_MAX_NAME_LEN + 1];
! WCHAR wzVDirRoot[METADATA_MAX_NAME_LEN + 1];
!
! // iis configuation information
! WCHAR wzDirectory[MAX_PATH];
! BOOL fHasProperties;
! SCA_WEB_PROPERTIES swp;
! BOOL fHasApplication;
! SCA_WEB_APPLICATION swapp;
! BOOL fHasSecurity;
! WCHAR wzDistinguishedName[MAX_DISTINGUISHED_NAME];
! WCHAR wzCertificateAuthority[MAX_CERTIFICATE_AUTHORITY];
! int dwAccessPermissions;
! // mime mappings
! SCA_MIMEMAP* psmm;
! // custom web errors
! SCA_WEB_ERROR* pswe;
! SCA_VDIR* psvdNext;
};
- HRESULT __stdcall ScaVirtualDirsRead(IMSAdminBase* piMetabase,
- SCA_WEB* pswList, SCA_VDIR** ppsvdList, SCA_MIMEMAP** ppsmmList, SCA_WEB_ERROR** ppsweList);
! HRESULT ScaVirtualDirsInstall(IMSAdminBase* piMetabase, SCA_VDIR* psvdList, SCA_APPPOOL * psapList);
! HRESULT ScaVirtualDirsUninstall(IMSAdminBase* piMetabase, SCA_VDIR* psvdList);
! void ScaVirtualDirsFreeList(SCA_VDIR* psvdList);
! HRESULT ScaVirtualDirGetAlias(__in LPCWSTR wzVirtualDir, __out LPWSTR* ppwzData);
! HRESULT ScaVirtualDirGetComponent(__in LPCWSTR wzVirtualDir, __out LPWSTR* ppwzData);
--- 25,88 ----
struct SCA_VDIR
{
! // darwin information
! WCHAR wzKey[MAX_DARWIN_KEY + 1];
! WCHAR wzComponent[MAX_DARWIN_KEY + 1];
! INSTALLSTATE isInstalled;
! INSTALLSTATE isAction;
! // metabase information
! WCHAR wzWebKey[MAX_DARWIN_KEY + 1];
! WCHAR wzWebBase[METADATA_MAX_NAME_LEN + 1];
! WCHAR wzVDirRoot[METADATA_MAX_NAME_LEN + 1];
! // iis configuation information
! WCHAR wzDirectory[MAX_PATH];
! BOOL fHasProperties;
! SCA_WEB_PROPERTIES swp;
! BOOL fHasApplication;
! SCA_WEB_APPLICATION swapp;
! SCA_MIMEMAP* psmm; // mime mappings
! SCA_HTTP_HEADER* pshh; // custom web errors
! SCA_WEB_ERROR* pswe; // custom web errors
! SCA_VDIR* psvdNext;
};
! // prototypes
! HRESULT __stdcall ScaVirtualDirsRead(
! __in IMSAdminBase* piMetabase,
! __in SCA_WEB* pswList,
! __in SCA_VDIR** ppsvdList,
! __in SCA_MIMEMAP** ppsmmList,
! __in SCA_HTTP_HEADER** ppshhList,
! __in SCA_WEB_ERROR** ppsweList
! );
! HRESULT ScaVirtualDirsInstall(
! __in IMSAdminBase* piMetabase,
! __in SCA_VDIR* psvdList,
! __in SCA_APPPOOL * psapList
! );
! HRESULT ScaVirtualDirsUninstall(
! __in IMSAdminBase* piMetabase,
! __in SCA_VDIR* psvdList
! );
! void ScaVirtualDirsFreeList(
! __in SCA_VDIR* psvdList
! );
! HRESULT ScaVirtualDirGetAlias(
! __in LPCWSTR wzVirtualDir,
! __out LPWSTR* ppwzData
! );
!
! HRESULT ScaVirtualDirGetComponent(
! __in LPCWSTR wzVirtualDir,
! __out LPWSTR* ppwzData
! );
Index: scasched.vcproj
===================================================================
RCS file: /cvsroot/wix/wix/src/ca/serverca/scasched/scasched.vcproj,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** scasched.vcproj 5 Apr 2006 07:24:26 -0000 1.2
--- scasched.vcproj 27 Jun 2007 05:35:59 -0000 1.3
***************
*** 5,9 ****
Name="scasched"
ProjectGUID="{3D3CCA65-3B74-4900-A829-7A5F6322D6AF}"
- RootNamespace="scasched"
Keyword="MakeFileProj"
>
--- 5,8 ----
***************
*** 18,83 ****
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
--- 17,37 ----
***************
*** 117,120 ****
--- 71,78 ----
+
+
***************
*** 125,128 ****
--- 83,90 ----
+
+
***************
*** 141,148 ****
--- 103,118 ----
+
+
+
+
***************
*** 206,209 ****
--- 176,271 ----
>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
wzKey, countof(psss->wzKey), pwzData);
// find the database information for this string
hr = WcaGetRecordString(hRec, ssqSqlDb, &pwzData);
ExitOnFailure1(hr, "Failed to get SqlString.SqlDb_ for SqlString '%S'", psss->wzKey);
! StringCchCopyW(psss->wzSqlDb, countof(psss->wzSqlDb), pwzData);
!
! // get component install state
! hr = WcaGetRecordString(hRec, ssqComponent, &pwzData);
! ExitOnFailure1(hr, "Failed to get SqlString.Component_ for SqlString '%S'", psss->wzKey);
! StringCchCopyW(psss->wzComponent, countof(psss->wzComponent), pwzData);
!
! er = ::MsiGetComponentStateW(WcaGetInstallHandle(), pwzData, &psss->isInstalled, &psss->isAction);
! hr = HRESULT_FROM_WIN32(er);
! ExitOnFailure1(hr, "Failed to get Component state for SqlString '%S'", psss->wzKey);
hr = WcaGetRecordInteger(hRec, ssqAttributes, &psss->iAttributes);
--- 72,109 ----
while (S_OK == (hr = WcaFetchRecord(hView, &hRec)))
{
+ INSTALLSTATE isInstalled = INSTALLSTATE_UNKNOWN;
+ INSTALLSTATE isAction = INSTALLSTATE_UNKNOWN;
+
+ hr = WcaGetRecordString(hRec, ssqComponent, &pwzComponent);
+ ExitOnFailure(hr, "Failed to get Component for SQL String.");
+
+ er = ::MsiGetComponentStateW(WcaGetInstallHandle(), pwzComponent, &isInstalled, &isAction);
+ hr = HRESULT_FROM_WIN32(er);
+ ExitOnFailure1(hr, "Failed to get state for component: %S", pwzComponent);
+
+ // If we're doing install but the Component is not being installed or we're doing
+ // uninstall but the Component is not being uninstalled, skip it.
+ if ((WcaIsInstalling(isInstalled, isAction) && SCA_ACTION_INSTALL != saAction) ||
+ (WcaIsUninstalling(isInstalled, isAction) && SCA_ACTION_UNINSTALL != saAction))
+ {
+ continue;
+ }
+
hr = NewSqlStr(&psss);
ExitOnFailure(hr, "failed to allocation new sql string element");
+ psss->isInstalled = isInstalled;
+ psss->isAction = isAction;
+
hr = WcaGetRecordString(hRec, ssqSqlString, &pwzData);
ExitOnFailure(hr, "Failed to get SqlString.String");
! hr = ::StringCchCopyW(psss->wzKey, countof(psss->wzKey), pwzData);
! ExitOnFailure1(hr, "Failed to copy SqlString.String: %S", pwzData);
// find the database information for this string
hr = WcaGetRecordString(hRec, ssqSqlDb, &pwzData);
ExitOnFailure1(hr, "Failed to get SqlString.SqlDb_ for SqlString '%S'", psss->wzKey);
! hr = ::StringCchCopyW(psss->wzSqlDb, countof(psss->wzSqlDb), pwzData);
! ExitOnFailure1(hr, "Failed to copy SqlString.SqlDb_: %S", pwzData);
hr = WcaGetRecordInteger(hRec, ssqAttributes, &psss->iAttributes);
***************
*** 108,116 ****
*ppsssList = AddSqlStrToList(*ppsssList, psss);
! psss = NULL; // set the db NULL so it doesn't accidentally get freed below
}
if (E_NOMOREITEMS == hr)
hr = S_OK;
ExitOnFailure(hr, "Failure occured while reading SqlString table");
--- 123,133 ----
*ppsssList = AddSqlStrToList(*ppsssList, psss);
! psss = NULL; // set the sss to NULL so it doesn't get freed below
}
if (E_NOMOREITEMS == hr)
+ {
hr = S_OK;
+ }
ExitOnFailure(hr, "Failure occured while reading SqlString table");
***************
*** 123,126 ****
--- 140,144 ----
ReleaseStr(pwzData);
+ ReleaseStr(pwzComponent);
return hr;
***************
*** 129,133 ****
HRESULT ScaSqlStrsReadScripts(
! __inout SCA_SQLSTR** ppsssList
)
{
--- 147,152 ----
HRESULT ScaSqlStrsReadScripts(
! __inout SCA_SQLSTR** ppsssList,
! __in SCA_ACTION saAction
)
{
***************
*** 139,142 ****
--- 158,162 ----
PMSIHANDLE hViewUser, hRecUser;
+ LPWSTR pwzComponent = NULL;
LPWSTR pwzData = NULL;
***************
*** 146,150 ****
DWORD cchScript = 0;
! WCHAR* pwzScript;
WCHAR* pwz;
DWORD cch = 0;
--- 166,171 ----
DWORD cchScript = 0;
! LPWSTR pwzScriptBuffer = NULL;
! WCHAR* pwzScript = NULL;
WCHAR* pwz;
DWORD cch = 0;
***************
*** 157,162 ****
{
WcaLog(LOGMSG_VERBOSE, "Skipping ScaSqlStrsReadScripts() - SqlScripts and/or SqlDatabase table not present");
! hr = S_FALSE;
! goto LExit;
}
--- 178,182 ----
{
WcaLog(LOGMSG_VERBOSE, "Skipping ScaSqlStrsReadScripts() - SqlScripts and/or SqlDatabase table not present");
! ExitFunction1(hr = S_FALSE);
}
***************
*** 170,192 ****
while (S_OK == (hr = WcaFetchRecord(hView, &hRec)))
{
::ZeroMemory(&sss, sizeof(sss));
hr = WcaGetRecordString(hRec, sscrqSqlScript, &pwzData);
ExitOnFailure(hr, "Failed to get SqlScript.Script");
! StringCchCopyW(sss.wzKey, countof(sss.wzKey), pwzData);
// find the database information for this string
hr = WcaGetRecordString(hRec, sscrqSqlDb, &pwzData);
ExitOnFailure1(hr, "Failed to get SqlScript.SqlDb_ for SqlScript '%S'", sss.wzKey);
! StringCchCopyW(sss.wzSqlDb, countof(sss.wzSqlDb), pwzData);
!
! // get component install state
! hr = WcaGetRecordString(hRec, sscrqComponent, &pwzData);
! ExitOnFailure1(hr, "Failed to get SqlScript.Component_ for SqlScript '%S'", sss.wzKey);
! StringCchCopyW(sss.wzComponent, countof(sss.wzComponent), pwzData);
!
! er = ::MsiGetComponentStateW(WcaGetInstallHandle(), pwzData, &sss.isInstalled, &sss.isAction);
! hr = HRESULT_FROM_WIN32(er);
! ExitOnFailure1(hr, "Failed to get Component state for SqlScript '%S'", sss.wzKey);
hr = WcaGetRecordInteger(hRec, sscrqAttributes, &sss.iAttributes);
--- 190,226 ----
while (S_OK == (hr = WcaFetchRecord(hView, &hRec)))
{
+ INSTALLSTATE isInstalled = INSTALLSTATE_UNKNOWN;
+ INSTALLSTATE isAction = INSTALLSTATE_UNKNOWN;
+
+ hr = WcaGetRecordString(hRec, sscrqComponent, &pwzComponent);
+ ExitOnFailure(hr, "Failed to get Component for SQL Script.");
+
+ er = ::MsiGetComponentStateW(WcaGetInstallHandle(), pwzComponent, &isInstalled, &isAction);
+ hr = HRESULT_FROM_WIN32(er);
+ ExitOnFailure1(hr, "Failed to get state for component: %S", pwzComponent);
+
+ // If we're doing install but the Component is not being installed or we're doing
+ // uninstall but the Component is not being uninstalled, skip it.
+ if ((WcaIsInstalling(isInstalled, isAction) && SCA_ACTION_INSTALL != saAction) ||
+ (WcaIsUninstalling(isInstalled, isAction) && SCA_ACTION_UNINSTALL != saAction))
+ {
+ continue;
+ }
+
::ZeroMemory(&sss, sizeof(sss));
+ sss.isInstalled = isInstalled;
+ sss.isAction = isAction;
+
hr = WcaGetRecordString(hRec, sscrqSqlScript, &pwzData);
ExitOnFailure(hr, "Failed to get SqlScript.Script");
! hr = ::StringCchCopyW(sss.wzKey, countof(sss.wzKey), pwzData);
! ExitOnFailure1(hr, "Failed to copy SqlScript.Script: %S", pwzData);
// find the database information for this string
hr = WcaGetRecordString(hRec, sscrqSqlDb, &pwzData);
ExitOnFailure1(hr, "Failed to get SqlScript.SqlDb_ for SqlScript '%S'", sss.wzKey);
! hr = ::StringCchCopyW(sss.wzSqlDb, countof(sss.wzSqlDb), pwzData);
! ExitOnFailure1(hr, "Failed to copy SqlScritp.SqlDbb: %S", pwzData);
hr = WcaGetRecordInteger(hRec, sscrqAttributes, &sss.iAttributes);
***************
*** 227,231 ****
cchScript = (cbScript / sizeof(WCHAR)) - 1;
! hr = StrAllocString(&pwzScript, reinterpret_cast(pbScript) + 1, cchScript);
ExitOnFailure1(hr, "Failed to allocate WCHAR string of size '%d'", cchScript);
}
--- 261,265 ----
cchScript = (cbScript / sizeof(WCHAR)) - 1;
! hr = StrAllocString(&pwzScriptBuffer, reinterpret_cast(pbScript) + 1, cchScript);
ExitOnFailure1(hr, "Failed to allocate WCHAR string of size '%d'", cchScript);
}
***************
*** 235,239 ****
cchScript = cbScript;
! hr = StrAllocStringAnsi(&pwzScript, reinterpret_cast(pbScript), cchScript, CP_ACP);
ExitOnFailure1(hr, "Failed to allocate WCHAR string of size '%d'", cchScript);
}
--- 269,273 ----
cchScript = cbScript;
! hr = StrAllocStringAnsi(&pwzScriptBuffer, reinterpret_cast(pbScript), cchScript, CP_ACP);
ExitOnFailure1(hr, "Failed to allocate WCHAR string of size '%d'", cchScript);
}
***************
*** 247,250 ****
--- 281,285 ----
// Process the SQL script stripping out unnecessary stuff (like comments) and looking for "GO" statements.
+ pwzScript = pwzScriptBuffer;
while (cchScript && pwzScript && *pwzScript)
{
***************
*** 466,470 ****
--- 501,507 ----
}
+ ReleaseStr(pwzScriptBuffer);
ReleaseStr(pwzData);
+ ReleaseStr(pwzComponent);
return hr;
Index: scauser.cpp
===================================================================
RCS file: /cvsroot/wix/wix/src/ca/serverca/scasched/scauser.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** scauser.cpp 19 Apr 2006 08:54:26 -0000 1.4
--- scauser.cpp 27 Jun 2007 05:35:59 -0000 1.5
***************
*** 19,52 ****
#include "precomp.h"
! LPCWSTR vcsUserQuery = L"SELECT `User`, `Component_`, `Name`, `Domain`, `Password`"
! L"FROM `User` WHERE `User`=?";
enum eUserQuery { vuqUser = 1, vuqComponent, vuqName, vuqDomain, vuqPassword };
! LPCWSTR vcsGroupQuery = L"SELECT `Group`, `Component_`, `Name`, `Domain`"
! L"FROM `Group` WHERE `Group`=?";
enum eGroupQuery { vgqGroup = 1, vgqComponent, vgqName, vgqDomain };
! LPCWSTR vcsUserGroupQuery = L"SELECT `User_`, `Group_`"
! L"FROM `UserGroup` WHERE `User_`=?";
enum eUserGroupQuery { vugqUser = 1, vugqGroup };
! LPCWSTR vActionableQuery = L"SELECT `User`,`Component_`,`Name`,`Domain`,`Password`,`Attributes` "
! L"FROM `User` WHERE `Component_` IS NOT NULL";
enum eActionableQuery { vaqUser = 1, vaqComponent, vaqName, vaqDomain, vaqPassword, vaqAttributes };
static HRESULT AddUserToList(
! SCA_USER** ppsuList
);
static HRESULT AddGroupToList(
! SCA_GROUP** ppsgList
);
! HRESULT __stdcall ScaGetUser(LPCWSTR wzUser, SCA_USER* pscau)
{
if (!wzUser || !pscau)
return E_INVALIDARG;
HRESULT hr = S_OK;
--- 19,53 ----
#include "precomp.h"
! LPCWSTR vcsUserQuery = L"SELECT `User`, `Component_`, `Name`, `Domain`, `Password` FROM `User` WHERE `User`=?";
enum eUserQuery { vuqUser = 1, vuqComponent, vuqName, vuqDomain, vuqPassword };
! LPCWSTR vcsGroupQuery = L"SELECT `Group`, `Component_`, `Name`, `Domain` FROM `Group` WHERE `Group`=?";
enum eGroupQuery { vgqGroup = 1, vgqComponent, vgqName, vgqDomain };
! LPCWSTR vcsUserGroupQuery = L"SELECT `User_`, `Group_` FROM `UserGroup` WHERE `User_`=?";
enum eUserGroupQuery { vugqUser = 1, vugqGroup };
! LPCWSTR vActionableQuery = L"SELECT `User`,`Component_`,`Name`,`Domain`,`Password`,`Attributes` FROM `User` WHERE `Component_` IS NOT NULL";
enum eActionableQuery { vaqUser = 1, vaqComponent, vaqName, vaqDomain, vaqPassword, vaqAttributes };
static HRESULT AddUserToList(
! __inout SCA_USER** ppsuList
);
static HRESULT AddGroupToList(
! __inout SCA_GROUP** ppsgList
);
! HRESULT __stdcall ScaGetUser(
! __in LPCWSTR wzUser,
! __out SCA_USER* pscau
! )
{
if (!wzUser || !pscau)
+ {
return E_INVALIDARG;
+ }
HRESULT hr = S_OK;
***************
*** 59,64 ****
if (!*wzUser)
{
! hr = S_OK;
! goto LExit;
}
--- 60,64 ----
if (!*wzUser)
{
! ExitFunction1(hr = S_OK);
}
***************
*** 111,120 ****
HRESULT __stdcall ScaGetGroup(
! LPCWSTR wzGroup,
! SCA_GROUP* pscag
)
{
if (!wzGroup || !pscag)
return E_INVALIDARG;
HRESULT hr = S_OK;
--- 111,122 ----
HRESULT __stdcall ScaGetGroup(
! __in LPCWSTR wzGroup,
! __out SCA_GROUP* pscag
)
{
if (!wzGroup || !pscag)
+ {
return E_INVALIDARG;
+ }
HRESULT hr = S_OK;
***************
*** 137,153 ****
hr = WcaGetRecordString(hRec, vgqGroup, &pwzData);
ExitOnFailure(hr, "Failed to get Group.Group");
! StringCchCopyW(pscag->wzKey, countof(pscag->wzKey), pwzData);
hr = WcaGetRecordString(hRec, vgqComponent, &pwzData);
ExitOnFailure(hr, "Failed to get Group.Component_");
! StringCchCopyW(pscag->wzComponent, countof(pscag->wzComponent), pwzData);
hr = WcaGetRecordFormattedString(hRec, vgqName, &pwzData);
ExitOnFailure(hr, "Failed to get Group.Name");
! StringCchCopyW(pscag->wzName, countof(pscag->wzName), pwzData);
hr = WcaGetRecordFormattedString(hRec, vgqDomain, &pwzData);
ExitOnFailure(hr, "Failed to get Group.Domain");
! StringCchCopyW(pscag->wzDomain, countof(pscag->wzDomain), pwzData);
}
else if (E_NOMOREITEMS == hr)
--- 139,159 ----
hr = WcaGetRecordString(hRec, vgqGroup, &pwzData);
ExitOnFailure(hr, "Failed to get Group.Group");
! hr = ::StringCchCopyW(pscag->wzKey, countof(pscag->wzKey), pwzData);
! ExitOnFailure(hr, "Failed to copy Group.Group.");
hr = WcaGetRecordString(hRec, vgqComponent, &pwzData);
ExitOnFailure(hr, "Failed to get Group.Component_");
! hr = ::StringCchCopyW(pscag->wzComponent, countof(pscag->wzComponent), pwzData);
! ExitOnFailure(hr, "Failed to copy Group.Component_.");
hr = WcaGetRecordFormattedString(hRec, vgqName, &pwzData);
ExitOnFailure(hr, "Failed to get Group.Name");
! hr = ::StringCchCopyW(pscag->wzName, countof(pscag->wzName), pwzData);
! ExitOnFailure(hr, "Failed to copy Group.Name.");
hr = WcaGetRecordFormattedString(hRec, vgqDomain, &pwzData);
ExitOnFailure(hr, "Failed to get Group.Domain");
! hr = ::StringCchCopyW(pscag->wzDomain, countof(pscag->wzDomain), pwzData);
! ExitOnFailure(hr, "Failed to copy Group.Domain.");
}
else if (E_NOMOREITEMS == hr)
***************
*** 157,161 ****
--- 163,169 ----
}
else
+ {
ExitOnFailure(hr, "Error or found multiple matching Group rows");
+ }
LExit:
***************
*** 166,177 ****
! HRESULT ScaBuildDomainUserName(__out_ecount(cchDest) WCHAR* wzDest, __in int cchDest, __in SCA_USER* pscau)
{
if (wzDest == NULL || cchDest == 0 || pscau == NULL)
return E_INVALIDARG;
// error if there is no user name
if (pscau->wzName[0] == NULL)
return E_INVALIDARG;
HRESULT hr = S_OK;
--- 174,193 ----
! HRESULT ScaBuildDomainUserName(
! __out_ecount(cchDest) WCHAR* wzDest,
! __in int cchDest,
! __in SCA_USER* pscau
! )
{
if (wzDest == NULL || cchDest == 0 || pscau == NULL)
+ {
return E_INVALIDARG;
+ }
// error if there is no user name
if (pscau->wzName[0] == NULL)
+ {
return E_INVALIDARG;
+ }
HRESULT hr = S_OK;
***************
*** 182,198 ****
if( cchLeft > MAX_DARWIN_COLUMN + 1 )
cchLeft = MAX_DARWIN_COLUMN + 1;
cch = lstrlenW(pscau->wzDomain);
if (cch >= cchLeft)
{
! hr = ERROR_MORE_DATA;
! goto LExit;
}
else if (cch > 0)
{
! // handle the domain case
!
! StringCchCopyNW(pwz, cchWz, pscau->wzDomain, cchLeft-1);//last parameter does not include '\0'
cchLeft -= cch;
--- 198,216 ----
if( cchLeft > MAX_DARWIN_COLUMN + 1 )
+ {
cchLeft = MAX_DARWIN_COLUMN + 1;
+ }
cch = lstrlenW(pscau->wzDomain);
if (cch >= cchLeft)
{
! ExitFunction1(hr = ERROR_MORE_DATA);
}
else if (cch > 0)
{
! // handle the domain case
!
! hr = ::StringCchCopyNW(pwz, cchWz, pscau->wzDomain, cchLeft - 1); //last parameter does not include '\0'
! ExitOnFailure(hr, "Failed to copy Domain onto string.");
cchLeft -= cch;
***************
*** 203,213 ****
if (1 >= cchLeft)
{
! hr = ERROR_MORE_DATA;
! goto LExit;
}
! StringCchCopyNW(pwz, cchWz, L"\\", cchLeft-1);//last parameter does not include '\0'
! cchLeft--;
! ++pwz; --cchWz;
}
--- 221,233 ----
if (1 >= cchLeft)
{
! ExitFunction1(hr = ERROR_MORE_DATA);
}
! hr = ::StringCchCopyNW(pwz, cchWz, L"\\", cchLeft - 1); //last parameter does not include '\0'
! ExitOnFailure(hr, "Failed to copy backslash onto string.");
!
! --cchLeft;
! ++pwz;
! --cchWz;
}
***************
*** 215,223 ****
if (cch >= cchLeft)
{
! hr = ERROR_MORE_DATA;
! goto LExit;
}
! StringCchCopyNW(pwz, cchWz, pscau->wzName, cchLeft-1);//last parameter does not include '\0'
LExit:
--- 235,243 ----
if (cch >= cchLeft)
{
! ExitFunction1(hr = ERROR_MORE_DATA);
}
! hr = ::StringCchCopyNW(pwz, cchWz, pscau->wzName, cchLeft - 1);//last parameter does not include '\0'
! ExitOnFailure(hr, "Failed to copy User name onto string.");
LExit:
***************
*** 227,231 ****
void ScaUserFreeList(
! SCA_USER* psuList
)
{
--- 247,251 ----
void ScaUserFreeList(
! __in SCA_USER* psuList
)
{
***************
*** 243,247 ****
void ScaGroupFreeList(
! SCA_GROUP* psgList
)
{
--- 263,267 ----
void ScaGroupFreeList(
! __in SCA_GROUP* psgList
)
{
***************
*** 258,262 ****
HRESULT ScaUserRead(
! SCA_USER** ppsuList
)
{
--- 278,282 ----
HRESULT ScaUserRead(
! __out SCA_USER** ppsuList
)
{
***************
*** 364,375 ****
--- 384,401 ----
ExitOnFailure1(hr, "failed to get information for group: %S", pwzData);
}
+
if (E_NOMOREITEMS == hr)
+ {
hr = S_OK;
+ }
ExitOnFailure(hr, "failed to enumerate selected rows from UserGroup table");
}
}
}
+
if (E_NOMOREITEMS == hr)
+ {
hr = S_OK;
+ }
ExitOnFailure(hr, "failed to enumerate selected rows from User table");
***************
*** 382,460 ****
/* ****************************************************************
! ScaUserExecute - Schedules user account creation or removal based on
! component state.
! ******************************************************************/
! HRESULT ScaUserExecute(
! SCA_USER *psuList
)
{
HRESULT hr = S_OK;
! UINT er = 0;
- SCA_USER *psu = NULL;
- LPWSTR pwzActionData = NULL;
USER_INFO_0 *pUserInfo = NULL;
! for (psu = psuList; psu; psu = psu->psuNext)
{
! if (WcaIsInstalling(psu->isInstalled, psu->isAction))
{
! // MMode reinstalls will fail without this
! if (psu->isInstalled == INSTALLSTATE_LOCAL)
! psu->iAttributes &= ~SCAU_FAIL_IF_EXISTS; // clear the fail if exists bit if it has been set
! // check to see if we should fail if user exists, if so check before scheduling
! if((SCAU_FAIL_IF_EXISTS & (psu->iAttributes)) && !(SCAU_UPDATE_IF_EXISTS & (psu->iAttributes)))
{
! er = ::NetApiBufferAllocate(sizeof(USER_INFO_0), (LPVOID*)&pUserInfo);
! if(NERR_Success == er)
{
! er = ::NetUserGetInfo(psu->wzDomain, psu->wzName, 0, (LPBYTE*)pUserInfo);
!
! // if user exists then fail install
! if(NERR_Success == er)
! {
! er = NERR_UserExists;
! MessageExitOnFailure1(hr = HRESULT_FROM_WIN32(er), msierrUSRFailedUserCreateExists, "failed to create user: %S due to user already exists", psu->wzName);
! }
! else if(NERR_UserNotFound == er) // clear error if User not found
! {
! er = NERR_Success;
! }
! er = ::NetApiBufferFree((LPVOID)pUserInfo);
! pUserInfo = NULL;
}
- ExitOnFailure1(hr = HRESULT_FROM_WIN32(er), "failed user existence check on user: %S", psu->wzName);
}
//
! // Schedule the rollback first
//
! Assert(psu->wzName && *psu->wzName);
! hr = WcaWriteStringToCaData(psu->wzName, &pwzActionData);
! ExitOnFailure1(hr, "failed to add user name to custom action data: %S", psu->wzName);
! hr = WcaWriteStringToCaData(psu->wzDomain, &pwzActionData);
! ExitOnFailure1(hr, "failed to add user domain to custom action data: %S", psu->wzDomain);
!
! //Should not remove user on roll back if user would not be created
! //during the install as this could lead to the removal of a pre-existing user.
! if (!(psu->iAttributes & SCAU_DONT_CREATE_USER))
{
! // All you need for deletion is the domain and user names
hr = WcaDoDeferredAction(L"CreateUserRollback", pwzActionData, COST_USER_DELETE);
! ExitOnFailure(hr, "failed to schedule RemoveUser");
}
//
! // Schedule the creation now
//
hr = WcaWriteStringToCaData(psu->wzPassword, &pwzActionData);
ExitOnFailure1(hr, "failed to add user password to custom action data for user: %S", psu->wzKey);
- hr = WcaWriteIntegerToCaData(psu->iAttributes, &pwzActionData);
- ExitOnFailure1(hr, "failed to add user attributes to custom action data for user: %S", psu->wzKey);
-
for (SCA_GROUP* psg = psu->psgGroups; psg; psg = psg->psgNext)
{
--- 408,509 ----
/* ****************************************************************
! ScaUserExecute - Schedules user account creation or removal based on
! component state.
! ******************************************************************/
! HRESULT ScaUserExecute(
! __in SCA_USER *psuList
)
{
HRESULT hr = S_OK;
! DWORD er = 0;
! PDOMAIN_CONTROLLER_INFOW pDomainControllerInfo = NULL;
USER_INFO_0 *pUserInfo = NULL;
+ LPWSTR pwzActionData = NULL;
! for (SCA_USER *psu = psuList; psu; psu = psu->psuNext)
{
! BOOL fUserExists = FALSE;
!
! // Always put the User Name and Domain plus Attributes on the front of the CustomAction
! // data. Sometimes we'll add more data.
! Assert(psu->wzName && *psu->wzName);
! hr = WcaWriteStringToCaData(psu->wzName, &pwzActionData);
! ExitOnFailure1(hr, "Failed to add user name to custom action data: %S", psu->wzName);
! hr = WcaWriteStringToCaData(psu->wzDomain, &pwzActionData);
! ExitOnFailure1(hr, "Failed to add user domain to custom action data: %S", psu->wzDomain);
! hr = WcaWriteIntegerToCaData(psu->iAttributes, &pwzActionData);
! ExitOnFailure1(hr, "failed to add user attributes to custom action data for user: %S", psu->wzKey);
!
! // Check to see if the user already exists since we have to be very careful when adding
! // and removing users. Note: MSDN says that it is safe to call these APIs from any
! // user, so we should be safe calling it during immediate mode.
! er = ::NetApiBufferAllocate(sizeof(USER_INFO_0), (LPVOID*)&pUserInfo);
! hr = HRESULT_FROM_WIN32(er);
! ExitOnFailure1(hr, "Failed to allocate memory to check existence of user: %S", psu->wzName);
!
! LPCWSTR wzDomain = psu->wzDomain;
! if (wzDomain && *wzDomain)
{
! er = ::DsGetDcNameW(NULL, wzDomain, NULL, NULL, NULL, &pDomainControllerInfo);
! if (ERROR_SUCCESS == er)
! {
! wzDomain = pDomainControllerInfo->DomainControllerName + 2; //Add 2 so that we don't get the \\ prefix
! }
! }
! er = ::NetUserGetInfo(wzDomain, psu->wzName, 0, (LPBYTE*)pUserInfo);
! if (NERR_Success == er)
! {
! fUserExists = TRUE;
! }
! else if (NERR_UserNotFound == er)
! {
! fUserExists = FALSE;
! }
! else
! {
! hr = HRESULT_FROM_WIN32(er);
! ExitOnFailure2(hr, "Failed to check existence of domain: %S, user: %S", wzDomain, psu->wzName);
! }
!
! if (WcaIsInstalling(psu->isInstalled, psu->isAction))
! {
! // If the user exists, check to see if we are supposed to fail if user the exists before
! // the install.
! if(fUserExists)
{
! // Reinstalls will always fail if we don't remove the check for "fail if exists".
! if (psu->isInstalled == INSTALLSTATE_LOCAL)
{
! psu->iAttributes &= ~SCAU_FAIL_IF_EXISTS;
! }
! if ((SCAU_FAIL_IF_EXISTS & (psu->iAttributes)) && !(SCAU_UPDATE_IF_EXISTS & (psu->iAttributes)))
! {
! hr = HRESULT_FROM_WIN32(NERR_UserExists);
! MessageExitOnFailure1(hr, msierrUSRFailedUserCreateExists, "Failed to create user: %S becuase user already exists.", psu->wzName);
}
}
//
! // Schedule the rollback first if the user does not already exist (we wouldn't
! // want to accidentally remove a pre-existing user during rollback) or if we
! // are just going to modify the user (such as adding LogonAsService right).
//
! if (!fUserExists || psu->iAttributes & SCAU_DONT_CREATE_USER)
{
! // All you need for deletion is the domain and user names.
hr = WcaDoDeferredAction(L"CreateUserRollback", pwzActionData, COST_USER_DELETE);
! ExitOnFailure(hr, "failed to schedule CreateUserRollback");
}
//
! // Schedule the creation now.
//
hr = WcaWriteStringToCaData(psu->wzPassword, &pwzActionData);
ExitOnFailure1(hr, "failed to add user password to custom action data for user: %S", psu->wzKey);
for (SCA_GROUP* psg = psu->psgGroups; psg; psg = psg->psgNext)
{
***************
*** 468,500 ****
ExitOnFailure(hr, "failed to schedule CreateUser");
}
! else if (WcaIsUninstalling(psu->isInstalled, psu->isAction) &&
! !((psu->iAttributes & SCAU_DONT_REMOVE_ON_UNINSTALL) || (psu->iAttributes & SCAU_DONT_CREATE_USER)))
{
//
! // Schedule the removal
//
! Assert(psu->wzName && *psu->wzName);
! hr = WcaWriteStringToCaData(psu->wzName, &pwzActionData);
! ExitOnFailure1(hr, "failed to add user name to custom action data: %S", psu->wzName);
! hr = WcaWriteStringToCaData(psu->wzDomain, &pwzActionData);
! ExitOnFailure1(hr, "failed to add user domain to custom action data: %S", psu->wzDomain);
!
hr = WcaDoDeferredAction(L"RemoveUser", pwzActionData, COST_USER_DELETE);
ExitOnFailure(hr, "failed to schedule RemoveUser");
-
- // Can't really roll this back which is why RemoveUser should be a deferred commit action
}
! if (pwzActionData)
{
! ReleaseNullStr(pwzActionData);
}
}
LExit:
- if (pUserInfo)
- ::NetApiBufferFree((LPVOID)pUserInfo);
-
ReleaseStr(pwzActionData);
return hr;
--- 517,555 ----
ExitOnFailure(hr, "failed to schedule CreateUser");
}
! else if (fUserExists && WcaIsUninstalling(psu->isInstalled, psu->isAction) && !(psu->iAttributes & SCAU_DONT_REMOVE_ON_UNINSTALL))
{
//
! // Schedule the removal because the user exists and we don't have any flags set
! // that say, don't remove the user on uninstall.
//
! // Note: We can't rollback the removal of a user which is why RemoveUser is a commit
! // CustomAction.
hr = WcaDoDeferredAction(L"RemoveUser", pwzActionData, COST_USER_DELETE);
ExitOnFailure(hr, "failed to schedule RemoveUser");
}
! ReleaseNullStr(pwzActionData);
! if (pUserInfo)
{
! ::NetApiBufferFree(static_cast(pUserInfo));
! pUserInfo = NULL;
! }
! if (pDomainControllerInfo)
! {
! ::NetApiBufferFree(static_cast(pDomainControllerInfo));
! pDomainControllerInfo = NULL;
}
}
LExit:
ReleaseStr(pwzActionData);
+ if (pUserInfo)
+ {
+ ::NetApiBufferFree(static_cast(pUserInfo));
+ }
+ if (pDomainControllerInfo)
+ {
+ ::NetApiBufferFree(static_cast(pDomainControllerInfo));
+ }
return hr;
***************
*** 503,507 ****
static HRESULT AddUserToList(
! SCA_USER** ppsuList
)
{
--- 558,562 ----
static HRESULT AddUserToList(
! __inout SCA_USER** ppsuList
)
{
***************
*** 509,513 ****
SCA_USER* psu = (SCA_USER*)MemAlloc(sizeof(SCA_USER), TRUE);
ExitOnNull(psu, hr, E_OUTOFMEMORY, "failed to allocate memory for new user list element");
!
psu->psuNext = *ppsuList;
*ppsuList = psu;
--- 564,568 ----
SCA_USER* psu = (SCA_USER*)MemAlloc(sizeof(SCA_USER), TRUE);
ExitOnNull(psu, hr, E_OUTOFMEMORY, "failed to allocate memory for new user list element");
!
psu->psuNext = *ppsuList;
*ppsuList = psu;
***************
*** 519,523 ****
static HRESULT AddGroupToList(
! SCA_GROUP** ppsgList
)
{
--- 574,578 ----
static HRESULT AddGroupToList(
! __inout SCA_GROUP** ppsgList
)
{
***************
*** 525,532 ****
SCA_GROUP* psg = (SCA_GROUP*)MemAlloc(sizeof(SCA_GROUP), TRUE);
ExitOnNull(psg, hr, E_OUTOFMEMORY, "failed to allocate memory for new group list element");
!
psg->psgNext = *ppsgList;
*ppsgList = psg;
!
LExit:
return hr;
--- 580,587 ----
SCA_GROUP* psg = (SCA_GROUP*)MemAlloc(sizeof(SCA_GROUP), TRUE);
ExitOnNull(psg, hr, E_OUTOFMEMORY, "failed to allocate memory for new group list element");
!
psg->psgNext = *ppsgList;
*ppsgList = psg;
!
LExit:
return hr;
Index: scawebdir.h
===================================================================
RCS file: /cvsroot/wix/wix/src/ca/serverca/scasched/scawebdir.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** scawebdir.h 19 Apr 2006 08:54:26 -0000 1.2
--- scawebdir.h 27 Jun 2007 05:35:59 -0000 1.3
***************
*** 20,60 ****
struct SCA_WEBDIR
{
! // darwin information
! WCHAR wzKey[MAX_DARWIN_KEY + 1];
! WCHAR wzComponent[MAX_DARWIN_KEY + 1];
! INSTALLSTATE isInstalled;
! INSTALLSTATE isAction;
!
! // metabase information
! WCHAR wzWebKey[MAX_DARWIN_KEY + 1];
! WCHAR wzWebBase[METADATA_MAX_NAME_LEN + 1];
! WCHAR wzWebDirRoot[METADATA_MAX_NAME_LEN + 1];
! // iis configuation information
! WCHAR wzDirectory[MAX_PATH];
! BOOL fHasProperties;
! SCA_WEB_PROPERTIES swp;
! BOOL fHasApplication;
! SCA_WEB_APPLICATION swapp;
! BOOL fHasSecurity;
! WCHAR wzDistinguishedName[MAX_DISTINGUISHED_NAME];
! WCHAR wzCertificateAuthority[MAX_CERTIFICATE_AUTHORITY];
! int dwAccessPermissions;
! SCA_WEBDIR* pswdNext;
};
// prototypes
! UINT __stdcall ScaWebDirsRead(IMSAdminBase* piMetabase,
! SCA_WEB* pswList, SCA_WEBDIR** ppswdList);
!
! HRESULT ScaWebDirsInstall(IMSAdminBase* piMetabase, SCA_WEBDIR* pswdList, SCA_APPPOOL * psapList);
! HRESULT ScaWebDirsUninstall(IMSAdminBase* piMetabase, SCA_WEBDIR* pswdList);
! void ScaWebDirsFreeList(SCA_WEBDIR* pswdList);
--- 20,66 ----
struct SCA_WEBDIR
{
! // darwin information
! WCHAR wzKey[MAX_DARWIN_KEY + 1];
! WCHAR wzComponent[MAX_DARWIN_KEY + 1];
! INSTALLSTATE isInstalled;
! INSTALLSTATE isAction;
! // metabase information
! WCHAR wzWebKey[MAX_DARWIN_KEY + 1];
! WCHAR wzWebBase[METADATA_MAX_NAME_LEN + 1];
! WCHAR wzWebDirRoot[METADATA_MAX_NAME_LEN + 1];
! // iis configuation information
! WCHAR wzDirectory[MAX_PATH];
! BOOL fHasProperties;
! SCA_WEB_PROPERTIES swp;
! BOOL fHasApplication;
! SCA_WEB_APPLICATION swapp;
! SCA_WEBDIR* pswdNext;
};
// prototypes
! UINT __stdcall ScaWebDirsRead(
! __in IMSAdminBase* piMetabase,
! __in SCA_WEB* pswList,
! __out SCA_WEBDIR** ppswdList
! );
! HRESULT ScaWebDirsInstall(
! __in IMSAdminBase* piMetabase,
! __in SCA_WEBDIR* pswdList,
! __in SCA_APPPOOL* psapList
! );
! HRESULT ScaWebDirsUninstall(
! __in IMSAdminBase* piMetabase,
! __in SCA_WEBDIR* pswdList
! );
+ void ScaWebDirsFreeList(
+ __in SCA_WEBDIR* pswdList
+ );
--- NEW FILE: scasql.cpp ---
//-------------------------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// The use and distribution terms for this software are covered by the
// Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
// which can be found in the file CPL.TXT at the root of this distribution.
// By using this software in any fashion, you are agreeing to be bound by
// the terms of this license.
//
// You must not remove this notice, or any other, from this software.
//
//
//
// SQL functions for CustomActions
//
//-------------------------------------------------------------------------------------------------
#include "precomp.h"
// prototypes
static HRESULT ConfigureSqlData(
__in SCA_ACTION saAction
);
/********************************************************************
InstallSqlData - CUSTOM ACTION ENTRY POINT for installing
SQL data
********************************************************************/
extern "C" UINT __stdcall InstallSqlData(
__in MSIHANDLE hInstall
)
{
HRESULT hr = S_OK;
UINT er = ERROR_SUCCESS;
// initialize
hr = WcaInitialize(hInstall, "InstallSqlData");
ExitOnFailure(hr, "Failed to initialize");
hr = ConfigureSqlData(SCA_ACTION_INSTALL);
LExit:
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
return WcaFinalize(er);
}
/********************************************************************
UninstallSqlData - CUSTOM ACTION ENTRY POINT for uninstalling
SQL data
********************************************************************/
extern "C" UINT __stdcall UninstallSqlData(
__in MSIHANDLE hInstall
)
{
HRESULT hr = S_OK;
UINT er = ERROR_SUCCESS;
// initialize
hr = WcaInitialize(hInstall, "UninstallCertificates");
ExitOnFailure(hr, "Failed to initialize");
hr = ConfigureSqlData(SCA_ACTION_UNINSTALL);
LExit:
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
return WcaFinalize(er);
}
static HRESULT ConfigureSqlData(
__in SCA_ACTION saAction
)
{
//AssertSz(FALSE, "debug ConfigureSqlData()");
HRESULT hr = S_OK;
SCA_DB* psdList = NULL;
SCA_SQLSTR* psssList = NULL;
// check for the prerequsite tables
if (S_OK != WcaTableExists(L"SqlDatabase"))
{
WcaLog(LOGMSG_VERBOSE, "skipping SQL CustomAction, no SqlDatabase table");
ExitFunction1(hr = S_FALSE);
}
// read tables
hr = ScaDbsRead(&psdList, saAction);
ExitOnFailure(hr, "failed to read SqlDatabase table");
hr = ScaSqlStrsRead(&psssList, saAction);
ExitOnFailure(hr, "failed to read SqlStrings table");
hr = ScaSqlStrsReadScripts(&psssList, saAction);
ExitOnFailure(hr, "failed to read SqlScripts table");
if (SCA_ACTION_UNINSTALL == saAction)
{
// do uninstall actions (order is important!)
hr = ScaSqlStrsUninstall(psdList, psssList);
ExitOnFailure(hr, "failed to execute uninstall SQL strings");
hr = ScaDbsUninstall(psdList);
ExitOnFailure(hr, "failed to uninstall databases");
}
else
{
// do install actions (order is important!)
hr = ScaDbsInstall(psdList);
ExitOnFailure(hr, "failed to install databases");
hr = ScaSqlStrsInstall(psdList, psssList);
ExitOnFailure(hr, "failed to execute install SQL strings, length may be too long, try add GO to break up");
}
LExit:
if (psssList)
ScaSqlStrsFreeList(psssList);
if (psdList)
ScaDbsFreeList(psdList);
return hr;
}
Index: scasched.build
===================================================================
RCS file: /cvsroot/wix/wix/src/ca/serverca/scasched/scasched.build,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** scasched.build 19 Apr 2006 08:54:26 -0000 1.3
--- scasched.build 27 Jun 2007 05:35:59 -0000 1.4
***************
*** 48,57 ****
--- 48,61 ----
+
+
+
+
Index: scadb.h
===================================================================
RCS file: /cvsroot/wix/wix/src/ca/serverca/scasched/scadb.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** scadb.h 19 Apr 2006 08:54:26 -0000 1.2
--- scadb.h 27 Jun 2007 05:35:59 -0000 1.3
***************
*** 23,59 ****
struct SCA_DB
{
! // darwin information
! WCHAR wzKey[MAX_DARWIN_KEY + 1];
! BOOL fHasComponent;
! WCHAR wzComponent[MAX_DARWIN_KEY + 1];
! INSTALLSTATE isInstalled, isAction;
! WCHAR wzServer[MAX_DARWIN_COLUMN + 1];
! WCHAR wzInstance[MAX_DARWIN_COLUMN + 1];
! WCHAR wzDatabase[MAX_DARWIN_COLUMN + 1];
! int iAttributes;
! BOOL fUseIntegratedAuth;
! SCA_USER scau;
! BOOL fHasDbSpec;
! SQL_FILESPEC sfDb;
! BOOL fHasLogSpec;
! SQL_FILESPEC sfLog;
! SCA_DB* psdNext;
};
// prototypes
! HRESULT ScaDbsRead(SCA_DB** ppsdList);
!
! SCA_DB* ScaDbsFindDatabase(LPCWSTR wzSqlDb, SCA_DB* psdList);
! HRESULT ScaDbsInstall(SCA_DB* psdList);
! HRESULT ScaDbsUninstall(SCA_DB* psdList);
! void ScaDbsFreeList(SCA_DB* psdList);
--- 23,70 ----
struct SCA_DB
{
! // darwin information
! WCHAR wzKey[MAX_DARWIN_KEY + 1];
! BOOL fHasComponent;
! WCHAR wzComponent[MAX_DARWIN_KEY + 1];
! INSTALLSTATE isInstalled, isAction;
! WCHAR wzServer[MAX_DARWIN_COLUMN + 1];
! WCHAR wzInstance[MAX_DARWIN_COLUMN + 1];
! WCHAR wzDatabase[MAX_DARWIN_COLUMN + 1];
! int iAttributes;
! BOOL fUseIntegratedAuth;
! SCA_USER scau;
! BOOL fHasDbSpec;
! SQL_FILESPEC sfDb;
! BOOL fHasLogSpec;
! SQL_FILESPEC sfLog;
! SCA_DB* psdNext;
};
// prototypes
! HRESULT ScaDbsRead(
! __inout SCA_DB** ppsdList,
! __in SCA_ACTION saAction
! );
! SCA_DB* ScaDbsFindDatabase(
! __in LPCWSTR wzSqlDb,
! __in SCA_DB* psdList
! );
! HRESULT ScaDbsInstall(
! __in SCA_DB* psdList
! );
! HRESULT ScaDbsUninstall(
! __in SCA_DB* psdList
! );
+ void ScaDbsFreeList(
+ __in SCA_DB* psdList
+ );
Index: scassl.h
===================================================================
RCS file: /cvsroot/wix/wix/src/ca/serverca/scasched/scassl.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** scassl.h 19 Apr 2006 08:54:26 -0000 1.2
--- scassl.h 27 Jun 2007 05:35:59 -0000 1.3
***************
*** 18,49 ****
//-------------------------------------------------------------------------------------------------
- #include "scaweb.h"
-
- // Certificate.Attribute
- #define SCA_CERT_ATTRIBUTE_DEFAULT 0
- #define SCA_CERT_ATTRIBUTE_REQUEST 1
- #define SCA_CERT_ATTRIBUTE_BINARYDATA 2
- #define SCA_CERT_ATTRIBUTE_OVERWRITE 4
-
- // Certificate.StoreLocation
- #define SCA_CERTSYSTEMSTORE_CURRENTUSER 1
- #define SCA_CERTSYSTEMSTORE_LOCALMACHINE 2
-
// misc macros
#define MD_SSL_CERT_HASH ( IIS_MD_SSL_BASE+6 )
#define MD_SSL_CERT_STORE_NAME ( IIS_MD_SSL_BASE+11 )
! #define CB_CERTIFICATE_HASH 20
! #define WIDE(x) WIDE2(x)
! #define WIDE2(x) L ## x
! #define SSL_SCHEDULE_STORE 0
- // Main entry point
- HRESULT ScaConfigureCertificates(IMSAdminBase* piMetabase, SCA_WEB* pswList);
! // IIs SSL metabase write
! HRESULT ScaSslWriteMetabase(IMSAdminBase* piMetabase, LPCWSTR wzWebBase, DWORD dwAccessPermissions, INT iStore, BYTE* pbaHashBuffer);
! // Certificate install or delete
! HRESULT ScaInstallCertificateByBinaryData(BOOL fAddCert, INT iStore, INT iStoreLocation, LPCWSTR wzName, BYTE* pbData, DWORD cbData,
! LPCWSTR wzPFXPassword);
--- 18,51 ----
//-------------------------------------------------------------------------------------------------
// misc macros
#define MD_SSL_CERT_HASH ( IIS_MD_SSL_BASE+6 )
#define MD_SSL_CERT_STORE_NAME ( IIS_MD_SSL_BASE+11 )
! //#define WIDE(x) WIDE2(x)
! //#define WIDE2(x) L ## x
! // structs
! struct SCA_WEB_SSL_CERTIFICATE
! {
! WCHAR wzStoreName[65];
! BYTE rgbSHA1Hash[CB_CERTIFICATE_HASH];
! SCA_WEB_SSL_CERTIFICATE* pNext;
! };
!
!
! // prototypes
! HRESULT ScaSslCertificateRead(
! __in LPCWSTR wzWebId,
! __inout SCA_WEB_SSL_CERTIFICATE** ppswscList
! );
!
! HRESULT ScaSslCertificateWriteMetabase(
! __in IMSAdminBase* piMetabase,
! __in LPCWSTR wzWebBase,
! __in SCA_WEB_SSL_CERTIFICATE* pswscList
! );
+ void ScaSslCertificateFreeList(
+ __in SCA_WEB_SSL_CERTIFICATE* pswscList
+ );
Index: scawebsvcext.h
===================================================================
RCS file: /cvsroot/wix/wix/src/ca/serverca/scasched/scawebsvcext.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** scawebsvcext.h 19 Apr 2006 08:54:26 -0000 1.3
--- scawebsvcext.h 27 Jun 2007 05:35:59 -0000 1.4
***************
*** 22,43 ****
struct SCA_WEBSVCEXT
{
! // darwin information
! INSTALLSTATE isInstalled;
! INSTALLSTATE isAction;
! // iis configuation information
! WCHAR wzFile[MAX_PATH + 1];
! WCHAR wzDescription[MAX_DARWIN_COLUMN + 1];
! WCHAR wzGroup[MAX_DARWIN_COLUMN + 1];
! int iAttributes;
! SCA_WEBSVCEXT* psWseNext;
};
! HRESULT __stdcall ScaWebSvcExtRead(SCA_WEBSVCEXT** ppsWseList);
!
! HRESULT ScaWebSvcExtCommit(IMSAdminBase* piMetabase, SCA_WEBSVCEXT* psWseList);
! void ScaWebSvcExtFreeList(SCA_WEBSVCEXT* psWseList);
--- 22,49 ----
struct SCA_WEBSVCEXT
{
! // darwin information
! INSTALLSTATE isInstalled;
! INSTALLSTATE isAction;
! // iis configuation information
! WCHAR wzFile[MAX_PATH + 1];
! WCHAR wzDescription[MAX_DARWIN_COLUMN + 1];
! WCHAR wzGroup[MAX_DARWIN_COLUMN + 1];
! int iAttributes;
! SCA_WEBSVCEXT* psWseNext;
};
! HRESULT __stdcall ScaWebSvcExtRead(
! __in SCA_WEBSVCEXT** ppsWseList
! );
! HRESULT ScaWebSvcExtCommit(
! __in IMSAdminBase* piMetabase,
! __in SCA_WEBSVCEXT* psWseList
! );
+ void ScaWebSvcExtFreeList(
+ __in SCA_WEBSVCEXT* psWseList
+ );
Index: scadb.cpp
===================================================================
RCS file: /cvsroot/wix/wix/src/ca/serverca/scasched/scadb.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** scadb.cpp 19 Apr 2006 08:54:26 -0000 1.4
--- scadb.cpp 27 Jun 2007 05:35:59 -0000 1.5
***************
*** 33,52 ****
// prototypes for private helper functions
! static HRESULT NewDb(SCA_DB** ppsd);
! static SCA_DB* AddDbToList(SCA_DB* psdList, SCA_DB* psd);
! static HRESULT SchedCreateDatabase(SCA_DB* psd);
! static HRESULT SchedDropDatabase(LPCWSTR wzKey, LPCWSTR wzServer, LPCWSTR wzInstance,
! LPCWSTR wzDatabase, int iAttributes, BOOL fIntegratedAuth,
! LPCWSTR wzUser, LPCWSTR wzPassword);
! static HRESULT GetFileSpec(MSIHANDLE hViewFileSpec, LPCWSTR wzKey, SQL_FILESPEC* psf);
! HRESULT ScaDbsRead(SCA_DB** ppsdList)
{
HRESULT hr = S_OK;
UINT er = ERROR_SUCCESS;
! PMSIHANDLE hView, hRec;
PMSIHANDLE hViewFileSpec = NULL;
LPWSTR pwzData = NULL;
SCA_DB* psd = NULL;
--- 33,81 ----
// prototypes for private helper functions
! static HRESULT NewDb(
! __out SCA_DB** ppsd
! );
!
! static SCA_DB* AddDbToList(
! __in SCA_DB* psdList,
! __in SCA_DB* psd
! );
+ static HRESULT SchedCreateDatabase(
+ __in SCA_DB* psd
+ );
! static HRESULT SchedDropDatabase(
! __in LPCWSTR wzKey, LPCWSTR wzServer,
! __in LPCWSTR wzInstance,
! __in LPCWSTR wzDatabase,
! __in int iAttributes,
! __in BOOL fIntegratedAuth,
! __in LPCWSTR wzUser,
! __in LPCWSTR wzPassword
! );
!
! static HRESULT GetFileSpec(
! __in MSIHANDLE hViewFileSpec,
! __in LPCWSTR wzKey,
! __in SQL_FILESPEC* psf
! );
!
!
! HRESULT ScaDbsRead(
! __inout SCA_DB** ppsdList,
! __in SCA_ACTION saAction
! )
{
HRESULT hr = S_OK;
UINT er = ERROR_SUCCESS;
! PMSIHANDLE hView;
! PMSIHANDLE hRec;
PMSIHANDLE hViewFileSpec = NULL;
+
LPWSTR pwzData = NULL;
+ LPWSTR pwzId = NULL;
+ LPWSTR pwzComponent = NULL;
+
SCA_DB* psd = NULL;
***************
*** 54,59 ****
{
WcaLog(LOGMSG_VERBOSE, "Skipping ScaCreateDatabase() - SqlDatabase table not present");
! hr = S_FALSE;
! goto LExit;
}
--- 83,87 ----
{
WcaLog(LOGMSG_VERBOSE, "Skipping ScaCreateDatabase() - SqlDatabase table not present");
! ExitFunction1(hr = S_FALSE);
}
***************
*** 69,91 ****
while (S_OK == (hr = WcaFetchRecord(hView, &hRec)))
{
! hr = NewDb(&psd);
! ExitOnFailure(hr, "failed to allocate memory for new database");
! hr = WcaGetRecordString(hRec, sdqSqlDb, &pwzData);
ExitOnFailure(hr, "Failed to get SqlDatabase.SqlDb");
- StringCchCopyW(psd->wzKey, countof(psd->wzKey), pwzData);
! hr = WcaGetRecordString(hRec, sdqComponent, &pwzData);
ExitOnFailure1(hr, "Failed to get Component for database: '%S'", psd->wzKey);
! StringCchCopyW(psd->wzComponent, countof(psd->wzComponent), pwzData);
! if (*(psd->wzComponent))
{
! psd->fHasComponent = TRUE;
! er = ::MsiGetComponentStateW(WcaGetInstallHandle(), psd->wzComponent, &psd->isInstalled, &psd->isAction);
hr = HRESULT_FROM_WIN32(er);
! ExitOnFailure(hr, "Failed to get Component state for SqlDatabase");
}
hr = WcaGetRecordFormattedString(hRec, sdqServer, &pwzData);
ExitOnFailure1(hr, "Failed to get Server for database: '%S'", psd->wzKey);
--- 97,139 ----
while (S_OK == (hr = WcaFetchRecord(hView, &hRec)))
{
! BOOL fHasComponent = FALSE;
! INSTALLSTATE isInstalled = INSTALLSTATE_UNKNOWN;
! INSTALLSTATE isAction = INSTALLSTATE_UNKNOWN;
! hr = WcaGetRecordString(hRec, sdqSqlDb, &pwzId);
ExitOnFailure(hr, "Failed to get SqlDatabase.SqlDb");
! hr = WcaGetRecordString(hRec, sdqComponent, &pwzComponent);
ExitOnFailure1(hr, "Failed to get Component for database: '%S'", psd->wzKey);
! if (pwzComponent && *pwzComponent)
{
! fHasComponent = TRUE;
! er = ::MsiGetComponentStateW(WcaGetInstallHandle(), pwzComponent, &isInstalled, &isAction);
hr = HRESULT_FROM_WIN32(er);
! ExitOnFailure1(hr, "Failed to get state for component: %S", pwzComponent);
!
! // If we're doing install but the Component is not being installed or we're doing
! // uninstall but the Component is not being uninstalled, skip it.
! if ((WcaIsInstalling(isInstalled, isAction) && SCA_ACTION_INSTALL != saAction) ||
! (WcaIsUninstalling(isInstalled, isAction) && SCA_ACTION_UNINSTALL != saAction))
! {
! continue;
! }
}
+ hr = NewDb(&psd);
+ ExitOnFailure1(hr, "Failed to allocate memory for new database: %D", pwzId);
+
+ hr = ::StringCchCopyW(psd->wzKey, countof(psd->wzKey), pwzId);
+ ExitOnFailure1(hr, "Failed to copy SqlDatabase.SqlDbL: %S", pwzId);
+
+ hr = ::StringCchCopyW(psd->wzComponent, countof(psd->wzComponent), pwzComponent);
+ ExitOnFailure1(hr, "Failed to copy SqlDatabase.Component_: %S", pwzComponent);
+
+ psd->fHasComponent = fHasComponent;
+ psd->isInstalled = isInstalled;
+ psd->isAction = isAction;
+
hr = WcaGetRecordFormattedString(hRec, sdqServer, &pwzData);
ExitOnFailure1(hr, "Failed to get Server for database: '%S'", psd->wzKey);
***************
*** 128,132 ****
--- 176,182 ----
ExitOnFailure1(hr, "failed to get FileSpec for: %S", pwzData);
if (S_OK == hr)
+ {
psd->fHasDbSpec = TRUE;
+ }
}
***************
*** 140,144 ****
--- 190,196 ----
ExitOnFailure1(hr, "failed to get FileSpec for: %S", pwzData);
if (S_OK == hr)
+ {
psd->fHasLogSpec = TRUE;
+ }
}
***************
*** 148,159 ****
if (E_NOMOREITEMS == hr)
hr = S_OK;
ExitOnFailure(hr, "Failure occured while processing SqlDatabase table");
LExit:
- // if anything was left over after an error clean it all up
if (psd)
ScaDbsFreeList(psd);
ReleaseStr(pwzData);
return hr;
--- 200,216 ----
if (E_NOMOREITEMS == hr)
+ {
hr = S_OK;
+ }
ExitOnFailure(hr, "Failure occured while processing SqlDatabase table");
LExit:
if (psd)
+ {
ScaDbsFreeList(psd);
+ }
+ ReleaseStr(pwzComponent);
+ ReleaseStr(pwzId);
ReleaseStr(pwzData);
return hr;
***************
*** 161,165 ****
! SCA_DB* ScaDbsFindDatabase(LPCWSTR wzSqlDb, SCA_DB* psdList)
{
SCA_DB* psd = NULL;
--- 218,225 ----
! SCA_DB* ScaDbsFindDatabase(
! __in LPCWSTR wzSqlDb,
! __in SCA_DB* psdList
! )
{
SCA_DB* psd = NULL;
***************
*** 168,172 ****
--- 228,234 ----
{
if (0 == lstrcmpW(wzSqlDb, psd->wzKey))
+ {
break;
+ }
}
***************
*** 175,179 ****
! HRESULT ScaDbsInstall(SCA_DB* psdList)
{
HRESULT hr = S_FALSE; // assume nothing will be done
--- 237,243 ----
! HRESULT ScaDbsInstall(
! __in SCA_DB* psdList
! )
{
HRESULT hr = S_FALSE; // assume nothing will be done
***************
*** 192,196 ****
}
else if (((psd->iAttributes & SCADB_DROP_ON_INSTALL) && WcaIsInstalling(psd->isInstalled, psd->isAction) && !WcaIsReInstalling(psd->isInstalled, psd->isAction)) ||
! ((psd->iAttributes & SCADB_DROP_ON_REINSTALL) && WcaIsReInstalling(psd->isInstalled, psd->isAction)))
{
hr = SchedDropDatabase(psd->wzKey, psd->wzServer, psd->wzInstance, psd->wzDatabase, psd->iAttributes, psd->fUseIntegratedAuth, psd->scau.wzName, psd->scau.wzPassword);
--- 256,260 ----
}
else if (((psd->iAttributes & SCADB_DROP_ON_INSTALL) && WcaIsInstalling(psd->isInstalled, psd->isAction) && !WcaIsReInstalling(psd->isInstalled, psd->isAction)) ||
! ((psd->iAttributes & SCADB_DROP_ON_REINSTALL) && WcaIsReInstalling(psd->isInstalled, psd->isAction)))
{
hr = SchedDropDatabase(psd->wzKey, psd->wzServer, psd->wzInstance, psd->wzDatabase, psd->iAttributes, psd->fUseIntegratedAuth, psd->scau.wzName, psd->scau.wzPassword);
***************
*** 205,209 ****
! HRESULT ScaDbsUninstall(SCA_DB* psdList)
{
HRESULT hr = S_FALSE; // assume nothing will be done
--- 269,275 ----
! HRESULT ScaDbsUninstall(
! __in SCA_DB* psdList
! )
{
HRESULT hr = S_FALSE; // assume nothing will be done
***************
*** 233,237 ****
! void ScaDbsFreeList(SCA_DB* psdList)
{
SCA_DB* psdDelete = psdList;
--- 299,305 ----
! void ScaDbsFreeList(
! __in SCA_DB* psdList
! )
{
SCA_DB* psdDelete = psdList;
***************
*** 249,253 ****
static HRESULT NewDb(
! SCA_DB** ppsd
)
{
--- 317,321 ----
static HRESULT NewDb(
! __out SCA_DB** ppsd
)
{
***************
*** 255,259 ****
SCA_DB* psd = (SCA_DB*)MemAlloc(sizeof(SCA_DB), TRUE);
ExitOnNull(psd, hr, E_OUTOFMEMORY, "failed to allocate memory for new database element");
!
*ppsd = psd;
--- 323,327 ----
SCA_DB* psd = (SCA_DB*)MemAlloc(sizeof(SCA_DB), TRUE);
ExitOnNull(psd, hr, E_OUTOFMEMORY, "failed to allocate memory for new database element");
!
*ppsd = psd;
***************
*** 263,267 ****
! static SCA_DB* AddDbToList(SCA_DB* psdList, SCA_DB* psd)
{
if (psdList)
--- 331,338 ----
! static SCA_DB* AddDbToList(
! __in SCA_DB* psdList,
! __in SCA_DB* psd
! )
{
if (psdList)
***************
*** 269,278 ****
--- 340,353 ----
SCA_DB* psdT = psdList;
while (psdT->psdNext)
+ {
psdT = psdT->psdNext;
+ }
psdT->psdNext = psd;
}
else
+ {
psdList = psd;
+ }
return psdList;
***************
*** 280,284 ****
! static HRESULT SchedCreateDatabase(SCA_DB* psd)
{
HRESULT hr = S_OK;
--- 355,361 ----
! static HRESULT SchedCreateDatabase(
! __in SCA_DB* psd
! )
{
HRESULT hr = S_OK;
***************
*** 309,314 ****
ExitOnFailure(hr, "Failed to add user password to CustomActionData");
! hr = WcaDoDeferredAction(L"RollbackCreateDatabase", pwzCustomActionData, COST_SQL_CREATEDB);
! ExitOnFailure(hr, "Failed to schedule RollbackCreateDatabase action");
// database filespec
--- 386,401 ----
ExitOnFailure(hr, "Failed to add user password to CustomActionData");
! // Check to see if the database exists, if it does not then schedule a rollback
! // so we clean up after ourselves if the creation of the database fails or is
! // aborted. It is intereting to note that we can do this check here because the
! // deferred CustomActions are Impersonated. That means this scheduling action and
! // the execution actions all run with the same user context, so it is safe to
! // to do the check.
! hr = SqlDatabaseExists(psd->wzServer, psd->wzInstance, psd->wzDatabase, psd->fUseIntegratedAuth, psd->scau.wzName, psd->scau.wzPassword, NULL);
! if (S_FALSE == hr)
! {
! hr = WcaDoDeferredAction(L"RollbackCreateDatabase", pwzCustomActionData, COST_SQL_CREATEDB);
! ExitOnFailure(hr, "Failed to schedule RollbackCreateDatabase action");
! }
// database filespec
***************
*** 376,382 ****
! HRESULT SchedDropDatabase(LPCWSTR wzKey, LPCWSTR wzServer, LPCWSTR wzInstance,
! LPCWSTR wzDatabase, int iAttributes, BOOL fIntegratedAuth,
! LPCWSTR wzUser, LPCWSTR wzPassword)
{
HRESULT hr = S_OK;
--- 463,476 ----
! HRESULT SchedDropDatabase(
! __in LPCWSTR wzKey,
! __in LPCWSTR wzServer,
! __in LPCWSTR wzInstance,
! __in LPCWSTR wzDatabase,
! __in int iAttributes,
! __in BOOL fIntegratedAuth,
! __in LPCWSTR wzUser,
! __in LPCWSTR wzPassword
! )
{
HRESULT hr = S_OK;
***************
*** 416,420 ****
! HRESULT GetFileSpec(MSIHANDLE hViewFileSpec, LPCWSTR wzKey, SQL_FILESPEC* psf)
{
HRESULT hr = S_OK;
--- 510,518 ----
! HRESULT GetFileSpec(
! __in MSIHANDLE hViewFileSpec,
! __in LPCWSTR wzKey,
! __in SQL_FILESPEC* psf
! )
{
HRESULT hr = S_OK;
***************
*** 425,429 ****
--- 523,529 ----
hRecFileSpec = ::MsiCreateRecord(1);
if (!hRecFileSpec)
+ {
ExitOnFailure1(hr = E_UNEXPECTED, "failed to create record for filespec: %S", wzKey);
+ }
hr = WcaSetRecordString(hRecFileSpec, 1, wzKey);
ExitOnFailure1(hr, "failed to set record string for filespec: %S", wzKey);
***************
*** 443,447 ****
--- 543,549 ----
ExitOnFailure1(hr, "Failed to get SqlFileSpec.Filename for filespec: %S", wzKey);
if (*pwzData)
+ {
StringCchCopyW(psf->wzFilename, countof(psf->wzFilename), pwzData);
+ }
else // if there is no file, skip this FILESPEC
{
***************
*** 453,473 ****
ExitOnFailure1(hr, "Failed to get SqlFileSpec.Size for filespec: %S", wzKey);
if (*pwzData)
StringCchCopyW(psf->wzSize, countof(psf->wzSize), pwzData);
else
psf->wzSize[0] = 0;
hr = WcaGetRecordFormattedString(hRec, sfsqMaxSize, &pwzData);
ExitOnFailure1(hr, "Failed to get SqlFileSpec.MaxSize for filespec: %S", wzKey);
if (*pwzData)
StringCchCopyW(psf->wzMaxSize, countof(psf->wzMaxSize), pwzData);
else
psf->wzMaxSize[0] = 0;
!
hr = WcaGetRecordFormattedString(hRec, sfsqGrowth, &pwzData);
ExitOnFailure1(hr, "Failed to get SqlFileSpec.GrowthSize for filespec: %S", wzKey);
if (*pwzData)
StringCchCopyW(psf->wzGrow, countof(psf->wzGrow), pwzData);
else
psf->wzGrow[0] = 0;
hr = S_OK;
--- 555,587 ----
ExitOnFailure1(hr, "Failed to get SqlFileSpec.Size for filespec: %S", wzKey);
if (*pwzData)
+ {
StringCchCopyW(psf->wzSize, countof(psf->wzSize), pwzData);
+ }
else
+ {
psf->wzSize[0] = 0;
+ }
hr = WcaGetRecordFormattedString(hRec, sfsqMaxSize, &pwzData);
ExitOnFailure1(hr, "Failed to get SqlFileSpec.MaxSize for filespec: %S", wzKey);
if (*pwzData)
+ {
StringCchCopyW(psf->wzMaxSize, countof(psf->wzMaxSize), pwzData);
+ }
else
+ {
psf->wzMaxSize[0] = 0;
! }
!
hr = WcaGetRecordFormattedString(hRec, sfsqGrowth, &pwzData);
ExitOnFailure1(hr, "Failed to get SqlFileSpec.GrowthSize for filespec: %S", wzKey);
if (*pwzData)
+ {
StringCchCopyW(psf->wzGrow, countof(psf->wzGrow), pwzData);
+ }
else
+ {
psf->wzGrow[0] = 0;
+ }
hr = S_OK;
Index: precomp.h
===================================================================
RCS file: /cvsroot/wix/wix/src/ca/serverca/scasched/precomp.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** precomp.h 19 Apr 2006 08:54:26 -0000 1.2
--- precomp.h 27 Jun 2007 05:35:57 -0000 1.3
***************
*** 30,43 ****
#include // ICertRequest
#include
- #include
#include
#include
#include
#include
! #include // PerfMon counter header file.
! #include // PerfMon counter header file.
#include "wcautil.h"
#include "memutil.h"
#include "metautil.h"
--- 30,44 ----
#include // ICertRequest
#include
#include
#include
#include
#include
+ #include
! #include // PerfMon counter header file.
! #include // PerfMon counter header file.
#include "wcautil.h"
+ #include "fileutil.h"
#include "memutil.h"
#include "metautil.h"
***************
*** 47,59 ****
#include "CustomMsiErrors.h"
#include "scaapppool.h"
#include "scadb.h"
#include "scafilter.h"
#include "scaiis.h"
#include "scamimemap.h"
#include "scaproperty.h"
#include "scassl.h"
#include "scasmb.h"
- #include "scasql.h"
#include "scasqlstr.h"
#include "scaweb.h"
--- 48,64 ----
#include "CustomMsiErrors.h"
+ #include "..\inc\sca.h"
+ #include "..\inc\scacost.h"
+
#include "scaapppool.h"
+ #include "scacert.h"
#include "scadb.h"
#include "scafilter.h"
#include "scaiis.h"
#include "scamimemap.h"
+ #include "scahttpheader.h"
#include "scaproperty.h"
#include "scassl.h"
#include "scasmb.h"
#include "scasqlstr.h"
#include "scaweb.h"
***************
*** 62,65 ****
#include "scawebsvcext.h"
#include "scavdir.h"
- #include "..\inc\sca.h"
- #include "..\inc\scacost.h"
--- 67,68 ----
Index: scaapppool.cpp
===================================================================
RCS file: /cvsroot/wix/wix/src/ca/serverca/scasched/scaapppool.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** scaapppool.cpp 19 Apr 2006 08:54:26 -0000 1.5
--- scaapppool.cpp 27 Jun 2007 05:35:59 -0000 1.6
***************
*** 37,51 ****
Notes:
! RecycleTimes is a comma delimeted list of times. CPUMon is a
! comma delimeted list of the following format:
! ,,. The values for
! Action are 1 (Shutdown) and 0 (No Action).
!
------------------------------------------------------------------*/
// sql queries
! LPCWSTR vcsAppPoolQuery = L"SELECT `AppPool`, `Name`, `Component_`, `Attributes`, `User_`, `RecycleMinutes`, `RecycleRequests`, `RecycleTimes`, `VirtualMemory`, `PrivateMemory`, `IdleTimeout`, `QueueLimit`, `CPUMon`, `MaxProc` "
! L"FROM `IIsAppPool`";
!
enum eAppPoolQuery { apqAppPool = 1, apqName, apqComponent, apqAttributes, apqUser, apqRecycleMinutes, apqRecycleRequests, apqRecycleTimes, apqVirtualMemory, apqPrivateMemory, apqIdleTimeout, apqQueueLimit, apqCpuMon, apqMaxProc };
--- 37,49 ----
Notes:
! RecycleTimes is a comma delimeted list of times. CPUMon is a
! comma delimeted list of the following format:
! ,,. The values for
! Action are 1 (Shutdown) and 0 (No Action).
!
------------------------------------------------------------------*/
// sql queries
! LPCWSTR vcsAppPoolQuery = L"SELECT `AppPool`, `Name`, `Component_`, `Attributes`, `User_`, `RecycleMinutes`, `RecycleRequests`, `RecycleTimes`, `VirtualMemory`, `PrivateMemory`, `IdleTimeout`, `QueueLimit`, `CPUMon`, `MaxProc` FROM `IIsAppPool`";
enum eAppPoolQuery { apqAppPool = 1, apqName, apqComponent, apqAttributes, apqUser, apqRecycleMinutes, apqRecycleRequests, apqRecycleTimes, apqVirtualMemory, apqPrivateMemory, apqIdleTimeout, apqQueueLimit, apqCpuMon, apqMaxProc };
***************
*** 53,61 ****
// prototypes
static HRESULT AppPoolExists(
! IMSAdminBase* piMetabase,
! LPCWSTR wzAppPool
);
static HRESULT AddAppPoolToList(
! SCA_APPPOOL** ppsapList
);
--- 51,60 ----
// prototypes
static HRESULT AppPoolExists(
! __in IMSAdminBase* piMetabase,
! __in LPCWSTR wzAppPool
);
+
static HRESULT AddAppPoolToList(
! __in SCA_APPPOOL** ppsapList
);
***************
*** 64,68 ****
void ScaAppPoolFreeList(
! SCA_APPPOOL* psapList
)
{
--- 63,67 ----
void ScaAppPoolFreeList(
! __in SCA_APPPOOL* psapList
)
{
***************
*** 88,99 ****
PMSIHANDLE hView, hRec;
- BOOL fIIsAppPoolTable = FALSE;
LPWSTR pwzData = NULL;
! SCA_APPPOOL* psap;
!
! // check to see what tables are available
! fIIsAppPoolTable = (S_OK == WcaTableExists(L"IIsAppPool"));
! if (!fIIsAppPoolTable)
{
WcaLog(LOGMSG_VERBOSE, "Skipping ScaInstallAppPool() - required table not present");
--- 87,96 ----
PMSIHANDLE hView, hRec;
LPWSTR pwzData = NULL;
! INSTALLSTATE isInstalled = INSTALLSTATE_UNKNOWN;
! INSTALLSTATE isAction = INSTALLSTATE_UNKNOWN;
! SCA_APPPOOL* psap = NULL;
! if (S_OK != WcaTableExists(L"IIsAppPool"))
{
WcaLog(LOGMSG_VERBOSE, "Skipping ScaInstallAppPool() - required table not present");
***************
*** 106,109 ****
--- 103,130 ----
while (S_OK == (hr = WcaFetchRecord(hView, &hRec)))
{
+ BOOL fHasComponent = FALSE;
+
+ // Get the Component first. If there is a Component and it is not being modified during
+ // this transaction, skip processing this whole record.
+ hr = WcaGetRecordString(hRec, apqComponent, &pwzData);
+ ExitOnFailure(hr, "failed to get AppPool.Component");
+
+ if (pwzData && *pwzData)
+ {
+ fHasComponent = TRUE;
+
+ uiResult = ::MsiGetComponentStateW(WcaGetInstallHandle(), pwzData, &isInstalled, &isAction);
+ hr = HRESULT_FROM_WIN32(uiResult);
+ ExitOnFailure(hr, "Failed to get AppPool.Component state");
+
+ if (!WcaIsInstalling(isInstalled, isAction) &&
+ !WcaIsReInstalling(isInstalled, isAction) &&
+ !WcaIsUninstalling(isInstalled, isAction))
+ {
+ continue; // skip this record.
+ }
+ }
+
+ // Add this record's information into the list of things to process.
hr = AddAppPoolToList(ppsapList);
ExitOnFailure(hr, "failed to add app pool to app pool list");
***************
*** 111,114 ****
--- 132,145 ----
psap = *ppsapList;
+ psap->fHasComponent = fHasComponent;
+ if (psap->fHasComponent)
+ {
+ hr = StringCchCopyW(psap->wzComponent, countof(psap->wzComponent), pwzData);
+ ExitOnFailure1(hr, "failed to copy component name: %S", pwzData);
+
+ psap->isInstalled = isInstalled;
+ psap->isAction = isAction;
+ }
+
hr = WcaGetRecordString(hRec, apqAppPool, &pwzData);
ExitOnFailure(hr, "failed to get AppPool.AppPool");
***************
*** 123,139 ****
ExitOnFailure(hr, "failed to format app pool key name");
- hr = WcaGetRecordString(hRec, apqComponent, &pwzData);
- ExitOnFailure(hr, "failed to get AppPool.Component");
- hr = StringCchCopyW(psap->wzComponent, countof(psap->wzComponent), pwzData);
- ExitOnFailure1(hr, "failed to copy component name: %S", pwzData);
- if (*(psap->wzComponent))
- {
- psap->fHasComponent = TRUE;
-
- uiResult = ::MsiGetComponentStateW(WcaGetInstallHandle(), psap->wzComponent, &psap->isInstalled, &psap->isAction);
- hr = HRESULT_FROM_WIN32(uiResult);
- ExitOnFailure(hr, "Failed to get AppPool.Component state");
- }
-
hr = WcaGetRecordInteger(hRec, apqAttributes, &psap->iAttributes);
ExitOnFailure(hr, "failed to get AppPool.Attributes");
--- 154,157 ----
***************
*** 177,181 ****
--- 195,201 ----
if (E_NOMOREITEMS == hr)
+ {
hr = S_OK;
+ }
ExitOnFailure(hr, "failure while processing AppPools");
***************
*** 226,231 ****
static HRESULT AppPoolExists(
! IMSAdminBase* piMetabase,
! LPCWSTR wzAppPool
)
{
--- 246,251 ----
static HRESULT AppPoolExists(
! __in IMSAdminBase* piMetabase,
! __in LPCWSTR wzAppPool
)
{
***************
*** 244,249 ****
--- 264,272 ----
}
}
+
if (E_NOMOREITEMS == hr)
+ {
hr = S_FALSE;
+ }
return hr;
***************
*** 252,257 ****
HRESULT ScaAppPoolInstall(
! IMSAdminBase* piMetabase,
! SCA_APPPOOL* psapList
)
{
--- 275,280 ----
HRESULT ScaAppPoolInstall(
! __in IMSAdminBase* piMetabase,
! __in SCA_APPPOOL* psapList
)
{
***************
*** 276,281 ****
HRESULT ScaAppPoolUninstall(
! IMSAdminBase* piMetabase,
! SCA_APPPOOL* psapList
)
{
--- 299,304 ----
HRESULT ScaAppPoolUninstall(
! __in IMSAdminBase* piMetabase,
! __in SCA_APPPOOL* psapList
)
{
***************
*** 300,305 ****
HRESULT ScaWriteAppPool(
! IMSAdminBase* piMetabase,
! SCA_APPPOOL* psap
)
{
--- 323,328 ----
HRESULT ScaWriteAppPool(
! __in IMSAdminBase* piMetabase,
! __in SCA_APPPOOL* psap
)
{
***************
*** 330,334 ****
--- 353,359 ----
}
else
+ {
fExists = TRUE;
+ }
//
***************
*** 346,349 ****
--- 371,375 ----
ExitOnFailure(hr, "failed to set periodic restart request count");
}
+
if (psap->wzRecycleTimes && *psap->wzRecycleTimes)
{
***************
*** 377,381 ****
ExitOnFailure(hr, "failed to set periodic restart private memory count");
}
!
//
--- 403,407 ----
ExitOnFailure(hr, "failed to set periodic restart private memory count");
}
!
//
***************
*** 387,390 ****
--- 413,417 ----
ExitOnFailure(hr, "failed to set idle timeout value");
}
+
if (MSI_NULL_INTEGER != psap->iQueueLimit)
{
***************
*** 392,395 ****
--- 419,423 ----
ExitOnFailure(hr, "failed to set request queue limit value");
}
+
if(psap->wzCpuMon && *psap->wzCpuMon)
{
***************
*** 400,404 ****
DWORD dwRefreshMinutes = 0;
DWORD dwAction = 0;
!
dwPercent = wcstoul(pwzValue, &wz, 10);
if (100 < dwPercent)
--- 428,432 ----
DWORD dwRefreshMinutes = 0;
DWORD dwAction = 0;
!
dwPercent = wcstoul(pwzValue, &wz, 10);
if (100 < dwPercent)
***************
*** 433,436 ****
--- 461,465 ----
}
}
+
if (MSI_NULL_INTEGER != psap->iMaxProcesses)
{
***************
*** 445,455 ****
//
if (psap->iAttributes & APATTR_NETSERVICE)
dwIdentity = MD_APPPOOL_IDENTITY_TYPE_NETWORKSERVICE;
else if (psap->iAttributes & APATTR_LOCSERVICE)
dwIdentity = MD_APPPOOL_IDENTITY_TYPE_LOCALSERVICE;
else if (psap->iAttributes & APATTR_LOCSYSTEM)
dwIdentity = MD_APPPOOL_IDENTITY_TYPE_LOCALSYSTEM;
else if (psap->iAttributes & APATTR_OTHERUSER)
! dwIdentity = MD_APPPOOL_IDENTITY_TYPE_SPECIFICUSER;
if (-1 != dwIdentity)
--- 474,533 ----
//
if (psap->iAttributes & APATTR_NETSERVICE)
+ {
dwIdentity = MD_APPPOOL_IDENTITY_TYPE_NETWORKSERVICE;
+ }
else if (psap->iAttributes & APATTR_LOCSERVICE)
+ {
dwIdentity = MD_APPPOOL_IDENTITY_TYPE_LOCALSERVICE;
+ }
else if (psap->iAttributes & APATTR_LOCSYSTEM)
+ {
dwIdentity = MD_APPPOOL_IDENTITY_TYPE_LOCALSYSTEM;
+ }
else if (psap->iAttributes & APATTR_OTHERUSER)
! {
! if (!psap->suUser.wzDomain || !*psap->suUser.wzDomain || CSTR_EQUAL == ::CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, psap->suUser.wzDomain, -1, L".", -1))
! {
! if (CSTR_EQUAL == ::CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, psap->suUser.wzName, -1, L"NetworkService", -1))
! {
! dwIdentity = MD_APPPOOL_IDENTITY_TYPE_NETWORKSERVICE;
! }
! else if (CSTR_EQUAL == ::CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, psap->suUser.wzName, -1, L"LocalService", -1))
! {
! dwIdentity = MD_APPPOOL_IDENTITY_TYPE_LOCALSERVICE;
! }
! else if (CSTR_EQUAL == ::CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, psap->suUser.wzName, -1, L"LocalSystem", -1))
! {
! dwIdentity = MD_APPPOOL_IDENTITY_TYPE_LOCALSYSTEM;
! }
! else
! {
! dwIdentity = MD_APPPOOL_IDENTITY_TYPE_SPECIFICUSER;
! }
! }
! else if (CSTR_EQUAL == ::CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, psap->suUser.wzDomain, -1, L"NT AUTHORITY", -1))
! {
! if (CSTR_EQUAL == ::CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, psap->suUser.wzName, -1, L"NETWORK SERVICE", -1))
! {
! dwIdentity = MD_APPPOOL_IDENTITY_TYPE_NETWORKSERVICE;
! }
! else if (CSTR_EQUAL == ::CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, psap->suUser.wzName, -1, L"SERVICE", -1))
! {
! dwIdentity = MD_APPPOOL_IDENTITY_TYPE_LOCALSERVICE;
! }
! else if (CSTR_EQUAL == ::CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, psap->suUser.wzName, -1, L"SYSTEM", -1))
! {
! dwIdentity = MD_APPPOOL_IDENTITY_TYPE_LOCALSYSTEM;
! }
! else
! {
! dwIdentity = MD_APPPOOL_IDENTITY_TYPE_SPECIFICUSER;
! }
! }
! else
! {
! dwIdentity = MD_APPPOOL_IDENTITY_TYPE_SPECIFICUSER;
! }
! }
if (-1 != dwIdentity)
***************
*** 460,464 ****
if (MD_APPPOOL_IDENTITY_TYPE_SPECIFICUSER == dwIdentity)
{
! if ( psap->suUser.wzDomain && *psap->suUser.wzDomain )
{
hr = StrAllocFormatted(&pwzValue, L"%s\\%s", psap->suUser.wzDomain, psap->suUser.wzName);
--- 538,542 ----
if (MD_APPPOOL_IDENTITY_TYPE_SPECIFICUSER == dwIdentity)
{
! if (psap->suUser.wzDomain && *psap->suUser.wzDomain)
{
hr = StrAllocFormatted(&pwzValue, L"%s\\%s", psap->suUser.wzDomain, psap->suUser.wzName);
***************
*** 485,491 ****
}
HRESULT ScaRemoveAppPool(
! IMSAdminBase* piMetabase,
! SCA_APPPOOL* psap
)
{
--- 563,570 ----
}
+
HRESULT ScaRemoveAppPool(
! __in IMSAdminBase* piMetabase,
! __in SCA_APPPOOL* psap
)
{
***************
*** 504,509 ****
}
static HRESULT AddAppPoolToList(
! SCA_APPPOOL** ppsapList
)
{
--- 583,589 ----
}
+
static HRESULT AddAppPoolToList(
! __in SCA_APPPOOL** ppsapList
)
{
Index: scavdir.cpp
===================================================================
RCS file: /cvsroot/wix/wix/src/ca/serverca/scasched/scavdir.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** scavdir.cpp 19 Apr 2006 08:54:26 -0000 1.4
--- scavdir.cpp 27 Jun 2007 05:35:59 -0000 1.5
***************
*** 21,37 ****
// sql queries
LPCWSTR vcsVDirQuery = L"SELECT `Web_`, `VirtualDir`, `Component_`, `Alias`, `Directory_`, `DirProperties_`, `Application_`"
! L"FROM `IIsWebVirtualDir`";
LPCWSTR vcsVDirPropertiesQuery = L"SELECT `Web_`, `VirtualDir`, `Component_`, `Alias`, `Directory_`, `DirProperties_`, `Application_`"
! L"FROM `IIsWebVirtualDir` WHERE `VirtualDir`=?";
enum eVDirQuery { vdqWeb = 1, vdqVDir, vdqComponent , vdqAlias, vdqDirectory, vdqProperties, vdqApplication };
// prototypes
static HRESULT AddVirtualDirToList(
! SCA_VDIR** psvdList
);
! HRESULT __stdcall ScaVirtualDirsRead(IMSAdminBase* piMetabase,
! SCA_WEB* pswList, SCA_VDIR** ppsvdList, SCA_MIMEMAP** ppsmmList, SCA_WEB_ERROR** ppsweList)
{
Assert(piMetabase && ppsvdList);
--- 21,43 ----
// sql queries
LPCWSTR vcsVDirQuery = L"SELECT `Web_`, `VirtualDir`, `Component_`, `Alias`, `Directory_`, `DirProperties_`, `Application_`"
! L"FROM `IIsWebVirtualDir`";
LPCWSTR vcsVDirPropertiesQuery = L"SELECT `Web_`, `VirtualDir`, `Component_`, `Alias`, `Directory_`, `DirProperties_`, `Application_`"
! L"FROM `IIsWebVirtualDir` WHERE `VirtualDir`=?";
enum eVDirQuery { vdqWeb = 1, vdqVDir, vdqComponent , vdqAlias, vdqDirectory, vdqProperties, vdqApplication };
// prototypes
static HRESULT AddVirtualDirToList(
! __in SCA_VDIR** psvdList
);
! HRESULT __stdcall ScaVirtualDirsRead(
! __in IMSAdminBase* piMetabase,
! __in SCA_WEB* pswList,
! __in SCA_VDIR** ppsvdList,
! __in SCA_MIMEMAP** ppsmmList,
! __in SCA_HTTP_HEADER** ppshhList,
! __in SCA_WEB_ERROR** ppsweList
! )
{
Assert(piMetabase && ppsvdList);
***************
*** 138,145 ****
}
if (*pwzData && *ppsweList)
{
hr = ScaGetWebError(weptVDir, pwzData, ppsweList, &pvdir->pswe);
! ExitOnFailure(hr, "Failed to get custom web errors for VirtualDir");
}
}
--- 144,157 ----
}
+ if (*pwzData && *ppshhList)
+ {
+ hr = ScaGetHttpHeader(hhptVDir, pwzData, ppshhList, &pvdir->pshh);
+ ExitOnFailure1(hr, "Failed to get custom HTTP headers for VirtualDir: %S", pwzData);
+ }
+
if (*pwzData && *ppsweList)
{
hr = ScaGetWebError(weptVDir, pwzData, ppsweList, &pvdir->pswe);
! ExitOnFailure1(hr, "Failed to get custom web errors for VirtualDir: %S", pwzData);
}
}
***************
*** 155,159 ****
! HRESULT ScaVirtualDirsInstall(IMSAdminBase* piMetabase, SCA_VDIR* psvdList, SCA_APPPOOL * psapList)
{
Assert(piMetabase);
--- 167,175 ----
! HRESULT ScaVirtualDirsInstall(
! __in IMSAdminBase* piMetabase,
! __in SCA_VDIR* psvdList,
! __in SCA_APPPOOL * psapList
! )
{
Assert(piMetabase);
***************
*** 171,175 ****
hr = ScaWriteMetabaseValue(piMetabase, psvd->wzVDirRoot, L"", MD_KEY_TYPE, METADATA_NO_ATTRIBUTES, IIS_MD_UT_SERVER, STRING_METADATA, (LPVOID)L"IIsWebVirtualDir");
ExitOnFailure(hr, "Failed to write key type for for VirtualDir");
! i = 0x4000003e; // 1073741886; // default directory browsing rights
hr = ScaWriteMetabaseValue(piMetabase, psvd->wzVDirRoot, L"", MD_DIRECTORY_BROWSING, METADATA_INHERIT, IIS_MD_UT_FILE, DWORD_METADATA, (LPVOID)((DWORD_PTR)i));
ExitOnFailure(hr, "Failed to set directory browsing for VirtualDir");
--- 187,191 ----
hr = ScaWriteMetabaseValue(piMetabase, psvd->wzVDirRoot, L"", MD_KEY_TYPE, METADATA_NO_ATTRIBUTES, IIS_MD_UT_SERVER, STRING_METADATA, (LPVOID)L"IIsWebVirtualDir");
ExitOnFailure(hr, "Failed to write key type for for VirtualDir");
! i = 0x4000003e; // 1073741886; // default directory browsing rights
hr = ScaWriteMetabaseValue(piMetabase, psvd->wzVDirRoot, L"", MD_DIRECTORY_BROWSING, METADATA_INHERIT, IIS_MD_UT_FILE, DWORD_METADATA, (LPVOID)((DWORD_PTR)i));
ExitOnFailure(hr, "Failed to set directory browsing for VirtualDir");
***************
*** 196,199 ****
--- 212,221 ----
}
+ if (psvd->pshh)
+ {
+ hr = ScaWriteHttpHeader(piMetabase, hhptVDir, psvd->wzVDirRoot, psvd->pshh);
+ ExitOnFailure(hr, "Failed to write custom HTTP headers for VirtualDir");
+ }
+
if (psvd->pswe)
{
***************
*** 211,215 ****
! HRESULT ScaVirtualDirsUninstall(IMSAdminBase* piMetabase, SCA_VDIR* psvdList)
{
Assert(piMetabase);
--- 233,240 ----
! HRESULT ScaVirtualDirsUninstall(
! __in IMSAdminBase* piMetabase,
! __in SCA_VDIR* psvdList
! )
{
Assert(piMetabase);
***************
*** 235,239 ****
void ScaVirtualDirsFreeList(
! SCA_VDIR* psvdList
)
{
--- 260,264 ----
void ScaVirtualDirsFreeList(
! __in SCA_VDIR* psvdList
)
{
***************
*** 260,264 ****
static HRESULT AddVirtualDirToList(
! SCA_VDIR** ppsvdList
)
{
--- 285,289 ----
static HRESULT AddVirtualDirToList(
! __in SCA_VDIR** ppsvdList
)
{
***************
*** 266,270 ****
SCA_VDIR* psvd = (SCA_VDIR*)MemAlloc(sizeof(SCA_VDIR), TRUE);
ExitOnNull(psvd, hr, E_OUTOFMEMORY, "failed to allocate memory for new vdir list element");
!
psvd->psvdNext= *ppsvdList;
*ppsvdList = psvd;
--- 291,295 ----
SCA_VDIR* psvd = (SCA_VDIR*)MemAlloc(sizeof(SCA_VDIR), TRUE);
ExitOnNull(psvd, hr, E_OUTOFMEMORY, "failed to allocate memory for new vdir list element");
!
psvd->psvdNext= *ppsvdList;
*ppsvdList = psvd;
***************
*** 275,279 ****
! HRESULT ScaVirtualDirGetAlias(__in LPCWSTR wzVirtualDir, __out LPWSTR* ppwzData)
{
Assert(wzVirtualDir && *wzVirtualDir);
--- 300,307 ----
! HRESULT ScaVirtualDirGetAlias(
! __in LPCWSTR wzVirtualDir,
! __out LPWSTR* ppwzData
! )
{
Assert(wzVirtualDir && *wzVirtualDir);
***************
*** 329,333 ****
! HRESULT ScaVirtualDirGetComponent(__in LPCWSTR wzVirtualDir, __out LPWSTR* ppwzData)
{
Assert(wzVirtualDir && *wzVirtualDir);
--- 357,364 ----
! HRESULT ScaVirtualDirGetComponent(
! __in LPCWSTR wzVirtualDir,
! __out LPWSTR* ppwzData
! )
{
Assert(wzVirtualDir && *wzVirtualDir);
Index: scassl.cpp
===================================================================
RCS file: /cvsroot/wix/wix/src/ca/serverca/scasched/scassl.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** scassl.cpp 19 Apr 2006 08:54:26 -0000 1.6
--- scassl.cpp 27 Jun 2007 05:35:59 -0000 1.7
***************
*** 19,923 ****
#include "precomp.h"
! // helpers
! HRESULT ScaGetCertificateByPath(LPCWSTR pwzName, BOOL fIsInstalling,
! BOOL fIsUninstalling, INT iStore,
! INT iStoreLocation, LPCWSTR wzSslCertificate,
! LPCWSTR wzPFXPassword, BSTR* pbstrCertificate,
! DWORD* pcbCertificate, BYTE* pbaHashBuffer);
!
! HRESULT ScaGetCertificateByRequest(LPCWSTR pwzName, BOOL fIsInstalling,
[...1274 lines suppressed...]
! MemFree(pswscDelete);
}
}
! static HRESULT AddSslCertificateToList(
! __in SCA_WEB_SSL_CERTIFICATE** ppswscList
! )
{
HRESULT hr = S_OK;
! SCA_WEB_SSL_CERTIFICATE* pswsc = (SCA_WEB_SSL_CERTIFICATE*)MemAlloc(sizeof(SCA_WEB_SSL_CERTIFICATE), TRUE);
! ExitOnNull(pswsc, hr, E_OUTOFMEMORY, "failed to allocate memory for new SSL certificate list element");
! pswsc->pNext = *ppswscList;
! *ppswscList = pswsc;
LExit:
return hr;
}
Index: scasched.cpp
===================================================================
RCS file: /cvsroot/wix/wix/src/ca/serverca/scasched/scasched.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** scasched.cpp 19 Apr 2006 08:54:26 -0000 1.7
--- scasched.cpp 27 Jun 2007 05:35:59 -0000 1.8
***************
*** 21,31 ****
/********************************************************************
! DllMain - standard entry point for all WiX CustomActions
********************************************************************/
extern "C" BOOL WINAPI DllMain(
! IN HINSTANCE hInst,
! IN ULONG ulReason,
! IN LPVOID)
{
switch(ulReason)
--- 21,32 ----
/********************************************************************
! DllMain - standard entry point for all WiX CustomActions
********************************************************************/
extern "C" BOOL WINAPI DllMain(
! __in HINSTANCE hInst,
! __in ULONG ulReason,
! __in LPVOID
! )
{
switch(ulReason)
***************
*** 45,54 ****
/********************************************************************
! ConfigureIIs - CUSTOM ACTION ENTRY POINT for installing IIs settings
********************************************************************/
! extern "C" UINT __stdcall ConfigureIIs(MSIHANDLE hInstall)
{
! //AssertSz(FALSE, "debug ConfigureIIs here");
HRESULT hr = S_OK;
UINT er = ERROR_SUCCESS;
--- 46,57 ----
/********************************************************************
! ConfigureIIs - CUSTOM ACTION ENTRY POINT for installing IIs settings
********************************************************************/
! extern "C" UINT __stdcall ConfigureIIs(
! __in MSIHANDLE hInstall
! )
{
! //AssertSz(FALSE, "debug ConfigureIIs here");
HRESULT hr = S_OK;
UINT er = ERROR_SUCCESS;
***************
*** 63,66 ****
--- 66,70 ----
SCA_APPPOOL *psapList = NULL;
SCA_MIMEMAP* psmmList = NULL;
+ SCA_HTTP_HEADER* pshhList = NULL;
SCA_PROPERTY *pspList = NULL;
SCA_WEBSVCEXT* psWseList = NULL;
***************
*** 115,126 ****
MessageExitOnFailure(hr, msierrIISFailedReadAppPool, "failed to read IIsAppPool table");
! // MimeMap and Error need to be read before the virtual directory and web read
hr = ScaMimeMapRead(&psmmList);
MessageExitOnFailure(hr, msierrIISFailedReadMimeMap, "failed to read IIsMimeMap table");
hr = ScaWebErrorRead(&psweList);
MessageExitOnFailure(hr, msierrIISFailedReadWebError, "failed to read IIsWebError table");
! hr = ScaWebsRead(piMetabase, &pswList, &psweList);
MessageExitOnFailure(hr, msierrIISFailedReadWebSite, "failed to read IIsWebSite table");
--- 119,133 ----
MessageExitOnFailure(hr, msierrIISFailedReadAppPool, "failed to read IIsAppPool table");
! // MimeMap, Error and HttpHeader need to be read before the virtual directory and web read
hr = ScaMimeMapRead(&psmmList);
MessageExitOnFailure(hr, msierrIISFailedReadMimeMap, "failed to read IIsMimeMap table");
+ hr = ScaHttpHeaderRead(&pshhList);
+ MessageExitOnFailure(hr, msierrIISFailedReadHttpHeader, "failed to read IIsHttpHeader table");
+
hr = ScaWebErrorRead(&psweList);
MessageExitOnFailure(hr, msierrIISFailedReadWebError, "failed to read IIsWebError table");
! hr = ScaWebsRead(piMetabase, &pswList, &pshhList, &psweList);
MessageExitOnFailure(hr, msierrIISFailedReadWebSite, "failed to read IIsWebSite table");
***************
*** 128,132 ****
MessageExitOnFailure(hr, msierrIISFailedReadWebDirs, "failed to read IIsWebDir table");
! hr = ScaVirtualDirsRead(piMetabase, pswList, &psvdList, &psmmList, &psweList);
MessageExitOnFailure(hr, msierrIISFailedReadVDirs, "failed to read IIsWebVirtualDir table");
--- 135,139 ----
MessageExitOnFailure(hr, msierrIISFailedReadWebDirs, "failed to read IIsWebDir table");
! hr = ScaVirtualDirsRead(piMetabase, pswList, &psvdList, &psmmList, &pshhList, &psweList);
MessageExitOnFailure(hr, msierrIISFailedReadVDirs, "failed to read IIsWebVirtualDir table");
***************
*** 180,191 ****
MessageExitOnFailure(hr, msierrIISFailedSchedInstallProp, "failed to schedule install of properties");
- // configure certificates here: need to write to the metabase to register SSL certificate
- // before the certificate is to be installed later through a deferred action
- // this action supports: remove on uninstall
- // NOSSL
- // SSLCERTIFICATE
- hr = ScaConfigureCertificates(piMetabase, pswList);
- ExitOnFailure(hr, "failed to configure certificates");
-
hr = ScaScheduleMetabaseConfiguration();
ExitOnFailure(hr, "failed to schedule metabase configuration");
--- 187,190 ----
***************
*** 193,209 ****
--- 192,218 ----
LExit:
if (psWseList)
+ {
ScaWebSvcExtFreeList(psWseList);
+ }
if (psfList)
+ {
ScaFiltersFreeList(psfList);
+ }
if (psvdList)
+ {
ScaVirtualDirsFreeList(psvdList);
+ }
if (pswdList)
+ {
ScaWebDirsFreeList(pswdList);
+ }
if (pswList)
+ {
ScaWebsFreeList(pswList);
+ }
if (psmmList)
***************
*** 213,216 ****
--- 222,231 ----
}
+ if (pshhList)
+ {
+ ScaHttpHeaderCheckList(pshhList);
+ ScaHttpHeaderFreeList(pshhList);
+ }
+
if (psweList)
{
***************
*** 220,421 ****
if (piMetabase)
- piMetabase->Release();
-
- if (fInitializedCom)
- ::CoUninitialize();
-
- er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
- return WcaFinalize(er);
- }
-
-
- /********************************************************************
- ConfigureSql - CUSTOM ACTION ENTRY POINT for installing Sql settings
-
- ********************************************************************/
- extern "C" UINT __stdcall ConfigureSql(MSIHANDLE hInstall)
- {
- //AssertSz(FALSE, "debug here");
- HRESULT hr = S_OK;
- UINT er = ERROR_SUCCESS;
-
- SCA_DB* psdList = NULL;
- SCA_SQLSTR* psssList = NULL;
-
- // initialize
- hr = WcaInitialize(hInstall, "ConfigureSql");
- ExitOnFailure(hr, "failed to initialize");
-
- // check for the prerequsite tables
- if (S_OK != WcaTableExists(L"SqlDatabase"))
{
! WcaLog(LOGMSG_VERBOSE, "skipping SQL CustomAction, no SqlDatabase table");
! ExitFunction1(hr = S_FALSE);
! }
!
! // read tables
! hr = ScaDbsRead(&psdList);
! ExitOnFailure(hr, "failed to read SqlDatabase table");
!
! hr = ScaSqlStrsRead(&psssList);
! ExitOnFailure(hr, "failed to read SqlStrings table");
!
! hr = ScaSqlStrsReadScripts(&psssList);
! ExitOnFailure(hr, "failed to read SqlScripts table");
!
!
! // do uninstall actions (order is important!)
! hr = ScaSqlStrsUninstall(psdList, psssList);
! ExitOnFailure(hr, "failed to execute uninstall SQL strings");
!
! hr = ScaDbsUninstall(psdList);
! ExitOnFailure(hr, "failed to uninstall databases");
!
! // do install actions (order is important!)
! hr = ScaDbsInstall(psdList);
! ExitOnFailure(hr, "failed to install databases");
!
! hr = ScaSqlStrsInstall(psdList, psssList);
! ExitOnFailure(hr, "failed to execute install SQL strings, length may be too long, try add GO to break up");
!
!
! LExit:
! if (psssList)
! ScaSqlStrsFreeList(psssList);
!
! if (psdList)
! ScaDbsFreeList(psdList);
!
! er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
! return WcaFinalize(er);
! }
!
!
!
! LPCWSTR vcsPerfMonQuery = L"SELECT `Component_`, `File`, `Name`"
! L"FROM `Perfmon`";
! enum ePerfMonQuery { pmqComponent = 1, pmqFile, pmqName };
!
! /********************************************************************
! RegisterPerfmon - CUSTOM ACTION ENTRY POINT for installing Perfmon counters
!
! ********************************************************************/
! extern "C" UINT __stdcall ConfigurePerfmonInstall(MSIHANDLE hInstall)
! {
! // Assert(FALSE);
! HRESULT hr;
! UINT er = ERROR_SUCCESS;
!
! PMSIHANDLE hView, hRec;
! LPWSTR pwzData = NULL, pwzName = NULL, pwzFile = NULL;
! INSTALLSTATE isInstalled, isAction;
!
! hr = WcaInitialize(hInstall, "ConfigurePerfmonInstall");
! ExitOnFailure(hr, "Failed to initialize");
!
! // check to see if necessary tables are specified
! if (S_OK != WcaTableExists(L"Perfmon"))
! {
! WcaLog(LOGMSG_VERBOSE, "Skipping RegisterPerfmon() because Perfmon table not present");
! ExitFunction1(hr = S_FALSE);
! }
!
! hr = WcaOpenExecuteView(vcsPerfMonQuery, &hView);
! ExitOnFailure(hr, "failed to open view on PerfMon table");
! while ((hr = WcaFetchRecord(hView, &hRec)) == S_OK)
! {
! // get component install state
! hr = WcaGetRecordString(hRec, pmqComponent, &pwzData);
! ExitOnFailure(hr, "failed to get Component for PerfMon");
! er = ::MsiGetComponentStateW(hInstall, pwzData, &isInstalled, &isAction);
! hr = HRESULT_FROM_WIN32(er);
! ExitOnFailure(hr, "failed to get Component state for PerfMon");
! if (!WcaIsInstalling(isInstalled, isAction))
! continue;
!
! hr = WcaGetRecordString(hRec, pmqName, &pwzName);
! ExitOnFailure(hr, "failed to get Name for PerfMon");
!
! hr = WcaGetRecordFormattedString(hRec, pmqFile, &pwzFile);
! ExitOnFailure(hr, "failed to get File for PerfMon");
!
! WcaLog(LOGMSG_VERBOSE, "ConfigurePerfmonInstall's CustomActionData: '%S', '%S'", pwzName, pwzFile);
! hr = WcaDoDeferredAction(L"RegisterPerfmon", pwzFile, COST_PERFMON_REGISTER);
! ExitOnFailure(hr, "failed to schedule RegisterPerfmon action");
! hr = WcaDoDeferredAction(L"RollbackRegisterPerfmon", pwzName, COST_PERFMON_UNREGISTER);
! ExitOnFailure(hr, "failed to schedule RollbackRegisterPerfmon action");
! }
! if (hr == E_NOMOREITEMS)
! hr = S_OK;
! ExitOnFailure(hr, "Failure while processing PerfMon");
! hr = S_OK;
!
! LExit:
! ReleaseStr(pwzData);
! ReleaseStr(pwzName);
! ReleaseStr(pwzFile);
!
! er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
! return WcaFinalize(er);
! }
!
!
! /********************************************************************
! ConfigurePerfmonUninstall - CUSTOM ACTION ENTRY POINT for uninstalling
! Perfmon counters
!
! ********************************************************************/
! extern "C" UINT __stdcall ConfigurePerfmonUninstall(MSIHANDLE hInstall)
! {
! // Assert(FALSE);
! HRESULT hr;
! UINT er = ERROR_SUCCESS;
!
! PMSIHANDLE hView, hRec;
! LPWSTR pwzData = NULL, pwzName = NULL, pwzFile = NULL;
! INSTALLSTATE isInstalled, isAction;
!
! hr = WcaInitialize(hInstall, "ConfigurePerfmonUninstall");
! ExitOnFailure(hr, "Failed to initialize");
!
! // check to see if necessary tables are specified
! if (WcaTableExists(L"Perfmon") != S_OK)
! {
! WcaLog(LOGMSG_VERBOSE, "Skipping UnregisterPerfmon() because Perfmon table not present");
! ExitFunction1(hr = S_FALSE);
}
! hr = WcaOpenExecuteView(vcsPerfMonQuery, &hView);
! ExitOnFailure(hr, "failed to open view on PerfMon table");
! while ((hr = WcaFetchRecord(hView, &hRec)) == S_OK)
{
! // get component install state
! hr = WcaGetRecordString(hRec, pmqComponent, &pwzData);
! ExitOnFailure(hr, "failed to get Component for PerfMon");
! er = ::MsiGetComponentStateW(hInstall, pwzData, &isInstalled, &isAction);
! hr = HRESULT_FROM_WIN32(er);
! ExitOnFailure(hr, "failed to get Component state for PerfMon");
! if (!WcaIsUninstalling(isInstalled, isAction))
! continue;
! hr = WcaGetRecordString(hRec, pmqName, &pwzName);
! ExitOnFailure(hr, "failed to get Name for PerfMon");
!
! hr = WcaGetRecordFormattedString(hRec, pmqFile, &pwzFile);
! ExitOnFailure(hr, "failed to get File for PerfMon");
!
! WcaLog(LOGMSG_VERBOSE, "ConfigurePerfmonUninstall's CustomActionData: '%S', '%S'", pwzName, pwzFile);
! hr = WcaDoDeferredAction(L"UnregisterPerfmon", pwzName, COST_PERFMON_UNREGISTER);
! ExitOnFailure(hr, "failed to schedule UnregisterPerfmon action");
! hr = WcaDoDeferredAction(L"RollbackUnregisterPerfmon", pwzFile, COST_PERFMON_REGISTER);
! ExitOnFailure(hr, "failed to schedule RollbackUnregisterPerfmon action");
}
- if (hr == E_NOMOREITEMS)
- hr = S_OK;
- ExitOnFailure(hr, "Failure while processing PerfMon");
- hr = S_OK;
- LExit:
- ReleaseStr(pwzData);
- ReleaseStr(pwzName);
- ReleaseStr(pwzFile);
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
--- 235,246 ----
if (piMetabase)
{
! piMetabase->Release();
}
! if (fInitializedCom)
{
! ::CoUninitialize();
}
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
***************
*** 425,432 ****
/********************************************************************
! ConfigureSmb - CUSTOM ACTION ENTRY POINT for installing fileshare settings
********************************************************************/
! extern "C" UINT __stdcall ConfigureSmb(MSIHANDLE hInstall)
{
HRESULT hr = S_OK;
--- 250,259 ----
/********************************************************************
! ConfigureSmb - CUSTOM ACTION ENTRY POINT for installing fileshare settings
********************************************************************/
! extern "C" UINT __stdcall ConfigureSmb(
! __in MSIHANDLE hInstall
! )
{
HRESULT hr = S_OK;
***************
*** 467,474 ****
/********************************************************************
! ConfigureUsers - CUSTOM ACTION ENTRY POINT for installing users
********************************************************************/
! extern "C" UINT __stdcall ConfigureUsers(MSIHANDLE hInstall)
{
//AssertSz(0, "Debug ConfigureUsers");
--- 294,303 ----
/********************************************************************
! ConfigureUsers - CUSTOM ACTION ENTRY POINT for installing users
********************************************************************/
! extern "C" UINT __stdcall ConfigureUsers(
! __in MSIHANDLE hInstall
! )
{
//AssertSz(0, "Debug ConfigureUsers");
***************
*** 491,495 ****
--- 320,326 ----
LExit:
if (psuList)
+ {
ScaUserFreeList(psuList);
+ }
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
Index: scaiis.cpp
===================================================================
RCS file: /cvsroot/wix/wix/src/ca/serverca/scasched/scaiis.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** scaiis.cpp 19 Apr 2006 08:54:26 -0000 1.5
--- scaiis.cpp 27 Jun 2007 05:35:59 -0000 1.6
***************
*** 28,46 ****
HRESULT ScaMetabaseTransaction(LPCWSTR wzBackup)
{
! HRESULT hr = S_OK;
! // TODO: These functions have been reported to hang IIS (O11:51709). They may have been fixed in IIS6, but if not, need to be re-written the hard way
! hr = WcaDoDeferredAction(L"StartMetabaseTransaction", wzBackup, COST_IIS_TRANSACTIONS);
! ExitOnFailure(hr, "Failed to schedule StartMetabaseTransaction");
! hr = WcaDoDeferredAction(L"RollbackMetabaseTransaction", wzBackup, 0); // rollback cost is irrelevant
! ExitOnFailure(hr, "Failed to schedule RollbackMetabaseTransaction");
! hr = WcaDoDeferredAction(L"CommitMetabaseTransaction", wzBackup, 0); // commit is free
! ExitOnFailure(hr, "Failed to schedule StartMetabaseTransaction");
LExit:
! return hr;
}
--- 28,46 ----
HRESULT ScaMetabaseTransaction(LPCWSTR wzBackup)
{
! HRESULT hr = S_OK;
! // TODO: These functions have been reported to hang IIS (O11:51709). They may have been fixed in IIS6, but if not, need to be re-written the hard way
! hr = WcaDoDeferredAction(L"StartMetabaseTransaction", wzBackup, COST_IIS_TRANSACTIONS);
! ExitOnFailure(hr, "Failed to schedule StartMetabaseTransaction");
! hr = WcaDoDeferredAction(L"RollbackMetabaseTransaction", wzBackup, 0); // rollback cost is irrelevant
! ExitOnFailure(hr, "Failed to schedule RollbackMetabaseTransaction");
! hr = WcaDoDeferredAction(L"CommitMetabaseTransaction", wzBackup, 0); // commit is free
! ExitOnFailure(hr, "Failed to schedule StartMetabaseTransaction");
LExit:
! return hr;
}
***************
*** 48,83 ****
HRESULT ScaCreateWeb(IMSAdminBase* piMetabase, LPCWSTR wzWeb, LPCWSTR wzWebBase)
{
! Assert(piMetabase);
! HRESULT hr = S_OK;
! UINT ui = 0;
! hr = ScaCreateMetabaseKey(piMetabase, wzWebBase, L"");
! ExitOnFailure(hr, "Failed to create web");
! hr = ScaWriteMetabaseValue(piMetabase, wzWebBase, L"", MD_KEY_TYPE, METADATA_NO_ATTRIBUTES, IIS_MD_UT_SERVER, STRING_METADATA, (LPVOID)L"IIsWebServer");
! ExitOnFailure(hr, "Failed to set key type for web");
! hr = ScaCreateMetabaseKey(piMetabase, wzWebBase, L"Root");
! ExitOnFailure(hr, "Failed to create web root");
! hr = ScaWriteMetabaseValue(piMetabase, wzWebBase, L"Root", MD_KEY_TYPE, METADATA_NO_ATTRIBUTES, IIS_MD_UT_SERVER, STRING_METADATA, (LPVOID)L"IIsWebVirtualDir");
! ExitOnFailure(hr, "Failed to set key type for web root");
! ui = 0x4000003e; // 1073741886; // default directory browsing rights
! hr = ScaWriteMetabaseValue(piMetabase, wzWebBase, L"Root", MD_DIRECTORY_BROWSING, METADATA_INHERIT, IIS_MD_UT_FILE, DWORD_METADATA, (LPVOID)((DWORD_PTR)ui));
! ExitOnFailure(hr, "Failed to set directory browsing for web");
! hr = ScaCreateMetabaseKey(piMetabase, wzWebBase, L"Filters");
! ExitOnFailure(hr, "Failed to create web filters root");
! hr = ScaWriteMetabaseValue(piMetabase, wzWebBase, L"Filters", MD_KEY_TYPE, METADATA_NO_ATTRIBUTES, IIS_MD_UT_SERVER, STRING_METADATA, (LPVOID)L"IIsFilters");
! ExitOnFailure(hr, "Failed to set key for web filters root");
! hr = ScaWriteMetabaseValue(piMetabase, wzWebBase, L"Filters", MD_FILTER_LOAD_ORDER, METADATA_NO_ATTRIBUTES, IIS_MD_UT_SERVER, STRING_METADATA, (LPVOID)L"");
! ExitOnFailure(hr, "Failed to set empty load order for web");
LExit:
! return hr;
}
--- 48,83 ----
HRESULT ScaCreateWeb(IMSAdminBase* piMetabase, LPCWSTR wzWeb, LPCWSTR wzWebBase)
{
! Assert(piMetabase);
! HRESULT hr = S_OK;
! UINT ui = 0;
! hr = ScaCreateMetabaseKey(piMetabase, wzWebBase, L"");
! ExitOnFailure(hr, "Failed to create web");
! hr = ScaWriteMetabaseValue(piMetabase, wzWebBase, L"", MD_KEY_TYPE, METADATA_NO_ATTRIBUTES, IIS_MD_UT_SERVER, STRING_METADATA, (LPVOID)L"IIsWebServer");
! ExitOnFailure(hr, "Failed to set key type for web");
! hr = ScaCreateMetabaseKey(piMetabase, wzWebBase, L"Root");
! ExitOnFailure(hr, "Failed to create web root");
! hr = ScaWriteMetabaseValue(piMetabase, wzWebBase, L"Root", MD_KEY_TYPE, METADATA_NO_ATTRIBUTES, IIS_MD_UT_SERVER, STRING_METADATA, (LPVOID)L"IIsWebVirtualDir");
! ExitOnFailure(hr, "Failed to set key type for web root");
! ui = 0x4000003e; // 1073741886; // default directory browsing rights
! hr = ScaWriteMetabaseValue(piMetabase, wzWebBase, L"Root", MD_DIRECTORY_BROWSING, METADATA_INHERIT, IIS_MD_UT_FILE, DWORD_METADATA, (LPVOID)((DWORD_PTR)ui));
! ExitOnFailure(hr, "Failed to set directory browsing for web");
! hr = ScaCreateMetabaseKey(piMetabase, wzWebBase, L"Filters");
! ExitOnFailure(hr, "Failed to create web filters root");
! hr = ScaWriteMetabaseValue(piMetabase, wzWebBase, L"Filters", MD_KEY_TYPE, METADATA_NO_ATTRIBUTES, IIS_MD_UT_SERVER, STRING_METADATA, (LPVOID)L"IIsFilters");
! ExitOnFailure(hr, "Failed to set key for web filters root");
! hr = ScaWriteMetabaseValue(piMetabase, wzWebBase, L"Filters", MD_FILTER_LOAD_ORDER, METADATA_NO_ATTRIBUTES, IIS_MD_UT_SERVER, STRING_METADATA, (LPVOID)L"");
! ExitOnFailure(hr, "Failed to set empty load order for web");
LExit:
! return hr;
}
***************
*** 86,377 ****
DWORD dwIsolation)
{
! Assert(piMetabase);
! Unused(piMetabase);
!
! HRESULT hr = S_OK;
! WCHAR wzKey[METADATA_MAX_NAME_LEN];
! BOOL fInProc = FALSE;
!
! WCHAR* pwzCustomActionData = NULL;
!
! hr = WcaWriteIntegerToCaData(MBA_CREATEAPP, &pwzCustomActionData);
! ExitOnFailure(hr, "Failed to add metabase create app directive to CustomActionData");
!
! StringCchCopyW(wzKey, countof(wzKey), wzWebRoot);
! hr = WcaWriteStringToCaData(wzKey, &pwzCustomActionData);
! ExitOnFailure(hr, "Failed to add metabase key to CustomActionData");
!
! if (0 == dwIsolation)
! fInProc = TRUE;
! else
! fInProc = FALSE;
!
! hr = WcaWriteIntegerToCaData(fInProc, &pwzCustomActionData);
! ExitOnFailure(hr, "Failed to add isolation value to CustomActionData");
!
! hr = ScaAddToMetabaseConfiguration(pwzCustomActionData, COST_IIS_CREATEAPP);
! ExitOnFailure2(hr, "Failed to add ScaCreateApp action data: %S cost: %d", pwzCustomActionData, COST_IIS_CREATEAPP);
!
! LExit:
! ReleaseStr(pwzCustomActionData);
!
! return hr;
! }
!
!
! HRESULT ScaAddFilterToLoadOrder(IMSAdminBase* piMetabase, LPCWSTR wzFilterRoot,
! LPCWSTR wzFilter, int iLoadOrder)
! {
! Assert(piMetabase);
!
! HRESULT hr = S_OK;
!
! METADATA_HANDLE mhRoot = 0;
! int i;
! int cFilter = lstrlenW(wzFilter);
!
! METADATA_RECORD mr;
! DWORD dwRequired = 0;
! DWORD cchData = 255;
! ::ZeroMemory(&mr, sizeof(mr));
! mr.dwMDIdentifier = MD_FILTER_LOAD_ORDER;
! mr.dwMDAttributes = METADATA_NO_ATTRIBUTES;
! mr.dwMDUserType = IIS_MD_UT_SERVER;
! mr.dwMDDataType = ALL_METADATA;
! mr.dwMDDataLen = cchData;
! mr.pbMDData = (BYTE*)new WCHAR[mr.dwMDDataLen];
! ExitOnNull(mr.pbMDData, hr, E_OUTOFMEMORY, "failed to allocate memory for MDData in metadata record");
! ::ZeroMemory(mr.pbMDData, mr.dwMDDataLen * sizeof(WCHAR));
!
! WCHAR* pwzLoadOrder = NULL;
! DWORD cchLoadOrder = 0;
! LPWSTR pwz = NULL;
!
! hr = piMetabase->OpenKey(METADATA_MASTER_ROOT_HANDLE, wzFilterRoot, METADATA_PERMISSION_READ | METADATA_PERMISSION_WRITE, 10, &mhRoot);
! for (i = 0; i < 30 && HRESULT_FROM_WIN32(ERROR_PATH_BUSY) == hr; i++)
! {
! ::Sleep(1000);
! WcaLog(LOGMSG_STANDARD, "Failed to open root key, retrying %d time(s)...", i);
! hr = piMetabase->OpenKey(METADATA_MASTER_ROOT_HANDLE, wzFilterRoot, METADATA_PERMISSION_READ | METADATA_PERMISSION_WRITE, 10, &mhRoot);
! }
!
! if (SUCCEEDED(hr))
! {
! hr = piMetabase->GetData(mhRoot, L"", &mr, &dwRequired);
! if (HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) == hr)
! {
! mr.dwMDDataLen = cchData = dwRequired;
! delete [] mr.pbMDData;
! mr.pbMDData = (BYTE*)new WCHAR[mr.dwMDDataLen];
! ExitOnNull(mr.pbMDData, hr, E_OUTOFMEMORY, "failed to allocate memory for MDData in metadata record");
! ::ZeroMemory(mr.pbMDData, mr.dwMDDataLen * sizeof(WCHAR));
!
! hr = piMetabase->GetData(mhRoot, L"", &mr, &dwRequired);
! }
! }
!
! //
! // Allow adding a Filter if /Filters node or /Filters/FilterLoadOrder property
! // doesn't exist (yet)
! //
! if (HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) == hr || MD_ERROR_DATA_NOT_FOUND == hr)
! hr = S_OK;
! ExitOnFailure(hr, "Failed to get filter load order");
!
! //
! // If the filter name ends with '\0' or ',' and
! // the filter name begins at the beginning of the list or with ','
! // Then we've found the exact filter by name.
! //
! // If the filter isn't already in the load order, add it
! //
! if (mr.pbMDData)
! {
! pwz = const_cast(wcsstr(reinterpret_cast(mr.pbMDData), wzFilter));
!
! if (NULL != pwz &&
! (L'\0' == *(pwz + cFilter) || L',' == *(pwz + cFilter)) &&
! (pwz == reinterpret_cast(mr.pbMDData) || L',' == *(pwz-1)))
! {
! }
! else
! {
! pwz = NULL;
! if (0 CloseKey(mhRoot);
!
! return hr;
! }
!
!
! HRESULT ScaRemoveFilterFromLoadOrder(IMSAdminBase* piMetabase,
! LPCWSTR wzFilterRoot, LPCWSTR wzFilter)
! {
! Assert(piMetabase);
! HRESULT hr = S_OK;
!
! METADATA_HANDLE mhRoot = 0;
! int i;
! int cFilter = lstrlenW(wzFilter);
!
! LPCWSTR pwzStart = NULL;
! LPCWSTR pwzFind = NULL;
! LPCWSTR pwzNext = NULL;
! LPWSTR pwzLoadOrder = NULL;
! DWORD cchLoadOrder = 0;
!
! DWORD cchData = 0;
! METADATA_RECORD mr;
! ::ZeroMemory(&mr, sizeof(mr));
! mr.dwMDIdentifier = MD_FILTER_LOAD_ORDER;
! mr.dwMDAttributes = METADATA_NO_ATTRIBUTES;
! mr.dwMDUserType = IIS_MD_UT_SERVER;
! mr.dwMDDataType = ALL_METADATA;
! mr.dwMDDataLen = cchData = 0;
! mr.pbMDData = NULL;
!
! // open the filter metabase key
! hr = piMetabase->OpenKey(METADATA_MASTER_ROOT_HANDLE, wzFilterRoot, METADATA_PERMISSION_READ | METADATA_PERMISSION_WRITE, 10, &mhRoot);
! for (i = 0; i < 30 && HRESULT_FROM_WIN32(ERROR_PATH_BUSY) == hr; i++)
! {
! ::Sleep(1000);
! WcaLog(LOGMSG_STANDARD, "Failed to open root key, retrying %d time(s)...", i);
! hr = piMetabase->OpenKey(METADATA_MASTER_ROOT_HANDLE, wzFilterRoot, METADATA_PERMISSION_READ | METADATA_PERMISSION_WRITE, 10, &mhRoot);
! }
!
! if (HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) == hr || MD_ERROR_DATA_NOT_FOUND == hr)
! {
! WcaLog(LOGMSG_STANDARD, "No Filter to remove at path: '%S'", wzFilterRoot);
! hr = S_OK;
! ExitFunction();
! }
! ExitOnFailure(hr, "Failed to open filter root key");
!
! hr = MetaGetValue(piMetabase, mhRoot, L"", &mr);
! ExitOnFailure1(hr, "Failed to get load order for '%S'", wzFilterRoot);
! ExitOnNull1(mr.pbMDData, hr, E_UNEXPECTED, "Failed to get load order for '%S'", wzFilterRoot);
!
! pwzStart = (LPWSTR)mr.pbMDData;
! do
! {
! if (!pwzFind)
! pwzFind = pwzStart;
! else
! pwzFind += cFilter;
!
! pwzFind = wcsstr(pwzFind, wzFilter);
! if (!pwzFind)
! break;
!
! //
! // Make sure to only match [wzFilter] and NOT foobar[wzFilter]
! //
! if ( pwzFind > pwzStart && L',' != *(pwzFind-1) )
! continue;
!
! if (L',' == *(pwzFind + cFilter))
! pwzNext = pwzFind + cFilter + 1;
! else if(L'\0' == *(pwzFind + cFilter))
! pwzNext = pwzFind + cFilter;
! }while (!pwzNext);
! if (!pwzFind)
! {
! hr = S_FALSE;
! WcaLog(LOGMSG_STANDARD, "Filter '%S' was not load order: '%S'", wzFilter, wzFilterRoot);
! ExitFunction();
! }
! cchLoadOrder = mr.dwMDDataLen + 1;
! pwzLoadOrder = new WCHAR[cchLoadOrder];
! ::ZeroMemory(pwzLoadOrder, (mr.dwMDDataLen + 1) * sizeof(WCHAR));
! //
! // The substring of FilterLoadOrder PRIOR to "Filter", not including trailing ","
! // If "Filter" was first, string remains "" because of ZeroMemory(pwzLoadOrder) above
! //
! if (pwzFind != pwzStart)
! {
! StringCchCopyNW(pwzLoadOrder, cchLoadOrder, pwzStart, pwzFind - pwzStart - 1);
! }
! //
! // If the "Filter" being removed is not first or last, add a ","
! //
! if (pwzFind != pwzStart && NULL != *pwzNext )
! {
! StringCchCatW(pwzLoadOrder, cchLoadOrder, L",");
! }
! //
! // The substring of FilterLoadOrder AFTER "Filter", not including any leading ","
! // pwzNext is "" if "Filter" is last
! //
! StringCchCatW(pwzLoadOrder, cchLoadOrder, pwzNext);
! //
! // TODO: Finally, remove ANY other instance of wzFilter in pwzLoadOrder
! //
! hr = ScaWriteMetabaseValue(piMetabase, wzFilterRoot, L"", MD_FILTER_LOAD_ORDER, METADATA_NO_ATTRIBUTES, IIS_MD_UT_SERVER, STRING_METADATA, (LPVOID)pwzLoadOrder);
! ExitOnFailure1(hr, "Failed to remove Filter '%S'from load order", wzFilter);
LExit:
! if (pwzLoadOrder)
! delete [] pwzLoadOrder;
!
! MetaFreeValue(&mr);
!
! if (mhRoot)
! piMetabase->CloseKey(mhRoot);
! return hr;
}
--- 86,120 ----
DWORD dwIsolation)
{
! Assert(piMetabase);
! Unused(piMetabase);
! HRESULT hr = S_OK;
! WCHAR wzKey[METADATA_MAX_NAME_LEN];
! BOOL fInProc = FALSE;
! WCHAR* pwzCustomActionData = NULL;
! hr = WcaWriteIntegerToCaData(MBA_CREATEAPP, &pwzCustomActionData);
! ExitOnFailure(hr, "Failed to add metabase create app directive to CustomActionData");
! StringCchCopyW(wzKey, countof(wzKey), wzWebRoot);
! hr = WcaWriteStringToCaData(wzKey, &pwzCustomActionData);
! ExitOnFailure(hr, "Failed to add metabase key to CustomActionData");
! if (0 == dwIsolation)
! fInProc = TRUE;
! else
! fInProc = FALSE;
! hr = WcaWriteIntegerToCaData(fInProc, &pwzCustomActionData);
! ExitOnFailure(hr, "Failed to add isolation value to CustomActionData");
! hr = ScaAddToMetabaseConfiguration(pwzCustomActionData, COST_IIS_CREATEAPP);
! ExitOnFailure2(hr, "Failed to add ScaCreateApp action data: %S cost: %d", pwzCustomActionData, COST_IIS_CREATEAPP);
LExit:
! ReleaseStr(pwzCustomActionData);
! return hr;
}
***************
*** 380,414 ****
LPCWSTR wzSubKey)
{
! Assert(piMetabase);
! Unused(piMetabase);
! HRESULT hr = S_OK;
! WCHAR wzKey[METADATA_MAX_NAME_LEN];
! WCHAR* pwzCustomActionData = NULL;
! StringCchCopyW(wzKey, countof(wzKey), wzRootKey);
! if (L'/' != *(wzKey + lstrlenW(wzRootKey)))
! StringCchCatW(wzKey, countof(wzKey), L"/");
! if (wzSubKey && *wzSubKey)
! {
! if (L'/' == *wzSubKey)
! StringCchCatW(wzKey, countof(wzKey), wzSubKey + 1);
! else
! StringCchCatW(wzKey, countof(wzKey), wzSubKey);
! }
! hr = WcaWriteIntegerToCaData(MBA_CREATEKEY, &pwzCustomActionData);
! ExitOnFailure(hr, "Failed to add metabase delete key directive to CustomActionData");
! hr = WcaWriteStringToCaData(wzKey, &pwzCustomActionData);
! ExitOnFailure(hr, "Failed to add metabase key to CustomActionData");
! hr = ScaAddToMetabaseConfiguration(pwzCustomActionData, COST_IIS_CREATEKEY);
! ExitOnFailure2(hr, "Failed to add ScaCreateMetabaseKey action data: %S cost: %d", pwzCustomActionData, COST_IIS_CREATEKEY);
LExit:
! ReleaseStr(pwzCustomActionData);
! return hr;
}
--- 123,157 ----
LPCWSTR wzSubKey)
{
! Assert(piMetabase);
! Unused(piMetabase);
! HRESULT hr = S_OK;
! WCHAR wzKey[METADATA_MAX_NAME_LEN];
! WCHAR* pwzCustomActionData = NULL;
! StringCchCopyW(wzKey, countof(wzKey), wzRootKey);
! if (L'/' != *(wzKey + lstrlenW(wzRootKey)))
! StringCchCatW(wzKey, countof(wzKey), L"/");
! if (wzSubKey && *wzSubKey)
! {
! if (L'/' == *wzSubKey)
! StringCchCatW(wzKey, countof(wzKey), wzSubKey + 1);
! else
! StringCchCatW(wzKey, countof(wzKey), wzSubKey);
! }
! hr = WcaWriteIntegerToCaData(MBA_CREATEKEY, &pwzCustomActionData);
! ExitOnFailure(hr, "Failed to add metabase delete key directive to CustomActionData");
! hr = WcaWriteStringToCaData(wzKey, &pwzCustomActionData);
! ExitOnFailure(hr, "Failed to add metabase key to CustomActionData");
! hr = ScaAddToMetabaseConfiguration(pwzCustomActionData, COST_IIS_CREATEKEY);
! ExitOnFailure2(hr, "Failed to add ScaCreateMetabaseKey action data: %S cost: %d", pwzCustomActionData, COST_IIS_CREATEKEY);
LExit:
! ReleaseStr(pwzCustomActionData);
! return hr;
}
***************
*** 417,451 ****
LPCWSTR wzSubKey)
{
! Assert(piMetabase);
! Unused(piMetabase);
! HRESULT hr = S_OK;
! WCHAR wzKey[METADATA_MAX_NAME_LEN];
! WCHAR* pwzCustomActionData = NULL;
! StringCchCopyW(wzKey, countof(wzKey), wzRootKey);
! if (L'/' != *(wzKey + lstrlenW(wzRootKey)))
! StringCchCatW(wzKey, countof(wzKey), L"/");
! if (*wzSubKey)
! {
! if (L'/' == *wzSubKey)
! StringCchCatW(wzKey, countof(wzKey), wzSubKey + 1);
! else
! StringCchCatW(wzKey, countof(wzKey), wzSubKey);
! }
! hr = WcaWriteIntegerToCaData(MBA_DELETEKEY, &pwzCustomActionData);
! ExitOnFailure(hr, "Failed to add metabase delete key directive to CustomActionData");
! hr = WcaWriteStringToCaData(wzKey, &pwzCustomActionData);
! ExitOnFailure(hr, "Failed to add metabase key to CustomActionData");
! hr = ScaAddToMetabaseConfiguration(pwzCustomActionData, COST_IIS_DELETEKEY);
! ExitOnFailure2(hr, "Failed to add ScaDeleteMetabaseKey action data: %S cost: %d", pwzCustomActionData, COST_IIS_DELETEKEY);
LExit:
! ReleaseStr(pwzCustomActionData);
! return hr;
}
--- 160,194 ----
LPCWSTR wzSubKey)
{
! Assert(piMetabase);
! Unused(piMetabase);
! HRESULT hr = S_OK;
! WCHAR wzKey[METADATA_MAX_NAME_LEN];
! WCHAR* pwzCustomActionData = NULL;
! StringCchCopyW(wzKey, countof(wzKey), wzRootKey);
! if (L'/' != *(wzKey + lstrlenW(wzRootKey)))
! StringCchCatW(wzKey, countof(wzKey), L"/");
! if (*wzSubKey)
! {
! if (L'/' == *wzSubKey)
! StringCchCatW(wzKey, countof(wzKey), wzSubKey + 1);
! else
! StringCchCatW(wzKey, countof(wzKey), wzSubKey);
! }
! hr = WcaWriteIntegerToCaData(MBA_DELETEKEY, &pwzCustomActionData);
! ExitOnFailure(hr, "Failed to add metabase delete key directive to CustomActionData");
! hr = WcaWriteStringToCaData(wzKey, &pwzCustomActionData);
! ExitOnFailure(hr, "Failed to add metabase key to CustomActionData");
! hr = ScaAddToMetabaseConfiguration(pwzCustomActionData, COST_IIS_DELETEKEY);
! ExitOnFailure2(hr, "Failed to add ScaDeleteMetabaseKey action data: %S cost: %d", pwzCustomActionData, COST_IIS_DELETEKEY);
LExit:
! ReleaseStr(pwzCustomActionData);
! return hr;
}
***************
*** 456,600 ****
DWORD dwDataType, LPVOID pvData)
{
! Assert(piMetabase && (pvData || (DWORD_METADATA == dwDataType))); // pvData may be 0 if it is DWORD data
! Unused(piMetabase);
! HRESULT hr = S_OK;
! WCHAR wzKey[METADATA_MAX_NAME_LEN];
! WCHAR* pwzCustomActionData = NULL;
! StringCchCopyW(wzKey, countof(wzKey), wzRootKey);
! if (L'/' != *(wzKey + lstrlenW(wzRootKey)))
! StringCchCatW(wzKey, countof(wzKey), L"/");
! if (wzSubKey && *wzSubKey)
! {
! if (L'/' == *wzSubKey)
! StringCchCatW(wzKey, countof(wzKey), wzSubKey + 1);
! else
! StringCchCatW(wzKey, countof(wzKey), wzSubKey);
! }
! hr = WcaWriteIntegerToCaData(MBA_WRITEKEY, &pwzCustomActionData);
! ExitOnFailure(hr, "Failed to add metabase write key directive to CustomActionData");
! hr = WcaWriteStringToCaData(wzKey, &pwzCustomActionData);
! ExitOnFailure(hr, "Failed to add metabase key to CustomActionData");
! hr = WcaWriteIntegerToCaData(dwIdentifier, &pwzCustomActionData);
! ExitOnFailure(hr, "Failed to add metabase identifier to CustomActionData");
! hr = WcaWriteIntegerToCaData(dwAttributes, &pwzCustomActionData);
! ExitOnFailure(hr, "Failed to add metabase attributes to CustomActionData");
! hr = WcaWriteIntegerToCaData(dwUserType, &pwzCustomActionData);
! ExitOnFailure(hr, "Failed to add metabase user type to CustomActionData");
! hr = WcaWriteIntegerToCaData(dwDataType, &pwzCustomActionData);
! ExitOnFailure(hr, "Failed to add metabase data type to CustomActionData");
! switch (dwDataType)
! {
! case DWORD_METADATA:
! hr = WcaWriteIntegerToCaData((DWORD)((DWORD_PTR)pvData), &pwzCustomActionData);
! break;
! case STRING_METADATA:
! hr = WcaWriteStringToCaData((LPCWSTR)pvData, &pwzCustomActionData);
! break;
! case MULTISZ_METADATA:
! {
! // change NULLs to unprintable character to create a 'safe' MULTISZ string
! LPWSTR pwz = (LPWSTR)pvData;
! for (;;)
! {
! if ('\0' == *pwz)
! {
! *pwz = MAGIC_MULTISZ_CHAR;
! if ('\0' == *(pwz + 1)) // second null back to back means end of string
! break;
! }
! pwz++;
! }
! hr = WcaWriteStringToCaData((LPCWSTR)pvData, &pwzCustomActionData);
! }
! break;
! case BINARY_METADATA:
! hr = WcaWriteStreamToCaData(((BLOB*) pvData)->pBlobData, ((BLOB*) pvData)->cbSize, &pwzCustomActionData);
! break;
! default:
! hr = E_UNEXPECTED;
! }
! ExitOnFailure(hr, "Failed to add metabase data to CustomActionData");
! // TODO: maybe look the key up and make sure we're not just writing the same value that already there
! hr = ScaAddToMetabaseConfiguration(pwzCustomActionData, COST_IIS_WRITEKEY);
! ExitOnFailure2(hr, "Failed to add ScaWriteMetabaseValue action data: %S, cost: %d", pwzCustomActionData, COST_IIS_WRITEKEY);
LExit:
! ReleaseStr(pwzCustomActionData);
! return hr;
}
static HRESULT ScaAddToMetabaseConfiguration(LPCWSTR pwzData, DWORD dwCost)
{
! HRESULT hr = S_OK;
! hr = WcaWriteStringToCaData(pwzData, &vpwzCustomActionData);
! ExitOnFailure1(hr, "failed to add to metabase configuration data string: %S", pwzData);
! vdwCustomActionCost += dwCost;
LExit:
! return hr;
}
HRESULT ScaScheduleMetabaseConfiguration()
{
! HRESULT hr = S_OK;
! if (vpwzCustomActionData && *vpwzCustomActionData)
! {
! hr = WcaDoDeferredAction(L"WriteMetabaseChanges", vpwzCustomActionData, vdwCustomActionCost);
! ExitOnFailure(hr, "Failed to schedule ConfigureMetabase custom action");
! ReleaseStr(vpwzCustomActionData);
! }
! else
! hr = S_FALSE;
LExit:
! return hr;
}
HRESULT ScaLoadMetabase(IMSAdminBase** ppiMetabase)
{
! HRESULT hr = S_OK;
! UINT er = ERROR_SUCCESS;
! // if IIS was uninstalled (thus no IID_IMSAdminBase) allow the
! // user to still uninstall this package by clicking "Ignore"
! do
! {
! hr = ::CoCreateInstance(CLSID_MSAdminBase, NULL, CLSCTX_ALL, IID_IMSAdminBase, (void**)ppiMetabase);
! if (FAILED(hr))
! {
! WcaLog(LOGMSG_STANDARD, "failed to get IID_IMSAdminBase Object");
! er = WcaErrorMessage(msierrIISCannotConnect, hr, INSTALLMESSAGE_ERROR | MB_ABORTRETRYIGNORE, 0);
! switch (er)
! {
! case IDABORT:
! ExitFunction(); // bail with the error result from the CoCreate to kick off a rollback
! case IDRETRY:
! hr = S_FALSE; // hit me, baby, one more time
! break;
! case IDIGNORE:
! hr = S_OK; // pretend everything is okay and bail
! }
! }
! } while (S_FALSE == hr);
LExit:
! return hr;
}
--- 199,343 ----
DWORD dwDataType, LPVOID pvData)
{
! Assert(piMetabase && (pvData || (DWORD_METADATA == dwDataType))); // pvData may be 0 if it is DWORD data
! Unused(piMetabase);
! HRESULT hr = S_OK;
! WCHAR wzKey[METADATA_MAX_NAME_LEN];
! WCHAR* pwzCustomActionData = NULL;
! StringCchCopyW(wzKey, countof(wzKey), wzRootKey);
! if (L'/' != *(wzKey + lstrlenW(wzRootKey)))
! StringCchCatW(wzKey, countof(wzKey), L"/");
! if (wzSubKey && *wzSubKey)
! {
! if (L'/' == *wzSubKey)
! StringCchCatW(wzKey, countof(wzKey), wzSubKey + 1);
! else
! StringCchCatW(wzKey, countof(wzKey), wzSubKey);
! }
! hr = WcaWriteIntegerToCaData(MBA_WRITEKEY, &pwzCustomActionData);
! ExitOnFailure(hr, "Failed to add metabase write key directive to CustomActionData");
! hr = WcaWriteStringToCaData(wzKey, &pwzCustomActionData);
! ExitOnFailure(hr, "Failed to add metabase key to CustomActionData");
! hr = WcaWriteIntegerToCaData(dwIdentifier, &pwzCustomActionData);
! ExitOnFailure(hr, "Failed to add metabase identifier to CustomActionData");
! hr = WcaWriteIntegerToCaData(dwAttributes, &pwzCustomActionData);
! ExitOnFailure(hr, "Failed to add metabase attributes to CustomActionData");
! hr = WcaWriteIntegerToCaData(dwUserType, &pwzCustomActionData);
! ExitOnFailure(hr, "Failed to add metabase user type to CustomActionData");
! hr = WcaWriteIntegerToCaData(dwDataType, &pwzCustomActionData);
! ExitOnFailure(hr, "Failed to add metabase data type to CustomActionData");
! switch (dwDataType)
! {
! case DWORD_METADATA:
! hr = WcaWriteIntegerToCaData((DWORD)((DWORD_PTR)pvData), &pwzCustomActionData);
! break;
! case STRING_METADATA:
! hr = WcaWriteStringToCaData((LPCWSTR)pvData, &pwzCustomActionData);
! break;
! case MULTISZ_METADATA:
! {
! // change NULLs to unprintable character to create a 'safe' MULTISZ string
! LPWSTR pwz = (LPWSTR)pvData;
! for (;;)
! {
! if ('\0' == *pwz)
! {
! *pwz = MAGIC_MULTISZ_CHAR;
! if ('\0' == *(pwz + 1)) // second null back to back means end of string
! break;
! }
! pwz++;
! }
! hr = WcaWriteStringToCaData((LPCWSTR)pvData, &pwzCustomActionData);
! }
! break;
! case BINARY_METADATA:
! hr = WcaWriteStreamToCaData(((BLOB*) pvData)->pBlobData, ((BLOB*) pvData)->cbSize, &pwzCustomActionData);
! break;
! default:
! hr = E_UNEXPECTED;
! }
! ExitOnFailure(hr, "Failed to add metabase data to CustomActionData");
! // TODO: maybe look the key up and make sure we're not just writing the same value that already there
! hr = ScaAddToMetabaseConfiguration(pwzCustomActionData, COST_IIS_WRITEKEY);
! ExitOnFailure2(hr, "Failed to add ScaWriteMetabaseValue action data: %S, cost: %d", pwzCustomActionData, COST_IIS_WRITEKEY);
LExit:
! ReleaseStr(pwzCustomActionData);
! return hr;
}
static HRESULT ScaAddToMetabaseConfiguration(LPCWSTR pwzData, DWORD dwCost)
{
! HRESULT hr = S_OK;
! hr = WcaWriteStringToCaData(pwzData, &vpwzCustomActionData);
! ExitOnFailure1(hr, "failed to add to metabase configuration data string: %S", pwzData);
! vdwCustomActionCost += dwCost;
LExit:
! return hr;
}
HRESULT ScaScheduleMetabaseConfiguration()
{
! HRESULT hr = S_OK;
! if (vpwzCustomActionData && *vpwzCustomActionData)
! {
! hr = WcaDoDeferredAction(L"WriteMetabaseChanges", vpwzCustomActionData, vdwCustomActionCost);
! ExitOnFailure(hr, "Failed to schedule ConfigureMetabase custom action");
! ReleaseStr(vpwzCustomActionData);
! }
! else
! hr = S_FALSE;
LExit:
! return hr;
}
HRESULT ScaLoadMetabase(IMSAdminBase** ppiMetabase)
{
! HRESULT hr = S_OK;
! UINT er = ERROR_SUCCESS;
! // if IIS was uninstalled (thus no IID_IMSAdminBase) allow the
! // user to still uninstall this package by clicking "Ignore"
! do
! {
! hr = ::CoCreateInstance(CLSID_MSAdminBase, NULL, CLSCTX_ALL, IID_IMSAdminBase, (void**)ppiMetabase);
! if (FAILED(hr))
! {
! WcaLog(LOGMSG_STANDARD, "failed to get IID_IMSAdminBase Object");
! er = WcaErrorMessage(msierrIISCannotConnect, hr, INSTALLMESSAGE_ERROR | MB_ABORTRETRYIGNORE, 0);
! switch (er)
! {
! case IDABORT:
! ExitFunction(); // bail with the error result from the CoCreate to kick off a rollback
! case IDRETRY:
! hr = S_FALSE; // hit me, baby, one more time
! break;
! case IDIGNORE:
! hr = S_OK; // pretend everything is okay and bail
! }
! }
! } while (S_FALSE == hr);
LExit:
! return hr;
}
------------------------------
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
------------------------------
_______________________________________________
Wix-commits mailing list
Wix-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-commits
End of Wix-commits Digest, Vol 11, Issue 47
*******************************************
P.S. И не забудьте послать роботу вашу рекламу :)
Обработано объявлений: 11776
Стас Давыдов & Outcorp © 2007