无忧启动论坛

 找回密码
 注册
搜索

如何将VC程序标准库添加到PE中

查看数: 6657 | 评论数: 15 | 收藏 1
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2016-3-24 11:27

正文摘要:

自己编写了一个VC程序,需要用到VC的标准库,但是PE环境中没有这些库,请问如何可以把这些库添加到PE中?

回复

cnpirate 发表于 2016-3-30 14:16:44
yfwang0798 发表于 2016-3-30 13:09
前面介绍的网站下载软件包中有帮助文件,最简单的语法
http://reboot.pro/topic/4424-app-scripts-guide-c ...

非常感谢啊
yfwang0798 发表于 2016-3-30 13:09:05
前面介绍的网站下载软件包中有帮助文件,最简单的语法
http://reboot.pro/topic/4424-app ... g-a-new-app-script/

也可以参考别人制作的脚本学习。

点评

非常感谢啊  详情 回复 发表于 2016-3-30 14:16
cnpirate 发表于 2016-3-30 09:53:18
yfwang0798 发表于 2016-3-29 17:23
国外这个网站有现成的软件,包含notepad等组件。

http://theoven.org/index.php?PHPSESSID=c2e332fdd9 ...

能提供学习winbuilder语法的资料么,嘿嘿,^_^
yfwang0798 发表于 2016-3-29 17:23:08
国外这个网站有现成的软件,包含notepad等组件。

http://theoven.org/index.php?PHP ... c490083859460d7efa;

它提供的notepad,没有数字签名,不是微软的,但是可以在pe中运行。只要会winbuilder语法,就可以自己定制pe。

点评

能提供学习winbuilder语法的资料么,嘿嘿,^_^  详情 回复 发表于 2016-3-30 09:53
cnpirate 发表于 2016-3-29 12:06:10
slore 发表于 2016-3-29 11:30
你确定你的/MT设定到release|x64的配置上了么?
/MT的话运行库是直接编译到exe程序里面的。

嗯嗯,我确认,因为我把程序中某些代码注释掉,程序可以正确执行的。
slore 发表于 2016-3-29 11:30:03
cnpirate 发表于 2016-3-29 11:26
添加文件和导入注册表后,在PE环境下,打开文本文件,提示:
The application has failed to start beca ...

你确定你的/MT设定到release|x64的配置上了么?
/MT的话运行库是直接编译到exe程序里面的。

点评

嗯嗯,我确认,因为我把程序中某些代码注释掉,程序可以正确执行的。  详情 回复 发表于 2016-3-29 12:06
cnpirate 发表于 2016-3-29 11:26:08
yfwang0798 发表于 2016-3-25 20:30
以前在pe3 x86集成vc相关文件和注册表设置,用于适用active password changer  6.01,64位应该类似:
要添 ...

添加文件和导入注册表后,在PE环境下,打开文本文件,提示:
The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.
起初,我以为是注册表导入的不对,但是换一个机器的注册表,还是一样的错误

使用sxstrace.exe获得log文件如下:

=================
Begin Activation Context Generation.
Input Parameter:
        Flags = 0
        ProcessorArchitecture = AMD64
        CultureFallBacks = en-US;en
        ManifestPath = X:\windows\system32\NOTEPAD.EXE
        AssemblyDirectory = X:\windows\system32\
        Application Config File =
-----------------
INFO: Parsing Manifest File X:\windows\system32\NOTEPAD.EXE.
        INFO: Manifest Definition Identity is Notepad2,type="win32",version="5.1.0.0".
        INFO: Reference: Microsoft.Windows.Common-Controls,language="&#x2a;",processorArchitecture="&#x2a;",publicKeyToken="6595b64144ccf1df",type="win32",version="6.0.0.0"
INFO: Resolving reference Microsoft.Windows.Common-Controls,language="&#x2a;",processorArchitecture="&#x2a;",publicKeyToken="6595b64144ccf1df",type="win32",version="6.0.0.0".
        INFO: Resolving reference for ProcessorArchitecture AMD64.
                INFO: Resolving reference for culture en-US.
                        INFO: Applying Binding Policy.
                                INFO: No publisher policy found.
                                INFO: No binding policy redirect found.
                        INFO: Begin assembly probing.
                                INFO: Did not find the assembly in WinSxS.
                                INFO: Attempt to probe manifest at X:\windows\assembly\GAC_64\Microsoft.Windows.Common-Controls\6.0.0.0_en-US_6595b64144ccf1df\Microsoft.Windows.Common-Controls.DLL.
                                INFO: Attempt to probe manifest at X:\windows\system32\en-US\Microsoft.Windows.Common-Controls.DLL.
                                INFO: Attempt to probe manifest at X:\windows\system32\en-US\Microsoft.Windows.Common-Controls.MANIFEST.
                                INFO: Attempt to probe manifest at X:\windows\system32\en-US\Microsoft.Windows.Common-Controls\Microsoft.Windows.Common-Controls.DLL.
                                INFO: Attempt to probe manifest at X:\windows\system32\en-US\Microsoft.Windows.Common-Controls\Microsoft.Windows.Common-Controls.MANIFEST.
                                INFO: Did not find manifest for culture en-US.
                        INFO: End assembly probing.
                INFO: Resolving reference for culture en.
                        INFO: Applying Binding Policy.
                                INFO: No publisher policy found.
                                INFO: No binding policy redirect found.
                        INFO: Begin assembly probing.
                                INFO: Did not find the assembly in WinSxS.
                                INFO: Attempt to probe manifest at X:\windows\assembly\GAC_64\Microsoft.Windows.Common-Controls\6.0.0.0_en_6595b64144ccf1df\Microsoft.Windows.Common-Controls.DLL.
                                INFO: Did not find manifest for culture en.
                        INFO: End assembly probing.
                INFO: Resolving reference for culture Neutral.
                        INFO: Applying Binding Policy.
                                INFO: Auto Servicing Policy redirected assembly version.
                                INFO: Post policy assembly identity is Microsoft.Windows.Common-Controls,processorArchitecture="AMD64",publicKeyToken="6595b64144ccf1df",type="win32",version="6.0.7601.18837".
                        INFO: Begin assembly probing.
                                INFO: Attempt to probe manifest at X:\windows\WinSxS\manifests\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.18837_none_fa3b1e3d17594757.manifest.
                                INFO: Attempt to probe manifest at X:\windows\assembly\GAC_64\Microsoft.Windows.Common-Controls\6.0.7601.18837__6595b64144ccf1df\Microsoft.Windows.Common-Controls.DLL.
                                INFO: Attempt to probe manifest at X:\windows\system32\Microsoft.Windows.Common-Controls.DLL.
                                INFO: Attempt to probe manifest at X:\windows\system32\Microsoft.Windows.Common-Controls.MANIFEST.
                                INFO: Attempt to probe manifest at X:\windows\system32\Microsoft.Windows.Common-Controls\Microsoft.Windows.Common-Controls.DLL.
                                INFO: Attempt to probe manifest at X:\windows\system32\Microsoft.Windows.Common-Controls\Microsoft.Windows.Common-Controls.MANIFEST.
                                INFO: Did not find manifest for culture Neutral.
                        INFO: End assembly probing.
        INFO: Resolving reference for ProcessorArchitecture MSIL.
                INFO: Resolving reference for culture en-US.
                        INFO: Applying Binding Policy.
                                INFO: No publisher policy found.
                                INFO: No binding policy redirect found.
                        INFO: Begin assembly probing.
                                INFO: Did not find the assembly in WinSxS.
                                INFO: Attempt to probe manifest at X:\windows\assembly\GAC_MSIL\Microsoft.Windows.Common-Controls\6.0.7601.18837_en-US_6595b64144ccf1df\Microsoft.Windows.Common-Controls.DLL.
                                INFO: Did not find manifest for culture en-US.
                        INFO: End assembly probing.
                INFO: Resolving reference for culture en.
                        INFO: Applying Binding Policy.
                                INFO: No publisher policy found.
                                INFO: No binding policy redirect found.
                        INFO: Begin assembly probing.
                                INFO: Did not find the assembly in WinSxS.
                                INFO: Attempt to probe manifest at X:\windows\assembly\GAC_MSIL\Microsoft.Windows.Common-Controls\6.0.7601.18837_en_6595b64144ccf1df\Microsoft.Windows.Common-Controls.DLL.
                                INFO: Did not find manifest for culture en.
                        INFO: End assembly probing.
                INFO: Resolving reference for culture Neutral.
                        INFO: Applying Binding Policy.
                                INFO: No publisher policy found.
                                INFO: No binding policy redirect found.
                        INFO: Begin assembly probing.
                                INFO: Did not find the assembly in WinSxS.
                                INFO: Attempt to probe manifest at X:\windows\assembly\GAC_MSIL\Microsoft.Windows.Common-Controls\6.0.7601.18837__6595b64144ccf1df\Microsoft.Windows.Common-Controls.DLL.
                                INFO: Did not find manifest for culture Neutral.
                        INFO: End assembly probing.
        INFO: Resolving reference for ProcessorArchitecture Data.
                INFO: Resolving reference for culture en-US.
                        INFO: Applying Binding Policy.
                                INFO: No publisher policy found.
                                INFO: No binding policy redirect found.
                        INFO: Begin assembly probing.
                                INFO: Did not find the assembly in WinSxS.
                                INFO: Attempt to probe manifest at X:\windows\assembly\GAC\Microsoft.Windows.Common-Controls\6.0.7601.18837_en-US_6595b64144ccf1df\Microsoft.Windows.Common-Controls.DLL.
                                INFO: Did not find manifest for culture en-US.
                        INFO: End assembly probing.
                INFO: Resolving reference for culture en.
                        INFO: Applying Binding Policy.
                                INFO: No publisher policy found.
                                INFO: No binding policy redirect found.
                        INFO: Begin assembly probing.
                                INFO: Did not find the assembly in WinSxS.
                                INFO: Attempt to probe manifest at X:\windows\assembly\GAC\Microsoft.Windows.Common-Controls\6.0.7601.18837_en_6595b64144ccf1df\Microsoft.Windows.Common-Controls.DLL.
                                INFO: Did not find manifest for culture en.
                        INFO: End assembly probing.
                INFO: Resolving reference for culture Neutral.
                        INFO: Applying Binding Policy.
                                INFO: No publisher policy found.
                                INFO: No binding policy redirect found.
                        INFO: Begin assembly probing.
                                INFO: Did not find the assembly in WinSxS.
                                INFO: Attempt to probe manifest at X:\windows\assembly\GAC\Microsoft.Windows.Common-Controls\6.0.7601.18837__6595b64144ccf1df\Microsoft.Windows.Common-Controls.DLL.
                                INFO: Did not find manifest for culture Neutral.
                        INFO: End assembly probing.
        ERROR: Cannot resolve reference Microsoft.Windows.Common-Controls,language="&#x2a;",processorArchitecture="&#x2a;",publicKeyToken="6595b64144ccf1df",type="win32",version="6.0.0.0".
ERROR: Activation Context generation failed.
End Activation Context Generation.

=================
Begin Activation Context Generation.
Input Parameter:
        Flags = 0
        ProcessorArchitecture = AMD64
        CultureFallBacks = en-US;en
        ManifestPath = X:\windows\system32\ndfapi.dll
        AssemblyDirectory = X:\windows\system32\
        Application Config File =
-----------------
INFO: Parsing Manifest File X:\windows\system32\ndfapi.dll.
        INFO: Manifest Definition Identity is ndfapi,processorArchitecture="amd64",type="win32",version="1.0.0.0".
        INFO: Reference: Microsoft.Windows.Common-Controls,language="&#x2a;",processorArchitecture="amd64",publicKeyToken="6595b64144ccf1df",type="win32",version="6.0.0.0"
INFO: Resolving reference Microsoft.Windows.Common-Controls,language="&#x2a;",processorArchitecture="amd64",publicKeyToken="6595b64144ccf1df",type="win32",version="6.0.0.0".
        INFO: Resolving reference for ProcessorArchitecture amd64.
                INFO: Resolving reference for culture en-US.
                        INFO: Applying Binding Policy.
                                INFO: No publisher policy found.
                                INFO: No binding policy redirect found.
                        INFO: Begin assembly probing.
                                INFO: Did not find the assembly in WinSxS.
                                INFO: Attempt to probe manifest at X:\windows\assembly\GAC_64\Microsoft.Windows.Common-Controls\6.0.0.0_en-US_6595b64144ccf1df\Microsoft.Windows.Common-Controls.DLL.
                                INFO: Attempt to probe manifest at X:\windows\system32\en-US\Microsoft.Windows.Common-Controls.DLL.
                                INFO: Attempt to probe manifest at X:\windows\system32\en-US\Microsoft.Windows.Common-Controls.MANIFEST.
                                INFO: Attempt to probe manifest at X:\windows\system32\en-US\Microsoft.Windows.Common-Controls\Microsoft.Windows.Common-Controls.DLL.
                                INFO: Attempt to probe manifest at X:\windows\system32\en-US\Microsoft.Windows.Common-Controls\Microsoft.Windows.Common-Controls.MANIFEST.
                                INFO: Did not find manifest for culture en-US.
                        INFO: End assembly probing.
                INFO: Resolving reference for culture en.
                        INFO: Applying Binding Policy.
                                INFO: No publisher policy found.
                                INFO: No binding policy redirect found.
                        INFO: Begin assembly probing.
                                INFO: Did not find the assembly in WinSxS.
                                INFO: Attempt to probe manifest at X:\windows\assembly\GAC_64\Microsoft.Windows.Common-Controls\6.0.0.0_en_6595b64144ccf1df\Microsoft.Windows.Common-Controls.DLL.
                                INFO: Did not find manifest for culture en.
                        INFO: End assembly probing.
                INFO: Resolving reference for culture Neutral.
                        INFO: Applying Binding Policy.
                                INFO: Auto Servicing Policy redirected assembly version.
                                INFO: Post policy assembly identity is Microsoft.Windows.Common-Controls,processorArchitecture="amd64",publicKeyToken="6595b64144ccf1df",type="win32",version="6.0.7601.18837".
                        INFO: Begin assembly probing.
                                INFO: Attempt to probe manifest at X:\windows\WinSxS\manifests\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.18837_none_fa3b1e3d17594757.manifest.
                                INFO: Attempt to probe manifest at X:\windows\assembly\GAC_64\Microsoft.Windows.Common-Controls\6.0.7601.18837__6595b64144ccf1df\Microsoft.Windows.Common-Controls.DLL.
                                INFO: Attempt to probe manifest at X:\windows\system32\Microsoft.Windows.Common-Controls.DLL.
                                INFO: Attempt to probe manifest at X:\windows\system32\Microsoft.Windows.Common-Controls.MANIFEST.
                                INFO: Attempt to probe manifest at X:\windows\system32\Microsoft.Windows.Common-Controls\Microsoft.Windows.Common-Controls.DLL.
                                INFO: Attempt to probe manifest at X:\windows\system32\Microsoft.Windows.Common-Controls\Microsoft.Windows.Common-Controls.MANIFEST.
                                INFO: Did not find manifest for culture Neutral.
                        INFO: End assembly probing.
        ERROR: Cannot resolve reference Microsoft.Windows.Common-Controls,language="&#x2a;",processorArchitecture="amd64",publicKeyToken="6595b64144ccf1df",type="win32",version="6.0.0.0".
ERROR: Activation Context generation failed.

End Activation Context Generation.



点评

你确定你的/MT设定到release|x64的配置上了么? /MT的话运行库是直接编译到exe程序里面的。  详情 回复 发表于 2016-3-29 11:30
cnpirate 发表于 2016-3-28 16:21:04
yfwang0798 发表于 2016-3-25 20:30
以前在pe3 x86集成vc相关文件和注册表设置,用于适用active password changer  6.01,64位应该类似:
要添 ...

按照你说的方法,我把Windows\winsxs下所有包含amd64和vc字符的文件,以及Windows\winsxs\manifests文件下包含amd64和vc字符的文件导入到PE中,并且将注册表也导入,我的程序可以在PE环境下运行了。

非常感谢,谢谢
yfwang0798 发表于 2016-3-25 20:30:30
本帖最后由 yfwang0798 于 2016-3-25 20:34 编辑

以前在pe3 x86集成vc相关文件和注册表设置,用于适用active password changer  6.01,64位应该类似:
要添加的文件位置
Windows\winsxs 下所有包含 x86 和 vc 字符的文件夹,如
x86_microsoft-windows-vcm-core-codecs_31bf3856ad364e35_6.1.7601.17514_none_6eaa2afd36b1e303
等几个文件夹
Windows\winsxs\manifests 文件夹下包含 x86 和vc名字的文件。例如x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.4940_none_d08cc06a442b34fc.manif  等文件。


要添加的注册表位置
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide\Winners
下所有包含 x86和vc的注册表。



点评

添加文件和导入注册表后,在PE环境下,打开文本文件,提示: The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the comma  详情 回复 发表于 2016-3-29 11:26

评分

参与人数 1无忧币 +5 收起 理由
cnpirate + 5 很给力!

查看全部评分

2012tzyx 发表于 2016-3-25 18:49:32
本帖最后由 2012tzyx 于 2016-3-25 18:58 编辑

vc2008还需要注册表的吧。要么就还得加几个manifest文件。
试试用dependency walker找找依赖。
lxl1638 发表于 2016-3-24 19:39:54
frg521 发表于 2016-3-24 17:38
请问老师的RcData压缩资源工具可以分享吗?compress.exe吗?如果那个文件不可单独运行,还请带上附属文件,谢 ...

压缩/解压,代码都是PECMD内置的,就是LZMA命令的代码,这个代码网上有,以前我在时空论坛发过类似的代码。另一个是自己如何读取资源数据,网上也有代码——PE文件头格式。

点评

几乎找遍那个帖子,没有看到繁体化译者与你提到如何解压,倒是你提到,还有截图是无图标的compress.exe 是你提供给工具的吧? 否则lzma.exe或7z解压不了,用pecmd.exe如何压缩呢,90多条命令也没找到,最后就是不会使用vc6  详情 回复 发表于 2016-3-25 05:42
lxl1638 发表于 2016-3-24 16:50:16
cnpirate 发表于 2016-3-24 14:14
自己写的那个程序没有使用.net,也没有使用MFC,而且也改成/MT编译了,但是在PE运行时,还是0xC0150002错 ...

如果这样,你知道要那些库,头文件已一一列出

点评

请问老师的RcData压缩资源工具可以分享吗?compress.exe吗?如果那个文件不可单独运行,还请带上附属文件,谢谢  详情 回复 发表于 2016-3-24 17:38
cnpirate 发表于 2016-3-24 14:14:43
slore 发表于 2016-3-24 12:44
不使用.net,不使用MFC,纯WIN32程序的话,/MT编译就可以直接PE用。

自己写的那个程序没有使用.net,也没有使用MFC,而且也改成/MT编译了,但是在PE运行时,还是0xC0150002错误。网上说这个错误,表示库文件缺失。因此我想把VC下的库文件都加入到PE中,看看能不能解决这个问题。

点评

下载procmon监控看在PE下调用缺少文件,另外用资源编辑软件查看调用哪些dll是非系统内核的,补充就可以的启动必需文件一般在导入表看看见  发表于 2016-3-24 17:41
如果这样,你知道要那些库,头文件已一一列出  详情 回复 发表于 2016-3-24 16:50
slore 发表于 2016-3-24 12:44:33
不使用.net,不使用MFC,纯WIN32程序的话,/MT编译就可以直接PE用。

小黑屋|手机版|Archiver|捐助支持|无忧启动 ( 闽ICP备05002490号-1 )

闽公网安备 35020302032614号

GMT+8, 2024-11-28 21:40

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表