It was about time I came up with a macro-based solution for saving+loading your app data on app startup/exit. I personally like it much more than AdvApi32.

This is all you need to put, to automatically save/restore data after exit and on startup.

.data
.SAVEBLOCK_BEGIN
string1 db 260 dup (?)
......
var154 dd ?
.SAVEBLOCK_END

.code
main proc
invoke LoadSaveBlocks,T("SaveFile.bin"),0

.BIND_SAVEBLOCKS ; macro
;-----[ application code ]----------\
....
;-----------------------------------/
invoke SaveSaveBlocks,0
ret
main endp

5 lines - to save you hundreds ^_^
Attachments:
Posted on 2005-10-16 08:25:38 by Ultrano
Looks pretty interesting. I just finished some easy save/load code for C++, since I was fed up with AdvApi32 too :)
Posted on 2005-10-16 12:07:45 by f0dder
seems to be usefull. thank you
Posted on 2005-10-17 08:43:36 by diablo2oo2
Ultrano,

Thanks !!!

With just a little more work, it works like a database too!

Regards,  P1  8)
Posted on 2005-10-18 08:58:05 by Pone
SaveState/PrefState, version 2 ready:
- no limits in names of save-blocks;
- new feature: saving of strings and arrays of strings;
- new feature: saving of (usually big) fixed-size memory chunks;
- easily expandable;
- now as a .lib+.inc, immediately available for integration in any MASM app.;
- examples, documentation, and detailed explanation on its operation;
- macros show friendly tips on fixing compilation-problems, if such occur.
Attachments:
Posted on 2006-07-17 08:39:27 by Ultrano