X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=win32.c;h=679ce18fd5e7b3e2f4aab9671ccd0e7162cf7786;hp=9c0ed68b5809f958a830717aa2f73a9abce87a16;hb=7c7592fae8bbc71e2b255289e5a1eebd752e4dfc;hpb=5c50b6cd2ec21ee3b58b4a6afa7c628bb9ed4c1b diff --git a/win32.c b/win32.c index 9c0ed68b..679ce18f 100644 --- a/win32.c +++ b/win32.c @@ -1,12 +1,12 @@ -const char win32_rcs[] = "$Id: win32.c,v 1.5 2002/03/04 23:47:30 jongfoster Exp $"; +const char win32_rcs[] = "$Id: win32.c,v 1.13 2007/01/31 16:25:24 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/win32.c,v $ * * Purpose : Win32 User Interface initialization and message loop * - * Copyright : Written by and Copyright (C) 2001 the SourceForge - * IJBSWA team. http://ijbswa.sourceforge.net + * Copyright : Written by and Copyright (C) 2001-2002 members of + * the Privoxy team. http://www.privoxy.org/ * * Written by and Copyright (C) 1999 Adam Lock * @@ -31,6 +31,34 @@ const char win32_rcs[] = "$Id: win32.c,v 1.5 2002/03/04 23:47:30 jongfoster Exp * * Revisions : * $Log: win32.c,v $ + * Revision 1.13 2007/01/31 16:25:24 fabiankeil + * Update copyright range for the About message. + * + * Revision 1.12 2006/08/12 03:54:37 david__schmidt + * Windows service integration + * + * Revision 1.11 2006/07/18 14:48:48 david__schmidt + * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch) + * with what was really the latest development (the v_3_0_branch branch) + * + * Revision 1.9.2.2 2002/08/27 18:03:40 oes + * Fixed stupid typo + * + * Revision 1.9.2.1 2002/08/21 17:59:27 oes + * Sync win32_blurb[] with our standard blurb + * + * Revision 1.9 2002/03/31 17:19:00 jongfoster + * Win32 only: Enabling STRICT to fix a VC++ compile warning. + * + * Revision 1.8 2002/03/26 22:57:10 jongfoster + * Web server name should begin www. + * + * Revision 1.7 2002/03/24 12:03:47 jongfoster + * Name change + * + * Revision 1.6 2002/03/16 21:53:28 jongfoster + * VC++ Heap debug option + * * Revision 1.5 2002/03/04 23:47:30 jongfoster * - Rewritten, simpler command-line pre-parser * - not using raise(SIGINT) any more @@ -64,6 +92,9 @@ const char win32_rcs[] = "$Id: win32.c,v 1.5 2002/03/04 23:47:30 jongfoster Exp /* Uncomment this if you want to build Win32 as a console app */ /* #define _WIN_CONSOLE */ +#ifndef STRICT +#define STRICT +#endif #include #include @@ -78,31 +109,46 @@ const char win32_rcs[] = "$Id: win32.c,v 1.5 2002/03/04 23:47:30 jongfoster Exp const char win32_h_rcs[] = WIN32_H_VERSION; +/** + * A short introductory text about Privoxy. Used for the "About" box + * or the console startup message. + */ const char win32_blurb[] = -"Internet Junkbuster Proxy(TM) Version " VERSION " for Windows is Copyright (C) 1997-8\n" -"by Junkbusters Corp. This is free software; it may be used and copied under\n" -"the GNU General Public License: http://www.gnu.org/copyleft/gpl.html .\n" -"This program comes with ABSOLUTELY NO WARRANTY OF ANY KIND.\n" -"\n" -"For information about how to to configure the proxy and your browser, see\n" -" " REDIRECT_URL "win\n" -"\n" -"The Internet Junkbuster Proxy(TM) is running and ready to serve!\n" -""; +"Privoxy version " VERSION " for Windows\n" +"Copyright (C) 2000-2008 the Privoxy Team (" HOME_PAGE_URL ")\n" +"Based on the Internet Junkbuster by Junkbusters Corp.\n" +"This is free software; it may be used and copied under the\n" +"GNU General Public License: http://www.gnu.org/copyleft/gpl.html .\n" +"This program comes with ABSOLUTELY NO WARRANTY OF ANY KIND.\n"; #ifdef _WIN_CONSOLE +/** + * Hide the console. If set, the program will disconnect from the + * console and run in the background. This allows the command-prompt + * window to close. + */ int hideConsole = 0; -#else +#else /* ndef _WIN_CONSOLE */ + + +/** + * The application instance handle. + */ HINSTANCE g_hInstance; + + +/** + * The command to show the window that was specified at startup. + */ int g_nCmdShow; static void __cdecl UserInterfaceThread(void *); -#endif +#endif /* ndef _WIN_CONSOLE */ /********************************************************************* * @@ -111,12 +157,12 @@ static void __cdecl UserInterfaceThread(void *); * Description : M$ Windows "main" routine: * parse the `lpCmdLine' param into main's argc and argv variables, * start the user interface thread (for the systray window), and - * call main (i.e. patch execution into normal IJB startup). + * call main (i.e. patch execution into normal startup). * * Parameters : - * 1 : hInstance = instance handle of this IJB execution - * 2 : hPrevInstance = instance handle of previous IJB execution - * 3 : lpCmdLine = command line string which started IJB + * 1 : hInstance = instance handle of this execution + * 2 : hPrevInstance = instance handle of previous execution + * 3 : lpCmdLine = command line string which started us * 4 : nCmdShow = window show value (MIN, MAX, NORMAL, etc...) * * Returns : `main' never returns, so WinMain will also never return. @@ -124,11 +170,14 @@ static void __cdecl UserInterfaceThread(void *); *********************************************************************/ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { +#if 0 /* See comment about __argc & __argv below */ int i; - int res; int argc = 1; const char *argv[3]; char szModule[MAX_PATH+1]; +#endif + + int res; #ifndef _WIN_CONSOLE HANDLE hInitCompleteEvent = NULL; #endif @@ -152,6 +201,16 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine #endif #endif /* defined(_WIN32) && defined(_MSC_VER) && defined(_DEBUG) */ + +/************ + * I couldn't figure out why the command line was being sorta parsed here + * instead of using the __argc & __argv globals usually defined in stdlib.h + * + * From what I can tell by looking at the MinWG source, it supports these + * globals, so i'd hope that the other compilers do so as well. + * Obviously, if i'm wrong i'll find out soon enough! :) + ************/ +#if 0 /* * Cheat in parsing the command line. We only ever have at most one * paramater, which may optionally be specified inside double quotes. @@ -182,6 +241,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine argv[1] = lpCmdLine; argv[2] = NULL; argc = ((lpCmdLine != NULL) ? 2 : 1); +#endif /* -END- 0 */ + #ifndef _WIN_CONSOLE /* Create a user-interface thread and wait for it to initialise */ @@ -194,9 +255,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine #endif #ifdef __MINGW32__ - res = real_main( argc, argv ); + res = real_main( __argc, __argv ); #else - res = main( argc, argv ); + res = main( __argc, __argv ); #endif return res; @@ -232,7 +293,7 @@ void InitWin32(void) if (WSAStartup(wVersionRequested, &wsaData) != 0) { #ifndef _WIN_CONSOLE - MessageBox(NULL, "Cannot initialize WinSock library", "Internet JunkBuster Error", + MessageBox(NULL, "Cannot initialize WinSock library", "Privoxy Error", MB_OK | MB_ICONERROR | MB_TASKMODAL | MB_SETFOREGROUND | MB_TOPMOST); #endif exit(1); @@ -256,7 +317,7 @@ void InitWin32(void) * Description : User interface thread. WinMain will wait for us to set * the hInitCompleteEvent before patching over to `main'. * This ensures the systray window is active before beginning - * IJB operations. + * operations. * * Parameters : * 1 : pData = pointer to `hInitCompleteEvent'. @@ -289,7 +350,7 @@ static void __cdecl UserInterfaceThread(void *pData) } -#endif +#endif /* ndef _WIN_CONSOLE */ /*