httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 35343] New: - [PatchAvailable] Add MSI logging to ResolveServerName in Real_Features.dll
Date Mon, 13 Jun 2005 15:24:17 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=35343>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=35343

           Summary: [PatchAvailable] Add MSI logging to ResolveServerName in
                    Real_Features.dll
           Product: Apache httpd-2.0
           Version: 2.0-HEAD
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: minor
          Priority: P2
         Component: All
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: eddiearmeen@yahoo.co.uk
                CC: eddiearmeen@yahoo.co.uk


There are a number of bugs and issues where people are trying to install 
apache on windows and they get an "Installation Interupted" error message, for 
some reason ResolveServerName has failed calling gethostbyname.  
ResolveServerName exits and there is no indication of why it fails.

I have added logging of WSAGetLastError when gethostbyname fails (I also added 
it for WSAStartup for good measure) so when users try to install using the MSI 
and it fails, by enabling msi logging they will at least have an indication of 
why it failed, instead of just that it failed.





Index: real_features.c
===================================================================
--- real_features.c     (revision 190008)
+++ real_features.c     (working copy)
@@ -65,6 +65,45 @@

 #define MAXHOSTNAMELEN 255

+#define MAXSTRINGLEN 2048
+
+
+UINT __stdcall LogMsiError( MSIHANDLE hInstall, char* szFunction,int  
dwError )
+{
+
+
+       char szBuf[MAXSTRINGLEN];
+    LPVOID lpMsgBuf;
+       MSIHANDLE hRecord;
+
+
+    FormatMessage(
+        FORMAT_MESSAGE_ALLOCATE_BUFFER |
+        FORMAT_MESSAGE_FROM_SYSTEM,
+        NULL,
+        dwError,
+        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+        (LPTSTR) &lpMsgBuf,
+        0, NULL );
+
+    wsprintf(szBuf,
+        "%s failed with error: %s",
+        szFunction, lpMsgBuf);
+
+
+    LocalFree(lpMsgBuf);
+
+
+
+       hRecord = MsiCreateRecord( 1 );
+       MsiRecordSetString( hRecord, 0, szBuf );
+       MsiProcessMessage(hInstall,INSTALLMESSAGE_INFO,hRecord);
+    MsiCloseHandle(hRecord);
+
+       return ERROR_SUCCESS;
+
+}
+
 UINT __declspec(dllexport) __stdcall ResolveServerName(MSIHANDLE hInstall)
 {
     char str[MAXHOSTNAMELEN + 7]; /* Allow for admin@ */
@@ -72,23 +111,27 @@
     struct hostent *p;
     WSADATA ver;
     int x, y;
-
+
     if (WSAStartup(MAKEWORD(2, 0), &ver)) {
         MsiSetPropertyA(hInstall, "RESOLVED_WINSOCK2", "0");
+               LogMsiError( hInstall, "Real_Features_Dll:ResolveServerName 
WSAStartup", WSAGetLastError() );
         return ERROR_SUCCESS;
     }

     if (ver.wVersion < 2) {
         WSACleanup();
         MsiSetPropertyA(hInstall, "RESOLVED_WINSOCK2", "0");
-        return ERROR_SUCCESS;
+               return ERROR_SUCCESS;
     }

     MsiSetPropertyA(hInstall, "RESOLVED_WINSOCK2", "1");

+
     if ((gethostname(str, MAXHOSTNAMELEN) != 0)) {
-        WSACleanup();
-        return ERROR_SUCCESS;
+       //We failed to get the hostname so log the actual winsock error
+               LogMsiError( hInstall, "Real_Features_Dll:ResolveServerName 
gethostname", WSAGetLastError() );
+               WSACleanup();
+               return ERROR_SUCCESS;
     }

     if (strchr(str, '.'))

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


Mime
View raw message