The help page for "SendMessage" states:
The mapped file must be at least 1024 bytes in length.
This is outdated; I believe the current value is 4150
characters, which requires a second page at least, and a third when using unicode. Using 1024 bytes thus leads to a crash when the result exceeds one page.
Alternatively, mIRC could use VirtualQuery and make sure it does not write beyond the number of pages allocated for the file mapping.