if (w32err) { char buf[256];  FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, NULL, w32err, MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), buf, sizeof (buf)-1, NULL); fputs (": ", logfp); fputs (buf, logfp); } if (*fmt && fmt[strlen (fmt) - 1] != '\n') putc ('\n', logfp);
do_log (const char *fmt, va_list a){  if (enable_logging == false || !logfile)    return;  if (!logfp)    {      lock_log ();      if (!logfp)        logfp = fopen (logfile, "a+");      unlock_log ();    }  if (!logfp)    return;  fprintf (logfp, "%lu/", (unsigned long)GetCurrentThreadId ());  vfprintf (logfp, fmt, a);  fflush (logfp);}