diff -cr orig/src/client.c patched/src/client.c *** orig/src/client.c 2010-09-14 17:03:43.000000000 +0200 --- patched/src/client.c 2010-09-26 20:49:38.601451000 +0200 *************** *** 827,841 **** int fd[2]; STARTUPINFO si; PROCESS_INFORMATION pi; make_sockets(c, fd); ! ZeroMemory(&si, sizeof si); si.cb=sizeof si; si.wShowWindow=SW_HIDE; si.dwFlags=STARTF_USESHOWWINDOW|STARTF_USESTDHANDLES; si.hStdInput=si.hStdOutput=si.hStdError=(HANDLE)fd[1]; ! ZeroMemory(&pi, sizeof pi); ! CreateProcess(c->opt->execname, c->opt->execargs, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi); closesocket(fd[1]); CloseHandle(pi.hProcess); CloseHandle(pi.hThread); --- 827,858 ---- int fd[2]; STARTUPINFO si; PROCESS_INFORMATION pi; + BOOL cr_l; + + LPTSTR execname_l = str2tstr(c->opt->execname);// pdelaage UNICODE support + LPTSTR execargs_l = str2tstr(c->opt->execargs); + + ZeroMemory(&pi, sizeof pi); make_sockets(c, fd); ! ! ZeroMemory(&si, sizeof si);// pdelaage: left for wce, to avoid compilation warning if si not used ! ! #ifndef _WIN32_WCE si.cb=sizeof si; si.wShowWindow=SW_HIDE; si.dwFlags=STARTF_USESHOWWINDOW|STARTF_USESTDHANDLES; si.hStdInput=si.hStdOutput=si.hStdError=(HANDLE)fd[1]; ! cr_l = CreateProcess(execname_l, execargs_l, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi); ! ! #else // _WIN32_WCE ! cr_l = CreateProcess(execname_l, execargs_l, NULL, NULL, (BOOL) NULL, 0, NULL, NULL, NULL, &pi); // pdelaage: :BOOL needed for strict type checking, "si" prm unsupported on wce ! #endif ! ! ! free(execname_l); ! free(execargs_l); ! closesocket(fd[1]); CloseHandle(pi.hProcess); CloseHandle(pi.hThread); Seulement dans patched/src: client.obj diff -cr orig/src/common.h patched/src/common.h *** orig/src/common.h 2010-09-14 17:00:36.000000000 +0200 --- patched/src/common.h 2010-09-26 18:01:39.094237000 +0200 *************** *** 181,186 **** --- 181,188 ---- #endif #include + /*pdelaage 20100926: all these redefinitions are PRESENTLY useless and dangerous (see log.c for proper use one day). Maybe useful once a severe socket error control be coded + #define ECONNRESET WSAECONNRESET #define ENOTSOCK WSAENOTSOCK #define ENOPROTOOPT WSAENOPROTOOPT *************** *** 194,199 **** --- 196,203 ---- #endif #define EINVAL WSAEINVAL + */ + #include /* _beginthread */ #include Seulement dans patched/src: ctx.obj diff -cr orig/src/evc.mak patched/src/evc.mak *** orig/src/evc.mak 2010-04-06 09:58:53.000000000 +0200 --- patched/src/evc.mak 2010-09-26 18:02:34.992026500 +0200 *************** *** 7,13 **** # 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\openssl-0.9.8-stable-SNAP-20090102\openssl-0.9.8-stable-SNAP-20090102 COMPATDIR=C:\Users\standard\Documents\Dvts\openssl\build\wcecompat # ceutilsdir probably useless CEUTILSDIR=..\..\ceutils --- 7,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\openssl-0.9.8-stable-SNAP-20090102\openssl-0.9.8-stable-SNAP-20090102 ! ! SSLDIR=C:\Users\standard\Documents\Dvts\Contrib\openssl\v1.0.0a\patched ! COMPATDIR=C:\Users\standard\Documents\Dvts\openssl\build\wcecompat # ceutilsdir probably useless CEUTILSDIR=..\..\ceutils *************** *** 44,55 **** resources.res: resources.rc resources.h install: stunnel.exe tstunnel.exe $(CEUTILSDIR)\cemkdir $(DSTDIR) || echo Directory exists? $(CEUTILSDIR)\cecopy stunnel.exe $(DSTDIR) $(CEUTILSDIR)\cecopy tstunnel.exe $(DSTDIR) ! $(CEUTILSDIR)\cecopy $(SSLDIR)\out32dll\libeay32.dll $(DSTDIR) ! $(CEUTILSDIR)\cecopy $(SSLDIR)\out32dll\ssleay32.dll $(DSTDIR) clean: del $(OBJS) $(GUIOBJS) $(NOGUIOBJS) stunnel.exe tstunnel.exe --- 47,62 ---- resources.res: resources.rc resources.h + # 20100926: pdelaage, changed location for openssl dll subdir, compliant with last openssl conventions, + # Nota: now list of openssl dll has also much more files...but we do not use "make install" for stunnel + # TODO 20100926: update all this ceutils stuff, or suppress it + install: stunnel.exe tstunnel.exe $(CEUTILSDIR)\cemkdir $(DSTDIR) || echo Directory exists? $(CEUTILSDIR)\cecopy stunnel.exe $(DSTDIR) $(CEUTILSDIR)\cecopy tstunnel.exe $(DSTDIR) ! $(CEUTILSDIR)\cecopy $(SSLDIR)\out32dll_$(TARGETCPU)\libeay32.dll $(DSTDIR) ! $(CEUTILSDIR)\cecopy $(SSLDIR)\out32dll_$(TARGETCPU)\ssleay32.dll $(DSTDIR) clean: del $(OBJS) $(GUIOBJS) $(NOGUIOBJS) stunnel.exe tstunnel.exe Seulement dans patched/src: file.obj diff -cr orig/src/gui.c patched/src/gui.c *** orig/src/gui.c 2010-09-19 23:00:01.000000000 +0200 --- patched/src/gui.c 2010-09-26 23:09:05.726077000 +0200 *************** *** 329,339 **** if(error_mode) { /* log window is hidden by default */ set_visible(1); ! EnableMenuItem(hmainmenu, IDM_RELOAD, MF_GRAYED); EnableMenuItem(htraymenu, IDM_RELOAD, MF_GRAYED); } else /* create the main thread */ ! _beginthread(ThreadFunc, 0, NULL); ! while(GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); --- 329,341 ---- if(error_mode) { /* log window is hidden by default */ set_visible(1); ! #ifndef _WIN32_WCE ! EnableMenuItem(hmainmenu, IDM_RELOAD, MF_GRAYED); ! #endif EnableMenuItem(htraymenu, IDM_RELOAD, MF_GRAYED); } else /* create the main thread */ ! // 20100926 Michal Trojnara/pdelaage _beginthread(ThreadFunc, 0, NULL); ! _beginthread(ThreadFunc, DEFAULT_STACK_SIZE, NULL); while(GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); *************** *** 373,379 **** --- 375,383 ---- } else { /* FIXME: could be unsafe to call it from another thread */ set_visible(1); + #ifndef _WIN32_WCE EnableMenuItem(hmainmenu, IDM_RELOAD, MF_GRAYED); + #endif EnableMenuItem(htraymenu, IDM_RELOAD, MF_GRAYED); } _endthread(); Seulement dans patched/src: gui.obj Seulement dans patched/src: log.obj Seulement dans patched/src: network.obj Seulement dans patched/src: nogui.obj diff -cr orig/src/options.c patched/src/options.c *** orig/src/options.c 2010-09-14 17:09:36.000000000 +0200 --- patched/src/options.c 2010-09-23 22:11:42.108168500 +0200 *************** *** 2014,2026 **** opt_val2_str=strchr(opt_val_str, ':'); if(opt_val2_str) { *opt_val2_str++='\0'; ! ptr->opt_val[socket_type]->linger_val.l_linger=strtol(opt_val2_str, &tmpstr, 10); if(tmpstr==arg || *tmpstr) /* not a number */ return 0; /* FAILED */ } else { ptr->opt_val[socket_type]->linger_val.l_linger=0; } ! ptr->opt_val[socket_type]->linger_val.l_onoff=strtol(opt_val_str, &tmpstr, 10); if(tmpstr==arg || *tmpstr) /* not a number */ return 0; /* FAILED */ return 1; /* OK */ --- 2014,2026 ---- opt_val2_str=strchr(opt_val_str, ':'); if(opt_val2_str) { *opt_val2_str++='\0'; ! ptr->opt_val[socket_type]->linger_val.l_linger= (u_short) strtol(opt_val2_str, &tmpstr, 10);// pdelaage unsafe ushort cast conversion but needed to compile if(tmpstr==arg || *tmpstr) /* not a number */ return 0; /* FAILED */ } else { ptr->opt_val[socket_type]->linger_val.l_linger=0; } ! ptr->opt_val[socket_type]->linger_val.l_onoff=(u_short) strtol(opt_val_str, &tmpstr, 10);// pdelaage unsafe ushort cast conversion but needed to compile if(tmpstr==arg || *tmpstr) /* not a number */ return 0; /* FAILED */ return 1; /* OK */ *************** *** 2145,2152 **** static char *stralloc(char *str) { /* strdup() with error checking */ char *retval; ! ! retval=strdup(str); if(!retval) { s_log(LOG_ERR, "Fatal memory allocation error"); die(2); --- 2145,2155 ---- static char *stralloc(char *str) { /* strdup() with error checking */ char *retval; ! #ifdef USE_WIN32 ! retval=_strdup(str); ! #else ! retval=strdup(str);// pdelaage : as is, this code COULD NEVER compile neither on WIN32 or WINCE...nobody sees that in win32? except compiled with non ms compiler... ! #endif if(!retval) { s_log(LOG_ERR, "Fatal memory allocation error"); die(2); Seulement dans patched/src: options.obj Seulement dans patched/src: protocol.obj diff -cr orig/src/prototypes.h patched/src/prototypes.h *** orig/src/prototypes.h 2010-09-14 17:09:50.000000000 +0200 --- patched/src/prototypes.h 2010-09-26 20:41:32.389406500 +0200 *************** *** 411,417 **** extern CONTEXT *waiting_head, *waiting_tail; #endif #ifdef _WIN32_WCE ! int _beginthread(void (*)(void *), int, void *); void _endthread(void); #endif #ifdef DEBUG_STACK_SIZE --- 411,417 ---- extern CONTEXT *waiting_head, *waiting_tail; #endif #ifdef _WIN32_WCE ! long _beginthread(void (*)(void *), int, void *);// pdelaage 20100926 : long is now consistant with sthread.c void _endthread(void); #endif #ifdef DEBUG_STACK_SIZE Seulement dans patched/src: resolver.obj Seulement dans patched/src: resources.RES Seulement dans patched/src: ssl.obj diff -cr orig/src/sthreads.c patched/src/sthreads.c *** orig/src/sthreads.c 2010-09-14 17:45:47.000000000 +0200 --- patched/src/sthreads.c 2010-09-26 20:37:55.208971000 +0200 *************** *** 460,466 **** int create_client(int ls, int s, CLI *arg, void *(*cli)(void *)) { (void)ls; /* this parameter is only used with USE_FORK */ s_log(LOG_DEBUG, "Creating a new thread"); ! if((long)_beginthread((void(*)(void *))cli, NULL, arg->opt->stack_size, arg)==-1L) { ioerror("_beginthread"); if(arg) free(arg); --- 460,468 ---- int create_client(int ls, int s, CLI *arg, void *(*cli)(void *)) { (void)ls; /* this parameter is only used with USE_FORK */ s_log(LOG_DEBUG, "Creating a new thread"); ! // if((long)_beginthread((void(*)(void *))cli, NULL, arg->opt->stack_size, arg)==-1L) { pdelaage 20100925 ong not anymore necessary after proper prototype ! ! if(_beginthread((void(*)(void *))cli, NULL, arg->opt->stack_size, arg)==-1L) { ioerror("_beginthread"); if(arg) free(arg); *************** *** 483,491 **** handle=CreateThread(NULL, stack_size, (LPTHREAD_START_ROUTINE)start_address, arglist, ! STACK_SIZE_PARAM_IS_A_RESERVATION, &thread_id); if(!handle) return -1L; CloseHandle(handle); return 0; } --- 485,499 ---- handle=CreateThread(NULL, stack_size, (LPTHREAD_START_ROUTINE)start_address, arglist, ! (stack_size > 0) ? STACK_SIZE_PARAM_IS_A_RESERVATION:0, &thread_id); ! // PDELAAGE 20100925 A BIG BUG WAS HERE : no thread can start with a gui since stksz is 0 AND this prm ask for this 0 to be the real stk size ! ! ! if(!handle) + { + if(!handle) s_log(LOG_ERR, "_beginthread failed ");// pdelaage add return -1L; + } CloseHandle(handle); return 0; } Seulement dans patched/src: sthreads.obj Les fichiers orig/src/stunnel.exe et patched/src/stunnel.exe sont différents. Seulement dans patched/src: stunnel.obj Seulement dans patched/src: tstunnel.exe Seulement dans patched/src: verify.obj