/[winpt]/trunk/Src/wptErrors.cpp
ViewVC logotype

Diff of /trunk/Src/wptErrors.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 36 by werner, Thu Oct 27 15:25:13 2005 UTC revision 190 by twoaday, Mon Mar 27 10:05:14 2006 UTC
# Line 1  Line 1 
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   *   *
# Line 23  Line 23 
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"
# Line 75  winpt_strerror (int errid) Line 74  winpt_strerror (int errid)
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");
# Line 93  winpt_strerror (int errid) Line 93  winpt_strerror (int errid)
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");
# Line 104  winpt_strerror (int errid) Line 104  winpt_strerror (int errid)
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");
# Line 112  winpt_strerror (int errid) Line 112  winpt_strerror (int errid)
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");
# Line 146  winpt_errmsg (const char * name, int is_ Line 147  winpt_errmsg (const char * name, int is_
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
# Line 223  log_debug (const char *format, ...) Line 220  log_debug (const char *format, ...)
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];
# Line 235  log_box (const char *title, int style, c Line 232  log_box (const char *title, int style, c
232      va_end( arg_ptr );      va_end( arg_ptr );
233    
234      return id;      return id;
235  } /* log_box */  }
236    

Legend:
Removed from v.36  
changed lines
  Added in v.190

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26