Board index » cppbuilder » Re: Adding a integer (counting) value to a compiled application..UPX problem..

Re: Adding a integer (counting) value to a compiled application..UPX problem..


2004-04-04 09:00:38 AM
cppbuilder39
"Oren Halvani" < XXXX@XXXXX.COM >wrote:
Quote
Is it maybe possible to store the value in a uncompressed area...?
for example in the application-header ? or do you have another idea how to
solve that problem..?
You might store your value as a resource and then tell upx not to compress
resources. There is command-line switch to control that, see upx docs.
Hernan Tornielli
 
 

Re:Re: Adding a integer (counting) value to a compiled application..UPX problem..

"Hernán Tornielli" < XXXX@XXXXX.COM >wrote:
Quote
You might store your value as a resource and then tell upx
not to compress resources.
That's the solution and most likely the only solution.
~ JD
 

Re:Re: Adding a integer (counting) value to a compiled application..UPX problem..

seems not to be the "best" solution, because the resources causes my
programm
to get a size of over 4 MByte..thats why I use upx ! to compress the
resources and
extract them only in runtime of the application :-(
- maybe other suggestions ??
Oren
"JD" < XXXX@XXXXX.COM >schrieb im Newsbeitrag
Quote

"Hernán Tornielli" < XXXX@XXXXX.COM >wrote:
>You might store your value as a resource and then tell upx
>not to compress resources.

That's the solution and most likely the only solution.

~ JD
 

{smallsort}

Re:Re: Adding a integer (counting) value to a compiled application..UPX problem..

"Oren Halvani" < XXXX@XXXXX.COM >wrote:
Quote
[...] maybe other suggestions ??
Here's the rub with how you're trying to do it now ... All of
this must take place within the context of your application:
Load the exe file from disk into memory
Decompress it
Make changes to it
Recompress it
Rewrite it to disk
all of which means that your application needs to incorporate
UPX or the compression routines that it uses.
If you could skip compressing the resource, you'd be able to
do it easily. My first move would be to check to see how UPX
handles multiple Resource files - if UPX let's you compress
one Resource and not another - and put my special string into
a seperate resource.
The only other option that I can think of is to generate 2
seperate, but almost identical exe's. The difference between
the two being the Count member of the special string that you're
trying to find:
"Start_Count_End"
Then run them through UPX and use a file compare utility to
locate the string.
Once you've located the literal (in both exe's), you will have
the compressed bit pattern that you need to search for (found
in the first exe) and what you need to change it to (from the
second exe).
Of course you'll have to repeate the process once for every
allowed launch to identify the compressed bit patern for the
next Count value.
If this works for you, be aware that your exe will contain the
matching bit patterns for Count 1 - 5 as strings to search for
and the actual special string. Just make sure that you're finding
the special string and not the string to search for. You can
accomplish this by defining the search strings with an errant
byte and then correcting the errant byte at runtime.
One final note: Compressed strings (almost) never result in
null terminated strings and (almost) always contain non-character
bytes. You won't be able to use native string compare functions
to find your special string.
~ JD