.386
.model flat, stdcall
option casemap :none
include mrcdll.inc
.data
szReturnError db "ERROR %1!s!%0",NULL
szReturnSuccess db "SUCCESS %1!s!%0",NULL
szMirc db "mIRC",NULL
.data?
hInstance dd ?
hFileMap dd ?
mData dd ?
mArgs dd 3 dup (?)
.code
LibMain proc hInstDLL:DWORD,reason:DWORD,unused:DWORD
.if reason == DLL_PROCESS_ATTACH
mov eax,TRUE
ret
.endif
mov eax,TRUE
ret
LibMain Endp
LoadDll proc LoadInfo:PTR LOADINFO
push ebx
invoke CreateFileMapping, INVALID_HANDLE_VALUE,0,PAGE_READWRITE,0,4000h,offset szMirc
mov hFileMap,eax
invoke MapViewOfFile, hFileMap,FILE_MAP_ALL_ACCESS,0,0,0
mov mData,eax
IF UNLOAD
mov ebx,LoadInfo
mov [ebx].LOADINFO.mKeep,FALSE
ENDIF
invoke GetModuleHandle, NULL
mov hInstance,eax
pop ebx
ret
LoadDll endp
UnLoadDll proc mTimeout:dword
IF KEEPLOADED
.if mTimeout==1
mov eax,0
ret
.else
invoke UnmapViewOfFile, mData
invoke CloseHandle, hFileMap
mov eax,1
ret
.endif
ELSE
invoke UnmapViewOfFile, mData
invoke CloseHandle, hFileMap
mov eax,1
ret
ENDIF
UnLoadDll endp
DoIdentifier proc mWnd:dword,aWnd:dword,data:dword,
parms:dword,show:dword,nopause:dword
invoke CopyText, mData,data
invoke SendMessage, mWnd, WM_MEVALUATE,0,0
m2m mArgs,mData
.if eax
invoke FormatMessage, FORMAT_MESSAGE_FROM_STRING or FORMAT_MESSAGE_ARGUMENT_ARRAY,
offset szReturnSuccess,NULL,NULL,data,950,offset mArgs
.else
invoke FormatMessage, FORMAT_MESSAGE_FROM_STRING or FORMAT_MESSAGE_ARGUMENT_ARRAY,
offset szReturnError,NULL,NULL,data,950,offset mArgs
;invoke CopyText, data,offset szReturnError
.endif
mov eax,3
ret
DoIdentifier endp
DoCommand proc mWnd:dword,aWnd:dword,data:dword,
parms:dword,show:dword,nopause:dword
invoke CopyText, mData,data
invoke SendMessage, mWnd, WM_MCOMMAND,1,0
m2m mArgs,mData
.if eax
invoke FormatMessage, FORMAT_MESSAGE_FROM_STRING or FORMAT_MESSAGE_ARGUMENT_ARRAY,
offset szReturnSuccess,NULL,NULL,data,950,offset mArgs
.else
invoke FormatMessage, FORMAT_MESSAGE_FROM_STRING or FORMAT_MESSAGE_ARGUMENT_ARRAY,
offset szReturnError,NULL,NULL,data,950,offset mArgs
.endif
mov eax,3
ret
DoCommand endp
end LibMain