heya,

i want to start a small SDK for my little tool (Plug-ins), all i wanna know is how to let a variable (global)
used in the main app shared (passed address) to the plugin so it can access it without the main app interaction ?

something like this;



[=========== ; Main App
global x

===========]
.|
.|
\/
Pass x Address to plugin

[====== ; Plugin
Global y = x (Pointer)
======]


e.g:
i have file mapped in memory in the main app, i have a pointer to it (MZ...)
if i want the plugin to access that location and read it's data (MZ/PE..etc of mapped file).
is it possible? is there a safer way?
thnx
Posted on 2003-11-03 20:10:53 by wizzra
For memory sharing-

In each modules (main and plug-ins) insert this:


ShareMemSize equ 4096d
MemShareName db "_my_super_share_",0
hMap dd 0
StartMappedAddress dd 0


invoke CreateFileMapping,INVALID_HANDLE_VALUE,0,PAGE_READWRITE,0,ShareMemSize,offset MemShareName
or eax,eax
jnz @F
;CreateFileMapping error
jmp ok
@@:
mov hMap,eax
invoke MapViewOfFile,hMap,FILE_MAP_ALL_ACCESS,0,0,0
or eax,eax
jnz @F
;MapViewOfFile error
jmp ok
@@:
mov StartMappedAddress,eax
ok:


and now in main module:
mov edi,StartMappedAddress
mov word ptr ,"hi"


in plugin:
mov edi,StartMappedAddress
mov ax,word ptr
ax=="hi"
Posted on 2003-11-04 00:37:41 by Poly
memory map all variables i need to share between plugin/gui looks kind of non-efficient :(
any other advices?
Posted on 2003-11-04 10:55:11 by wizzra
Lol, no, Poly is just drunk. :P Memory sharing is for when you want to share memory between different processes (address spaces). Just do what you said first. Pass a pointer to your data area to the DLL.
Posted on 2003-11-04 11:06:26 by Sephiroth3