I'm in the process of writing an ftp server in mIRC Script (mainly out of boredom lol), and everything seemed to be running well. I have an XP machine that I'm running it from, and another computer that I have networked to the XP machine.

It seems that when I just do a loopback connection (127.0.0.1), the server works great. I try it from the other computer, and it still works great to a point...this is where the strange part comes in. When the other computer does a LIST command, my computer starts sending the shared folder and filenames. In the middle of sending the filenames, my XP machine recieves the following Blue Screen of Death (STOP screen):

---------------------------
A problem has been detected and Windows has been shut down to prevent damage to your computer.

DRIVER_IRQL_NOT_LESS_OR_EQUAL

If this is the first time you've seen this Stop error screen, restart your computer. If this screen appears again, follow these steps:

Check to make sure any new hardware or software is properly installed. If this is a new installation, ask your hardware or software manufacturer for any Windows updates you might need.

If problems continue, disable or remove any newly installed hardware or software. Disable BIOS memory options such as caching or shadowing. If you need to use Safe Mode to remove r disable components, restart your computer, press F8 to select Advances Startup Options, and then select Safe Mode.

Technical information:

*** STOP: 0x000000D1 (0x00000010, 0x00000002, 0x00000000, 0xB9C098CD)
*** rtl8180.SYS - Address B9C098CD base at B9BF9000, Datestamp 3ecb351a

Beginning dump of physical memory
Physical memory dump complete.
Contact your system administrator or technical support group for further assistance.
----------------------------

The code I currently have is (note it isn't complete yet!):
----------------------------
alias ftpnew {
window -l15 @ftpmon
window @ftpd
socklisten ftp $1-
}
on 1:socklisten:ftp:{
var %ranum = ftpa $+ $rand(10000,99999)
if ($exists($mircdir $+ ftp) == $false) { mkdir $mircdir $+ ftp }
write ftp\connect.txt %ranum $sock(%ranum).ip
sockaccept %ranum
write ftp\log.txt «< $+ $date - $time $+ >» Connection from $sock(%ranum).ip accepted
echo -ti2 @ftpmon 9«<7 $+ $date 9 $+ -7 $time $+ 9>» Connection from $sock(%ranum).ip accepted
iline -l @ftpmon 1 $sock(%ranum).ip
cline -l4 @ftpmon 1
sockwrite %ranum 220 Welcome to Qb's FTP Server. $+ $crlf
}
on 1:sockread:ftpa*:{
sockread %ftpd
echo -ti2 @ftpd 10 $+ << %ftpd
write ftp\logall.txt << %ftpd
var %ranum = $sockname
var %rapla = $remove(%ranum, ftpa)
;--USER--;
if ($gettok(%ftpd, 1, 32) == USER) {
sockwrite $sockname 331 Username set to $gettok(%ftpd, 2, 32). Now enter your password. $+ $crlf
; writeini ftp\data.ini userlogin %ranum $gettok(%ftpd, 2, 32)
; writeini ftp\data.ini userlogin %ranum $+ logon 1
}
;--PASS--;
if ($gettok(%ftpd, 1, 32) == PASS) {
if ($gettok(%ftpd, 2, 32) == anonymous) {
;-motd here-;
var %ln = $calc($lines(ftp\motd.txt) - 1)
var %ln2 = 0
while (%ln2 <= %ln) {
inc %ln2 1
sockwrite %ranum 230 $read(ftp\motd.txt, %ln2) $+ $crlf
}
}
if ($gettok(%ftpd, 2, 32) != anonymous) {
sockwrite %ranum 530 Login incorrect. Please try again. $+ $crlf
dline @ftpmon $fline(@ftpmon, $sock(%ranum).ip, 1, 1)
sockclose %ranum
}
}
;--QUIT--;
if ($gettok(%ftpd, 1, 32) == QUIT) {
sockwrite %ranum 221 Bye Bye, Thanks for using the test server! $+ $crlf
dline -l @ftpmon $fline(@ftpmon, $sock(%ranum).ip, 1, 1)
sockclose %ranum
}
;--PASV--;
if ($gettok(%ftpd, 1, 32) == PASV) {
;//echo -s $calc($rand(1,255) * 256 + $rand(1, 255))
var %ro = $rand(1,255)
var %rt = $rand(1, 255)
var %rport = $calc(%ro * 256 + %rt)
socklisten ftpb $+ %rapla %rport
sockwrite %ranum 227 Entering Passive Mode $+ $chr(40) $+ 192,168,2,4, $+ %ro $+ , $+ %rt $+ $chr(41) $+ $crlf
}
;--SYST--;
if ($gettok(%ftpd, 1, 32) == SYST) {
sockwrite %ranum 215 UNIX Type: L8 $+ $crlf
}
;--PORT--;
if ($gettok(%ftpd, 1, 32) == PORT) {
;44
tokenize 44 $remove(%ftpd, PORT)
sockopen ftpb $+ %rapla $1 $+ . $+ $2 $+ . $+ $3 $+ . $+ $4 $calc($5 * 256 + $6)
sockwrite %ranum 200 Port command successful. $+ $crlf
}
;--LIST--;
if ($gettok(%ftpd, 1, 32) == LIST) {
sockwrite %ranum 150 Opening data connection for directory list. $+ $crlf
; sendshares
var %temp = $finddir($read(ftp\share.txt, 1), *, *, 1, sockwrite ftpb $+ %rapla $lastdir($1-) $+ $crlf )
;----WARNING: $nopath HAS BEEN CAUSING A Blue Screen Of Death!!!!----;
var %temp2 = $findfile($read(ftp\share.txt, 1), *, *, 1, sockwrite ftpb $+ %rapla $lastfile($1-) $+ $crlf )
; sockwrite ftpb $+ %rapla Down for the momento $+ $crlf
; sockwrite ftpb $+ %rapla Down for the momento $+ $crlf
var %raplip = $sock(ftpb $+ %rapla).ip
var %raplpo = $sock(ftpb $+ %rapla).port
sockclose ftpb $+ %rapla
; sockopen ftpb $+ %rapla %raplip %raplpo
sockwrite %ranum 226 Transfer ok $+ $crlf
}

}
alias lastdir {
var %gt = $numtok($1-, 92)
return $chr(92) $+ $gettok($1-, %gt, 92)
}
alias lastfile {
var %gt = $numtok($1-, 92)
return $gettok($1-, %gt, 92)

}
on 1:sockopen:ftpb*:{
var %ranum = $sockname
var %rapla = $remove(%ranum, ftpb)
; sockwrite ftpa $+ %rapla 150 Data connection accepted from $sock($sockname).ip $+ $chr(59) transfer starting. $+ $crlf
}
on 1:sockread:ftpb*:{
sockread %ajw
write ftp\logall.txt ftpb: %ajw
}
-----------------------------------
The line that is causing problems is the var %temp2 = $findfile($read(ftp\share.txt, 1), *, *, 1, sockwrite ftpb $+ %rapla $lastfile($1-) $+ $crlf ). This works PERFECTLY fine if I don't have any kind of identifier in front of the $1-. If I have any identifier in front of it, however, it sends me the BSOD. This current code only sends me the BSOD if I request a LIST several times quickly, the last one, which was just a $nopath, would just crash my computer every time (that's why I made the $lastfile identifier).

If I send it as just $1-, like I mentioned, it works fine every time. Obviously, though, I only want to send the filename from there, and not the whole folder.

If anybody has any ideas why this code would be crashing my system with that blue screen of death, please post.