Windows: Prevent explorer shell extension from crashing if symbolic link add fails
authorJeffrey Altman <jaltman@your-file-system.com>
Fri, 12 Feb 2010 02:45:40 +0000 (21:45 -0500)
committerJeffrey Altman <jaltman@openafs.org>
Fri, 12 Feb 2010 02:49:45 +0000 (18:49 -0800)
The explorer shell extension was passing the wrong parameters to
the MessageBox API when a symbolic link add failed.   The end result
was stack corruption.

FIXES 126406

Change-Id: I59b8b71d947525adccbd817cd5b6d4de5bf082b7
Reviewed-on: http://gerrit.openafs.org/1298
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

src/WINNT/client_exp/make_symbolic_link_dlg.cpp

index e35ac78..4816008 100644 (file)
@@ -68,9 +68,7 @@ END_MESSAGE_MAP()
 
 void CMakeSymbolicLinkDlg::OnOK() 
 {
-    char space[64];
     UINT code;
-    int i;
     UpdateData(TRUE);
     CString strName;
     CString strTarget;
@@ -79,23 +77,23 @@ void CMakeSymbolicLinkDlg::OnOK()
     if (!IsPathInAfs(m_sBase)) {
         MessageBeep((UINT)-1);
         strTarget+=" - Path is not in AFS directory";
-        AfxMessageBox(strTarget,MB_OK);
+        AfxMessageBox(strTarget,MB_ICONERROR);
         return;
     } 
     if (m_sBase.GetLength()>MAX_PATH-2)
     {
         MessageBeep((UINT)-1);
-        ShowMessageBox(IDS_CURRENT_DIRECTORY_PATH_TOO_LONG,MB_OK,IDS_CURRENT_DIRECTORY_PATH_TOO_LONG);
+        ShowMessageBox(IDS_CURRENT_DIRECTORY_PATH_TOO_LONG,MB_ICONERROR,IDS_CURRENT_DIRECTORY_PATH_TOO_LONG);
     }
     if (!SetCurrentDirectory(m_sBase))
     {
         MessageBeep((UINT)-1);
-        ShowMessageBox(IDS_UNABLE_TO_SET_CURRENT_DIRECTORY,MB_OK,IDS_UNABLE_TO_SET_CURRENT_DIRECTORY);
+        ShowMessageBox(IDS_UNABLE_TO_SET_CURRENT_DIRECTORY,MB_ICONERROR,IDS_UNABLE_TO_SET_CURRENT_DIRECTORY);
         return;
     }
     if ((code=MakeSymbolicLink(strName,strTarget))!=0){
         MessageBeep((UINT)-1);
-        ShowMessageBox(IDS_UNABLE_TO_CREATE_SYMBOLIC_LINK,MB_OK,IDS_UNABLE_TO_CREATE_SYMBOLIC_LINK,code);
+        ShowMessageBox(IDS_UNABLE_TO_CREATE_SYMBOLIC_LINK,MB_ICONERROR,IDS_UNABLE_TO_CREATE_SYMBOLIC_LINK,GetAfsError(code, strName));
         return;
     }
     CDialog::OnOK();