]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
afssvrcfg-updates-20031206
authorJeffrey Altman <jaltman@grand.central.org>
Sun, 7 Dec 2003 03:39:50 +0000 (03:39 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Sun, 7 Dec 2003 03:39:50 +0000 (03:39 +0000)
Replace the mechanism used to register drives with WNetAddConnection2.
This will hopefully be more reliable than then older code which was
unable to register drive mappings.

Corrected error string formatting.

src/WINNT/afssvrcfg/cfg_utils.cpp
src/WINNT/afssvrcfg/config_server_page.cpp

index aa3461251e4f914fbc7fe7fd028d7b027fa382fb..ff6ca87c539dd12e91ead10888c4ede1d36d0c3b 100644 (file)
@@ -109,9 +109,9 @@ void LogError(afs_status_t nErrorCode)
     const char *pszMsg = GetAdminLibErrorCodeMessage(nErrorCode);
     
     if (pszMsg)
-        g_LogFile.Write("Error %0xd has occurred:  %s.\r\n", (UINT)nErrorCode, pszMsg);
+        g_LogFile.Write("Error 0x%0x has occurred: %s.\r\n", (UINT)nErrorCode, pszMsg);
     else
-        g_LogFile.Write("Error %0xd has occurred.\r\n", (UINT)nErrorCode);
+        g_LogFile.Write("Error 0x%0x has occurred.\r\n", (UINT)nErrorCode);
 }
 
 void ShowError(HWND hDlg, afs_status_t nErrorCode, UINT uiErrorMsgID)
index 56bde11f01909392ab4fc77334070e2d67e1843b..f8d0edcdc5eb5f472c782f05b473926ae168f53d 100644 (file)
@@ -1389,10 +1389,20 @@ static BOOL CreateRootAfsDriveMapping()
     char chDriveLetter;
 
 try_again:
+    NETRESOURCE nr;
+    memset (&nr, 0x00, sizeof(NETRESOURCE));
+
     for (chDriveLetter = 'D'; (chDriveLetter <= 'Z') && !m_bRootAfsDriveMappingCreated; chDriveLetter++) {
         m_szDriveToMapTo[0] = chDriveLetter;
         g_LogFile.Write("Attempting to map %s to %s: ", m_szDriveToMapTo, szAfsRootDir);
-        m_bRootAfsDriveMappingCreated = (WNetAddConnection(A2S(szAfsRootDir), TEXT(""), A2S(m_szDriveToMapTo)) == NO_ERROR);
+
+        nr.dwType=RESOURCETYPE_DISK;
+        nr.lpLocalName=m_szDriveToMapTo;
+        nr.lpRemoteName=szAfsRootDir;
+        nr.dwDisplayType = RESOURCEDISPLAYTYPE_SHARE;
+        DWORD res=WNetAddConnection2(&nr,TEXT(""),NULL,0);
+        m_bRootAfsDriveMappingCreated = (res == NO_ERROR);
+        // m_bRootAfsDriveMappingCreated = (WNetAddConnection(A2S(szAfsRootDir), TEXT(""), A2S(m_szDriveToMapTo)) == NO_ERROR);
         g_LogFile.Write(m_bRootAfsDriveMappingCreated ? "succeeded.\r\n" : "failed.\r\n");
     }