mIRC Home    About    Download    Register    News    Help

Print Thread
#191557 11/12/07 05:26 PM
Joined: May 2005
Posts: 12
S
sprion Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: May 2005
Posts: 12
There seems to be a bug with $shortfn.

Path A: C:\Documents and Settings\jeric\My Documents\workspace\jeric\newscript\sysfiles\addons\zion\the zion\

$shortfn(Path A) results:
C:\DOCUME~1\jeric\MYDOCU~1\workspace\jeric\newscript\sysfiles\addons\zion\the zion\

Notice how 'the zion' was not changed..

I'm using Macbook Pro, running Windows XP SP 2, mIRC 6.31

Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031

Which file system are you using?

Code:

//echo -a $shortfn(C:\Documents and Settings\jeric\My Documents\workspace\jeric\newscript\sysfiles\addons\zion\the zion)

C:\DOCUME~1\jeric\MYDOCU~1\WORKSP~1\jeric\NEWSCR~1\sysfiles\addons\zion\THEZIO~1\



XP SP2 - NTFS - mIRC v6.31

RoCk #191564 11/12/07 08:23 PM
Joined: May 2005
Posts: 12
S
sprion Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: May 2005
Posts: 12
NTFS! that's so strange, i swear i just typed it and this is my results

//echo -a $shortfn(C:\Documents and Settings\jeric\My Documents\workspace\jeric\newscript\sysfiles\addons\zion\the zion)

C:\DOCUME~1\jeric\MYDOCU~1\workspace\jeric\newscript\sysfiles\addons\zion\the zion\

Compared to your results.. a lot more things aren't changed too. Just so you've seen, I'm using macbook pro, but running WinXP SP 2 on it, NTFS, 6.31, 6.21, 6.2 fails too.

Last edited by sprion; 11/12/07 08:31 PM.
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
First off, I assume that the directory actually exists. mIRC cannot return a short pathname for a path that doesn't exist.

Short filenames can be disabled on NTFS volumes, in which case any files or directories created after it has been disabled will return their long name.

If $shortfn fails to work on any new directories or files you create then you can check to see if this is the issue by looking at the value of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\NtfsDisable8dot3NameCreation in the registry. Or if you prefer, here's a simple script that will check it for you

Code:
alias regread {
  var %a = regread $+ $ticks
  .comopen %a WScript.Shell
  if $comerr { return ERROR }
  if !$com(%a,RegRead,3,bstr,$1) {
    .comclose %a
    return ERROR
  }
  var %b = $com(%a).result
  .comclose %a
  return OK %b
}

alias shortfns {
  ; Will return 1 if short filenames are enabled, 0 if they are disabled, or -1 if there was an error
  tokenize 32 $regread(HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\NtfsDisable8dot3NameCreation)
  if ($1 == ERROR) return -1
  else return $iif($2,0,1)
}

Just type //echo -a Short filenames are $iif($shortfns == 1, enabled, $iif(!$v1, disabled, *error*: couldn't read registry))

If newly created files/directories work just fine then it's possible it was disabled and re-enabled since, or it's possible that I'm way off and the problem is something else entirely.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: May 2005
Posts: 12
S
sprion Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: May 2005
Posts: 12
Hmm ok, if it doesn't work for paths that don't exist .. then I think RoCk above wouldn't have been able to still generate a correct $shortfn result.

But you're right, about the registry key, disabled. It's 0, so I assume it's disabled. Very good knowledge there.

Strange though, I haven't changed any settings, and it's a clean install of XP on this system, do you have any ideas and tips for users who may face the same problems ?


Alright, it works after enabling it and create the directory 'test again'

C:\Documents and Settings\jeric\My Documents\workspace\jeric\newscript\sysfiles\addons\zion\the zion\test again

shows:
C:\DOCUME~1\jeric\MYDOCU~1\workspace\jeric\newscript\sysfiles\addons\zion\the zion\TESTAG~1\

I'm also guessing that XP automatically disables shortfn support? after install? these folders 'the zion' were created from my mac os.

Last edited by sprion; 12/12/07 05:45 PM.
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
Quote:
Hmm ok, if it doesn't work for paths that don't exist .. then I think RoCk above wouldn't have been able to still generate a correct $shortfn result.

- Presumably he made the directory beforehand. Windows (and therefore mIRC) retrieves the short filename from the filesystem itself so it cannot return a short filename for something which doesn't exist on the filesystem.

Quote:
But you're right, about the registry key, disabled. It's 0, so I assume it's disabled. Very good knowledge there.

- When you say it's 0, do you mean the registry key itself or the $shortfns identifier I gave you. The registry key itself will be 1 if short filenames are disabled (notice the key's name is NtfsDisable8dot3NameCreation) - my identifier actually reverses the value so that $shortfns returns 1 if short filenames are enabled. I probably should have explained that better in the first post.

If it turns out you really do have short filenames disabled and need them turned on, the only thing I can really suggest is that you use the Microsoft command-line utility fsutil to manually set short filenames for those that don't have one. That's not as simple as it sounds though since you have to give fsutil the short filename to assign to each file - it won't generate them itself. You'd need a script to do it on any non-trivial amount of paths.

If short filenames aren't disabled then I would guess that the problem is to do with Mac OS creating the files. Try playing around with creating them in each OS and see if a pattern emerges.

Last edited by starbucks_mafia; 12/12/07 06:27 PM.

Spelling mistakes, grammatical errors, and stupid comments are intentional.
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031

Originally Posted By: starbucks_mafia

- Presumably he made the directory beforehand. Windows (and therefore mIRC) retrieves the short filename from the filesystem itself so it cannot return a short filename for something which doesn't exist on the filesystem.



Yes I did create it for that reason, I should have mentioned that.

Joined: May 2005
Posts: 12
S
sprion Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: May 2005
Posts: 12
From the above cases, I guess it's safe to assume that it was due to my copying of files from Mac OS onto this Windows partition that generated this error, and not a bug.

The registry key was 0, which means it was enabled from the start, the new folder 'test again' shortfn'ed successfully, while the 'the zion' folder failed because it was copied from Mac OS.

Thank you both for the invaluable feedback!

Joined: Mar 2006
Posts: 395
T
Pan-dimensional mouse
Offline
Pan-dimensional mouse
T
Joined: Mar 2006
Posts: 395
Originally Posted By: sprion
There seems to be a bug with $shortfn.

Path A: C:\Documents and Settings\jeric\My Documents\workspace\jeric\newscript\sysfiles\addons\zion\the zion\

$shortfn(Path A) results:
C:\DOCUME~1\jeric\MYDOCU~1\workspace\jeric\newscript\sysfiles\addons\zion\the zion\

Notice how 'the zion' was not changed..

I'm using Macbook Pro, running Windows XP SP 2, mIRC 6.31


Looking at this... I found it more odd that 'workspace' and 'newscript' wernt changed because of the lengths.

In most cases I see, its better to use $+(",%file,") than $shortfn(%file).
Thats just IMHO.


[02:16] * Titanic has quit IRC (Excess Flood)
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Those wouldn't have been changed for the same reason the last folder wasn't changed.


Invision Support
#Invision on irc.irchighway.net
Joined: Mar 2006
Posts: 395
T
Pan-dimensional mouse
Offline
Pan-dimensional mouse
T
Joined: Mar 2006
Posts: 395
Yeh frown Tis obselete anyway. "" ftw.


[02:16] * Titanic has quit IRC (Excess Flood)

Link Copied to Clipboard