mIRC Home    About    Download    Register    News    Help

Print Thread
Incorrectly detecting files as devices #192175
23/12/07 03:00 PM
23/12/07 03:00 PM
Joined: May 2003
Posts: 18
K
kinnu Offline OP
Pikka bird
kinnu  Offline OP
Pikka bird
K

Joined: May 2003
Posts: 18
Are there any plans to fix this old bug? Not being able to manipulate some perfectly valid files it looks like I'm going to have to move some script functionality to a .dll or .exe, something I'd really rather avoid.

Re: Incorrectly detecting files as devices [Re: kinnu] #192184
23/12/07 09:39 PM
23/12/07 09:39 PM
Joined: Oct 2004
Posts: 8,327
MA, USA
Riamus2 Offline
Hoopy frood
Riamus2  Offline
Hoopy frood

Joined: Oct 2004
Posts: 8,327
MA, USA
That's not technically a bug, per se. Windows considers certain names to be devices and so mIRC does as well. Granted, that's pretty much an outdated method of determining devices, but I don't believe Windows has chosen to drop it even in Vista.

In any case, you're looking at a very small number of names that cannot be used and there's absolutely no reason why you *have* to use them, so just change to something else instead.


Invision Support
#Invision on irc.irchighway.net
Re: Incorrectly detecting files as devices [Re: Riamus2] #192186
23/12/07 10:50 PM
23/12/07 10:50 PM
Joined: Oct 2003
Posts: 3,918
Montreal, QC, Canada
A
argv0 Offline
Hoopy frood
argv0  Offline
Hoopy frood
A

Joined: Oct 2003
Posts: 3,918
Montreal, QC, Canada
Sat's answer in the OP's referenced thread was indeed interesting though. Just because mIRC uses a Windows API to declare that file as reserved does not necessarily mean mIRC is properly using that API, or being a bit too reliant on Windows' results when they may not be fully accurate or used in the right context.



- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Re: Incorrectly detecting files as devices [Re: kinnu] #192320
28/12/07 11:13 PM
28/12/07 11:13 PM
Joined: May 2003
Posts: 18
K
kinnu Offline OP
Pikka bird
kinnu  Offline OP
Pikka bird
K

Joined: May 2003
Posts: 18
The idea that I should just use other names assumes that I have some control over the filenames my script has to manipulate. A reasonable assumption for most cases but of course it doesn't hold true for all scripts. Trust me, I would not bother duplicating script functionality in a DLL if simply using other filenames was an option here..

Re: Incorrectly detecting files as devices [Re: kinnu] #192321
28/12/07 11:35 PM
28/12/07 11:35 PM
Joined: Dec 2002
Posts: 503
Melbourne, Australia
B
Bekar Offline
Fjord artisan
Bekar  Offline
Fjord artisan
B

Joined: Dec 2002
Posts: 503
Melbourne, Australia
What exactally are you trying to do, and what file names are you trying to use?

Re: Incorrectly detecting files as devices [Re: Bekar] #192322
29/12/07 12:09 AM
29/12/07 12:09 AM
Joined: May 2003
Posts: 18
K
kinnu Offline OP
Pikka bird
kinnu  Offline OP
Pikka bird
K

Joined: May 2003
Posts: 18
The initial bug report that I received was about deleting a file named pipe.pm but the problem also affects other mirc commands and identifiers.

/remove x:\path\pipe.pm - fails with "/remove: no such file"
/remove x:\path\pipe2.pm - ok

Re: Incorrectly detecting files as devices [Re: kinnu] #192326
29/12/07 03:12 AM
29/12/07 03:12 AM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
genius_at_work  Offline
Hoopy frood
G

Joined: Oct 2005
Posts: 1,741
You could use a cmd batch file to perform tasks on those restricted filenames. Just write a batch file from within your script, execute it, and then remove it. I don't know if there is any way to tell if it was successful or not.

-genius_at_work

Re: Incorrectly detecting files as devices [Re: genius_at_work] #192328
29/12/07 05:12 AM
29/12/07 05:12 AM
Joined: Dec 2002
Posts: 503
Melbourne, Australia
B
Bekar Offline
Fjord artisan
Bekar  Offline
Fjord artisan
B

Joined: Dec 2002
Posts: 503
Melbourne, Australia
Whilst Windows in general handles this fine, mIRC it's self cannot.

It appears as if mIRC has an internal list of reserved words, probably introduced during the '95 days, that has dis-allowed filenames. Does anybody remember the old send-a-file-called-com1 issue of old?

$read(), /remove, /copy and others have issues with it (copy copies it to another name, but fails to remove the old instance).

/fopen et al commands seem to not have this issue.

There's no mention of reserved names in the versions.txt history however.

Re: Incorrectly detecting files as devices [Re: Bekar] #192330
29/12/07 05:59 AM
29/12/07 05:59 AM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
genius_at_work  Offline
Hoopy frood
G

Joined: Oct 2005
Posts: 1,741
I don't know exactly what happens within mIRC's coding (obviously), but Khaled stated in the referenced thread, basically, that mIRC asks windows and windows says yes or no. Maybe the method being used is outdated, but mIRC is designed to work with outdated versions of windows (I believe). If Khaled told us what method he used (the windows command that is called), maybe others here could suggest a different method.

-genius_at_work

Re: Incorrectly detecting files as devices [Re: genius_at_work] #192333
29/12/07 08:14 AM
29/12/07 08:14 AM
Joined: Dec 2002
Posts: 503
Melbourne, Australia
B
Bekar Offline
Fjord artisan
Bekar  Offline
Fjord artisan
B

Joined: Dec 2002
Posts: 503
Melbourne, Australia
He stated that the funcion he's calling returns whether the file is a 'device'.

As these file names could potentially be devices, he's discarding them as a possible file name..

So yeah, it's possible the routine he's using is outdated.. But then there's the whole backward compatability thing..

Re: Incorrectly detecting files as devices [Re: Bekar] #192339
29/12/07 11:06 AM
29/12/07 11:06 AM
Joined: Oct 2004
Posts: 8,327
MA, USA
Riamus2 Offline
Hoopy frood
Riamus2  Offline
Hoopy frood

Joined: Oct 2004
Posts: 8,327
MA, USA
And, of course, Windows itself is the one stating it's a device... even in newer Windows versions, so it's partle Windows' fault. smile


Invision Support
#Invision on irc.irchighway.net
Re: Incorrectly detecting files as devices [Re: Riamus2] #192344
29/12/07 03:17 PM
29/12/07 03:17 PM
Joined: Apr 2004
Posts: 839
The Netherlands
Sat Offline
Hoopy frood
Sat  Offline
Hoopy frood

Joined: Apr 2004
Posts: 839
The Netherlands
Don't be silly. Windows does not state that all device names are invalid file names. Some are, but most are not. mIRC assumes that all of them are, so only mIRC is at fault here.


Saturn, QuakeNet staff
Re: Incorrectly detecting files as devices [Re: Sat] #192353
29/12/07 09:04 PM
29/12/07 09:04 PM
Joined: Oct 2004
Posts: 8,327
MA, USA
Riamus2 Offline
Hoopy frood
Riamus2  Offline
Hoopy frood

Joined: Oct 2004
Posts: 8,327
MA, USA
Well, according to Khaled...

Originally Posted By: Khaled
mIRC asks Windows whether the file name in question is a device name or not. If Windows says that it is a device, mIRC will prevent access to it.


So, mIRC is asking Windows and Windows is replying. If Windows *didn't* say that those were devices, then mIRC wouldn't consider them invalid filenames. As mentioned, the method used to ask Windows may be outdated with newer Windows versions, but with backward compatibility, there may not be an easy way to change how it asks Windows about this. Of course, mIRC could just allow writing to those no matter what and let Windows complain about it, but I don't know if that's any better either. I think a better idea would just be to have the error that mIRC generates explain that it's a device name so people actually know what the problem is (not sure if it does or not).


Invision Support
#Invision on irc.irchighway.net
Re: Incorrectly detecting files as devices [Re: Riamus2] #192358
29/12/07 10:44 PM
29/12/07 10:44 PM
Joined: Apr 2004
Posts: 839
The Netherlands
Sat Offline
Hoopy frood
Sat  Offline
Hoopy frood

Joined: Apr 2004
Posts: 839
The Netherlands
Again, not all (MS-DOS) device names are invalid (Windows) file names. You can't blame Windows for providing information that is used improperly by mIRC. Remember that mIRC is not an MS-DOS application, and never was.

What mIRC should do instead is test for a small subset of hardcoded device names - see the "reserved device names" list at Microsoft's own advice on naming files.


Saturn, QuakeNet staff