From 9fa28d7df3034600026aacbfb902a4f92446253b Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Tue, 29 Nov 2011 14:55:55 -0500 Subject: [PATCH] Windows: no drive subst for NPCancelConnection NPCancelConnection() must use the results of a Get Connection ioctl to the afs redirector and not the result of Drive Letter Substitution queries via DosQueryDevice(). Rename NPGetConnection() to NPGetConnectionCommon() and add a new parameter to indicate whether drive substitution is ok. Change-Id: I42cd4488038f128ae90356a41bc538966d9cebed Reviewed-on: http://gerrit.openafs.org/6139 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/WINNT/afsrdr/npdll/AFS_Npdll.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/WINNT/afsrdr/npdll/AFS_Npdll.c b/src/WINNT/afsrdr/npdll/AFS_Npdll.c index e63ee095b..51fe57a04 100644 --- a/src/WINNT/afsrdr/npdll/AFS_Npdll.c +++ b/src/WINNT/afsrdr/npdll/AFS_Npdll.c @@ -72,6 +72,12 @@ ULONG _cdecl AFSDbgPrint( PWCHAR Format, ... ); +static DWORD APIENTRY +NPGetConnectionCommon( LPWSTR lpLocalName, + LPWSTR lpRemoteName, + LPDWORD lpBufferSize, + BOOL bDriveSubstOk); + #define WNNC_DRIVER( major, minor ) ( major * 0x00010000 + minor ) #define OPENAFS_PROVIDER_NAME L"OpenAFS Network" @@ -912,9 +918,10 @@ NPCancelConnection( LPWSTR lpName, // Get the remote name for the connection, if we are handling it // - dwStatus = NPGetConnection( lpName, - wchRemoteName, - &dwRemoteNameLength); + dwStatus = NPGetConnectionCommon( wchLocalName, + wchRemoteName, + &dwRemoteNameLength, + FALSE); if( dwStatus != WN_SUCCESS || dwRemoteNameLength == 0) @@ -1155,6 +1162,20 @@ NPGetConnection( LPWSTR lpLocalName, LPDWORD lpBufferSize) { + return NPGetConnectionCommon( lpLocalName, + lpRemoteName, + lpBufferSize, + TRUE); +} + +DWORD +APIENTRY +NPGetConnectionCommon( LPWSTR lpLocalName, + LPWSTR lpRemoteName, + LPDWORD lpBufferSize, + BOOL bDriveSubstOk) +{ + DWORD dwStatus = WN_NOT_CONNECTED; WCHAR wchLocalName[3]; WCHAR wchSubstName[MAX_PATH + 1]; @@ -1195,7 +1216,8 @@ NPGetConnection( LPWSTR lpLocalName, dwPassedSize = *lpBufferSize; - if ( !DriveSubstitution( lpLocalName, wchSubstName, sizeof( wchSubstName))) + if ( !bDriveSubstOk || + !DriveSubstitution( lpLocalName, wchSubstName, sizeof( wchSubstName))) { wchLocalName[0] = towupper(lpLocalName[0]); wchLocalName[1] = L':'; -- 2.39.5