[Privoxy-users] Run Privoxy on Windows without the GUI

Fabian Keil fk at fabiankeil.de
Wed Jan 4 19:37:27 CET 2023


Joel Verhagen <joel.verhagen at gmail.com> wrote on 2022-12-30 at 13:10:40:

> I'm the maintainer of TorSharp, a library for helping Tor and Privoxy
> interact easily, surfaced as a .NET API (
> https://github.com/joelverhagen/TorSharp). My library works on many Linux
> distros and Windows.

Interesting. Thanks for making Privoxy available to more users.

> On Windows, I have not found a way to run Privoxy in a "headless" or no GUI
> mode. No matter how I configure or start the process, the Windows UI
> appears. I'd like to run it in the background on demand, without running it
> as a Windows Service. Ideally, I'd like to disable the taskbar icon as well
> since on non-graceful process termination the taskbar icons sometimes
> remain (which is kind of ugly but probably a Windows thing, not a Privoxy
> thing).
> 
> Is running Privoxy without the GUI possible on Windows?
> 
> I found this in the config documentation:
> 
> The "hide-console" option is specific to the MS-Win console version of
> Privoxy. If this option is used, Privoxy will disconnect from and hide the
> command console.
> 
> 
> I tried enabling this but it didn't seem to do what I expected. Perhaps I
> am misunderstanding what the "MS-Win console version" is. Is there an
> official binary distribution of the MS-Win console version? I was unable to
> find it.

There's a comment in the code in win32.c that says:

    76	/**
    77	 * Hide the console.  If set, the program will disconnect from the
    78	 * console and run in the background.  This allows the command-prompt
    79	 * window to close.
    80	 */
    81	int hideConsole     = 0;

My interpretation of it is that the option is not supposed to affect
whether or not the GUI is opened and merely allows to close the
console/terminal window after starting Privoxy through it.

> I noticed the undocumented "--service" command line argument is passed to
> Privoxy when it runs as a service, but using this manually does not have
> the desired effect.

The code in jcc.c suggests that the option only works when Privoxy
was started by the "service control manager":

  5984     if (bRunAsService)
  5985     {
  5986        /* Yup, so now we must attempt to establish a connection
  5987         * with the service dispatcher. This will only work if this
  5988         * process was launched by the service control manager to
  5989         * actually run as a service. If this isn't the case, i've
  5990         * known it take around 30 seconds or so for the call to return.
  5991         */
  5992  
  5993        /* The StartServiceCtrlDispatcher won't return until the service is stopping */
  5994        if (w32_start_service_ctrl_dispatcher(w32ServiceDispatchTable))
  5995        {
  5996           /* Service has run, and at this point is now being stopped, so just return */
  5997           return 0;
  5998        }
  5999  
  6000  #ifdef _WIN_CONSOLE
  6001        printf("Warning: Failed to connect to Service Control Dispatcher\nwhen starting as a service!\n");
  6002  #endif
  6003        /* An error occurred. Usually it's because --service was wrongly specified
  6004         * and we were unable to connect to the Service Control Dispatcher because
  6005         * it wasn't expecting us and is therefore not listening.
  6006         *
  6007         * For now, just continue below to call the listen_loop function.
  6008         */
  6009     }
  6010  #endif /* def _WIN32 */
  6011  
  6012     listen_loop();

> From the source code I see a "_WIN_CONSOLE" #ifdef here and there, which
> suggests to me that if I could figure out how to build Privoxy on Windows
> with this defined, I might be in luck, but I wanted to check with this
> mailing list first.

You can not build the Windows GUI code by running configure without
the --enable-mingw32 flag. The resulting binary relies more heavily
on the Cygwin stuff and if I remember correctly needs different dlls
to work.

I think we currently don't release such binaries mainly due to lack
of demand and time.

I suspect that it wouldn't be too hard to add an option to the
mingw32 build that allows to hide the GUI but someone would
have to do the actual work and we are currently short on Windows
developers and Windows development systems.

> Apologies if I am missing something obvious. I am using version 3.0.33 of
> Privoxy.

I've CC'd Lee who is more familiar with building and running Privoxy
on Windows than me and may have additional ideas.

While I still have a WindowsXP-VM-Image lying around, last time I tried
it using Qemu on ElectroBSD it it didn't detect the network card anymore
which made using it really inconvenient.

If I remember correctly, I also have a disk image from a Windows 7
installation but it refuses to boot in a VM and the laptop it came
from and may still work is needed for ElectroBSD.

Fabian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.privoxy.org/pipermail/privoxy-users/attachments/20230104/84190ff9/attachment.bin>


More information about the Privoxy-users mailing list