Hi all ! I'm a beginner in MASM and I having a problem with it.
I'm trying to write a program which hook keyboard messages. The program contains two file: an executable file and a hook DLL.
Functions in the DLL:
; ---------------------------------------------------------------------------------------
;-------------------------- hook procedure ----------------------------------------
; ---------------------------------------------------------------------------------------
hookProc proc nCode :DWORD, wParam :DWORD, lParam :DWORD
; Send Message to Spy Window
invoke SendMessage, hShareWind, WH_ACTIVE, wParam, lParam
invoke CallNextHookEx, 0, nCode, wParam, lParam
return eax
ret
hookProc endp
; -------------------------------------------------------------------------------
; -------------------- Share handle win -----------------------------------
; -------------------------------------------------------------------------------
sharehWind proc hWind :DWORD
m2m hShareWind, hWind ; Copy hWind to DLL's global variable
ret
sharehWind endp
; -------------------------------------------------------------------------
And in the executable file, I do:
invoke sharehWind, hWin ; Copy hWin to DLL's global variable
In the executable file, I call sharehWind function to store handle Win [hWin] of the spy Window.
When a hook even occur, Windows OS call hookProc fuction. In this function, I SEND PARAMETERS TO THE SPY WINDOW TO PROCCES
WITH THE HANDLE OF IT BUT IT IS NOT SUCCESS WITH OTHER PROCCESES, because data in the DLL is not the same with two different procceses.

And I know a code in C++ can do it:
#pragma data_seg(".adshared")
HWND hShareWind = NULL;
#pragma data_seg()
#pragma comment(linker, "/SECTION:.adshared,RWS")
But I don't know how to do it with MASM. Can everybody show me what I can to do?
P/S: Sorry about bad at English because it is not my mother language.