mIRC crashes after a DLL call from remote event - 26/08/10 12:01 AM
I wrote a DLL that searches for a word within given file.
Everything works fine when I call it (or any alias that's making the DLL call) by typing //echo $dll(...) or /aliasname. However when the DLL is called from any remote event, eg:
mIRC crashes. The same thing happens when I initialize a timer that makes the DLL call:
This is the part of C++ code that causes a crash (the while loop, to be exact):
Any ideas about what's causing the crash and how to get rid of it?
Thanks in advance
Everything works fine when I call it (or any alias that's making the DLL call) by typing //echo $dll(...) or /aliasname. However when the DLL is called from any remote event, eg:
Code:
on *:text:!dll:*: echo -a $dll(...)
mIRC crashes. The same thing happens when I initialize a timer that makes the DLL call:
Code:
on *:text:!dll:*: timer1 1 1 echo -a $dll(...)
This is the part of C++ code that causes a crash (the while loop, to be exact):
Code:
CHAR buffer[8192]; HANDLE fin = ::CreateFile(afilename,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); DWORD dwFilePos = 0; DWORD indexin = 0; DWORD dwRead = 0; ::ReadFile(fin,buffer+indexin,4096,&dwRead,NULL); while ( dwRead > 0 ) { dwFilePos = dwFilePos + 4096; indexin += dwRead; dwRead = 0; ::ReadFile(fin,buffer+indexin,4096,&dwRead,NULL); }
Any ideas about what's causing the crash and how to get rid of it?
Thanks in advance