1 |
/* wptErrors.cpp - Error management |
/* wptErrors.cpp - Error management |
2 |
* Copyright (C) 2000-2004 Timo Schulz |
* Copyright (C) 2000-2006 Timo Schulz |
3 |
* |
* |
4 |
* This file is part of WinPT. |
* This file is part of WinPT. |
5 |
* |
* |
23 |
#endif |
#endif |
24 |
|
|
25 |
#include <windows.h> |
#include <windows.h> |
|
#include <windows.h> |
|
26 |
#include <stdio.h> |
#include <stdio.h> |
27 |
|
|
28 |
#include "wptErrors.h" |
#include "wptErrors.h" |
74 |
static char buf[256]; |
static char buf[256]; |
75 |
|
|
76 |
switch( errid ) { |
switch( errid ) { |
77 |
|
case -1: w32_fmt_msg (buf, 255); return buf; |
78 |
case WPTERR_GENERAL: return _("General error occured"); |
case WPTERR_GENERAL: return _("General error occured"); |
79 |
case WPTERR_FILE_OPEN: return _("Could not open file"); |
case WPTERR_FILE_OPEN: return _("Could not open file"); |
80 |
case WPTERR_FILE_CREAT: return _("Could not create file"); |
case WPTERR_FILE_CREAT: return _("Could not create file"); |
93 |
case WPTERR_CLIP: return _("General Clipboard error"); |
case WPTERR_CLIP: return _("General Clipboard error"); |
94 |
case WPTERR_REGISTRY: sprintf (buf, "%s", _("Registry error: ")); |
case WPTERR_REGISTRY: sprintf (buf, "%s", _("Registry error: ")); |
95 |
w32_fmt_msg (buf + strlen (buf), 128); |
w32_fmt_msg (buf + strlen (buf), 128); |
96 |
break; |
return buf; |
97 |
case WPTERR_WINSOCK_INIT: return _("Could not startup Winsock 2 interface"); |
case WPTERR_WINSOCK_INIT: return _("Could not startup Winsock 2 interface"); |
98 |
case WPTERR_WINSOCK_RESOLVE: return _("Could not resolve hostname"); |
case WPTERR_WINSOCK_RESOLVE: return _("Could not resolve hostname"); |
99 |
case WPTERR_WINSOCK_SOCKET: return _("Could not create new socket"); |
case WPTERR_WINSOCK_SOCKET: return _("Could not create new socket"); |
104 |
case WPTERR_KEYSERVER_NOTFOUND: return _("Keyserver returned: no matching keys in database"); |
case WPTERR_KEYSERVER_NOTFOUND: return _("Keyserver returned: no matching keys in database"); |
105 |
case WPTERR_HOTKEY: sprintf (buf, "%s", _("Could not register hotkey: ")); |
case WPTERR_HOTKEY: sprintf (buf, "%s", _("Could not register hotkey: ")); |
106 |
w32_fmt_msg (buf + strlen (buf), 128); |
w32_fmt_msg (buf + strlen (buf), 128); |
107 |
break; |
return buf; |
108 |
case WPTERR_DIR_OPEN: return _("Could not open directory"); |
case WPTERR_DIR_OPEN: return _("Could not open directory"); |
109 |
case WPTERR_DIR_CREAT: return _("Could not create directory"); |
case WPTERR_DIR_CREAT: return _("Could not create directory"); |
110 |
case WPTERR_CURR_WND: return _("Could not extract data from the current window"); |
case WPTERR_CURR_WND: return _("Could not extract data from the current window"); |
112 |
case WPTERR_GPG_EXEFILE: |
case WPTERR_GPG_EXEFILE: |
113 |
case WPTERR_GPG_OPT_KEYRINGS: |
case WPTERR_GPG_OPT_KEYRINGS: |
114 |
case WPTERR_GPG_KEYRINGS: return gpg_strerror (errid); |
case WPTERR_GPG_KEYRINGS: return gpg_strerror (errid); |
115 |
|
case WPTERR_NODATA: return _("No data available"); |
116 |
case WPTERR_NOCARD: return _("There is no card in the reader"); |
case WPTERR_NOCARD: return _("There is no card in the reader"); |
117 |
case WPTERR_NOREADER: return _("There was no reader found"); |
case WPTERR_NOREADER: return _("There was no reader found"); |
118 |
case WPTERR_NOPGPCARD: return _("This is not an OpenPGP card"); |
case WPTERR_NOPGPCARD: return _("This is not an OpenPGP card"); |
147 |
MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), |
MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), |
148 |
buf, DIM (buf)-1, NULL); |
buf, DIM (buf)-1, NULL); |
149 |
MessageBox (NULL, buf, head, MB_OK); |
MessageBox (NULL, buf, head, MB_OK); |
150 |
} /* winpt_errmsg */ |
} |
151 |
|
|
152 |
|
|
153 |
|
|
154 |
|
/* This function is used to cleanup static debug resources. */ |
155 |
void |
void |
156 |
winpt_debug_msg( void ) |
debug_end (void) |
157 |
{ |
{ |
158 |
char output[768], temp[384]; |
} |
159 |
|
|
|
GetTempPath( sizeof temp -1, temp ); |
|
|
_snprintf( output, sizeof output - 1, |
|
|
"The GPGME output file is gpgme.dbg\n" |
|
|
"The WinPT output file is %swinpt.log\n", temp ); |
|
|
MessageBox( NULL, output, "WinPT now runs in DEBUG MODE", MB_INFO ); |
|
|
} /* winpt_debug_msg */ |
|
160 |
|
|
161 |
|
|
162 |
void |
void |
220 |
|
|
221 |
|
|
222 |
int |
int |
223 |
log_box (const char *title, int style, const char *format, ...) |
printf_box (const char *title, int style, const char *format, ...) |
224 |
{ |
{ |
225 |
va_list arg_ptr; |
va_list arg_ptr; |
226 |
char log[8192]; |
char log[8192]; |
232 |
va_end( arg_ptr ); |
va_end( arg_ptr ); |
233 |
|
|
234 |
return id; |
return id; |
235 |
} /* log_box */ |
} |
236 |
|
|