Hi,
I see using mapped files as being flawed because this can interfere with other applications that want to communicate with mIRC at the same time.
Using indexed file mappings is somehow better but that's still not unique.
Some possible slutions fore a more reliable communication:
1. Pass the handle returned by CreateFileMapping in lParam
This would ensure that the memory mapping is specific to the call. In case on interprocess communtication the handle should be duplicated to the remote process. GetWindowThreadProcessId can be used to obtain the process id from a HWND and OpenProcess can be used to obtain a process handle. If the caller created the remote process it has a process handle returned by CreateProcess. DuplicateHandle can then be used to duplicate the handle to the remote process.
2. Use WM_COPYDATA
This would be a much easier way because the data is marshaled to remote processes by Windows. The only problem is that the buffer cannot be modified. This could be solved by calling back with another WM_COPYDATA.
3. Pass callback function addresses to LoadDll
This is usable for in-process communication only but is very fast and easy to use. A LOADINFOEX structure could be created that is compatible with LOADINFO and a DLL could cast LOADINFO* to LOADINFOEX* when mVersion if greather than or equal to a specific value.
4. Export the callback functions by mirc.exe
This is the same as exporting functions from DLLs. All modules in the process can use GetProcAddress to obtain the address of these functions. Other than this this is the same as the previous solution.
I hope you like these ideas.
Comments are welcome.
Kornel