Archive: System: create structure in preallocated memory?


System: create structure in preallocated memory?
I know how to create structures with System plugin but how do I create one at a given memory address?


The usage example for System::Copy at the top of the plug-in readme shows how to do it.

Stu


System::Call '*$0(i 666,i 1337)' in the memory starting at $0 (The set struct members syntax)


I studied that part in System readme before posting but I must be getting something wrong. What I need is to create a blank POINT structure in another process' memory and pass the pointer with SendMessage. Is System::Call "*$0(&i4, &i4)" ok, $0 being an existing address?


To write to the memory in another process you would first create the struct locally inside the nsis process normally with system and then you would have to call OpenProcess, VirtualAllocEx and WriteProcessMemory (This is not going to be pretty, and it sounds like you are doing something hacky)


I'm not a coder so pretty much everything's hacky to me but what i'm trying do is save/restore desktop icons layout. Found the code in Delphi, now I'm trying to port it to nsis. I already did the OpenProcess & VirtualAllocEx part but "first create the struct locally" is the thing I needed to hear. Thanks for pointing me in the right direction, I'll let you know if I was successful, or stuck again.


Woohoo! Did it. My main problem was failing to understand that System can't directly manage the memory of another process. It probably goes without saying for someone with proper knowledge but I'm just learning as I go along. Still got scripting ahead of me to achieve what I want but the bricks are here, all I got to do now is build. Thanks again, Anders.