EMULAB Forum

clrmamepro [English] => clrmame Discussion => Topic started by: Cassiel on 21 September 2020, 09:37

Title: 32k Path Length Issue
Post by: Cassiel on 21 September 2020, 09:37
Hey Roman, long time no post.

I'm experiencing an issue regarding your v4.036 change:
"added: automatic 32k path length support, no more need to use \\?\ prefixes (*)"
(BTW was super stoked when I read that!)

I have a TOSEC-PIX DAT that CMP does not recognise:
"C:\Program Files\ClrMamePro\datfiles\TOSEC-PIX\Tandy Radio Shack\Magazines\Byte Bandits of America Tandy TRS-80's Computer Club Newsletter\Tandy Radio Shack - Magazines - Byte Bandits of America Tandy TRS-80's Computer Club Newsletter (TOSEC-v2010-01-21_CM)"

The path length is 261, which takes it over the MAX_PATH limit of 260 (by one bloody char!) but my understanding is this should not be an issue now?

Obviously this is not the end of the world, can work around, but thought you would like to know (especially if an easy fix). I've not checked any other TOSEC DATs yet, this is just one I spotted first.
Title: Re: 32k Path Length Issue
Post by: Roman on 21 September 2020, 09:50
So..what is actually the issue? Yes, all file operations are wrapped so they detect too long paths and automatically add a prefix when needed, so the question is really where exactly (during which operation) it fails for you. I assume in the profiler when adding the datfile? (can you send it please). Or during a datfile update? during a batch run? Drag'n drop a datfiles? So..where exactly?
Title: Re: 32k Path Length Issue
Post by: Cassiel on 21 September 2020, 10:09
Profiler. Brand new DAT, sitting in that path (manually copied over). It's definitely there, I can see/open it through regular Windows Explorer and XYplorer. Profiler does not see it.
Title: Re: 32k Path Length Issue
Post by: Roman on 21 September 2020, 10:52
ah..manually copied over is bad ;) The profiler data is cached. It won't recognize your manual changes. Either use "add" or hit "refresh list". So maybe it's not related to long paths at all
Title: Re: 32k Path Length Issue
Post by: Cassiel on 21 September 2020, 11:28
Hmmm, will try again using "Add" later today (I do usually use Add for MAME Softlists, but not most DATs).

I did try Refreshing a couple of times.... no change.
Title: Re: 32k Path Length Issue
Post by: Roman on 21 September 2020, 11:46
ok...I can repeat it and I know the problem.....and I'm working on it
Title: Re: 32k Path Length Issue
Post by: Cassiel on 22 September 2020, 08:39
Excellent...   :)
Title: Re: 32k Path Length Issue
Post by: Roman on 23 September 2020, 09:59
well, while it was relatively easy and obvious why it didn't work, fixing that one brings up a new problem. It now shows up in the profiler but when cmpro tries to create profile-based backup folders it fails. For whatever reason a CreateDirectory call fails for long values (even though it should support 32k since it's a unicode variant and got the well known prefix in its path). Grr.....will dig deeper into win32 function calls now.....stay tuned
Title: Re: 32k Path Length Issue
Post by: Cassiel on 23 September 2020, 14:57
Cool. As always, thanks for the attention to detail.
Title: Re: 32k Path Length Issue
Post by: Roman on 23 September 2020, 19:17
well...fine...great...found out that if you want to recursively create a directory with a long path (e:\long\verylong\evenlonger\.........etc), then you need to add the \\?\ prefix right from the beginning and not only if the recursion sees that the filename gets too long. Totally weird behaviour..but that works for now.

But of course, I found the next win32 api call which might have a problem under some circumstances when path+filename gets too big....*sigh*

But on the other hand, I guess I somehow fooled Windows10 a bit...I've created folders in folders and used very long names. Until Windows complained that it gets too long. Then I reduced it a bit, put the dat inside it, stepped up some parent folders and increased their length again. I wasn't able to move any file to the deepest folder anymore and aren't able to rename the folder anymore......and the win32 api calls also fail.
So I more assume it's a Windows bug ;)
Title: Re: 32k Path Length Issue
Post by: Roman on 24 September 2020, 17:59
https://mamedev.emulab.it/clrmamepro/binaries/cmpro20200924.7z
Title: Re: 32k Path Length Issue
Post by: Cassiel on 27 September 2020, 12:44
Perfect.

Apologies for the belated feedback.
Title: Re: 32k Path Length Issue
Post by: Roman on 28 September 2020, 15:19
you're welcome.....I need users like you who spot the weirdest things ;)
Title: Re: 32k Path Length Issue
Post by: Cassiel on 12 November 2020, 15:23
You're going to regret saying that, have spotted another weird thing...   ;D

I have a DAT set, it is complete (224 files in folder, as should be).

When I run a scan in CMP, it insists I am missing the ROM (but not SET interestingly): "Montezuma's Revenge (1984)(Parker Brothers)(II+)[cr Black Bag - High Society][48K] & One On One (1983)(Electronic Arts)[cr L.S.D.][48K] & Hard Hat Mack (1983)(Electronic Arts)[cr Mr. Krac-Man][48K].rar".

The file is definitely there, I can see (and retrieve Properties for example) in both Windows Explorer and XYplorer. I can open it in WinRAR without issue, and it passes Test Archive.

The path is: "G:\Emulation Images\TOSEC\Apple\II\Compilations\Games\[DO]\Montezuma's Revenge (1984)(Parker Brothers)(II+)[cr Black Bag - High Society][48K] & One On One (1983)(Electronic Arts)[cr L.S.D.][48K] & Hard Hat Mack (1983)(Electronic Arts)[cr Mr. Krac-Man][48K].rar" which is obviously on the long side again.
Title: Re: 32k Path Length Issue
Post by: Roman on 12 November 2020, 18:43
did you use the lastest nightly?

If no, try it. If yes, send me the dat, the file in question, your *.cmp file (cmpro's settings folder) and cmpro.ini
Title: Re: 32k Path Length Issue
Post by: Cassiel on 12 November 2020, 22:04
Just tired, no dice. PM coming your way...
Title: Re: 32k Path Length Issue
Post by: Cassiel on 12 November 2020, 22:07
Oh! Forgot attachments disabled.

Find below:
Title: Re: 32k Path Length Issue
Post by: Roman on 18 November 2020, 18:43
Fixed in next nightly.... :)

funnily enough the path is exactly 260 chars long (which is identical to the system's MAX_PATH).
But hitting this means I have to auto add the 32k prefix stuff....so I had to change the check from < MAX_PATH to <= MAX_PATH

https://mamedev.emulab.it/clrmamepro/binaries/cmpro20201118.7z
Title: Re: 32k Path Length Issue
Post by: Cassiel on 20 November 2020, 21:14
Excellent. Thanks, will give it a go.