Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c414259e7a | ||
|
|
478d2580da | ||
|
|
e2d78df375 | ||
|
|
99df99dd9f | ||
|
|
151c63c9c2 | ||
|
|
949759ffe9 | ||
|
|
ff0cebc7cc | ||
|
|
83fb7dda4e | ||
|
|
4b3f73778e | ||
|
|
b64ae80502 | ||
|
|
c111210987 | ||
|
|
43dbb6f2d8 | ||
|
|
0ff448fdb8 | ||
|
|
c8aeb519c8 | ||
|
|
487957c365 |
@@ -20,6 +20,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PriReader2", "PriReader2\Pr
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CertificateManager", "CertificateManager\CertificateManager.vcxproj", "{22702832-C3FD-48E5-BC7D-3879CA50A2ED}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AppInstallerConsole", "AppInstallerConsole\AppInstallerConsole.vcxproj", "{D1338693-D56A-45D4-9BA6-DDA67F9E0AB3}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -81,6 +83,7 @@ Global
|
||||
{59131AB7-2A7D-9A09-8223-174C3F5E0F57}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{59131AB7-2A7D-9A09-8223-174C3F5E0F57}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{59131AB7-2A7D-9A09-8223-174C3F5E0F57}.Debug|x64.ActiveCfg = Debug|Win32
|
||||
{59131AB7-2A7D-9A09-8223-174C3F5E0F57}.Debug|x64.Build.0 = Debug|Win32
|
||||
{59131AB7-2A7D-9A09-8223-174C3F5E0F57}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{59131AB7-2A7D-9A09-8223-174C3F5E0F57}.Debug|x86.Build.0 = Debug|Win32
|
||||
{59131AB7-2A7D-9A09-8223-174C3F5E0F57}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||
@@ -120,6 +123,7 @@ Global
|
||||
{E10C6272-B876-4DC6-9E13-7CA646863B50}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{E10C6272-B876-4DC6-9E13-7CA646863B50}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{E10C6272-B876-4DC6-9E13-7CA646863B50}.Debug|x64.ActiveCfg = Debug|Win32
|
||||
{E10C6272-B876-4DC6-9E13-7CA646863B50}.Debug|x64.Build.0 = Debug|Win32
|
||||
{E10C6272-B876-4DC6-9E13-7CA646863B50}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{E10C6272-B876-4DC6-9E13-7CA646863B50}.Debug|x86.Build.0 = Debug|Win32
|
||||
{E10C6272-B876-4DC6-9E13-7CA646863B50}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||
@@ -172,6 +176,26 @@ Global
|
||||
{22702832-C3FD-48E5-BC7D-3879CA50A2ED}.Release|x64.Build.0 = Release|x64
|
||||
{22702832-C3FD-48E5-BC7D-3879CA50A2ED}.Release|x86.ActiveCfg = Release|Win32
|
||||
{22702832-C3FD-48E5-BC7D-3879CA50A2ED}.Release|x86.Build.0 = Release|Win32
|
||||
{D1338693-D56A-45D4-9BA6-DDA67F9E0AB3}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{D1338693-D56A-45D4-9BA6-DDA67F9E0AB3}.Debug|Any CPU.Build.0 = Debug|Win32
|
||||
{D1338693-D56A-45D4-9BA6-DDA67F9E0AB3}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{D1338693-D56A-45D4-9BA6-DDA67F9E0AB3}.Debug|ARM.Build.0 = Debug|Win32
|
||||
{D1338693-D56A-45D4-9BA6-DDA67F9E0AB3}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{D1338693-D56A-45D4-9BA6-DDA67F9E0AB3}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{D1338693-D56A-45D4-9BA6-DDA67F9E0AB3}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{D1338693-D56A-45D4-9BA6-DDA67F9E0AB3}.Debug|x64.Build.0 = Debug|x64
|
||||
{D1338693-D56A-45D4-9BA6-DDA67F9E0AB3}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{D1338693-D56A-45D4-9BA6-DDA67F9E0AB3}.Debug|x86.Build.0 = Debug|Win32
|
||||
{D1338693-D56A-45D4-9BA6-DDA67F9E0AB3}.Release|Any CPU.ActiveCfg = Release|Win32
|
||||
{D1338693-D56A-45D4-9BA6-DDA67F9E0AB3}.Release|Any CPU.Build.0 = Release|Win32
|
||||
{D1338693-D56A-45D4-9BA6-DDA67F9E0AB3}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{D1338693-D56A-45D4-9BA6-DDA67F9E0AB3}.Release|ARM.Build.0 = Release|Win32
|
||||
{D1338693-D56A-45D4-9BA6-DDA67F9E0AB3}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{D1338693-D56A-45D4-9BA6-DDA67F9E0AB3}.Release|Win32.Build.0 = Release|Win32
|
||||
{D1338693-D56A-45D4-9BA6-DDA67F9E0AB3}.Release|x64.ActiveCfg = Release|x64
|
||||
{D1338693-D56A-45D4-9BA6-DDA67F9E0AB3}.Release|x64.Build.0 = Release|x64
|
||||
{D1338693-D56A-45D4-9BA6-DDA67F9E0AB3}.Release|x86.ActiveCfg = Release|Win32
|
||||
{D1338693-D56A-45D4-9BA6-DDA67F9E0AB3}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include <Windows.h>
|
||||
#include "resource.h"
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// 中文(简体,中国) resources
|
||||
@@ -115,8 +114,8 @@ IDR_MANIFEST1 RT_MANIFEST "res/manifest.xml"
|
||||
//
|
||||
|
||||
IDR_VERSION_ZH_CN VERSIONINFO
|
||||
FILEVERSION 1,0,1,7
|
||||
PRODUCTVERSION 1,0,1,7
|
||||
FILEVERSION 1,0,1,11
|
||||
PRODUCTVERSION 1,0,1,11
|
||||
FILEFLAGSMASK 0x0L
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -133,9 +132,9 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Bruce Winter"
|
||||
VALUE "FileDescription", "应用安装程序"
|
||||
VALUE "FileVersion", "1.0.1.7"
|
||||
VALUE "FileVersion", "1.0.1.11"
|
||||
VALUE "LegalCopyright", "\\xA9Bruce Winter. All rights reserved."
|
||||
VALUE "ProductVersion", "1.0.1.7"
|
||||
VALUE "ProductVersion", "1.0.1.11"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
@@ -145,8 +144,8 @@ BEGIN
|
||||
END
|
||||
|
||||
IDR_VERSION_EN_US VERSIONINFO
|
||||
FILEVERSION 1,0,1,7
|
||||
PRODUCTVERSION 1,0,1,7
|
||||
FILEVERSION 1,0,1,11
|
||||
PRODUCTVERSION 1,0,1,11
|
||||
FILEFLAGSMASK 0x0L
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -163,9 +162,9 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Bruce Winter"
|
||||
VALUE "FileDescription", "App Installer"
|
||||
VALUE "FileVersion", "1.0.1.7"
|
||||
VALUE "FileVersion", "1.0.1.11"
|
||||
VALUE "LegalCopyright", "\\xA9Bruce Winter. All rights reserved."
|
||||
VALUE "ProductVersion", "1.0.1.7"
|
||||
VALUE "ProductVersion", "1.0.1.11"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
@@ -239,9 +238,15 @@ BEGIN
|
||||
PAGE_1_APP "Microsoft Store 应用"
|
||||
PAGE_2_LOADING "请稍候..."
|
||||
PAGE_2_INSTALLING "正在安装 %d%%"
|
||||
APPLIST_WINTITLE "应用选择列表"
|
||||
APPLIST_TITLE "你要从哪个应用开始?"
|
||||
APPLIST_BUTTON_CANCEL "取消"
|
||||
SHORTCUT_SETTINGS "设置"
|
||||
SHORTCUT_UNINSTALL "删除 应用安装程序"
|
||||
SHORTCUT_UPDATE "更新 App Installer"
|
||||
CLHELP_1 "命令行参数说明:\n\n"
|
||||
CLHELP_2 "\t/?, /Help\n\t显示帮助窗口 (命令行参数说明)\n\n"
|
||||
CLHELP_3 "\t/DisableFrame\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"
|
||||
@@ -267,6 +272,9 @@ END
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
CLHELP_7 "\t/NoGUI\n\t使用 WSAppPkgIns 安装。安装时会弹出命令行窗口,安装完成后需手动关闭窗口\n\n"
|
||||
CLHELP_8 "\t/EnableFrame\n\t使用自绘的窗口边框 (仅用于易程序)\n\n"
|
||||
CLHELP_9 "\t/EProgram\n\t使用易的 WebUI\n\n"
|
||||
CLHELP_10 "\t/Console\n\t使用命令行版的 应用安装程序 (其实建议直接使用 AppInstallerConsole.exe 才更方便看输入输出)\n\n"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
@@ -404,9 +412,15 @@ BEGIN
|
||||
PAGE_1_APP "Microsoft Store App"
|
||||
PAGE_2_LOADING "Please wait..."
|
||||
PAGE_2_INSTALLING "Installing %d%%"
|
||||
APPLIST_WINTITLE "App Select List"
|
||||
APPLIST_TITLE "Which app do you want to start with?"
|
||||
APPLIST_BUTTON_CANCEL "Cancel"
|
||||
SHORTCUT_SETTINGS "Settings"
|
||||
SHORTCUT_UNINSTALL "Delete App Installer"
|
||||
SHORTCUT_UPDATE "Update App Installer"
|
||||
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_3 "\t/DisableFrame\n\tDisable the use of self-drawn window borders. (Only use for E program.)\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"
|
||||
@@ -424,6 +438,9 @@ 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"
|
||||
CLHELP_8 "\t/EnableFrame\n\tEnable the use of self-drawn window borders. (Only use for E program.)\n\n"
|
||||
CLHELP_9 "\t/EProgram\n\tUse E WebUI program.\n\n"
|
||||
CLHELP_10 "\t/Console\n\tUse the command line version of the application installer (it is actually recommended to use AppInstallerConsole.exe directly for easier viewing of input and output)\n\n"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
|
||||
@@ -138,6 +138,12 @@
|
||||
<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>
|
||||
<AdditionalManifestFiles>app.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
|
||||
<InputResourceManifests>
|
||||
</InputResourceManifests>
|
||||
<EnableDpiAwareness>false</EnableDpiAwareness>
|
||||
</Manifest>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
||||
<ClCompile>
|
||||
@@ -191,6 +197,9 @@
|
||||
</Link>
|
||||
<Manifest>
|
||||
<EnableDpiAwareness>false</EnableDpiAwareness>
|
||||
<AdditionalManifestFiles>app.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
|
||||
<InputResourceManifests>
|
||||
</InputResourceManifests>
|
||||
</Manifest>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
||||
@@ -252,6 +261,7 @@
|
||||
<ResourceCompile Include="AppInstaller.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="CustomMarshalers" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Drawing">
|
||||
<HintPath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Drawing.dll</HintPath>
|
||||
|
||||
26
AppInstaller/app.manifest
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"
|
||||
xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- Windows 10 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
||||
<!-- Windows 8.1 -->
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
||||
<!-- Windows Vista -->
|
||||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
|
||||
<!-- Windows 7 -->
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
|
||||
<!-- Windows 8 -->
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a4e38}"/>
|
||||
</application>
|
||||
</compatibility>
|
||||
|
||||
<!-- 高DPI感知配置(兼容旧版SDK) -->
|
||||
<asmv3:application>
|
||||
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True/PM</dpiAware>
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
|
||||
</assembly>
|
||||
@@ -31,18 +31,20 @@ std::wstring GetFileNameWithoutExtension (const std::wstring &filePath)
|
||||
return GetFileNameWithoutExtension (filePath.c_str ());
|
||||
}
|
||||
|
||||
std::string GetLogoBase64FromReader (PackageReader &reader, IStream **getOutput = NULL)
|
||||
std::string GetLogoBase64FromReader (PackageReader &reader, IStream **getOutput = NULL, PriReader *priread = 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 ())
|
||||
PriReader *pri = ((priread != NULL) ? priread : new PriReader (reader.getPriFileStream ()));
|
||||
if (pri->isAvailable ())
|
||||
{
|
||||
std::wstring logoPathFromPri = pri.findFilePathValue (logoPath);
|
||||
std::wstring logoPathFromPri = pri->findFilePathValue (logoPath);
|
||||
if (!logoPathFromPri.empty () && logoPath.length () > 0) logoPath = logoPathFromPri;
|
||||
}
|
||||
if (priread == NULL) delete pri;
|
||||
pri = NULL;
|
||||
IStream *imgfile = reader.extractFileToStream (logoPath);
|
||||
if (getOutput) *getOutput = imgfile;
|
||||
if (!imgfile)
|
||||
@@ -288,4 +290,528 @@ std::string GetLogoBase64FromReader (PackageReader &reader, IStream **getOutput
|
||||
b64res = "data:image/png;base64," + b64res;
|
||||
}
|
||||
return b64res;
|
||||
}
|
||||
|
||||
std::string GetBase64FromPath (PackageReader &reader, LPCWSTR lpswImgPath, IStream **getOutput = NULL, PriReader *priread = NULL)
|
||||
{
|
||||
if (!&reader) return std::string ("");
|
||||
if (!reader.isAvailable ()) return std::string ("");
|
||||
if (!lpswImgPath) return std::string ("");
|
||||
std::wstring logoPath = std::wstring (lpswImgPath);
|
||||
if (logoPath.empty () || logoPath.length () == 0) return std::string ("");
|
||||
PriReader *pri = ((priread != NULL) ? priread : new PriReader (reader.getPriFileStream ()));
|
||||
if (pri->isAvailable ())
|
||||
{
|
||||
std::wstring logoPathFromPri = pri->findFilePathValue (logoPath);
|
||||
if (!logoPathFromPri.empty () && logoPath.length () > 0) logoPath = logoPathFromPri;
|
||||
}
|
||||
if (priread == NULL) delete pri;
|
||||
pri = NULL;
|
||||
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;
|
||||
}
|
||||
|
||||
std::wstring GetBase64FromPathW (PackageReader &reader, LPCWSTR lpswImgPath, IStream **getOutput = NULL, PriReader *priread = NULL)
|
||||
{
|
||||
if (!&reader) return std::wstring (L"");
|
||||
if (!reader.isAvailable ()) return std::wstring (L"");
|
||||
if (!lpswImgPath) return std::wstring (L"");
|
||||
std::wstring logoPath = std::wstring (lpswImgPath);
|
||||
if (logoPath.empty () || logoPath.length () == 0) return std::wstring (L"");
|
||||
PriReader *pri = ((priread != NULL) ? priread : new PriReader (reader.getPriFileStream ()));
|
||||
if (pri->isAvailable ())
|
||||
{
|
||||
std::wstring logoPathFromPri = pri->findFilePathValue (logoPath);
|
||||
if (!logoPathFromPri.empty () && logoPath.length () > 0) logoPath = logoPathFromPri;
|
||||
}
|
||||
if (priread == NULL) delete pri;
|
||||
pri = NULL;
|
||||
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::wstring (L"");
|
||||
std::wstring b64res (L"");
|
||||
LPWSTR szRes = StreamToBase64W (imgfile);
|
||||
if (!getOutput)
|
||||
{
|
||||
if (imgfile)
|
||||
{
|
||||
imgfile->Release ();
|
||||
imgfile = NULL;
|
||||
}
|
||||
}
|
||||
if (!szRes) return b64res;
|
||||
if (szRes) b64res += szRes;
|
||||
free (szRes);
|
||||
if (b64res.length () > 0)
|
||||
{
|
||||
b64res = L"data:image/png;base64," + b64res;
|
||||
}
|
||||
return b64res;
|
||||
}
|
||||
@@ -28,12 +28,26 @@
|
||||
using namespace System;
|
||||
using namespace System::Windows::Forms;
|
||||
using namespace System::Threading;
|
||||
using namespace msclr::interop;
|
||||
using namespace System::Runtime::InteropServices;
|
||||
|
||||
int GetScreenWidth ()
|
||||
{
|
||||
return GetSystemMetrics (SM_CXSCREEN);
|
||||
}
|
||||
int GetScreenHeight ()
|
||||
{
|
||||
return GetSystemMetrics (SM_CYSCREEN);
|
||||
}
|
||||
|
||||
#define toInt(_String_Managed_Object_) Int32::Parse (_String_Managed_Object_)
|
||||
#define toDouble(_String_Managed_Object_) Double::Parse (_String_Managed_Object_)
|
||||
#define toBool(_String_Managed_Object_) Boolean::Parse (_String_Managed_Object_)
|
||||
#define toDateTime(_String_Managed_Object_) DateTime::Parse (_String_Managed_Object_)
|
||||
|
||||
extern int iDpi = GetDPI ();
|
||||
extern double dDpi = iDpi * 0.01;
|
||||
|
||||
String ^GetRCString_NET (UINT resID)
|
||||
{
|
||||
size_t bufferSize = 256;
|
||||
@@ -177,32 +191,25 @@ std::wstring StrPrintFormatW (LPCWSTR format, ...)
|
||||
|
||||
void SetWebBrowserEmulation ()
|
||||
{
|
||||
// 获取应用程序的可执行文件名
|
||||
String ^appName = System::IO::Path::GetFileNameWithoutExtension (System::Windows::Forms::Application::ExecutablePath);
|
||||
const wchar_t *appNameWChar = (const wchar_t *)(void *)System::Runtime::InteropServices::Marshal::StringToHGlobalUni (appName);
|
||||
BOOL is64Bit = FALSE;
|
||||
IsWow64Process (GetCurrentProcess (), &is64Bit);
|
||||
String^ appName = System::IO::Path::GetFileName (Application::ExecutablePath); // 包含扩展名
|
||||
IntPtr appNamePtr = System::Runtime::InteropServices::Marshal::StringToHGlobalUni (appName);
|
||||
const wchar_t* appNameWChar = static_cast<const wchar_t*>(appNamePtr.ToPointer ());
|
||||
BOOL isWow64 = FALSE;
|
||||
IsWow64Process (GetCurrentProcess (), &isWow64);
|
||||
HKEY hKey;
|
||||
long regOpenResult = ERROR_SUCCESS;
|
||||
if (is64Bit)
|
||||
LPCWSTR keyPath = isWow64
|
||||
? L"SOFTWARE\\WOW6432Node\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION"
|
||||
: L"SOFTWARE\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION";
|
||||
LONG result = RegOpenKeyExW (HKEY_CURRENT_USER, keyPath, 0, KEY_WRITE, &hKey);
|
||||
if (result == ERROR_SUCCESS)
|
||||
{
|
||||
regOpenResult = RegOpenKeyExW (HKEY_CURRENT_USER, L"SOFTWARE\\WOW6432Node\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION", 0, KEY_WRITE, &hKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
regOpenResult = RegOpenKeyExW (HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION", 0, KEY_WRITE, &hKey);
|
||||
}
|
||||
if (regOpenResult == ERROR_SUCCESS)
|
||||
{
|
||||
DWORD ie11Mode = 11001;
|
||||
RegSetValueExW (hKey, appNameWChar, 0, REG_DWORD, (const BYTE *)&ie11Mode, sizeof (DWORD));
|
||||
DWORD value = 11001;
|
||||
RegSetValueExW (hKey, appNameWChar, 0, REG_DWORD, reinterpret_cast<const BYTE*>(&value), sizeof (value));
|
||||
RegCloseKey (hKey);
|
||||
}
|
||||
System::Runtime::InteropServices::Marshal::FreeHGlobal (appNamePtr);
|
||||
}
|
||||
|
||||
#include <windows.h>
|
||||
#include <string>
|
||||
|
||||
bool IsIeVersion10 ()
|
||||
{
|
||||
HKEY hKey;
|
||||
@@ -237,6 +244,17 @@ bool IsIeVersion10 ()
|
||||
RegCloseKey (hKey);
|
||||
return isIe10;
|
||||
}
|
||||
bool IsWindows10AndLater ()
|
||||
{
|
||||
OSVERSIONINFOEX osvi = {0};
|
||||
osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX);
|
||||
osvi.dwMajorVersion = 10;
|
||||
DWORDLONG conditionMask = 0;
|
||||
VER_SET_CONDITION (conditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
|
||||
if (VerifyVersionInfoW (&osvi, VER_MAJORVERSION, conditionMask)) return TRUE;
|
||||
DWORD error = GetLastError ();
|
||||
return (error == ERROR_OLD_WIN_VERSION) ? FALSE : FALSE;
|
||||
}
|
||||
|
||||
size_t EnumerateFilesW (const std::wstring &directory, const std::wstring &filter,
|
||||
std::vector <std::wstring> &outFiles, bool recursive = false)
|
||||
@@ -312,29 +330,190 @@ HRESULT SetCurrentAppUserModelID (PCWSTR appID)
|
||||
}
|
||||
|
||||
void ProgressCallback (unsigned progress);
|
||||
void ToastPressCallback ();
|
||||
void OutputDebugStringFormatted (const wchar_t* format, ...);
|
||||
|
||||
public ref class AppWindow: public Form
|
||||
{
|
||||
private:
|
||||
System::Windows::Forms::WebBrowser ^webUI;
|
||||
std::vector <appmap> *appItems = new std::vector <appmap> ();
|
||||
System::Collections::Generic::Dictionary <String ^, Delegate ^> ^jsFunctionHandlers;
|
||||
public:
|
||||
AppWindow ()
|
||||
{
|
||||
this->Visible = false;
|
||||
this->DoubleBuffered = true;
|
||||
jsFunctionHandlers = gcnew System::Collections::Generic::Dictionary <String ^, Delegate ^> ();
|
||||
this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::None;
|
||||
this->ShowInTaskbar = false;
|
||||
this->TopMost = true;
|
||||
this->Size = System::Drawing::Size (392 * dDpi, 494 * dDpi);
|
||||
if (IsWindows10AndLater ()) this->MinimumSize = System::Drawing::Size (392 * dDpi, 226 * dDpi);
|
||||
else this->MinimumSize = System::Drawing::Size (392 * dDpi, 129 * dDpi);
|
||||
if (IsWindows10AndLater ()) this->MaximumSize = System::Drawing::Size (392 * dDpi, 522 * dDpi);
|
||||
else this->MaximumSize = System::Drawing::Size (368 * dDpi, 394 * dDpi);
|
||||
this->Text = rcString (APPLIST_WINTITLE);
|
||||
webUI = gcnew System::Windows::Forms::WebBrowser ();
|
||||
webUI->Dock = DockStyle::Fill;
|
||||
webUI->Visible = false;
|
||||
this->Controls->Add (webUI);
|
||||
String ^rootDir = System::IO::Path::GetDirectoryName (System::Windows::Forms::Application::ExecutablePath);
|
||||
String ^htmlFilePath = System::IO::Path::Combine (rootDir, "HTML\\Libs\\AppList.html");
|
||||
if (IsIeVersion10 ()) htmlFilePath = System::IO::Path::Combine (rootDir, "HTML\\Libs\\AppListIE10.html"); // IE10 (Win8) 特供
|
||||
if (IsWindows10AndLater ()) htmlFilePath = System::IO::Path::Combine (rootDir, "HTML\\Libs\\AppListWin10.html"); // Windows 10 及以上版本的风格
|
||||
webUI->Navigate (htmlFilePath);
|
||||
webUI->ObjectForScripting = this;
|
||||
this->webUI->IsWebBrowserContextMenuEnabled = false;
|
||||
webUI->DocumentCompleted += gcnew WebBrowserDocumentCompletedEventHandler (this, &AppWindow::OnDocumentCompleted);
|
||||
this->StartPosition = FormStartPosition::CenterScreen;
|
||||
this->Deactivate += gcnew EventHandler (this, &AppWindow::eventOnDeactivate);
|
||||
}
|
||||
void OnDocumentCompleted (Object ^sender, WebBrowserDocumentCompletedEventArgs ^e)
|
||||
{
|
||||
this->CallJSFunction ("SetHighDpiMode", gcnew array <Object ^> { 2 });
|
||||
CallJSFunction ("SetText", gcnew array <Object ^> {
|
||||
"span-title",
|
||||
rcString (APPLIST_TITLE)
|
||||
});
|
||||
CallJSFunction ("SetText", gcnew array <Object ^> {
|
||||
"button-cancel-window",
|
||||
rcString (APPLIST_BUTTON_CANCEL)
|
||||
});
|
||||
Thread ^thread = gcnew Thread (gcnew ThreadStart (this, &AppWindow::InvokeRefreshAppItems));
|
||||
thread->Start ();
|
||||
webUI->Visible = true; // **加载完成后显示 webUI**
|
||||
this->Visible = true;
|
||||
}
|
||||
void SendAppData (std::vector <appmap> apps)
|
||||
{
|
||||
if (appItems) delete appItems;
|
||||
appItems = nullptr;
|
||||
appItems = new std::vector <appmap> ();
|
||||
for (auto it : apps)
|
||||
{
|
||||
appItems->push_back (it);
|
||||
}
|
||||
this->InvokeRefreshAppItems ();
|
||||
}
|
||||
void eventLaunchApp (String ^appModelUserId)
|
||||
{
|
||||
taskLaunchApp (appModelUserId);
|
||||
}
|
||||
void taskLaunchApp (Object ^parameter)
|
||||
{
|
||||
String^ aMUId = safe_cast <String ^> (parameter);
|
||||
DWORD dwPId = 0;
|
||||
LaunchApp ((marshal_as <std::wstring> (aMUId)).c_str (), &dwPId);
|
||||
if (this->InvokeRequired)
|
||||
{
|
||||
if (this->IsHandleCreated) this->Invoke (gcnew Action (this, &AppWindow::Close));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this->IsHandleCreated) this->Close ();
|
||||
}
|
||||
}
|
||||
void eventCancelWindow ()
|
||||
{
|
||||
if (this->IsHandleCreated) this->Close ();
|
||||
}
|
||||
void eventOnDeactivate (Object ^sender, EventArgs ^e)
|
||||
{
|
||||
if (this->IsHandleCreated) this->Close ();
|
||||
}
|
||||
~AppWindow ()
|
||||
{
|
||||
if (appItems) delete appItems;
|
||||
appItems = nullptr;
|
||||
}
|
||||
private:
|
||||
Object ^CallJSFunction (String ^functionName, ... array<Object^> ^args)
|
||||
{
|
||||
if (webUI->Document != nullptr)
|
||||
{
|
||||
try
|
||||
{
|
||||
return webUI->Document->InvokeScript (functionName, args);
|
||||
}
|
||||
catch (Exception^ ex)
|
||||
{
|
||||
MessageBox::Show ("Error calling JavaScript function: " + ex->Message);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
void InvokeRefreshAppItems ()
|
||||
{
|
||||
if (this->InvokeRequired)
|
||||
{
|
||||
this->Invoke (gcnew Action (this, &AppWindow::RefreshAppItems));
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshAppItems ();
|
||||
}
|
||||
}
|
||||
void RefreshAppItems ()
|
||||
{
|
||||
CallJSFunction ("ClearListItems", gcnew array <Object ^> { });
|
||||
bool isWin10 = IsWindows10AndLater ();
|
||||
size_t height = ((appItems->size ()) * (isWin10 ? 50 : 60) * dDpi) + (isWin10 ? 206 : 120) * dDpi;
|
||||
if (height < (isWin10 ? 522 : 394) * dDpi) this->Height = height;
|
||||
else this->Height = 522 * dDpi;
|
||||
this->Left = (GetScreenWidth () - this->Width) / 2;
|
||||
this->Top = (GetScreenHeight () - this->Height) / 2;
|
||||
for (auto it : *appItems)
|
||||
{
|
||||
String ^colorStr = gcnew String (it [L"BackgroundColor"].c_str ());
|
||||
if (LabelEqual (it [L"BackgroundColor"], L"transparent")) colorStr = ColorToHtml (GetAeroColor ());
|
||||
CallJSFunction ("AddListItems", gcnew array <Object ^> {
|
||||
gcnew String (it [L"AppUserModelID"].c_str ()),
|
||||
gcnew String (it [L"Square44x44LogoBase64"].c_str ()),
|
||||
colorStr,
|
||||
gcnew String (it [L"DisplayName"].c_str ())
|
||||
});
|
||||
}
|
||||
}
|
||||
protected:
|
||||
virtual void OnHandleCreated (EventArgs^ e) override
|
||||
{
|
||||
Form::OnHandleCreated (e);
|
||||
if (Environment::OSVersion->Version->Major >= 6)
|
||||
{
|
||||
MARGINS margins = {0, 0, 0, 0};
|
||||
HRESULT hr = DwmExtendFrameIntoClientArea ((HWND)this->Handle.ToPointer (), &margins);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public ref class MainWnd: public Form
|
||||
{
|
||||
private:
|
||||
WebBrowser ^webUI;
|
||||
System::Windows::Forms::WebBrowser ^webUI;
|
||||
int page;
|
||||
System::Collections::Generic::Dictionary <String ^, Delegate ^> ^jsFunctionHandlers;
|
||||
System::Windows::Forms::Timer^ fadeTimer;
|
||||
public:
|
||||
MainWnd (): page (-1)
|
||||
{
|
||||
jsFunctionHandlers = gcnew System::Collections::Generic::Dictionary <String ^, Delegate ^> ();
|
||||
this->Opacity = 0.0;
|
||||
initWnd ();
|
||||
}
|
||||
private:
|
||||
void initWnd ()
|
||||
{
|
||||
this->Visible = false;
|
||||
this->webUI = gcnew WebBrowser ();
|
||||
this->DoubleBuffered = true;
|
||||
this->BackColor = System::Drawing::Color::FromArgb (0, 120, 215);
|
||||
SetWebBrowserEmulation ();
|
||||
this->webUI = gcnew System::Windows::Forms::WebBrowser ();
|
||||
this->webUI->BackColor = this->BackColor;
|
||||
this->SuspendLayout ();
|
||||
this->webUI->Dock = DockStyle::Fill;
|
||||
this->webUI->DocumentCompleted += gcnew WebBrowserDocumentCompletedEventHandler (this, &MainWnd::eventOnDocumentCompleted);
|
||||
this->webUI->IsWebBrowserContextMenuEnabled = false;
|
||||
this->webUI->PreviewKeyDown += gcnew System::Windows::Forms::PreviewKeyDownEventHandler (this, &MainWnd::eventOnPreviewKeyDown_WebBrowser);
|
||||
this->Controls->Add (this->webUI);
|
||||
HICON tempIco = LoadRCIcon (ICON_TASKBAR);
|
||||
if (tempIco)
|
||||
@@ -358,10 +537,10 @@ public ref class MainWnd: public Form
|
||||
}
|
||||
else
|
||||
{
|
||||
wid = m_initConfig.readUIntValue (L"Settings", L"SavePosWidth",
|
||||
wid = m_initConfig.readUIntValue (L"Settings", L"PosWidth",
|
||||
(unsigned)_wtol (GetRCString_cpp (INITWIDTH).c_str ())
|
||||
);
|
||||
hei = m_initConfig.readUIntValue (L"Settings", L"SavePosHeight",
|
||||
hei = m_initConfig.readUIntValue (L"Settings", L"PosHeight",
|
||||
(unsigned)_wtol (GetRCString_cpp (INITHEIGHT).c_str ())
|
||||
);
|
||||
}
|
||||
@@ -370,21 +549,22 @@ public ref class MainWnd: public Form
|
||||
m_initConfig.readUIntValue (L"Settings", L"MinPosHeight", (unsigned)_wtol (GetRCString_cpp (LIMITHEIGHT).c_str ()))
|
||||
);
|
||||
this->WindowState = (System::Windows::Forms::FormWindowState)m_initConfig.readIntValue (L"Settings", L"WindowPos", (int)System::Windows::Forms::FormWindowState::Normal);
|
||||
this->ClientSize = System::Drawing::Size (wid, hei);
|
||||
this->ClientSize = System::Drawing::Size (wid * dDpi, hei * dDpi);
|
||||
this->Text = GetRCString (WIN_TITLE);
|
||||
this->ResumeLayout (false);
|
||||
webUI->ObjectForScripting = this;
|
||||
this->webUI->DocumentCompleted += gcnew WebBrowserDocumentCompletedEventHandler (this, &MainWnd::eventOnDocumentCompleted);
|
||||
this->webUI->PreviewKeyDown += gcnew System::Windows::Forms::PreviewKeyDownEventHandler (this, &MainWnd::eventOnPreviewKeyDown_WebBrowser);
|
||||
this->Resize += gcnew System::EventHandler (this, &MainWnd::eventOnResize);
|
||||
this->Load += gcnew EventHandler (this, &MainWnd::eventOnCreate);
|
||||
this->ResizeEnd += gcnew EventHandler (this, &MainWnd::eventOnResizeEnd);
|
||||
this->ResumeLayout (false);
|
||||
this->Resize += gcnew System::EventHandler (this, &MainWnd::eventOnResize);
|
||||
}
|
||||
void eventOnCreate (System::Object ^sender, System::EventArgs ^e)
|
||||
{
|
||||
SetWebBrowserEmulation ();
|
||||
String ^rootDir = System::IO::Path::GetDirectoryName (System::Windows::Forms::Application::ExecutablePath);
|
||||
String ^htmlFilePath = System::IO::Path::Combine (rootDir, "HTML\\Index.html");
|
||||
if (IsIeVersion10 ()) htmlFilePath = System::IO::Path::Combine (rootDir, "HTML\\IndexIE10.html"); // IE10 (Win8) 特供
|
||||
webUI->Navigate (htmlFilePath);
|
||||
webUI->ObjectForScripting = this;
|
||||
}
|
||||
void eventOnPreviewKeyDown_WebBrowser (System::Object ^sender, System::Windows::Forms::PreviewKeyDownEventArgs ^e)
|
||||
{
|
||||
@@ -395,9 +575,25 @@ public ref class MainWnd: public Form
|
||||
{
|
||||
if (e->Url->ToString () == webUI->Url->ToString ())
|
||||
{
|
||||
eventOnPageLoad ();
|
||||
this->CallJSFunction ("SetHighDpiMode", gcnew array <Object ^> { 2 });
|
||||
this->CallJSFunction ("SetPageZoom", gcnew array <Object ^> { dDpi });
|
||||
this->Visible = true;
|
||||
fadeTimer = gcnew System::Windows::Forms::Timer ();
|
||||
fadeTimer->Interval = 5;
|
||||
fadeTimer->Tick += gcnew EventHandler (this, &MainWnd::fadeTimer_Tick);
|
||||
fadeTimer->Start ();
|
||||
this->setLaunchWhenReadyJS (m_initConfig.readBoolValue (L"Settings", L"LaunchWhenReady", true));
|
||||
Thread ^thread = gcnew Thread (gcnew ThreadStart (this, &MainWnd::taskReadFile));
|
||||
thread->Start ();
|
||||
Thread ^thread2 = gcnew Thread (gcnew ThreadStart (this, &MainWnd::taskCountDarkMode));
|
||||
thread2->Start ();
|
||||
}
|
||||
}
|
||||
void fadeTimer_Tick (Object^ sender, EventArgs^ e)
|
||||
{
|
||||
if (this->Opacity < 1.0) this->Opacity += 0.2;
|
||||
else fadeTimer->Stop ();
|
||||
}
|
||||
void eventOnResizeEnd (Object ^sender, EventArgs ^e)
|
||||
{
|
||||
if (this->WindowState == FormWindowState::Maximized)
|
||||
@@ -409,7 +605,7 @@ public ref class MainWnd: public Form
|
||||
this->changeMaxDisplayPicJS (false);
|
||||
}
|
||||
}
|
||||
void eventOnResize (Object ^sender, EventArgs ^e)
|
||||
void adjustWhenResize ()
|
||||
{
|
||||
if (this->WindowState == FormWindowState::Maximized)
|
||||
{
|
||||
@@ -422,20 +618,44 @@ public ref class MainWnd: public Form
|
||||
this->changeMaxDisplayPicJS (false);
|
||||
if (m_initConfig.readBoolValue (L"Settings", L"SavePosBeforeClosing"))
|
||||
{
|
||||
m_initConfig.writeUIntValue (L"Settings", L"SavePosWidth", this->Width);
|
||||
m_initConfig.writeUIntValue (L"Settings", L"SavePosHeight", this->Height);
|
||||
System::Drawing::Size ^client = this->ClientSize;
|
||||
if (dDpi == 1)
|
||||
{
|
||||
m_initConfig.writeUIntValue (L"Settings", L"SavePosWidth", client->Width);
|
||||
m_initConfig.writeUIntValue (L"Settings", L"SavePosHeight", client->Height);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_initConfig.writeUIntValue (L"Settings", L"SavePosWidth", client->Width / dDpi);
|
||||
m_initConfig.writeUIntValue (L"Settings", L"SavePosHeight", client->Height / dDpi);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this->webUI->IsHandleCreated)
|
||||
{
|
||||
UINT resID = 0;
|
||||
switch (page)
|
||||
{
|
||||
case 2: resID = PAGE_1_TITLE; break;
|
||||
case 3: resID = PAGE_2_TITLE; break;
|
||||
case 4: resID = PAGE_4_TITLE; break;
|
||||
case 5: resID = PAGE_5_TITLE; break;
|
||||
}
|
||||
if (resID)
|
||||
{
|
||||
std::wstring title = m_pkgInfo.getPropertyName ();
|
||||
std::wstring temp = StrPrintFormatW (GetRCString_cpp (resID).c_str (), L" ");
|
||||
std::wstring temp1 = temp + title;
|
||||
size_t reduce = getTextOmitAdviceJS (gcnew String ("caption-title"), gcnew String (temp1.c_str ()), (size_t)2);
|
||||
std::wstring sub = title.substr (0, title.length () - reduce) + (reduce > 3 ? L"..." : L"");
|
||||
setTextJS ("caption-title", gcnew String (StrPrintFormatW (GetRCString_cpp (resID).c_str (), sub.c_str ()).c_str ()));
|
||||
// this->CallJSFunction ("adjustTextareaHeight", gcnew array <Object ^> {});
|
||||
}
|
||||
}
|
||||
}
|
||||
void eventOnPageLoad ()
|
||||
void eventOnResize (Object ^sender, EventArgs ^e)
|
||||
{
|
||||
this->Visible = true;
|
||||
this->setLaunchWhenReadyJS (m_initConfig.readBoolValue (L"Settings", L"LaunchWhenReady", true));
|
||||
if (IsIeVersion10 ()) hideFrameJS (false);
|
||||
Thread ^thread = gcnew Thread (gcnew ThreadStart (this, &MainWnd::taskReadFile));
|
||||
thread->Start ();
|
||||
Thread ^thread2 = gcnew Thread (gcnew ThreadStart (this, &MainWnd::taskCountDarkMode));
|
||||
thread2->Start ();
|
||||
this->adjustWhenResize ();
|
||||
}
|
||||
void eventOnPress_button1 ()
|
||||
{
|
||||
@@ -467,6 +687,7 @@ public ref class MainWnd: public Form
|
||||
thread->SetApartmentState (ApartmentState::STA);
|
||||
thread->Start ();
|
||||
} break;
|
||||
case 3: break;
|
||||
case 4:
|
||||
{
|
||||
// this->setButtonDisabledJS (true);
|
||||
@@ -480,6 +701,17 @@ public ref class MainWnd: public Form
|
||||
m_pkgInfo.getApplicationUserModelIDs (ids);
|
||||
DWORD dwPId = 0;
|
||||
if (ids.size () == 1) LaunchApp (ids [0].c_str (), &dwPId);
|
||||
else if (ids.size () > 1)
|
||||
{
|
||||
AppWindow ^appWnd = gcnew AppWindow ();
|
||||
std::vector <appmap> apps;
|
||||
m_pkgInfo.getApplications (apps);
|
||||
appWnd->SendAppData (apps);
|
||||
appWnd->StartPosition = FormStartPosition::CenterScreen;
|
||||
//appWnd->Owner = this;
|
||||
appWnd->Show ();
|
||||
//appWnd->ShowDialog ();
|
||||
}
|
||||
}
|
||||
// this->setButtonDisabledJS (false);
|
||||
} break;
|
||||
@@ -489,6 +721,17 @@ public ref class MainWnd: public Form
|
||||
} break;
|
||||
}
|
||||
}
|
||||
void invokeEventOnPress_button1 ()
|
||||
{
|
||||
if (this->InvokeRequired)
|
||||
{
|
||||
this->Invoke (gcnew Action (this, &MainWnd::eventOnPress_button1));
|
||||
}
|
||||
else
|
||||
{
|
||||
eventOnPress_button1 ();
|
||||
}
|
||||
}
|
||||
void eventOnPress_button2 ()
|
||||
{
|
||||
|
||||
@@ -694,6 +937,21 @@ public ref class MainWnd: public Form
|
||||
setProgressTextJS (content);
|
||||
}
|
||||
}
|
||||
void adjustTextareaHeightJS ()
|
||||
{
|
||||
this->CallJSFunction ("adjustTextareaHeight", gcnew array <Object ^> {});
|
||||
}
|
||||
void invokeAdjustTextareaHeight ()
|
||||
{
|
||||
if (this->InvokeRequired)
|
||||
{
|
||||
this->Invoke (gcnew Action (this, &MainWnd::adjustTextareaHeightJS));
|
||||
}
|
||||
else
|
||||
{
|
||||
adjustTextareaHeightJS ();
|
||||
}
|
||||
}
|
||||
void setPage (int serial)
|
||||
{
|
||||
switch (serial)
|
||||
@@ -708,8 +966,10 @@ public ref class MainWnd: public Form
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
std::wstring title = m_pkgInfo.getPropertyName (), titleF = StrPrintFormatW (GetRCString_cpp (PAGE_1_TITLE).c_str (), title.c_str ());
|
||||
size_t reduce = getTextOmitAdviceJS (gcnew String ("caption-title"), gcnew String (titleF.c_str ()), (size_t)2);
|
||||
std::wstring title = m_pkgInfo.getPropertyName ();
|
||||
std::wstring temp = StrPrintFormatW (GetRCString_cpp (PAGE_1_TITLE).c_str (), L" ");
|
||||
std::wstring temp1 = temp + title;
|
||||
size_t reduce = getTextOmitAdviceJS (gcnew String ("caption-title"), gcnew String (temp1.c_str ()), (size_t)2);
|
||||
std::wstring sub = title.substr (0, title.length () - reduce) + (reduce > 3 ? L"..." : L"");
|
||||
setTextJS ("caption-title", gcnew String (StrPrintFormatW (GetRCString_cpp (PAGE_1_TITLE).c_str (), sub.c_str ()).c_str ()));
|
||||
}
|
||||
@@ -786,16 +1046,20 @@ public ref class MainWnd: public Form
|
||||
case 3:
|
||||
{
|
||||
invokeSetProgressText (rcString (PAGE_2_LOADING));
|
||||
std::wstring title = m_pkgInfo.getPropertyName (), titleF = StrPrintFormatW (GetRCString_cpp (PAGE_2_TITLE).c_str (), title.c_str ());
|
||||
size_t reduce = getTextOmitAdviceJS (gcnew String ("caption-title"), gcnew String (titleF.c_str ()), (size_t)2);
|
||||
std::wstring title = m_pkgInfo.getPropertyName ();
|
||||
std::wstring temp = StrPrintFormatW (GetRCString_cpp (PAGE_2_TITLE).c_str (), L" ");
|
||||
std::wstring temp1 = temp + title;
|
||||
size_t reduce = getTextOmitAdviceJS (gcnew String ("caption-title"), gcnew String (temp1.c_str ()), (size_t)2);
|
||||
std::wstring sub = title.substr (0, title.length () - reduce) + (reduce > 3 ? L"..." : L"");
|
||||
setTextJS ("caption-title", gcnew String (StrPrintFormatW (GetRCString_cpp (PAGE_2_TITLE).c_str (), sub.c_str ()).c_str ()));
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
std::wstring title = m_pkgInfo.getPropertyName (), titleF = StrPrintFormatW (GetRCString_cpp (PAGE_4_TITLE).c_str (), title.c_str ());
|
||||
size_t reduce = getTextOmitAdviceJS (gcnew String ("caption-title"), gcnew String (titleF.c_str ()), (size_t)2);
|
||||
std::wstring title = m_pkgInfo.getPropertyName ();
|
||||
std::wstring temp = StrPrintFormatW (GetRCString_cpp (PAGE_4_TITLE).c_str (), L" ");
|
||||
std::wstring temp1 = temp + title;
|
||||
size_t reduce = getTextOmitAdviceJS (gcnew String ("caption-title"), gcnew String (temp1.c_str ()), (size_t)2);
|
||||
std::wstring sub = title.substr (0, title.length () - reduce) + (reduce > 3 ? L"..." : L"");
|
||||
setTextJS ("caption-title", gcnew String (StrPrintFormatW (GetRCString_cpp (PAGE_4_TITLE).c_str (), sub.c_str ()).c_str ()));
|
||||
}
|
||||
@@ -815,8 +1079,10 @@ public ref class MainWnd: public Form
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
std::wstring title = m_pkgInfo.getPropertyName (), titleF = StrPrintFormatW (GetRCString_cpp (PAGE_5_TITLE).c_str (), title.c_str ());
|
||||
size_t reduce = getTextOmitAdviceJS (gcnew String ("caption-title"), gcnew String (titleF.c_str ()), (size_t)2);
|
||||
std::wstring title = m_pkgInfo.getPropertyName ();
|
||||
std::wstring temp = StrPrintFormatW (GetRCString_cpp (PAGE_5_TITLE).c_str (), L" ");
|
||||
std::wstring temp1 = temp + title;
|
||||
size_t reduce = getTextOmitAdviceJS (gcnew String ("caption-title"), gcnew String (temp1.c_str ()), (size_t)2);
|
||||
std::wstring sub = title.substr (0, title.length () - reduce) + (reduce > 3 ? L"..." : L"");
|
||||
setTextJS ("caption-title", gcnew String (StrPrintFormatW (GetRCString_cpp (PAGE_5_TITLE).c_str (), sub.c_str ()).c_str ()));
|
||||
if (GetLastErrorDetailTextLength ()) setTextJS ("caption-more-info", gcnew String (GetLastErrorDetailText ()));
|
||||
@@ -826,23 +1092,32 @@ public ref class MainWnd: public Form
|
||||
setTextJS ("button-serial-1", rcString (BUTTON_5_SER1));
|
||||
}
|
||||
setPageJS (serial);
|
||||
setPicBoxVisibilityJS (false);
|
||||
if (serial > 1)
|
||||
{
|
||||
std::string res = m_pkgInfo.getPropertyLogoBase64 ();
|
||||
if (!res.empty () && res.length () > 0)
|
||||
if (serial == 2)
|
||||
{
|
||||
std::string b64logo = res;
|
||||
// MessageBox::Show (gcnew String ((std::string ("Base 64 String: ") + b64logo).c_str ()));
|
||||
this->setStoreLogoJS (gcnew String (res.c_str ()));
|
||||
setPicBoxVisibilityJS (true);
|
||||
std::string res = m_pkgInfo.getPropertyLogoBase64 ();
|
||||
if (m_pkgInfo.getPropertyLogoIStream () && !res.empty () && res.length () > 10)
|
||||
{
|
||||
std::string b64logo = res;
|
||||
// MessageBox::Show (gcnew String ((std::string ("Base 64 String: ") + b64logo).c_str ()));
|
||||
this->setStoreLogoJS (gcnew String (res.c_str ()));
|
||||
setPicBoxVisibilityJS (true);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->setStoreLogoJS ("./Libs/Images/StoreLogo.png");
|
||||
setPicBoxVisibilityJS (false);
|
||||
}
|
||||
}
|
||||
else setPicBoxVisibilityJS (false);
|
||||
}
|
||||
else
|
||||
{
|
||||
setPicBoxVisibilityJS (false);
|
||||
}
|
||||
page = serial;
|
||||
this->adjustWhenResize ();
|
||||
}
|
||||
void invokeSetPage (int page)
|
||||
{
|
||||
@@ -866,6 +1141,17 @@ public ref class MainWnd: public Form
|
||||
setLogoBackgroundColorJS (color);
|
||||
}
|
||||
}
|
||||
void invokeSetColor (System::Drawing::Color ^color)
|
||||
{
|
||||
if (this->InvokeRequired)
|
||||
{
|
||||
this->Invoke (gcnew Action <String ^> (this, &MainWnd::setLogoBackgroundColorJS), ColorToHtml (*color));
|
||||
}
|
||||
else
|
||||
{
|
||||
setLogoBackgroundColorJS (color);
|
||||
}
|
||||
}
|
||||
void setTaskbarProgress (int progress)
|
||||
{
|
||||
IntPtr hwnd = this->Handle;
|
||||
@@ -879,6 +1165,17 @@ public ref class MainWnd: public Form
|
||||
pTaskbarList->Release ();
|
||||
}
|
||||
}
|
||||
void invokeSetTaskbarProgress (int value)
|
||||
{
|
||||
if (this->InvokeRequired)
|
||||
{
|
||||
this->Invoke (gcnew Action <int> (this, &MainWnd::setTaskbarProgress), value);
|
||||
}
|
||||
else
|
||||
{
|
||||
setTaskbarProgress (value);
|
||||
}
|
||||
}
|
||||
void clearTaskbarProgress ()
|
||||
{
|
||||
IntPtr hwnd = this->Handle;
|
||||
@@ -894,6 +1191,17 @@ public ref class MainWnd: public Form
|
||||
pTaskbarList->Release ();
|
||||
}
|
||||
}
|
||||
void invokeClearTaskbarProgress ()
|
||||
{
|
||||
if (this->InvokeRequired)
|
||||
{
|
||||
this->Invoke (gcnew Action (this, &MainWnd::clearTaskbarProgress));
|
||||
}
|
||||
else
|
||||
{
|
||||
clearTaskbarProgress ();
|
||||
}
|
||||
}
|
||||
bool invokeGetLaunchWhenReady ()
|
||||
{
|
||||
if (this->InvokeRequired)
|
||||
@@ -918,8 +1226,10 @@ public ref class MainWnd: public Form
|
||||
// if (page < 0) invokeSetPage (2);
|
||||
if (color.size () > 0)
|
||||
{
|
||||
if (LabelEqual (color [0].c_str (), L"transparent")) invokeSetColor (GetAeroColor ());
|
||||
invokeSetColor (gcnew String (color [0].c_str ()));
|
||||
}
|
||||
else invokeSetColor (GetAeroColor ());
|
||||
invokeSetPage (2);
|
||||
if (m_silentMode)
|
||||
{
|
||||
@@ -936,14 +1246,28 @@ public ref class MainWnd: public Form
|
||||
if (m_silentMode)
|
||||
{
|
||||
// 在此版本中,在静默模式下打开无效的包后会自动关闭窗口结束程序。
|
||||
this->Close ();
|
||||
while (!this->IsHandleCreated) {};
|
||||
if (this->IsHandleCreated)
|
||||
{
|
||||
if (this->InvokeRequired)
|
||||
{
|
||||
this->Invoke (gcnew Action (this, &MainWnd::Close));
|
||||
}
|
||||
else
|
||||
{
|
||||
this->Close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
invokeSetPage (1);
|
||||
}
|
||||
}
|
||||
this->invokeSetDarkMode (IsAppInDarkMode ());
|
||||
if (this->IsHandleCreated)
|
||||
{
|
||||
this->invokeSetDarkMode (IsAppInDarkMode ());
|
||||
}
|
||||
EmptyWorkingSet ((HANDLE)-1);
|
||||
}
|
||||
void taskInstallPackage ()
|
||||
@@ -963,13 +1287,12 @@ public ref class MainWnd: public Form
|
||||
invokeSetProgressText (rcString (PAGE_2_INSTALL));
|
||||
InstallStatus status = AddPackageFromPath (pkgPath.c_str (), &ProgressCallback);
|
||||
// MessageBeep (MB_OK);
|
||||
std::wstring title (L"");
|
||||
if (status == InstallStatus::Success)
|
||||
{
|
||||
invokeSetPage (4);
|
||||
if (this->invokeGetLaunchWhenReady ())
|
||||
{
|
||||
if (reader.isPackageApplication ()) this->eventOnPress_button1 (); // 用于启用 APP
|
||||
}
|
||||
title = StrPrintFormatW (GetRCString_cpp (PAGE_4_TITLE).c_str (), m_pkgInfo.getPropertyName ().c_str ());
|
||||
if (m_pkgInfo.applications.size () == 1 && !m_silentMode && this->invokeGetLaunchWhenReady ()) this->eventOnPress_button1 (); // 用于启用 APP
|
||||
Thread ^closeThread = gcnew Thread (gcnew ThreadStart (this, &MainWnd::taskCountCancel));
|
||||
closeThread->IsBackground = true;
|
||||
closeThread->Start ();
|
||||
@@ -977,6 +1300,7 @@ public ref class MainWnd: public Form
|
||||
else
|
||||
{
|
||||
invokeSetPage (5);
|
||||
title = StrPrintFormatW (GetRCString_cpp (PAGE_5_TITLE).c_str (), m_pkgInfo.getPropertyName ().c_str ());
|
||||
if (m_silentMode)
|
||||
{
|
||||
Thread ^closeThread = gcnew Thread (gcnew ThreadStart (this, &MainWnd::taskCountCancel));
|
||||
@@ -984,11 +1308,10 @@ public ref class MainWnd: public Form
|
||||
closeThread->Start ();
|
||||
}
|
||||
}
|
||||
this->clearTaskbarProgress ();
|
||||
std::wstring title = StrPrintFormatW (GetRCString_cpp (PAGE_4_TITLE).c_str (), m_pkgInfo.getPropertyName ().c_str ());
|
||||
this->invokeClearTaskbarProgress ();
|
||||
std::wstring text (L"");
|
||||
if (GetLastErrorDetailTextLength ()) text += GetLastErrorDetailText ();
|
||||
bool res = CreateToastNotification (m_idenName, title.c_str (), text.c_str (), NULL, m_pkgInfo.getPropertyLogoIStream ());
|
||||
bool res = CreateToastNotification (m_idenName, title.c_str (), text.c_str (), &ToastPressCallback, m_pkgInfo.getPropertyLogoIStream ());
|
||||
#ifdef _DEBUG
|
||||
//MessageBox::Show (res ? "Toast has create! " : "Toast created failed! ");
|
||||
#endif
|
||||
@@ -996,7 +1319,12 @@ public ref class MainWnd: public Form
|
||||
}
|
||||
void taskCountCancel ()
|
||||
{
|
||||
for (char cnt = 0; cnt < 100; cnt ++)
|
||||
int size = (int)m_pkgInfo.applications.size ();
|
||||
if (size < 1) size = 1;
|
||||
if (size > 5) size = 5;
|
||||
if (m_silentMode) size = 1; // 不耽误时间
|
||||
int tcnt = size * 100;
|
||||
for (int cnt = 0; cnt < tcnt; cnt ++)
|
||||
{
|
||||
if (!this->IsHandleCreated) break;
|
||||
Thread::Sleep (50);
|
||||
@@ -1033,7 +1361,7 @@ public ref class MainWnd: public Form
|
||||
}
|
||||
public:
|
||||
[STAThread]
|
||||
void Button1_PressEvent () { eventOnPress_button1 (); }
|
||||
void Button1_PressEvent () { invokeEventOnPress_button1 (); }
|
||||
[STAThread]
|
||||
void Button2_PressEvent () { eventOnPress_button2 (); }
|
||||
[STAThread]
|
||||
@@ -1056,7 +1384,17 @@ public ref class MainWnd: public Form
|
||||
StrPrintFormatW (GetRCString_cpp (PAGE_2_INSTALLING).c_str (), (int)value).c_str ()
|
||||
)
|
||||
);
|
||||
this->setTaskbarProgress ((unsigned)value);
|
||||
this->invokeSetTaskbarProgress ((unsigned)value);
|
||||
}
|
||||
bool launchInstalledApp ()
|
||||
{
|
||||
if (page != 4) return false;
|
||||
else
|
||||
{
|
||||
if (!reader.isPackageApplication ()) return false;
|
||||
}
|
||||
this->Button1_PressEvent ();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1080,7 +1418,8 @@ std::vector <CMDARGUMENT> cmdargs =
|
||||
{{L"", L"/", L"-"}, {L"CREATESHORTCUT", L"SHORTCUT", L"CREATELNK"}, {}, 8},
|
||||
{{L"", L"/", L"-"}, {L"DELETESHORTCUT", L"DELSHORTCUT", L"DELETELNK"}, {}, 9},
|
||||
{{L"", L"/", L"-"}, {L"DEVTOOL", L"DEVTOOLS", L"DEVMODE", L"DEVELOP"}, {}, 10},
|
||||
{{L"", L"/", L"-"}, {L"USEEPROGRAM", L"EPROGRAM", L"ESUPPORT", L"USEE"}, {}, 11}
|
||||
{{L"", L"/", L"-"}, {L"USEEPROGRAM", L"EPROGRAM", L"ESUPPORT", L"USEE"}, {}, 11},
|
||||
{{L"", L"/", L"-"}, {L"CONSOLE", L"CONSOLECLIENT"}, {}, 12},
|
||||
};
|
||||
|
||||
// 编号为大于 0 的数,失败返回非正数
|
||||
@@ -1152,9 +1491,9 @@ bool ReadCommand (int argc, LPWSTR *argv)
|
||||
{
|
||||
std::vector <std::wstring> vecObjSwFiles;
|
||||
bool bWin32Wnd = false, bSilent = false, bVerySilent = false,
|
||||
bUseConsole = false, bUseNewFrame = false, bDisplayHelp = false,
|
||||
bUseCmd = false, bUseNewFrame = false, bDisplayHelp = false,
|
||||
bCreateLnk = false, bDestroyLnk = false, bDevTool = false,
|
||||
bUseEProgream = false;
|
||||
bUseEProgream = false, bConsole = false;
|
||||
for (size_t cnt = 0; cnt < (size_t)argc; cnt ++)
|
||||
{
|
||||
int res = GetCmdArgSerial (argv [cnt]);
|
||||
@@ -1165,7 +1504,7 @@ bool ReadCommand (int argc, LPWSTR *argv)
|
||||
case 1: bUseNewFrame = false; break;
|
||||
case 2: bSilent = true; break;
|
||||
case 3: bVerySilent = true; break;
|
||||
case 4: bUseConsole = true; break;
|
||||
case 4: bUseCmd = true; break;
|
||||
case 5: bDisplayHelp = true; break;
|
||||
case 6: bUseNewFrame = true; break;
|
||||
case 7: bWin32Wnd = true; break;
|
||||
@@ -1173,6 +1512,7 @@ bool ReadCommand (int argc, LPWSTR *argv)
|
||||
case 9: bDestroyLnk = true; break;
|
||||
case 10: bDevTool = true; break;
|
||||
case 11: bUseEProgream = true; break;
|
||||
case 12: bConsole = true; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1188,9 +1528,14 @@ bool ReadCommand (int argc, LPWSTR *argv)
|
||||
MessageBox::Show (
|
||||
rcString (CLHELP_1) +
|
||||
rcString (CLHELP_2) +
|
||||
rcString (CLHELP_3) +
|
||||
rcString (CLHELP_4) +
|
||||
rcString (CLHELP_5) +
|
||||
rcString (CLHELP_7)
|
||||
rcString (CLHELP_6) +
|
||||
rcString (CLHELP_7) +
|
||||
rcString (CLHELP_8) +
|
||||
rcString (CLHELP_9) +
|
||||
rcString (CLHELP_10)
|
||||
);
|
||||
return false;
|
||||
}
|
||||
@@ -1214,6 +1559,12 @@ bool ReadCommand (int argc, LPWSTR *argv)
|
||||
_itow (WIN_TITLE, resIdStr, 10);
|
||||
desktop.writeUIntValue (L".ShellClassInfo", L"ConfirmFileOp", 0);
|
||||
desktop.writeStringValue (L"LocalizedFileNames", L"App Installer.lnk", std::wstring (L"@") + path + L",-" + resIdStr);
|
||||
_itow (SHORTCUT_SETTINGS, resIdStr, 10);
|
||||
desktop.writeStringValue (L"LocalizedFileNames", L"Settings.lnk", std::wstring (L"@") + path + L",-" + resIdStr);
|
||||
_itow (SHORTCUT_UNINSTALL, resIdStr, 10);
|
||||
desktop.writeStringValue (L"LocalizedFileNames", L"Uninstaller.lnk", std::wstring (L"@") + path + L",-" + resIdStr);
|
||||
_itow (SHORTCUT_UPDATE, resIdStr, 10);
|
||||
desktop.writeStringValue (L"LocalizedFileNames", L"Update.lnk", std::wstring (L"@") + path + L",-" + resIdStr);
|
||||
DWORD attrs = GetFileAttributesW (desktopIni);
|
||||
SetFileAttributesW (desktopIni, attrs | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM);
|
||||
DWORD folderAttrs = GetFileAttributesW (expandedPath);
|
||||
@@ -1256,7 +1607,7 @@ bool ReadCommand (int argc, LPWSTR *argv)
|
||||
else args += L"/DISABLEFRAME ";
|
||||
if (bSilent) args += L"/SILENT ";
|
||||
if (bVerySilent) args += L"/VERYSILENT ";
|
||||
if (bUseConsole) args += L"/NOGUI ";
|
||||
if (bUseCmd) args += L"/NOGUI ";
|
||||
if (bDisplayHelp) args += L"/? ";
|
||||
std::wstring cmdline = L"\"" + exepath + L"\" " + args;
|
||||
{
|
||||
@@ -1281,7 +1632,7 @@ bool ReadCommand (int argc, LPWSTR *argv)
|
||||
else args += L"/DISABLEFRAME ";
|
||||
if (bSilent) args += L"/SILENT ";
|
||||
if (bVerySilent) args += L"/VERYSILENT ";
|
||||
if (bUseConsole) args += L"/NOGUI ";
|
||||
if (bUseCmd) args += L"/NOGUI ";
|
||||
if (bDisplayHelp) args += L"/? ";
|
||||
std::wstring cmdline = L"\"" + exepath + L"\" " + args;
|
||||
{
|
||||
@@ -1296,7 +1647,7 @@ bool ReadCommand (int argc, LPWSTR *argv)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (bUseConsole)
|
||||
else if (bUseCmd)
|
||||
{
|
||||
std::wstring root = EnsureTrailingSlash (GetProgramRootDirectoryW ());
|
||||
std::wstring exepath = root + L"WSAppPkgIns.exe";
|
||||
@@ -1315,6 +1666,25 @@ bool ReadCommand (int argc, LPWSTR *argv)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (bConsole)
|
||||
{
|
||||
std::wstring root = EnsureTrailingSlash (GetProgramRootDirectoryW ());
|
||||
std::wstring exepath = root + L"AppInstallerConsole.exe";
|
||||
std::wstring args = L"";
|
||||
args += L"\"" + pkgPath + L"\" ";
|
||||
std::wstring cmdline = L"\"" + exepath + L"\" " + args;
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if (vecObjSwFiles.size () <= 0)
|
||||
@@ -1328,7 +1698,7 @@ bool ReadCommand (int argc, LPWSTR *argv)
|
||||
else args += L"/DISABLEFRAME ";
|
||||
if (bSilent) args += L"/SILENT ";
|
||||
if (bVerySilent) args += L"/VERYSILENT ";
|
||||
if (bUseConsole) args += L"/NOGUI ";
|
||||
if (bUseCmd) args += L"/NOGUI ";
|
||||
if (bDisplayHelp) args += L"/? ";
|
||||
std::wstring cmdline = L"\"" + exepath + L"\" " + args;
|
||||
{
|
||||
@@ -1352,7 +1722,7 @@ bool ReadCommand (int argc, LPWSTR *argv)
|
||||
else args += L"/DISABLEFRAME ";
|
||||
if (bSilent) args += L"/SILENT ";
|
||||
if (bVerySilent) args += L"/VERYSILENT ";
|
||||
if (bUseConsole) args += L"/NOGUI ";
|
||||
if (bUseCmd) args += L"/NOGUI ";
|
||||
if (bDisplayHelp) args += L"/? ";
|
||||
if (bDevTool) args += L"/DEVTOOL ";
|
||||
std::wstring cmdline = L"\"" + exepath + L"\" " + args;
|
||||
@@ -1368,34 +1738,59 @@ bool ReadCommand (int argc, LPWSTR *argv)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (bUseCmd || bConsole) return false;
|
||||
else return true;
|
||||
}
|
||||
else if (vecObjSwFiles.size () > 1) // 面对多个文件
|
||||
{
|
||||
for (auto it : vecObjSwFiles)
|
||||
if (bConsole)
|
||||
{
|
||||
wchar_t path [MAX_PATH] = {0};
|
||||
if (GetModuleFileNameW (NULL, path, MAX_PATH))
|
||||
{
|
||||
std::wstring args = L"";
|
||||
args += L"\"" + it + L"\" ";
|
||||
if (bUseNewFrame) args += L"/ENABLEFRAME ";
|
||||
else args += L"/DISABLEFRAME ";
|
||||
if (bSilent) args += L"/SILENT ";
|
||||
if (bVerySilent) args += L"/VERYSILENT ";
|
||||
if (bUseConsole) args += L"/NOGUI ";
|
||||
if (bDisplayHelp) args += L"/? ";
|
||||
if (bWin32Wnd) args += L"WIN32WINDOW ";
|
||||
if (bUseEProgream) args += L"/USEEPROGRAM ";
|
||||
std::wstring cmdline = L"\"" + std::wstring (path) + L"\" " + args;
|
||||
std::wstring root = EnsureTrailingSlash (GetProgramRootDirectoryW ());
|
||||
std::wstring exepath = root + L"AppInstallerConsole.exe";
|
||||
std::wstring args = L"";
|
||||
for (auto it : vecObjSwFiles)
|
||||
{
|
||||
STARTUPINFOW si = {sizeof (STARTUPINFOW)};
|
||||
PROCESS_INFORMATION pi = {0};
|
||||
if (CreateProcessW (NULL, (LPWSTR)cmdline.c_str (), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
|
||||
args += L" \"" + it + L"\"";
|
||||
}
|
||||
std::wstring cmdline = L"\"" + exepath + L"\"" + args;
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (auto it : vecObjSwFiles)
|
||||
{
|
||||
wchar_t path [MAX_PATH] = {0};
|
||||
if (GetModuleFileNameW (NULL, path, MAX_PATH))
|
||||
{
|
||||
std::wstring args = L"";
|
||||
args += L"\"" + it + L"\" ";
|
||||
if (bUseNewFrame) args += L"/ENABLEFRAME ";
|
||||
else args += L"/DISABLEFRAME ";
|
||||
if (bSilent) args += L"/SILENT ";
|
||||
if (bVerySilent) args += L"/VERYSILENT ";
|
||||
if (bUseCmd) args += L"/NOGUI ";
|
||||
if (bDisplayHelp) args += L"/? ";
|
||||
if (bWin32Wnd) args += L"WIN32WINDOW ";
|
||||
if (bUseEProgream) args += L"/USEEPROGRAM ";
|
||||
std::wstring cmdline = L"\"" + std::wstring (path) + L"\" " + args;
|
||||
{
|
||||
WaitForSingleObject (pi.hProcess, INFINITE);
|
||||
CloseHandle (pi.hProcess);
|
||||
CloseHandle (pi.hThread);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1423,6 +1818,10 @@ void ProgressCallback (unsigned progress)
|
||||
{
|
||||
mainwndPtr->funcSetProgress (progress);
|
||||
}
|
||||
void ToastPressCallback ()
|
||||
{
|
||||
mainwndPtr->launchInstalledApp ();
|
||||
}
|
||||
|
||||
void OutputDebugStringFormatted (const wchar_t* format, ...)
|
||||
{
|
||||
|
||||
@@ -323,7 +323,8 @@ std::vector <std::wstring> applicationItems =
|
||||
L"DisplayName",
|
||||
L"BackgroundColor",
|
||||
L"ForegroundText",
|
||||
L"ShortName"
|
||||
L"ShortName",
|
||||
L"Square44x44Logo"
|
||||
};
|
||||
typedef std::wstring strlabel, StringLabel;
|
||||
std::wstring StringTrim (const std::wstring &str)
|
||||
@@ -571,7 +572,7 @@ bool AppxReader::isFileReaderAvailable ()
|
||||
bool AppxReader::destroy ()
|
||||
{
|
||||
if (!this->isAvailable ()) return false; // 表示已销毁等
|
||||
this->m_appxReader->Release ();
|
||||
if (this->m_appxReader) this->m_appxReader->Release ();
|
||||
this->m_appxReader = NULL;
|
||||
this->m_filePath = std::wstring (L"");
|
||||
return true;
|
||||
@@ -1145,7 +1146,7 @@ bool BundleReader::isFileReaderAvailable ()
|
||||
bool BundleReader::destroy ()
|
||||
{
|
||||
if (!this->isAvailable ()) return false; // 表示已销毁等
|
||||
this->m_bundleReader->Release ();
|
||||
if (this->m_bundleReader) this->m_bundleReader->Release ();
|
||||
this->m_bundleReader = NULL;
|
||||
this->m_filePath = std::wstring (L"");
|
||||
return true;
|
||||
|
||||
@@ -89,9 +89,40 @@ struct PackageInfomation
|
||||
this->properties.description = reader.getPropertyDescription ();
|
||||
this->properties.publisher = reader.getPropertyPublisher ();
|
||||
}
|
||||
this->properties.logoBase64 = GetLogoBase64FromReader (reader, &this->properties.logoStream);
|
||||
this->properties.logoBase64 = GetLogoBase64FromReader (reader, &this->properties.logoStream, &pri);
|
||||
this->prerequisites.osMinVersion = reader.getPrerequisiteOSMinVersion ();
|
||||
reader.getApplications (this->applications);
|
||||
for (auto &it : this->applications)
|
||||
{
|
||||
for (auto &sit : it)
|
||||
{
|
||||
if (LabelEqual (sit.first, L"AppUserModelID")) continue;
|
||||
else if (LabelEqual (sit.first, L"Id")) continue;
|
||||
else if (LabelEqual (sit.first, L"DisplayName"))
|
||||
{
|
||||
if (isMsResourceLabel (sit.second))
|
||||
{
|
||||
std::wstring temp (L"");
|
||||
temp += pri.findStringValue (sit.second);
|
||||
it [L"DisplayName"] = temp;
|
||||
}
|
||||
}
|
||||
else if (LabelEqual (sit.first, L"ShortName"))
|
||||
{
|
||||
if (isMsResourceLabel (sit.second))
|
||||
{
|
||||
std::wstring temp (L"");
|
||||
temp += pri.findStringValue (sit.second);
|
||||
it [L"ShortName"] = temp;
|
||||
}
|
||||
}
|
||||
else if (LabelEqual (sit.first, L"Square44x44Logo"))
|
||||
{
|
||||
sit.second = pri.findFilePathValue (sit.second);
|
||||
it [strlabel (L"Square44x44LogoBase64")] = GetBase64FromPathW (reader, sit.second.c_str (), NULL, &pri);
|
||||
}
|
||||
}
|
||||
}
|
||||
reader.getCapabilities (capabilities);
|
||||
reader.getDependencies (dependencies);
|
||||
return reader.isAvailable ();
|
||||
|
||||
@@ -316,7 +316,7 @@ class PriReader
|
||||
PriReader (): priReader (NULL) {}
|
||||
void destroy ()
|
||||
{
|
||||
if (!priReader) return;
|
||||
if (priReader == NULL) return;
|
||||
DestroyPriReader (priReader);
|
||||
priReader = NULL;
|
||||
}
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
<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>
|
||||
<!-- Windows 8 -->
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
|
||||
<!-- Windows 8.1 -->
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
||||
<!-- Windows 10 / Windows 11 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
<description></description>
|
||||
|
||||
529
AppInstallerConsole/AppInstaller.rc
Normal 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,9
|
||||
PRODUCTVERSION 1,0,1,9
|
||||
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.9"
|
||||
VALUE "LegalCopyright", "\\xA9Bruce Winter. All rights reserved."
|
||||
VALUE "ProductVersion", "1.0.1.9"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x804, 1200
|
||||
END
|
||||
END
|
||||
|
||||
IDR_VERSION_EN_US VERSIONINFO
|
||||
FILEVERSION 1,0,1,9
|
||||
PRODUCTVERSION 1,0,1,9
|
||||
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.9"
|
||||
VALUE "LegalCopyright", "\\xA9Bruce Winter. All rights reserved."
|
||||
VALUE "ProductVersion", "1.0.1.9"
|
||||
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
|
||||
|
||||
335
AppInstallerConsole/AppInstaller.vcxproj
Normal 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>
|
||||
178
AppInstallerConsole/AppInstaller.vcxproj.filters
Normal 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>
|
||||
212
AppInstallerConsole/AppInstallerConsole.vcxproj
Normal file
@@ -0,0 +1,212 @@
|
||||
<?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\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\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)ToastNotification.lib;$(OutDir)PriReader2.lib;$(OutDir)CertificateManager.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
|
||||
</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)ToastNotification.lib;$(OutDir)PriReader2.lib;$(OutDir)CertificateManager.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
|
||||
</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="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>
|
||||
<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>
|
||||
160
AppInstallerConsole/AppInstallerConsole.vcxproj.filters
Normal file
@@ -0,0 +1,160 @@
|
||||
<?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="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>
|
||||
<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>
|
||||
194
AppInstallerConsole/initread.h
Normal 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);
|
||||
}
|
||||
};
|
||||
111
AppInstallerConsole/localeex.h
Normal 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);
|
||||
}
|
||||
628
AppInstallerConsole/main.cpp
Normal file
@@ -0,0 +1,628 @@
|
||||
#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 "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},
|
||||
{{L"", L"/", L"-"}, {L"ReadInfo", L"Read", L"Info", L"ReadOnly", L"ReadInfoOnly"}, {}, 1},
|
||||
{{L"", L"/", L"-"}, {L"LoadCertOnly", L"Load", L"LoadOnly", L"Cert", L"CertOnly", L"LoadCert"}, {}, 2},
|
||||
{{L"", L"/", L"-"}, {L"InstallOnly", L"Install", L"AddPackageOnly", L"Add", L"AddOnly", L"InstallOnly"}, {}, 3}
|
||||
};
|
||||
|
||||
// 编号为大于 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 ReadPackageInfo ();
|
||||
void TaskInstallPackage ();
|
||||
void TaskInstallPackages (size_t serial, size_t total);
|
||||
bool LoadCert ();
|
||||
bool InstallPackage ();
|
||||
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(-s)>" << endl;
|
||||
std::wcout << L"\t\t" << "Install package(-s)." << endl;
|
||||
std::wcout << L'\t' << PathFindFileNameW (path) << L" <package_file_path(-s)> [/readinfo] [/loadcert] [/install]" << endl;
|
||||
std::wcout << L"\t\t" << "/readinfo" << endl;
|
||||
std::wcout << L"\t\t\t" << "Read package(-s) infomation." << endl;
|
||||
std::wcout << L"\t\t" << "/loadcert" << endl;
|
||||
std::wcout << L"\t\t\t" << "Load certificate from package(-s)." << endl;
|
||||
std::wcout << L"\t\t" << "/install" << endl;
|
||||
std::wcout << L"\t\t\t" << "Install package(-s). (Only perform installation tasks)" << endl;
|
||||
std::wcout << L"\t\t" << L"These command line parameters can be used cumulatively." << 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, bReadInfoOnly = false, bLoadCertOnly = false, bInstallOnly = false;
|
||||
for (size_t cnt = 1; cnt < (size_t)argc; cnt ++)
|
||||
{
|
||||
int res = GetCmdArgSerial (argv [cnt]);
|
||||
if (res > 0)
|
||||
{
|
||||
switch (res)
|
||||
{
|
||||
case 1: bReadInfoOnly = true; break;
|
||||
case 2: bLoadCertOnly = true; break;
|
||||
case 3: bInstallOnly = true; break;
|
||||
case 5: bDisplayHelp = true; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsFileExistsW (argv [cnt])) push_no_repeat (vecObjSwFiles, argv [cnt]);
|
||||
else
|
||||
{
|
||||
wcerr << "Error: Unrecognized command line arguments: " << argv [cnt] << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bDisplayHelp) // 处理命令参数提示
|
||||
{
|
||||
PrintHelpText ();
|
||||
return false;
|
||||
}
|
||||
if (vecObjSwFiles.size () == 1)
|
||||
{
|
||||
g_pkgPath = vecObjSwFiles [0];
|
||||
if (bReadInfoOnly)
|
||||
{
|
||||
if (g_reader.create (g_pkgPath)) ReadPackageInfo ();
|
||||
else wcerr << "Error: Unavailable Package." << endl;
|
||||
}
|
||||
if (bLoadCertOnly)
|
||||
{
|
||||
LoadCert ();
|
||||
}
|
||||
if (bInstallOnly)
|
||||
{
|
||||
InstallPackage ();
|
||||
}
|
||||
if (bReadInfoOnly || bLoadCertOnly || bInstallOnly) return false;
|
||||
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'\"';
|
||||
if (bReadInfoOnly) cmdline += L" /READINFO";
|
||||
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 ReadPackageInfo ()
|
||||
{
|
||||
if (g_reader.isAvailable ())
|
||||
{
|
||||
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)) <<
|
||||
L" ( " << it << L" )" << 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool LoadCert ()
|
||||
{
|
||||
bool res = false;
|
||||
wcout << GetRCString_cpp (PAGE_2_LOADCERT);
|
||||
if (res = LoadCertFromSignedFile (g_pkgPath.c_str ())) wcout << L"Succeeded! " << endl;
|
||||
else wcout << "Failed. " << endl;
|
||||
return res;
|
||||
}
|
||||
|
||||
bool InstallPackage ()
|
||||
{
|
||||
InstallStatus ires = AddPackageFromPath (g_pkgPath.c_str (), &ProgressCallback);
|
||||
wcout << endl;
|
||||
if (ires == InstallStatus::Success)
|
||||
{
|
||||
wcout << "Install Succeeded! " << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
wcerr << "\rError: Install Failed. Message: " << GetLastErrorDetailText () << endl;
|
||||
}
|
||||
return ires == InstallStatus::Success;
|
||||
}
|
||||
|
||||
void TaskInstallPackage ()
|
||||
{
|
||||
if (g_reader.create (g_pkgPath))
|
||||
{
|
||||
ReadPackageInfo ();
|
||||
wcout << StrPrintFormatW (GetRCString_cpp (PAGE_2_TITLE).c_str (), g_pkgInfo.getPropertyName ().c_str ()) << endl;
|
||||
LoadCert ();
|
||||
wcout << GetRCString_cpp (PAGE_2_INSTALL);
|
||||
InstallPackage ();
|
||||
}
|
||||
else
|
||||
{
|
||||
wcerr << "\rError: Install 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;
|
||||
}
|
||||
2062
AppInstallerConsole/pkgcode.h
Normal file
190
AppInstallerConsole/pkginfo.h
Normal file
@@ -0,0 +1,190 @@
|
||||
#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"";
|
||||
} 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 ());
|
||||
this->properties.name = reader.getPropertyName ();
|
||||
this->properties.publisher = reader.getPropertyPublisher ();
|
||||
this->properties.description = reader.getPropertyDescription ();
|
||||
if (isMsResourceLabel (this->properties.name) ||
|
||||
isMsResourceLabel (this->properties.publisher) ||
|
||||
isMsResourceLabel (this->properties.description))
|
||||
{
|
||||
if (pri.create (reader.getPriFileStream ()))
|
||||
{
|
||||
std::wstring temp = this->properties.name;
|
||||
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 = this->properties.publisher;
|
||||
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 = this->properties.description;
|
||||
if (isMsResourceLabel (temp))
|
||||
{
|
||||
std::wstring getres = pri.findStringValue (temp);
|
||||
if (!getres.empty () && getres.length () > 0) temp = std::wstring (L"") + getres;
|
||||
}
|
||||
this->properties.publisher = temp;
|
||||
}
|
||||
}
|
||||
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->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; }
|
||||
// 失败返回都为 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 ();
|
||||
}
|
||||
};
|
||||
377
AppInstallerConsole/priread.h
Normal 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 == NULL) 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;
|
||||
}
|
||||
};
|
||||
BIN
AppInstallerConsole/res/Button/Large/blank.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
AppInstallerConsole/res/Button/Large/blank_light.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
AppInstallerConsole/res/Button/Large/blank_press.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
AppInstallerConsole/res/Button/Large/cancel_window_light.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
AppInstallerConsole/res/Button/Large/cancel_window_normal.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
AppInstallerConsole/res/Button/Large/cancel_window_press.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
AppInstallerConsole/res/Button/Large/max_light.png
Normal file
|
After Width: | Height: | Size: 228 B |
BIN
AppInstallerConsole/res/Button/Large/max_normal.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
AppInstallerConsole/res/Button/Large/max_press.png
Normal file
|
After Width: | Height: | Size: 227 B |
BIN
AppInstallerConsole/res/Button/Large/max_trans_normal.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
AppInstallerConsole/res/Button/Large/min_light.png
Normal file
|
After Width: | Height: | Size: 214 B |
BIN
AppInstallerConsole/res/Button/Large/min_normal.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
AppInstallerConsole/res/Button/Large/min_press.png
Normal file
|
After Width: | Height: | Size: 213 B |
BIN
AppInstallerConsole/res/Button/Large/min_trans_normal.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
AppInstallerConsole/res/Button/Large/restore_light.png
Normal file
|
After Width: | Height: | Size: 243 B |
BIN
AppInstallerConsole/res/Button/Large/restore_normal.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
AppInstallerConsole/res/Button/Large/restore_press.png
Normal file
|
After Width: | Height: | Size: 242 B |
BIN
AppInstallerConsole/res/Button/Large/restore_trans_normal.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
AppInstallerConsole/res/Button/Normal/blank.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
AppInstallerConsole/res/Button/Normal/blank_light.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
AppInstallerConsole/res/Button/Normal/blank_press.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
AppInstallerConsole/res/Button/Normal/cancel_back.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
AppInstallerConsole/res/Button/Normal/cancel_light.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
AppInstallerConsole/res/Button/Normal/cancel_press.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
AppInstallerConsole/res/Button/Normal/max_back.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
AppInstallerConsole/res/Button/Normal/max_light.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
AppInstallerConsole/res/Button/Normal/max_press.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
AppInstallerConsole/res/Button/Normal/min_back.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
AppInstallerConsole/res/Button/Normal/min_light.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
AppInstallerConsole/res/Button/Normal/min_press.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
AppInstallerConsole/res/Button/Normal/restore_back.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
AppInstallerConsole/res/Button/Normal/restore_light.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
AppInstallerConsole/res/Button/Normal/restore_press.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
AppInstallerConsole/res/Fonts/IDR_SETUP_FONT.TTF
Normal file
BIN
AppInstallerConsole/res/Icons/FileIcon.ico
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
AppInstallerConsole/res/Icons/IconColor.ico
Normal file
|
After Width: | Height: | Size: 184 KiB |
BIN
AppInstallerConsole/res/Icons/IconTitleBar.ico
Normal file
|
After Width: | Height: | Size: 403 KiB |
BIN
AppInstallerConsole/res/Icons/IconWhite.ico
Normal file
|
After Width: | Height: | Size: 153 KiB |
BIN
AppInstallerConsole/res/Icons/Main.ico
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
AppInstallerConsole/res/Pictures/Trans.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
AppInstallerConsole/res/Pictures/Trans_old.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
AppInstallerConsole/res/icon.ico
Normal file
|
After Width: | Height: | Size: 7.2 KiB |
25
AppInstallerConsole/res/manifest.xml
Normal 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
@@ -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 ());
|
||||
}
|
||||
162
AppInstallerConsole/resource.h
Normal 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
|
||||
@@ -31,4 +31,33 @@ LPSTR StreamToBase64 (HISTREAM ifile)
|
||||
if (!lpszStr) return NULL;
|
||||
lstrcpyA (lpszStr, res.c_str ());
|
||||
return lpszStr;
|
||||
}
|
||||
}
|
||||
|
||||
LPWSTR StreamToBase64W (HISTREAM ifile)
|
||||
{
|
||||
if (!ifile) return NULL;
|
||||
IStream *pStream = (IStream *)ifile;
|
||||
LARGE_INTEGER liZero = {};
|
||||
pStream->Seek (liZero, STREAM_SEEK_SET, nullptr);
|
||||
STATSTG statstg;
|
||||
pStream->Stat (&statstg, STATFLAG_NONAME);
|
||||
ULARGE_INTEGER uliSize = statstg.cbSize;
|
||||
std::vector<BYTE> buffer (uliSize.QuadPart);
|
||||
ULONG bytesRead;
|
||||
pStream->Read (buffer.data (), static_cast<ULONG>(buffer.size ()), &bytesRead);
|
||||
DWORD base64Size = 0;
|
||||
if (!CryptBinaryToStringW (buffer.data (), bytesRead, CRYPT_STRING_BASE64 | CRYPT_STRING_NOCRLF, nullptr, &base64Size))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
std::vector <WCHAR> base64Buffer (base64Size);
|
||||
if (!CryptBinaryToStringW (buffer.data (), bytesRead, CRYPT_STRING_BASE64 | CRYPT_STRING_NOCRLF, base64Buffer.data (), &base64Size))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
std::wstring res = std::wstring (base64Buffer.begin (), base64Buffer.end ());
|
||||
LPWSTR lpszStr = (LPWSTR)calloc (res.capacity (), sizeof (WCHAR));
|
||||
if (!lpszStr) return NULL;
|
||||
lstrcpyW (lpszStr, res.c_str ());
|
||||
return lpszStr;
|
||||
}
|
||||
|
||||
@@ -14,3 +14,5 @@ typedef HANDLE HISTREAM;
|
||||
typedef char *LPSTR;
|
||||
|
||||
extern "C" BASE64IMG_API LPSTR StreamToBase64 (HISTREAM ifile);
|
||||
|
||||
extern "C" BASE64IMG_API LPWSTR StreamToBase64W (HISTREAM ifile);
|
||||
|
||||
24
LICENSE(pugixml).md
Normal file
@@ -0,0 +1,24 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2006-2025 Arseny Kapoulkine
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -5,6 +5,27 @@
|
||||
#include "localeex.h"
|
||||
#include "PriReader2.h"
|
||||
|
||||
template <typename CharT> std::basic_string <CharT> replace_substring
|
||||
(
|
||||
const std::basic_string <CharT> &str,
|
||||
const std::basic_string <CharT> &from,
|
||||
const std::basic_string <CharT> &to
|
||||
)
|
||||
{
|
||||
if (from.empty ()) return str;
|
||||
std::basic_string <CharT> result;
|
||||
size_t pos = 0;
|
||||
size_t start_pos;
|
||||
while ((start_pos = str.find (from, pos)) != std::basic_string<CharT>::npos)
|
||||
{
|
||||
result.append (str, pos, start_pos - pos);
|
||||
result.append (to);
|
||||
pos = start_pos + from.length ();
|
||||
}
|
||||
result.append (str, pos, str.length () - pos);
|
||||
return result;
|
||||
}
|
||||
|
||||
int GetDPI ()
|
||||
{
|
||||
HDC hDC = GetDC (NULL);
|
||||
@@ -866,10 +887,24 @@ class PriReader
|
||||
isMatch = LabelEqual (resname, lpname2);
|
||||
}
|
||||
if (!isMatch)
|
||||
{
|
||||
std::string objstr = std::regex_replace (std::string (lpMsName), pattern, "");
|
||||
std::string lpname2 = PathFindFileNameA (objstr.c_str ());
|
||||
isMatch = LabelEqual (resname, lpname2);
|
||||
}
|
||||
if (!isMatch)
|
||||
{
|
||||
pugi::xml_attribute uriAttr = namedRes.attribute ("uri");
|
||||
std::string resuri = uriAttr.as_string ();
|
||||
isMatch = (InStr (resuri, resname) >= 0);
|
||||
isMatch = (InStr (resuri, lpMsName, true) >= 0);
|
||||
}
|
||||
if (!isMatch)
|
||||
{
|
||||
pugi::xml_attribute uriAttr = namedRes.attribute ("uri");
|
||||
std::string resuri = uriAttr.as_string ();
|
||||
std::string objstr = std::regex_replace (std::string (lpMsName), pattern, "");
|
||||
objstr = replace_substring <char> (objstr, "\\", "/");
|
||||
isMatch = (InStr (resuri, objstr, true) >= 0);
|
||||
}
|
||||
if (isMatch)
|
||||
{
|
||||
@@ -996,6 +1031,12 @@ class PriReader
|
||||
isMatch = LabelEqual (resname, lpname2);
|
||||
}
|
||||
if (!isMatch)
|
||||
{
|
||||
std::wstring objstr = std::regex_replace (std::wstring (lpMsName), pattern, L"");
|
||||
std::wstring lpname2 = PathFindFileNameW (objstr.c_str ());
|
||||
isMatch = LabelEqual (resname, lpname2);
|
||||
}
|
||||
if (!isMatch)
|
||||
{
|
||||
pugi::xml_attribute uriAttr = namedRes.attribute ("uri");
|
||||
std::wstring resuri = pugi::as_wide (uriAttr.as_string ());
|
||||
@@ -1008,6 +1049,14 @@ class PriReader
|
||||
std::wstring resuri = pugi::as_wide (uriAttr.as_string ());
|
||||
isMatch = (InStr (resuri, lpname2, true) >= 0);
|
||||
}
|
||||
if (!isMatch)
|
||||
{
|
||||
pugi::xml_attribute uriAttr = namedRes.attribute ("uri");
|
||||
std::wstring resuri = pugi::as_wide (uriAttr.as_string ());
|
||||
std::wstring objstr = std::regex_replace (std::wstring (lpMsName), pattern, L"");
|
||||
objstr = replace_substring <WCHAR> (objstr, L"\\", L"/");
|
||||
isMatch = (InStr (resuri, objstr, true) >= 0);
|
||||
}
|
||||
if (isMatch)
|
||||
{
|
||||
std::map <std::wstring, std::wstring> langmap;
|
||||
@@ -1603,6 +1652,10 @@ class PriReader
|
||||
if (xmlreader) delete xmlreader;
|
||||
xmlreader = nullptr;
|
||||
if (IsFileExists (txmlpath)) DeleteFileW (txmlpath.c_str ());
|
||||
if (IsFileExists (txmlpath.substr (0, txmlpath.length () - 4)))
|
||||
{
|
||||
DeleteFileW (txmlpath.substr (0, txmlpath.length () - 4).c_str ());
|
||||
}
|
||||
txmlpath = L"";
|
||||
prifile = L"";
|
||||
}
|
||||
@@ -1711,6 +1764,10 @@ class PriReader
|
||||
}
|
||||
bool res = this->create (tempPriFile);
|
||||
DeleteFileW (tempPriFile.c_str ());
|
||||
if (IsFileExists (tempPriFile.substr (0, tempPriFile.length () - 4)))
|
||||
{
|
||||
DeleteFileW (tempPriFile.substr (0, tempPriFile.length () - 4).c_str ());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
// 获取到的指针需要 free 手动释放。
|
||||
@@ -1728,6 +1785,12 @@ class PriReader
|
||||
LPSTR result = recFindStringValue (subtree, lpMsName, defaultLocaleCode);
|
||||
if (result) return result;
|
||||
}
|
||||
for (pugi::xml_node subtree = resmap.child ("ResourceMapSubtree"); subtree; subtree = subtree.next_sibling ("ResourceMapSubtree"))
|
||||
{
|
||||
std::string resMapName = subtree.attribute ("name").as_string ();
|
||||
LPSTR result = recFindStringValue (subtree, lpMsName, defaultLocaleCode);
|
||||
if (result) return result;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
// 获取到的指针需要 free 手动释放。
|
||||
@@ -1738,6 +1801,14 @@ class PriReader
|
||||
pugi::xml_node resmap = root.child ("ResourceMap");
|
||||
if (!resmap) return NULL;
|
||||
for (pugi::xml_node subtree = resmap.child ("ResourceMapSubtree"); subtree; subtree = subtree.next_sibling ("ResourceMapSubtree"))
|
||||
{
|
||||
std::string resMapName = subtree.attribute ("name").as_string ();
|
||||
if (LabelEqual (resMapName, "Files")) continue;
|
||||
if (!LabelEqual (resMapName, "resources")) continue;
|
||||
LPWSTR result = recFindStringValue (subtree, lpMsName, defaultLocaleCode);
|
||||
if (result && lstrlenW (result) > 0) return result;
|
||||
}
|
||||
for (pugi::xml_node subtree = resmap.child ("ResourceMapSubtree"); subtree; subtree = subtree.next_sibling ("ResourceMapSubtree"))
|
||||
{
|
||||
std::string resMapName = subtree.attribute ("name").as_string ();
|
||||
if (LabelEqual (resMapName, "Files")) continue;
|
||||
@@ -1842,7 +1913,7 @@ void DestroyPriReader (HPRIREADER hpr)
|
||||
{
|
||||
if (!hpr) return;
|
||||
PriReader *ptr = (PriReader *)hpr;
|
||||
delete hpr;
|
||||
delete ptr;
|
||||
return;
|
||||
}
|
||||
// 返回的字符串只能肯定不是宽字符串,而不确定具体的编码方式(可能为 ANSI 也有可能为 UTF-8)
|
||||
|
||||
13
README.md
@@ -1,2 +1,13 @@
|
||||
# AppInstallerForWin8
|
||||
A Windows Store App Installer for Windows 8.
|
||||
|
||||
A Windows Store App Installer for Windows 8.x.
|
||||
|
||||
(Translated by ChatGTP)
|
||||
|
||||
The purpose of this project is actually to create an intuitive and visually appealing Windows Store app installer, which also serves a personal need. Unfortunately, I only have a foundation in C/C++ programming, and I am not familiar with .NET/WinRT/HTML/JavaScript/Win32API. Here, I would like to thank AI (ChatGPT, GitHub Copilot, and DeepSeek) for making this project possible when it seemed impossible. That being said, suitable tools were actually hard to find (back in the Windows 8.x era). I remember Windows App Boss, but it wasn’t specialized—it also had other features. Over such a long period, there weren’t that many tools available, and compared to today, they were difficult to find, which is quite regretful.
|
||||
|
||||
The functionality of this tool is actually very simple: it’s just about "installing" a task. However, it also provides some additional information. Though it might not be as thorough as Microsoft’s official installer, it works well for Windows 8.x and for installing apps that the earlier versions of Microsoft’s App Installer could not. As for installing Microsoft’s official installer, it’s recommended to continue using it.
|
||||
|
||||
The code itself is not particularly instructive; it’s either because AI or my programming is a bit chaotic, but feel free to use it, offer suggestions, or add to it. The reason I chose WebUI is that UI design is too difficult—after all, websites can use animations and other conveniences. The WebUI uses the IE browser control, but it seems Windows 8 couldn’t use IE 10, so I had to create a compatible webpage, which isn’t very pretty, but there’s no choice.
|
||||
|
||||
This project is for learning and research purposes only.
|
||||
|
||||