From: bunjia on
Hi,
I'm trying to change a removable disk label.
If I use the SetVolumeLevel API, then it uses only upper-case letters.
I need to have lower case as well.
I know that the label is actually kept as a hidden system file in the
root directory of the disk, but I haven't succeeded in programatically
finding and renaming that file to the new label.

Does anyone know how to do this?

Thanks,
B.

From: Kellie Fitton on
Hi,

You can use the following API to set the label of a file
system volume such as a floppy or a hard drive disk:

SetVolumeLabel()

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/setvolumelabel.asp

Hope these suggestions helps,

Kellie.

From: bunjia on
Hi,
Yes, that's the API I used: SetVolumeLabel, not SetVolumeLevel. Nice
typo, right? ;-)
The behavior is that even if I give it a label with lower case letters,
it sets the label with only upper-case letters.

Thanks,
B.

From: David Jones on
bunjia(a)gmail.com wrote:

> The behavior is that even if I give it a label with lower case letters,
> it sets the label with only upper-case letters.

It's been that way since the old DOS days. (I think it's also a
requirement in OS/2.) AFAIK, there's no way to set lower case
through the API since uppercase is a requirement of 8.3 filenames
on FAT. The only way that I've ever seen it done is by walking
through the filesystem structures on the disk, although that
would be my last choice.

You could try IShellFolder.SetNameOf if you only need it to
display mixed case on one machine. IIRC, this sets some entry
in the registry so the shell displays it in mixed case even
though it's really in upper case. For a removable disk, though,
this wouldn't really work too well.

I think you're going to have to look for the file in the root
directory that has the "volume label" attribute: 0x08.
FindFirstFile might find this file, so I'd try that first. If
not, you'll probably need to walk the FAT structures by hand.

HTH,

David
From: Grzegorz on
bunjia(a)gmail.com wrote:

> Hi,
> I'm trying to change a removable disk label.
> If I use the SetVolumeLevel API, then it uses only upper-case letters.
> I need to have lower case as well.
> I know that the label is actually kept as a hidden system file in the
> root directory of the disk, but I haven't succeeded in programatically
> finding and renaming that file to the new label.

You can't do that, drives volumes support only uppercase.
Shell can display lower case but that's a cheat. When you change drive label via explorer to lowercase it additionalyy adds registry entry HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\%driveGuid%\_LabelFromReg and for dispaying it in Windows Explorer it reads name from there. But other programs will read real label directly from drive so it will be uppercase. Also this is stored locally in a registry, not on a drive, so in case of removable media trying to change label to lowercase would be pointless.

--
677265676F727940346E6575726F6E732E636F6D