Add a console client.

This commit is contained in:
Bruce
2025-02-22 11:27:28 +08:00
parent 3a70be9491
commit 0ff448fdb8
59 changed files with 5431 additions and 2 deletions

View File

@@ -0,0 +1,529 @@
// Microsoft Visual C++ generated resource script.
//
#include <Windows.h>
#include "resource.h"
/////////////////////////////////////////////////////////////////////////////
// 中文(简体,中国) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
#pragma code_page(936)
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_MAINICON ICON "res/Icons/Main.ico"
ICON_TASKBAR ICON "res/Icons/Main.ico"
ICON_FILE ICON "res/Icons/FileIcon.ico"
ICON_WHITE ICON "res/Icons/IconWhite.ico"
ICON_COLOR ICON "res/Icons/IconColor.ico"
/////////////////////////////////////////////////////////////////////////////
//
// IMAGE
//
BLANK_NORMAL IMAGE "res/Button/Normal/blank.png"
BLANK_LIGHT IMAGE "res/Button/Normal/blank_light.png"
BLANK_PRESS IMAGE "res/Button/Normal/blank_press.png"
MIN_NORMAL IMAGE "res/Button/Normal/min_back.png"
MIN_LIGHT IMAGE "res/Button/Normal/min_light.png"
MIN_PRESS IMAGE "res/Button/Normal/min_press.png"
MAX_NORMAL IMAGE "res/Button/Normal/max_back.png"
MAX_LIGHT IMAGE "res/Button/Normal/max_light.png"
MAX_PRESS IMAGE "res/Button/Normal/max_press.png"
RESTORE_NORMAL IMAGE "res/Button/Normal/restore_back.png"
RESTORE_LIGHT IMAGE "res/Button/Normal/restore_light.png"
RESTORE_PRESS IMAGE "res/Button/Normal/restore_press.png"
CANCEL_NORMAL IMAGE "res/Button/Normal/cancel_back.png"
CANCEL_LIGHT IMAGE "res/Button/Normal/cancel_light.png"
CANCEL_PRESS IMAGE "res/Button/Normal/cancel_press.png"
BLANK_LARGR_NORMAL IMAGE "res/Button/Large/blank.png"
BLANK_LARGR_LIGHT IMAGE "res/Button/Large/blank_light.png"
BLANK_LARGR_PRESS IMAGE "res/Button/Large/blank_press.png"
MIN_LARGR_NORMAL IMAGE "res/Button/Large/min_normal.png"
MIN_LARGE_LIGHT IMAGE "res/Button/Large/min_light.png"
MIN_LARGR_PRESS IMAGE "res/Button/Large/min_press.png"
MAX_LARGE_NORMAL IMAGE "res/Button/Large/max_normal.png"
MAX_LARGE_LIGHT IMAGE "res/Button/Large/max_light.png"
MAX_LARGE_PRESS IMAGE "res/Button/Large/max_press.png"
RESTORE_LARGE_NORMAL IMAGE "res/Button/Large/restore_normal.png"
RESTORE_LARGE_LIGHT IMAGE "res/Button/Large/restore_light.png"
RESTORE_LARGE_PRESS IMAGE "res/Button/Large/restore_press.png"
CANCEL_LARGE_NORMAL IMAGE "res/Button/Large/cancel_window_normal.png"
CANCEL_LARGE_LIGHT IMAGE "res/Button/Large/cancel_window_light.png"
CANCEL_LARGE_PRESS IMAGE "res/Button/Large/cancel_window_press.png"
/////////////////////////////////////////////////////////////////////////////
//
// RCDATA
//
ICON_METRO RCDATA "res/Icons/IconTitleBar.ico"
/////////////////////////////////////////////////////////////////////////////
//
// RT_MANIFEST
//
IDR_MANIFEST1 RT_MANIFEST "res/manifest.xml"
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
IDR_VERSION_ZH_CN VERSIONINFO
FILEVERSION 1,0,1,7
PRODUCTVERSION 1,0,1,7
FILEFLAGSMASK 0x0L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x0L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "080404b0"
BEGIN
VALUE "CompanyName", "Bruce Winter"
VALUE "FileDescription", "应用安装程序"
VALUE "FileVersion", "1.0.1.7"
VALUE "LegalCopyright", "\\xA9Bruce Winter. All rights reserved."
VALUE "ProductVersion", "1.0.1.7"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x804, 1200
END
END
IDR_VERSION_EN_US VERSIONINFO
FILEVERSION 1,0,1,7
PRODUCTVERSION 1,0,1,7
FILEFLAGSMASK 0x0L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x0L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904e6"
BEGIN
VALUE "CompanyName", "Bruce Winter"
VALUE "FileDescription", "App Installer"
VALUE "FileVersion", "1.0.1.7"
VALUE "LegalCopyright", "\\xA9Bruce Winter. All rights reserved."
VALUE "ProductVersion", "1.0.1.7"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1254
END
END
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
WIN_TITLE "应用安装程序"
PAGE_LOADING "请稍候..."
PAGE_1_TITLE "安装 %ls"
PAGE_INFO_PUBLISHER "发布者: %ls"
END
STRINGTABLE
BEGIN
PAGE_INFO_VERSION "版本: %ls"
PAGE_FUNCTIONS "功能:"
PAGE_CHECK_RUNWHENREADY "当准备就绪时启动"
PAGE_2_LOADCERT "正在导入证书..."
PAGE_2_INSTALL "正在安装..."
PAGE_3_TITLE "请选择一个有效的安装源以继续"
PAGE_4_TITLE "%ls 已安装完成"
PAGE_5_TITLE "%ls 安装失败"
DIALOG_SELLET_APPX "Windows 应用包文件 (*.appx, *.appxbundle)"
DIALOG_SELLET_UNI "所有文件 (*.*)"
BUTTON_1_SER1 "安装"
BUTTON_3_SER1 "打开文件"
BUTTON_4_SER1 "启动"
BUTTON_5_SER1 "关闭"
DIALOG_WINTITLE "请选择有效的 Windows 应用包文件"
PAGE_1_APPHASINSTALLED "%ls 已安装"
END
STRINGTABLE
BEGIN
PAGE_2_TITLE "正在安装 %ls"
PAGE_1_APP "Microsoft Store 应用"
PAGE_2_LOADING "请稍候..."
PAGE_2_INSTALLING "正在安装 %d%%"
CLHELP_1 "命令行参数说明:\n\n"
CLHELP_2 "\t/?, /Help\n\t显示帮助窗口 (命令行参数说明)\n\n"
CLHELP_3 "\t/DisableFrame\n\t禁止使用自绘的窗口边框\n\n"
CLHELP_4 "\t/Win32Window\n\t不使用 WebUI改用 Win32 窗口\n\n"
CLHELP_5 "\t/Silent\n\t一般情况下会自动安装安装完成后在几秒后结束\n\n"
CLHELP_6 "\t/VerySilent\n\t静默安装安装时不会显示任何信息安装任务完成后自动结束\n\n"
END
STRINGTABLE
BEGIN
textSupportCPU "受支持的处理器架构: "
textSupportSystem "受支持的 Windows 版本: %ls 及更高版本(应用最低运行系统版本: %ls"
textSupportLanguage "受支持的语言: "
textDependency "以下是应用所需依赖包: "
textDependencyItem "%ls, 所需最低版本: %ls"
END
STRINGTABLE
BEGIN
INITWIDTH "656"
INITHEIGHT "412"
LIMITWIDTH "504"
LIMITHEIGHT "412"
END
STRINGTABLE
BEGIN
CLHELP_7 "\t/NoGUI\n\t使用 WSAppPkgIns 安装。安装时会弹出命令行窗口,安装完成后需手动关闭窗口\n\n"
END
STRINGTABLE
BEGIN
internetClient "访问您的 Internet 连接"
internetClientServer "访问您的 Internet 连接并充当服务器"
privateNetworkClientServer "访问您的家庭或工作网络"
documentsLibrary "使用您的文档库"
picturesLibrary "使用您的图片库"
videosLibrary "使用您的视频库"
musicLibrary "使用您的音乐库"
enterpriseAuthentication "使用您的企业域凭据"
sharedUserCertificates "使用您设备上可用的软件和硬件证书"
removableStorage "使用存储在外部存储设备上的数据"
appointments "使用日历中的事件"
contacts "使用您的联系人"
END
STRINGTABLE
BEGIN
phoneCall "访问您设备上的所有电话线路"
backgroundMediaPlayback "在后台播放媒体"
pointOfService "使用条形码扫描仪和磁卡读卡器"
allJoyn "发现并与支持 AllJoyn 的应用和设备交互"
phoneCallHistoryPublic "电话呼叫公开历史记录"
microphone "使用您的麦克风"
offlineMapsManagement "允许应用程序访问离线地图。"
objects3D "以编程方式访问您的 3D 对象"
graphicsCaptureWithoutBorder "允许无边框图形捕获"
bluetooth "与已配对的蓝牙设备通信"
lowLevelDevices "物联网低级总线硬件"
location "使用您的位置"
humaninterfacedevice "使用支持人机接口设备 (HID) 协议的设备"
recordedCallsFolder "访问您的通话记录"
proximity "使用支持近场通信 (NFC) 服务的设备"
webcam "使用您的网络摄像头"
END
STRINGTABLE
BEGIN
graphicsCaptureProgrammatic "允许使用图形捕获"
userNotificationListener "允许应用程序访问通知设置的当前状态"
userDataTasks "允许应用程序访问任务设置的当前状态"
userAccountInformation "访问您帐户的用户名和图片"
usb "访问您的 USB 连接设备"
systemManagement "物联网系统管理"
spatialPerception "查看您当前和过去的周围环境"
smsSend "发送 SMS 和 MMS 消息"
blockedChatMessages "阅读被垃圾邮件过滤器应用阻止的 SMS 和 MMS 消息"
chat "阅读和删除文本消息"
codeGeneration "动态生成代码"
voipCall "使用设备的 IP 语音 (VoIP) 服务"
enterpriseDataPolicy "为您的设备定义企业特定的政策"
inputInjectionBrokered "允许应用程序以编程方式将各种形式的输入注入系统,例如 HID、触摸、笔、键盘或鼠标。"
remoteSystem "允许应用程序访问与用户的 Microsoft 帐户关联的设备列表"
END
STRINGTABLE
BEGIN
inProcessMediaExtension "进程内媒体扩展"
webPlatformMediaExtension "Web 平台媒体扩展"
previewStore "Microsoft Store 预览功能"
confirmAppClose "关闭自己和自己的窗口,并延迟关闭其应用程序"
runFullTrust "使用所有系统资源"
previewUiComposition "预览 Windows UI Composition API 以接收反馈"
slapiQueryLicenseValue "查询软件许可政策"
localSystemServices "在使用最大权限运行的计算机上安装服务"
packageManagement "直接管理其他应用"
packageQuery "搜集有关其他应用的信息"
packagePolicySystem "控制与安装在设备上的应用相关的系统策略"
storeAppInstall "管理应用安装"
appLicensing "应用许可"
broadFileSystemAccess "文件系统"
allowElevation "以管理员身份运行"
unvirtualizedResources "写入在卸载时不会清除的注册表项和文件"
END
STRINGTABLE
BEGIN
extendedExecution "允许应用程序在进入后台后继续执行一段时间的操作"
appointmentsSystem "允许应用读取和修改用户日历上的所有事件"
contactsSystem "允许应用读取已指定为受限或敏感的联系人信息,以及修改现有的联系人信息。"
phoneCallSystem "允许应用访问设备上的所有电话线"
userDataAccounts "可访问电子邮件、联系人、日历等的用户数据帐户"
userDataTasksSystem "可访问系统任务项"
END
#endif // 中文(简体,中国) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// 英语(美国) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
WIN_TITLE "App Installer"
PAGE_LOADING "Please wait..."
PAGE_1_TITLE "Install %ls?"
PAGE_INFO_PUBLISHER "Publisher: %ls"
END
STRINGTABLE
BEGIN
PAGE_INFO_VERSION "Version: %ls"
PAGE_FUNCTIONS "Functions:"
PAGE_CHECK_RUNWHENREADY "Launch when ready"
PAGE_2_LOADCERT "Importing certificates..."
PAGE_2_INSTALL "Installing..."
PAGE_3_TITLE "Please select a valid installation source to continue"
PAGE_4_TITLE "%ls is ready"
PAGE_5_TITLE "%ls is failed"
DIALOG_SELLET_APPX "Windows App Package (*.appx, *.appxbundle)"
DIALOG_SELLET_UNI "All files (*.*)"
BUTTON_1_SER1 "Install"
BUTTON_3_SER1 "Open File"
BUTTON_4_SER1 "Launch"
BUTTON_5_SER1 "Cancel"
DIALOG_WINTITLE "Please select a valid app package file"
PAGE_1_APPHASINSTALLED "%ls has been installed"
END
STRINGTABLE
BEGIN
PAGE_2_TITLE "Installing %s"
PAGE_1_APP "Microsoft Store App"
PAGE_2_LOADING "Please wait..."
PAGE_2_INSTALLING "Installing %d%%"
CLHELP_1 "Usage:\n\n"
CLHELP_2 "\t/?, /Help\n\tDisplay help window (command line parameter description).\n\n"
CLHELP_3 "\t/DisableFrame\n\tDisable the use of self-drawn window borders.\n\n"
CLHELP_4 "\t/Win32Window\n\tDo not use WebUI, use Win32 window instead.\n\n"
CLHELP_5 "\t/Silent\n\tUnder normal circumstances, it will be automatically installed and will end after a few seconds.\n\n"
CLHELP_6 "\t/VerySilent\n\tSilent installation, no information will be displayed during installation, and the installation task will automatically end after completion.\n\n"
END
STRINGTABLE
BEGIN
textSupportCPU "Supported processor architectures: "
textSupportSystem "Supported Windows versions: %ls and later (minimum running system version of the app: %ls)"
textSupportLanguage "Supported languages:"
textDependency "The following are the dependencies required by the application:"
textDependencyItem "%ls, minimum required version: %ls"
END
STRINGTABLE
BEGIN
CLHELP_7 "\t/NoGUI\n\tUse WSAppPkgIns to install. A command line window will pop up during installation, and you need to manually close the window after installation.\n\n"
END
STRINGTABLE
BEGIN
internetClient "Access your Internet connection"
internetClientServer "Access your Internet connection and act as a server."
privateNetworkClientServer "Access your home or work networks"
documentsLibrary "Use your documents library"
picturesLibrary "Use your pictures library"
videosLibrary "Use your video library"
musicLibrary "Use your music library"
enterpriseAuthentication "Use your enterprise domain credentials"
sharedUserCertificates "Use the software and hardware certificates available on your device"
removableStorage "Use data stored on an external storage device"
appointments "Use the appointments in your calendar"
contacts "Use your contacts"
END
STRINGTABLE
BEGIN
phoneCall "Access all the phone lines on your device"
backgroundMediaPlayback "Play media in the background"
pointOfService "Use barcode scanners and magnetic card readers"
allJoyn "Discover and interact with AllJoyn enabled apps and devices"
phoneCallHistoryPublic "Phone Calls Public History"
microphone "Use your microphone"
offlineMapsManagement "Allows the application to access offline maps."
objects3D "Programmatically access your 3D Objects"
graphicsCaptureWithoutBorder "Allows borderless graphics capture"
bluetooth "Communicate with already paired Bluetooth devices"
lowLevelDevices "IoT Low-Level Bus Hardware"
location "Use your location"
humaninterfacedevice "Use your devices that support the Human Interface Device (HID) protocol"
recordedCallsFolder "Access your recorded calls"
proximity "Use devices that support Near Field Communication (NFC) services"
webcam "Use your webcam"
END
STRINGTABLE
BEGIN
graphicsCaptureProgrammatic "Allows use of graphics capture"
userNotificationListener
"Allows an application to access the current state of notification settings"
userDataTasks "Allows an application to access the current state of task settings"
userAccountInformation "Access to your Account's username and picture"
usb "Access your USB connected devices"
systemManagement "IoT System Adminstration"
spatialPerception "See your current and past surroundings"
smsSend "Send SMS and MMS messages"
blockedChatMessages "Read SMS and MMS messages that have been blocked by the Spam Filter app"
chat "Read and delete Text Messages"
codeGeneration "Generate code dynamically"
voipCall "Use your device's voice over IP (VoIP) services"
enterpriseDataPolicy "Define enterprise-specific policies for your device"
inputInjectionBrokered "Allows an application to programmatically inject various forms of input into the system, such as HID, touch, pen, keyboard, or mouse."
remoteSystem "Allows the application to access the list of devices associated with the user's Microsoft account"
END
STRINGTABLE
BEGIN
inProcessMediaExtension "In-process Media Extension"
webPlatformMediaExtension "Web Platform Media Extension"
previewStore "Microsoft Store Preview Features"
confirmAppClose "Close themselves and their own windows, and delay the closing of their app"
runFullTrust "Uses all system resources"
previewUiComposition "Preview the Windows UI Composition API to receive feedback"
slapiQueryLicenseValue "Query software licensing policies"
localSystemServices "Install a service on the machine that runs with maximum privileges"
packageManagement "Manage other apps directly"
packageQuery "Gather information about other apps"
packagePolicySystem "Control system policies related to apps that are installed on the device"
storeAppInstall "Store app installation"
appLicensing "App Licensing"
broadFileSystemAccess "File System"
allowElevation "Run as administrator"
unvirtualizedResources "Write registry entries and files that are not cleaned up on uninstall"
END
STRINGTABLE
BEGIN
extendedExecution "Allows the app to continue to perform operations for a period of time after entering the background"
appointmentsSystem "Allows the app to read and modify all appointments on the user's calendar"
contactsSystem "Allows the app to read information about contacts that have been designated as restricted or sensitive, and to modify existing contact information."
phoneCallSystem "Allows the app to access all phone lines on the device"
userDataAccounts "Allows the program to access user data such as email, contacts, calendar, etc."
userDataTasksSystem "Access to system tasks"
END
#endif // 英语(美国) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,335 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{D417C165-3F17-40C4-8C7B-0F5AACEF62C5}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>AppInstaller</RootNamespace>
<ProjectName>AppInstallerConsole</ProjectName>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<CLRSupport>false</CLRSupport>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<CLRSupport>true</CLRSupport>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<CLRSupport>false</CLRSupport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<CLRSupport>true</CLRSupport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>($SolutionDir)\AppLauncher;($SolutionDir)\PackageManagerAdd;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\AppLauncher;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\PackageManagerAdd;($SolutionDir)\Base64Img;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\Base64Img;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\ToastNotification;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\PriReader2;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\CertificateManager;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>($SolutionDir)\AppLauncher;($SolutionDir)\PackageManagerAdd;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\AppLauncher;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\PackageManagerAdd;($SolutionDir)\Base64Img;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\Base64Img;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\ToastNotification;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\PriReader2;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\CertificateManager;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>($SolutionDir)\AppLauncher;($SolutionDir)\PackageManagerAdd;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\AppLauncher;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\PackageManagerAdd;($SolutionDir)\Base64Img;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\Base64Img;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\ToastNotification;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\PriReader2;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\CertificateManager;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>($SolutionDir)\AppLauncher;($SolutionDir)\PackageManagerAdd;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\AppLauncher;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\PackageManagerAdd;($SolutionDir)\Base64Img;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\Base64Img;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\ToastNotification;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\PriReader2;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\CertificateManager;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>shlwapi.lib;dwmapi.lib;crypt32.lib;$(OutDir)PackageManager.lib;$(OutDir)AppLauncher.lib;$(OutDir)Base64Img.lib;$(OutDir)ToastNotification.lib;$(OutDir)PriReader2.lib;$(OutDir)CertificateManager.lib</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>shlwapi.lib;dwmapi.lib;crypt32.lib;$(OutDir)PackageManager.lib;$(OutDir)AppLauncher.lib;$(OutDir)Base64Img.lib;$(OutDir)ToastNotification.lib;$(OutDir)PriReader2.lib;$(OutDir)CertificateManager.lib</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>false</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WholeProgramOptimization>false</WholeProgramOptimization>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>shlwapi.lib;dwmapi.lib;crypt32.lib;$(OutDir)PackageManager.lib;$(OutDir)AppLauncher.lib;$(OutDir)Base64Img.lib;$(OutDir)ToastNotification.lib;$(OutDir)PriReader2.lib;$(OutDir)CertificateManager.lib</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
</Link>
<Manifest>
<EnableDpiAwareness>false</EnableDpiAwareness>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>shlwapi.lib;dwmapi.lib;crypt32.lib;$(OutDir)PackageManager.lib;$(OutDir)AppLauncher.lib;$(OutDir)Base64Img.lib;$(OutDir)ToastNotification.lib;$(OutDir)PriReader2.lib;$(OutDir)CertificateManager.lib</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\AppLauncher\AppLauncher.h" />
<ClInclude Include="..\Base64Img\Base64Img.h" />
<ClInclude Include="..\CertificateManager\CertificateManager.h" />
<ClInclude Include="..\PackageManagerAdd\PackageManager.h" />
<ClInclude Include="..\PriReader2\PriReader2.h" />
<ClInclude Include="base64logo.h" />
<ClInclude Include="initread.h" />
<ClInclude Include="pkgcode.h" />
<ClInclude Include="pkginfo.h" />
<ClInclude Include="priread.h" />
<ClInclude Include="localeex.h" />
<ClInclude Include="res2.h" />
<ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="mainwnd.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="AppInstaller.rc" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Drawing">
<HintPath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Drawing.dll</HintPath>
</Reference>
<Reference Include="System.Drawing.Design">
<HintPath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Drawing.Design.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms">
<HintPath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Windows.Forms.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq">
<HintPath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Xml.Linq.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AppLauncher\AppLauncher.vcxproj">
<Project>{285130bc-cbf1-4c7a-a28d-6f5ee6c68384}</Project>
</ProjectReference>
<ProjectReference Include="..\Base64Img\Base64Img.vcxproj">
<Project>{911edc63-db20-4d61-9420-583a1c35427f}</Project>
</ProjectReference>
<ProjectReference Include="..\CertificateManager\CertificateManager.vcxproj">
<Project>{22702832-c3fd-48e5-bc7d-3879ca50a2ed}</Project>
</ProjectReference>
<ProjectReference Include="..\PackageManagerAdd\AddPackageSample.vcxproj">
<Project>{59131ab7-2a7d-9a09-8223-174c3f5e0f57}</Project>
</ProjectReference>
<ProjectReference Include="..\PriReader2\PriReader2.vcxproj">
<Project>{b897969c-6ea9-4dfc-b7e0-94f1c6d94856}</Project>
</ProjectReference>
<ProjectReference Include="..\ToastNotification\ToastNotification.vcxproj">
<Project>{e10c6272-b876-4dc6-9e13-7ca646863b50}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Image Include="res\Button\Large\blank.png" />
<Image Include="res\Button\Large\blank_light.png" />
<Image Include="res\Button\Large\blank_press.png" />
<Image Include="res\Button\Large\cancel_window_light.png" />
<Image Include="res\Button\Large\cancel_window_normal.png" />
<Image Include="res\Button\Large\cancel_window_press.png" />
<Image Include="res\Button\Large\max_light.png" />
<Image Include="res\Button\Large\max_normal.png" />
<Image Include="res\Button\Large\max_press.png" />
<Image Include="res\Button\Large\min_light.png" />
<Image Include="res\Button\Large\min_normal.png" />
<Image Include="res\Button\Large\min_press.png" />
<Image Include="res\Button\Large\restore_light.png" />
<Image Include="res\Button\Large\restore_normal.png" />
<Image Include="res\Button\Large\restore_press.png" />
<Image Include="res\Button\Normal\blank.png" />
<Image Include="res\Button\Normal\blank_light.png" />
<Image Include="res\Button\Normal\blank_press.png" />
<Image Include="res\Button\Normal\cancel_back.png" />
<Image Include="res\Button\Normal\cancel_light.png" />
<Image Include="res\Button\Normal\cancel_press.png" />
<Image Include="res\Button\Normal\max_back.png" />
<Image Include="res\Button\Normal\max_light.png" />
<Image Include="res\Button\Normal\max_press.png" />
<Image Include="res\Button\Normal\min_back.png" />
<Image Include="res\Button\Normal\min_light.png" />
<Image Include="res\Button\Normal\min_press.png" />
<Image Include="res\Button\Normal\restore_back.png" />
<Image Include="res\Button\Normal\restore_light.png" />
<Image Include="res\Button\Normal\restore_press.png" />
<Image Include="res\Icons\FileIcon.ico" />
<Image Include="res\Icons\IconColor.ico" />
<Image Include="res\Icons\IconTitleBar.ico" />
<Image Include="res\Icons\IconWhite.ico" />
<Image Include="res\Icons\Main.ico" />
</ItemGroup>
<ItemGroup>
<Xml Include="res\manifest.xml" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,178 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<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>
<ClInclude Include="resource.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="res2.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="pkgcode.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\AppLauncher\AppLauncher.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\PackageManagerAdd\PackageManager.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="base64logo.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\Base64Img\Base64Img.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="priread.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="localeex.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="pkginfo.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\PriReader2\PriReader2.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\CertificateManager\CertificateManager.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="initread.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="mainwnd.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="AppInstaller.rc">
<Filter>资源文件</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Image Include="res\Icons\Main.ico">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Icons\FileIcon.ico">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Icons\IconWhite.ico">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Icons\IconColor.ico">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Button\Normal\blank.png">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Button\Normal\blank_light.png">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Button\Normal\blank_press.png">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Button\Normal\min_back.png">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Button\Normal\min_light.png">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Button\Normal\min_press.png">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Button\Normal\max_back.png">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Button\Normal\max_light.png">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Button\Normal\max_press.png">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Button\Normal\restore_back.png">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Button\Normal\restore_light.png">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Button\Normal\restore_press.png">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Button\Normal\cancel_back.png">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Button\Normal\cancel_light.png">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Button\Normal\cancel_press.png">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Button\Large\blank.png">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Button\Large\blank_light.png">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Button\Large\blank_press.png">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Button\Large\min_normal.png">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Button\Large\min_light.png">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Button\Large\min_press.png">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Button\Large\max_normal.png">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Button\Large\max_light.png">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Button\Large\max_press.png">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Button\Large\restore_normal.png">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Button\Large\restore_light.png">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Button\Large\restore_press.png">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Button\Large\cancel_window_normal.png">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Button\Large\cancel_window_light.png">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Button\Large\cancel_window_press.png">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Icons\IconTitleBar.ico">
<Filter>资源文件</Filter>
</Image>
</ItemGroup>
<ItemGroup>
<Xml Include="res\manifest.xml" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,171 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.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="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{D1338693-D56A-45D4-9BA6-DDA67F9E0AB3}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>AppInstallerConsole</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\AppLauncher;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\Base64Img;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\CertificateManager;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\PackageManagerAdd;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\PriReader2;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\ShoutcutCreater;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\ToastNotification;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\AppLauncher;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\Base64Img;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\CertificateManager;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\PackageManagerAdd;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\PriReader2;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\ShoutcutCreater;E:\Profiles\Bruce\Documents\Visual Studio 2015\Projects\AppInstaller\ToastNotification;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>shlwapi.lib;dwmapi.lib;crypt32.lib;$(OutDir)PackageManager.lib;$(OutDir)AppLauncher.lib;$(OutDir)Base64Img.lib;$(OutDir)ToastNotification.lib;$(OutDir)PriReader2.lib;$(OutDir)CertificateManager.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>shlwapi.lib;dwmapi.lib;crypt32.lib;$(OutDir)PackageManager.lib;$(OutDir)AppLauncher.lib;$(OutDir)Base64Img.lib;$(OutDir)ToastNotification.lib;$(OutDir)PriReader2.lib;$(OutDir)CertificateManager.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="base64logo.h" />
<ClInclude Include="initread.h" />
<ClInclude Include="localeex.h" />
<ClInclude Include="pkgcode.h" />
<ClInclude Include="pkginfo.h" />
<ClInclude Include="priread.h" />
<ClInclude Include="res2.h" />
<ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="AppInstaller.rc" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<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>
<ClInclude Include="base64logo.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="initread.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="localeex.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="pkgcode.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="pkginfo.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="priread.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="res2.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="AppInstaller.rc">
<Filter>资源文件</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,291 @@
#pragma once
#include "Base64Img.h"
#include <iostream>
#include <map>
#include <regex>
#include "pkgcode.h"
#include "priread.h"
std::string GetFileNameWithoutExtension (LPCSTR filePath)
{
char pathCopy [MAX_PATH];
lstrcpynA (pathCopy, filePath, MAX_PATH);
char *fileName = PathFindFileNameA (pathCopy);
PathRemoveExtensionA (fileName);
return std::string (fileName);
}
std::wstring GetFileNameWithoutExtension (LPCWSTR filePath)
{
wchar_t pathCopy [MAX_PATH];
lstrcpynW (pathCopy, filePath, MAX_PATH);
wchar_t *fileName = PathFindFileNameW (pathCopy);
PathRemoveExtensionW (fileName);
return std::wstring (fileName);
}
std::string GetFileNameWithoutExtension (const std::string &filePath)
{
return GetFileNameWithoutExtension (filePath.c_str ());
}
std::wstring GetFileNameWithoutExtension (const std::wstring &filePath)
{
return GetFileNameWithoutExtension (filePath.c_str ());
}
std::string GetLogoBase64FromReader (PackageReader &reader, IStream **getOutput = NULL)
{
if (!&reader) return std::string ("");
if (!reader.isAvailable ()) return std::string ("");
std::wstring logoPath = reader.getPropertyLogo ();
if (logoPath.empty () || logoPath.length () == 0) return std::string ("");
PriReader pri (reader.getPriFileStream ());
if (pri.isAvailable ())
{
std::wstring logoPathFromPri = pri.findFilePathValue (logoPath);
if (!logoPathFromPri.empty () && logoPath.length () > 0) logoPath = logoPathFromPri;
}
IStream *imgfile = reader.extractFileToStream (logoPath);
if (getOutput) *getOutput = imgfile;
if (!imgfile)
{
std::wstring fileName = GetFileNameWithoutExtension (logoPath);
IAppxPackageReader *appxreader = reader.getAppxPackageReader ();
CComPtr <IAppxFilesEnumerator> fe = NULL;
HRESULT hr = appxreader->GetPayloadFiles (&fe);
if (SUCCEEDED (hr) && fe)
{
std::vector <std::wstring> files;
BOOL hasCurrent = FALSE;
hr = fe->GetHasCurrent (FALSE);
while (SUCCEEDED (hr) && hasCurrent)
{
CComPtr <IAppxFile> ifile = NULL;
hr = fe->GetCurrent (&ifile);
if (SUCCEEDED (hr) && ifile)
{
LPWSTR lpstr = NULL;
if (SUCCEEDED (ifile->GetName (&lpstr)) && lpstr)
{
std::wstring strWillSearch = StringToUpper (StringTrim (lpstr));
std::wstring strWillToSearch = StringToUpper (StringTrim (fileName));
if (StrStrW (strWillSearch.c_str (), strWillToSearch.c_str ()))
{
bool isFind = LabelEqual (PathFindExtensionW (lpstr), L".png");
if (!isFind) isFind = LabelEqual (PathFindExtensionW (lpstr), L".jpg");
if (!isFind) isFind = LabelEqual (PathFindExtensionW (lpstr), L".jpeg");
if (!isFind) isFind = LabelEqual (PathFindExtensionW (lpstr), L".bmp");
if (isFind)
{
std::wstring temp (L"");
if (lpstr) temp += lpstr;
if (temp.length () > 0) push_no_repeat (files, temp);
}
}
}
}
}
bool isFindSuit = false;
{
std::map <int, std::wstring> scaleFiles;
std::wregex pattern (L"(scale-(\\d+))");
for (auto it : files)
{
if (StrStrW (it.c_str (), L"contrast-")) continue;
std::wsmatch match;
if (std::regex_search (it, match, pattern))
{
int temp = StrToIntW (match [1].str ().c_str ());
if (!temp)
{
scaleFiles [temp] = it;
}
}
}
if (scaleFiles.find (GetDPI ()) != scaleFiles.end ())
{
isFindSuit = true;
logoPath = scaleFiles [GetDPI ()];
}
else
{
bool isFindScale = false;
for (auto it : scaleFiles)
{
if (it.first >= GetDPI ())
{
isFindScale = true;
logoPath = scaleFiles [GetDPI ()];
break;
}
}
if (!isFindScale)
{
for (auto it : scaleFiles)
{
if (it.first >= 100)
{
isFindScale = true;
logoPath = scaleFiles [GetDPI ()];
break;
}
}
}
if (!isFindScale)
{
for (auto it : scaleFiles)
{
isFindScale = true;
logoPath = scaleFiles [GetDPI ()];
break;
}
}
isFindSuit = isFindScale;
}
}
if (!isFindSuit)
{
std::map <int, std::wstring> scaleFiles;
std::wregex pattern (L"(scale-(\\d+))");
for (auto it : files)
{
if (StrStrW (it.c_str (), L"contrast-white")) continue;
std::wsmatch match;
if (std::regex_search (it, match, pattern))
{
int temp = StrToIntW (match [1].str ().c_str ());
if (!temp)
{
scaleFiles [temp] = it;
}
}
}
if (scaleFiles.find (GetDPI ()) != scaleFiles.end ())
{
isFindSuit = true;
logoPath = scaleFiles [GetDPI ()];
}
else
{
bool isFindScale = false;
for (auto it : scaleFiles)
{
if (it.first >= GetDPI ())
{
isFindScale = true;
logoPath = scaleFiles [GetDPI ()];
break;
}
}
if (!isFindScale)
{
for (auto it : scaleFiles)
{
if (it.first >= 100)
{
isFindScale = true;
logoPath = scaleFiles [GetDPI ()];
break;
}
}
}
if (!isFindScale)
{
for (auto it : scaleFiles)
{
isFindScale = true;
logoPath = scaleFiles [GetDPI ()];
break;
}
}
isFindSuit = isFindScale;
}
}
if (!isFindSuit)
{
std::map <int, std::wstring> scaleFiles;
std::wregex pattern (L"(scale-(\\d+))");
for (auto it : files)
{
if (StrStrW (it.c_str (), L"contrast-black")) continue;
std::wsmatch match;
if (std::regex_search (it, match, pattern))
{
int temp = StrToIntW (match [1].str ().c_str ());
if (!temp)
{
scaleFiles [temp] = it;
}
}
}
if (scaleFiles.find (GetDPI ()) != scaleFiles.end ())
{
isFindSuit = true;
logoPath = scaleFiles [GetDPI ()];
}
else
{
bool isFindScale = false;
for (auto it : scaleFiles)
{
if (it.first >= GetDPI ())
{
isFindScale = true;
logoPath = scaleFiles [GetDPI ()];
break;
}
}
if (!isFindScale)
{
for (auto it : scaleFiles)
{
if (it.first >= 100)
{
isFindScale = true;
logoPath = scaleFiles [GetDPI ()];
break;
}
}
}
if (!isFindScale)
{
for (auto it : scaleFiles)
{
isFindScale = true;
logoPath = scaleFiles [GetDPI ()];
break;
}
}
isFindSuit = isFindScale;
}
}
if (!isFindSuit)
{
for (auto it : files)
{
logoPath = std::wstring (L"") + it;
break;
}
}
}
imgfile = reader.extractFileToStream (logoPath);
}
if (getOutput) *getOutput = imgfile;
if (!imgfile) return std::string ("");
std::string b64res ("");
LPSTR szRes = StreamToBase64 (imgfile);
if (!getOutput)
{
if (imgfile)
{
imgfile->Release ();
imgfile = NULL;
}
}
if (!szRes) return b64res;
if (szRes) b64res += szRes;
free (szRes);
if (b64res.length () > 0)
{
b64res = "data:image/png;base64," + b64res;
}
return b64res;
}

View File

@@ -0,0 +1,194 @@
#pragma once
#include <Windows.h>
#include <string>
#include <cstdlib>
#include <cstdio>
#include "pkgcode.h"
unsigned _wtou (const wchar_t *str)
{
unsigned value = 0;
if (str)
{
swscanf (str, L"%u", &value);
}
return value;
}
unsigned long _wtoul (const wchar_t *str)
{
unsigned value = 0;
if (str)
{
swscanf (str, L"%'u", &value);
}
return value;
}
unsigned long long _wtou64 (const wchar_t *str)
{
unsigned long long value = 0;
if (str)
{
swscanf (str, L"%llu", &value);
}
return value;
}
double _wtod (const wchar_t *str)
{
if (!str || !*str) return 0.0; // 避免空指针或空字符串
double value = 0.0;
if (swscanf (str, L"%lg", &value) == 1)
{
return value;
}
return 0.0; // 解析失败时返回 0.0
}
std::string GetPrivateProfileStringA (std::string filePath, std::string section, std::string key, LPCSTR defaultValue = "")
{
char buf [32768] = {0};
GetPrivateProfileStringA (section.c_str (), key.c_str (), defaultValue, buf, 32767, filePath.c_str ());
return buf;
}
std::wstring GetPrivateProfileStringW (std::wstring filePath, std::wstring section, std::wstring key, LPCWSTR defaultValue = L"")
{
WCHAR buf [32768] = {0};
GetPrivateProfileStringW (section.c_str (), key.c_str (), defaultValue, buf, 32767, filePath.c_str ());
return buf;
}
UINT GetPrivateProfileIntA (std::string filePath, std::string section, std::string key, INT defaultValue = 0)
{
return GetPrivateProfileIntA (section.c_str (), key.c_str (), defaultValue, filePath.c_str ());
}
UINT GetPrivateProfileIntW (std::wstring filePath, std::wstring section, std::wstring key, INT defaultValue = 0)
{
return GetPrivateProfileIntW (section.c_str (), key.c_str (), defaultValue, filePath.c_str ());
}
class WInitFile
{
private:
std::wstring m_filePath;
template <class t> std::wstring numberToString (t src, std::wstring format)
{
WCHAR buf [256] = {0};
swprintf (buf, format.c_str (), src);
return buf;
}
public:
WInitFile (LPCWSTR lpswFilePath = L""): m_filePath (lpswFilePath) {}
void setFilePath (std::wstring filePath)
{
this->m_filePath = L"";
this->m_filePath += filePath;
}
std::wstring getFilePath () const { return this->m_filePath; }
std::wstring readStringValue (std::wstring section, std::wstring key, std::wstring defaultValue = L"")
{
return GetPrivateProfileStringW (this->m_filePath, section, key, defaultValue.c_str ());
}
bool readBoolValue (std::wstring section, std::wstring key, bool defaultValue = false)
{
std::wstring res = this->readStringValue (section, key, (defaultValue ? L"true" : L"false"));
if (LabelEqual (res, L"true") || LabelEqual (res, L"zhen") || LabelEqual (res, L"1") || LabelEqual (res, L"yes") || LabelEqual (res, L""))
{
return true;
}
else if (LabelEqual (res, L"false") || LabelEqual (res, L"jia") || LabelEqual (res, L"0") || LabelEqual (res, L"no") || LabelEqual (res, L""))
{
return false;
}
return false;
}
int readIntValue (std::wstring section, std::wstring key, int defaultValue = 0)
{
WCHAR buf [256] = {0};
swprintf (buf, L"%d", defaultValue);
return _wtoi (this->readStringValue (section, key, buf).c_str ());
}
unsigned readUIntValue (std::wstring section, std::wstring key, unsigned defaultValue = 0)
{
WCHAR buf [256] = {0};
swprintf (buf, L"%u", defaultValue);
return _wtou (this->readStringValue (section, key, buf).c_str ());
}
long readLongValue (std::wstring section, std::wstring key, long defaultValue = 0)
{
WCHAR buf [256] = {0};
swprintf (buf, L"%ld", defaultValue);
return _wtol (this->readStringValue (section, key, buf).c_str ());
}
unsigned long readULongValue (std::wstring section, std::wstring key, unsigned long defaultValue = 0)
{
WCHAR buf [256] = {0};
swprintf (buf, L"%lu", defaultValue);
return _wtoul (this->readStringValue (section, key, buf).c_str ());
}
long long readLongLongValue (std::wstring section, std::wstring key, long long defaultValue = 0)
{
WCHAR buf [256] = {0};
swprintf (buf, L"%lld", defaultValue);
return _wtoll (this->readStringValue (section, key, buf).c_str ());
}
unsigned long long readULongLongValue (std::wstring section, std::wstring key, unsigned long long defaultValue = 0)
{
WCHAR buf [256] = {0};
swprintf (buf, L"%llu", defaultValue);
return _wtou64 (this->readStringValue (section, key, buf).c_str ());
}
float readFloatValue (std::wstring section, std::wstring key, float defaultValue = 0)
{
WCHAR buf [256] = {0};
swprintf (buf, L"%f", defaultValue);
return _wtof (this->readStringValue (section, key, buf).c_str ());
}
double readDoubleValue (std::wstring section, std::wstring key, double defaultValue = 0)
{
WCHAR buf [256] = {0};
swprintf (buf, L"%lf", defaultValue);
return _wtod (this->readStringValue (section, key, buf).c_str ());
}
bool writeStringValue (std::wstring section, std::wstring key, std::wstring value)
{
return WritePrivateProfileStringW (section.c_str (), key.c_str (), value.c_str (), this->m_filePath.c_str ());
}
bool writeBoolValue (std::wstring section, std::wstring key, bool value)
{
return this->writeBoolValue (section, key, value ? L"true" : L"false");
}
bool writeIntValue (std::wstring section, std::wstring key, int value)
{
return this->writeStringValue (section, key, this->numberToString (value, L"%d"));
}
bool writeUIntValue (std::wstring section, std::wstring key, unsigned value)
{
return this->writeStringValue (section, key, this->numberToString (value, L"%u"));
}
bool writeLongValue (std::wstring section, std::wstring key, long value)
{
return this->writeStringValue (section, key, this->numberToString (value, L"%ld"));
}
bool writeULongValue (std::wstring section, std::wstring key, unsigned long value)
{
return this->writeStringValue (section, key, this->numberToString (value, L"%lu"));
}
bool writeLongLongValue (std::wstring section, std::wstring key, long long value)
{
return this->writeStringValue (section, key, this->numberToString (value, L"%lld"));
}
bool writeULongLongValue (std::wstring section, std::wstring key, unsigned long long value)
{
return this->writeStringValue (section, key, this->numberToString (value, L"%llu"));
}
bool writeFloatValue (std::wstring section, std::wstring key, float value)
{
return this->writeStringValue (section, key, this->numberToString (value, L"%g"));
}
bool writeDoublegValue (std::wstring section, std::wstring key, double value)
{
return this->writeStringValue (section, key, this->numberToString (value, L"%g"));
}
bool isAvaliable ()
{
return IsFileExists (this->m_filePath);
}
};

View File

@@ -0,0 +1,111 @@
#pragma once
#include <Windows.h>
#include <WinNls.h>
#include <stringapiset.h>
#include <string>
std::wstring StringToWString (const std::string &str, UINT codePage = CP_ACP)
{
if (str.empty ()) return std::wstring ();
int len = MultiByteToWideChar (codePage, 0, str.c_str (), -1, nullptr, 0);
if (len == 0) return std::wstring ();
std::wstring wstr (len - 1, L'\0');
MultiByteToWideChar (codePage, 0, str.c_str (), -1, &wstr [0], len);
return wstr;
}
std::string GetLocaleInfoA (LCID code, LCTYPE type)
{
char buf [LOCALE_NAME_MAX_LENGTH] = {0};
GetLocaleInfoA (code, type, buf, LOCALE_NAME_MAX_LENGTH);
return buf;
}
std::wstring GetLocaleInfoW (LCID code, LCTYPE type)
{
WCHAR buf [LOCALE_NAME_MAX_LENGTH] = {0};
GetLocaleInfoW (code, type, buf, LOCALE_NAME_MAX_LENGTH);
return buf;
}
int GetLocaleInfoEx (std::wstring lpLocaleName, LCTYPE type, std::wstring &output)
{
WCHAR buf [LOCALE_NAME_MAX_LENGTH] = {0};
int res = GetLocaleInfoEx (lpLocaleName.c_str (), type, buf, LOCALE_NAME_MAX_LENGTH);
if (&output) output = std::wstring (buf);
return res;
}
BOOL SetLocaleInfoA (LCID code, LCTYPE type, const std::string lcData)
{
return SetLocaleInfoA (code, type, lcData.c_str ());
}
BOOL SetLocaleInfoW (LCID code, LCTYPE type, const std::wstring lcData)
{
return SetLocaleInfoW (code, type, lcData.c_str ());
}
std::string GetLocaleRestrictedCodeFromLcidA (LCID lcid)
{
return GetLocaleInfoA (lcid, 89);
}
std::wstring GetLocaleRestrictedCodeFromLcidW (LCID lcid)
{
return GetLocaleInfoW (lcid, 89);
}
std::string GetLocaleElaboratedCodeFromLcidA (LCID lcid)
{
return GetLocaleInfoA (lcid, 90);
}
std::wstring GetLocaleElaboratedCodeFromLcidW (LCID lcid)
{
return GetLocaleInfoW (lcid, 90);
}
LCID LocaleCodeToLcidW (LPCWSTR localeCode)
{
BYTE buf [LOCALE_NAME_MAX_LENGTH * sizeof (WCHAR)] = {0};
int res = GetLocaleInfoEx (localeCode, LOCALE_RETURN_NUMBER | LOCALE_ILANGUAGE, (LPWSTR)buf, LOCALE_NAME_MAX_LENGTH);
LCID lcid = *((LCID *)buf);
return lcid;
}
LCID LocaleCodeToLcidA (LPCSTR localeCode)
{
std::wstring lcWide = StringToWString (std::string (localeCode));
return LocaleCodeToLcidW (lcWide.c_str ());
}
std::string GetLocaleRestrictedCodeA (LPCSTR lc)
{
return GetLocaleInfoA (LocaleCodeToLcidA (lc), 89);
}
std::string GetLocaleRestrictedCodeA (const std::string lc)
{
return GetLocaleInfoA (LocaleCodeToLcidA (lc.c_str ()), 89);
}
std::wstring GetLocaleRestrictedCodeW (LPCWSTR lc)
{
return GetLocaleInfoW (LocaleCodeToLcidW (lc), 89);
}
std::wstring GetLocaleRestrictedCodeW (const std::wstring lc)
{
return GetLocaleInfoW (LocaleCodeToLcidW (lc.c_str ()), 89);
}
std::string GetLocaleElaboratedCodeA (LPCSTR lc)
{
return GetLocaleInfoA (LocaleCodeToLcidA (lc), 90);
}
std::string GetLocaleElaboratedCodeA (const std::string lc)
{
return GetLocaleInfoA (LocaleCodeToLcidA (lc.c_str ()), 90);
}
std::wstring GetLocaleElaboratedCodeW (LPCWSTR lc)
{
return GetLocaleInfoW (LocaleCodeToLcidW (lc), 90);
}
std::wstring GetLocaleElaboratedCodeW (const std::wstring lc)
{
return GetLocaleInfoW (LocaleCodeToLcidW (lc.c_str ()), 90);
}
std::string LcidToLocaleCodeA (LCID lcid, char divide = '-')
{
return GetLocaleRestrictedCodeFromLcidA (lcid) + divide + GetLocaleElaboratedCodeFromLcidA (lcid);
}
std::wstring LcidToLocaleCodeW (LCID lcid, WCHAR divide = L'-')
{
return GetLocaleRestrictedCodeFromLcidW (lcid) + divide + GetLocaleElaboratedCodeFromLcidW (lcid);
}

View File

@@ -0,0 +1,569 @@
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#ifndef _CRT_NON_CONFORMING_SWPRINTFS
#define _CRT_NON_CONFORMING_SWPRINTFS
#endif
#include <Windows.h>
#include <string>
#include <iostream>
#include <cstdarg>
#include <dwmapi.h>
#include <wingdi.h>
#include <ShObjIdl.h>
#include "pkgcode.h"
#include "resource.h"
#include "res2.h"
#include "PackageManager.h"
#include "base64logo.h"
#include "AppLauncher.h"
#include "ToastNotification.h"
#include "pkginfo.h"
#include "CertificateManager.h"
#include "initread.h"
#include <Psapi.h>
#include <iomanip>
using namespace std;
std::wstring GetRCString_cpp (UINT resID)
{
size_t bufferSize = 256;
wchar_t* buffer = nullptr;
int length = 0;
do
{
delete [] buffer;
buffer = new wchar_t [bufferSize];
length = LoadStringW (GetModuleHandle (nullptr), resID, buffer, bufferSize);
if ((size_t)length >= bufferSize)
{
bufferSize += 20;
}
} while ((size_t)length >= bufferSize);
std::wstring result = L"";
result += buffer;
delete [] buffer;
return result;
}
#define GetRCString GetRCString_cpp
#define rcIcon(resID) LoadRCIcon (resID)
HRSRC FindResourceByName (LPCWSTR resourceName, LPCWSTR resourceType)
{
return FindResourceW (GetModuleHandle (nullptr), resourceName, resourceType);
}
HRSRC FindResourceByName (const std::wstring &resourceName, LPCWSTR resourceType)
{
return FindResourceByName (resourceName.c_str (), resourceType);
}
std::wstring StrPrintFormatW (LPCWSTR format, ...)
{
va_list args;
va_start (args, format);
size_t sizeBuf = 256;
WCHAR *buffer = (WCHAR *)malloc (sizeBuf * sizeof (WCHAR));
if (!buffer)
{
va_end (args);
return L"";
}
int written = -1;
while (true)
{
written = vswprintf (buffer, sizeBuf, format, args);
if (written >= 0 && static_cast<size_t>(written) < sizeBuf)
{
break;
}
sizeBuf += 256;
wchar_t* newBuffer = (wchar_t*)realloc (buffer, sizeBuf * sizeof (wchar_t));
if (!newBuffer)
{
free (buffer);
va_end (args);
return L"";
}
buffer = newBuffer;
}
va_end (args);
std::wstring result (buffer);
free (buffer);
return result;
}
size_t EnumerateFilesW (const std::wstring &directory, const std::wstring &filter,
std::vector <std::wstring> &outFiles, bool recursive = false)
{
std::wstring searchPath = directory;
if (!searchPath.empty () && searchPath.back () != L'\\')
{
searchPath += L'\\';
}
searchPath += filter;
WIN32_FIND_DATAW findData;
HANDLE hFind = FindFirstFileW (searchPath.c_str (), &findData);
if (hFind != INVALID_HANDLE_VALUE)
{
do {
if (!(findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
outFiles.push_back (directory + L"\\" + findData.cFileName);
}
} while (FindNextFileW (hFind, &findData));
FindClose (hFind);
}
if (recursive) {
std::wstring subDirSearchPath = directory + L"\\*";
hFind = FindFirstFileW (subDirSearchPath.c_str (), &findData);
if (hFind != INVALID_HANDLE_VALUE)
{
do {
if ((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) &&
wcscmp (findData.cFileName, L".") != 0 && wcscmp (findData.cFileName, L"..") != 0)
{
EnumerateFilesW (directory + L"\\" + findData.cFileName, filter, outFiles, true);
}
} while (FindNextFileW (hFind, &findData));
FindClose (hFind);
}
}
return outFiles.size ();
}
std::wstring GetFileDirectoryW (const std::wstring &filePath)
{
std::wstring directory (L"");
WCHAR *buf = (WCHAR *)calloc (filePath.capacity () + 1, sizeof (WCHAR));
lstrcpyW (buf, filePath.c_str ());
PathRemoveFileSpecW (buf);
directory += buf;
free (buf);
return directory;
}
std::wstring g_pkgPath = L"";
pkgreader g_reader;
LPCWSTR g_idenName = L"Microsoft.DesktopAppInstaller";
PackageInfomation g_pkgInfo;
HRESULT SetCurrentAppUserModelID (PCWSTR appID)
{
typedef HRESULT (WINAPI *SetAppUserModelIDFunc)(PCWSTR);
HMODULE shell32 = LoadLibraryW (L"shell32.dll");
if (!shell32) return E_FAIL;
auto SetAppUserModelID = (SetAppUserModelIDFunc)GetProcAddress (shell32, "SetCurrentProcessExplicitAppUserModelID");
if (!SetAppUserModelID)
{
FreeLibrary (shell32);
return E_FAIL;
}
HRESULT hr = SetAppUserModelID (appID);
FreeLibrary (shell32);
return hr;
}
typedef struct _CMDARGUMENT
{
std::vector <std::wstring> front;
std::vector <std::wstring> body;
std::vector <std::wstring> rear;
int flag;
} CMDARGUMENT;
std::vector <CMDARGUMENT> cmdargs =
{
{{L"", L"/", L"-"}, {L"HELP", L"?", L"H"}, {}, 5},
};
// 编号为大于 0 的数,失败返回非正数
int GetCmdArgSerial (std::wstring cmdparam)
{
#define tolabel(__std_wstring__) StringToUpper (StringTrim (__std_wstring__))
std::wstring arg = tolabel (cmdparam);
for (size_t cnt = 0; cnt < cmdargs.size (); cnt ++)
{
CMDARGUMENT &tca = cmdargs [cnt];
std::wstring tempP = L"";
for (size_t i = 0; i < tca.body.size (); i ++)
{
if (tca.rear.size () > 0)
{
if (tca.front.size () > 0)
{
for (size_t j = 0; j < tca.front.size (); j ++)
{
for (size_t k = 0; k < tca.rear.size (); k ++)
{
tempP = tolabel (tca.front [j]) + tolabel (tca.body [i]) + tolabel (tca.rear [k]);
std::wstring t1;
if (tolabel (tca.rear [k]).length () > 0) t1 = arg.substr (0, tempP.length ());
else t1 = tempP;
if (t1 == arg) return tca.flag;
}
}
}
else
{
for (size_t k = 0; k < tca.rear.size (); k ++)
{
tempP = tolabel (tca.body [i]) + tolabel (tca.rear [k]);
std::wstring t1;
if (tolabel (tca.rear [k]).length () > 0) t1 = arg.substr (0, tempP.length ());
else t1 = tempP;
if (t1 == arg) return tca.flag;
}
}
}
else
{
if (tca.front.size () > 0)
{
for (size_t j = 0; j < tca.front.size (); j ++)
{
tempP = tolabel (tca.front [j]) + tolabel (tca.body [i]);
std::wstring &t1 = tempP;
if (t1 == arg) return tca.flag;
}
}
else
{
tempP = tolabel (tca.body [i]);
std::wstring &t1 = tempP;
if (t1 == arg) return tca.flag;
}
}
}
}
return 0; // 返回 0 正好适用于 C/C++ 的逻辑判断
}
int GetCmdArgSerial (LPCWSTR cmdparam) { return GetCmdArgSerial (std::wstring (cmdparam)); }
void TaskInstallPackage ();
void TaskInstallPackages (size_t serial, size_t total);
void PrintHelpText ()
{
wchar_t path [MAX_PATH] = {0};
GetModuleFileNameW (NULL, path, MAX_PATH);
std::wcout << "Usage: " << endl;
std::wcout << L'\t' << PathFindFileNameW (path) << L" <package_file_path>" << endl;
std::wcout << L"\t\t" << "Install packages." << endl;
std::wcout << L'\t' << PathFindFileNameW (path) << L" /?" << endl;
std::wcout << L"\t\t" << "Show help." << endl;
}
void middle (wstring s)
{
HANDLE hOutput = GetStdHandle (STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO bInfo;
GetConsoleScreenBufferInfo (hOutput, &bInfo);
int len = bInfo.dwSize.X / 2 - s.size () / 2;
wprintf (L"\033[%dC", len);
wcout << s;
}
// 返回真时代表执行 GUI 进程
bool ReadCommand (int argc, LPWSTR *argv)
{
std::vector <std::wstring> vecObjSwFiles;
bool bDisplayHelp = false;
for (size_t cnt = 1; cnt < (size_t)argc; cnt ++)
{
int res = GetCmdArgSerial (argv [cnt]);
if (res > 0)
{
switch (res)
{
case 5: bDisplayHelp = true; break;
}
}
else
{
if (IsFileExistsW (argv [cnt])) push_no_repeat (vecObjSwFiles, argv [cnt]);
}
}
if (bDisplayHelp) // 处理命令参数提示
{
PrintHelpText ();
return false;
}
if (vecObjSwFiles.size () == 1)
{
g_pkgPath = vecObjSwFiles [0];
return true;
}
else if (vecObjSwFiles.size () <= 0)
{
wchar_t path [MAX_PATH] = {0};
if (GetModuleFileNameW (NULL, path, MAX_PATH))
{
std::wstring cmdline = L"\"" + std::wstring (path) + L"\" /?";
STARTUPINFOW si = {sizeof (STARTUPINFOW)};
PROCESS_INFORMATION pi = {0};
if (CreateProcessW (NULL, (LPWSTR)cmdline.c_str (), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
{
WaitForSingleObject (pi.hProcess, INFINITE);
CloseHandle (pi.hProcess);
CloseHandle (pi.hThread);
}
}
return false;
}
else if (vecObjSwFiles.size () > 1) // 面对多个文件
{
wchar_t path [MAX_PATH] = {0};
if (GetModuleFileNameW (NULL, path, MAX_PATH))
{
for (size_t cnt = 0; cnt < vecObjSwFiles.size (); cnt ++)
{
g_pkgPath = vecObjSwFiles [cnt];
wstringstream ss;
ss << (cnt + 1) << L" of " << vecObjSwFiles.size () << endl;
middle (ss.str ().c_str ());
std::wstring cmdline = L"\"" + std::wstring (path) + L"\" \"" + g_pkgPath + L'\"';
STARTUPINFOW si = {sizeof (STARTUPINFOW)};
PROCESS_INFORMATION pi = {0};
if (CreateProcessW (NULL, (LPWSTR)cmdline.c_str (), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
{
WaitForSingleObject (pi.hProcess, INFINITE);
CloseHandle (pi.hProcess);
CloseHandle (pi.hThread);
}
}
}
}
return false;
}
// 返回真时代表执行 GUI 进程
bool ReadCommand (LPWSTR lpCmdLine)
{
int iArgc = 0;
LPWSTR *lpArgv = CommandLineToArgvW (lpCmdLine, &iArgc);
return ReadCommand (iArgc, lpArgv);
}
void ProgressCallback (unsigned uPrecent)
{
wcout << L'\r';
wcout << StrPrintFormatW (GetRCString_cpp (PAGE_2_INSTALLING).c_str (), (int)uPrecent);
}
void TaskInstallPackage ()
{
if (g_reader.create (g_pkgPath))
{
wcout << GetRCString_cpp (PAGE_LOADING);
g_pkgInfo.create (g_reader);
wcout << L"\r";
wcout << L"Package File: " << g_pkgPath << endl;
wcout << L'\t' << L"Identity" << endl;
wcout << L"\t\t" << L"Name: " << g_pkgInfo.getIdentityName () << endl;
wcout << L"\t\t" << L"Publisher: " << g_pkgInfo.getIdentityPublisher () << endl;
wcout << L"\t\t" << L"Version: " << g_pkgInfo.getIdentityVersion ().toStringW () << endl;
std::vector <APPX_PACKAGE_ARCHITECTURE> archs;
wcout << L"\t\t" << L"Processor Architecture (" << g_pkgInfo.getIdentityProcessorArchitecture (archs) << ") ";
if (archs.size () > 0)
{
std::wstring temp;
for (size_t cnt = 0; cnt < archs.size (); cnt ++)
{
switch (archs [cnt])
{
case APPX_PACKAGE_ARCHITECTURE_NEUTRAL: temp += L"Neutral"; break;
case APPX_PACKAGE_ARCHITECTURE_X86: temp += L"x86"; break;
case APPX_PACKAGE_ARCHITECTURE_X64: temp += L"x64"; break;
case APPX_PACKAGE_ARCHITECTURE_ARM: temp += L"Arm"; break;
default:
if ((UINT)archs [cnt] == 12) temp += L"Arm64";
}
if (cnt + 1 != archs.size ()) temp += L", ";
}
wcout << temp;
}
wcout << endl;
wcout << L'\t' << L"Properties" << endl;
wcout << L"\t\t" << L"Name: " << g_pkgInfo.getPropertyName () << endl;
wcout << L"\t\t" << L"Publisher: " << g_pkgInfo.getPropertyPublisher () << endl;
{
std::wstring &temp = g_pkgInfo.getPropertyDescription ();
if (temp.size () > 0)
{
wcout << L"\t\t" << L"Description: " << temp << endl;
}
}
{
std::vector <std::wstring> langs;
g_pkgInfo.getResourceLanguages (langs);
if (langs.size () > 0)
{
wcout << L"\t" << L"Resources" << endl;
wcout << L"\t\t" << L"Languages (" << langs.size () << "): ";
for (size_t cnt = 0; cnt < langs.size (); cnt ++)
{
wcout << langs [cnt];
if (cnt + 1 != langs.size ()) wcout << L", ";
}
wcout << endl;
}
}
std::vector <appmap> apps;
g_pkgInfo.getApplications (apps);
wcout << L'\t' << L"Applications (" << apps.size () << ")" << endl;
if (apps.size () > 0)
{
for (auto it : apps)
{
wcout << L"\t\t" << L"Application" << endl;
wcout << L"\t\t\t" << L"App Model User ID: " << it.getAppUserModelID () << endl;
wcout << L"\t\t\t" << L"ID: " << it [L"Id"] << endl;
}
}
std::vector <std::wstring> caps;
g_pkgInfo.getCapabilities (caps);
wcout << L'\t' << L"Capabilities (" << caps.size () << ")" << endl;
if (caps.size () > 0)
{
for (auto it : caps)
{
wcout << L"\t\t" << GetRCString_cpp (CapabilitiesNameToID (it)) << endl;
}
}
std::vector <DEPINFO> deps;
wcout << L'\t' << L"Dependencies (" << deps.size () << ")" << endl;
for (auto it : deps)
{
wcout << L"\t\t" << L"Dependency" << endl;
wcout << L"\t\t\t" << L"Name: " << it.name << endl;
wcout << L"\t\t\t" << L"Publisher: " << it.publisher << endl;
wcout << L"\t\t\t" << L"Version: " << it.versionMin.toStringW () << endl;
}
wcout << StrPrintFormatW (GetRCString_cpp (PAGE_2_TITLE).c_str (), g_pkgInfo.getPropertyName ().c_str ()) << endl;
wcout << GetRCString_cpp (PAGE_2_LOADCERT);
if (LoadCertFromSignedFile (g_pkgPath.c_str ())) wcout << L"Succeeded! " << endl;
else wcout << "Failed. " << endl;
wcout << GetRCString_cpp (PAGE_2_INSTALL);
InstallStatus ires = AddPackageFromPath (g_pkgPath.c_str (), &ProgressCallback);
wcout << endl;
if (ires == InstallStatus::Success)
{
wcout << "Install Succeeded! " << endl;
}
else
{
wcout << "\rInstall Failed. Message: " << GetLastErrorDetailText () << endl;
}
}
else
{
wcout << "\rInstall Failed. Message: Unavailable Package." << endl;
}
}
void TaskInstallPackages (size_t serial, size_t total)
{
wcout << serial << L" of " << total << endl;
wcout << L'\t' << GetRCString_cpp (PAGE_LOADING);
g_reader.destroy ();
if (g_reader.create (g_pkgPath))
{
g_pkgInfo.create (g_reader);
wcout << L"\r";
wcout << L"\tPackage File: " << g_pkgPath << endl;
wcout << L"\t\t" << L"Identity" << endl;
wcout << L"\t\t\t" << L"Name: " << g_pkgInfo.getIdentityName () << endl;
wcout << L"\t\t\t" << L"Publisher: " << g_pkgInfo.getIdentityPublisher () << endl;
wcout << L"\t\t\t" << L"Version: " << g_pkgInfo.getIdentityVersion ().toStringW () << endl;
std::vector <APPX_PACKAGE_ARCHITECTURE> archs;
wcout << L"\t\t\t" << L"Processor Architecture (" << g_pkgInfo.getIdentityProcessorArchitecture (archs) << ") ";
if (archs.size () > 0)
{
std::wstring temp;
for (size_t cnt = 0; cnt < archs.size (); cnt ++)
{
switch (archs [cnt])
{
case APPX_PACKAGE_ARCHITECTURE_NEUTRAL: temp += L"Neutral"; break;
case APPX_PACKAGE_ARCHITECTURE_X86: temp += L"x86"; break;
case APPX_PACKAGE_ARCHITECTURE_X64: temp += L"x64"; break;
case APPX_PACKAGE_ARCHITECTURE_ARM: temp += L"Arm"; break;
default:
if ((UINT)archs [cnt] == 12) temp += L"Arm64";
}
if (cnt + 1 != archs.size ()) temp += L", ";
}
wcout << temp;
}
wcout << endl;
wcout << L"\t\t" << L"Properties" << endl;
wcout << L"\t\t\t" << L"Name: " << g_pkgInfo.getPropertyName () << endl;
wcout << L"\t\t\t" << L"Publisher: " << g_pkgInfo.getPropertyPublisher () << endl;
{
std::wstring &temp = g_pkgInfo.getPropertyDescription ();
if (temp.size () > 0)
{
wcout << L"\t\t\t" << L"Description: " << temp << endl;
}
}
std::vector <appmap> apps;
g_pkgInfo.getApplications (apps);
wcout << L"\t" << L"Applications (" << apps.size () << ")" << endl;
if (apps.size () > 0)
{
for (auto it : apps)
{
wcout << L"\t\t\t" << L"Application" << endl;
wcout << L"\t\t\t\t" << L"App Model User ID: " << it.getAppUserModelID () << endl;
}
}
wcout << StrPrintFormatW (GetRCString_cpp (PAGE_2_TITLE).c_str (), g_pkgInfo.getPropertyName ().c_str ()) << endl;
wcout << GetRCString_cpp (PAGE_2_LOADCERT);
if (LoadCertFromSignedFile (g_pkgPath.c_str ())) wcout << L"\tSucceeded! " << endl;
else wcout << "\tFailed. " << endl;
wcout << GetRCString_cpp (PAGE_2_INSTALL);
InstallStatus ires = AddPackageFromPath (g_pkgPath.c_str (), &ProgressCallback);
wcout << endl;
if (ires == InstallStatus::Success)
{
wcout << "\tInstall Succeeded! " << endl;
}
else
{
wcout << "\tInstall Failed. Message: " << GetLastErrorDetailText () << endl;
}
}
else
{
wcout << "\r\tInstall Failed. Message: Unavailable Package." << endl;
}
}
int wmain (int argc, LPWSTR *argv)
{
if (argc <= 1)
{
PrintHelpText ();
return 0;
}
setlocale (LC_ALL, "");
std::wcout.imbue (std::locale ("", LC_CTYPE));
SetCurrentProcessExplicitAppUserModelID (g_idenName);
wchar_t currentPath [MAX_PATH];
GetCurrentDirectory (MAX_PATH, currentPath);
wchar_t executablePath [MAX_PATH];
GetModuleFileName (NULL, executablePath, MAX_PATH);
std::wstring executableDir (executablePath);
executableDir = executableDir.substr (0, executableDir.find_last_of (L"\\/"));
if (!wcscmp (currentPath, executableDir.c_str ()))
{
SetCurrentDirectory (executableDir.c_str ());
}
CoInitializeEx (NULL, COINIT_MULTITHREADED);
if (ReadCommand (argc, argv))
{
TaskInstallPackage ();
}
g_reader.destroy ();
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,196 @@
#pragma once
#include "pkgcode.h"
#include "priread.h"
#include <algorithm>
// 用于处理信息
struct PackageInfomation
{
struct Identity
{
std::wstring name = L"";
std::wstring publisher = L"";
VERSION version;
std::vector <APPX_PACKAGE_ARCHITECTURE> architectures;
} identities;
struct Resources
{
std::vector <std::wstring> languages;
} resources;
struct Prerequisites
{
VERSION osMinVersion;
} prerequisites;
struct Property
{
std::wstring name = L"";
std::wstring description = L"";
std::wstring publisher = L"";
std::string logoBase64 = "";
CComPtr <IStream> logoStream = NULL;
} properties;
std::vector <appmap> applications;
std::vector <std::wstring> capabilities;
std::vector <DEPINFO> dependencies;
bool isMsResourceLabel (LPCSTR lpstr)
{
if (!lpstr) return false;
const std::string mslabel ("ms-resource:");
std::string sub = StringTrim (std::string (lpstr)).substr (0, mslabel.length ());
return LabelEqual (sub, mslabel);
}
bool isMsResourceLabel (LPCWSTR lpstr)
{
if (!lpstr) return false;
const std::wstring mslabel (L"ms-resource:");
std::wstring sub = StringTrim (std::wstring (lpstr)).substr (0, mslabel.length ());
return LabelEqual (sub, mslabel);
}
bool isMsResourceLabel (std::string objStr) { return isMsResourceLabel (objStr.c_str ()); }
bool isMsResourceLabel (std::wstring objStr) { return isMsResourceLabel (objStr.c_str ()); }
PackageInfomation (PackageReader &reader) { this->create (reader); }
PackageInfomation () {}
bool create (PackageReader &reader)
{
PriReader pri;
this->identities.name = reader.getIdentityName ();
this->identities.publisher = reader.getIdentityPublisher ();
this->identities.version = reader.getIdentityVersion ();
reader.getIdentityProcessorArchitecture (this->identities.architectures);
reader.getResourceLanguages (this->resources.languages);
std::sort (this->resources.languages.begin (), this->resources.languages.end ());
if (pri.create (reader.getPriFileStream ()))
{
std::wstring temp = reader.getPropertyName ();
if (isMsResourceLabel (temp))
{
std::wstring getres = pri.findStringValue (temp);
if (!getres.empty () && getres.length () > 0) temp = std::wstring (L"") + getres;
}
this->properties.name = temp;
temp = reader.getPropertyDescription ();
if (isMsResourceLabel (temp))
{
std::wstring getres = pri.findStringValue (temp);
if (!getres.empty () && getres.length () > 0) temp = std::wstring (L"") + getres;
}
this->properties.description = temp;
temp = reader.getPropertyPublisher ();
if (isMsResourceLabel (temp))
{
std::wstring getres = pri.findStringValue (temp);
if (!getres.empty () && getres.length () > 0) temp = std::wstring (L"") + getres;
}
this->properties.publisher = temp;
}
else
{
this->properties.name = reader.getPropertyName ();
this->properties.description = reader.getPropertyDescription ();
this->properties.publisher = reader.getPropertyPublisher ();
}
this->properties.logoBase64 = GetLogoBase64FromReader (reader, &this->properties.logoStream);
this->prerequisites.osMinVersion = reader.getPrerequisiteOSMinVersion ();
reader.getApplications (this->applications);
reader.getCapabilities (capabilities);
reader.getDependencies (dependencies);
return reader.isAvailable ();
}
void destroy ()
{
this->identities.name = L"";
this->identities.publisher = L"";
this->identities.version = VERSION (0);
this->identities.architectures.clear ();
this->properties.name = L"";
this->properties.description = L"";
this->properties.publisher = L"";
this->properties.logoBase64 = "";
if (this->properties.logoStream) { this->properties.logoStream.Release (); this->properties.logoStream = nullptr; }
this->resources.languages.clear ();
this->prerequisites.osMinVersion = VERSION (0);
this->applications.clear ();
this->capabilities.clear ();
this->dependencies.clear ();
}
// 失败返回长度为 0 或空的文本。
std::wstring getIdentityName () { return this->identities.name; }
// 失败返回长度为 0 或空的文本。
std::wstring getIdentityPublisher () { return this->identities.publisher; }
// 失败返回都为 0 的版本号
VERSION getIdentityVersion () { return this->identities.version; }
size_t getIdentityProcessorArchitecture (std::vector <APPX_PACKAGE_ARCHITECTURE> &arrOut)
{
for (auto it : this->identities.architectures)
{
arrOut.push_back (it);
}
return arrOut.size ();
}
size_t getResourceLanguages (std::vector <std::wstring> &vec)
{
for (auto it : this->resources.languages)
{
vec.push_back (it);
}
return vec.size ();
}
std::wstring getPropertyName () { return this->properties.name; }
std::wstring getPropertyDescription () { return this->properties.description; }
std::wstring getPropertyPublisher () { return this->properties.publisher; }
std::string getPropertyLogoBase64 () { return this->properties.logoBase64; }
// 无需手动释放
IStream *getPropertyLogoIStream () { return this->properties.logoStream; }
// 失败返回都为 0 的版本号
VERSION getPrerequisiteOSMinVersion () { return this->prerequisites.osMinVersion; }
// 判断当前包是否为应用包而不是资源包或依赖项。如果为捆绑包的话判断是否子包中存在应用包。
bool isPackageApplication () { return this->applications.size () > 0; }
size_t getApplications (std::vector <appmap> &output)
{
for (auto it : this->applications)
{
output.push_back (it);
}
return output.size ();
}
size_t getApplicationUserModelIDs (std::vector <std::wstring> &output)
{
for (auto it : this->applications)
{
output.push_back (it.getAppUserModelID ());
}
return output.size ();
}
size_t getApplicationIDs (std::vector <std::wstring> &output)
{
for (size_t cnt = 0; cnt < this->applications.size (); cnt ++)
{
output.push_back (this->applications [cnt] [std::wstring (L"Id")]);
}
return output.size ();
}
size_t getApplicationVisualElementsBackgroundColor (std::vector <std::wstring> &output)
{
for (size_t cnt = 0; cnt < this->applications.size (); cnt ++)
{
output.push_back (this->applications [cnt] [std::wstring (L"BackgroundColor")]);
}
return output.size ();
}
size_t getCapabilities (std::vector <std::wstring> &output)
{
for (auto it : this->capabilities)
{
output.push_back (it);
}
return output.size ();
}
size_t getDependencies (std::vector <DEPINFO> &output)
{
for (auto it : this->dependencies)
{
output.push_back (it);
}
return output.size ();
}
};

View File

@@ -0,0 +1,377 @@
#pragma once
// 由于难用 PRI 相关 API只得使用 makepri 了
#include <Windows.h>
#include <string>
#include <iostream>
#include "localeex.h"
#include <vector>
#include "pkgcode.h"
#include "PriReader2.h"
std::string GetProgramRootDirectoryA ()
{
char path [MAX_PATH];
if (GetModuleFileNameA (NULL, path, MAX_PATH))
{
std::string dir (path);
size_t pos = dir.find_last_of ("\\/");
if (pos != std::string::npos)
{
dir = dir.substr (0, pos);
}
return dir;
}
return "";
}
std::wstring GetProgramRootDirectoryW ()
{
wchar_t path [MAX_PATH];
if (GetModuleFileNameW (NULL, path, MAX_PATH))
{
std::wstring dir (path);
size_t pos = dir.find_last_of (L"\\/");
if (pos != std::wstring::npos)
{
dir = dir.substr (0, pos);
}
return dir;
}
return L"";
}
std::string EnsureTrailingSlash (const std::string &path)
{
if (path.empty ()) return path; // 空路径直接返回
char lastChar = path.back ();
if (lastChar == '\\' || lastChar == '/')
return path; // 已有分隔符,直接返回
// 根据系统或原路径格式添加适当的分隔符
char separator = (path.find ('/') != std::string::npos) ? '/' : '\\';
return path + separator;
}
std::wstring EnsureTrailingSlash (const std::wstring &path)
{
if (path.empty ()) return path;
wchar_t lastChar = path.back ();
if (lastChar == L'\\' || lastChar == L'/')
return path;
wchar_t separator = (path.find (L'/') != std::wstring::npos) ? L'/' : L'\\';
return path + separator;
}
bool IsDirectoryExists (const std::string path) { return IsDirectoryExistsA (path.c_str ()); }
bool IsDirectoryExists (const std::wstring path) { return IsDirectoryExistsW (path.c_str ()); }
bool IsDirectoryExists (LPCSTR path) { return IsDirectoryExistsA (path); }
bool IsDirectoryExists (LPCWSTR path) { return IsDirectoryExistsW (path); }
std::string NormalizePath (const std::string &path)
{
if (!path.empty () && path.back () == '\\')
return path.substr (0, path.size () - 1);
return path;
}
std::wstring NormalizePath (const std::wstring &path)
{
if (!path.empty () && path.back () == L'\\')
return path.substr (0, path.size () - 1);
return path;
}
std::vector <std::string> EnumSubdirectories (const std::string &directory, bool includeParentPath)
{
std::vector<std::string> subdirs;
std::string normPath = NormalizePath (directory);
std::string searchPath = normPath + "\\*";
WIN32_FIND_DATAA findData;
HANDLE hFind = FindFirstFileA (searchPath.c_str (), &findData);
if (hFind == INVALID_HANDLE_VALUE) return subdirs;
do
{
// 过滤 "." 和 ".."
if (strcmp (findData.cFileName, ".") == 0 || strcmp (findData.cFileName, "..") == 0)
continue;
// 判断是否为目录
if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
if (includeParentPath)
subdirs.push_back (normPath + "\\" + findData.cFileName);
else
subdirs.push_back (findData.cFileName);
}
} while (FindNextFileA (hFind, &findData));
FindClose (hFind);
return subdirs;
}
std::vector <std::wstring> EnumSubdirectories (const std::wstring &directory, bool includeParentPath)
{
std::vector<std::wstring> subdirs;
std::wstring normPath = NormalizePath (directory);
std::wstring searchPath = normPath + L"\\*";
WIN32_FIND_DATAW findData;
HANDLE hFind = FindFirstFileW (searchPath.c_str (), &findData);
if (hFind == INVALID_HANDLE_VALUE) return subdirs;
do
{
if (wcscmp (findData.cFileName, L".") == 0 || wcscmp (findData.cFileName, L"..") == 0)
continue;
if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
if (includeParentPath)
subdirs.push_back (normPath + L"\\" + findData.cFileName);
else
subdirs.push_back (findData.cFileName);
}
} while (FindNextFileW (hFind, &findData));
FindClose (hFind);
return subdirs;
}
bool CheckDependency (const std::string &dllName)
{
HMODULE hModule = LoadLibraryA (dllName.c_str ());
if (hModule == NULL)
{
return false;
}
FreeLibrary (hModule);
return true;
}
bool CheckDependency (const std::wstring &dllName)
{
HMODULE hModule = LoadLibraryW (dllName.c_str ());
if (hModule == NULL)
{
return false;
}
FreeLibrary (hModule);
return true;
}
bool CanRunExe (const std::string &exePath)
{
STARTUPINFOA si = {sizeof (si)};
PROCESS_INFORMATION pi;
BOOL success = CreateProcessA (
exePath.c_str (), // 应用路径
NULL, // 命令行参数
NULL, // 安全属性
NULL, // 线程安全属性
FALSE, // 不继承句柄
CREATE_NO_WINDOW, // 不创建窗口
NULL, // 环境变量
NULL, // 当前目录
&si, // 启动信息
&pi // 进程信息
);
if (!success)
{
DWORD error = GetLastError ();
return false;
}
WaitForSingleObject (pi.hProcess, INFINITE);
DWORD exitCode;
GetExitCodeProcess (pi.hProcess, &exitCode);
CloseHandle (pi.hProcess);
CloseHandle (pi.hThread);
return (exitCode == 0);
}
bool CanRunExe (const std::wstring& exePath)
{
STARTUPINFOW si = {sizeof (si)};
PROCESS_INFORMATION pi;
BOOL success = CreateProcessW (
exePath.c_str (), // 应用路径
NULL, // 命令行参数
NULL, // 安全属性
NULL, // 线程安全属性
FALSE, // 不继承句柄
CREATE_NO_WINDOW, // 不创建窗口
NULL, // 环境变量
NULL, // 当前目录
&si, // 启动信息
&pi // 进程信息
);
if (!success)
{
DWORD error = GetLastError ();
return false;
}
WaitForSingleObject (pi.hProcess, INFINITE);
DWORD exitCode;
GetExitCodeProcess (pi.hProcess, &exitCode);
CloseHandle (pi.hProcess);
CloseHandle (pi.hThread);
return (exitCode == 0);
}
bool IsProgramExecutable (const std::string &exePath)
{
if (!IsFileExists (exePath))
{
return false;
}
if (!CanRunExe (exePath))
{
return false;
}
return true;
}
bool IsProgramExecutable (const std::wstring &exePath)
{
if (!IsFileExists (exePath))
{
return false;
}
if (!CanRunExe (exePath))
{
return false;
}
return true;
}
std::wstring GetUniqueTempFilePathW ()
{
// 获取临时文件夹路径
wchar_t tempPath [MAX_PATH];
if (GetTempPath (MAX_PATH, tempPath) == 0)
{
return L"";
}
// 创建一个唯一的临时文件
wchar_t tempFile [MAX_PATH];
if (GetTempFileName (tempPath, L"TMP", 0, tempFile) == 0)
{
return L"";
}
return tempFile;
}
std::string GetUniqueTempFilePathA () {
// 获取临时文件夹路径
char tempPath [MAX_PATH];
if (GetTempPathA (MAX_PATH, tempPath) == 0)
{
return "";
}
// 创建一个唯一的临时文件
char tempFile [MAX_PATH];
if (GetTempFileNameA (tempPath, "TMP", 0, tempFile) == 0)
{
return "";
}
return tempFile;
}
int InStr (const std::string &text, const std::string &keyword, bool ignoreCase = false)
{
std::string s1, s2;
if (ignoreCase)
{
s1 = StringToUpper (text);
s2 = StringToUpper (keyword);
}
else
{
s1 = text;
s2 = keyword;
}
const char *found = StrStrIA (s1.c_str (), s2.c_str ());
if (!found)
{
return -1;
}
return found - text.c_str ();
}
int InStr (const std::wstring &text, const std::wstring &keyword, bool ignoreCase = false)
{
std::wstring s1, s2;
if (ignoreCase)
{
s1 = StringToUpper (text);
s2 = StringToUpper (keyword);
}
else
{
s1 = text;
s2 = keyword;
}
const WCHAR *found = StrStrIW (s1.c_str (), s2.c_str ());
if (!found)
{
return -1;
}
return found - text.c_str ();
}
template <typename StringType> StringType ReplaceBackslash (const StringType &input)
{
StringType result = input; // 复制输入字符串,避免修改原数据
using CharType = typename StringType::value_type; // 获取字符串的字符类型char 或 wchar_t
std::replace (result.begin (), result.end (), static_cast<CharType> ('\\'), static_cast<CharType> ('/'));
return result;
}
class PriReader
{
private:
HPRIREADER priReader;
public:
PriReader (LPCWSTR lpPriFilePath) { this->create (lpPriFilePath); }
PriReader (const std::wstring objPriFilePath) { this->create (objPriFilePath); }
PriReader (IStream *comISPriFile) { this->create (comISPriFile); }
~PriReader () { this->destroy (); }
PriReader (): priReader (NULL) {}
void destroy ()
{
if (!priReader) return;
DestroyPriReader (priReader);
priReader = NULL;
}
bool isAvailable () { return priReader != nullptr; }
bool create (const std::wstring priFile) { destroy (); return priReader = CreatePriReader (priFile.c_str ()); }
bool create (LPCWSTR priFile) { destroy (); if (!priFile) return false; return this->create (std::wstring (priFile)); }
bool create (IStream *priFStream) { destroy (); return priReader = CreatePriReaderFromStream (priFStream); }
// 获取到的指针需要 free 手动释放。
LPSTR findStringValue (LPCSTR lpMsName, LPCSTR defaultLocaleCode = NULL)
{
return PriReaderFindStringValueA (priReader, lpMsName, defaultLocaleCode);
}
// 获取到的指针需要 free 手动释放。
LPWSTR findStringValue (LPCWSTR lpMsName, LPCWSTR defaultLocaleCode = NULL)
{
return PriReaderFindStringValueW (priReader, lpMsName, defaultLocaleCode);
}
std::string findStringValue (const std::string &objMsName, const std::string &defaultLocaleCode = "")
{
std::string t ("");
LPSTR lpStr = findStringValue (objMsName.c_str (), ((!defaultLocaleCode.empty () && defaultLocaleCode.length () > 0) ? defaultLocaleCode.c_str () : NULL));
if (lpStr) t += lpStr;
if (lpStr) free (lpStr);
return t;
}
std::wstring findStringValue (const std::wstring &objMsName, const std::wstring &defaultLocaleCode = L"")
{
std::wstring t (L"");
LPWSTR lpStr = findStringValue (objMsName.c_str (), ((!defaultLocaleCode.empty () && defaultLocaleCode.length () > 0) ? defaultLocaleCode.c_str () : NULL));
if (lpStr) t += lpStr;
if (lpStr) free (lpStr);
return t;
}
LPSTR findFilePathValue (LPCSTR lpMsName, int defaultScale = 0, ImageContrast defaultContrast = ImageContrast::none)
{
return PriReaderFindFilePathValueA (priReader, lpMsName, defaultScale, defaultContrast);
}
LPWSTR findFilePathValue (LPCWSTR lpMsName, int defaultScale = 0, ImageContrast defaultContrast = ImageContrast::none)
{
return PriReaderFindFilePathValueW (priReader, lpMsName, defaultScale, defaultContrast);
}
std::string findFilePathValue (const std::string &objMsName, int defaultScale = 0, ImageContrast defaultContrast = ImageContrast::none)
{
std::string t ("");
LPSTR lpStr = findFilePathValue (objMsName.c_str (), defaultScale, defaultContrast);
if (lpStr) t += lpStr;
if (lpStr) free (lpStr);
return t;
}
std::wstring findFilePathValue (const std::wstring &objMsName, int defaultScale = 0, ImageContrast defaultContrast = ImageContrast::none)
{
std::wstring t (L"");
LPWSTR lpStr = findFilePathValue (objMsName.c_str (), defaultScale, defaultContrast);
if (lpStr) t += lpStr;
if (lpStr) free (lpStr);
return t;
}
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="Company.Product.Name" type="win32" />
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns=
"https://schemas.microsoft.com/SMI/2005/WindowsSettings">
True/PM
</dpiAware>
</windowsSettings>
</application>
<description></description>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*" />
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

156
AppInstallerConsole/res2.h Normal file
View File

@@ -0,0 +1,156 @@
#pragma once
#include "resource.h"
#include "pkgcode.h"
bool IsEqualLabel (std::wstring str1, std::wstring str2)
{
std::wstring s1 = StringToUpper (StringTrim (str1)),
s2 = StringToUpper (StringTrim (str2));
return s1 == s2;
}
typedef class _LABEL
{
private:
std::wstring objwsStr;
public:
template <class T> explicit _LABEL (const T& str)
{
std::wstringstream wss;
wss << str;
objwsStr = wss.str ();
}
_LABEL (const _LABEL &label)
{
objwsStr = std::wstring (label.objwsStr);
}
_LABEL (): objwsStr (L"") {}
friend bool operator == (const _LABEL &l1, const _LABEL &l2)
{
return IsEqualLabel (l1.objwsStr, l2.objwsStr);
}
friend bool operator == (LPCWSTR &l1, const _LABEL &l2)
{
return IsEqualLabel (_LABEL (l1).objwsStr, l2.objwsStr);
}
friend bool operator == (const _LABEL &l2, LPCWSTR &l1)
{
return IsEqualLabel (_LABEL (l1).objwsStr, l2.objwsStr);
}
friend bool operator == (std::wstring &l1, const _LABEL &l2)
{
return IsEqualLabel (_LABEL (l1).objwsStr, l2.objwsStr);
}
friend bool operator == (const _LABEL &l2, std::wstring &l1)
{
return IsEqualLabel (_LABEL (l1).objwsStr, l2.objwsStr);
}
_LABEL operator = (const _LABEL &other)
{
if (this != &other) this->objwsStr = std::wstring (other.objwsStr);
return *this;
}
_LABEL operator = (LPCWSTR &lpWStr)
{
this->objwsStr = std::wstring (lpWStr);
return *this;
}
_LABEL operator = (const std::wstring &obj)
{
this->objwsStr = std::wstring (obj);
return *this;
}
std::wstring getStr () const { return objwsStr; }
LPCWSTR getStrC () { return objwsStr.c_str (); }
bool operator < (const _LABEL &other) const
{
std::wstring s1 = StringToUpper (StringTrim (this->objwsStr)),
s2 = StringToUpper (StringTrim (other.objwsStr));
return s1 < s2;
}
} LABEL;
typedef std::map <LABEL, UINT> MAP_LABEL_UINT;
bool isinitcapmap = false;
MAP_LABEL_UINT capmap;
void InitCapabilitiesMap ()
{
if (isinitcapmap) return;
isinitcapmap = true;
capmap [LABEL (L"internetClient")] = internetClient;
capmap [LABEL (L"internetClientServer")] = internetClientServer;
capmap [LABEL (L"privateNetworkClientServer")] = privateNetworkClientServer;
capmap [LABEL (L"documentsLibrary")] = documentsLibrary;
capmap [LABEL (L"picturesLibrary")] = picturesLibrary;
capmap [LABEL (L"videosLibrary")] = videosLibrary;
capmap [LABEL (L"musicLibrary")] = musicLibrary;
capmap [LABEL (L"enterpriseAuthentication")] = enterpriseAuthentication;
capmap [LABEL (L"sharedUserCertificates")] = sharedUserCertificates;
capmap [LABEL (L"removableStorage")] = removableStorage;
capmap [LABEL (L"appointments")] = appointments;
capmap [LABEL (L"contacts")] = contacts;
capmap [LABEL (L"phoneCall")] = phoneCall;
capmap [LABEL (L"backgroundMediaPlayback")] = backgroundMediaPlayback;
capmap [LABEL (L"pointOfService")] = pointOfService;
capmap [LABEL (L"allJoyn")] = allJoyn;
capmap [LABEL (L"phoneCallHistoryPublic")] = phoneCallHistoryPublic;
capmap [LABEL (L"microphone")] = microphone;
capmap [LABEL (L"offlineMapsManagement")] = offlineMapsManagement;
capmap [LABEL (L"objects5D")] = objects5D;
capmap [LABEL (L"objects3D")] = objects3D;
capmap [LABEL (L"graphicsCaptureWithoutBorder")] = graphicsCaptureWithoutBorder;
capmap [LABEL (L"bluetooth")] = bluetooth;
capmap [LABEL (L"lowLevelDevices")] = lowLevelDevices;
capmap [LABEL (L"location")] = location;
capmap [LABEL (L"humaninterfacedevice")] = humaninterfacedevice;
capmap [LABEL (L"recordedCallsFolder")] = recordedCallsFolder;
capmap [LABEL (L"proximity")] = proximity;
capmap [LABEL (L"webcam")] = webcam;
capmap [LABEL (L"graphicsCaptureProgrammatic")] = graphicsCaptureProgrammatic;
capmap [LABEL (L"userNotificationListener")] = userNotificationListener;
capmap [LABEL (L"userDataTasks")] = userDataTasks;
capmap [LABEL (L"userAccountInformation")] = userAccountInformation;
capmap [LABEL (L"usb")] = usb;
capmap [LABEL (L"systemManagement")] = systemManagement;
capmap [LABEL (L"spatialPerception")] = spatialPerception;
capmap [LABEL (L"smsSend")] = smsSend;
capmap [LABEL (L"blockedChatMessages")] = blockedChatMessages;
capmap [LABEL (L"chat")] = chat;
capmap [LABEL (L"codeGeneration")] = codeGeneration;
capmap [LABEL (L"voipCall")] = voipCall;
capmap [LABEL (L"enterpriseDataPolicy")] = enterpriseDataPolicy;
capmap [LABEL (L"inputInjectionBrokered")] = inputInjectionBrokered;
capmap [LABEL (L"remoteSystem")] = remoteSystem;
capmap [LABEL (L"inProcessMediaExtension")] = inProcessMediaExtension;
capmap [LABEL (L"webPlatformMediaExtension")] = webPlatformMediaExtension;
capmap [LABEL (L"previewStore")] = previewStore;
capmap [LABEL (L"confirmAppClose")] = confirmAppClose;
capmap [LABEL (L"runFullTrust")] = runFullTrust;
capmap [LABEL (L"previewUiComposition")] = previewUiComposition;
capmap [LABEL (L"slapiQueryLicenseValue")] = slapiQueryLicenseValue;
capmap [LABEL (L"localSystemServices")] = localSystemServices;
capmap [LABEL (L"packageManagement")] = packageManagement;
capmap [LABEL (L"packageQuery")] = packageQuery;
capmap [LABEL (L"packagePolicySystem")] = packagePolicySystem;
capmap [LABEL (L"storeAppInstall")] = storeAppInstall;
capmap [LABEL (L"appLicensing")] = appLicensing;
capmap [LABEL (L"broadFileSystemAccess")] = broadFileSystemAccess;
capmap [LABEL (L"allowElevation")] = allowElevation;
capmap [LABEL (L"unvirtualizedResources")] = unvirtualizedResources;
capmap [LABEL (L"extendedExecution")] = extendedExecution;
capmap [LABEL (L"appointmentsSystem")] = appointmentsSystem;
capmap [LABEL (L"contactsSystem")] = contactsSystem;
capmap [LABEL (L"phoneCallSystem")] = phoneCallSystem;
capmap [LABEL (L"userDataAccounts")] = userDataAccounts;
capmap [LABEL (L"userDataTasksSystem")] = userDataTasksSystem;
}
// ʧ°Ü·µ»Ø NULL
UINT CapabilitiesNameToID (LPCWSTR lpStr)
{
if (!lpStr) return NULL;
InitCapabilitiesMap ();
auto it = capmap.find (LABEL (lpStr));
if (it != capmap.end ()) return it->second;
else return NULL;
}
UINT CapabilitiesNameToID (std::wstring objStr)
{
return CapabilitiesNameToID (objStr.c_str ());
}

View File

@@ -0,0 +1,162 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ 生成的包含文件。
// 供 AppInstaller.rc 使用
//
#pragma once
#define IDR_MANIFEST1 1
#define IDR_VERSION_ZH_CN 1
#define IDR_VERSION_EN_US 2
#define MANIFEST 24
#define BLANK_NORMAL 99
#define BLANK_LIGHT 100
#define BLANK_PRESS 101
#define MIN_NORMAL 102
#define MIN_LIGHT 103
#define MIN_PRESS 104
#define MAX_NORMAL 105
#define MAX_LIGHT 106
#define MAX_PRESS 107
#define RESTORE_NORMAL 108
#define RESTORE_LIGHT 109
#define RESTORE_PRESS 110
#define CANCEL_NORMAL 111
#define CANCEL_LIGHT 112
#define CANCEL_PRESS 113
#define BLANK_LARGR_NORMAL 114
#define BLANK_LARGR_LIGHT 115
#define BLANK_LARGR_PRESS 116
#define MIN_LARGR_NORMAL 117
#define MIN_LARGE_LIGHT 118
#define MIN_LARGR_PRESS 119
#define MAX_LARGE_NORMAL 120
#define MAX_LARGE_LIGHT 121
#define MAX_LARGE_PRESS 122
#define RESTORE_LARGE_NORMAL 123
#define RESTORE_LARGE_LIGHT 124
#define RESTORE_LARGE_PRESS 125
#define CANCEL_LARGE_NORMAL 126
#define CANCEL_LARGE_LIGHT 127
#define CANCEL_LARGE_PRESS 128
#define IDI_MAINICON 129
#define ICON_TASKBAR 130
#define ICON_FILE 131
#define ICON_WHITE 132
#define ICON_METRO 133
#define ICON_COLOR 136
#define WIN_TITLE 300
#define PAGE_LOADING 301
#define PAGE_1_TITLE 302
#define PAGE_INFO_PUBLISHER 303
#define PAGE_INFO_VERSION 304
#define PAGE_FUNCTIONS 305
#define PAGE_CHECK_RUNWHENREADY 306
#define PAGE_2_LOADCERT 307
#define PAGE_2_INSTALL 308
#define PAGE_3_TITLE 309
#define PAGE_4_TITLE 310
#define PAGE_5_TITLE 311
#define DIALOG_SELLET_APPX 312
#define DIALOG_SELLET_UNI 313
#define BUTTON_1_SER1 314
#define BUTTON_3_SER1 315
#define BUTTON_4_SER1 316
#define BUTTON_5_SER1 317
#define DIALOG_WINTITLE 318
#define PAGE_1_APPHASINSTALLED 319
#define PAGE_2_TITLE 320
#define PAGE_1_APP 321
#define PAGE_2_LOADING 322
#define PAGE_2_INSTALLING 323
#define CLHELP_1 330
#define CLHELP_2 331
#define CLHELP_3 332
#define CLHELP_4 333
#define CLHELP_5 334
#define CLHELP_6 335
#define CLHELP_7 336
#define INITWIDTH 400
#define INITHEIGHT 401
#define LIMITWIDTH 402
#define LIMITHEIGHT 403
#define textSupportCPU 450
#define textSupportSystem 451
#define textSupportLanguage 452
#define textDependency 453
#define textDependencyItem 454
#define internetClient 500
#define internetClientServer 501
#define privateNetworkClientServer 502
#define documentsLibrary 503
#define picturesLibrary 504
#define videosLibrary 505
#define musicLibrary 506
#define enterpriseAuthentication 507
#define sharedUserCertificates 508
#define removableStorage 509
#define appointments 510
#define contacts 511
#define phoneCall 512
#define backgroundMediaPlayback 513
#define pointOfService 514
#define allJoyn 515
#define phoneCallHistoryPublic 516
#define microphone 517
#define offlineMapsManagement 518
#define objects5D 519
#define objects3D 519
#define graphicsCaptureWithoutBorder 520
#define bluetooth 521
#define lowLevelDevices 522
#define location 523
#define humaninterfacedevice 524
#define recordedCallsFolder 525
#define proximity 526
#define webcam 527
#define graphicsCaptureProgrammatic 528
#define userNotificationListener 529
#define userDataTasks 530
#define userAccountInformation 531
#define usb 532
#define systemManagement 533
#define spatialPerception 534
#define smsSend 535
#define blockedChatMessages 536
#define chat 537
#define codeGeneration 538
#define voipCall 539
#define enterpriseDataPolicy 540
#define inputInjectionBrokered 541
#define remoteSystem 542
#define inProcessMediaExtension 544
#define webPlatformMediaExtension 545
#define previewStore 546
#define confirmAppClose 547
#define runFullTrust 548
#define previewUiComposition 549
#define slapiQueryLicenseValue 550
#define localSystemServices 551
#define packageManagement 552
#define packageQuery 553
#define packagePolicySystem 554
#define storeAppInstall 555
#define appLicensing 556
#define broadFileSystemAccess 557
#define allowElevation 558
#define unvirtualizedResources 559
#define extendedExecution 560
#define appointmentsSystem 561
#define contactsSystem 562
#define phoneCallSystem 563
#define userDataAccounts 564
#define userDataTasksSystem 565
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif