#ifdef WIN32
+extern OSVERSIONINFO osver; /* hiding in mpm_winnt.c */
+static int win_nt;
+
/*
* CGI Script stuff for Win32...
*/
* will read characters 80-ff. For the moment, use the unicode
* values 0080-00ff. This isn't trivial, since the code page
* varies between msdos and Windows applications.
+ * For subsystem 2 [GUI] the default is the system Ansi CP.
+ * For subsystem 3 [CLI] the default is the system OEM CP.
*/
static void prep_string(const char ** str, apr_pool_t *p)
{
const char *ch = *str;
char *ch2;
int widen = 0;
+
if (!ch) {
return;
}
break;
}
ap_unescape_url(w);
- prep_string(&w, p);
+ if (win_nt) {
+ prep_string(&w, p);
+ }
arg = (const char**)apr_array_push(args);
*arg = ap_escape_shell_cmd(p, w);
}
break;
}
ap_unescape_url(w);
- prep_string(&w, p);
+ if (win_nt) {
+ prep_string(&w, p);
+ }
arg = (const char**)apr_array_push(args);
*arg = ap_escape_shell_cmd(p, w);
}
* application (following the OEM or Ansi code page in effect.)
*/
for (i = 0; i < r->subprocess_env->a.nelts; ++i) {
- if (elts[i].key && *elts[i].key
+ if (win_nt && elts[i].key && *elts[i].key
&& (strncmp(elts[i].key, "HTTP_", 5) == 0
|| strncmp(elts[i].key, "SERVER_", 7) == 0
|| strncmp(elts[i].key, "REQUEST_", 8) == 0
return APR_SUCCESS;
}
+static int win32_pre_config(apr_pool_t *pconf_, apr_pool_t *plog, apr_pool_t *ptemp)
+{
+ win_nt = (osver.dwPlatformId != VER_PLATFORM_WIN32_WINDOWS);
+ return OK;
+}
+
static void register_hooks(apr_pool_t *p)
{
APR_REGISTER_OPTIONAL_FN(ap_cgi_build_command);
+ ap_hook_pre_config(win32_pre_config, NULL, NULL, APR_HOOK_MIDDLE);
}
static const command_rec win32_cmds[] = {