Dodal sem začetno verzijo knjižnjice. Njeno kodo sem izruval iz MSITSCA.dll in jo predelal.
This commit is contained in:
parent
a8c4506968
commit
a46662476b
11
.gitattributes
vendored
11
.gitattributes
vendored
@ -1,4 +1,15 @@
|
|||||||
* text=auto !eol
|
* text=auto !eol
|
||||||
|
AMSICA/AMSICA.props -text svneol=unset#text/xml
|
||||||
|
AMSICA/AMSICALib/AMSICALib.vcxproj -text svneol=unset#text/xml
|
||||||
|
AMSICA/AMSICALib/AMSICALib.vcxproj.filters -text svneol=unset#text/xml
|
||||||
|
AMSICA/include/AMSICA.h -text
|
||||||
|
AMSICA/include/StdAfx.h -text
|
||||||
|
AMSICA/msm/Makefile -text svneol=unset#text/plain%3B+charset%3DWindows-1250
|
||||||
|
AMSICA/res/en_GB.po -text
|
||||||
|
AMSICA/src/AMSICA.cpp -text
|
||||||
|
AMSICA/src/AMSICAFileOp.cpp -text
|
||||||
|
AMSICA/src/AMSICATSOp.cpp -text
|
||||||
|
AMSICA/src/StdAfx.cpp -text
|
||||||
MSITSCA/L10N/sl_SI.po -text
|
MSITSCA/L10N/sl_SI.po -text
|
||||||
MSITSCA/MSITSCA.cpp -text
|
MSITSCA/MSITSCA.cpp -text
|
||||||
MSITSCA/MSITSCA.h -text
|
MSITSCA/MSITSCA.h -text
|
||||||
|
19
.gitignore
vendored
19
.gitignore
vendored
@ -1,3 +1,22 @@
|
|||||||
|
AMSICA/AMSICALib/*.user
|
||||||
|
AMSICA/AMSICALib/Debug.Win32
|
||||||
|
AMSICA/AMSICALib/Debug.x64
|
||||||
|
AMSICA/AMSICALib/Release.Win32
|
||||||
|
AMSICA/AMSICALib/Release.x64
|
||||||
|
AMSICA/AMSICALib/Unicode[!!-~]Debug.Win32
|
||||||
|
AMSICA/AMSICALib/Unicode[!!-~]Debug.x64
|
||||||
|
AMSICA/AMSICALib/Unicode[!!-~]Release.Win32
|
||||||
|
AMSICA/AMSICALib/Unicode[!!-~]Release.x64
|
||||||
|
AMSICA/msm/*-1.idt
|
||||||
|
AMSICA/msm/*-2.idt
|
||||||
|
AMSICA/msm/*-2.idtx
|
||||||
|
AMSICA/msm/*.Binary-1
|
||||||
|
AMSICA/msm/*.Binary-2
|
||||||
|
AMSICA/msm/*.Icon-1
|
||||||
|
AMSICA/msm/*.Icon-2
|
||||||
|
AMSICA/msm/*.lst
|
||||||
|
AMSICA/msm/*.msm
|
||||||
|
AMSICA/res/*.mo
|
||||||
MSITSCA/*.user
|
MSITSCA/*.user
|
||||||
MSITSCA/L10N/*.mo
|
MSITSCA/L10N/*.mo
|
||||||
MSITSCA/MSITSCA.Debug.Win32
|
MSITSCA/MSITSCA.Debug.Win32
|
||||||
|
20
AMSICA/AMSICA.props
Normal file
20
AMSICA/AMSICA.props
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup>
|
||||||
|
<ClCompile>
|
||||||
|
<AdditionalIncludeDirectories>$(IntDir);..\include;..\..\include;..\..\AOsn\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<ResourceCompile>
|
||||||
|
<AdditionalIncludeDirectories>$(IntDir);..\include;..\..\include;..\res;..\..\AOsn\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ResourceCompile>
|
||||||
|
<ResourceLocalizator>
|
||||||
|
<LanguageCatalogs>..\res\en_GB.po</LanguageCatalogs>
|
||||||
|
</ResourceLocalizator>
|
||||||
|
<MessageLocalizator>
|
||||||
|
<LanguageCatalogs>..\res\en_GB.po</LanguageCatalogs>
|
||||||
|
</MessageLocalizator>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
</Project>
|
236
AMSICA/AMSICALib/AMSICALib.vcxproj
Normal file
236
AMSICA/AMSICALib/AMSICALib.vcxproj
Normal file
@ -0,0 +1,236 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Unicode Debug|Win32">
|
||||||
|
<Configuration>Unicode Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Unicode Debug|x64">
|
||||||
|
<Configuration>Unicode Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Unicode Release|Win32">
|
||||||
|
<Configuration>Unicode Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Unicode Release|x64">
|
||||||
|
<Configuration>Unicode Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\src\AMSICA.cpp" />
|
||||||
|
<ClCompile Include="..\src\AMSICAFileOp.cpp" />
|
||||||
|
<ClCompile Include="..\src\AMSICATSOp.cpp" />
|
||||||
|
<ClCompile Include="..\src\StdAfx.cpp">
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|x64'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Unicode Release|x64'">Create</PrecompiledHeader>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\include\AMSICA.h" />
|
||||||
|
<ClInclude Include="..\include\StdAfx.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{8552EE55-177E-4F51-B51B-BAF7D6462CDE}</ProjectGuid>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>AMSICALib</RootNamespace>
|
||||||
|
<ProjectName>AMSICALib</ProjectName>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<UseOfAtl>Static</UseOfAtl>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
<UseOfAtl>Static</UseOfAtl>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<UseOfAtl>Static</UseOfAtl>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<UseOfAtl>Static</UseOfAtl>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<UseOfAtl>Static</UseOfAtl>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
<UseOfAtl>Static</UseOfAtl>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<UseOfAtl>Static</UseOfAtl>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<UseOfAtl>Static</UseOfAtl>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
<Import Project="$(VCTargetsPath)\BuildCustomizations\rcxgettext.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="$(VCInstallDir)VCProjectDefaults\Amebis.props" />
|
||||||
|
<Import Project="$(VCInstallDir)VCProjectDefaults\AmebisDebug.props" />
|
||||||
|
<Import Project="$(VCInstallDir)VCProjectDefaults\AmebisWin32.props" />
|
||||||
|
<Import Project="..\AMSICA.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="$(VCInstallDir)VCProjectDefaults\Amebis.props" />
|
||||||
|
<Import Project="$(VCInstallDir)VCProjectDefaults\AmebisDebug.props" />
|
||||||
|
<Import Project="$(VCInstallDir)VCProjectDefaults\AmebisWin32.props" />
|
||||||
|
<Import Project="..\AMSICA.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="$(VCInstallDir)VCProjectDefaults\Amebis.props" />
|
||||||
|
<Import Project="$(VCInstallDir)VCProjectDefaults\AmebisRelease.props" />
|
||||||
|
<Import Project="$(VCInstallDir)VCProjectDefaults\AmebisWin32.props" />
|
||||||
|
<Import Project="..\AMSICA.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="$(VCInstallDir)VCProjectDefaults\Amebis.props" />
|
||||||
|
<Import Project="$(VCInstallDir)VCProjectDefaults\AmebisRelease.props" />
|
||||||
|
<Import Project="$(VCInstallDir)VCProjectDefaults\AmebisWin32.props" />
|
||||||
|
<Import Project="..\AMSICA.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="$(VCInstallDir)VCProjectDefaults\Amebis.props" />
|
||||||
|
<Import Project="$(VCInstallDir)VCProjectDefaults\AmebisDebug.props" />
|
||||||
|
<Import Project="$(VCInstallDir)VCProjectDefaults\Amebisx64.props" />
|
||||||
|
<Import Project="..\AMSICA.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="$(VCInstallDir)VCProjectDefaults\Amebis.props" />
|
||||||
|
<Import Project="$(VCInstallDir)VCProjectDefaults\AmebisDebug.props" />
|
||||||
|
<Import Project="$(VCInstallDir)VCProjectDefaults\Amebisx64.props" />
|
||||||
|
<Import Project="..\AMSICA.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="$(VCInstallDir)VCProjectDefaults\Amebis.props" />
|
||||||
|
<Import Project="$(VCInstallDir)VCProjectDefaults\AmebisRelease.props" />
|
||||||
|
<Import Project="$(VCInstallDir)VCProjectDefaults\Amebisx64.props" />
|
||||||
|
<Import Project="..\AMSICA.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="$(VCInstallDir)VCProjectDefaults\Amebis.props" />
|
||||||
|
<Import Project="$(VCInstallDir)VCProjectDefaults\AmebisRelease.props" />
|
||||||
|
<Import Project="$(VCInstallDir)VCProjectDefaults\Amebisx64.props" />
|
||||||
|
<Import Project="..\AMSICA.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup />
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile />
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile />
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">
|
||||||
|
<ClCompile />
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|x64'">
|
||||||
|
<ClCompile />
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile />
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile />
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">
|
||||||
|
<ClCompile />
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|x64'">
|
||||||
|
<ClCompile />
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
39
AMSICA/AMSICALib/AMSICALib.vcxproj.filters
Normal file
39
AMSICA/AMSICALib/AMSICALib.vcxproj.filters
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Source Files">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Resource Files">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\src\AMSICA.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\AMSICAFileOp.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\AMSICATSOp.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\StdAfx.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\include\AMSICA.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\StdAfx.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
979
AMSICA/include/AMSICA.h
Normal file
979
AMSICA/include/AMSICA.h
Normal file
@ -0,0 +1,979 @@
|
|||||||
|
#ifndef __AMSICA_H__
|
||||||
|
#define __AMSICA_H__
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Version
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#define AMSICA_VERSION 0x01000000
|
||||||
|
|
||||||
|
#define AMSICA_VERSION_MAJ 1
|
||||||
|
#define AMSICA_VERSION_MIN 0
|
||||||
|
#define AMSICA_VERSION_REV 0
|
||||||
|
|
||||||
|
#define AMSICA_VERSION_STR "1.0"
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(RC_INVOKED) && !defined(MIDL_PASS)
|
||||||
|
|
||||||
|
#include <atlbase.h>
|
||||||
|
#include <atlcoll.h>
|
||||||
|
#include <atlfile.h>
|
||||||
|
#include <atlstr.h>
|
||||||
|
#include <msi.h>
|
||||||
|
#include <mstask.h>
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Error codes (last unused 2561L)
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#define ERROR_INSTALL_DELETE_FAILED 2554L
|
||||||
|
#define ERROR_INSTALL_MOVE_FAILED 2555L
|
||||||
|
#define ERROR_INSTALL_TASK_CREATE_FAILED 2556L
|
||||||
|
#define ERROR_INSTALL_TASK_DELETE_FAILED 2557L
|
||||||
|
#define ERROR_INSTALL_TASK_ENABLE_FAILED 2558L
|
||||||
|
#define ERROR_INSTALL_TASK_COPY_FAILED 2559L
|
||||||
|
|
||||||
|
// Errors reported by MSITSCA
|
||||||
|
#define ERROR_INSTALL_SCHEDULED_TASKS_DATABASE_OPEN 2550L
|
||||||
|
#define ERROR_INSTALL_SCHEDULED_TASKS_OPLIST_CREATE 2551L
|
||||||
|
#define ERROR_INSTALL_SCHEDULED_TASKS_SCRIPT_WRITE 2552L
|
||||||
|
#define ERROR_INSTALL_SCHEDULED_TASKS_SCRIPT_READ 2560L
|
||||||
|
#define ERROR_INSTALL_SCHEDULED_TASKS_PROPERTY_SET 2553L
|
||||||
|
|
||||||
|
|
||||||
|
namespace AMSICA {
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Forward declarations
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class CSession;
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
// COperation
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class COperation
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
COperation(int iTicks = 0);
|
||||||
|
|
||||||
|
virtual HRESULT Execute(CSession *pSession) = 0;
|
||||||
|
|
||||||
|
friend class COpList;
|
||||||
|
friend inline HRESULT operator <<(ATL::CAtlFile &f, const COperation &op);
|
||||||
|
friend inline HRESULT operator >>(ATL::CAtlFile &f, COperation &op);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
int m_iTicks; // Number of ticks on a progress bar required for this action execution
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
// COpTypeSingleString
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class COpTypeSingleString : public COperation
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
COpTypeSingleString(LPCWSTR pszValue = L"", int iTicks = 0);
|
||||||
|
|
||||||
|
friend inline HRESULT operator <<(ATL::CAtlFile &f, const AMSICA::COpTypeSingleString &op);
|
||||||
|
friend inline HRESULT operator >>(ATL::CAtlFile &f, AMSICA::COpTypeSingleString &op);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
ATL::CAtlStringW m_sValue;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
// COpDoubleStringOperation
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class COpTypeSrcDstString : public COperation
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
COpTypeSrcDstString(LPCWSTR pszValue1 = L"", LPCWSTR pszValue2 = L"", int iTicks = 0);
|
||||||
|
|
||||||
|
friend inline HRESULT operator <<(ATL::CAtlFile &f, const AMSICA::COpTypeSrcDstString &op);
|
||||||
|
friend inline HRESULT operator >>(ATL::CAtlFile &f, AMSICA::COpTypeSrcDstString &op);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
ATL::CAtlStringW m_sValue1;
|
||||||
|
ATL::CAtlStringW m_sValue2;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
// COpTypeBoolean
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class COpTypeBoolean : public COperation
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
COpTypeBoolean(BOOL bValue = TRUE, int iTicks = 0);
|
||||||
|
|
||||||
|
friend inline HRESULT operator <<(ATL::CAtlFile &f, const AMSICA::COpTypeBoolean &op);
|
||||||
|
friend inline HRESULT operator >>(ATL::CAtlFile &f, AMSICA::COpTypeBoolean &op);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
BOOL m_bValue;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
// COpRollbackEnable
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class COpRollbackEnable : public COpTypeBoolean
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
COpRollbackEnable(BOOL bEnable = TRUE, int iTicks = 0);
|
||||||
|
virtual HRESULT Execute(CSession *pSession);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
// COpFileDelete
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class COpFileDelete : public COpTypeSingleString
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
COpFileDelete(LPCWSTR pszFileName = L"", int iTicks = 0);
|
||||||
|
virtual HRESULT Execute(CSession *pSession);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
// COpFileMove
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class COpFileMove : public COpTypeSrcDstString
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
COpFileMove(LPCWSTR pszFileSrc = L"", LPCWSTR pszFileDst = L"", int iTicks = 0);
|
||||||
|
virtual HRESULT Execute(CSession *pSession);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
// COpTaskCreate
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class COpTaskCreate : public COpTypeSingleString
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
COpTaskCreate(LPCWSTR pszTaskName = L"", int iTicks = 0);
|
||||||
|
virtual ~COpTaskCreate();
|
||||||
|
virtual HRESULT Execute(CSession *pSession);
|
||||||
|
|
||||||
|
UINT SetFromRecord(MSIHANDLE hInstall, MSIHANDLE hRecord);
|
||||||
|
UINT SetTriggersFromView(MSIHANDLE hView);
|
||||||
|
|
||||||
|
friend inline HRESULT operator <<(ATL::CAtlFile &f, const AMSICA::COpTaskCreate &op);
|
||||||
|
friend inline HRESULT operator >>(ATL::CAtlFile &f, AMSICA::COpTaskCreate &op);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
ATL::CAtlStringW m_sApplicationName;
|
||||||
|
ATL::CAtlStringW m_sParameters;
|
||||||
|
ATL::CAtlStringW m_sWorkingDirectory;
|
||||||
|
ATL::CAtlStringW m_sAuthor;
|
||||||
|
ATL::CAtlStringW m_sComment;
|
||||||
|
DWORD m_dwFlags;
|
||||||
|
DWORD m_dwPriority;
|
||||||
|
ATL::CAtlStringW m_sAccountName;
|
||||||
|
ATL::CAtlStringW m_sPassword;
|
||||||
|
WORD m_wIdleMinutes;
|
||||||
|
WORD m_wDeadlineMinutes;
|
||||||
|
DWORD m_dwMaxRuntimeMS;
|
||||||
|
|
||||||
|
ATL::CAtlList<TASK_TRIGGER> m_lTriggers;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
// COpTaskDelete
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class COpTaskDelete : public COpTypeSingleString
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
COpTaskDelete(LPCWSTR pszTaskName = L"", int iTicks = 0);
|
||||||
|
virtual HRESULT Execute(CSession *pSession);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
// COpTaskEnable
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class COpTaskEnable : public COpTypeSingleString
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
COpTaskEnable(LPCWSTR pszTaskName = L"", BOOL bEnable = TRUE, int iTicks = 0);
|
||||||
|
virtual HRESULT Execute(CSession *pSession);
|
||||||
|
|
||||||
|
friend inline HRESULT operator <<(ATL::CAtlFile &f, const COpTaskEnable &op);
|
||||||
|
friend inline HRESULT operator >>(ATL::CAtlFile &f, COpTaskEnable &op);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
BOOL m_bEnable;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
// COpTaskCopy
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class COpTaskCopy : public COpTypeSrcDstString
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
COpTaskCopy(LPCWSTR pszTaskSrc = L"", LPCWSTR pszTaskDst = L"", int iTicks = 0);
|
||||||
|
virtual HRESULT Execute(CSession *pSession);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
// COpList
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class COpList : public COperation, public ATL::CAtlList<COperation*>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
COpList(int iTicks = 0);
|
||||||
|
|
||||||
|
void Free();
|
||||||
|
HRESULT LoadFromFile(LPCTSTR pszFileName);
|
||||||
|
HRESULT SaveToFile(LPCTSTR pszFileName) const;
|
||||||
|
|
||||||
|
virtual HRESULT Execute(CSession *pSession);
|
||||||
|
|
||||||
|
friend inline HRESULT operator <<(ATL::CAtlFile &f, const COpList &op);
|
||||||
|
friend inline HRESULT operator >>(ATL::CAtlFile &f, COpList &op);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
enum OPERATION {
|
||||||
|
OPERATION_ENABLE_ROLLBACK = 1,
|
||||||
|
OPERATION_DELETE_FILE,
|
||||||
|
OPERATION_MOVE_FILE,
|
||||||
|
OPERATION_CREATE_TASK,
|
||||||
|
OPERATION_DELETE_TASK,
|
||||||
|
OPERATION_ENABLE_TASK,
|
||||||
|
OPERATION_COPY_TASK,
|
||||||
|
OPERATION_SUBLIST
|
||||||
|
};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
template <class T, int ID> inline static HRESULT Save(ATL::CAtlFile &f, const COperation *p);
|
||||||
|
template <class T> inline HRESULT LoadAndAddTail(ATL::CAtlFile &f);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CSession
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class CSession
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CSession();
|
||||||
|
|
||||||
|
MSIHANDLE m_hInstall; // Installer handle
|
||||||
|
BOOL m_bContinueOnError; // Continue execution on operation error?
|
||||||
|
BOOL m_bRollbackEnabled; // Is rollback enabled?
|
||||||
|
COpList m_olRollback; // Rollback operation list
|
||||||
|
COpList m_olCommit; // Commit operation list
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace AMSICA
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Local includes
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include <atlfile.h>
|
||||||
|
#include <atlstr.h>
|
||||||
|
#include <assert.h>
|
||||||
|
#include <msiquery.h>
|
||||||
|
#include <mstask.h>
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Inline Functions
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
inline UINT MsiGetPropertyA(MSIHANDLE hInstall, LPCSTR szName, ATL::CAtlStringA &sValue)
|
||||||
|
{
|
||||||
|
DWORD dwSize = 0;
|
||||||
|
UINT uiResult;
|
||||||
|
|
||||||
|
// Query the actual string length first.
|
||||||
|
uiResult = ::MsiGetPropertyA(hInstall, szName, "", &dwSize);
|
||||||
|
if (uiResult == ERROR_MORE_DATA) {
|
||||||
|
// Prepare the buffer to read the string data into and read it.
|
||||||
|
LPSTR szBuffer = sValue.GetBuffer(dwSize++);
|
||||||
|
if (!szBuffer) return ERROR_OUTOFMEMORY;
|
||||||
|
uiResult = ::MsiGetPropertyA(hInstall, szName, szBuffer, &dwSize);
|
||||||
|
sValue.ReleaseBuffer(uiResult == ERROR_SUCCESS ? dwSize : 0);
|
||||||
|
return uiResult;
|
||||||
|
} else if (uiResult == ERROR_SUCCESS) {
|
||||||
|
// The string in database is empty.
|
||||||
|
sValue.Empty();
|
||||||
|
return ERROR_SUCCESS;
|
||||||
|
} else {
|
||||||
|
// Return error code.
|
||||||
|
return uiResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline UINT MsiGetPropertyW(MSIHANDLE hInstall, LPCWSTR szName, ATL::CAtlStringW &sValue)
|
||||||
|
{
|
||||||
|
DWORD dwSize = 0;
|
||||||
|
UINT uiResult;
|
||||||
|
|
||||||
|
// Query the actual string length first.
|
||||||
|
uiResult = ::MsiGetPropertyW(hInstall, szName, L"", &dwSize);
|
||||||
|
if (uiResult == ERROR_MORE_DATA) {
|
||||||
|
// Prepare the buffer to read the string data into and read it.
|
||||||
|
LPWSTR szBuffer = sValue.GetBuffer(dwSize++);
|
||||||
|
if (!szBuffer) return ERROR_OUTOFMEMORY;
|
||||||
|
uiResult = ::MsiGetPropertyW(hInstall, szName, szBuffer, &dwSize);
|
||||||
|
sValue.ReleaseBuffer(uiResult == ERROR_SUCCESS ? dwSize : 0);
|
||||||
|
return uiResult;
|
||||||
|
} else if (uiResult == ERROR_SUCCESS) {
|
||||||
|
// The string in database is empty.
|
||||||
|
sValue.Empty();
|
||||||
|
return ERROR_SUCCESS;
|
||||||
|
} else {
|
||||||
|
// Return error code.
|
||||||
|
return uiResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline UINT MsiRecordGetStringA(MSIHANDLE hRecord, unsigned int iField, ATL::CAtlStringA &sValue)
|
||||||
|
{
|
||||||
|
DWORD dwSize = 0;
|
||||||
|
UINT uiResult;
|
||||||
|
|
||||||
|
// Query the actual string length first.
|
||||||
|
uiResult = ::MsiRecordGetStringA(hRecord, iField, "", &dwSize);
|
||||||
|
if (uiResult == ERROR_MORE_DATA) {
|
||||||
|
// Prepare the buffer to read the string data into and read it.
|
||||||
|
LPSTR szBuffer = sValue.GetBuffer(dwSize++);
|
||||||
|
if (!szBuffer) return ERROR_OUTOFMEMORY;
|
||||||
|
uiResult = ::MsiRecordGetStringA(hRecord, iField, szBuffer, &dwSize);
|
||||||
|
sValue.ReleaseBuffer(uiResult == ERROR_SUCCESS ? dwSize : 0);
|
||||||
|
return uiResult;
|
||||||
|
} else if (uiResult == ERROR_SUCCESS) {
|
||||||
|
// The string in database is empty.
|
||||||
|
sValue.Empty();
|
||||||
|
return ERROR_SUCCESS;
|
||||||
|
} else {
|
||||||
|
// Return error code.
|
||||||
|
return uiResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline UINT MsiRecordGetStringW(MSIHANDLE hRecord, unsigned int iField, ATL::CAtlStringW &sValue)
|
||||||
|
{
|
||||||
|
DWORD dwSize = 0;
|
||||||
|
UINT uiResult;
|
||||||
|
|
||||||
|
// Query the actual string length first.
|
||||||
|
uiResult = ::MsiRecordGetStringW(hRecord, iField, L"", &dwSize);
|
||||||
|
if (uiResult == ERROR_MORE_DATA) {
|
||||||
|
// Prepare the buffer to read the string data into and read it.
|
||||||
|
LPWSTR szBuffer = sValue.GetBuffer(dwSize++);
|
||||||
|
if (!szBuffer) return ERROR_OUTOFMEMORY;
|
||||||
|
uiResult = ::MsiRecordGetStringW(hRecord, iField, szBuffer, &dwSize);
|
||||||
|
sValue.ReleaseBuffer(uiResult == ERROR_SUCCESS ? dwSize : 0);
|
||||||
|
return uiResult;
|
||||||
|
} else if (uiResult == ERROR_SUCCESS) {
|
||||||
|
// The string in database is empty.
|
||||||
|
sValue.Empty();
|
||||||
|
return ERROR_SUCCESS;
|
||||||
|
} else {
|
||||||
|
// Return error code.
|
||||||
|
return uiResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline UINT MsiFormatRecordA(MSIHANDLE hInstall, MSIHANDLE hRecord, ATL::CAtlStringA &sValue)
|
||||||
|
{
|
||||||
|
DWORD dwSize = 0;
|
||||||
|
UINT uiResult;
|
||||||
|
|
||||||
|
// Query the final string length first.
|
||||||
|
uiResult = ::MsiFormatRecordA(hInstall, hRecord, "", &dwSize);
|
||||||
|
if (uiResult == ERROR_MORE_DATA) {
|
||||||
|
// Prepare the buffer to format the string data into and read it.
|
||||||
|
LPSTR szBuffer = sValue.GetBuffer(dwSize++);
|
||||||
|
if (!szBuffer) return ERROR_OUTOFMEMORY;
|
||||||
|
uiResult = ::MsiFormatRecordA(hInstall, hRecord, szBuffer, &dwSize);
|
||||||
|
sValue.ReleaseBuffer(uiResult == ERROR_SUCCESS ? dwSize : 0);
|
||||||
|
return uiResult;
|
||||||
|
} else if (uiResult == ERROR_SUCCESS) {
|
||||||
|
// The result is empty.
|
||||||
|
sValue.Empty();
|
||||||
|
return ERROR_SUCCESS;
|
||||||
|
} else {
|
||||||
|
// Return error code.
|
||||||
|
return uiResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline UINT MsiFormatRecordW(MSIHANDLE hInstall, MSIHANDLE hRecord, ATL::CAtlStringW &sValue)
|
||||||
|
{
|
||||||
|
DWORD dwSize = 0;
|
||||||
|
UINT uiResult;
|
||||||
|
|
||||||
|
// Query the final string length first.
|
||||||
|
uiResult = ::MsiFormatRecordW(hInstall, hRecord, L"", &dwSize);
|
||||||
|
if (uiResult == ERROR_MORE_DATA) {
|
||||||
|
// Prepare the buffer to format the string data into and read it.
|
||||||
|
LPWSTR szBuffer = sValue.GetBuffer(dwSize++);
|
||||||
|
if (!szBuffer) return ERROR_OUTOFMEMORY;
|
||||||
|
uiResult = ::MsiFormatRecordW(hInstall, hRecord, szBuffer, &dwSize);
|
||||||
|
sValue.ReleaseBuffer(uiResult == ERROR_SUCCESS ? dwSize : 0);
|
||||||
|
return uiResult;
|
||||||
|
} else if (uiResult == ERROR_SUCCESS) {
|
||||||
|
// The result is empty.
|
||||||
|
sValue.Empty();
|
||||||
|
return ERROR_SUCCESS;
|
||||||
|
} else {
|
||||||
|
// Return error code.
|
||||||
|
return uiResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline UINT MsiRecordFormatStringA(MSIHANDLE hInstall, MSIHANDLE hRecord, unsigned int iField, ATL::CAtlStringA &sValue)
|
||||||
|
{
|
||||||
|
UINT uiResult;
|
||||||
|
PMSIHANDLE hRecordEx;
|
||||||
|
|
||||||
|
// Read string to format.
|
||||||
|
uiResult = ::MsiRecordGetStringA(hRecord, iField, sValue);
|
||||||
|
if (uiResult != ERROR_SUCCESS) return uiResult;
|
||||||
|
|
||||||
|
// If the string is empty, there's nothing left to do.
|
||||||
|
if (sValue.IsEmpty()) return ERROR_SUCCESS;
|
||||||
|
|
||||||
|
// Create a record.
|
||||||
|
hRecordEx = ::MsiCreateRecord(1);
|
||||||
|
if (!hRecordEx) return ERROR_INVALID_HANDLE;
|
||||||
|
|
||||||
|
// Populate record with data.
|
||||||
|
uiResult = ::MsiRecordSetStringA(hRecordEx, 0, sValue);
|
||||||
|
if (uiResult != ERROR_SUCCESS) return uiResult;
|
||||||
|
|
||||||
|
// Do the formatting.
|
||||||
|
return ::MsiFormatRecordA(hInstall, hRecordEx, sValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline UINT MsiRecordFormatStringW(MSIHANDLE hInstall, MSIHANDLE hRecord, unsigned int iField, ATL::CAtlStringW &sValue)
|
||||||
|
{
|
||||||
|
UINT uiResult;
|
||||||
|
PMSIHANDLE hRecordEx;
|
||||||
|
|
||||||
|
// Read string to format.
|
||||||
|
uiResult = ::MsiRecordGetStringW(hRecord, iField, sValue);
|
||||||
|
if (uiResult != ERROR_SUCCESS) return uiResult;
|
||||||
|
|
||||||
|
// If the string is empty, there's nothing left to do.
|
||||||
|
if (sValue.IsEmpty()) return ERROR_SUCCESS;
|
||||||
|
|
||||||
|
// Create a record.
|
||||||
|
hRecordEx = ::MsiCreateRecord(1);
|
||||||
|
if (!hRecordEx) return ERROR_INVALID_HANDLE;
|
||||||
|
|
||||||
|
// Populate record with data.
|
||||||
|
uiResult = ::MsiRecordSetStringW(hRecordEx, 0, sValue);
|
||||||
|
if (uiResult != ERROR_SUCCESS) return uiResult;
|
||||||
|
|
||||||
|
// Do the formatting.
|
||||||
|
return ::MsiFormatRecordW(hInstall, hRecordEx, sValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef UNICODE
|
||||||
|
#define MsiRecordFormatString MsiRecordFormatStringW
|
||||||
|
#else
|
||||||
|
#define MsiRecordFormatString MsiRecordFormatStringA
|
||||||
|
#endif // !UNICODE
|
||||||
|
|
||||||
|
|
||||||
|
inline UINT MsiGetTargetPathA(MSIHANDLE hInstall, LPCSTR szFolder, ATL::CAtlStringA &sValue)
|
||||||
|
{
|
||||||
|
DWORD dwSize = 0;
|
||||||
|
UINT uiResult;
|
||||||
|
|
||||||
|
// Query the final string length first.
|
||||||
|
uiResult = ::MsiGetTargetPathA(hInstall, szFolder, "", &dwSize);
|
||||||
|
if (uiResult == ERROR_MORE_DATA) {
|
||||||
|
// Prepare the buffer to format the string data into and read it.
|
||||||
|
LPSTR szBuffer = sValue.GetBuffer(dwSize++);
|
||||||
|
if (!szBuffer) return ERROR_OUTOFMEMORY;
|
||||||
|
uiResult = ::MsiGetTargetPathA(hInstall, szFolder, szBuffer, &dwSize);
|
||||||
|
sValue.ReleaseBuffer(uiResult == ERROR_SUCCESS ? dwSize : 0);
|
||||||
|
return uiResult;
|
||||||
|
} else if (uiResult == ERROR_SUCCESS) {
|
||||||
|
// The result is empty.
|
||||||
|
sValue.Empty();
|
||||||
|
return ERROR_SUCCESS;
|
||||||
|
} else {
|
||||||
|
// Return error code.
|
||||||
|
return uiResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline UINT MsiGetTargetPathW(MSIHANDLE hInstall, LPCWSTR szFolder, ATL::CAtlStringW &sValue)
|
||||||
|
{
|
||||||
|
DWORD dwSize = 0;
|
||||||
|
UINT uiResult;
|
||||||
|
|
||||||
|
// Query the final string length first.
|
||||||
|
uiResult = ::MsiGetTargetPathW(hInstall, szFolder, L"", &dwSize);
|
||||||
|
if (uiResult == ERROR_MORE_DATA) {
|
||||||
|
// Prepare the buffer to format the string data into and read it.
|
||||||
|
LPWSTR szBuffer = sValue.GetBuffer(dwSize++);
|
||||||
|
if (!szBuffer) return ERROR_OUTOFMEMORY;
|
||||||
|
uiResult = ::MsiGetTargetPathW(hInstall, szFolder, szBuffer, &dwSize);
|
||||||
|
sValue.ReleaseBuffer(uiResult == ERROR_SUCCESS ? dwSize : 0);
|
||||||
|
return uiResult;
|
||||||
|
} else if (uiResult == ERROR_SUCCESS) {
|
||||||
|
// The result is empty.
|
||||||
|
sValue.Empty();
|
||||||
|
return ERROR_SUCCESS;
|
||||||
|
} else {
|
||||||
|
// Return error code.
|
||||||
|
return uiResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
namespace AMSICA {
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Inline operators
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
inline HRESULT operator <<(ATL::CAtlFile &f, int i)
|
||||||
|
{
|
||||||
|
return f.Write(&i, sizeof(int));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT operator >>(ATL::CAtlFile &f, int &i)
|
||||||
|
{
|
||||||
|
return f.Read(&i, sizeof(int));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT operator <<(ATL::CAtlFile &f, const ATL::CAtlStringA &str)
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
int iLength = str.GetLength();
|
||||||
|
|
||||||
|
// Write string length (in characters) as 32-bit integer.
|
||||||
|
hr = f.Write(&iLength, sizeof(int));
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
|
||||||
|
// Write string data (without terminator).
|
||||||
|
return f.Write((LPCSTR)str, sizeof(CHAR) * iLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT operator >>(ATL::CAtlFile &f, ATL::CAtlStringA &str)
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
int iLength;
|
||||||
|
LPSTR buf;
|
||||||
|
|
||||||
|
// Read string length (in characters) as 32-bit integer.
|
||||||
|
hr = f.Read(&iLength, sizeof(int));
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
|
||||||
|
// Allocate the buffer.
|
||||||
|
buf = str.GetBuffer(iLength);
|
||||||
|
if (!buf) return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
// Read string data (without terminator).
|
||||||
|
hr = f.Read(buf, sizeof(CHAR) * iLength);
|
||||||
|
str.ReleaseBuffer(SUCCEEDED(hr) ? iLength : 0);
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT operator <<(ATL::CAtlFile &f, const ATL::CAtlStringW &str)
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
int iLength = str.GetLength();
|
||||||
|
|
||||||
|
// Write string length (in characters) as 32-bit integer.
|
||||||
|
hr = f.Write(&iLength, sizeof(int));
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
|
||||||
|
// Write string data (without terminator).
|
||||||
|
return f.Write((LPCWSTR)str, sizeof(WCHAR) * iLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT operator >>(ATL::CAtlFile &f, ATL::CAtlStringW &str)
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
int iLength;
|
||||||
|
LPWSTR buf;
|
||||||
|
|
||||||
|
// Read string length (in characters) as 32-bit integer.
|
||||||
|
hr = f.Read(&iLength, sizeof(int));
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
|
||||||
|
// Allocate the buffer.
|
||||||
|
buf = str.GetBuffer(iLength);
|
||||||
|
if (!buf) return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
// Read string data (without terminator).
|
||||||
|
hr = f.Read(buf, sizeof(WCHAR) * iLength);
|
||||||
|
str.ReleaseBuffer(SUCCEEDED(hr) ? iLength : 0);
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT operator <<(ATL::CAtlFile &f, const TASK_TRIGGER &ttData)
|
||||||
|
{
|
||||||
|
return f.Write(&ttData, sizeof(TASK_TRIGGER));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT operator >>(ATL::CAtlFile &f, TASK_TRIGGER &ttData)
|
||||||
|
{
|
||||||
|
return f.Read(&ttData, sizeof(TASK_TRIGGER));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT operator <<(ATL::CAtlFile &f, const AMSICA::COperation &op)
|
||||||
|
{
|
||||||
|
return f << op.m_iTicks;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT operator >>(ATL::CAtlFile &f, COperation &op)
|
||||||
|
{
|
||||||
|
return f >> op.m_iTicks;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT operator <<(ATL::CAtlFile &f, const COpTypeSingleString &op)
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
hr = f << (const COperation &)op;
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
|
||||||
|
return f << op.m_sValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT operator >>(ATL::CAtlFile &f, COpTypeSingleString &op)
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
hr = f >> (COperation &)op;
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
|
||||||
|
return f >> op.m_sValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT operator <<(ATL::CAtlFile &f, const COpTypeSrcDstString &op)
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
hr = f << (const COperation &)op;
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
|
||||||
|
hr = f << op.m_sValue1;
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
|
||||||
|
return f << op.m_sValue2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT operator >>(ATL::CAtlFile &f, COpTypeSrcDstString &op)
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
hr = f >> (COperation &)op;
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
|
||||||
|
hr = f >> op.m_sValue1;
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
|
||||||
|
return f >> op.m_sValue2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT operator <<(ATL::CAtlFile &f, const COpTypeBoolean &op)
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
hr = f << (const COperation &)op;
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
|
||||||
|
return f << (int)op.m_bValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT operator >>(ATL::CAtlFile &f, COpTypeBoolean &op)
|
||||||
|
{
|
||||||
|
int iValue;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
hr = f >> (COperation &)op;
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
|
||||||
|
hr = f >> iValue;
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
op.m_bValue = iValue ? TRUE : FALSE;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT operator <<(ATL::CAtlFile &f, const COpTaskCreate &op)
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
POSITION pos;
|
||||||
|
|
||||||
|
hr = f << (const COpTypeSingleString&)op; if (FAILED(hr)) return hr;
|
||||||
|
hr = f << op.m_sApplicationName; if (FAILED(hr)) return hr;
|
||||||
|
hr = f << op.m_sParameters; if (FAILED(hr)) return hr;
|
||||||
|
hr = f << op.m_sWorkingDirectory; if (FAILED(hr)) return hr;
|
||||||
|
hr = f << op.m_sAuthor; if (FAILED(hr)) return hr;
|
||||||
|
hr = f << op.m_sComment; if (FAILED(hr)) return hr;
|
||||||
|
hr = f << (int)op.m_dwFlags; if (FAILED(hr)) return hr;
|
||||||
|
hr = f << (int)op.m_dwPriority; if (FAILED(hr)) return hr;
|
||||||
|
hr = f << op.m_sAccountName; if (FAILED(hr)) return hr;
|
||||||
|
hr = f << op.m_sPassword; if (FAILED(hr)) return hr;
|
||||||
|
hr = f << (int)MAKELONG(op.m_wDeadlineMinutes, op.m_wIdleMinutes); if (FAILED(hr)) return hr;
|
||||||
|
hr = f << (int)op.m_dwMaxRuntimeMS; if (FAILED(hr)) return hr;
|
||||||
|
hr = f << (int)op.m_lTriggers.GetCount(); if (FAILED(hr)) return hr;
|
||||||
|
for (pos = op.m_lTriggers.GetHeadPosition(); pos;) {
|
||||||
|
hr = f << op.m_lTriggers.GetNext(pos);
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT operator >>(ATL::CAtlFile &f, COpTaskCreate &op)
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
DWORD dwValue;
|
||||||
|
|
||||||
|
hr = f >> (COpTypeSingleString&)op; if (FAILED(hr)) return hr;
|
||||||
|
hr = f >> op.m_sApplicationName; if (FAILED(hr)) return hr;
|
||||||
|
hr = f >> op.m_sParameters; if (FAILED(hr)) return hr;
|
||||||
|
hr = f >> op.m_sWorkingDirectory; if (FAILED(hr)) return hr;
|
||||||
|
hr = f >> op.m_sAuthor; if (FAILED(hr)) return hr;
|
||||||
|
hr = f >> op.m_sComment; if (FAILED(hr)) return hr;
|
||||||
|
hr = f >> (int&)op.m_dwFlags; if (FAILED(hr)) return hr;
|
||||||
|
hr = f >> (int&)op.m_dwPriority; if (FAILED(hr)) return hr;
|
||||||
|
hr = f >> op.m_sAccountName; if (FAILED(hr)) return hr;
|
||||||
|
hr = f >> op.m_sPassword; if (FAILED(hr)) return hr;
|
||||||
|
hr = f >> (int&)dwValue; if (FAILED(hr)) return hr; op.m_wIdleMinutes = HIWORD(dwValue); op.m_wDeadlineMinutes = LOWORD(dwValue);
|
||||||
|
hr = f >> (int&)op.m_dwMaxRuntimeMS; if (FAILED(hr)) return hr;
|
||||||
|
hr = f >> (int&)dwValue; if (FAILED(hr)) return hr;
|
||||||
|
while (dwValue--) {
|
||||||
|
TASK_TRIGGER ttData;
|
||||||
|
hr = f >> ttData;
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
op.m_lTriggers.AddTail(ttData);
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT operator <<(ATL::CAtlFile &f, const COpTaskEnable &op)
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
hr = f << (const COpTypeSingleString&)op;
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
|
||||||
|
return f << (int)op.m_bEnable;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT operator >>(ATL::CAtlFile &f, COpTaskEnable &op)
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
int iTemp;
|
||||||
|
|
||||||
|
hr = f >> (COpTypeSingleString&)op;
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
|
||||||
|
hr = f >> iTemp;
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
op.m_bEnable = iTemp ? TRUE : FALSE;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT operator <<(ATL::CAtlFile &f, const COpList &list)
|
||||||
|
{
|
||||||
|
POSITION pos;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
hr = f << (const COperation &)list;
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
|
||||||
|
hr = f << (int)list.GetCount();
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
|
||||||
|
for (pos = list.GetHeadPosition(); pos;) {
|
||||||
|
const COperation *pOp = list.GetNext(pos);
|
||||||
|
if (dynamic_cast<const COpRollbackEnable*>(pOp))
|
||||||
|
hr = list.Save<COpRollbackEnable, COpList::OPERATION_ENABLE_ROLLBACK>(f, pOp);
|
||||||
|
else if (dynamic_cast<const COpFileDelete*>(pOp))
|
||||||
|
hr = list.Save<COpFileDelete, COpList::OPERATION_DELETE_FILE>(f, pOp);
|
||||||
|
else if (dynamic_cast<const COpFileMove*>(pOp))
|
||||||
|
hr = list.Save<COpFileMove, COpList::OPERATION_MOVE_FILE>(f, pOp);
|
||||||
|
else if (dynamic_cast<const COpTaskCreate*>(pOp))
|
||||||
|
hr = list.Save<COpTaskCreate, COpList::OPERATION_CREATE_TASK>(f, pOp);
|
||||||
|
else if (dynamic_cast<const COpTaskDelete*>(pOp))
|
||||||
|
hr = list.Save<COpTaskDelete, COpList::OPERATION_DELETE_TASK>(f, pOp);
|
||||||
|
else if (dynamic_cast<const COpTaskEnable*>(pOp))
|
||||||
|
hr = list.Save<COpTaskEnable, COpList::OPERATION_ENABLE_TASK>(f, pOp);
|
||||||
|
else if (dynamic_cast<const COpTaskCopy*>(pOp))
|
||||||
|
hr = list.Save<COpTaskCopy, COpList::OPERATION_COPY_TASK>(f, pOp);
|
||||||
|
else if (dynamic_cast<const COpList*>(pOp))
|
||||||
|
hr = list.Save<COpList, COpList::OPERATION_SUBLIST>(f, pOp);
|
||||||
|
else {
|
||||||
|
// Unsupported type of operation.
|
||||||
|
assert(0);
|
||||||
|
hr = E_UNEXPECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT operator >>(ATL::CAtlFile &f, COpList &list)
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
DWORD dwCount;
|
||||||
|
|
||||||
|
hr = f >> (COperation &)list;
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
|
||||||
|
hr = f >> (int&)dwCount;
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
|
||||||
|
while (dwCount--) {
|
||||||
|
int iTemp;
|
||||||
|
|
||||||
|
hr = f >> iTemp;
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
|
||||||
|
switch ((COpList::OPERATION)iTemp) {
|
||||||
|
case COpList::OPERATION_ENABLE_ROLLBACK:
|
||||||
|
hr = list.LoadAndAddTail<COpRollbackEnable>(f);
|
||||||
|
break;
|
||||||
|
case COpList::OPERATION_DELETE_FILE:
|
||||||
|
hr = list.LoadAndAddTail<COpFileDelete>(f);
|
||||||
|
break;
|
||||||
|
case COpList::OPERATION_MOVE_FILE:
|
||||||
|
hr = list.LoadAndAddTail<COpFileMove>(f);
|
||||||
|
break;
|
||||||
|
case COpList::OPERATION_CREATE_TASK:
|
||||||
|
hr = list.LoadAndAddTail<COpTaskCreate>(f);
|
||||||
|
break;
|
||||||
|
case COpList::OPERATION_DELETE_TASK:
|
||||||
|
hr = list.LoadAndAddTail<COpTaskDelete>(f);
|
||||||
|
break;
|
||||||
|
case COpList::OPERATION_ENABLE_TASK:
|
||||||
|
hr = list.LoadAndAddTail<COpTaskEnable>(f);
|
||||||
|
break;
|
||||||
|
case COpList::OPERATION_COPY_TASK:
|
||||||
|
hr = list.LoadAndAddTail<COpTaskCopy>(f);
|
||||||
|
break;
|
||||||
|
case COpList::OPERATION_SUBLIST:
|
||||||
|
hr = list.LoadAndAddTail<COpList>(f);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// Unsupported type of operation.
|
||||||
|
assert(0);
|
||||||
|
hr = E_UNEXPECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Inline methods
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
template <class T, int ID> inline static HRESULT COpList::Save(ATL::CAtlFile &f, const COperation *p)
|
||||||
|
{
|
||||||
|
assert(p);
|
||||||
|
HRESULT hr;
|
||||||
|
const T *pp = dynamic_cast<const T*>(p);
|
||||||
|
if (!pp) return E_UNEXPECTED;
|
||||||
|
|
||||||
|
hr = f << (int)ID;
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
|
||||||
|
return f << *pp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <class T> inline HRESULT COpList::LoadAndAddTail(ATL::CAtlFile &f)
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
// Create element.
|
||||||
|
T *p = new T();
|
||||||
|
if (!p) return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
// Load element from file.
|
||||||
|
hr = f >> *p;
|
||||||
|
if (FAILED(hr)) {
|
||||||
|
delete p;
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add element.
|
||||||
|
AddTail(p);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace AMSICA
|
||||||
|
|
||||||
|
|
||||||
|
#endif // RC_INVOKED
|
||||||
|
#endif // __AMSICA_H__
|
48
AMSICA/include/StdAfx.h
Normal file
48
AMSICA/include/StdAfx.h
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
// StdAfx.h : include file for standard system include files,
|
||||||
|
// or project specific include files that are used frequently,
|
||||||
|
// but are changed infrequently
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#if defined(_UNICODE) && !defined(UNICODE)
|
||||||
|
#define UNICODE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_WIN32) && !defined(WIN32)
|
||||||
|
#define WIN32
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef STRICT
|
||||||
|
#define STRICT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
|
||||||
|
#define _WIN32_WINNT 0x0501 // Include Windows XP symbols
|
||||||
|
#define _WINSOCKAPI_ // Prevent inclusion of winsock.h in windows.h
|
||||||
|
#ifdef _WINDLL
|
||||||
|
#define AMSICA_DLL // This is a DLL
|
||||||
|
#endif
|
||||||
|
//#define _ATL_APARTMENT_THREADED
|
||||||
|
//#define _ATL_NO_AUTOMATIC_NAMESPACE
|
||||||
|
//#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // Some CString constructors will be explicit
|
||||||
|
|
||||||
|
#include <atlbase.h>
|
||||||
|
#include <atlfile.h>
|
||||||
|
#include <atlstr.h>
|
||||||
|
|
||||||
|
using namespace ATL;
|
||||||
|
|
||||||
|
#include "BuildNum.h"
|
||||||
|
|
||||||
|
#include "AMSICA.h"
|
||||||
|
|
||||||
|
#include <msi.h>
|
||||||
|
#include <msiquery.h>
|
||||||
|
#include <mstask.h>
|
||||||
|
#include <taskschd.h>
|
||||||
|
|
||||||
|
#ifdef NDEBUG
|
||||||
|
#define verify(expr) ((void)(expr))
|
||||||
|
#else
|
||||||
|
#define verify(expr) assert(expr)
|
||||||
|
#endif
|
59
AMSICA/msm/Makefile
Normal file
59
AMSICA/msm/Makefile
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
!INCLUDE "..\..\include\MSINast.mak"
|
||||||
|
|
||||||
|
MSM_IMA_LOKALIZACIJO=1
|
||||||
|
!IF "$(CFG)" == "ReleaseU"
|
||||||
|
CFG_VC=Unicode Release
|
||||||
|
!ELSEIF "$(CFG)" == "DebugU"
|
||||||
|
CFG_VC=Unicode Debug
|
||||||
|
!ELSE
|
||||||
|
CFG_VC=$(CFG)
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
# Error
|
||||||
|
|
||||||
|
Vse :: \
|
||||||
|
"$(JEZIK).$(CFG).$(PLAT).Error-1.idt" \
|
||||||
|
"$(JEZIK).$(CFG).$(PLAT).Error-2.idt"
|
||||||
|
|
||||||
|
"$(JEZIK).$(CFG).$(PLAT).Error-1.idt" : "Makefile" "..\..\include\MSINast.mak"
|
||||||
|
-if exist $@ del /f /q $@
|
||||||
|
move /y << $@ > NUL
|
||||||
|
Error Message
|
||||||
|
i2 L0
|
||||||
|
Error Error
|
||||||
|
<<NOKEEP
|
||||||
|
|
||||||
|
"Sl.$(CFG).$(PLAT).Error-2.idtx" : "Makefile" "..\..\include\MSINast.mak"
|
||||||
|
-if exist $@ del /f /q $@
|
||||||
|
move /y << $@ > NUL
|
||||||
|
Error Message
|
||||||
|
i2 L0
|
||||||
|
1250 Error Error
|
||||||
|
2554 Pri brisanju datoteke »[2]« je prišlo do napake [3]. Obrnite se na svojo tehnièno službo.
|
||||||
|
2555 Pri premikanju datoteke »[2]« v »[3]« je prišlo do napake [4]. Obrnite se na svojo tehnièno službo.
|
||||||
|
2556 Pri ustvarjanju razporejenega opravila »[2]« je prišlo do napake [3]. Obrnite se na svojo tehnièno službo.
|
||||||
|
2557 Pri brisanju razporejenega opravila »[2]« je prišlo do napake [3]. Obrnite se na svojo tehnièno službo.
|
||||||
|
2558 Pri o(ne)mogoèanju razporejenega opravila »[2]« je prišlo do napake [3]. Obrnite se na svojo tehnièno službo.
|
||||||
|
2559 Pri kopiranju razporejenega opravila »[2]« v »[3]« je prišlo do napake [4]. Obrnite se na svojo tehnièno službo.
|
||||||
|
<<NOKEEP
|
||||||
|
|
||||||
|
"De.$(CFG).$(PLAT).Error-2.idt" : "Sl.$(CFG).$(PLAT).Error-2.idtx" "..\res\de_DE.po"
|
||||||
|
rcxgettext.exe idtp $@ $**
|
||||||
|
|
||||||
|
"En.$(CFG).$(PLAT).Error-2.idt" : "Sl.$(CFG).$(PLAT).Error-2.idtx" "..\res\en_GB.po"
|
||||||
|
rcxgettext.exe idtp $@ $**
|
||||||
|
|
||||||
|
"It.$(CFG).$(PLAT).Error-2.idt" : "Sl.$(CFG).$(PLAT).Error-2.idtx" "..\res\it_IT.po"
|
||||||
|
rcxgettext.exe idtp $@ $**
|
||||||
|
|
||||||
|
"Sl.$(CFG).$(PLAT).Error-2.idt" : "Sl.$(CFG).$(PLAT).Error-2.idtx"
|
||||||
|
copy /y $** $@ > NUL
|
||||||
|
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
# Izdelava modula MSM
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
!INCLUDE "..\..\AOsn\msm\MSM.mak"
|
77
AMSICA/res/en_GB.po
Normal file
77
AMSICA/res/en_GB.po
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: MSITSCA\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2013-04-26 11:07+0100\n"
|
||||||
|
"PO-Revision-Date: \n"
|
||||||
|
"Last-Translator: Simon Rozman <simon.rozman@amebis.si>\n"
|
||||||
|
"Language-Team: Amebis, d. o. o., Kamnik <simon.rozman@amebis.si>\n"
|
||||||
|
"Language: en\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"X-Poedit-SourceCharset: UTF-8\n"
|
||||||
|
"X-Poedit-KeywordsList: __\n"
|
||||||
|
"X-Poedit-Basepath: .\n"
|
||||||
|
"X-Generator: Poedit 1.5.5\n"
|
||||||
|
"X-Poedit-SearchPath-0: .\n"
|
||||||
|
"X-Poedit-SearchPath-1: ..\\msm\n"
|
||||||
|
|
||||||
|
# Privzeta kodna stran ANSI za ta jezik (desetiško)
|
||||||
|
#: ..\msm/Sl.DebugU.Win32.Error-2.idtx:3 ..\msm/Sl.DebugU.x64.Error-2.idtx:3
|
||||||
|
#: ..\msm/Sl.ReleaseU.Win32.Error-2.idtx:3
|
||||||
|
msgid "1250"
|
||||||
|
msgstr "1252"
|
||||||
|
|
||||||
|
#: ..\msm/Sl.DebugU.Win32.Error-2.idtx:4 ..\msm/Sl.DebugU.x64.Error-2.idtx:4
|
||||||
|
#: ..\msm/Sl.ReleaseU.Win32.Error-2.idtx:4
|
||||||
|
msgid ""
|
||||||
|
"Pri brisanju datoteke »[2]« je prišlo do napake [3]. Obrnite se na svojo "
|
||||||
|
"tehnično službo."
|
||||||
|
msgstr ""
|
||||||
|
"Error [3] deleting \"[2]\" file. Please, contact your support personnel."
|
||||||
|
|
||||||
|
#: ..\msm/Sl.DebugU.Win32.Error-2.idtx:7 ..\msm/Sl.DebugU.x64.Error-2.idtx:7
|
||||||
|
#: ..\msm/Sl.ReleaseU.Win32.Error-2.idtx:7
|
||||||
|
msgid ""
|
||||||
|
"Pri brisanju razporejenega opravila »[2]« je prišlo do napake [3]. Obrnite "
|
||||||
|
"se na svojo tehnično službo."
|
||||||
|
msgstr ""
|
||||||
|
"Error [3] deleting \"[2]\" scheduled task. Please, contact your support "
|
||||||
|
"personnel."
|
||||||
|
|
||||||
|
#: ..\msm/Sl.DebugU.Win32.Error-2.idtx:9 ..\msm/Sl.DebugU.x64.Error-2.idtx:9
|
||||||
|
#: ..\msm/Sl.ReleaseU.Win32.Error-2.idtx:9
|
||||||
|
msgid ""
|
||||||
|
"Pri kopiranju razporejenega opravila »[2]« v »[3]« je prišlo do napake [4]. "
|
||||||
|
"Obrnite se na svojo tehnično službo."
|
||||||
|
msgstr ""
|
||||||
|
"Error [4] copying \"[2]\" scheduled task to \"[3]\". Please, contact your "
|
||||||
|
"support personnel."
|
||||||
|
|
||||||
|
#: ..\msm/Sl.DebugU.Win32.Error-2.idtx:8 ..\msm/Sl.DebugU.x64.Error-2.idtx:8
|
||||||
|
#: ..\msm/Sl.ReleaseU.Win32.Error-2.idtx:8
|
||||||
|
msgid ""
|
||||||
|
"Pri o(ne)mogočanju razporejenega opravila »[2]« je prišlo do napake [3]. "
|
||||||
|
"Obrnite se na svojo tehnično službo."
|
||||||
|
msgstr ""
|
||||||
|
"Error [3] enabling/disabling \"[2]\" scheduled task. Please, contact your "
|
||||||
|
"support personnel."
|
||||||
|
|
||||||
|
#: ..\msm/Sl.DebugU.Win32.Error-2.idtx:5 ..\msm/Sl.DebugU.x64.Error-2.idtx:5
|
||||||
|
#: ..\msm/Sl.ReleaseU.Win32.Error-2.idtx:5
|
||||||
|
msgid ""
|
||||||
|
"Pri premikanju datoteke »[2]« v »[3]« je prišlo do napake [4]. Obrnite se na "
|
||||||
|
"svojo tehnično službo."
|
||||||
|
msgstr ""
|
||||||
|
"Error [4] moving \"[2]\" file to \"[3]\". Please, contact your support "
|
||||||
|
"personnel."
|
||||||
|
|
||||||
|
#: ..\msm/Sl.DebugU.Win32.Error-2.idtx:6 ..\msm/Sl.DebugU.x64.Error-2.idtx:6
|
||||||
|
#: ..\msm/Sl.ReleaseU.Win32.Error-2.idtx:6
|
||||||
|
msgid ""
|
||||||
|
"Pri ustvarjanju razporejenega opravila »[2]« je prišlo do napake [3]. "
|
||||||
|
"Obrnite se na svojo tehnično službo."
|
||||||
|
msgstr ""
|
||||||
|
"Error [3] creating \"[2]\" scheduled task. Please, contact your support "
|
||||||
|
"personnel."
|
182
AMSICA/src/AMSICA.cpp
Normal file
182
AMSICA/src/AMSICA.cpp
Normal file
@ -0,0 +1,182 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace AMSICA {
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
// COperation
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
COperation::COperation(int iTicks) :
|
||||||
|
m_iTicks(iTicks)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
// COpTypeSingleString
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
COpTypeSingleString::COpTypeSingleString(LPCWSTR pszValue, int iTicks) :
|
||||||
|
m_sValue(pszValue),
|
||||||
|
COperation(iTicks)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
// COpDoubleStringOperation
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
COpTypeSrcDstString::COpTypeSrcDstString(LPCWSTR pszValue1, LPCWSTR pszValue2, int iTicks) :
|
||||||
|
m_sValue1(pszValue1),
|
||||||
|
m_sValue2(pszValue2),
|
||||||
|
COperation(iTicks)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
// COpTypeBoolean
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
COpTypeBoolean::COpTypeBoolean(BOOL bValue, int iTicks) :
|
||||||
|
m_bValue(bValue),
|
||||||
|
COperation(iTicks)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
// COpRollbackEnable
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
COpRollbackEnable::COpRollbackEnable(BOOL bEnable, int iTicks) :
|
||||||
|
COpTypeBoolean(bEnable, iTicks)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT COpRollbackEnable::Execute(CSession *pSession)
|
||||||
|
{
|
||||||
|
assert(pSession);
|
||||||
|
|
||||||
|
pSession->m_bRollbackEnabled = m_bValue;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
// COpList
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
COpList::COpList(int iTicks) :
|
||||||
|
COperation(iTicks),
|
||||||
|
ATL::CAtlList<COperation*>(sizeof(COperation*))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void COpList::Free()
|
||||||
|
{
|
||||||
|
POSITION pos;
|
||||||
|
|
||||||
|
for (pos = GetHeadPosition(); pos;) {
|
||||||
|
COperation *pOp = GetNext(pos);
|
||||||
|
COpList *pOpList = dynamic_cast<COpList*>(pOp);
|
||||||
|
|
||||||
|
if (pOpList) {
|
||||||
|
// Recursivelly free sublists.
|
||||||
|
pOpList->Free();
|
||||||
|
}
|
||||||
|
delete pOp;
|
||||||
|
}
|
||||||
|
|
||||||
|
RemoveAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT COpList::LoadFromFile(LPCTSTR pszFileName)
|
||||||
|
{
|
||||||
|
assert(pszFileName);
|
||||||
|
HRESULT hr;
|
||||||
|
ATL::CAtlFile fSequence;
|
||||||
|
|
||||||
|
hr = fSequence.Create(pszFileName, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN);
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
|
||||||
|
// Load operation sequence.
|
||||||
|
return fSequence >> *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT COpList::SaveToFile(LPCTSTR pszFileName) const
|
||||||
|
{
|
||||||
|
assert(pszFileName);
|
||||||
|
HRESULT hr;
|
||||||
|
ATL::CAtlFile fSequence;
|
||||||
|
|
||||||
|
hr = fSequence.Create(pszFileName, GENERIC_WRITE, FILE_SHARE_READ, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN);
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
|
||||||
|
// Save execute sequence to file.
|
||||||
|
hr = fSequence << *this;
|
||||||
|
fSequence.Close();
|
||||||
|
|
||||||
|
if (FAILED(hr)) ::DeleteFile(pszFileName);
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT COpList::Execute(CSession *pSession)
|
||||||
|
{
|
||||||
|
assert(pSession);
|
||||||
|
POSITION pos;
|
||||||
|
HRESULT hr;
|
||||||
|
PMSIHANDLE hRecordProg = ::MsiCreateRecord(3);
|
||||||
|
|
||||||
|
// Tell the installer to use explicit progress messages.
|
||||||
|
verify(::MsiRecordSetInteger(hRecordProg, 1, 1) == ERROR_SUCCESS);
|
||||||
|
verify(::MsiRecordSetInteger(hRecordProg, 2, 1) == ERROR_SUCCESS);
|
||||||
|
verify(::MsiRecordSetInteger(hRecordProg, 3, 0) == ERROR_SUCCESS);
|
||||||
|
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_PROGRESS, hRecordProg);
|
||||||
|
|
||||||
|
// Prepare hRecordProg for progress messages.
|
||||||
|
verify(::MsiRecordSetInteger(hRecordProg, 1, 2) == ERROR_SUCCESS);
|
||||||
|
verify(::MsiRecordSetInteger(hRecordProg, 3, 0) == ERROR_SUCCESS);
|
||||||
|
|
||||||
|
for (pos = GetHeadPosition(); pos;) {
|
||||||
|
COperation *pOp = GetNext(pos);
|
||||||
|
assert(pOp);
|
||||||
|
|
||||||
|
hr = pOp->Execute(pSession);
|
||||||
|
if (!pSession->m_bContinueOnError && FAILED(hr)) {
|
||||||
|
// Operation failed. Its Execute() method should have sent error message to Installer.
|
||||||
|
// Therefore, just quit here.
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
verify(::MsiRecordSetInteger(hRecordProg, 2, pOp->m_iTicks) == ERROR_SUCCESS);
|
||||||
|
if (::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_PROGRESS, hRecordProg) == IDCANCEL)
|
||||||
|
return AtlHresultFromWin32(ERROR_INSTALL_USEREXIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
verify(::MsiRecordSetInteger(hRecordProg, 2, m_iTicks) == ERROR_SUCCESS);
|
||||||
|
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_PROGRESS, hRecordProg);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
// CSession
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CSession::CSession() :
|
||||||
|
m_bContinueOnError(FALSE),
|
||||||
|
m_bRollbackEnabled(FALSE)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace AMSICA
|
90
AMSICA/src/AMSICAFileOp.cpp
Normal file
90
AMSICA/src/AMSICAFileOp.cpp
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
#include "StdAfx.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace AMSICA {
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
// COpFileDelete
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
COpFileDelete::COpFileDelete(LPCWSTR pszFileName, int iTicks) :
|
||||||
|
COpTypeSingleString(pszFileName, iTicks)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT COpFileDelete::Execute(CSession *pSession)
|
||||||
|
{
|
||||||
|
assert(pSession);
|
||||||
|
DWORD dwError;
|
||||||
|
|
||||||
|
if (pSession->m_bRollbackEnabled) {
|
||||||
|
ATL::CAtlStringW sBackupName;
|
||||||
|
UINT uiCount = 0;
|
||||||
|
|
||||||
|
do {
|
||||||
|
// Rename the file to make a backup.
|
||||||
|
sBackupName.Format(L"%ls (orig %u)", (LPCWSTR)m_sValue, ++uiCount);
|
||||||
|
dwError = ::MoveFileW(m_sValue, sBackupName) ? ERROR_SUCCESS : ::GetLastError();
|
||||||
|
} while (dwError == ERROR_ALREADY_EXISTS);
|
||||||
|
if (dwError == ERROR_SUCCESS) {
|
||||||
|
// Order rollback action to restore from backup copy.
|
||||||
|
pSession->m_olRollback.AddHead(new COpFileMove(sBackupName, m_sValue));
|
||||||
|
|
||||||
|
// Order commit action to delete backup copy.
|
||||||
|
pSession->m_olCommit.AddTail(new COpFileDelete(sBackupName));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Delete the file.
|
||||||
|
dwError = ::DeleteFileW(m_sValue) ? ERROR_SUCCESS : ::GetLastError();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dwError == ERROR_SUCCESS || dwError == ERROR_FILE_NOT_FOUND)
|
||||||
|
return S_OK;
|
||||||
|
else {
|
||||||
|
PMSIHANDLE hRecordProg = ::MsiCreateRecord(3);
|
||||||
|
verify(::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_DELETE_FAILED) == ERROR_SUCCESS);
|
||||||
|
verify(::MsiRecordSetStringW(hRecordProg, 2, m_sValue ) == ERROR_SUCCESS);
|
||||||
|
verify(::MsiRecordSetInteger(hRecordProg, 3, dwError ) == ERROR_SUCCESS);
|
||||||
|
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
||||||
|
return AtlHresultFromWin32(dwError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
// COpFileMove
|
||||||
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
COpFileMove::COpFileMove(LPCWSTR pszFileSrc, LPCWSTR pszFileDst, int iTicks) :
|
||||||
|
COpTypeSrcDstString(pszFileSrc, pszFileDst, iTicks)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT COpFileMove::Execute(CSession *pSession)
|
||||||
|
{
|
||||||
|
assert(pSession);
|
||||||
|
DWORD dwError;
|
||||||
|
|
||||||
|
// Move the file.
|
||||||
|
dwError = ::MoveFileW(m_sValue1, m_sValue2) ? ERROR_SUCCESS : ::GetLastError();
|
||||||
|
if (dwError == ERROR_SUCCESS) {
|
||||||
|
if (pSession->m_bRollbackEnabled) {
|
||||||
|
// Order rollback action to move it back.
|
||||||
|
pSession->m_olRollback.AddHead(new COpFileMove(m_sValue2, m_sValue1));
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
} else {
|
||||||
|
PMSIHANDLE hRecordProg = ::MsiCreateRecord(4);
|
||||||
|
verify(::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_MOVE_FAILED) == ERROR_SUCCESS);
|
||||||
|
verify(::MsiRecordSetStringW(hRecordProg, 2, m_sValue1 ) == ERROR_SUCCESS);
|
||||||
|
verify(::MsiRecordSetStringW(hRecordProg, 3, m_sValue2 ) == ERROR_SUCCESS);
|
||||||
|
verify(::MsiRecordSetInteger(hRecordProg, 4, dwError ) == ERROR_SUCCESS);
|
||||||
|
::MsiProcessMessage(pSession->m_hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
|
||||||
|
return AtlHresultFromWin32(dwError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace AMSICA
|
1040
AMSICA/src/AMSICATSOp.cpp
Normal file
1040
AMSICA/src/AMSICATSOp.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1
AMSICA/src/StdAfx.cpp
Normal file
1
AMSICA/src/StdAfx.cpp
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include "StdAfx.h"
|
Loading…
x
Reference in New Issue
Block a user