@@ -466,6 +466,11 @@ BOOL DeleteMountPoint(LPCWSTR MountPoint) {
466466 if (result ) {
467467 DbgPrintW (L"DeleteMountPoint %s success\n" , MountPoint );
468468 } else {
469+ if (GetLastError () == ERROR_NOT_A_REPARSE_POINT ) {
470+ // Not a failure for us as this happen when mount manager
471+ // is used and reparse point is removed from kernel.
472+ return TRUE;
473+ }
469474 FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM , NULL , GetLastError (),
470475 MAKELANGID (LANG_NEUTRAL , SUBLANG_DEFAULT ), errorMsg , 256 ,
471476 NULL );
@@ -546,11 +551,10 @@ BOOL DokanMount(LPCWSTR MountPoint, LPCWSTR DeviceName,
546551 UNREFERENCED_PARAMETER (DokanOptions );
547552 if (MountPoint != NULL ) {
548553 if (!IsMountPointDriveLetter (MountPoint )) {
549- // Unfortunately mount manager is not working as excepted and don't
550- // support mount folder on associated IOCTL, which breaks dokan (ghost
551- // drive, ...)
552- // In that case we cannot use mount manager ; doesn't this should be done
553- // kernel-mode too?
554+ if (DokanOptions -> Options & DOKAN_OPTION_MOUNT_MANAGER ) {
555+ return TRUE; // Kernel has already created the reparse point.
556+ }
557+ // Should it not also be moved to kernel ?
554558 return CreateMountPoint (MountPoint , DeviceName );
555559 } else {
556560 // Notify applications / explorer
@@ -578,12 +582,8 @@ BOOL DokanRemoveMountPointEx(LPCWSTR MountPoint, BOOL Safe) {
578582
579583 if (SendGlobalReleaseIRP (mountPoint )) {
580584 if (!IsMountPointDriveLetter (MountPoint )) {
581- length = wcslen (mountPoint );
582- if (length + 1 < MAX_PATH ) {
583- mountPoint [length ] = L'\\' ;
584- mountPoint [length + 1 ] = L'\0' ;
585- return DeleteMountPoint (mountPoint );
586- }
585+ wcscat_s (mountPoint , sizeof (mountPoint ) / sizeof (WCHAR ), L"\\" );
586+ return DeleteMountPoint (mountPoint );
587587 } else {
588588 // Notify applications / explorer
589589 DokanBroadcastLink (MountPoint [0 ], TRUE, Safe );
0 commit comments