VS2010清楚地编译了可执行文件和路径段 [英] VS2010 compiled executables AND path segments in the clear

查看:226
本文介绍了VS2010清楚地编译了可执行文件和路径段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否存在我忽略的编译器/链接器设置/命令行开关,从而消除了对计算机的这些引用?

在我看来,该信息被归类为个人"类型,甚至早在从界面内部创建项目时就应该轻松消除,即使不是通过VS,也可以通过比基本二进制编辑器更复杂的方法来消除. >
...在C ++中,现在...不一定要进行管理...

Is there a compiler/linker setting/command-line-switch which I''m overlooking that would eliminate these references to my computer?

It seems to me that this information qualifies as type "personal" and should easily be eliminated, even as early as project creation from within the interface, if not by VS then by something a bit more sophisticated than a basic binary editor.

... in C++, now ... not necessarily managed ...

推荐答案

是否可以打开调试信息的生成?

这是在调试模式下进行构建时的默认设置,如果要分发.exe,则在发布模式下进行构建具有更好的设置.
Could it be that you have generation of debug info turned on?

This is the default setting when building in debug mode, building in release mode has better settings if you want to distribute your .exe.


如果您的意思是C ++链接,则其中没有文件路径.使用.仅存储DLL名称.在运行时,存在预定义的搜索路径,可在其中搜索所需的DLL.因此,如果您担心分布式可执行文件将揭示您的文件系统结构,那么不用担心,发生这种情况的风险为零.

根据您的响应,看来您可能正在寻找一个调试版本,该版本确实比发布版本具有更多信息.我仍然惊讶于您找到了完整的编译器命令行.就是说,您只需要分发二进制文件的发行版,实际上,您永远都不应分发调试模式的可执行文件.


好的,看来您指的是PDB路径.您可以使用以下开关/PDBALTPATH 手动将其设置为无路径字符串:

http://msdn.microsoft.com/en-us/library/dd998269.aspx [ ^ ]

尝试一下,看看是否仍然有问题.


从您的1票和您的愤怒评论中,您似乎将上述开关误认为是垃圾桶开关.不是.我给你的是一个VC ++链接器开关,可用于防止将pdb文件的完整路径插入到生成的二进制文件中.如果看到此编辑,请尝试一下.



我认为这里沟通不畅.这是默认情况下发生的情况(我刚刚使用VC ++ 2010进行了验证).

我创建了一个新的MFC项目,并构建了一个发布模式可执行文件(将所有设置保留为默认设置).生成的exe具有pdb文件的完整路径,该文件确实揭示了文件系统信息.

我添加了带有虚拟pdb名称的上述链接器开关:

/PDBALTPATH:dummyfile.pdb
 

我重建了exe,并在二进制编辑器中将其打开.这次路径信息不见了.

这不是您想做的吗?是的,我在这里谈论发布模式.
If you mean C++ linkage, there are no file paths in use at all. Only the DLL names are stored. At runtime, there are predefined search paths where the required DLLs are searched for. So if your fear is that distributed executables will reveal your file system structure, then don''t worry, there is zero risk of that happening.

Based on your response, it seems you may be looking at a debug build which will indeed have more information in it than a release build would. I am still surprised that you found the full compiler command line. That said, you will only ever need to distribute release builds of your binaries, and in fact you should never distribute a debug mode executable.


Okay, it seems you are referring to the PDB path. You can set this manually to a path-less string using the following switch /PDBALTPATH:

http://msdn.microsoft.com/en-us/library/dd998269.aspx[^]

Try that and see if you still have the problem.


From your 1 vote and your angry comment, it seems you have mistaken the above switch to be a dumpbin switch. It''s not. What I gave you is a VC++ linker switch that can be used to prevent the full path to the pdb file from being inserted into the generated binary. Do give it a shot if you see this edit.



I think there is a miscommunication here. Here''s what happens by default (I just verified this with VC++ 2010).

I created a new MFC project, and built a release mode executable (leaving all settings as default). The generated exe had the full path to the pdb file which did reveal file system info.

I added the above mentioned linker switch with a dummy pdb name:

/PDBALTPATH:dummyfile.pdb
 

I rebuilt the exe, and opened it in a binary editor. This time the path information was gone.

Isn''t this what you want to do? And yes, I am talking about release mode here.


以下是有关该主题的一些信息,底部有一些链接
http://www.mail-archive.com/openssl-dev@openssl.org/msg27691.html [ ^ ]

这是一种商业选择:
http://www.heaventools.com/remove-debug-information.htm [ ^ ]

您还可以搜索PE可执行文件的strip命令的版本

也许这会有所帮助:
/PDBSTRIPPED(带专用符号) [ .PDB文件和.DBG文件的描述中复制 [
Here is some info on the subject with some links at the bottom
http://www.mail-archive.com/openssl-dev@openssl.org/msg27691.html[^]

and here is a commercial option:
http://www.heaventools.com/remove-debug-information.htm[^]

you can also search for a version of the strip command for PE executables

Maybe this will help:
/PDBSTRIPPED (Strip Private Symbols)[^]

Update: copied from Description of the .PDB files and of the .DBG files[^]:
It is possible to strip debug information from a PE file and store it in a .DBG file for use by debuggers. For this to work, the debugger needs to know whether to find the debug information in a separate file or not and whether the information has been stripped from the file or not. One method would be for the debugger to search through the executable file looking for debug information. However, to save the debugger from having to search the file, a file characteristic field (IMAGE_FILE_DEBUG_STRIPPED) was invented that indicates that the file has been stripped. Debuggers can look for this field in the PE file header to quickly determine whether the debug information is present in the file or not.

To generate a .DBG file in this format, you can use REBASE.EXE, which is provided with the Win32 SDK. Please see the Win32 SDK documentation for more details.


Downvoting people who actually try to help you doesn''t leave us with a warm fuzzy feeling, neither does it motivate us to help you.


Regards
Espen Harlinn


这篇关于VS2010清楚地编译了可执行文件和路径段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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