[stunnel-users] public domain [PATCH] to stunnel 500b3 for Windows CE / Windows Mobile, "no log window bug" on WCE, UNICODE wce/w32, and compilation issues fixed

Pierre DELAAGE delaage.pierre at free.fr
Tue Dec 18 00:17:18 CET 2012


Dear All,
Please find enclosed a patch in "diff -cr orig patched" format, applying 
to stunnel v500b3 as found here https://www.stunnel.org/downloads.html

This patch mainly addresses compilation and unicode issues for Windows 
CE targets + ONE issue preventing stunnel to display error logs in error 
Window on WCE.

This code has been made common to WCE AND W32, by selecting proper win32 
api calls common to both platforms.

For example : InsertMenuItem does not exist on WCE, but InsertMenu can 
do the same job.
ShellExecute does not exist on WCE, but...ShellExecuteEx does exist on 
both platforms and can do the job.


I use MS EVC 4sp4 compiler with WCE 420 SDK, on a vista sp2 host platform.
Once debugged the code works fine on WM6 HTC smartphones.
Should work on WM5.
It needs a windows CE openssl lib (I recompiled MY patched version of 
openssl 1.0.2snap20121213 successfully: I have sent a patch to those 
openssl gentlemen, hoping that they will integrate it one fine day..., 
something not so obvious ...).

You will find my openssl "patch to port", by following carefully this 
thread at openssl diffusion list :

http://marc.info/?l=openssl-dev&m=135574071824906&w=2
two messages are more important than the others : one containing the 
patch on the code. Another one containing 2 useful scripts.

The present stunnel patch addresses the following issues :

*************
I] COMPILATION FAILURES

It is important to state that to detect more type mismatching (that can 
be error prone at runtime), I delibarately use /WX option on both WCE 
and W32 compilers: this flag takes each warning as an error. This is 
very useful for UNICODE clean coding as, without this option, the 
compiler will just warn when seeing a short* (unicode string) used as a 
char* (ansi string), which leads to big pb at run time.

1/ orig/src/client.c
just a warning on missing "return".

2/ evc.mak
new SSLDIR to openssl V102snap20121213
Missing flag x86 needed to get inline function InterlockedExchange from 
winbase.h.
Added dependency to evc.mak itself, as in vc.mak
Added commctrl.lib for CommandBar routines (although, strangely, the 
program was running without that !)

3/ gui.c :
UNICODE port for W32/WCE.
WM_WINDOWSPOSCHHANGED replaces WM_SHOWINDOW, as the latter is 
unsupported in WCE.
some mismatch between prototype and function definition for service_install.
Visible now is a BOOL, as it is more consistant with its value and usage.
Some "return TRUE" have been replaced by "return 0" as stated in msdn doc.
Trick to delete menuitems : itemcount does not exist in WCE, but the 
delete loop is using the return value of deletemenu.
message_boxT created for Tchar vars such as section->help
ShellExecute replaced by shellExecuteEx, common to WCE and W32

4/ prototypes.h : declared message_boxT

5/ resolver.c :
UNICODE issue on LoadLibrary

6/ stunnel.c
type cast for time_t

7/ vc.mak :
inc32 for openssl includes
/WX warning as error flag to see every potential casting problem around 
UNICODE





*************
II] OPERATIONAL ERRORS (at run-time)

1/ error log windows is displayed empty :
cause = WM_SHOWWINDOW does not exist on WCE, although the constant is 
declared !
solution : use WM_WINDOWPOSCHANGED instead...

2/ Unsolved, unfortunaltely :
on WCE only, on start, there is an error message, but no real error behind :
"CommandBar_InsertMenuBar : error 120 : this function is only valid in 
win32 mode"

I am still searching...

*************
III] MINOR IMPROVMENT

1/replaced some win3.1 ugly fonts
See resources.rc :
some nice FONT on About and Password dlgbox...to replace ugly windows3.1 
style bold font...



Note : I use stunnel to establish a simple "vpn" between smartphones and
a corporate linux server mainly for HTTPS/POPS/SMTPS support.
Stunnel is very relevant in that matter, over solutions based on SSH
(although we use also ssh), from a communication cost point of view :
ssh establishes permanent socket between client and server, so that the
communication is charged by the mobile network provider : and these
charges are very expensive.
On the contrary stunnel only establishes ssl sockets on demand so that
financial charges are limited to strict necessary.
Please note that stunnel brings "client based certificate
authentication" to POP/SMTP mobile mail user agents which only BASICALLY 
supports SSL with server authentication, but NO client authentication, 
such as M$ Outlook for Mobile (unless you pay for an exchange server and 
exchange client licence).
Here again stunnel is very relevant.

Note 2 : TODO list and Wish list :

1/ there is a remaining runtime bug on WCE :
On start there is a warning that is NOT causing any failure in the software.
Very difficult to analyse...

2/ find a notepad for WCE...

3/ in log.c...I really it would be good to replace hard coded values for 
socket errors by symbolic constant.

4/ fips openssl for WCE and then stunnel for WCE...

I hope you will find this patch useful.
Michal, thank you for your excellent work,
Yours sincerely,

Pierre Delaage


-------------- next part --------------
Seulement dans patch1: bin
Seulement dans patch1: obj
diff -cr orig/src/client.c patch1/src/client.c
*** orig/src/client.c	2012-12-03 14:12:22.000000000 +0100
--- patch1/src/client.c	2012-12-17 13:03:39.073372500 +0100
***************
*** 889,894 ****
--- 889,895 ----
      default:
          sockerror(text);
          longjmp(c->err, 1);
+ 		 return 1; /* 20121208 pdelaage to avoid warning */
      }
  }
  
diff -cr orig/src/evc.mak patch1/src/evc.mak
*** orig/src/evc.mak	2012-12-02 18:16:52.000000000 +0100
--- patch1/src/evc.mak	2012-12-17 13:05:10.340968500 +0100
***************
*** 10,16 ****
  
  # Modify this to point to your actual openssl compile directory
  # (You did already compile openssl, didn't you???)
! SSLDIR=C:\Users\standard\Documents\Dvts\Contrib\openssl\v1.0.0a\patched3
  
  # Note that we currently use a multi-target customized version of legacy Essemer/wcecompat lib
  COMPATDIR=C:\Users\standard\Documents\Dvts\Contrib\wcecompat\v12\patchedX86
--- 10,16 ----
  
  # Modify this to point to your actual openssl compile directory
  # (You did already compile openssl, didn't you???)
! SSLDIR=C:\Users\standard\Documents\Dvts\Contrib\openssl\v1.0.2-stable-SNAP-20121213\patch1
  
  # Note that we currently use a multi-target customized version of legacy Essemer/wcecompat lib
  COMPATDIR=C:\Users\standard\Documents\Dvts\Contrib\wcecompat\v12\patchedX86
***************
*** 24,30 ****
  !IF "$(TARGETCPU)"=="X86"
  WCETARGETCPU=_X86_
  LDTARGETCPU=X86
! MORECFLAGS=/MT
  
  # TODO: continue list for other targets : see wcecompat/wcedefs.mak for a good ref.
  # see also openssl/util/pl/vc-32.pl, also link /?
--- 24,31 ----
  !IF "$(TARGETCPU)"=="X86"
  WCETARGETCPU=_X86_
  LDTARGETCPU=X86
! #pdelaage 20121210 /Dx86 for inline defs of InterlockedExchange inline in winbase.h
! MORECFLAGS=/MT /Dx86
  
  # TODO: continue list for other targets : see wcecompat/wcedefs.mak for a good ref.
  # see also openssl/util/pl/vc-32.pl, also link /?
***************
*** 34,40 ****
  !ELSEIF "$(TARGETCPU)"=="emulator"
  WCETARGETCPU=_X86_
  LDTARGETCPU=X86
! MORECFLAGS=/MT
  
  !ELSEIF "$(TARGETCPU)"=="MIPS16" || "$(TARGETCPU)"=="MIPSII" || "$(TARGETCPU)"=="MIPSII_FP" || "$(TARGETCPU)"=="MIPSIV" || "$(TARGETCPU)"=="MIPSIV_FP"
  WCETARGETCPU=_MIPS_
--- 35,42 ----
  !ELSEIF "$(TARGETCPU)"=="emulator"
  WCETARGETCPU=_X86_
  LDTARGETCPU=X86
! #pdelaage 20121210 /Dx86 for inline defs of InterlockedExchange inline in winbase.h
! MORECFLAGS=/MT /Dx86
  
  !ELSEIF "$(TARGETCPU)"=="MIPS16" || "$(TARGETCPU)"=="MIPSII" || "$(TARGETCPU)"=="MIPSII_FP" || "$(TARGETCPU)"=="MIPSIV" || "$(TARGETCPU)"=="MIPSIV_FP"
  WCETARGETCPU=_MIPS_
***************
*** 65,71 ****
  INCLUDES=-I$(SSLDIR)\inc32 -I$(COMPATDIR)\include -I"$(SDKDIR)\include\$(TARGETCPU)"
  # for X86 and other it appears that /MC or /ML flags are absurd,
  # we always have to override runtime lib list to coredll and corelibc
! LIBS=/NODEFAULTLIB winsock.lib wcecompatex.lib libeay32.lib ssleay32.lib coredll.lib corelibc.lib
  
  DEFINES=/DHOST=\"$(TARGETCPU)-WCE-eVC-$(WCEVER)\"
  # /O1 /Oi more correct vs MS doc
--- 67,77 ----
  INCLUDES=-I$(SSLDIR)\inc32 -I$(COMPATDIR)\include -I"$(SDKDIR)\include\$(TARGETCPU)"
  # for X86 and other it appears that /MC or /ML flags are absurd,
  # we always have to override runtime lib list to coredll and corelibc
! #LIBS=/NODEFAULTLIB winsock.lib wcecompatex.lib libeay32.lib ssleay32.lib coredll.lib corelibc.lib
! #LIBS=libeay32.lib ssleay32.lib wcecompatex.lib winsock.lib
! # pdelaage 20121209, as Michal did in vc.mak
! #pdelaage 20121216 added commctrlbecause should be necessary in THEORY !!! but works practically for insertcommandbar_menu bar in 434!!!
! LIBS=/NODEFAULTLIB ws2.lib commctrl.lib wcecompatex.lib libeay32.lib ssleay32.lib coredll.lib corelibc.lib
  
  DEFINES=/DHOST=\"$(TARGETCPU)-WCE-eVC-$(WCEVER)\"
  # /O1 /Oi more correct vs MS doc
***************
*** 118,123 ****
--- 124,132 ----
  $(BIN)\tstunnel.exe:$(OBJS) $(NOGUIOBJS)
  	link $(LDFLAGS)  /out:$(BIN)\tstunnel.exe $(LIBS) $**
  
+ #pdelaage 20121216 added from vc.ak, good practice to recompile everything if makefile changes	
+ $(OBJS): *.h evc.mak
+ 
  $(OBJ)\resources.res: $(SRC)\resources.rc $(SRC)\resources.h $(SRC)\version.h
  $(OBJ)\gui.obj: $(SRC)\gui.c $(SRC)\version.h
  $(OBJ)\stunnel.obj: $(SRC)\stunnel.c $(SRC)\version.h
diff -cr orig/src/gui.c patch1/src/gui.c
*** orig/src/gui.c	2012-12-03 14:05:26.000000000 +0100
--- patch1/src/gui.c	2012-12-17 23:41:58.992872000 +0100
***************
*** 37,42 ****
--- 37,43 ----
  
  #include "common.h"
  #include "prototypes.h"
+ 
  #include <commdlg.h>
  #include <commctrl.h>
  #ifndef _WIN32_WCE
***************
*** 50,56 ****
  #define STUNNEL_PLATFORM "WinCE"
  #else
  #define STUNNEL_PLATFORM "Win32"
! #define SERVICE_NAME "stunnel"
  #endif
  
  /* mingw-Patches-1825044 is missing in Debian Squeeze */
--- 51,57 ----
  #define STUNNEL_PLATFORM "WinCE"
  #else
  #define STUNNEL_PLATFORM "Win32"
! #define SERVICE_NAME TEXT("stunnel") /* pdelaage 20121214  */
  #endif
  
  /* mingw-Patches-1825044 is missing in Debian Squeeze */
***************
*** 85,91 ****
  /* NT Service related function */
  #ifndef _WIN32_WCE
  static int service_initialize(void);
! static int service_install(LPTSTR);
  static int service_uninstall(void);
  static int service_start(void);
  static int service_stop(void);
--- 86,93 ----
  /* NT Service related function */
  #ifndef _WIN32_WCE
  static int service_initialize(void);
! /* pdelaage 20121214 : wrong prototype, the DEFINITION code further in that file is with LPSTR only, not lpTstr...static int service_install(LPTSTR); */
! static int service_install(LPSTR);
  static int service_uninstall(void);
  static int service_start(void);
  static int service_stop(void);
***************
*** 125,131 ****
  static SERVICE_STATUS_HANDLE serviceStatusHandle=0;
  #endif
  
! static volatile int visible=0;
  static volatile int error_mode=1; /* no valid configuration was ever loaded */
  static HANDLE config_ready=NULL; /* reload without a valid configuration */
  static LONG new_logs=0;
--- 127,135 ----
  static SERVICE_STATUS_HANDLE serviceStatusHandle=0;
  #endif
  
! /* pdelaage 20121215 static volatile int visible=0;, now visible is more appropriately a BOOL */
! static volatile BOOL visible=FALSE;
! 
  static volatile int error_mode=1; /* no valid configuration was ever loaded */
  static HANDLE config_ready=NULL; /* reload without a valid configuration */
  static LONG new_logs=0;
***************
*** 149,166 ****
          int nCmdShow) {
      LPSTR command_line;
  #ifndef _WIN32_WCE
!     char *c, *errmsg;
!     char stunnel_exe_path[MAX_PATH];
  #endif
  
!     (void)prev_instance; /* skip warning about unused parameter */
!     (void)nCmdShow; /* skip warning about unused parameter */
! 
      str_init(); /* initialize per-thread string management */
      ghInst=this_instance;
  #ifdef _WIN32_WCE
!     command_line=tstr2str(lpCmdLine);
! #else
      command_line=lpCmdLine;
  #endif
  
--- 153,183 ----
          int nCmdShow) {
      LPSTR command_line;
  #ifndef _WIN32_WCE
!     TCHAR *c, *errmsg; /* pdelaage 20121214 unicode */
!     TCHAR stunnel_exe_path[MAX_PATH];
! 	size_t size_l;
! #else
! #ifdef UNICODE
! int len_l = 0;/* pdelaage 20121212 init to avoid warning */
! #endif
! 	
  #endif
  
! (void)prev_instance; /* skip warning about unused parameter */
! (void)nCmdShow; /* skip warning about unused parameter */
      str_init(); /* initialize per-thread string management */
      ghInst=this_instance;
+ 
  #ifdef _WIN32_WCE
! #ifdef UNICODE /* need conversion from Wstr to str, and tstr2str can do that */
!     command_line=tstr2str(lpCmdLine);/* pdelaage , if compiled in ANSI, on wce lpCmdline is always LPWSTR ...BUT tstr2str wait for a char* */
! #else /* still need conversion from Wstr to str, and tstr2str cannot  do that ...well this is a fact that WCE is only UNICODE, but porting missing calls to ansi is not impossible...*/
! 	len_l=WideCharToMultiByte(CP_ACP, 0,lpCmdLine, -1, NULL, 0, NULL, NULL);
!     command_line=str_alloc(len_l+1);
!     len_l=WideCharToMultiByte(CP_ACP, 0, lpCmdLine, -1, command_line, len_l, NULL, NULL);	
! #endif
! 
! #else /* pdelaage 20121212, on win32 lpcmdline is always ansi string...for the moment.*/
      command_line=lpCmdLine;
  #endif
  
***************
*** 170,185 ****
      GetModuleFileName(0, stunnel_exe_path, MAX_PATH);
  
      /* find previous instances of the same executable */
!     EnumWindows(enum_windows, (LPARAM)stunnel_exe_path);
  
      /* change current working directory */
!     c=strrchr(stunnel_exe_path, '\\'); /* last backslash */
      if(c) /* found */
!         c[1]='\0'; /* truncate program name */
      if(!SetCurrentDirectory(stunnel_exe_path)) {
!         errmsg=str_printf("Cannot set directory to %s", stunnel_exe_path);
!         message_box(errmsg, MB_ICONERROR);
!         str_free(errmsg);
          return 1;
      }
  
--- 187,204 ----
      GetModuleFileName(0, stunnel_exe_path, MAX_PATH);
  
      /* find previous instances of the same executable */
!     EnumWindows(enum_windows, (LPARAM)stunnel_exe_path); 
  
      /* change current working directory */
!     c=_tcsrchr(stunnel_exe_path, TEXT('\\')); /* last backslash *//* pdelaage 20121212 unicode */
      if(c) /* found */
!         c[1]=TEXT('\0'); /* truncate program name */
      if(!SetCurrentDirectory(stunnel_exe_path)) {
! 		size_l = sizeof(TCHAR) * (1+_tcslen(stunnel_exe_path)+_tcslen(TEXT("Cannot set directory to ")));
! 		errmsg=(TCHAR *) malloc( size_l );
!         _stprintf(errmsg, TEXT("Cannot set directory to %s"), stunnel_exe_path);
!         message_boxT(errmsg, MB_ICONERROR);
!         free(errmsg);
          return 1;
      }
  
***************
*** 210,218 ****
  static BOOL CALLBACK enum_windows(HWND other_window_handle, LPARAM lParam) {
      DWORD pid;
      HINSTANCE hInstance;
!     char window_exe_path[MAX_PATH];
      HANDLE process_handle;
!     char *stunnel_exe_path=(char *)lParam;
  
      if(!other_window_handle)
          return TRUE;
--- 229,237 ----
  static BOOL CALLBACK enum_windows(HWND other_window_handle, LPARAM lParam) {
      DWORD pid;
      HINSTANCE hInstance;
!     TCHAR window_exe_path[MAX_PATH];/* pdelaage 20121214 UNICODE */
      HANDLE process_handle;
!     TCHAR *stunnel_exe_path=(TCHAR *)lParam; /* pdelaage 20121214 UNICODE */
  
      if(!other_window_handle)
          return TRUE;
***************
*** 224,230 ****
          CloseHandle(process_handle);
          return TRUE;
      }
!     if(strcmp(stunnel_exe_path, window_exe_path)) {
          CloseHandle(process_handle);
          return TRUE;
      }
--- 243,249 ----
          CloseHandle(process_handle);
          return TRUE;
      }
!     if(_tcscmp(stunnel_exe_path, window_exe_path)) {/* pdelaage 20121214 UNICODE */
          CloseHandle(process_handle);
          return TRUE;
      }
***************
*** 232,238 ****
          SendMessage(other_window_handle, WM_COMMAND, IDM_EXIT, 0);
          WaitForSingleObject(process_handle, 3000);
      } else {
!         ShowWindow(other_window_handle, SW_SHOWNORMAL); /* show window */
          SetForegroundWindow(other_window_handle); /* bring on top */
      }
      CloseHandle(process_handle);
--- 251,257 ----
          SendMessage(other_window_handle, WM_COMMAND, IDM_EXIT, 0);
          WaitForSingleObject(process_handle, 3000);
      } else {
! 		ShowWindow(other_window_handle, SW_SHOWNORMAL); /* show window */ 
          SetForegroundWindow(other_window_handle); /* bring on top */
      }
      CloseHandle(process_handle);
***************
*** 363,382 ****
      RECT rect;
      SERVICE_OPTIONS *section;
      unsigned int section_number;
! 
! #if 0
      if(message!=WM_CTLCOLORSTATIC && message!=WM_TIMER)
          s_log(LOG_DEBUG, "Window message: %d", message);
  #endif
      switch(message) {
      case WM_CREATE:
  #ifdef _WIN32_WCE
          /* create command bar */
          command_bar_handle=CommandBar_Create(ghInst, main_window_handle, 1);
          if(!command_bar_handle)
!             error_box("CommandBar_Create");
          if(!CommandBar_InsertMenubar(command_bar_handle, ghInst, IDM_MAINMENU, 0))
              error_box("CommandBar_InsertMenubar");
          if(!CommandBar_AddAdornments(command_bar_handle, 0, 0))
              error_box("CommandBar_AddAdornments");
  #endif
--- 382,406 ----
      RECT rect;
      SERVICE_OPTIONS *section;
      unsigned int section_number;
! 	LPWINDOWPOS lpwp = (LPWINDOWPOS) NULL;  /* pdelaage 20121215 */
! 	
! #if 0 /* pdelaage 20121215 TODO: strangely, on WCE this logtrace saturates the logs with UNKNOWN 32770 msg and blocks completely stunnel...is there an infinite loop somewhere ? TODO */
      if(message!=WM_CTLCOLORSTATIC && message!=WM_TIMER)
          s_log(LOG_DEBUG, "Window message: %d", message);
  #endif
      switch(message) {
      case WM_CREATE:
+ 		InitCommonControls(); /* pdelaage 20121211 ! at least this is missing  for WCE, and no pain for W32. Strangely the code worked without that, this was not good...*/
+ 
  #ifdef _WIN32_WCE
          /* create command bar */
          command_bar_handle=CommandBar_Create(ghInst, main_window_handle, 1);
          if(!command_bar_handle)
!             error_box("CommandBar_Create");			
! 			
          if(!CommandBar_InsertMenubar(command_bar_handle, ghInst, IDM_MAINMENU, 0))
              error_box("CommandBar_InsertMenubar");
+ 		
          if(!CommandBar_AddAdornments(command_bar_handle, 0, 0))
              error_box("CommandBar_AddAdornments");
  #endif
***************
*** 393,398 ****
--- 417,424 ----
              MAKELPARAM(FALSE, 0)); /* no need to redraw right, now */
  #endif
          /* NOTE: there's no return statement here -> proceeding with resize */
+ 		/* pdelaage 20121211 : there should be !  resize will come just later from the windows gdi internals */
+ 		return 0;
  
      case WM_SIZE:
          GetClientRect(main_window_handle, &rect);
***************
*** 404,410 ****
  #endif
          UpdateWindow(edit_handle);
          /* CommandBar_Show(command_bar_handle, TRUE); */
!         return TRUE;
  
      case WM_SETFOCUS:
          SetFocus(edit_handle);
--- 430,437 ----
  #endif
          UpdateWindow(edit_handle);
          /* CommandBar_Show(command_bar_handle, TRUE); */
!         
! 		return 0;/*TRUE;...pdelaage 20121211 : should be ZERO, not "true", dixit msdn. it is a common mistake to return boolean where msdn says litteral 0, dont know why...*/
  
      case WM_SETFOCUS:
          SetFocus(edit_handle);
***************
*** 417,434 ****
          return TRUE;
  
      case WM_CLOSE:
!         ShowWindow(main_window_handle, SW_HIDE);
!         return TRUE;
  
      case WM_SHOWWINDOW:
!         visible=wParam; /* setup global variable */
          if(tray_menu_handle)
              CheckMenuItem(tray_menu_handle, IDM_SHOW_LOG,
                  visible ? MF_CHECKED : MF_UNCHECKED);
          if(visible)
              update_logs();
!         return TRUE;
! 
      case WM_DESTROY:
  #ifdef _WIN32_WCE
          CommandBar_Destroy(command_bar_handle);
--- 444,469 ----
          return TRUE;
  
      case WM_CLOSE:
! 		ShowWindow(main_window_handle, SW_HIDE);
!      return TRUE;
  
+ /* pdelaage 20121214 , I made "visible" a real BOOL...instead of an int between 0 and 1...
      case WM_SHOWWINDOW:
!        visible= (BOOL) wParam; *//* setup global variable */
! 	   
! 	case WM_WINDOWPOSCHANGED :/* pdelaage 20121215 : new code, and now visible is really a BOOL */
! 		
! 		lpwp = (LPWINDOWPOS) lParam; 		
!         visible= ((lpwp->flags & SWP_SHOWWINDOW) == SWP_SHOWWINDOW); /* setup global variable */
! 		
          if(tray_menu_handle)
              CheckMenuItem(tray_menu_handle, IDM_SHOW_LOG,
                  visible ? MF_CHECKED : MF_UNCHECKED);
          if(visible)
              update_logs();
! 	/*      return TRUE;*//* pdelaage : 20121214 : should go to DefProc to properly reflect window appearance */
! 		break;
! 		
      case WM_DESTROY:
  #ifdef _WIN32_WCE
          CommandBar_Destroy(command_bar_handle);
***************
*** 438,443 ****
--- 473,479 ----
  #endif
          if(tray_menu_handle)
              DestroyMenu(tray_menu_handle);
+ 			
          ZeroMemory(&nid, sizeof nid);
          nid.cbSize=sizeof nid;
          nid.hWnd=main_window_handle;
***************
*** 464,470 ****
  #endif
              if(tray_menu_handle)
                  CheckMenuItem(tray_menu_handle, wParam, MF_CHECKED);
!             message_box(section->help, MB_ICONINFORMATION);
              return TRUE;
          }
          switch(wParam) {
--- 500,507 ----
  #endif
              if(tray_menu_handle)
                  CheckMenuItem(tray_menu_handle, wParam, MF_CHECKED);
! 				
!             message_boxT(section->help, MB_ICONINFORMATION);/* pdelaage 20121215: what is the purpose of this ????? */
              return TRUE;
          }
          switch(wParam) {
***************
*** 473,487 ****
                  (DLGPROC)about_proc);
              break;
          case IDM_SHOW_LOG:
              if(visible) {
!                 ShowWindow(main_window_handle, SW_HIDE); /* hide window */
!             } else {
!                 ShowWindow(main_window_handle, SW_SHOWNORMAL); /* show window */
!                 SetForegroundWindow(main_window_handle); /* bring on top */
              }
              break;
          case IDM_CLOSE:
!             ShowWindow(main_window_handle, SW_HIDE); /* hide window */
              break;
          case IDM_EXIT:
              if(!error_mode) { /* signal_pipe is active */
--- 510,525 ----
                  (DLGPROC)about_proc);
              break;
          case IDM_SHOW_LOG:
+ 			visible = IsWindowVisible(main_window_handle);/* pdelaage 20121215 : better...not a good idea to stay with remanent value... as many system events can change this state */
              if(visible) {
! 				ShowWindow(main_window_handle, SW_HIDE); /* hide window */
!            } else {   
! 				ShowWindow(main_window_handle, SW_SHOWNORMAL); /* show window */
! 				SetForegroundWindow(main_window_handle); /* bring on top */
              }
              break;
          case IDM_CLOSE:
! 			ShowWindow(main_window_handle, SW_HIDE); /* hide window */
              break;
          case IDM_EXIT:
              if(!error_mode) { /* signal_pipe is active */
***************
*** 545,553 ****
  #ifndef _WIN32_WCE
          case WM_LBUTTONDBLCLK: /* switch log window visibility */
              if(visible) {
!                 ShowWindow(main_window_handle, SW_HIDE); /* hide window */
!             } else {
!                 ShowWindow(main_window_handle, SW_SHOWNORMAL); /* show window */
                  SetForegroundWindow(main_window_handle); /* bring on top */
              }
              break;
--- 583,591 ----
  #ifndef _WIN32_WCE
          case WM_LBUTTONDBLCLK: /* switch log window visibility */
              if(visible) {
! 				ShowWindow(main_window_handle, SW_HIDE); /* hide window */
!            } else {
!  				ShowWindow(main_window_handle, SW_SHOWNORMAL); /* show window */
                  SetForegroundWindow(main_window_handle); /* bring on top */
              }
              break;
***************
*** 582,592 ****
  
  static LRESULT CALLBACK about_proc(HWND dialog_handle, UINT message,
          WPARAM wParam, LPARAM lParam) {
!     (void)lParam; /* skip warning about unused parameter */
  
      switch(message) {
          case WM_INITDIALOG:
              return TRUE;
          case WM_COMMAND:
              switch(wParam) {
                  case IDOK:
--- 620,633 ----
  
  static LRESULT CALLBACK about_proc(HWND dialog_handle, UINT message,
          WPARAM wParam, LPARAM lParam) {
!    (void)lParam ; /* skip warning about unused parameter */ /* pdelaage 20121217: strange "init" that put the mess in next declarations.... I would prefer = 0*/
! 	
! 
  
      switch(message) {
          case WM_INITDIALOG:
              return TRUE;
+ 	
          case WM_COMMAND:
              switch(wParam) {
                  case IDOK:
***************
*** 613,619 ****
      case WM_INITDIALOG:
          /* set the default push button to "Cancel" */
          SendMessage(dialog_handle, DM_SETDEFID, (WPARAM)IDCANCEL, (LPARAM)0);
! 
          titlebar=str_printf("Private key: %s", ui_data->section->key);
          tstr=str2tstr(titlebar);
          str_free(titlebar);
--- 654,660 ----
      case WM_INITDIALOG:
          /* set the default push button to "Cancel" */
          SendMessage(dialog_handle, DM_SETDEFID, (WPARAM)IDCANCEL, (LPARAM)0);
!  
          titlebar=str_printf("Private key: %s", ui_data->section->key);
          tstr=str2tstr(titlebar);
          str_free(titlebar);
***************
*** 772,784 ****
  
  static void update_logs(void) {
      LPTSTR txt;
! 
!     if(!InterlockedExchange(&new_logs, 0))
          return;
      txt=log_txt();
      if(!txt)
!         return;
!     SetWindowText(edit_handle, txt);
      str_free(txt);
      SendMessage(edit_handle, WM_VSCROLL, (WPARAM)SB_BOTTOM, (LPARAM)0);
  }
--- 813,825 ----
  
  static void update_logs(void) {
      LPTSTR txt;
! 	
! 	if(!InterlockedExchange(&new_logs, 0))
          return;
      txt=log_txt();
      if(!txt)
!         return;		
! 	SetWindowText(edit_handle, txt); 
      str_free(txt);
      SendMessage(edit_handle, WM_VSCROLL, (WPARAM)SB_BOTTOM, (LPARAM)0);
  }
***************
*** 834,840 ****
      SetWindowText(hwnd, win32_name);
  
      /* log window is hidden by default */
!     ShowWindow(hwnd, SW_SHOWNORMAL); /* show window */
      SetForegroundWindow(hwnd); /* bring on top */
  
      update_tray_icon();
--- 875,881 ----
      SetWindowText(hwnd, win32_name);
  
      /* log window is hidden by default */
! 	ShowWindow(hwnd, SW_SHOWNORMAL); /* show window */
      SetForegroundWindow(hwnd); /* bring on top */
  
      update_tray_icon();
***************
*** 876,896 ****
      HMENU tray_peer_list=NULL;
      char *str;
      unsigned int section_number;
!     MENUITEMINFO mii;
  
      /* purge menu peer lists */
  #ifndef _WIN32_WCE
      if(main_menu_handle)
          main_peer_list=GetSubMenu(main_menu_handle, 2); /* 3rd submenu */
      if(main_peer_list)
!         while(GetMenuItemCount(main_peer_list)) /* purge old menu */
!             DeleteMenu(main_peer_list, 0, MF_BYPOSITION);
  #endif
      if(tray_menu_handle)
          tray_peer_list=GetSubMenu(GetSubMenu(tray_menu_handle, 0), 2);
      if(tray_peer_list)
!         while(GetMenuItemCount(tray_peer_list)) /* purge old menu */
!             DeleteMenu(tray_peer_list, 0, MF_BYPOSITION);
  
      /* initialize data structures */
      number_of_sections=0;
--- 917,938 ----
      HMENU tray_peer_list=NULL;
      char *str;
      unsigned int section_number;
!  /* pdelaage 20121208   MENUITEMINFO mii; */
  
      /* purge menu peer lists */
  #ifndef _WIN32_WCE
      if(main_menu_handle)
          main_peer_list=GetSubMenu(main_menu_handle, 2); /* 3rd submenu */
      if(main_peer_list)
!  /* 20121208   pdelaage, trick because getcount is not on WCE    while(GetMenuItemCount(main_peer_list)) */ /* purge old menu */
!             while (DeleteMenu(main_peer_list, 0, MF_BYPOSITION) == TRUE) {;}; /* 20121208, code ok for w32 AND wce */
! 			
  #endif
      if(tray_menu_handle)
          tray_peer_list=GetSubMenu(GetSubMenu(tray_menu_handle, 0), 2);
      if(tray_peer_list)
!   /* 20121208   pdelaage, trick because getcount is not on WCE         while(GetMenuItemCount(tray_peer_list)) *//* purge old menu */
!             while (DeleteMenu(tray_peer_list, 0, MF_BYPOSITION) == TRUE) {;}; /* 20121208, code ok for w32 AND wce */
  
      /* initialize data structures */
      number_of_sections=0;
***************
*** 923,931 ****
          section->chain=NULL;
  
          /* insert new menu item */
          mii.cbSize=sizeof mii;
          mii.fMask=MIIM_STRING|MIIM_DATA|MIIM_ID|MIIM_STATE;
!         mii.fType=MFT_STRING;
          mii.dwTypeData=section->file;
          mii.cch=_tcslen(mii.dwTypeData);
          mii.wID=IDM_PEER_MENU+section_number;
--- 965,974 ----
          section->chain=NULL;
  
          /* insert new menu item */
+ /*		
          mii.cbSize=sizeof mii;
          mii.fMask=MIIM_STRING|MIIM_DATA|MIIM_ID|MIIM_STATE;
!         mii.fType=MFT_STRING; // pdelaage 20121208 : msdn says it is NOT ok for w98/2000 ! replaced by MIIM_STRING....
          mii.dwTypeData=section->file;
          mii.cch=_tcslen(mii.dwTypeData);
          mii.wID=IDM_PEER_MENU+section_number;
***************
*** 938,943 ****
--- 981,996 ----
          if(tray_peer_list)
              if(!InsertMenuItem(tray_peer_list, section_number, TRUE, &mii))
                  ioerror("InsertMenuItem");
+ */
+ #ifndef _WIN32_WCE
+         if(main_peer_list)
+             if(InsertMenu(main_peer_list, section_number, MF_BYPOSITION | MF_STRING | MF_GRAYED, IDM_PEER_MENU+section_number, section->file) == 0)
+                 ioerror("InsertMenu");
+ #endif
+         if(tray_peer_list)
+             if(InsertMenu(tray_peer_list, section_number, MF_BYPOSITION | MF_STRING | MF_GRAYED, IDM_PEER_MENU+section_number, section->file) == 0)
+                 ioerror("InsertMenu");
+ 			
          ++section_number;
      }
      if(hwnd)
***************
*** 988,1003 ****
      str_free(fullmsg);
  }
  
! void message_box(const LPSTR text, const UINT type) {
      LPTSTR tstr;
  
      if(cmdline.quiet)
          return;
      tstr=str2tstr(text);
      MessageBox(hwnd, tstr, win32_name, type);
      str_free(tstr);
  }
  
  void win_new_chain(int section_number) {
      PostMessage(hwnd, WM_NEW_CHAIN, section_number, 0);
  }
--- 1041,1072 ----
      str_free(fullmsg);
  }
  
! 
! void message_boxT(LPCTSTR text, const UINT type) /* pdelaage 20121208, to display section->help and other Tstrings */
! {
! if(cmdline.quiet) 
!     return;
! 
! MessageBox(hwnd, text, win32_name, type);
! 		
! }
! 
! 
! 
! void message_box(const LPSTR text, const UINT type) {  /* pdelaage 20121208 does not support display of unicode srings as section->help that may require 16 bits to 8 bits conversion if we were using your routine !....*/
      LPTSTR tstr;
  
      if(cmdline.quiet)
          return;
+ 	
      tstr=str2tstr(text);
      MessageBox(hwnd, tstr, win32_name, type);
      str_free(tstr);
+ 
+ 	
  }
  
+ 
  void win_new_chain(int section_number) {
      PostMessage(hwnd, WM_NEW_CHAIN, section_number, 0);
  }
***************
*** 1011,1036 ****
  }
  
  static void edit_config(HWND main_window_handle) {
!     char cwd[MAX_PATH], *conf_path;
  
      if(is_admin()) {
          ShellExecute(main_window_handle, TEXT("open"),
              TEXT("notepad.exe"), TEXT("stunnel.conf"),
              NULL, SW_SHOWNORMAL);
!     } else { /* UAC workaround */
          GetCurrentDirectory(MAX_PATH, cwd);
          conf_path=str_printf("%s\\stunnel.conf", cwd);
          ShellExecute(main_window_handle, TEXT("runas"),
!             TEXT("notepad.exe"), conf_path,
              NULL, SW_SHOWNORMAL);
          str_free(conf_path);
      }
! }
  
  static BOOL is_admin(void) {
!     SID_IDENTIFIER_AUTHORITY NtAuthority={SECURITY_NT_AUTHORITY};
!     PSID admin_group;
      BOOL retval;
  
      retval=AllocateAndInitializeSid(&NtAuthority, 2,
          SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS,
--- 1080,1152 ----
  }
  
  static void edit_config(HWND main_window_handle) {
! /*    char cwd[MAX_PATH], *conf_path; //pdelaage 20121208 : MUST BE UNICODE !!!! */
!    TCHAR cwd[MAX_PATH] = TEXT("");  /* pdelaage 20121209 init to avoid compil warning when not used in wce */
!    TCHAR conf_path[MAX_PATH] = TEXT(""); /* pdelaage 20121208 : MUST BE UNICODE !!!! */
!    /* as conf_path is ALSO a path, it is useless to be dynamic ptr...*/
  
+ 	/* pdelaage 20121208 : well, on wce AND w32 we have to use ShelExecuteEx...BUT I am not sure that notepad is available on wce, maybe something else can be used instead..to be checked...*/
+ /*	
      if(is_admin()) {
          ShellExecute(main_window_handle, TEXT("open"),
              TEXT("notepad.exe"), TEXT("stunnel.conf"),
              NULL, SW_SHOWNORMAL);
!     } else { 
! 	*/
! 	/* UAC workaround */
! 	/*
          GetCurrentDirectory(MAX_PATH, cwd);
          conf_path=str_printf("%s\\stunnel.conf", cwd);
          ShellExecute(main_window_handle, TEXT("runas"),
!             TEXT("notepad.exe"), conf_path, // pdelaage CONFPATH NOT UNICODE !!! and SHOUD BE !
              NULL, SW_SHOWNORMAL);
          str_free(conf_path);
      }
! */
! SHELLEXECUTEINFO shinfo;
! 
!     if(is_admin()) {
! 	
! 		shinfo.cbSize = sizeof(shinfo);
! 		shinfo.hwnd  = main_window_handle;
! 		shinfo.lpVerb  = TEXT("open");
! 		shinfo.lpFile  = TEXT("notepad.exe");/* pdelaage 20121208 TODO : notepad is NOT available on wce, but there are possible replacements on google...*/
! 		shinfo.lpParameters  = TEXT("stunnel.conf");
! 		shinfo.lpDirectory   = (LPCTSTR) 0;
! 		shinfo.nShow  = SW_SHOWNORMAL;
! 
!         ShellExecuteEx(&shinfo);
!     } 
! #ifndef _WIN32_WCE
! 	
! 	else { 	/* UAC workaround */
! 
! 	GetCurrentDirectory(MAX_PATH, cwd);
! 		
!         _stprintf(conf_path, TEXT("%s\\stunnel.conf"), cwd); /* pdelaage 2012 must be UNICODE ! */
! 		
! 		shinfo.cbSize = sizeof(shinfo);
! 		shinfo.hwnd  = main_window_handle;
! 		shinfo.lpVerb  = TEXT("runas");
! 		shinfo.lpFile  = TEXT("notepad.exe");
! 		shinfo.lpParameters  = conf_path;
! 		shinfo.lpDirectory   = (LPCTSTR) 0;
! 		shinfo.nShow  = SW_SHOWNORMAL;
! 
!         ShellExecuteEx(&shinfo);
! 		
!         /* pdelaage 20121214 not anymore as confpath is not a ptr, str_free(conf_path); */
!     }
! #endif
! 	}
  
  static BOOL is_admin(void) {
!     SID_IDENTIFIER_AUTHORITY NtAuthority={SECURITY_NT_AUTHORITY}; /* pdelaage : strangely this compiles on wce while this is NOT documented ! */
      BOOL retval;
+ #ifdef _WIN32_WCE /* pdelaage 20121208 : no notion of admin on WCE, the user is always admin */
+     retval= TRUE;
+ #else	
+     PSID admin_group;
  
      retval=AllocateAndInitializeSid(&NtAuthority, 2,
          SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS,
***************
*** 1040,1045 ****
--- 1156,1162 ----
              retval=FALSE;
          FreeSid(admin_group);
      }
+ #endif	
      return retval;
  }
  
***************
*** 1062,1081 ****
  
  static int service_install(LPSTR command_line) {
      SC_HANDLE scm, service;
!     char stunnel_exe_path[MAX_PATH], *service_path;
! 
      scm=OpenSCManager(0, 0, SC_MANAGER_CREATE_SERVICE);
      if(!scm) {
          error_box("OpenSCManager");
          return 1;
      }
      GetModuleFileName(0, stunnel_exe_path, MAX_PATH);
!     service_path=str_printf("\"%s\" -service %s", stunnel_exe_path, command_line);
      service=CreateService(scm, SERVICE_NAME, SERVICE_NAME, SERVICE_ALL_ACCESS,
          SERVICE_WIN32_OWN_PROCESS|SERVICE_INTERACTIVE_PROCESS,
          SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, service_path,
          NULL, NULL, NULL, NULL, NULL);
!     str_free(service_path);
      if(!service) {
          error_box("CreateService");
          CloseServiceHandle(scm);
--- 1179,1211 ----
  
  static int service_install(LPSTR command_line) {
      SC_HANDLE scm, service;
!     TCHAR stunnel_exe_path[MAX_PATH], *service_path;/* pdelaage 20121214 UNICODE */
! 	size_t size_l;/* pdelaage 20121214 UNICODE */
! 	TCHAR *Tcommand_line;
! 	
      scm=OpenSCManager(0, 0, SC_MANAGER_CREATE_SERVICE);
      if(!scm) {
          error_box("OpenSCManager");
          return 1;
      }
      GetModuleFileName(0, stunnel_exe_path, MAX_PATH);
! 	
! 	Tcommand_line = str2tstr(command_line);
! 
!     size_l = sizeof(TCHAR) * (1+_tcslen(stunnel_exe_path) + _tcslen(Tcommand_line)+_tcslen(TEXT(" -service ")));
! 	service_path=(TCHAR *) malloc( size_l );
!      _stprintf(service_path, TEXT("\"%s\" -service %s"), stunnel_exe_path, Tcommand_line);
! 	
! 	
!    
      service=CreateService(scm, SERVICE_NAME, SERVICE_NAME, SERVICE_ALL_ACCESS,
          SERVICE_WIN32_OWN_PROCESS|SERVICE_INTERACTIVE_PROCESS,
          SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, service_path,
          NULL, NULL, NULL, NULL, NULL);
!     
! 	free(service_path);/* pdelaage 20121214 UNICODE */
! 	str_free(Tcommand_line);/* pdelaage 20121214 UNICODE */
! 
      if(!service) {
          error_box("CreateService");
          CloseServiceHandle(scm);
diff -cr orig/src/prototypes.h patch1/src/prototypes.h
*** orig/src/prototypes.h	2012-12-03 14:03:36.000000000 +0100
--- patch1/src/prototypes.h	2012-12-17 13:10:34.230394500 +0100
***************
*** 550,556 ****
  /**************************************** prototypes for gui.c */
  
  #ifdef USE_WIN32
! void message_box(const LPSTR, const UINT);
  void win_new_chain(int);
  void win_new_log(char *);
  void win_new_config(void);
--- 550,558 ----
  /**************************************** prototypes for gui.c */
  
  #ifdef USE_WIN32
! void message_box(const LPSTR, const UINT); /* pdelaage: this original routine allows to avoid "TEXT" macro, and supports only 8 bits msg */
! void message_boxT(LPCTSTR, const UINT);/* pdelaage 20121214 for TCHAR arg */
! 
  void win_new_chain(int);
  void win_new_log(char *);
  void win_new_config(void);
diff -cr orig/src/resolver.c patch1/src/resolver.c
*** orig/src/resolver.c	2012-12-02 20:41:21.000000000 +0100
--- patch1/src/resolver.c	2012-12-14 19:19:59.452757500 +0100
***************
*** 92,98 ****
  #if defined(USE_WIN32) && !defined(_WIN32_WCE)
      HINSTANCE handle;
  
!     handle=LoadLibrary("ws2_32.dll"); /* IPv6 in Windows XP or higher */
      if(handle) {
          s_getaddrinfo=(GETADDRINFO)GetProcAddress(handle, "getaddrinfo");
          s_freeaddrinfo=(FREEADDRINFO)GetProcAddress(handle, "freeaddrinfo");
--- 92,98 ----
  #if defined(USE_WIN32) && !defined(_WIN32_WCE)
      HINSTANCE handle;
  
!     handle=LoadLibrary(TEXT("ws2_32.dll")); /* IPv6 in Windows XP or higher */ /* pdelaage 20121214...unicode ! */
      if(handle) {
          s_getaddrinfo=(GETADDRINFO)GetProcAddress(handle, "getaddrinfo");
          s_freeaddrinfo=(FREEADDRINFO)GetProcAddress(handle, "freeaddrinfo");
***************
*** 101,107 ****
              return; /* IPv6 detected -> OK */
          FreeLibrary(handle);
      }
!     handle=LoadLibrary("wship6.dll"); /* experimental IPv6 for Windows 2000 */
      if(handle) {
          s_getaddrinfo=(GETADDRINFO)GetProcAddress(handle, "getaddrinfo");
          s_freeaddrinfo=(FREEADDRINFO)GetProcAddress(handle, "freeaddrinfo");
--- 101,107 ----
              return; /* IPv6 detected -> OK */
          FreeLibrary(handle);
      }
!     handle=LoadLibrary(TEXT("wship6.dll")); /* experimental IPv6 for Windows 2000 */ /* pdelaage 20121214...unicode ! */
      if(handle) {
          s_getaddrinfo=(GETADDRINFO)GetProcAddress(handle, "getaddrinfo");
          s_freeaddrinfo=(FREEADDRINFO)GetProcAddress(handle, "freeaddrinfo");
Seulement dans patch1/src: resources.aps
diff -cr orig/src/resources.rc patch1/src/resources.rc
*** orig/src/resources.rc	2012-01-01 22:43:22.000000000 +0100
--- patch1/src/resources.rc	2012-12-17 17:36:03.349537500 +0100
***************
*** 83,105 ****
      END
  END
  
  ABOUTBOX DIALOG DISCARDABLE  0, 0, 140, 68
! STYLE DS_MODALFRAME|DS_CENTER|WS_POPUP|WS_CAPTION|WS_SYSMENU
  CAPTION "About stunnel"
  BEGIN
      ICON            IDI_MYICON, -1,                              9,  8,  18, 20
      LTEXT           "stunnel version", -1,                      30,  4,  52,  8
      LTEXT           STUNNEL_VERSION, -1,                        82,  4,  54,  8
!     LTEXT           "© by Michal Trojnara, 1998-2012", -1,      30, 12, 106,  8
      LTEXT           "All Rights Reserved", -1,                  30, 20, 106,  8
      LTEXT           "Licensed under the GNU GPL version 2", -1,  4, 28, 132,  8
      LTEXT           "with a special exception for OpenSSL", -1,  4, 36, 132,  8
      DEFPUSHBUTTON   "OK",IDOK,                                  54, 48,  32, 14, WS_GROUP
  END
  
  PASSBOX DIALOG DISCARDABLE 0, 0, 158, 51
! STYLE DS_MODALFRAME|DS_CENTER|WS_POPUP|WS_CAPTION|WS_SYSMENU
  CAPTION ""
  BEGIN
      ICON            IDI_MYICON, -1,           8,  6, 18, 20
      LTEXT           "Pass phrase:", -1,      33,  9, 50,  8
--- 83,109 ----
      END
  END
  
+ // pdelaage 20121217 : no more ugly font a la windows 3.1...stunnel deserves to look more "smart"
  ABOUTBOX DIALOG DISCARDABLE  0, 0, 140, 68
! STYLE DS_MODALFRAME|DS_CENTER|DS_SETFONT|WS_POPUP|WS_CAPTION|WS_SYSMENU
  CAPTION "About stunnel"
+ FONT 8, "MS Sans Serif"
  BEGIN
      ICON            IDI_MYICON, -1,                              9,  8,  18, 20
      LTEXT           "stunnel version", -1,                      30,  4,  52,  8
      LTEXT           STUNNEL_VERSION, -1,                        82,  4,  54,  8
!     LTEXT           "© by Michal Trojnara, 1998-2012", -1,      30, 12, 126,  8
      LTEXT           "All Rights Reserved", -1,                  30, 20, 106,  8
      LTEXT           "Licensed under the GNU GPL version 2", -1,  4, 28, 132,  8
      LTEXT           "with a special exception for OpenSSL", -1,  4, 36, 132,  8
      DEFPUSHBUTTON   "OK",IDOK,                                  54, 48,  32, 14, WS_GROUP
  END
  
+ // pdelaage 20121217 : no more ugly font a la windows 3.1...stunnel deserves to look more "smart"
  PASSBOX DIALOG DISCARDABLE 0, 0, 158, 51
! STYLE DS_MODALFRAME|DS_CENTER|DS_SETFONT|WS_POPUP|WS_CAPTION|WS_SYSMENU
  CAPTION ""
+ FONT 8, "MS Sans Serif"
  BEGIN
      ICON            IDI_MYICON, -1,           8,  6, 18, 20
      LTEXT           "Pass phrase:", -1,      33,  9, 50,  8
diff -cr orig/src/stunnel.c patch1/src/stunnel.c
*** orig/src/stunnel.c	2012-12-02 19:25:47.000000000 +0100
--- patch1/src/stunnel.c	2012-12-14 19:17:32.705314000 +0100
***************
*** 332,338 ****
          if(opt->ctx) {
              s_log(LOG_DEBUG, "Sessions cached before flush: %ld",
                  SSL_CTX_sess_number(opt->ctx));
!             SSL_CTX_flush_sessions(opt->ctx, time(NULL)+opt->session_timeout+1);
              s_log(LOG_DEBUG, "Sessions cached after flush: %ld",
                  SSL_CTX_sess_number(opt->ctx));
          }
--- 332,338 ----
          if(opt->ctx) {
              s_log(LOG_DEBUG, "Sessions cached before flush: %ld",
                  SSL_CTX_sess_number(opt->ctx));
!             SSL_CTX_flush_sessions(opt->ctx, ((long) time(NULL))+opt->session_timeout+1);/* pdelaage 20121214 cast from time_t to long */
              s_log(LOG_DEBUG, "Sessions cached after flush: %ld",
                  SSL_CTX_sess_number(opt->ctx));
          }
diff -cr orig/src/vc.mak patch1/src/vc.mak
*** orig/src/vc.mak	2012-08-01 21:03:52.000000000 +0200
--- patch1/src/vc.mak	2012-12-17 13:12:20.413051500 +0100
***************
*** 21,30 ****
  #FIPSDIR=$(SSLDIR)\inc32
  #LIBDIR=$(SSLDIR)\out32dll
  # or simply install with "nmake -f ms\ntdll.mak install"
! SSLDIR=\usr\local\ssl
  INCDIR=$(SSLDIR)\include
  FIPSDIR=$(SSLDIR)\fips-2.0\include
  LIBDIR=$(SSLDIR)\lib
  
  TARGETCPU=W32
  SRC=..\src
--- 21,32 ----
  #FIPSDIR=$(SSLDIR)\inc32
  #LIBDIR=$(SSLDIR)\out32dll
  # or simply install with "nmake -f ms\ntdll.mak install"
! SSLDIR=C:\Users\standard\Documents\Dvts\Contrib\openssl\v1.0.2-stable-SNAP-20121213\patch1
  INCDIR=$(SSLDIR)\include
+ INCDIR=$(SSLDIR)\inc32
  FIPSDIR=$(SSLDIR)\fips-2.0\include
  LIBDIR=$(SSLDIR)\lib
+ LIBDIR=$(SSLDIR)\out32dll
  
  TARGETCPU=W32
  SRC=..\src
***************
*** 42,51 ****
  CC=cl
  LINK=link
  
! CFLAGS=/MD /W3 /O2 /nologo /I"$(INCDIR)" /I"$(FIPSDIR)"
  LDFLAGS=/NOLOGO
  
! LIBS=advapi32.lib comdlg32.lib crypt32.lib gdi32.lib \
  	psapi.lib shell32.lib user32.lib ws2_32.lib \
  	/LIBPATH:"$(LIBDIR)" libeay32.lib ssleay32.lib
  # static linking:
--- 44,60 ----
  CC=cl
  LINK=link
  
! # pdelaage 20121214 added unicode flag : because w32 unicode version helps to debug...WCE unicode version...
! # pdelaage 20121214 WX warning as error to detect subtle cast problems in unicode management.
! 
! UNICODEFLAGS=/DUNICODE -D_UNICODE
! UNICODEFLAGS=
! MORECFLAGS=/WX $(UNICODEFLAGS) /D_CRT_NON_CONFORMING_SWPRINTFS
! CFLAGS=/MD /W3 /O2 /nologo $(MORECFLAGS) /I"$(INCDIR)" /I"$(FIPSDIR)"
  LDFLAGS=/NOLOGO
  
! #pdelaage 20121214 added commctl32 for initcommoncontrols (not really necessary on W32, it is for wce)
! LIBS=advapi32.lib comdlg32.lib comctl32.lib crypt32.lib gdi32.lib \
  	psapi.lib shell32.lib user32.lib ws2_32.lib \
  	/LIBPATH:"$(LIBDIR)" libeay32.lib ssleay32.lib
  # static linking:


More information about the stunnel-users mailing list