|
Tomasz Sowinski wrote:
Oops - it's too hot here; my monitor looses focus obviously
Of course, I just reread what he said and now I see it as just retaining the value after the EXE has been copied - like to another computer for instance. Perception can be interesting. I'll blame my mouse for that.
Tomasz Sowinski wrote:
Thanks. Watch for upgrade in September or, more likely, October.
Spiffy!
Jeremy Falcon
Imputek
<nobr>"Life is too precious - don't waste it." - Norm Almond
|
|
|
|
|
no, exe is running, copy is something later
the exe writes date to itself, so it must be in running
includeh10
|
|
|
|
|
You can do something close. Store your piece of data in a companion DLL. Link this DLL dynamically with LoadLibrary and FreeLibrary . When you want to modify the internal data, make sure the DLL is not loaded, open it as a regular file in read/write mode, change it and close it again.
Possibly the best way to change the data without getting into PE format details is to signal the block to be changed with some beacon like this:
static char data[]=":::BEGINMARKER::: ";
so that you can search for the beacon and just overwrite what follows (being careful not to exceed the maximum space reserved in advance). You can save the searching phase if you already found out where the storing space begins (e.g. by examining the DLL with a binary editor).
This approach involves a fair amount of work, but I think it should work.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Possibly the best (and most easy ) way to store data in an .exe without going into format details is to store them as custom ressource inside the ressouce fork. Then you can update and retrieve them use simple API functions.
However, the API to store the ressource (UpdateResource()) is only available on NT and above, so if you have to support ugly versions of Windows this approach would not work
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
Hi Daniel
Possibly the best (and most easy ) way to store data in an .exe without going into format details is to store them as custom ressource inside the ressouce fork.
I don't really think so. Updating string resources is a pain in the ass because a) those strings are always stored in Unicode b) they are bundled into messy entry blocks (several strings per block) and the API does not give direct access to the strings themselves, only the blocks.
However, the API to store the ressource (UpdateResource()) is only available on NT and above, so if you have to support ugly versions of Windows this approach would not work.
If you are interested, Erik Kallen wrote a superb clone of this API for 9x systems that you can have a look at in his article Updating Resources on Win9x.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
i downloaded the zip and will try soon.
thx
includeh10
|
|
|
|
|
Hello Joaquín
Aehm, did I talk about string resources?
I would store the data as uninterpreted custom resource. You can store any binary data this way.
Joaquín M López Muñoz wrote:
If you are interested, Erik Kallen wrote a superb clone of this API for 9x systems that you can have a look at in his article Updating Resources on Win9x.
That's really good news for all those poor folks who have to support bulshit OS versions
(And obviously the code would throw light on how to deal with PE and resource formats! Very interesting!)
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
I would store the data as uninterpreted custom resource. You can store any binary data this way.
Didn't think of it at first. Yes, this avoids the strings hassle.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi,
I would like to know that Visual C++ 6.0 can use ClassWizard with CDaoRecordset to open a MS Access 97 file or not?
a) I create a simple trypassword97.mdb (attached) with 1 row & 2 columns
b) Using password option (password = 12345)
c) Every thing is OK
d) But in Visual C++ 6.0 Application, when I use the ClassWizard --> Member Variable --> Add Classe --> New --> Filename.cpp --> CDaoRecordset --> trypassword97.mdb --> "Invalid passord!" ... I could not open that mdb file!
*) That means somehow Visual C++ must know the password (12345) to open the trypassword97.mdb
1) Can any one help me about this (above)?
2) In programing (at run time) at any time when I try to open it, what command line to use (with password?) to open it?
I appreciate very much for any help!
Thanks,
Anh Truong
|
|
|
|
|
Check MFC technical note TN054.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Hi Tomasz,
Thank you for your guide of info. I did take a look and will try at Run Time! But my problem is that I could not use Visual C++ 6.0 ClassWizard to open my MS Access file which created "before" and using option password!
Can you clarify this?
Many thanks,
Anh Truong
|
|
|
|
|
Anonymous wrote:
But my problem is that I could not use Visual C++ 6.0 ClassWizard to open my MS Access file which created "before" and using option password!
I'm afraid you're stuck with the problem. KB article Q153291 describes this issue, but doesn't offer any reasonable solution.
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
Hi Tomasz,
You did help me a lot so that I will not search more info. to fix my problem! I think I should create a MS Access mdb file "without security password" from its environment to avoid the problem when I use ClassWizard! I will use at Run Time instead (I hope that it will work)
Many thanks for helps
Anh Truong
|
|
|
|
|
Hi all.
Could someone tell me how to take some resource strings I have in an access db and write then to a valid .RES file so I can include it in my program?
There has to be a API for writting to .RES files surely? Or some other simple way.
Thanks.
Pete
|
|
|
|
|
There's an API for changing resources in PE files (.exe and .dlls), however, it's available only on NT/2K/XP (UpdateResource and friends).
If you need .res file, then you'll be linking next. Why don't you write .rc and invoke Resource Compiler?
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
Thanks for the swift reply...
Writing an RC file would be acceptable...What exe is the resource compiler? and how to use it?
Can't you tell I've never been outside an IDE before!
Pete
|
|
|
|
|
Pete Bassett wrote:
What exe is the resource compiler? and how to use it?
RC.EXE. Run with /? to get basic usage info. I believe there should be more in MSDN.
Tomasz Sowinski -- http://www.shooltz.com
- It's for protection - Protection from what? Zee Germans?
|
|
|
|
|
|
You could also include the created RC file into your own projects RC file. Then you don't have to invoke RC.EXE to compile it.
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
Its going to be a .RES for for use in a VB app...Thats the problem, you cant use .RC files in VB. Damn!
Pete
|
|
|
|
|
When I call OpenPrinter, it fails and GetLastError() returns 87 -> ERROR_INVALID_PARAMETER
it's the last parameter ! i know this because this is the one i don't know how to init. it's a PRINTER_DEFAULTS struct.
if somebody knows how to init this struct, post me the tips !
See you later on the web !
March'
|
|
|
|
|
It can be NULL
|
|
|
|
|
I want to make my program expire after 30 days. What's the best way to implement this? I just need a simple solution, one that will prevent normal users from bypassing the expiration.
Thanks!
Johnny Wood
|
|
|
|
|
1. get the current time
2. read a registry key that your program owns HKCU/Software/MyCompany/Whatever...
3. if that key doesn't exist, create it and write the current time there. this wil happen the first time your app runs.
4. if the key does exists, read the time stamp that was stored there and compare it to the current time.
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
save lastest date in register or a file, make sure ur user can't find it
avoid to use 'current time', so if user changes time setting, the app still expired
includeh10
|
|
|
|