×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    9

    程序启动报告错误"因安全原因,无法执行文件"

    大家好,最近开发一个程序,由两个进程组成。一个XXXServ.exe,一个XXX.exe。

    最初开发的时候,申请了两个unprotected UID,分别给两个进程用,在模拟器上测试正常,没有 PlatSec warning。用开发者证书签名,在真机上测试,也一切正常。

    上周打算进行 Express Sign,所以把两个unprotected UID分别更改为了两个protected UID,在模拟器上测试也正常。用开发者证书签名后,在真机上安装正常,但启动时报告“因安全原因,无法执行文件”,对应的英文提示应该是"Unable to execute file for security"。

    在论坛以及网上搜索,提到这个问题大都说是安全原因:一种情况是建议检查PlatSec,但这个我已经检查过了没问题;另一种情况是用到了能力比exe低的dll,但我这里也没有用到dll。

    请问大家有没有遇到类似的情况,用unprotected uid可以但是protected uid就有问题

    也请大家帮想想,这种问题可能的原因是什么?

    这个问题困扰小弟好几天了,非常感谢大家的帮助。

  2. #2
    Super Contributor
    Join Date
    Jul 2007
    Location
    ShenZhen, China
    Posts
    4,346

    Re: 程序启动报告错误"因安全原因,无法执行文件"

    你这个uid是0x2开头的范围么, 不是 0x1开头的吧.
    ----------------------------
    坚持学习, 坚持编码
    http://www.devdiv.net/
    qxiaoyuan

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    9

    Re: 程序启动报告错误"因安全原因,无法执行文件"

    Quote Originally Posted by qxiaoyuan View Post
    你这个uid是0x2开头的范围么, 不是 0x1开头的吧.
    出问题的UID都是 0x2 开头的。之前未保护的uid是0xA 开头的。

  4. #4
    Super Contributor
    Join Date
    Jul 2007
    Location
    ShenZhen, China
    Posts
    4,346

    Re: 程序启动报告错误"因安全原因,无法执行文件"

    把2个exe各自的mmp和pkg贴出来看看.
    ----------------------------
    坚持学习, 坚持编码
    http://www.devdiv.net/
    qxiaoyuan

  5. #5
    Registered User
    Join Date
    Mar 2009
    Posts
    9

    Re: 程序启动报告错误"因安全原因,无法执行文件"

    Quote Originally Posted by qxiaoyuan View Post
    把2个exe各自的mmp和pkg贴出来看看.
    第一个XXXSrv.exe只有mmp,没有pkg。注:源代码部分去掉了,一些关键信息用XXX替换了

    XXXSrv.mmp文件:
    TARGET XXXSrv.exe
    TARGETTYPE exe
    UID 0 0x200XXXX5
    VENDORID 0

    USERINCLUDE ..\inc
    SYSTEMINCLUDE \epoc32\include

    SOURCEPATH .
    DOCUMENT bld.inf

    START RESOURCE 200XXXX5.rss
    END

    SOURCEPATH ..\src
    SOURCE AAA.cpp
    SOURCE BBB.cpp
    SOURCE ....cpp

    LIBRARY euser.lib
    LIBRARY apparc.lib
    LIBRARY cone.lib
    LIBRARY eikcore.lib
    LIBRARY eikcoctl.lib
    LIBRARY avkon.lib
    LIBRARY estor.lib
    LIBRARY egul.lib
    LIBRARY fbscli.lib
    LIBRARY gdi.lib
    LIBRARY eikctl.lib
    LIBRARY ws32.lib
    LIBRARY efsrv.lib
    LIBRARY bafl.lib
    LIBRARY MGFetch.lib
    LIBRARY CommonDialogs.lib
    LIBRARY flogger.lib
    LIBRARY commdb.lib
    LIBRARY insock.lib
    LIBRARY form.lib
    LIBRARY eikdlg.lib
    LIBRARY edbms.lib
    LIBRARY InetProtUtil.lib
    LIBRARY http.lib
    LIBRARY ecom.lib
    LIBRARY imut.lib
    LIBRARY mediaclientaudio.lib
    LIBRARY mediaclientaudioinputstream.lib
    LIBRARY mediaclientaudiostream.lib
    LIBRARY CommonUI.lib
    LIBRARY apgrfx.lib
    LIBRARY apmime.lib
    LIBRARY ImageConversion.lib
    LIBRARY bitmaptransforms.lib
    LIBRARY bitgdi.lib
    LIBRARY etext.lib
    LIBRARY charconv.lib
    LIBRARY bluetooth.lib
    LIBRARY btextnotifiers.lib
    LIBRARY btmanclient.lib
    LIBRARY irobex.lib
    LIBRARY esock.lib
    LIBRARY sdpagent.lib
    LIBRARY sdpdatabase.lib
    LIBRARY etel.lib
    LIBRARY msgs.lib
    LIBRARY smcm.lib
    LIBRARY gsmu.lib
    LIBRARY ecam.lib
    LIBRARY Sendui.lib
    LIBRARY favouritesengine.lib
    LIBRARY etel3rdparty.lib
    LIBRARY commonengine.lib
    LIBRARY hal.lib
    LIBRARY sysutil.lib
    LIBRARY platformenv.lib
    LIBRARY pbkeng.lib
    LIBRARY cntmodel.lib
    LIBRARY bcardeng.lib
    LIBRARY PbkView.lib
    LIBRARY aknnotify.lib
    LIBRARY uiklaf.lib
    LIBRARY fepbase.lib
    LIBRARY AknSkins.lib
    LIBRARY estlib.lib
    LIBRARY MediaClientImage.lib
    LIBRARY ezlib.lib
    LIBRARY hlplch.lib
    LIBRARY aknicon.lib

    CAPABILITY LocalServices ReadUserData WriteUserData NetworkServices UserEnvironment Location ReadDeviceData WriteDeviceData SwEvent
    XXX.mmp文件:
    MACRO HAVE_CONFIG_H
    #ifndef EKA2
    TARGET XXX.app
    TARGETTYPE app
    UID 0x100039CE 0x200XXXX6
    TARGETPATH \system\apps\XXX
    #else
    TARGET XXX.exe
    TARGETTYPE exe
    UID 0x0 0x200XXXX6
    SECUREID 0x200XXXX6
    #endif
    EPOCSTACKSIZE 0x5000

    LANG 01 31

    SOURCEPATH ..\data
    #ifndef EKA2
    RESOURCE XXX.rss
    RESOURCE XXX_caption.rss
    #else
    START RESOURCE XXX.rss
    HEADER
    TARGETPATH \resource\apps
    END

    START RESOURCE XXX_reg.rss
    TARGETPATH \private\10003a3f\apps
    END
    #endif

    SOURCEPATH ..\src
    SOURCE XXX.cpp
    SOURCE XXXDocument.cpp
    SOURCE XXXAppUi.cpp
    SOURCE XXXAAA.cpp


    SYSTEMINCLUDE .
    SYSTEMINCLUDE \epoc32\include
    SYSTEMINCLUDE \epoc32\include\mmf\server
    SYSTEMINCLUDE \epoc32\include\ecom
    SYSTEMINCLUDE \epoc32\include\libc

    #ifndef EKA2
    #if defined(WINS)
    LIBRARY prnesock.lib
    #endif
    LIBRARY plpvariant.lib gsmbas.lib
    #else
    LIBRARY aknicon.lib
    #endif
    LIBRARY euser.lib
    LIBRARY apparc.lib
    LIBRARY cone.lib
    LIBRARY eikcore.lib
    LIBRARY eikcoctl.lib
    LIBRARY avkon.lib
    LIBRARY estor.lib
    LIBRARY egul.lib
    LIBRARY fbscli.lib
    LIBRARY gdi.lib
    LIBRARY eikctl.lib
    LIBRARY ws32.lib
    LIBRARY efsrv.lib
    LIBRARY bafl.lib
    LIBRARY MGFetch.lib
    LIBRARY CommonDialogs.lib
    LIBRARY flogger.lib
    LIBRARY commdb.lib
    LIBRARY insock.lib
    LIBRARY form.lib
    LIBRARY eikdlg.lib
    LIBRARY edbms.lib
    LIBRARY InetProtUtil.lib
    LIBRARY http.lib
    LIBRARY ecom.lib
    LIBRARY imut.lib
    LIBRARY mediaclientaudio.lib
    LIBRARY mediaclientaudioinputstream.lib
    LIBRARY mediaclientaudiostream.lib
    LIBRARY CommonUI.lib
    LIBRARY apgrfx.lib
    LIBRARY apmime.lib
    LIBRARY ImageConversion.lib
    LIBRARY bitmaptransforms.lib
    LIBRARY bitgdi.lib
    LIBRARY etext.lib
    LIBRARY charconv.lib
    LIBRARY bluetooth.lib
    LIBRARY btextnotifiers.lib
    LIBRARY btmanclient.lib
    LIBRARY irobex.lib
    LIBRARY esock.lib
    LIBRARY sdpagent.lib
    LIBRARY sdpdatabase.lib
    LIBRARY etel.lib
    LIBRARY msgs.lib
    LIBRARY smcm.lib
    LIBRARY gsmu.lib
    LIBRARY ecam.lib
    LIBRARY MediaClientVideo.lib
    LIBRARY MMFControllerFramework.lib
    LIBRARY Sendui.lib
    LIBRARY favouritesengine.lib
    LIBRARY etel3rdparty.lib
    LIBRARY commonengine.lib
    LIBRARY hal.lib
    LIBRARY sysutil.lib
    LIBRARY platformenv.lib
    LIBRARY pbkeng.lib
    LIBRARY cntmodel.lib
    LIBRARY bcardeng.lib
    LIBRARY PbkView.lib
    LIBRARY aknnotify.lib
    LIBRARY uiklaf.lib
    LIBRARY fepbase.lib
    LIBRARY AknSkins.lib
    LIBRARY estlib.lib
    LIBRARY MediaClientImage.lib
    LIBRARY ezlib.lib

    #ifndef EKA2
    AIF XXX.aif ..\aif XXXaif.rss c24 context_pane_icon.bmp context_pane_icon_mask.bmp list_icon.bmp list_icon_mask.bmp
    #else
    VENDORID 0
    CAPABILITY LocalServices NetworkServices ReadUserData WriteUserData UserEnvironment ReadDeviceData WriteDeviceData SwEvent
    #endif

    XXX.pkg文件:
    ; Languages
    &ZH
    ; Header
    #{"我的应用"},(0x200XXXX5), 1,0,0

    ; Platform compatibility
    [0x101F7961], 0, 0, 0, {"Series60ProductID"}

    ; vendor
    %{"Me"}
    :"Me"


    "C:\Symbian\9.2\S60_3rd_FP1_4\Epoc32\data\z\resource\apps\XXX.r01" -"!:\resource\apps\XXX.r01"
    "C:\Symbian\9.2\S60_3rd_FP1_4\Epoc32\data\z\resource\apps\XXX.r31" -"!:\resource\apps\XXX.r31"
    "C:\Symbian\9.2\S60_3rd_FP1_4\Epoc32\data\z\private\10003a3f\apps\XXX_reg.r01" -"!:\private\10003a3f\import\apps\XXX_reg.r01"
    "C:\Symbian\9.2\S60_3rd_FP1_4\Epoc32\data\z\private\10003a3f\apps\XXX_reg.r31" -"!:\private\10003a3f\import\apps\XXX_reg.r31"
    "C:\Symbian\9.2\S60_3rd_FP1_4\Epoc32\data\z\resource\apps\XXX_reg.mif" -"!:\resource\apps\XXX_reg.mif"
    "C:\Symbian\9.2\S60_3rd_FP1_4\Epoc32\release\gcce\UREL\XXX.exe" -"!:\sys\bin\XXX.exe"

    "C:\Symbian\9.2\S60_3rd_FP1_4\epoc32\data\200XXXX5.rsc" -"!:\private\101f875a\import\[200XXXX5].rsc"
    "C:\Symbian\9.2\S60_3rd_FP1_4\epoc32\release\gcce\urel\XXXSrv.exe" -"!:\sys\bin\XXXSrv.exe",FR,RI

    补充两点:
    • XXXSrv.exe是可以正常启动的,但是XXX.exe启动时报告"因安全原因,无法执行文件"
    • 我试过把开发者证书允许的13种能力全部加上,没有帮助。

  6. #6
    Registered User
    Join Date
    Mar 2009
    Posts
    9

    Re: 程序启动报告错误"因安全原因,无法执行文件"

    在程序里加日志跟踪,发现问题的根源是一个比较隐蔽的BUG。
    TBuf<32> tmp;
    tmp.AppendNum(KAppUid.iUid, EHex);
    path.Append(tmp.Mid(8));
    这段代码在 KAppUid 是 0xA0... 和 0x20... 的情况下执行结果是不一样的。
    原因是AppendNum接受的参数是TUint64,传一个 TUint32 进去做类型转换,对 >=0x8000000 的数前面会用 ffffffff 补齐,得到的字符串长度是16。而 0x20... 这样的数,结果是8个字符。

    修改为下面的代码解决问题:
    tmp.Format(_L("%x"), KAppUid.iUid);
    path.Append(tmp);
    谢谢大家的关注,谢谢 qxiaoyuan 的帮助

  7. #7
    Super Contributor
    Join Date
    Jul 2007
    Location
    ShenZhen, China
    Posts
    4,346

    Re: 程序启动报告错误"因安全原因,无法执行文件"

    晕, 还有这一说, 学习了
    ----------------------------
    坚持学习, 坚持编码
    http://www.devdiv.net/
    qxiaoyuan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×