以下是 PackageOrigin 枚举的定义:
typedef enum PACKAGE_ORIGIN {
PACKAGE_ORIGIN_Unsigned,
PACKAGE_ORIGIN_Inbox,
PACKAGE_ORIGIN_Store,
PACKAGE_ORIGIN_DeveloperUnsigned,
PACKAGE_ORIGIN_DeveloperSigned,
PACKAGE_ORIGIN_LineOfBusiness
} PACKAGE_ORIGIN;
枚举值说明:
- PACKAGE_ORIGIN_Unsigned: 未签名的应用程序包。
- PACKAGE_ORIGIN_Inbox: 预装在操作系统中的应用程序包。
- PACKAGE_ORIGIN_Store: 从 Microsoft Store 安装的应用程序包。
- PACKAGE_ORIGIN_DeveloperUnsigned: 开发人员未签名的应用程序包。
- PACKAGE_ORIGIN_DeveloperSigned: 开发人员签名的应用程序包。
- PACKAGE_ORIGIN_LineOfBusiness: 针对企业的应用程序包。
使用示例:
#include <windows.h>
#include <appmodel.h>
int main() {
PACKAGE_ORIGIN origin = PACKAGE_ORIGIN_Unsigned;
// 获取应用程序包的来源
if (GetPackageOrigin(&origin) == ERROR_SUCCESS) {
switch (origin) {
case PACKAGE_ORIGIN_Unsigned:
wprintf(L"The package is unsigned.\n");
break;
case PACKAGE_ORIGIN_Inbox:
wprintf(L"The package is pre-installed in the OS.\n");
break;
case PACKAGE_ORIGIN_Store:
wprintf(L"The package is from the Microsoft Store.\n");
break;
case PACKAGE_ORIGIN_DeveloperUnsigned:
wprintf(L"The package is developer unsigned.\n");
break;
case PACKAGE_ORIGIN_DeveloperSigned:
wprintf(L"The package is developer signed.\n");
break;
case PACKAGE_ORIGIN_LineOfBusiness:
wprintf(L"The package is for line of business.\n");
break;
default:
wprintf(L"Unknown package origin.\n");
break;
}
}
return 0;
}
请注意,使用这些枚举时,你需要在代码中包含相应的头文件,并且在编译时链接相应的库。
转载请注明出处:http://www.zyzy.cn/article/detail/23848/Win32 API/Appmodel.h/PackageOrigin