Removing Sensitive Paths from Executable (.exe) Topic is solved

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
purplex88
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 247
Joined: Mon Feb 24, 2014 3:14 pm

Removing Sensitive Paths from Executable (.exe)

Post by purplex88 »

I'm using Visual Studio v11 to statically link libraries to produce an executable file in release mode. Upon analyzing it in Hex editor mode I found some paths which point to the wxWidgets library E.g. C:\Users\Purplex\AppData\Roaming\wxWidgets-3.0.0\include\wx/strvararg.h and 48 other files in same path.

So, what I did was to move my "wxWidgets-3.0.0" directory to another location and start a project from scratch and rebuild it. But still the same paths are showing up even when the above path isn't a valid location anymore. How can I strip this extra information and clean up or reduce the size a bit if possible?
eranif
Moderator
Moderator
Posts: 610
Joined: Tue Nov 29, 2005 7:10 pm
Location: Israel

Re: Removing Sensitive Paths from Executable (.exe)

Post by eranif »

Have you tried running strip.exe on your code?
It should remove all extra strings from the executable
IDE: CodeLite + wxCrafter
OS: All
https://wxcrafter.codelite.org
https://codelite.org
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Removing Sensitive Paths from Executable (.exe)

Post by PB »

Just a wild guess, aren't those paths there to be eventually used with wxASSERT and such? These may be compiled in even, in the release mode, unless wxWidgets were built with wxDEBUG_LEVEL is set to 0 in wx/msw/setup.h.

If you want the paths to change, you probably have to rebuild wxWidgets themselves from the new path, not just your project.
purplex88
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 247
Joined: Mon Feb 24, 2014 3:14 pm

Re: Removing Sensitive Paths from Executable (.exe)

Post by purplex88 »

Isn't "strip.exe" part of GNU project? If so, then should it work to remove debug info from Visual Studio executable?

I just re-built the wxWidgets libraries and set the debug level to 0 and it seems the paths are all cleared. Is there still way to further strip the debug symbols used by Visual Studio v11?
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Removing Sensitive Paths from Executable (.exe)

Post by doublemax »

AFAIK you don't need an external tool like this for VS. Just check the settings under project properties -> Linker -> Debugging
Use the source, Luke!
purplex88
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 247
Joined: Mon Feb 24, 2014 3:14 pm

Re: Removing Sensitive Paths from Executable (.exe)

Post by purplex88 »

I don't know what went wrong but in one of my project solutions the "wxWidgets debug errors" have completely stopped both in debug and release mode after I edited "wx/msw/setup.h" to set the wxDEBUG_LEVEL to 0.

But in my other project, they won't go away both in debug and release build.

I have checked the Preprocessor definitions and they are same for both of the projects with NDEBUG only defined for release builds.

Here's how:
10-Sep-14 1-06-06 PM.jpg
10-Sep-14 1-06-06 PM.jpg (70.83 KiB) Viewed 10792 times
For both projects built in debug mode, one of them shows this:
10-Sep-14 1-06-31 PM.jpg
10-Sep-14 1-06-31 PM.jpg (9.27 KiB) Viewed 10792 times
and other one:
10-Sep-14 1-08-04 PM.jpg
10-Sep-14 1-08-04 PM.jpg (11.9 KiB) Viewed 10792 times
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Removing Sensitive Paths from Executable (.exe)

Post by PB »

Something must be really wrong here, as the debug messages should still pop up in configurations where NDEBUG is not defined in the project settings. Also both projects have to behave the same as long as they have same project settings and link with the same wxWidgets build. Just to be sure, you do realize you have to set NDEBUG in your project settings too (in the release configuration, matching the wxWidgets build you link against)?

After any change in wx/msw/setup.h be sure to clean and rebuild wxWidgets and check if the setup.h file was properly copied into the build directories (e.g. lib\vc_dll\mswu\wx for release shared build) do match.
purplex88
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 247
Joined: Mon Feb 24, 2014 3:14 pm

Re: Removing Sensitive Paths from Executable (.exe)

Post by purplex88 »

I already deleted the other wxWidgets build and rebuilt the projects several times.

But still it should only show the "Debug dialog" only in debug mode and switching from debug to release mode built has no affect.
So, the same debug dialog is still shown in release mode.

Here are my processors from debug mode:
WIN32
_DEBUG
_WINDOWS
_UNICODE
__WXMSW__
__WXDEBUG__
WXUSINGDLL
and release mode:
WIN32
_WINDOWS
__WXMSW__
_UNICODE
NDEBUG
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Removing Sensitive Paths from Executable (.exe)

Post by PB »

Well then, I am out of ideas, assuming you didn't somewhat manage to link to debug build version even in the release build of your project.
purplex88
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 247
Joined: Mon Feb 24, 2014 3:14 pm

Re: Removing Sensitive Paths from Executable (.exe)

Post by purplex88 »

I created a project this time and added the preprocessors as above with include and library paths to the new wxWidgets build

and then I edit all the setup.h files in the following paths:
wxWidgets-3.0.0\lib\vc_dll\mswud\wx\setup.h
wxWidgets-3.0.0\lib\vc_lib\mswu\wx\setup.h
wxWidgets-3.0.0\lib\vc_lib\mswud\wx\setup.h
wxWidgets-3.0.0\include\wx\msw\setup.h
But still the same "debug" dialog shows in release build.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Removing Sensitive Paths from Executable (.exe)

Post by PB »

AFAIK for what you need it should be enough to change the master setup.h in include/wx/msw, which is then copied to the respective lib directories during their build process. Just to be sure I say it again, after any change in the setup.h, you have to rebuild wxWidgets clean.

Anyway, the error dialog posted in your screenshots does not look like a debug message. It looks as a standard error message produced by wxLogError() or similar. To suppress these, use wxLogNull class in general. To avoid this one error message do not attempt to add an invalid image to a list, e.g. do not add bitmaps for which IsOk() returns false.
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Removing Sensitive Paths from Executable (.exe)

Post by doublemax »

Messages like "Couldn't add an image to the image list." are not debug messages. There are similar (annoying) messages when you open a file that doesn't exist or want to open a registry key under windows that doesn't exist. They will appear in both debug in release versions unless you wrap the code with a wxLogNull instance or disable logging completely in release mode.

Code: Select all

#ifndef _DEBUG
	wxLog::SetLogLevel(0);
#endif
Use the source, Luke!
Rytz
Earned a small fee
Earned a small fee
Posts: 22
Joined: Wed May 17, 2006 10:27 pm

Re: Removing Sensitive Paths from Executable (.exe)

Post by Rytz »

Necro-ing this thread to add a tidbit.

Defining/setting wxDEBUG_LEVEL to zero in setup.h for my build got rid of most of the path strings in my executable. To get the remainder, I needed to also define/set wxUSE_LOG to zero. An example of this requirement was for the following:

Code: Select all

wxOleInitialize
<MY_BUILD_PATH>wx/msw/ole/oleutils.h
Cannot initialize OLE
Only way I could get rid of the line with "oleutils.h" was to disable logging.
Post Reply