Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 60b9c23

Browse files
author
Hermann Schinagl
committed
Check if maximum number of available numbered drives is exceeded
1 parent a10cbc1 commit 60b9c23

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

src/wfgoto.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -597,15 +597,18 @@ SetCurrentPathOfWindow(LPWSTR szPath)
597597
{
598598
HWND hwndActive = (HWND)SendMessage(hwndMDIClient, WM_MDIGETACTIVE, 0, 0L);
599599

600-
BOOL bOpenOnReplace = TRUE;
600+
HWND hwndNew = nullptr;
601601
if (ISUNCPATH(szPath))
602602
{
603603
// For UNC path this is the place of opening a new UNC window.
604604
// Use CTRL+W to remove the number-drive mapping and close it
605-
AddUNCDrive(szPath);
606-
bOpenOnReplace = FALSE;
605+
DRIVE freeDriveFound = AddUNCDrive(szPath);
606+
607+
if (freeDriveFound)
608+
hwndNew = CreateDirWindow(szPath, FALSE, hwndActive);
607609
}
608-
HWND hwndNew = CreateDirWindow(szPath, bOpenOnReplace, hwndActive);
610+
else
611+
hwndNew = CreateDirWindow(szPath, TRUE, hwndActive);
609612

610613
HWND hwndTree = HasTreeWindow(hwndNew);
611614
if (hwndTree)

src/wfutil.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,7 +1630,7 @@ DRIVE FindUNCDrive(LPCTSTR path, PDWORD pdwFreeDriveSlot)
16301630
// Added an UNC drive which already existed
16311631
return dwDriveIndex;
16321632

1633-
// If we come across an empt yone, remember the first one
1633+
// If we come across an empty one, remember the first one
16341634
if (!aDriveInfo[dwDriveIndex].szRoot[0] && !(*pdwFreeDriveSlot))
16351635
*pdwFreeDriveSlot = dwDriveIndex;
16361636
}
@@ -1641,7 +1641,7 @@ DRIVE AddUNCDrive(LPCTSTR path)
16411641
{
16421642
DWORD dwFreeDriveSlot = 0;
16431643
DRIVE drive = FindUNCDrive(path, &dwFreeDriveSlot);
1644-
if (!drive){
1644+
if (!drive && dwFreeDriveSlot){
16451645
// Havent't found an existing slot, so add new to first free found
16461646
lstrcpy(aDriveInfo[dwFreeDriveSlot].szRoot, path);
16471647
lstrcpy(aDriveInfo[dwFreeDriveSlot].szRootBackslash, path);

0 commit comments

Comments
 (0)