ATL replaced with stl c++, version set to 2.0-pre

This commit is contained in:
Simon Rozman 2017-04-24 21:49:56 +02:00
parent b5cf7ab5f5
commit 7e11f053b4
6 changed files with 130 additions and 143 deletions

104
MSICA.sln
View File

@ -1,52 +1,52 @@
 
Microsoft Visual Studio Solution File, Format Version 11.00 Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010 # Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "atlex", "..\..\lib\atlex\build\atlex.vcxproj", "{5A4EADF2-3237-457A-9DA8-BB9942A91019}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSICALib", "..\..\lib\MSICALib\build\MSICALib.vcxproj", "{8552EE55-177E-4F51-B51B-BAF7D6462CDE}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSICALib", "..\..\lib\MSICALib\build\MSICALib.vcxproj", "{8552EE55-177E-4F51-B51B-BAF7D6462CDE}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSICA", "build\MSICA.vcxproj", "{A7D9EBC1-1E64-4399-9C88-6692F8742153}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSICA", "build\MSICA.vcxproj", "{A7D9EBC1-1E64-4399-9C88-6692F8742153}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{26350A68-2F55-4732-972C-4A5E9077699E}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{26350A68-2F55-4732-972C-4A5E9077699E}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WinStd", "..\..\lib\WinStd\build\WinStd.vcxproj", "{47399D91-7EB9-41DE-B521-514BA5DB0C43}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32 Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64 Debug|x64 = Debug|x64
Release|Win32 = Release|Win32 Release|Win32 = Release|Win32
Release|x64 = Release|x64 Release|x64 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5A4EADF2-3237-457A-9DA8-BB9942A91019}.Debug|Win32.ActiveCfg = Debug|Win32 {8552EE55-177E-4F51-B51B-BAF7D6462CDE}.Debug|Win32.ActiveCfg = Debug|Win32
{5A4EADF2-3237-457A-9DA8-BB9942A91019}.Debug|Win32.Build.0 = Debug|Win32 {8552EE55-177E-4F51-B51B-BAF7D6462CDE}.Debug|Win32.Build.0 = Debug|Win32
{5A4EADF2-3237-457A-9DA8-BB9942A91019}.Debug|x64.ActiveCfg = Debug|x64 {8552EE55-177E-4F51-B51B-BAF7D6462CDE}.Debug|x64.ActiveCfg = Debug|x64
{5A4EADF2-3237-457A-9DA8-BB9942A91019}.Debug|x64.Build.0 = Debug|x64 {8552EE55-177E-4F51-B51B-BAF7D6462CDE}.Debug|x64.Build.0 = Debug|x64
{5A4EADF2-3237-457A-9DA8-BB9942A91019}.Release|Win32.ActiveCfg = Release|Win32 {8552EE55-177E-4F51-B51B-BAF7D6462CDE}.Release|Win32.ActiveCfg = Release|Win32
{5A4EADF2-3237-457A-9DA8-BB9942A91019}.Release|Win32.Build.0 = Release|Win32 {8552EE55-177E-4F51-B51B-BAF7D6462CDE}.Release|Win32.Build.0 = Release|Win32
{5A4EADF2-3237-457A-9DA8-BB9942A91019}.Release|x64.ActiveCfg = Release|x64 {8552EE55-177E-4F51-B51B-BAF7D6462CDE}.Release|x64.ActiveCfg = Release|x64
{5A4EADF2-3237-457A-9DA8-BB9942A91019}.Release|x64.Build.0 = Release|x64 {8552EE55-177E-4F51-B51B-BAF7D6462CDE}.Release|x64.Build.0 = Release|x64
{8552EE55-177E-4F51-B51B-BAF7D6462CDE}.Debug|Win32.ActiveCfg = Debug|Win32 {A7D9EBC1-1E64-4399-9C88-6692F8742153}.Debug|Win32.ActiveCfg = Debug|Win32
{8552EE55-177E-4F51-B51B-BAF7D6462CDE}.Debug|Win32.Build.0 = Debug|Win32 {A7D9EBC1-1E64-4399-9C88-6692F8742153}.Debug|Win32.Build.0 = Debug|Win32
{8552EE55-177E-4F51-B51B-BAF7D6462CDE}.Debug|x64.ActiveCfg = Debug|x64 {A7D9EBC1-1E64-4399-9C88-6692F8742153}.Debug|x64.ActiveCfg = Debug|x64
{8552EE55-177E-4F51-B51B-BAF7D6462CDE}.Debug|x64.Build.0 = Debug|x64 {A7D9EBC1-1E64-4399-9C88-6692F8742153}.Debug|x64.Build.0 = Debug|x64
{8552EE55-177E-4F51-B51B-BAF7D6462CDE}.Release|Win32.ActiveCfg = Release|Win32 {A7D9EBC1-1E64-4399-9C88-6692F8742153}.Release|Win32.ActiveCfg = Release|Win32
{8552EE55-177E-4F51-B51B-BAF7D6462CDE}.Release|Win32.Build.0 = Release|Win32 {A7D9EBC1-1E64-4399-9C88-6692F8742153}.Release|Win32.Build.0 = Release|Win32
{8552EE55-177E-4F51-B51B-BAF7D6462CDE}.Release|x64.ActiveCfg = Release|x64 {A7D9EBC1-1E64-4399-9C88-6692F8742153}.Release|x64.ActiveCfg = Release|x64
{8552EE55-177E-4F51-B51B-BAF7D6462CDE}.Release|x64.Build.0 = Release|x64 {A7D9EBC1-1E64-4399-9C88-6692F8742153}.Release|x64.Build.0 = Release|x64
{A7D9EBC1-1E64-4399-9C88-6692F8742153}.Debug|Win32.ActiveCfg = Debug|Win32 {47399D91-7EB9-41DE-B521-514BA5DB0C43}.Debug|Win32.ActiveCfg = Debug|Win32
{A7D9EBC1-1E64-4399-9C88-6692F8742153}.Debug|Win32.Build.0 = Debug|Win32 {47399D91-7EB9-41DE-B521-514BA5DB0C43}.Debug|Win32.Build.0 = Debug|Win32
{A7D9EBC1-1E64-4399-9C88-6692F8742153}.Debug|x64.ActiveCfg = Debug|x64 {47399D91-7EB9-41DE-B521-514BA5DB0C43}.Debug|x64.ActiveCfg = Debug|x64
{A7D9EBC1-1E64-4399-9C88-6692F8742153}.Debug|x64.Build.0 = Debug|x64 {47399D91-7EB9-41DE-B521-514BA5DB0C43}.Debug|x64.Build.0 = Debug|x64
{A7D9EBC1-1E64-4399-9C88-6692F8742153}.Release|Win32.ActiveCfg = Release|Win32 {47399D91-7EB9-41DE-B521-514BA5DB0C43}.Release|Win32.ActiveCfg = Release|Win32
{A7D9EBC1-1E64-4399-9C88-6692F8742153}.Release|Win32.Build.0 = Release|Win32 {47399D91-7EB9-41DE-B521-514BA5DB0C43}.Release|Win32.Build.0 = Release|Win32
{A7D9EBC1-1E64-4399-9C88-6692F8742153}.Release|x64.ActiveCfg = Release|x64 {47399D91-7EB9-41DE-B521-514BA5DB0C43}.Release|x64.ActiveCfg = Release|x64
{A7D9EBC1-1E64-4399-9C88-6692F8742153}.Release|x64.Build.0 = Release|x64 {47399D91-7EB9-41DE-B521-514BA5DB0C43}.Release|x64.Build.0 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(NestedProjects) = preSolution GlobalSection(NestedProjects) = preSolution
{5A4EADF2-3237-457A-9DA8-BB9942A91019} = {26350A68-2F55-4732-972C-4A5E9077699E} {8552EE55-177E-4F51-B51B-BAF7D6462CDE} = {26350A68-2F55-4732-972C-4A5E9077699E}
{8552EE55-177E-4F51-B51B-BAF7D6462CDE} = {26350A68-2F55-4732-972C-4A5E9077699E} {47399D91-7EB9-41DE-B521-514BA5DB0C43} = {26350A68-2F55-4732-972C-4A5E9077699E}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
Copyright 1991-2017 Amebis Copyright 1991-2017 Amebis
@ -16,34 +16,34 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with MSICA. If not, see <http://www.gnu.org/licenses/>. along with MSICA. If not, see <http://www.gnu.org/licenses/>.
--> -->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" /> <ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup> <PropertyGroup>
<OutDir>..\output\$(Platform).$(Configuration)\</OutDir> <OutDir>..\output\$(Platform).$(Configuration)\</OutDir>
<IgnoreImportLibrary>true</IgnoreImportLibrary> <IgnoreImportLibrary>true</IgnoreImportLibrary>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'"> <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile> <ClCompile>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile> </ClCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'"> <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ClCompile> <ClCompile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile> </ClCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup> <ItemDefinitionGroup>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
</Link> </Link>
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>..\include;..\..\..\lib\MSICALib\include;..\..\..\lib\atlex\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\include;..\..\..\lib\MSICALib\include;..\..\..\lib\WinStd\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<ResourceCompile> <ResourceCompile>
<AdditionalIncludeDirectories>..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile> </ResourceCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup /> <ItemGroup />
</Project> </Project>

View File

@ -25,24 +25,20 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfAtl>Static</UseOfAtl>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfAtl>Static</UseOfAtl>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfAtl>Static</UseOfAtl>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfAtl>Static</UseOfAtl>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
@ -99,6 +95,9 @@
<ProjectReference Include="..\..\..\lib\MSICALib\build\MSICALib.vcxproj"> <ProjectReference Include="..\..\..\lib\MSICALib\build\MSICALib.vcxproj">
<Project>{8552ee55-177e-4f51-b51b-baf7d6462cde}</Project> <Project>{8552ee55-177e-4f51-b51b-baf7d6462cde}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\lib\WinStd\build\WinStd.vcxproj">
<Project>{47399d91-7eb9-41de-b521-514ba5db0c43}</Project>
</ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" /> <ImportGroup Label="ExtensionTargets" />

View File

@ -24,14 +24,14 @@
// Version // Version
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
#define MSICA_VERSION 0x00ff0500 #define MSICA_VERSION 0x01ff0000
#define MSICA_VERSION_MAJ 0 #define MSICA_VERSION_MAJ 1
#define MSICA_VERSION_MIN 255 #define MSICA_VERSION_MIN 255
#define MSICA_VERSION_REV 5 #define MSICA_VERSION_REV 0
#define MSICA_VERSION_BUILD 0 #define MSICA_VERSION_BUILD 0
#define MSICA_VERSION_STR "1.0-pre5" #define MSICA_VERSION_STR "2.0-pre"
#define MSICA_BUILD_YEAR_STR "2016" #define MSICA_BUILD_YEAR_STR "2016"
#if !defined(RC_INVOKED) && !defined(MIDL_PASS) #if !defined(RC_INVOKED) && !defined(MIDL_PASS)

View File

@ -97,22 +97,22 @@ UINT MSICA_API MSICAInitialize(MSIHANDLE hInstall)
PMSIHANDLE PMSIHANDLE
hDatabase, hDatabase,
hRecordProg = ::MsiCreateRecord(3); hRecordProg = ::MsiCreateRecord(3);
ATL::CAtlString sValue; winstd::tstring sValue;
// Check and add the rollback enabled state. // Check and add the rollback enabled state.
uiResult = ::MsiGetProperty(hInstall, _T("RollbackDisabled"), sValue); uiResult = ::MsiGetProperty(hInstall, _T("RollbackDisabled"), sValue);
bRollbackEnabled = uiResult == NO_ERROR ? bRollbackEnabled = uiResult == NO_ERROR ?
_ttoi(sValue) || !sValue.IsEmpty() && _totlower(sValue.GetAt(0)) == _T('y') ? FALSE : TRUE : _ttoi(sValue.c_str()) || !sValue.empty() && _totlower(sValue[0]) == _T('y') ? FALSE : TRUE :
TRUE; TRUE;
olRemoveScheduledTask.AddTail(new MSICA::COpRollbackEnable(bRollbackEnabled)); olRemoveScheduledTask.push_back(new MSICA::COpRollbackEnable(bRollbackEnabled));
olStopServices.AddTail(new MSICA::COpRollbackEnable(bRollbackEnabled)); olStopServices.push_back(new MSICA::COpRollbackEnable(bRollbackEnabled));
olRemoveWLANProfiles.AddTail(new MSICA::COpRollbackEnable(bRollbackEnabled)); olRemoveWLANProfiles.push_back(new MSICA::COpRollbackEnable(bRollbackEnabled));
olRemoveCertificates.AddTail(new MSICA::COpRollbackEnable(bRollbackEnabled)); olRemoveCertificates.push_back(new MSICA::COpRollbackEnable(bRollbackEnabled));
olInstallCertificates.AddTail(new MSICA::COpRollbackEnable(bRollbackEnabled)); olInstallCertificates.push_back(new MSICA::COpRollbackEnable(bRollbackEnabled));
olInstallWLANProfiles.AddTail(new MSICA::COpRollbackEnable(bRollbackEnabled)); olInstallWLANProfiles.push_back(new MSICA::COpRollbackEnable(bRollbackEnabled));
olSetServiceStarts.AddTail(new MSICA::COpRollbackEnable(bRollbackEnabled)); olSetServiceStarts.push_back(new MSICA::COpRollbackEnable(bRollbackEnabled));
olStartServices.AddTail(new MSICA::COpRollbackEnable(bRollbackEnabled)); olStartServices.push_back(new MSICA::COpRollbackEnable(bRollbackEnabled));
olInstallScheduledTask.AddTail(new MSICA::COpRollbackEnable(bRollbackEnabled)); olInstallScheduledTask.push_back(new MSICA::COpRollbackEnable(bRollbackEnabled));
// Open MSI database. // Open MSI database.
hDatabase = ::MsiGetActiveDatabase(hInstall); hDatabase = ::MsiGetActiveDatabase(hInstall);
@ -130,9 +130,9 @@ UINT MSICA_API MSICAInitialize(MSIHANDLE hInstall)
// Execute query! // Execute query!
uiResult = ::MsiViewExecute(hViewCert, NULL); uiResult = ::MsiViewExecute(hViewCert, NULL);
if (uiResult == NO_ERROR) { if (uiResult == NO_ERROR) {
ATL::CAtlStringW sStore; std::wstring sStore;
int iFlags, iEncoding; int iFlags, iEncoding;
ATL::CAtlArray<BYTE> binCert; std::vector<BYTE> binCert;
for (;;) { for (;;) {
PMSIHANDLE hRecord; PMSIHANDLE hRecord;
@ -150,7 +150,7 @@ UINT MSICA_API MSICAInitialize(MSIHANDLE hInstall)
// Read and evaluate certificate's condition. // Read and evaluate certificate's condition.
uiResult = ::MsiRecordGetString(hRecord, 5, sValue); uiResult = ::MsiRecordGetString(hRecord, 5, sValue);
if (uiResult != NO_ERROR) break; if (uiResult != NO_ERROR) break;
condition = ::MsiEvaluateCondition(hInstall, sValue); condition = ::MsiEvaluateCondition(hInstall, sValue.c_str());
if (condition == MSICONDITION_FALSE) if (condition == MSICONDITION_FALSE)
continue; continue;
else if (condition == MSICONDITION_ERROR) { else if (condition == MSICONDITION_ERROR) {
@ -199,15 +199,15 @@ UINT MSICA_API MSICAInitialize(MSIHANDLE hInstall)
if (uiResult != NO_ERROR) break; if (uiResult != NO_ERROR) break;
// Get the component state. // Get the component state.
uiResult = ::MsiGetComponentState(hInstall, sValue, &iInstalled, &iAction); uiResult = ::MsiGetComponentState(hInstall, sValue.c_str(), &iInstalled, &iAction);
if (uiResult != NO_ERROR) break; if (uiResult != NO_ERROR) break;
if (iAction >= INSTALLSTATE_LOCAL) { if (iAction >= INSTALLSTATE_LOCAL) {
// Component is or should be installed. Install the certificate. // Component is or should be installed. Install the certificate.
olInstallCertificates.AddTail(new MSICA::COpCertInstall(binCert.GetData(), binCert.GetCount(), sStore, iEncoding, iFlags, MSICA_CERT_TICK_SIZE)); olInstallCertificates.push_back(new MSICA::COpCertInstall(binCert.data(), binCert.size(), sStore.c_str(), iEncoding, iFlags, MSICA_CERT_TICK_SIZE));
} else if (iAction >= INSTALLSTATE_REMOVED) { } else if (iAction >= INSTALLSTATE_REMOVED) {
// Component is installed, but should be degraded to advertised/removed. Delete the certificate. // Component is installed, but should be degraded to advertised/removed. Delete the certificate.
olRemoveCertificates.AddTail(new MSICA::COpCertRemove(binCert.GetData(), binCert.GetCount(), sStore, iEncoding, iFlags, MSICA_CERT_TICK_SIZE)); olRemoveCertificates.push_back(new MSICA::COpCertRemove(binCert.data(), binCert.size(), sStore.c_str(), iEncoding, iFlags, MSICA_CERT_TICK_SIZE));
} }
// The amount of tick space to add for each certificate to progress indicator. // The amount of tick space to add for each certificate to progress indicator.
@ -253,7 +253,7 @@ UINT MSICA_API MSICAInitialize(MSIHANDLE hInstall)
// Read and evaluate service configuration condition. // Read and evaluate service configuration condition.
uiResult = ::MsiRecordGetString(hRecord, 4, sValue); uiResult = ::MsiRecordGetString(hRecord, 4, sValue);
if (uiResult != NO_ERROR) break; if (uiResult != NO_ERROR) break;
condition = ::MsiEvaluateCondition(hInstall, sValue); condition = ::MsiEvaluateCondition(hInstall, sValue.c_str());
if (condition == MSICONDITION_FALSE) if (condition == MSICONDITION_FALSE)
continue; continue;
else if (condition == MSICONDITION_ERROR) { else if (condition == MSICONDITION_ERROR) {
@ -273,7 +273,7 @@ UINT MSICA_API MSICAInitialize(MSIHANDLE hInstall)
} }
if (iValue >= 0) { if (iValue >= 0) {
// Set service start type. // Set service start type.
olSetServiceStarts.AddTail(new MSICA::COpSvcSetStart(sValue, iValue, MSICA_SVC_SET_START_TICK_SIZE)); olSetServiceStarts.push_back(new MSICA::COpSvcSetStart(sValue.c_str(), iValue, MSICA_SVC_SET_START_TICK_SIZE));
// The amount of tick space to add to progress indicator. // The amount of tick space to add to progress indicator.
::MsiRecordSetInteger(hRecordProg, 1, 3 ); ::MsiRecordSetInteger(hRecordProg, 1, 3 );
@ -289,7 +289,7 @@ UINT MSICA_API MSICAInitialize(MSIHANDLE hInstall)
} }
if ((iValue & 4) != 0) { if ((iValue & 4) != 0) {
// Stop service. // Stop service.
olStopServices.AddTail(new MSICA::COpSvcStop(sValue, (iValue & 1) ? TRUE : FALSE, MSICA_SVC_STOP_TICK_SIZE)); olStopServices.push_back(new MSICA::COpSvcStop(sValue.c_str(), (iValue & 1) ? TRUE : FALSE, MSICA_SVC_STOP_TICK_SIZE));
// The amount of tick space to add to progress indicator. // The amount of tick space to add to progress indicator.
::MsiRecordSetInteger(hRecordProg, 1, 3 ); ::MsiRecordSetInteger(hRecordProg, 1, 3 );
@ -297,7 +297,7 @@ UINT MSICA_API MSICAInitialize(MSIHANDLE hInstall)
if (::MsiProcessMessage(hInstall, INSTALLMESSAGE_PROGRESS, hRecordProg) == IDCANCEL) { uiResult = ERROR_INSTALL_USEREXIT; break; } if (::MsiProcessMessage(hInstall, INSTALLMESSAGE_PROGRESS, hRecordProg) == IDCANCEL) { uiResult = ERROR_INSTALL_USEREXIT; break; }
} else if ((iValue & 2) != 0) { } else if ((iValue & 2) != 0) {
// Start service. // Start service.
olStartServices.AddTail(new MSICA::COpSvcStart(sValue, (iValue & 1) ? TRUE : FALSE, MSICA_SVC_START_TICK_SIZE)); olStartServices.push_back(new MSICA::COpSvcStart(sValue.c_str(), (iValue & 1) ? TRUE : FALSE, MSICA_SVC_START_TICK_SIZE));
// The amount of tick space to add to progress indicator. // The amount of tick space to add to progress indicator.
::MsiRecordSetInteger(hRecordProg, 1, 3 ); ::MsiRecordSetInteger(hRecordProg, 1, 3 );
@ -327,8 +327,8 @@ UINT MSICA_API MSICAInitialize(MSIHANDLE hInstall)
// Execute query! // Execute query!
uiResult = ::MsiViewExecute(hViewST, NULL); uiResult = ::MsiViewExecute(hViewST, NULL);
if (uiResult == NO_ERROR) { if (uiResult == NO_ERROR) {
//ATL::CAtlString sComponent; //winstd::tstring sComponent;
ATL::CAtlStringW sDisplayName; std::wstring sDisplayName;
for (;;) { for (;;) {
PMSIHANDLE hRecord; PMSIHANDLE hRecord;
@ -345,7 +345,7 @@ UINT MSICA_API MSICAInitialize(MSIHANDLE hInstall)
// Read and evaluate task's condition. // Read and evaluate task's condition.
uiResult = ::MsiRecordGetString(hRecord, 15, sValue); uiResult = ::MsiRecordGetString(hRecord, 15, sValue);
if (uiResult != NO_ERROR) break; if (uiResult != NO_ERROR) break;
condition = ::MsiEvaluateCondition(hInstall, sValue); condition = ::MsiEvaluateCondition(hInstall, sValue.c_str());
if (condition == MSICONDITION_FALSE) if (condition == MSICONDITION_FALSE)
continue; continue;
else if (condition == MSICONDITION_ERROR) { else if (condition == MSICONDITION_ERROR) {
@ -358,7 +358,7 @@ UINT MSICA_API MSICAInitialize(MSIHANDLE hInstall)
if (uiResult != NO_ERROR) break; if (uiResult != NO_ERROR) break;
// Get the component state. // Get the component state.
uiResult = ::MsiGetComponentState(hInstall, sValue, &iInstalled, &iAction); uiResult = ::MsiGetComponentState(hInstall, sValue.c_str(), &iInstalled, &iAction);
if (uiResult != NO_ERROR) break; if (uiResult != NO_ERROR) break;
// Get task's DisplayName. // Get task's DisplayName.
@ -367,7 +367,7 @@ UINT MSICA_API MSICAInitialize(MSIHANDLE hInstall)
if (iAction >= INSTALLSTATE_LOCAL) { if (iAction >= INSTALLSTATE_LOCAL) {
// Component is or should be installed. Create the task. // Component is or should be installed. Create the task.
PMSIHANDLE hViewTT; PMSIHANDLE hViewTT;
MSICA::COpTaskCreate *opCreateTask = new MSICA::COpTaskCreate(sDisplayName, MSICA_TASK_TICK_SIZE); MSICA::COpTaskCreate *opCreateTask = new MSICA::COpTaskCreate(sDisplayName.c_str(), MSICA_TASK_TICK_SIZE);
// Populate the operation with task's data. // Populate the operation with task's data.
uiResult = opCreateTask->SetFromRecord(hInstall, hRecord); uiResult = opCreateTask->SetFromRecord(hInstall, hRecord);
@ -387,10 +387,10 @@ UINT MSICA_API MSICAInitialize(MSIHANDLE hInstall)
} else } else
break; break;
olInstallScheduledTask.AddTail(opCreateTask); olInstallScheduledTask.push_back(opCreateTask);
} else if (iAction >= INSTALLSTATE_REMOVED) { } else if (iAction >= INSTALLSTATE_REMOVED) {
// Component is installed, but should be degraded to advertised/removed. Delete the task. // Component is installed, but should be degraded to advertised/removed. Delete the task.
olRemoveScheduledTask.AddTail(new MSICA::COpTaskDelete(sDisplayName, MSICA_TASK_TICK_SIZE)); olRemoveScheduledTask.push_back(new MSICA::COpTaskDelete(sDisplayName.c_str(), MSICA_TASK_TICK_SIZE));
} }
// The amount of tick space to add for each task to progress indicator. // The amount of tick space to add for each task to progress indicator.
@ -432,8 +432,8 @@ UINT MSICA_API MSICAInitialize(MSIHANDLE hInstall)
// Get a list of WLAN interfaces. // Get a list of WLAN interfaces.
dwError = ::pfnWlanEnumInterfaces(hClientHandle, NULL, &pInterfaceList); dwError = ::pfnWlanEnumInterfaces(hClientHandle, NULL, &pInterfaceList);
if (dwError == NO_ERROR) { if (dwError == NO_ERROR) {
ATL::CAtlStringW sName, sProfileXML; std::wstring sName, sProfileXML;
ATL::CAtlArray<BYTE> binProfile; std::vector<BYTE> binProfile;
for (;;) { for (;;) {
PMSIHANDLE hRecord; PMSIHANDLE hRecord;
@ -452,7 +452,7 @@ UINT MSICA_API MSICAInitialize(MSIHANDLE hInstall)
// Read and evaluate profile's condition. // Read and evaluate profile's condition.
uiResult = ::MsiRecordGetString(hRecord, 3, sValue); uiResult = ::MsiRecordGetString(hRecord, 3, sValue);
if (uiResult != NO_ERROR) break; if (uiResult != NO_ERROR) break;
condition = ::MsiEvaluateCondition(hInstall, sValue); condition = ::MsiEvaluateCondition(hInstall, sValue.c_str());
if (condition == MSICONDITION_FALSE) if (condition == MSICONDITION_FALSE)
continue; continue;
else if (condition == MSICONDITION_ERROR) { else if (condition == MSICONDITION_ERROR) {
@ -469,7 +469,7 @@ UINT MSICA_API MSICAInitialize(MSIHANDLE hInstall)
if (uiResult != NO_ERROR) break; if (uiResult != NO_ERROR) break;
// Get the component state. // Get the component state.
uiResult = ::MsiGetComponentState(hInstall, sValue, &iInstalled, &iAction); uiResult = ::MsiGetComponentState(hInstall, sValue.c_str(), &iInstalled, &iAction);
if (uiResult != NO_ERROR) break; if (uiResult != NO_ERROR) break;
if (iAction >= INSTALLSTATE_LOCAL) { if (iAction >= INSTALLSTATE_LOCAL) {
@ -492,23 +492,23 @@ UINT MSICA_API MSICAInitialize(MSIHANDLE hInstall)
::MsiViewClose(hViewBinary); ::MsiViewClose(hViewBinary);
if (uiResult != NO_ERROR) break; if (uiResult != NO_ERROR) break;
// Convert CAtlArray<BYTE> to CAtlStringW. // Convert std::vector<BYTE> to std::wstring.
pProfileStr = (LPCWSTR)binProfile.GetData(); pProfileStr = (LPCWSTR)binProfile.data();
nCount = binProfile.GetCount()/sizeof(WCHAR); nCount = binProfile.size()/sizeof(WCHAR);
if (nCount < 1 || pProfileStr[0] != 0xfeff) { if (nCount < 1 || pProfileStr[0] != 0xfeff) {
// The profile XML is not UTF-16 encoded. // The profile XML is not UTF-16 encoded.
::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_WLAN_PROFILE_NOT_UTF16); ::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_WLAN_PROFILE_NOT_UTF16);
::MsiRecordSetStringW(hRecordProg, 2, sName ); ::MsiRecordSetStringW(hRecordProg, 2, sName.c_str() );
::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg); ::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
uiResult = ERROR_INSTALL_USEREXIT; uiResult = ERROR_INSTALL_USEREXIT;
} }
sProfileXML.SetString(pProfileStr + 1, (int)nCount - 1); sProfileXML.assign(pProfileStr + 1, (int)nCount - 1);
for (i = 0; i < pInterfaceList->dwNumberOfItems; i++) { for (i = 0; i < pInterfaceList->dwNumberOfItems; i++) {
// Check for not ready state in interface. // Check for not ready state in interface.
if (pInterfaceList->InterfaceInfo[i].isState != wlan_interface_state_not_ready) { if (pInterfaceList->InterfaceInfo[i].isState != wlan_interface_state_not_ready) {
olInstallWLANProfiles.AddTail(new MSICA::COpWLANProfileSet(pInterfaceList->InterfaceInfo[i].InterfaceGuid, 0, sName, sProfileXML, MSICA_WLAN_PROFILE_TICK_SIZE)); olInstallWLANProfiles.push_back(new MSICA::COpWLANProfileSet(pInterfaceList->InterfaceInfo[i].InterfaceGuid, 0, sName.c_str(), sProfileXML.c_str(), MSICA_WLAN_PROFILE_TICK_SIZE));
iTick += MSICA_WLAN_PROFILE_TICK_SIZE; iTick += MSICA_WLAN_PROFILE_TICK_SIZE;
} }
} }
@ -522,7 +522,7 @@ UINT MSICA_API MSICAInitialize(MSIHANDLE hInstall)
for (i = 0; i < pInterfaceList->dwNumberOfItems; i++) { for (i = 0; i < pInterfaceList->dwNumberOfItems; i++) {
// Check for not ready state in interface. // Check for not ready state in interface.
if (pInterfaceList->InterfaceInfo[i].isState != wlan_interface_state_not_ready) { if (pInterfaceList->InterfaceInfo[i].isState != wlan_interface_state_not_ready) {
olRemoveWLANProfiles.AddTail(new MSICA::COpWLANProfileDelete(pInterfaceList->InterfaceInfo[i].InterfaceGuid, sName, MSICA_WLAN_PROFILE_TICK_SIZE)); olRemoveWLANProfiles.push_back(new MSICA::COpWLANProfileDelete(pInterfaceList->InterfaceInfo[i].InterfaceGuid, sName.c_str(), MSICA_WLAN_PROFILE_TICK_SIZE));
iTick += MSICA_WLAN_PROFILE_TICK_SIZE; iTick += MSICA_WLAN_PROFILE_TICK_SIZE;
} }
} }
@ -584,16 +584,6 @@ UINT MSICA_API MSICAInitialize(MSIHANDLE hInstall)
::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg); ::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
} }
olInstallScheduledTask.Free();
olStartServices.Free();
olSetServiceStarts.Free();
olInstallWLANProfiles.Free();
olInstallCertificates.Free();
olRemoveCertificates.Free();
olRemoveWLANProfiles.Free();
olStopServices.Free();
olRemoveScheduledTask.Free();
if (bIsCoInitialized) ::CoUninitialize(); if (bIsCoInitialized) ::CoUninitialize();
return uiResult; return uiResult;
} }

View File

@ -23,9 +23,7 @@
#define MSICA_DLL // This library is compiled as a DLL #define MSICA_DLL // This library is compiled as a DLL
#endif #endif
#include <atlbase.h> #include <Windows.h>
#include <atlfile.h>
#include <atlstr.h>
#include <corerror.h> #include <corerror.h>
#include <stdlib.h> #include <stdlib.h>