nt_eventlog.c revision 08cb74ca432a8c24e39f17dedce527e6a47b8001
/* Copyright 2002-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define CORE_PRIVATE
#include "httpd.h"
#include "http_log.h"
#include "mpm_winnt.h"
#include "apr_strings.h"
#include "apr_lib.h"
#include "ap_regkey.h"
static char *display_name = NULL;
static HANDLE stderr_ready;
{
char errbuf[256];
const char *errarg[9];
apr_pool_t *p;
errarg[0] = "The Apache service named";
/* What are we going to do in here, bail on the user? not. */
"SYSTEM\\CurrentControlSet\\Services\\"
"EventLog\\Application\\Apache Service",
== APR_SUCCESS)
{
/* The stock message file */
"%SystemRoot%\\System32\\netmsg.dll",
AP_REGKEY_EXPAND, p);
}
{
{
++errmsg;
{
--errmsg;
}
*errmsg = '\0';
/* Generic message: '%1 %2 %3 %4 %5 %6 %7 %8 %9'
* The event code in netmsg.dll is 3299
*/
}
}
}
"Win32 error %d reading stderr pipe stream\r\n",
GetLastError());
}
apr_pool_destroy(p);
return 0;
}
void mpm_nt_eventlog_stderr_flush(void)
{
if (cleanup_thread) {
}
}
{
int fd;
/* Create a pipe to send stderr messages to the system error log.
*
* _dup2() duplicates the write handle inheritable for us.
*/
/* Flush stderr and unset its buffer, then commit and replace stderr.
* handles [but valid FILE *'s, oddly enough], but is required
* for NT 4.0 and to use this code outside of services.
*/
/* hPipeWrite was _close()'ed above, and _dup2()'ed
* to fd 2 creating a new, inherited Win32 handle.
* Recover that real handle from fd 2.
*/
/* The code above _will_ corrupt the StdHandle...
* and we must do so anyways. We set this up only
* after we initialized the posix stderr API.
*/
}