add windows/ build files from the old cvs winsetup/ directory
authorLee <ler762@users.sourceforge.net>
Fri, 10 Aug 2018 19:19:09 +0000 (15:19 -0400)
committerLee <ler762@users.sourceforge.net>
Fri, 10 Aug 2018 19:19:09 +0000 (15:19 -0400)
windows/MYconfigure [new file with mode: 0755]
windows/WinMessages.nsh [new file with mode: 0755]
windows/privoxy.ico [new file with mode: 0755]
windows/privoxy_winthreads.nsi [new file with mode: 0755]
windows/uninstall_privoxy.ico [new file with mode: 0755]

diff --git a/windows/MYconfigure b/windows/MYconfigure
new file mode 100755 (executable)
index 0000000..5b3d55b
--- /dev/null
@@ -0,0 +1,123 @@
+#!/bin/sh
+# run the configure script for a native Windows build
+
+if [ -f ../configure.in ]; then
+   #  we're in the windows directory, so we need to go up a level
+   cd ..
+fi
+
+if [ ! -f configure ]; then
+   autoheader
+   #   creates config.h.in
+   autoconf
+   #   creates configure
+fi
+
+####### configure options:
+# --help                          Show configure options and a short description
+#
+# --host=i686-w64-mingw32         Use the mingw cross-compiler to build a 'native' windows binary
+# --enable-mingw32                Use mingw32 for a Windows GUI
+# --enable-static-linking         Use static linking instead of dynamic linking (and not have
+#                                 to put all the .DLLs in the path or the same dir as Privoxy)
+# --disable-pthread               Use native threads instead of POSIX pthreads library
+# --disable-dynamic-pcre          Use the built-in, static pcre, even if libpcre is available
+# --with-docbook=yes              Enable docbook documentation creation
+
+
+export CFLAGS="-O2"
+# note: configure.in line 155
+#         if test "X$CFLAGS" = "X "; then # if CFLAGS were unset (see above)
+#   In other words, if you set CFLAGS you need to include -O2 if you want optimization
+#   assume I'll set cflags below, so set O2 now
+
+export LDFLAGS=""
+# start with initially empty flags
+
+
+### CFLAGS="${CFLAGS} -fstack-protector-strong"
+### LDFLAGS="${LDFLAGS} -fstack-protector-strong"
+# enable stack checking.  NOTE: need to specify when compiling _and_ linking
+# stack-protector-strong: better balance between security and performance.
+#   This flag protects more kinds of vulnerable functions than -fstack-protector does,
+#   but not every function, providing better performance than -fstack-protector-all.
+# see : https://en.wikipedia.org/wiki/Buffer_overflow_protection
+# NOTE: needs static linking or the following in the path:
+#         /usr/i686-w64-mingw32/sys-root/mingw/bin/libssp-0.dll
+
+### CFLAGS="${CFLAGS} -march=native"
+# -march=cpu-type
+#   Generate instructions for the machine type cpu-type.  In contrast to -mtune=cpu-type, which merely tunes the
+#   generated code for the specified cpu-type, -march=cpu-type allows GCC to generate code that may not run at all on
+#   processors other than the one indicated.
+#   Specifying -march=cpu-type implies -mtune=cpu-type.
+#
+# -march=native
+#   This selects the CPU to generate code for at compilation time by determining the processor type of the compiling
+#   machine.  Using -march=native enables all instruction subsets supported by the local machine (hence the result
+#   might not run on different machines).  Using -mtune=native produces code optimized for the local machine under
+#   the constraints of the selected instruction set.
+
+LDFLAGS="${LDFLAGS} -Wl,--nxcompat"
+# https://en.wikipedia.org/wiki/Data_Execution_Prevention
+#   Enable DEP with -Wl,--nxcompat
+
+LDFLAGS="${LDFLAGS} -Wl,--dynamicbase,--export-all-symbols"
+# https://en.wikipedia.org/wiki/Address_space_layout_randomization
+# https://stackoverflow.com/questions/24283918/how-can-i-enable-aslr-dep-and-safeseh-on-an-exe-in-codeblocks-using-mingw
+#   ASLR with gcc has a problem: -Wl,--dynamicbase doesn't emit the necessary relocation table.
+#   As a workaround, you can pass -Wl,--dynamicbase,--export-all-symbols
+#   NOTE: you can't have both this and profiling (cflags='-pg') enabled!
+
+#CFLAGS="${CFLAGS} -pg"
+#LDFLAGS="${LDFLAGS} -pg"
+# Generate extra code to write profile information suitable for the analysis program gprof.
+# Use this option when compiling the source files you want data about, and you must also use it when linking.
+# -- creates a "gmon.out" profile file when the program exits
+# -- then do 'gprof -b privoxy.exe gmon.out'
+#  ??? WHY ???  profiling doesn't work if ASLR is enabled
+
+
+### CFLAGS="${CFLAGS} -Wall"
+# see: http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
+# -Wall   doesn't actually turn on all warnings, so add  -Wextra
+#    but then plenty too many complaints by
+#      -Wmissing-field-initializers
+#      -Wsign-compare
+#      -Wtype-limits
+### CFLAGS="${CFLAGS} -Wextra -Wno-missing-field-initializers -Wno-sign-compare -Wno-type-limits"
+
+# CFLAGS="${CFLAGS} -Wconversion"
+#   way too many warnings for things that don't look like a problem
+
+### CFLAGS="${CFLAGS} -Wformat-security"
+# If -Wformat is specified, also warn about uses of format functions that represent possible security problems.
+
+### CFLAGS="${CFLAGS} -Wlogical-op"
+# Warn about suspicious uses of logical operators in expressions.
+
+CFLAGS="${CFLAGS} -Wshadow"
+# Warn whenever a local variable or type declaration shadows
+# another variable or whenever a built-in function is shadowed.
+
+# CFLAGS="${CFLAGS} -Wwrite-strings"
+# These warnings help you find at compile time code that can try to write
+# into a string constant, but only if you have been very careful about
+# using const in declarations and prototypes.
+# >>> Otherwise, it is just a nuisance. <<<  -- this, very much this
+
+echo "CFLAGS=${CFLAGS}"
+echo "LDFLAGS=${LDFLAGS}"
+
+# ./configure cross-compilation options:
+#    --build: the system on which the program will be built.
+#    --host:  the system on which the generated program will run.
+#    --target: only used to build a cross-compiling toolchain.
+
+./configure  --host=i686-w64-mingw32  --enable-mingw32  --enable-zlib \
+             --enable-static-linking \
+             --enable-strptime-sanity-checks \
+             --disable-pthread  --disable-dynamic-pcre \
+             --with-docbook=yes
+
+#  -- done --
diff --git a/windows/WinMessages.nsh b/windows/WinMessages.nsh
new file mode 100755 (executable)
index 0000000..b18f27d
--- /dev/null
@@ -0,0 +1,576 @@
+/*\r
+_____________________________________________________________________________\r
+\r
+                       List of common Windows Messages\r
+_____________________________________________________________________________\r
+\r
+ 2005 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)\r
+\r
+\r
+Usage example:\r
+---------------------------------------------------\r
+Name "Output"\r
+OutFile "Output.exe"\r
+\r
+!include "WinMessages.nsh"\r
+\r
+Section\r
+       FindWindow $0 '#32770' '' $HWNDPARENT\r
+       GetDlgItem $1 $0 1027\r
+       SendMessage $1 ${WM_SETTEXT} 0 'STR:MyText'\r
+SectionEnd\r
+---------------------------------------------------\r
+\r
+\r
+Prefix  Message category\r
+-------------------------\r
+SW      ShowWindow Commands\r
+BM      Button control\r
+CB      Combo box control\r
+EM      Edit control\r
+LB      List box control\r
+WM      General window\r
+ABM     Application desktop toolbar\r
+DBT     Device\r
+DM      Default push button control\r
+HDM     Header control\r
+LVM     List view control\r
+SB      Status bar window\r
+SBM     Scroll bar control\r
+STM     Static control\r
+TCM     Tab control\r
+-----------------------------------\r
+\r
+NOT included messages (WM_USER + X)\r
+-----------------------------------\r
+CBEM    Extended combo box control\r
+CDM     Common dialog box\r
+DL      Drag list box\r
+DTM     Date and time picker control\r
+HKM     Hot key control\r
+IPM     IP address control\r
+MCM     Month calendar control\r
+PBM     Progress bar\r
+PGM     Pager control\r
+PSM     Property sheet\r
+RB      Rebar control\r
+TB      Toolbar\r
+TBM     Trackbar\r
+TTM     Tooltip control\r
+TVM     Tree-view control\r
+UDM     Up-down control\r
+-----------------------------------\r
+*/\r
+\r
+\r
+!ifndef WINMESSAGES_INCLUDED\r
+!define WINMESSAGES_INCLUDED\r
+!verbose push\r
+!verbose 3\r
+\r
+!define HWND_BROADCAST      0xFFFF\r
+\r
+#ShowWindow Commands#\r
+!define SW_HIDE             0\r
+!define SW_SHOWNORMAL       1\r
+!define SW_NORMAL           1\r
+!define SW_SHOWMINIMIZED    2\r
+!define SW_SHOWMAXIMIZED    3\r
+!define SW_MAXIMIZE         3\r
+!define SW_SHOWNOACTIVATE   4\r
+!define SW_SHOW             5\r
+!define SW_MINIMIZE         6\r
+!define SW_SHOWMINNOACTIVE  7\r
+!define SW_SHOWNA           8\r
+!define SW_RESTORE          9\r
+!define SW_SHOWDEFAULT      10\r
+!define SW_FORCEMINIMIZE    11\r
+!define SW_MAX              11\r
+\r
+#Button Control Messages#\r
+!define BM_CLICK           0x00F5\r
+!define BM_GETCHECK        0x00F0\r
+!define BM_GETIMAGE        0x00F6\r
+!define BM_GETSTATE        0x00F2\r
+!define BM_SETCHECK        0x00F1\r
+!define BM_SETIMAGE        0x00F7\r
+!define BM_SETSTATE        0x00F3\r
+!define BM_SETSTYLE        0x00F4\r
+\r
+#Combo Box Messages#\r
+!define CB_ADDSTRING                0x0143\r
+!define CB_DELETESTRING             0x0144\r
+!define CB_DIR                      0x0145\r
+!define CB_FINDSTRING               0x014C\r
+!define CB_FINDSTRINGEXACT          0x0158\r
+!define CB_GETCOUNT                 0x0146\r
+!define CB_GETCURSEL                0x0147\r
+!define CB_GETDROPPEDCONTROLRECT    0x0152\r
+!define CB_GETDROPPEDSTATE          0x0157\r
+!define CB_GETDROPPEDWIDTH          0x015f\r
+!define CB_GETEDITSEL               0x0140\r
+!define CB_GETEXTENDEDUI            0x0156\r
+!define CB_GETHORIZONTALEXTENT      0x015d\r
+!define CB_GETITEMDATA              0x0150\r
+!define CB_GETITEMHEIGHT            0x0154\r
+!define CB_GETLBTEXT                0x0148\r
+!define CB_GETLBTEXTLEN             0x0149\r
+!define CB_GETLOCALE                0x015A\r
+!define CB_GETTOPINDEX              0x015b\r
+!define CB_INITSTORAGE              0x0161\r
+!define CB_INSERTSTRING             0x014A\r
+!define CB_LIMITTEXT                0x0141\r
+!define CB_MSGMAX                   0x015B  # 0x0162 0x0163\r
+!define CB_MULTIPLEADDSTRING        0x0163\r
+!define CB_RESETCONTENT             0x014B\r
+!define CB_SELECTSTRING             0x014D\r
+!define CB_SETCURSEL                0x014E\r
+!define CB_SETDROPPEDWIDTH          0x0160\r
+!define CB_SETEDITSEL               0x0142\r
+!define CB_SETEXTENDEDUI            0x0155\r
+!define CB_SETHORIZONTALEXTENT      0x015e\r
+!define CB_SETITEMDATA              0x0151\r
+!define CB_SETITEMHEIGHT            0x0153\r
+!define CB_SETLOCALE                0x0159\r
+!define CB_SETTOPINDEX              0x015c\r
+!define CB_SHOWDROPDOWN             0x014F\r
+\r
+!define CB_ERR                      -1\r
+\r
+#Edit Control Messages#\r
+!define EM_CANUNDO              0x00C6\r
+!define EM_CHARFROMPOS          0x00D7\r
+!define EM_EMPTYUNDOBUFFER      0x00CD\r
+!define EM_FMTLINES             0x00C8\r
+!define EM_GETFIRSTVISIBLELINE  0x00CE\r
+!define EM_GETHANDLE            0x00BD\r
+!define EM_GETIMESTATUS         0x00D9\r
+!define EM_GETLIMITTEXT         0x00D5\r
+!define EM_GETLINE              0x00C4\r
+!define EM_GETLINECOUNT         0x00BA\r
+!define EM_GETMARGINS           0x00D4\r
+!define EM_GETMODIFY            0x00B8\r
+!define EM_GETPASSWORDCHAR      0x00D2\r
+!define EM_GETRECT              0x00B2\r
+!define EM_GETSEL               0x00B0\r
+!define EM_GETTHUMB             0x00BE\r
+!define EM_GETWORDBREAKPROC     0x00D1\r
+!define EM_LIMITTEXT            0x00C5\r
+!define EM_LINEFROMCHAR         0x00C9\r
+!define EM_LINEINDEX            0x00BB\r
+!define EM_LINELENGTH           0x00C1\r
+!define EM_LINESCROLL           0x00B6\r
+!define EM_POSFROMCHAR          0x00D6\r
+!define EM_REPLACESEL           0x00C2\r
+!define EM_SCROLL               0x00B5\r
+!define EM_SCROLLCARET          0x00B7\r
+!define EM_SETHANDLE            0x00BC\r
+!define EM_SETIMESTATUS         0x00D8\r
+!define EM_SETLIMITTEXT         0x00C5  # Same as EM_LIMITTEXT\r
+!define EM_SETMARGINS           0x00D3\r
+!define EM_SETMODIFY            0x00B9\r
+!define EM_SETPASSWORDCHAR      0x00CC\r
+!define EM_SETREADONLY          0x00CF\r
+!define EM_SETRECT              0x00B3\r
+!define EM_SETRECTNP            0x00B4\r
+!define EM_SETSEL               0x00B1\r
+!define EM_SETTABSTOPS          0x00CB\r
+!define EM_SETWORDBREAKPROC     0x00D0\r
+!define EM_UNDO                 0x00C7\r
+\r
+#Listbox Messages#\r
+!define LB_ADDFILE              0x0196\r
+!define LB_ADDSTRING            0x0180\r
+!define LB_DELETESTRING         0x0182\r
+!define LB_DIR                  0x018D\r
+!define LB_FINDSTRING           0x018F\r
+!define LB_FINDSTRINGEXACT      0x01A2\r
+!define LB_GETANCHORINDEX       0x019D\r
+!define LB_GETCARETINDEX        0x019F\r
+!define LB_GETCOUNT             0x018B\r
+!define LB_GETCURSEL            0x0188\r
+!define LB_GETHORIZONTALEXTENT  0x0193\r
+!define LB_GETITEMDATA          0x0199\r
+!define LB_GETITEMHEIGHT        0x01A1\r
+!define LB_GETITEMRECT          0x0198\r
+!define LB_GETLOCALE            0x01A6\r
+!define LB_GETSEL               0x0187\r
+!define LB_GETSELCOUNT          0x0190\r
+!define LB_GETSELITEMS          0x0191\r
+!define LB_GETTEXT              0x0189\r
+!define LB_GETTEXTLEN           0x018A\r
+!define LB_GETTOPINDEX          0x018E\r
+!define LB_INITSTORAGE          0x01A8\r
+!define LB_INSERTSTRING         0x0181\r
+!define LB_ITEMFROMPOINT        0x01A9\r
+!define LB_MSGMAX               0x01A8  # 0x01B0 0x01B1\r
+!define LB_MULTIPLEADDSTRING    0x01B1\r
+!define LB_RESETCONTENT         0x0184\r
+!define LB_SELECTSTRING         0x018C\r
+!define LB_SELITEMRANGE         0x019B\r
+!define LB_SELITEMRANGEEX       0x0183\r
+!define LB_SETANCHORINDEX       0x019C\r
+!define LB_SETCARETINDEX        0x019E\r
+!define LB_SETCOLUMNWIDTH       0x0195\r
+!define LB_SETCOUNT             0x01A7\r
+!define LB_SETCURSEL            0x0186\r
+!define LB_SETHORIZONTALEXTENT  0x0194\r
+!define LB_SETITEMDATA          0x019A\r
+!define LB_SETITEMHEIGHT        0x01A0\r
+!define LB_SETLOCALE            0x01A5\r
+!define LB_SETSEL               0x0185\r
+!define LB_SETTABSTOPS          0x0192\r
+!define LB_SETTOPINDEX          0x0197\r
+\r
+!define LB_ERR                  -1\r
+\r
+#Window Messages#\r
+!define WM_ACTIVATE                     0x0006\r
+!define WM_ACTIVATEAPP                  0x001C\r
+!define WM_AFXFIRST                     0x0360\r
+!define WM_AFXLAST                      0x037F\r
+!define WM_APP                          0x8000\r
+!define WM_APPCOMMAND                   0x0319\r
+!define WM_ASKCBFORMATNAME              0x030C\r
+!define WM_CANCELJOURNAL                0x004B\r
+!define WM_CANCELMODE                   0x001F\r
+!define WM_CAPTURECHANGED               0x0215\r
+!define WM_CHANGECBCHAIN                0x030D\r
+!define WM_CHANGEUISTATE                0x0127\r
+!define WM_CHAR                         0x0102\r
+!define WM_CHARTOITEM                   0x002F\r
+!define WM_CHILDACTIVATE                0x0022\r
+!define WM_CLEAR                        0x0303\r
+!define WM_CLOSE                        0x0010\r
+!define WM_COMMAND                      0x0111\r
+!define WM_COMMNOTIFY                   0x0044  # no longer suported\r
+!define WM_COMPACTING                   0x0041\r
+!define WM_COMPAREITEM                  0x0039\r
+!define WM_CONTEXTMENU                  0x007B\r
+!define WM_CONVERTREQUESTEX             0x108\r
+!define WM_COPY                         0x0301\r
+!define WM_COPYDATA                     0x004A\r
+!define WM_CREATE                       0x0001\r
+!define WM_CTLCOLOR                     0x0019\r
+!define WM_CTLCOLORBTN                  0x0135\r
+!define WM_CTLCOLORDLG                  0x0136\r
+!define WM_CTLCOLOREDIT                 0x0133\r
+!define WM_CTLCOLORLISTBOX              0x0134\r
+!define WM_CTLCOLORMSGBOX               0x0132\r
+!define WM_CTLCOLORSCROLLBAR            0x0137\r
+!define WM_CTLCOLORSTATIC               0x0138\r
+!define WM_CUT                          0x0300\r
+!define WM_DDE_FIRST                    0x3E0\r
+!define WM_DEADCHAR                     0x0103\r
+!define WM_DELETEITEM                   0x002D\r
+!define WM_DESTROY                      0x0002\r
+!define WM_DESTROYCLIPBOARD             0x0307\r
+!define WM_DEVICECHANGE                 0x0219\r
+!define WM_DEVMODECHANGE                0x001B\r
+!define WM_DISPLAYCHANGE                0x007E\r
+!define WM_DRAWCLIPBOARD                0x0308\r
+!define WM_DRAWITEM                     0x002B\r
+!define WM_DROPFILES                    0x0233\r
+!define WM_ENABLE                       0x000A\r
+!define WM_ENDSESSION                   0x0016\r
+!define WM_ENTERIDLE                    0x0121\r
+!define WM_ENTERMENULOOP                0x0211\r
+!define WM_ENTERSIZEMOVE                0x0231\r
+!define WM_ERASEBKGND                   0x0014\r
+!define WM_EXITMENULOOP                 0x0212\r
+!define WM_EXITSIZEMOVE                 0x0232\r
+!define WM_FONTCHANGE                   0x001D\r
+!define WM_GETDLGCODE                   0x0087\r
+!define WM_GETFONT                      0x0031\r
+!define WM_GETHOTKEY                    0x0033\r
+!define WM_GETICON                      0x007F\r
+!define WM_GETMINMAXINFO                0x0024\r
+!define WM_GETOBJECT                    0x003D\r
+!define WM_GETTEXT                      0x000D\r
+!define WM_GETTEXTLENGTH                0x000E\r
+!define WM_HANDHELDFIRST                0x0358\r
+!define WM_HANDHELDLAST                 0x035F\r
+!define WM_HELP                         0x0053\r
+!define WM_HOTKEY                       0x0312\r
+!define WM_HSCROLL                      0x0114\r
+!define WM_HSCROLLCLIPBOARD             0x030E\r
+!define WM_ICONERASEBKGND               0x0027\r
+!define WM_IME_CHAR                     0x0286\r
+!define WM_IME_COMPOSITION              0x010F\r
+!define WM_IME_COMPOSITIONFULL          0x0284\r
+!define WM_IME_CONTROL                  0x0283\r
+!define WM_IME_ENDCOMPOSITION           0x010E\r
+!define WM_IME_KEYDOWN                  0x0290\r
+!define WM_IME_KEYLAST                  0x010F\r
+!define WM_IME_KEYUP                    0x0291\r
+!define WM_IME_NOTIFY                   0x0282\r
+!define WM_IME_REQUEST                  0x0288\r
+!define WM_IME_SELECT                   0x0285\r
+!define WM_IME_SETCONTEXT               0x0281\r
+!define WM_IME_STARTCOMPOSITION         0x010D\r
+!define WM_INITDIALOG                   0x0110\r
+!define WM_INITMENU                     0x0116\r
+!define WM_INITMENUPOPUP                0x0117\r
+!define WM_INPUT                        0x00FF\r
+!define WM_INPUTLANGCHANGE              0x0051\r
+!define WM_INPUTLANGCHANGEREQUEST       0x0050\r
+!define WM_KEYDOWN                      0x0100\r
+!define WM_KEYFIRST                     0x0100\r
+!define WM_KEYLAST                      0x0108\r
+!define WM_KEYUP                        0x0101\r
+!define WM_KILLFOCUS                    0x0008\r
+!define WM_LBUTTONDBLCLK                0x0203\r
+!define WM_LBUTTONDOWN                  0x0201\r
+!define WM_LBUTTONUP                    0x0202\r
+!define WM_MBUTTONDBLCLK                0x0209\r
+!define WM_MBUTTONDOWN                  0x0207\r
+!define WM_MBUTTONUP                    0x0208\r
+!define WM_MDIACTIVATE                  0x0222\r
+!define WM_MDICASCADE                   0x0227\r
+!define WM_MDICREATE                    0x0220\r
+!define WM_MDIDESTROY                   0x0221\r
+!define WM_MDIGETACTIVE                 0x0229\r
+!define WM_MDIICONARRANGE               0x0228\r
+!define WM_MDIMAXIMIZE                  0x0225\r
+!define WM_MDINEXT                      0x0224\r
+!define WM_MDIREFRESHMENU               0x0234\r
+!define WM_MDIRESTORE                   0x0223\r
+!define WM_MDISETMENU                   0x0230\r
+!define WM_MDITILE                      0x0226\r
+!define WM_MEASUREITEM                  0x002C\r
+!define WM_MENUCHAR                     0x0120\r
+!define WM_MENUCOMMAND                  0x0126\r
+!define WM_MENUDRAG                     0x0123\r
+!define WM_MENUGETOBJECT                0x0124\r
+!define WM_MENURBUTTONUP                0x0122\r
+!define WM_MENUSELECT                   0x011F\r
+!define WM_MOUSEACTIVATE                0x0021\r
+!define WM_MOUSEFIRST                   0x0200\r
+!define WM_MOUSEHOVER                   0x02A1\r
+!define WM_MOUSELAST                    0x0209  # 0x020A 0x020D\r
+!define WM_MOUSELEAVE                   0x02A3\r
+!define WM_MOUSEMOVE                    0x0200\r
+!define WM_MOUSEWHEEL                   0x020A\r
+!define WM_MOVE                         0x0003\r
+!define WM_MOVING                       0x0216\r
+!define WM_NCACTIVATE                   0x0086\r
+!define WM_NCCALCSIZE                   0x0083\r
+!define WM_NCCREATE                     0x0081\r
+!define WM_NCDESTROY                    0x0082\r
+!define WM_NCHITTEST                    0x0084\r
+!define WM_NCLBUTTONDBLCLK              0x00A3\r
+!define WM_NCLBUTTONDOWN                0x00A1\r
+!define WM_NCLBUTTONUP                  0x00A2\r
+!define WM_NCMBUTTONDBLCLK              0x00A9\r
+!define WM_NCMBUTTONDOWN                0x00A7\r
+!define WM_NCMBUTTONUP                  0x00A8\r
+!define WM_NCMOUSEHOVER                 0x02A0\r
+!define WM_NCMOUSELEAVE                 0x02A2\r
+!define WM_NCMOUSEMOVE                  0x00A0\r
+!define WM_NCPAINT                      0x0085\r
+!define WM_NCRBUTTONDBLCLK              0x00A6\r
+!define WM_NCRBUTTONDOWN                0x00A4\r
+!define WM_NCRBUTTONUP                  0x00A5\r
+!define WM_NCXBUTTONDBLCLK              0x00AD\r
+!define WM_NCXBUTTONDOWN                0x00AB\r
+!define WM_NCXBUTTONUP                  0x00AC\r
+!define WM_NEXTDLGCTL                   0x0028\r
+!define WM_NEXTMENU                     0x0213\r
+!define WM_NOTIFY                       0x004E\r
+!define WM_NOTIFYFORMAT                 0x0055\r
+!define WM_NULL                         0x0000\r
+!define WM_PAINT                        0x000F\r
+!define WM_PAINTCLIPBOARD               0x0309\r
+!define WM_PAINTICON                    0x0026\r
+!define WM_PALETTECHANGED               0x0311\r
+!define WM_PALETTEISCHANGING            0x0310\r
+!define WM_PARENTNOTIFY                 0x0210\r
+!define WM_PASTE                        0x0302\r
+!define WM_PENWINFIRST                  0x0380\r
+!define WM_PENWINLAST                   0x038F\r
+!define WM_POWER                        0x0048\r
+!define WM_POWERBROADCAST               0x0218\r
+!define WM_PRINT                        0x0317\r
+!define WM_PRINTCLIENT                  0x0318\r
+!define WM_QUERYDRAGICON                0x0037\r
+!define WM_QUERYENDSESSION              0x0011\r
+!define WM_QUERYNEWPALETTE              0x030F\r
+!define WM_QUERYOPEN                    0x0013\r
+!define WM_QUERYUISTATE                 0x0129\r
+!define WM_QUEUESYNC                    0x0023\r
+!define WM_QUIT                         0x0012\r
+!define WM_RBUTTONDBLCLK                0x0206\r
+!define WM_RBUTTONDOWN                  0x0204\r
+!define WM_RBUTTONUP                    0x0205\r
+!define WM_RASDIALEVENT                 0xCCCD\r
+!define WM_RENDERALLFORMATS             0x0306\r
+!define WM_RENDERFORMAT                 0x0305\r
+!define WM_SETCURSOR                    0x0020\r
+!define WM_SETFOCUS                     0x0007\r
+!define WM_SETFONT                      0x0030\r
+!define WM_SETHOTKEY                    0x0032\r
+!define WM_SETICON                      0x0080\r
+!define WM_SETREDRAW                    0x000B\r
+!define WM_SETTEXT                      0x000C\r
+!define WM_SETTINGCHANGE                0x001A  # Same as WM_WININICHANGE\r
+!define WM_SHOWWINDOW                   0x0018\r
+!define WM_SIZE                         0x0005\r
+!define WM_SIZECLIPBOARD                0x030B\r
+!define WM_SIZING                       0x0214\r
+!define WM_SPOOLERSTATUS                0x002A\r
+!define WM_STYLECHANGED                 0x007D\r
+!define WM_STYLECHANGING                0x007C\r
+!define WM_SYNCPAINT                    0x0088\r
+!define WM_SYSCHAR                      0x0106\r
+!define WM_SYSCOLORCHANGE               0x0015\r
+!define WM_SYSCOMMAND                   0x0112\r
+!define WM_SYSDEADCHAR                  0x0107\r
+!define WM_SYSKEYDOWN                   0x0104\r
+!define WM_SYSKEYUP                     0x0105\r
+!define WM_TABLET_FIRST                 0x02C0\r
+!define WM_TABLET_LAST                  0x02DF\r
+!define WM_THEMECHANGED                 0x031A\r
+!define WM_TCARD                        0x0052\r
+!define WM_TIMECHANGE                   0x001E\r
+!define WM_TIMER                        0x0113\r
+!define WM_UNDO                         0x0304\r
+!define WM_UNICHAR                      0x0109\r
+!define WM_UNINITMENUPOPUP              0x0125\r
+!define WM_UPDATEUISTATE                0x0128\r
+!define WM_USER                         0x400\r
+!define WM_USERCHANGED                  0x0054\r
+!define WM_VKEYTOITEM                   0x002E\r
+!define WM_VSCROLL                      0x0115\r
+!define WM_VSCROLLCLIPBOARD             0x030A\r
+!define WM_WINDOWPOSCHANGED             0x0047\r
+!define WM_WINDOWPOSCHANGING            0x0046\r
+!define WM_WININICHANGE                 0x001A\r
+!define WM_WTSSESSION_CHANGE            0x02B1\r
+!define WM_XBUTTONDBLCLK                0x020D\r
+!define WM_XBUTTONDOWN                  0x020B\r
+!define WM_XBUTTONUP                    0x020C\r
+\r
+\r
+#Application desktop toolbar#\r
+!define ABM_ACTIVATE         0x00000006  # lParam == TRUE/FALSE means activate/deactivate\r
+!define ABM_GETAUTOHIDEBAR   0x00000007\r
+!define ABM_GETSTATE         0x00000004\r
+!define ABM_GETTASKBARPOS    0x00000005\r
+!define ABM_NEW              0x00000000\r
+!define ABM_QUERYPOS         0x00000002\r
+!define ABM_REMOVE           0x00000001\r
+!define ABM_SETAUTOHIDEBAR   0x00000008  # This can fail, you MUST check the result\r
+!define ABM_SETPOS           0x00000003\r
+!define ABM_WINDOWPOSCHANGED 0x0000009\r
+\r
+#Device#\r
+!define DBT_APPYBEGIN                   0x0000\r
+!define DBT_APPYEND                     0x0001\r
+!define DBT_CONFIGCHANGECANCELED        0x0019\r
+!define DBT_CONFIGCHANGED               0x0018\r
+!define DBT_CONFIGMGAPI32               0x0022\r
+!define DBT_CONFIGMGPRIVATE             0x7FFF\r
+!define DBT_CUSTOMEVENT                 0x8006  # User-defined event\r
+!define DBT_DEVICEARRIVAL               0x8000  # System detected a new device\r
+!define DBT_DEVICEQUERYREMOVE           0x8001  # Wants to remove, may fail\r
+!define DBT_DEVICEQUERYREMOVEFAILED     0x8002  # Removal aborted\r
+!define DBT_DEVICEREMOVECOMPLETE        0x8004  # Device is gone\r
+!define DBT_DEVICEREMOVEPENDING         0x8003  # About to remove, still avail.\r
+!define DBT_DEVICETYPESPECIFIC          0x8005  # Type specific event\r
+!define DBT_DEVNODES_CHANGED            0x0007\r
+!define DBT_DEVTYP_DEVICEINTERFACE      0x00000005  # Device interface class\r
+!define DBT_DEVTYP_DEVNODE              0x00000001  # Devnode number\r
+!define DBT_DEVTYP_HANDLE               0x00000006  # File system handle\r
+!define DBT_DEVTYP_NET                  0x00000004  # Network resource\r
+!define DBT_DEVTYP_OEM                  0x00000000  # Oem-defined device type\r
+!define DBT_DEVTYP_PORT                 0x00000003  # Serial, parallel\r
+!define DBT_DEVTYP_VOLUME               0x00000002  # Logical volume\r
+!define DBT_LOW_DISK_SPACE              0x0048\r
+!define DBT_MONITORCHANGE               0x001B\r
+!define DBT_NO_DISK_SPACE               0x0047\r
+!define DBT_QUERYCHANGECONFIG           0x0017\r
+!define DBT_SHELLLOGGEDON               0x0020\r
+!define DBT_USERDEFINED                 0xFFFF\r
+!define DBT_VOLLOCKLOCKFAILED           0x8043\r
+!define DBT_VOLLOCKLOCKRELEASED         0x8045\r
+!define DBT_VOLLOCKLOCKTAKEN            0x8042\r
+!define DBT_VOLLOCKQUERYLOCK            0x8041\r
+!define DBT_VOLLOCKQUERYUNLOCK          0x8044\r
+!define DBT_VOLLOCKUNLOCKFAILED         0x8046\r
+!define DBT_VPOWERDAPI                  0x8100  # VPOWERD API for Win95\r
+!define DBT_VXDINITCOMPLETE             0x0023\r
+\r
+#Default push button control#\r
+!define DM_BITSPERPEL       0x00040000\r
+!define DM_COLLATE          0x00008000\r
+!define DM_COLOR            0x00000800\r
+!define DM_COPIES           0x00000100\r
+!define DM_DEFAULTSOURCE    0x00000200\r
+!define DM_DISPLAYFLAGS     0x00200000\r
+!define DM_DISPLAYFREQUENCY 0x00400000\r
+!define DM_DITHERTYPE       0x04000000\r
+!define DM_DUPLEX           0x00001000\r
+!define DM_FORMNAME         0x00010000\r
+!define DM_GRAYSCALE        0x00000001  # This flag is no longer valid\r
+!define DM_ICMINTENT        0x01000000\r
+!define DM_ICMMETHOD        0x00800000\r
+!define DM_INTERLACED       0x00000002  # This flag is no longer valid\r
+!define DM_LOGPIXELS        0x00020000\r
+!define DM_MEDIATYPE        0x02000000\r
+!define DM_NUP              0x00000040\r
+!define DM_ORIENTATION      0x00000001\r
+!define DM_PANNINGHEIGHT    0x10000000\r
+!define DM_PANNINGWIDTH     0x08000000\r
+!define DM_PAPERLENGTH      0x00000004\r
+!define DM_PAPERSIZE        0x00000002\r
+!define DM_PAPERWIDTH       0x00000008\r
+!define DM_PELSHEIGHT       0x00100000\r
+!define DM_PELSWIDTH        0x00080000\r
+!define DM_POSITION         0x00000020\r
+!define DM_PRINTQUALITY     0x00000400\r
+!define DM_SCALE            0x00000010\r
+!define DM_SPECVERSION      0x0320       # 0x0400 0x0401\r
+!define DM_TTOPTION         0x00004000\r
+!define DM_YRESOLUTION      0x00002000\r
+\r
+#Header control#\r
+!define HDM_FIRST           0x1200\r
+\r
+#List view control#\r
+!define LVM_FIRST           0x1000\r
+\r
+#Status bar window#\r
+!define SB_CONST_ALPHA      0x00000001\r
+!define SB_GRAD_RECT        0x00000010\r
+!define SB_GRAD_TRI         0x00000020\r
+!define SB_NONE             0x00000000\r
+!define SB_PIXEL_ALPHA      0x00000002\r
+!define SB_PREMULT_ALPHA    0x00000004\r
+!define SB_SIMPLEID         0x00ff\r
+\r
+#Scroll bar control#\r
+!define SBM_ENABLE_ARROWS           0x00E4  # Not in win3.1\r
+!define SBM_GETPOS                  0x00E1  # Not in win3.1\r
+!define SBM_GETRANGE                0x00E3  # Not in win3.1\r
+!define SBM_GETSCROLLINFO           0x00EA\r
+!define SBM_SETPOS                  0x00E0  # Not in win3.1\r
+!define SBM_SETRANGE                0x00E2  # Not in win3.1\r
+!define SBM_SETRANGEREDRAW          0x00E6  # Not in win3.1\r
+!define SBM_SETSCROLLINFO           0x00E9\r
+\r
+#Static control#\r
+!define STM_GETICON                 0x0171\r
+!define STM_GETIMAGE                0x0173\r
+!define STM_MSGMAX                  0x0174\r
+!define STM_ONLY_THIS_INTERFACE     0x00000001\r
+!define STM_ONLY_THIS_NAME          0x00000008\r
+!define STM_ONLY_THIS_PROTOCOL      0x00000002\r
+!define STM_ONLY_THIS_TYPE          0x00000004\r
+!define STM_SETICON                 0x0170\r
+!define STM_SETIMAGE                0x0172\r
+\r
+#Tab control#\r
+!define TCM_FIRST                   0x1300\r
+\r
+!verbose pop\r
+!endif
\ No newline at end of file
diff --git a/windows/privoxy.ico b/windows/privoxy.ico
new file mode 100755 (executable)
index 0000000..52920ba
Binary files /dev/null and b/windows/privoxy.ico differ
diff --git a/windows/privoxy_winthreads.nsi b/windows/privoxy_winthreads.nsi
new file mode 100755 (executable)
index 0000000..8c9f113
--- /dev/null
@@ -0,0 +1,237 @@
+;
+; File:
+;   $Source: /cvsroot/ijbswa/winsetup/privoxy_winthreads.nsi,v $
+;
+; Purpose:
+;   NSIS script to make the Privoxy installer
+;
+;   This .NSI script is designed for NSIS v2.24+
+;
+;   Get NSIS from:  http://www.nullsoft.com/free/nsis/
+;
+; Copyright:
+;   Written by and Copyright (C) 2007-2009 the Privoxy team.
+;   http://www.privoxy.org/
+;
+;   This script originally written by and Copyright (C) 2002
+;   Jonathan Foster
+;
+;   This program is free software; you can redistribute it 
+;   and/or modify it under the terms of the GNU General
+;   Public License as published by the Free Software
+;   Foundation; either version 2 of the License, or (at
+;   your option) any later version.
+;
+;   This program is distributed in the hope that it will
+;   be useful, but WITHOUT ANY WARRANTY; without even the
+;   implied warranty of MERCHANTABILITY or FITNESS FOR A
+;   PARTICULAR PURPOSE.  See the GNU General Public
+;   License for more details.
+;
+;   The GNU General Public License should be included with
+;   this file.  If not, you can view it at
+;   http://www.gnu.org/copyleft/gpl.html
+;   or write to the Free Software Foundation, Inc., 59
+;   Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+;
+
+!include WinMessages.nsh ; to send close message to Privoxy process
+
+!define NL "$\r$\n"
+
+Var /GLOBAL UpdateExisting
+
+;win7 RequestExecutionLevel admin
+
+
+; Close Privoxy and wait for termination
+;
+!macro ClosePrivoxy
+       ;Close privoxy.exe
+       FindWindow $R0 "PrivoxyLogOwner"
+       IntCmpU $R0 0 NoPrivoxyRunning 0 0
+       SendMessage $R0 ${WM_CLOSE} 0 0
+       ; wait for close
+       StrCpy $R1 0
+CheckWindowClosed:
+       Sleep 200 ; avoid file in use error
+       FindWindow $R0 "PrivoxyLogOwner"
+       IntCmpU $R0 0 NoPrivoxyRunning 0 0
+       IntOp $R1 $R1 + 1
+       IntCmp $R1 20 0 CheckWindowClosed 0
+       Sleep 200 ; avoid file in use error
+NoPrivoxyRunning:
+!macroend
+
+
+; create a backup file if file exists, set $UpdateExisting on existing files
+;
+!macro BackupOLD Name BackupName
+       !define UniqueID ${__LINE__}
+
+       IfFileExists "$INSTDIR\${Name}"  0 skip_${UniqueID}
+       StrCpy $UpdateExisting 1
+       delete "$INSTDIR\${BackupName}"
+       rename "$INSTDIR\${Name}" "$INSTDIR\${BackupName}"
+skip_${UniqueID}:
+
+       !undef UniqueID
+!macroend
+
+
+; check file, write new one to different target there is one, set $UpdateExisting on existing files
+;
+!macro KeepCur Name DefaultName SrcDir
+       !define UniqueID ${__LINE__}
+
+       IfFileExists "$INSTDIR\${Name}" 0 new_${UniqueID}
+       StrCpy $UpdateExisting 1
+       delete "$INSTDIR\${DefaultName}"
+       File "/oname=${DefaultName}" "${SrcDir}${Name}"
+       goto done_${UniqueID}
+
+new_${UniqueID}:
+       File "${SrcDir}${Name}"
+
+done_${UniqueID}:
+
+       !undef UniqueID
+!macroend
+
+
+Name "Privoxy"
+OutFile "privoxy_setup.exe"
+
+BGGradient off
+
+; Some default compiler settings (uncomment and change at will):
+SetCompress auto ; (can be off or force)
+SetCompressor /FINAL /SOLID lzma
+SetDatablockOptimize on
+CRCCheck on
+AutoCloseWindow true ; (can be true for the window go away automatically at end)
+ShowInstDetails nevershow ; (can be show to have them shown, or nevershow to disable)
+SetDateSave on ; (can be on to have files restored to their orginal date)
+; SetOverwrite ifnewer ; (files are only overwritten if the existing file is older than the new file)
+SetOverwrite on  ; install package files over-write existing files regardless of date
+
+Icon "privoxy.ico"
+UninstallIcon "uninstall_privoxy.ico"
+
+#LicenseText "Privoxy is distributed under the GNU General Public License.  Please read it before you install."
+#LicenseData "build/LICENSE.txt"
+
+InstallDir "$PROGRAMFILES\Privoxy"
+;InstallDirRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Privoxy.org\Privoxy" ""
+;DirShow show ; (make this hide to not let the user change it)
+;DirShow doesn't currently work.
+DirText "Select the directory to install Privoxy in:"
+
+ComponentText "Please select how you want to start Privoxy:"
+
+Section "" ; (default section)
+       StrCpy $UpdateExisting 0
+
+       ; Close privoxy.exe if it is running (user is upgrading) to prevent in-use errors.
+       !insertmacro ClosePrivoxy
+
+       ; add files / whatever that need to be installed here.
+       SetOutPath "$INSTDIR"
+
+       ; save files the user might have changed
+       ;   config.txt  match-all.action  trust.txt
+       ;
+       !insertmacro BackupOLD "config.txt" "old_config.txt"
+       !insertmacro BackupOLD "match-all.action" "old_match-all.action";
+       !insertmacro BackupOLD "trust.txt" "old_trust.txt"
+
+       ;File /r build\*.*
+
+       ; leave user.action and user.filter alone if they exist
+       ;
+       !insertmacro KeepCur "user.action" "clean_user.action" "build\"
+       !insertmacro KeepCur "user.filter" "clean_user.filter" "build\"
+       ; exclude all files handled by KeepCur
+       File /r /x CVS /x user.action /x user.filter build\*.*
+
+       ;WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Privoxy.org\Privoxy" "" "$INSTDIR"
+       WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Privoxy" "DisplayName" "Privoxy (remove only)"
+       WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Privoxy" "UninstallString" '"$INSTDIR\privoxy_uninstall.exe"'
+
+       WriteRegStr HKEY_CLASSES_ROOT "PrivoxyActionFile\shell\open\command" "" 'Notepad.exe "%1"'
+       WriteRegStr HKEY_CLASSES_ROOT ".action" "" "PrivoxyActionFile"
+       WriteRegStr HKEY_CLASSES_ROOT "PrivoxyFilterFile\shell\open\command" "" 'Notepad.exe "%1"'
+       WriteRegStr HKEY_CLASSES_ROOT ".filter" "" "PrivoxyFilterFile"
+
+       WriteUninstaller "privoxy_uninstall.exe"
+SectionEnd
+
+Section "Add to Start Menu"
+       SetShellVarContext all ; (Add to "All Users" Start Menu if possible)
+       RMDir /r "$SMPROGRAMS\Privoxy"
+       CreateDirectory "$SMPROGRAMS\Privoxy"
+       CreateShortCut "$SMPROGRAMS\Privoxy\Privoxy.lnk" "$INSTDIR\privoxy.exe"
+       WriteINIStr "$SMPROGRAMS\Privoxy\Web-based Configuration.url" "InternetShortcut" "URL" "http://config.privoxy.org/"
+       CreateShortCut "$SMPROGRAMS\Privoxy\Web-based Feedback.lnk" "$INSTDIR\doc\user-manual\contact.html"
+       CreateDirectory "$SMPROGRAMS\Privoxy\Edit Config"
+       CreateShortCut "$SMPROGRAMS\Privoxy\Edit Config\Main Configuration.lnk" "Notepad.exe" '"$INSTDIR\config.txt"'
+       CreateShortCut "$SMPROGRAMS\Privoxy\Edit Config\Default Actions.lnk" "Notepad.exe" '"$INSTDIR\default.action"'
+       CreateShortCut "$SMPROGRAMS\Privoxy\Edit Config\User Actions.lnk" "Notepad.exe" '"$INSTDIR\user.action"'
+       CreateShortCut "$SMPROGRAMS\Privoxy\Edit Config\Filters.lnk" "Notepad.exe" '"$INSTDIR\default.filter"'
+       CreateShortCut "$SMPROGRAMS\Privoxy\Edit Config\Trust list.lnk" "Notepad.exe" '"$INSTDIR\trust.txt"'
+       CreateDirectory "$SMPROGRAMS\Privoxy\Documentation"
+       CreateShortCut "$SMPROGRAMS\Privoxy\Documentation\User Manual.lnk" "$INSTDIR\doc\user-manual\index.html"
+       CreateShortCut "$SMPROGRAMS\Privoxy\Documentation\Frequently Asked Questions.lnk" "$INSTDIR\doc\faq\index.html"
+       CreateShortCut "$SMPROGRAMS\Privoxy\Documentation\Credits.lnk" "Notepad.exe" '"$INSTDIR\AUTHORS.txt"'
+       CreateShortCut "$SMPROGRAMS\Privoxy\Documentation\License.lnk" "Notepad.exe" '"$INSTDIR\LICENSE.txt"'
+       CreateShortCut "$SMPROGRAMS\Privoxy\Documentation\ReadMe file.lnk" "Notepad.exe" '"$INSTDIR\README.txt"'
+       WriteINIStr "$SMPROGRAMS\Privoxy\Documentation\Web Site.url" "InternetShortcut" "URL" "http://privoxy.org/"
+       CreateShortCut "$SMPROGRAMS\Privoxy\Uninstall Privoxy.lnk" "$INSTDIR\privoxy_uninstall.exe"
+SectionEnd
+
+
+Section "Run automatically at startup"
+       CreateShortCut "$SMSTARTUP\Privoxy.lnk" "$INSTDIR\privoxy.exe" "" "" 0 SW_SHOWMINIMIZED
+SectionEnd
+
+
+Function .onInstSuccess
+       ; on successful install, show message then start it
+       IntCmp $UpdateExisting 0  0 updated updated
+       MessageBox MB_YESNO|MB_DEFBUTTON1|MB_ICONQUESTION "Privoxy has been installed.${NL}${NL}Start Privoxy now?" /SD IDNO IDYES execprivoxy IDNO done
+       goto done
+updated:
+       MessageBox MB_YESNO|MB_DEFBUTTON1|MB_ICONEXCLAMATION "Privoxy has been updated.${NL}Don't forget to convert configuration from the 'old*' files!${NL}${NL}Start Privoxy now?" /SD IDNO IDYES execprivoxy IDNO done
+       goto done
+execprivoxy:
+       ; run privoxy after installation
+       SetOutPath "$INSTDIR"
+
+       Exec "$INSTDIR\privoxy.exe"
+done:
+FunctionEnd
+
+
+; begin uninstall settings/section. The UninstallText line must be before the Section header.
+;
+UninstallText "This will uninstall Privoxy from your system"
+Section Uninstall
+       SetShellVarContext all ; (Remove from "All Users" Start Menu if possible)
+       
+       ;DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Privoxy.org\Privoxy"
+       DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Privoxy"
+
+       DeleteRegKey HKEY_CLASSES_ROOT ".action"
+       DeleteRegKey HKEY_CLASSES_ROOT "PrivoxyActionFile"
+       DeleteRegKey HKEY_CLASSES_ROOT ".filter"
+       DeleteRegKey HKEY_CLASSES_ROOT "PrivoxyFilterFile"
+
+       Delete "$SMSTARTUP\Privoxy.lnk"
+
+       !insertmacro ClosePrivoxy
+
+       RMDir /r "$SMPROGRAMS\Privoxy"
+       RMDir /r "$INSTDIR"
+SectionEnd
+
+; eof
diff --git a/windows/uninstall_privoxy.ico b/windows/uninstall_privoxy.ico
new file mode 100755 (executable)
index 0000000..76ef561
Binary files /dev/null and b/windows/uninstall_privoxy.ico differ