桌面Delphi应用程序可以通过Windows 8认证(使用Windows应用程序认证工具包)吗? [英] Can a desktop Delphi application be certified for Windows 8 (using Windows App Certification Kit)?

查看:269
本文介绍了桌面Delphi应用程序可以通过Windows 8认证(使用Windows应用程序认证工具包)吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

显然,Delphi(任何版本)不支持安全的异常处理程序 (/ Visual Studio中的SAFESEH开关)。在Windows 8上使用Windows桌面应用程序认证套件时,会导致警告。根据 Windows 8桌面应用程序的认证要求

Apparently, Delphi (any version) does not support safe exception handlers (/SAFESEH switch in Visual Studio). This results in a warning when using Windows Desktop App Certification Kit on Windows 8. Per certification requirements for Windows 8 desktop apps:


您的应用程序必须使用/ SafeSEH标志进行编译,以确保安全的异常处理

Your app must be compiled using the /SafeSEH flag to ensure safe exceptions handling

显然,Delphi缺少此开关,因此无法完成。我的问题是:

Obviously Delphi lacks this switch, so it cannot be done. My questions are:


  1. 我的理解是否正确,即使Kit仅显示警告(不是失败),因为这样是一个必须要求,今天的任何Delphi应用程序都无法通过Windows 8的认证,因此不能包含在Windows应用商店中。

  1. Is my understanding correct, that even though the Kit displays only a warning (not fail), since this is a "must" requirement, any Delphi app today cannot be certified for Windows 8 and therefore cannot be included in the Windows app store?

可以将SafeSEH表格在编译后添加到PE文件(例如从地图文件或调试符号中提取所需的信息),或者我们绝对需要编译器/链接器支持,因此必须等到Embarcadero实现此功能?

Can SafeSEH tables be added to a PE file after the compilation somehow (e.g. extracting needed info from the map file or debug symbols), or we absolutely need a compiler/linker support for this, and therefore must wait till Embarcadero implements this feature?

要清除,我的应用程序是Windows 32位桌面应用程序(64位兼容),不是Metro应用程序>

To clearify, my application is Windows 32-bit desktop application (64-bit compatible), not Metro application.

推荐答案

我无法回答问题1.但是,我觉得很难想象使用这个词必须可能意味着规则是可选的。

I cannot answer question 1. However, I find it hard to imagine that the use of the word must could mean that the rule was optional.

对于问题2,您需要编译器/链接的支持呃您不能合理地期望使用PE编辑后链接工具来适应此情况。请考虑以下代码:

As for question 2, you would need support from the compiler/linker. You cannot reasonably expect to back fit this with a PE editing post-link tool. Consider the following code:

try
  Beep;
except
  on E: Exception do
    Writeln(E.ClassName, ': ', E.Message);
end;

编译器发出以下内容:

Project1.dpr.11: try
0041C3AA 33C0             xor eax,eax
0041C3AC 55               push ebp
0041C3AD 68C9C34100       push $0041c3c9 // exception handler is at $0041c3c9
0041C3B2 64FF30           push dword ptr fs:[eax]
0041C3B5 648920           mov fs:[eax],esp
Project1.dpr.12: Beep;
0041C3B8 6A00             push $00
0041C3BA E8E1CEFEFF       call MessageBeep
0041C3BF 33C0             xor eax,eax
0041C3C1 5A               pop edx
0041C3C2 59               pop ecx
0041C3C3 59               pop ecx
0041C3C4 648910           mov fs:[eax],edx
0041C3C7 EB59             jmp $0041c422
0041C3C9 E97291FEFF       jmp @HandleOnException
0041C3CE 0100             add [eax],eax
0041C3D0 0000             add [eax],al
0041C3D2 E42F             in al,$2f
0041C3D4 41               inc ecx
0041C3D5 00DA             add dl,bl
0041C3D7 C3               ret 
0041C3D8 41               inc ecx
0041C3D9 00A3D83E4200     add [ebx+$00423ed8],ah
Project1.dpr.15: Writeln(E.ClassName, ': ', E.Message);
........

现在,真正的异常处理程序是code> HandleOnException ,在 System.pas 中实现。但是,推送到堆栈的地址是 $ 0041c3c9 ,该代码的本地地址包含 try / except 块。这意味着为了创建一个SafeSEH PE部分,您需要在代码中找到每个 try / except 。虽然这显然是可行的,但我不认为它是易处理​​的。

Now, the real exception handler is HandleOnException, implemented in System.pas. But, the address pushed onto the stack is $0041c3c9, an address local to the code containing the try/except block. This means that in order to create a SafeSEH PE section you would need to locate each and every try/except in your code. Whilst that is obviously feasible, I don't think it is tractable.

我想象的是,x86编译器的SEH异常处理程序将只是 _HandleXXX System.pas 中声明的函数。在这种情况下,添加一个仅将这些功能列为后连接步骤的PE部分将是非常简单的。然而,由于每一个 try / except 有自己的本地异常处理程序,我现在相信只有编译器作者可以真正地希望添加SafeSEH PE部分。

I rather imagined that the SEH exception handlers for the x86 compiler would be just the _HandleXXX functions declared in System.pas. In which case it would be easy enough to add a PE section listing just those functions as a post-link step. However, since every single try/except has its own local exception handler, I now believe that only the compiler author can realistically hope to add the SafeSEH PE section.

据我所知,没有QC报告要求x86 Windows编译器要求 SafeSEH 支持。我建议您登录一份QC报告和一份正式的支持案例。

There is, so far as I can see, no QC report that requests SafeSEH support for the x86 Windows compiler. I suggest that you log a QC report, and an official support case.

更新: @haimg做得好,成功失败,管理定位QC报告: QC#106781

Update: Well done to @haimg for succeeding where I failed and managing to locate a QC report: QC#106781.

这篇关于桌面Delphi应用程序可以通过Windows 8认证(使用Windows应用程序认证工具包)吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆