Failure to rename volumes

Found a bug or something that needs fixing?
Post Reply
Posts: 46
Joined: Sun Apr 02, 2017 7:22 am

Failure to rename volumes

Post by Edgar5 » Fri Jan 12, 2018 9:25 am

Assume I have a drive:
and it has a label:
Assume that I run Explorer++ from a CLI with the switch:
so that all the settings are reset to factory default. I now run Explorer++ with no switches (either via CLI or by double-clicking on its icon). Explorer++ opens up into its default size and location showing all the existing partitions on the system (A:\, B:\, C:\, D:\ … Z:\). Each partition displays its label which might look something like:
Data (D:\)
(note that Explorer++ has tacked on - in parentheses - the drive letter. Now, try to change the partition's label WITHOUT removing the appended drive letter:
X (D:\)
the rename fails because the code does not strip off that which it tacked on.

In file:
near line number 820, in the function:
BOOL Explorerplusplus::OnListViewEndLabelEdit(LPARAM lParam)
at the beginning of the function, there are a few sanity checks:
/* Did the user cancel the editing? */
if (pItem->pszText == NULL)
return false;
/* Is the new filename empty? */
if (lstrcmp(pItem->pszText, EMPTY_STRING) == 0)
return false;
/* Deny file names ending with a dot
after these sanity checks we can insert an additional sanity check:
/* partition labels have had their drive letter appended for display so they look like:
name (A:)
If the item is a partition, we must strip this " (*:)" drive letter off (if it is still there)*/
std::wstring currentPartition(pItem->pszText), CWD(currentWorkingDirectory);
if (("::{20D04FE0-3AEA-1069-A2D8-08002B30309D}") == 0)) {//Looking at "Drives" / "My Computer"
std::wstring aa, bb, cc, dd;
size_t fullLength = currentPartition.length();
wchar_t a[3] = { currentPartition[fullLength - 4], 0x0 };
wchar_t b[3] = { currentPartition[fullLength - 3], 0x0 };
wchar_t c[3] = { currentPartition[fullLength - 2], 0x0 };
wchar_t d[3] = { currentPartition[fullLength - 1], 0x0 };
if (("(") == 0) && (":") == 0) && (")") == 0)) {
std::wregex rxPattern;
rxPattern.assign(_T("[A-Z]"), std::regex_constants::icase);
if (std::tr1::regex_match(bb.c_str(), rxPattern)) {
std::wstring volumeLetter, excise;
Replace(currentPartition, excise, L"");
returnValue = SetVolumeLabel(volumeLetter.c_str(), currentPartition.c_str());
if (returnValue)
return returnValue;
/* The following characters are NOT allowed within a file name:
See: */

Post Reply