Click here to Skip to main content
15,890,282 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
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 ...
Posted
Updated 13-Jan-11 8:56am
v2
Comments
Espen Harlinn 13-Jan-11 14:32pm    
??? isn't there something missing from this ???
Sergey Alexandrovich Kryukov 13-Jan-11 14:37pm    
Where do you see "personal" references: in source files or executables?
Chris Meech 13-Jan-11 14:41pm    
What do you mean by path segments?
RedDk 13-Jan-11 17:50pm    
... post answer question ... How does one go about Improving questions ore than one time? (Don't answer that)

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.
 
Share this answer
 
Comments
Espen Harlinn 13-Jan-11 15:53pm    
5+ sounds entirely reasonable
RedDk 13-Jan-11 15:53pm    
Program Database information switches are available when compiling in release mode but that's besides the point. /Zi is the current setting. What do you use?
[no name] 13-Jan-11 15:56pm    
They are available, I didn't mean to claim they weren't, but by default they're off.
To not have any debug info, you can remove the /Zi switch.
RedDk 13-Jan-11 16:00pm    
blanked it as you proscribe, path is still there ...
RedDk 13-Jan-11 16:03pm    
commandline:

/nologo /W3 /WX- /O2 /Oi /Oy- /GL /D "_MBCS" /Gm- /EHsc /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Fp"Release\(project).pch" /Fa"Release\" /Fo"Release\" /Fd"Release\(project).pdb" /Gd /analyze- /errorReport:queue
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.

[Edit]
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.

[Edit]
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.

[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.
 
Share this answer
 
v5
Comments
RedDk 13-Jan-11 16:19pm    
Just tried PP/Configprop/linker/debugging/generate dbg info = NO (previously YES) ... partial solution! The "findable" path is now absent. Unfortuneatly, the wide-character path is still present.
RedDk 13-Jan-11 16:22pm    
I see my full path in the linker commandline!
How can I make that go away? That's surely the reason why it's being output. Where am I allowed to "../" in the VVisual Studio interface?
RedDk 13-Jan-11 16:35pm    
MAC Address Finder demo executable (straight off cdprjct ... debug/release not withstanding:
path:
c:\documents and settings\Nish\My Documents\Visual Studio\Projects\MACAddressChanger\MACAddressChanger\Release\MACAddressChanger.(pdb)

Now I'm really confused.
Nish Nishant 13-Jan-11 16:43pm    
I've updated my answer.
RedDk 13-Jan-11 17:02pm    
Forget about it. DUMPBIN? Why can't anybody address the Visual Studio commandline? Talking a switch here. I've used your program for an example! Didn't use Visual Studio to pipe that one into codeproject?
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
 
Share this answer
 
v3
Comments
RedDk 13-Jan-11 16:05pm    
commandline:
/nologo /W3 /WX- /O2 /Oi /Oy- /GL /D "_MBCS" /Gm- /EHsc /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Fp"Release\(project).pch" /Fa"Release\" /Fo"Release\" /Fd"Release\(project).pdb" /Gd /analyze- /errorReport:queue
RedDk 13-Jan-11 16:10pm    
From ACEDotNetDemo c# ... commandline snippet:
/Zi /clr /nologo /W3 /WX- /Od /Oy- /D "WIN32" /D "_DEBUG" /D "_UNICODE" /D

Don't use /Zi? I know, this is debug. Says so.
RedDk 13-Jan-11 17:28pm    
Thanks for that add. still searching ...
RedDk 13-Jan-11 18:16pm    
Problem solved Espen, thank-you for you're undivided attention. See Answer 4.
Three questions as answers; try to target all of them at once ...

If you dump your executable into a binary editor you see that the path your compiler uses to assemble and link your program is found there. And not only is the path found once but it's found twice.

Note that a binary search of the segmentone would like to eliiminate will obviously return a regular constituent character's size. But the path is also "characterized" in what appears to be wide size too (hence no search results).

Seems personal enough, yes?

Take "APIHookingSample_Executables.zip" fregzample (Adam Roderick - codeproject) ...

The path (a file):

"F:\Codeproject\LoadLibraryHooking\DLLCheck\Release\DLLCh3eck.pdb"
 
Share this answer
 
v2
Comments
[no name] 13-Jan-11 15:43pm    
With your extra information it's safe to say it's indeed debug info; .pdb files contain debug information. Building in release mode should remove this.
RedDk 13-Jan-11 15:46pm    
... hmm .. "Improve Answer" doesn't seem to update so:

There's a Tools/Options/Build&Run/Verbosity = Quiet which still doesn't remedy the appearance in the release version.

(And that's "DLLCheck.pdb" ... no "3")
Answer to my question (still can't seem edit this original post). Thanks all for the clues.

I've eliminated both references to personal info (as path). Void all references to any .pdb. You can ignore references to manifests; doesn't seem to affect anything. And the clincher I think -> restart Visual Studio after any tools/options alterations!

I think the second path reference was eliminated once the VERBOSE was set to "Quiet" way back in the beginning after shelling out to the IDE @ step #01!

So ... to repeat a maxim: "Expect good things once a restart is applied"
 
Share this answer
 
Comments
Espen Harlinn 13-Jan-11 18:22pm    
A 2? based on the effort and the info you provided, well, ehrrrm ... it's not like we're getting paid for this you know.
RedDk 13-Jan-11 18:26pm    
Hey, if could hit my own button Buddy I would.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900