remove last hardcode string to En.rc need translate to other langes new strings in En.rc are IDS_DNS_ERROR, IDS_SOCKET_ERROR, IDS_GET_SRV_ERROR, IDS_CON_SRV_ERROR Modified: trunk/reactos/subsys/system/reporterror/En.rc Modified: trunk/reactos/subsys/system/reporterror/reporterror.c Modified: trunk/reactos/subsys/system/reporterror/reporterror.h _____
Modified: trunk/reactos/subsys/system/reporterror/En.rc --- trunk/reactos/subsys/system/reporterror/En.rc 2005-05-09 00:33:23 UTC (rev 15158) +++ trunk/reactos/subsys/system/reporterror/En.rc 2005-05-09 00:38:57 UTC (rev 15159) @@ -52,3 +52,11 @@
IDS_FAILED_TO_LOCATE_SERVER "Failed to contact error reporting server" END
+STRINGTABLE +BEGIN +IDS_DNS_ERROR "Could not resolve DNS for %S (windows error code %d)" +IDS_SOCKET_ERROR "Could not create socket (windows error code %d)" +IDS_GET_SRV_ERROR "Could not get service (windows error code %d)" +IDS_CON_SRV_ERROR "Could not connect to server (windows error code %d)" +END + _____
Modified: trunk/reactos/subsys/system/reporterror/reporterror.c --- trunk/reactos/subsys/system/reporterror/reporterror.c 2005-05-09 00:33:23 UTC (rev 15158) +++ trunk/reactos/subsys/system/reporterror/reporterror.c 2005-05-09 00:38:57 UTC (rev 15159) @@ -212,6 +212,7 @@
struct hostent *hp; struct servent *sp; INT error; + WCHAR szMsg[1024]; SOCKET s;
*clientSocket = 0; @@ -220,7 +221,10 @@ if (hp == NULL) { error = WSAGetLastError(); - wsprintf(errorMessage, L"Could not resolve DNS for %S (windows error code %d)", host, error); + + //L"Could not resolve DNS for %S (windows error code %d) + LoadString( GetModuleHandle(NULL), IDS_DNS_ERROR, (LPTSTR) szMsg, sizeof(szMsg) / sizeof(WCHAR)); + wsprintf(errorMessage, L"Could not resolve DNS for %S (windows error code %d)", host, error); return error; }
@@ -228,7 +232,10 @@ if (s < 0) { error = WSAGetLastError(); - wsprintf(errorMessage, L"Could not create socket (windows error code %d)", error); + + // L"Could not create socket (windows error code %d) + LoadString( GetModuleHandle(NULL), IDS_SOCKET_ERROR, (LPTSTR) szMsg, sizeof(szMsg) / sizeof(WCHAR)); + wsprintf(errorMessage, szMsg, error); return error; }
@@ -237,7 +244,10 @@ if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) { error = WSAGetLastError(); - wsprintf(errorMessage, L"Could not resolve DNS for %S (windows error code %d)", host, error); + + //L"Could not resolve DNS for %S (windows error code %d) + LoadString( GetModuleHandle(NULL), IDS_DNS_ERROR, (LPTSTR) szMsg, sizeof(szMsg) / sizeof(WCHAR)); + wsprintf(errorMessage, L"Could not resolve DNS for %S (windows error code %d)", host, error); closesocket(s); return error; } @@ -247,7 +257,11 @@ if (sp == NULL) { error = WSAGetLastError(); - wsprintf(errorMessage, L"Could not get service (windows error code %d)", error); + + //L"Could not get service (windows error code %d)" + + LoadString( GetModuleHandle(NULL), IDS_GET_SRV_ERROR, (LPTSTR) szMsg, sizeof(szMsg) / sizeof(WCHAR)); + wsprintf(errorMessage, szMsg, error); closesocket(s); return error; } @@ -257,7 +271,10 @@ if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) { error = WSAGetLastError(); - wsprintf(errorMessage, L"Could not connect to server (windows error code %d)", error); + + //L"Could not connect to server (windows error code %d)" + LoadString( GetModuleHandle(NULL), IDS_CON_SRV_ERROR, (LPTSTR) szMsg, sizeof(szMsg) / sizeof(WCHAR)); + wsprintf(errorMessage,szMsg , error); closesocket(s); return error; } _____
Modified: trunk/reactos/subsys/system/reporterror/reporterror.h --- trunk/reactos/subsys/system/reporterror/reporterror.h 2005-05-09 00:33:23 UTC (rev 15158) +++ trunk/reactos/subsys/system/reporterror/reporterror.h 2005-05-09 00:38:57 UTC (rev 15159) @@ -41,6 +41,12 @@
#define IDB_WATERMARK 100 #define IDB_HEADER 101
+ +#define IDS_DNS_ERROR 600 +#define IDS_SOCKET_ERROR 601 +#define IDS_GET_SRV_ERROR 602 +#define IDS_CON_SRV_ERROR 603 + typedef struct _ERROR_REPORT { LPSTR YourEmail;