From 4cced63916945393049cff3610a8d741c67f055f Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Mon, 9 May 2005 00:38:57 +0000 Subject: [PATCH] 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 svn path=/trunk/; revision=15159 --- reactos/subsys/system/reporterror/En.rc | 8 ++++++ .../subsys/system/reporterror/reporterror.c | 27 +++++++++++++++---- .../subsys/system/reporterror/reporterror.h | 6 +++++ 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/reactos/subsys/system/reporterror/En.rc b/reactos/subsys/system/reporterror/En.rc index 0ed32cc5153..eac83cf86db 100644 --- a/reactos/subsys/system/reporterror/En.rc +++ b/reactos/subsys/system/reporterror/En.rc @@ -52,3 +52,11 @@ BEGIN 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 + diff --git a/reactos/subsys/system/reporterror/reporterror.c b/reactos/subsys/system/reporterror/reporterror.c index aeb890bbbd3..7c9a177873e 100644 --- a/reactos/subsys/system/reporterror/reporterror.c +++ b/reactos/subsys/system/reporterror/reporterror.c @@ -212,6 +212,7 @@ ConnectToServer(LPSTR host, struct hostent *hp; struct servent *sp; INT error; + WCHAR szMsg[1024]; SOCKET s; *clientSocket = 0; @@ -220,7 +221,10 @@ ConnectToServer(LPSTR host, 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 @@ ConnectToServer(LPSTR host, 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 @@ ConnectToServer(LPSTR host, 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 @@ ConnectToServer(LPSTR host, 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 @@ ConnectToServer(LPSTR host, 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; } diff --git a/reactos/subsys/system/reporterror/reporterror.h b/reactos/subsys/system/reporterror/reporterror.h index b1e3601003b..3c79314483d 100644 --- a/reactos/subsys/system/reporterror/reporterror.h +++ b/reactos/subsys/system/reporterror/reporterror.h @@ -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;