Huh... Problem: there is program (actually NSIS installer using System plugin) which should be able to use callbacks (to process windows messages for example). It uses scripting language, my plugin allows to call any exported function (from any module - a gateway to Win32Api programming). Callbacks are handled by plugin, which returns control to script, and after callback actions (of the script) emulates return from callback proc. But there is one problem - the windows awaits the stack to be restored after the callback proc, and I couldn't guarantie it, since the installer script could do strange things before the second call to my plugin.

Actually, the problem is: I need to establish secondary stack for calling procs, set it to original stack during callbacks , set it to secondary stack before the return from callback, and restore the original stack after the exit from proc.

That was done some months ago by simple allocation of 65kb memory block (Global Alloc ;), and using it as stack buffer, but today I've founded win98 telling me about gpf at kernel32.dll (I'm working under winxp (no problems here), and I couldn't remeber if I tested it under win98 before). So I need more windows-system-programming like solution. I could of course just sub esp by 4kb (for ex.) and use it as secondary stack, and during callback return it back, but how many stack should I left for installer itself... As I know in winnt systems for example stack could grow end-lessly (page_guard), and I wonna something like that ;)
Posted on 2003-03-20 17:09:06 by brainsucker