mirror of
https://github.com/modernw/App-Installer-For-Windows-8.x-Reset.git
synced 2026-04-11 17:57:19 +10:00
Update the features about Notification and Cert.
This commit is contained in:
@@ -10,8 +10,13 @@ BOOL APIENTRY DllMain( HMODULE hModule,
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
case DLL_THREAD_ATTACH:
|
||||
CoInitializeEx (NULL, COINIT_MULTITHREADED | COINIT_APARTMENTTHREADED);
|
||||
RoInitialize (RO_INIT_MULTITHREADED);
|
||||
break;
|
||||
case DLL_THREAD_DETACH:
|
||||
case DLL_PROCESS_DETACH:
|
||||
CoUninitialize ();
|
||||
RoUninitialize ();
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
@@ -628,4 +628,30 @@ HRESULT FindAppxPackage (LPCWSTR lpPackageFullName, PKGMGR_FINDENUMCALLBACK pfCa
|
||||
[STAThread]
|
||||
LPCWSTR GetPackageManagerLastErrorCode () { return g_swExceptionCode.c_str (); }
|
||||
[STAThread]
|
||||
LPCWSTR GetPackageManagerLastErrorDetailMessage () { return g_swExceptionDetail.c_str (); }
|
||||
LPCWSTR GetPackageManagerLastErrorDetailMessage () { return g_swExceptionDetail.c_str (); }
|
||||
|
||||
HRESULT ActivateAppxApplication (LPCWSTR lpAppUserId, PDWORD pdwProcessId)
|
||||
{
|
||||
if (!lpAppUserId) return E_INVALIDARG;
|
||||
std::wstring strAppUserModelId (L"");
|
||||
if (lpAppUserId) strAppUserModelId += lpAppUserId;
|
||||
IApplicationActivationManager *spAppActivationManager = nullptr;
|
||||
destruct relaamgr ([&] () {
|
||||
if (spAppActivationManager) spAppActivationManager->Release ();
|
||||
spAppActivationManager = nullptr;
|
||||
});
|
||||
HRESULT hResult = E_INVALIDARG;
|
||||
if (!strAppUserModelId.empty ())
|
||||
{
|
||||
// Instantiate IApplicationActivationManager
|
||||
hResult = CoCreateInstance (CLSID_ApplicationActivationManager, NULL, CLSCTX_LOCAL_SERVER, IID_IApplicationActivationManager, (LPVOID *)&spAppActivationManager);
|
||||
if (SUCCEEDED (hResult))
|
||||
{
|
||||
// This call ensures that the app is launched as the foreground window
|
||||
hResult = CoAllowSetForegroundWindow (spAppActivationManager, NULL);
|
||||
// Launch the app
|
||||
if (SUCCEEDED (hResult)) hResult = spAppActivationManager->ActivateApplication (strAppUserModelId.c_str (), NULL, AO_NONE, pdwProcessId);
|
||||
}
|
||||
}
|
||||
return hResult;
|
||||
}
|
||||
@@ -181,6 +181,8 @@ extern "C"
|
||||
PKGMGR_API LPCWSTR GetPackageManagerLastErrorCode ();
|
||||
// 获取错误详细信息。这个是常用的
|
||||
PKGMGR_API LPCWSTR GetPackageManagerLastErrorDetailMessage ();
|
||||
// 启动 Metro UI 应用
|
||||
PKGMGR_API HRESULT ActivateAppxApplication (LPCWSTR lpAppUserId, PDWORD pdwProcessId);
|
||||
#ifdef _DEFAULT_INIT_VALUE_
|
||||
#undef _DEFAULT_INIT_VALUE_
|
||||
#endif
|
||||
|
||||
@@ -82,6 +82,7 @@
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp" />
|
||||
<ClCompile Include="pkgmgr.cpp" />
|
||||
<ClCompile Include="stdafx.cpp" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="pkgmgr.h">
|
||||
|
||||
@@ -27,4 +27,7 @@ using namespace Windows::Management::Deployment;
|
||||
#include <algorithm>
|
||||
#include <collection.h>
|
||||
#include <string>
|
||||
#include <sddl.h>
|
||||
#include <sddl.h>
|
||||
#include <shlobj.h>
|
||||
#include <stdio.h>
|
||||
#include <shobjidl.h>
|
||||
Reference in New Issue
Block a user