diff options
-rw-r--r-- | dso/win32/dso.c | 6 | ||||
-rw-r--r-- | file_io/win32/dir.c | 37 | ||||
-rw-r--r-- | file_io/win32/filestat.c | 10 | ||||
-rw-r--r-- | file_io/win32/filesys.c | 24 | ||||
-rw-r--r-- | file_io/win32/open.c | 27 | ||||
-rw-r--r-- | include/arch/win32/fileio.h | 2 | ||||
-rw-r--r-- | include/arch/win32/misc.h | 42 | ||||
-rw-r--r-- | misc/win32/misc.c | 13 | ||||
-rw-r--r-- | shmem/win32/shm.c | 12 | ||||
-rw-r--r-- | threadproc/win32/proc.c | 14 | ||||
-rw-r--r-- | user/win32/userinfo.c | 9 |
11 files changed, 148 insertions, 48 deletions
diff --git a/dso/win32/dso.c b/dso/win32/dso.c index 974bf9775..56b31beaa 100644 --- a/dso/win32/dso.c +++ b/dso/win32/dso.c @@ -89,7 +89,7 @@ APR_DECLARE(apr_status_t) apr_dso_load(struct apr_dso_handle_t **res_handle, UINT em; #if APR_HAS_UNICODE_FS - if (apr_os_level >= APR_WIN_NT) + IF_WIN_OS_IS_UNICODE { apr_wchar_t wpath[APR_PATH_MAX]; if ((rv = utf8_to_unicode_path(wpath, sizeof(wpath) @@ -107,8 +107,9 @@ APR_DECLARE(apr_status_t) apr_dso_load(struct apr_dso_handle_t **res_handle, rv = apr_get_os_error(); SetErrorMode(em); } - else #endif +#if APR_HAS_ANSI_FS + ELSE_WIN_OS_IS_ANSI { char fspec[APR_PATH_MAX], *p = fspec; /* Must convert path from / to \ notation. @@ -132,6 +133,7 @@ APR_DECLARE(apr_status_t) apr_dso_load(struct apr_dso_handle_t **res_handle, rv = APR_SUCCESS; SetErrorMode(em); } +#endif *res_handle = apr_pcalloc(ctx, sizeof(**res_handle)); (*res_handle)->cont = ctx; diff --git a/file_io/win32/dir.c b/file_io/win32/dir.c index 0c6a21752..96484b574 100644 --- a/file_io/win32/dir.c +++ b/file_io/win32/dir.c @@ -100,15 +100,16 @@ APR_DECLARE(apr_status_t) apr_dir_open(apr_dir_t **new, const char *dirname, (*new)->dirname[len] = '\0'; #if APR_HAS_UNICODE_FS - if (apr_os_level >= APR_WIN_NT) + IF_WIN_OS_IS_UNICODE { /* Create a buffer for the longest file name we will ever see */ (*new)->w.entry = apr_pcalloc(cont, sizeof(WIN32_FIND_DATAW)); (*new)->name = apr_pcalloc(cont, APR_FILE_MAX * 3 + 1); } - else #endif +#if APR_HAS_ANSI_FS + ELSE_WIN_OS_IS_ANSI { /* Note that we won't open a directory that is greater than MAX_PATH, * including the trailing /* wildcard suffix. If a * won't fit, then @@ -122,6 +123,7 @@ APR_DECLARE(apr_status_t) apr_dir_open(apr_dir_t **new, const char *dirname, } (*new)->n.entry = apr_pcalloc(cont, sizeof(WIN32_FIND_DATAW)); } +#endif (*new)->rootlen = len - 1; (*new)->cntxt = cont; (*new)->dirhand = INVALID_HANDLE_VALUE; @@ -147,7 +149,7 @@ APR_DECLARE(apr_status_t) apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted, #if APR_HAS_UNICODE_FS apr_wchar_t wdirname[APR_PATH_MAX]; apr_wchar_t *eos = NULL; - if (apr_os_level >= APR_WIN_NT) + IF_WIN_OS_IS_UNICODE { if (thedir->dirhand == INVALID_HANDLE_VALUE) { @@ -181,8 +183,9 @@ APR_DECLARE(apr_status_t) apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted, return rv; fname = thedir->name; } - else #endif +#if APR_HAS_ANSI_FS + ELSE_WIN_OS_IS_ANSI { char *eop = strchr(thedir->dirname, '\0'); if (thedir->dirhand == INVALID_HANDLE_VALUE) { @@ -208,6 +211,7 @@ APR_DECLARE(apr_status_t) apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted, } fname = thedir->n.entry->cFileName; } +#endif fillin_fileinfo(finfo, (WIN32_FILE_ATTRIBUTE_DATA *) thedir->w.entry, 0, wanted); @@ -220,7 +224,8 @@ APR_DECLARE(apr_status_t) apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted, /* Go back and get more_info if we can't answer the whole inquiry */ #if APR_HAS_UNICODE_FS - if (apr_os_level >= APR_WIN_NT) { + IF_WIN_OS_IS_UNICODE + { /* Almost all our work is done. Tack on the wide file name * to the end of the wdirname (already / delimited) */ @@ -231,13 +236,16 @@ APR_DECLARE(apr_status_t) apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted, eos[0] = '\0'; return rv; } - else { +#endif +#if APR_HAS_ANSI_FS + ELSE_WIN_OS_IS_ANSI + { +#if APR_HAS_UNICODE_FS /* Don't waste stack space on a second buffer, the one we set * aside for the wide directory name is twice what we need. */ char *fspec = (char*)wdirname; -#else /* !APR_HAS_UNICODE_FS */ - { +#else char fspec[APR_PATH_MAX]; #endif int dirlen = strlen(thedir->dirname); @@ -247,6 +255,7 @@ APR_DECLARE(apr_status_t) apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted, apr_cpystrn(fspec + dirlen, fname, sizeof(fspec) - dirlen); return more_finfo(finfo, fspec, wanted, MORE_OF_FSPEC); } +#endif } return APR_SUCCESS; @@ -264,7 +273,7 @@ APR_DECLARE(apr_status_t) apr_dir_make(const char *path, apr_fileperms_t perm, apr_pool_t *cont) { #if APR_HAS_UNICODE_FS - if (apr_os_level >= APR_WIN_NT) + IF_WIN_OS_IS_UNICODE { apr_wchar_t wpath[APR_PATH_MAX]; apr_status_t rv; @@ -276,18 +285,20 @@ APR_DECLARE(apr_status_t) apr_dir_make(const char *path, apr_fileperms_t perm, return apr_get_os_error(); } } - else #endif +#if APR_HAS_ANSI_FS + ELSE_WIN_OS_IS_ANSI if (!CreateDirectory(path, NULL)) { return apr_get_os_error(); } +#endif return APR_SUCCESS; } APR_DECLARE(apr_status_t) apr_dir_remove(const char *path, apr_pool_t *cont) { #if APR_HAS_UNICODE_FS - if (apr_os_level >= APR_WIN_NT) + IF_WIN_OS_IS_UNICODE { apr_wchar_t wpath[APR_PATH_MAX]; apr_status_t rv; @@ -299,11 +310,13 @@ APR_DECLARE(apr_status_t) apr_dir_remove(const char *path, apr_pool_t *cont) return apr_get_os_error(); } } - else #endif +#if APR_HAS_ANSI_FS + ELSE_WIN_OS_IS_ANSI if (!RemoveDirectory(path)) { return apr_get_os_error(); } +#endif return APR_SUCCESS; } diff --git a/file_io/win32/filestat.c b/file_io/win32/filestat.c index 8952f79d0..0f2fe43e4 100644 --- a/file_io/win32/filestat.c +++ b/file_io/win32/filestat.c @@ -476,7 +476,8 @@ APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname, } #if APR_HAS_UNICODE_FS - if (apr_os_level >= APR_WIN_NT) { + IF_WIN_OS_IS_UNICODE + { if (rv = utf8_to_unicode_path(wfname, sizeof(wfname) / sizeof(apr_wchar_t), fname)) return rv; @@ -505,8 +506,9 @@ APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname, filename = apr_pstrdup(cont, tmpname); } } - else #endif +#if APR_HAS_ANSI_FS + ELSE_WIN_OS_IS_ANSI if ((apr_os_level >= APR_WIN_98) && (!(wanted & APR_FINFO_NAME) || isroot)) { /* cannot use FindFile on a Win98 root, it returns \* @@ -550,6 +552,7 @@ APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname, FindClose(hFind); filename = apr_pstrdup(cont, FileInfo.n.cFileName); } +#endif if (ident_rv != APR_INCOMPLETE) { if (fillin_fileinfo(finfo, (WIN32_FILE_ATTRIBUTE_DATA *) &FileInfo, @@ -559,7 +562,8 @@ APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname, * to reliably translate char devices to the path '\\.\device' * so go ask for the full path. */ - if (apr_os_level >= APR_WIN_NT) { + IF_WIN_OS_IS_UNICODE + { #if APR_HAS_UNICODE_FS apr_wchar_t tmpname[APR_FILE_MAX]; apr_wchar_t *tmpoff; diff --git a/file_io/win32/filesys.c b/file_io/win32/filesys.c index 09e1f9a72..9158472c7 100644 --- a/file_io/win32/filesys.c +++ b/file_io/win32/filesys.c @@ -120,7 +120,7 @@ apr_status_t filepath_drive_get(char **rootpath, char drive, { char path[APR_PATH_MAX]; #if APR_HAS_UNICODE_FS - if (apr_os_level >= APR_WIN_NT) + IF_WIN_OS_IS_UNICODE { apr_wchar_t *ignored; apr_wchar_t wdrive[8]; @@ -136,8 +136,9 @@ apr_status_t filepath_drive_get(char **rootpath, char drive, if ((rv = unicode_to_utf8_path(path, sizeof(path), wpath))) return rv; } - else #endif +#if APR_HAS_ANSI_FS + ELSE_WIN_OS_IS_ANSI { char *ignored; char drivestr[4]; @@ -148,6 +149,7 @@ apr_status_t filepath_drive_get(char **rootpath, char drive, if (!GetFullPathName(drivestr, sizeof(path), path, &ignored)) return apr_get_os_error(); } +#endif if (!(flags & APR_FILEPATH_NATIVE)) { for (*rootpath = path; **rootpath; ++*rootpath) { if (**rootpath == '\\') @@ -162,7 +164,7 @@ apr_status_t filepath_drive_get(char **rootpath, char drive, apr_status_t filepath_root_case(char **rootpath, char *root, apr_pool_t *p) { #if APR_HAS_UNICODE_FS - if (apr_os_level >= APR_WIN_NT) + IF_WIN_OS_IS_UNICODE { apr_wchar_t *ignored; apr_wchar_t wpath[APR_PATH_MAX]; @@ -183,8 +185,9 @@ apr_status_t filepath_root_case(char **rootpath, char *root, apr_pool_t *p) return rv; *rootpath = apr_pstrdup(p, (char*)wroot); } - else #endif +#if APR_HAS_ANSI_FS + ELSE_WIN_OS_IS_ANSI { char path[APR_PATH_MAX]; char *ignored; @@ -192,6 +195,7 @@ apr_status_t filepath_root_case(char **rootpath, char *root, apr_pool_t *p) return apr_get_os_error(); *rootpath = apr_pstrdup(p, path); } +#endif return APR_SUCCESS; } @@ -201,7 +205,7 @@ APR_DECLARE(apr_status_t) apr_filepath_get(char **rootpath, apr_int32_t flags, { char path[APR_PATH_MAX]; #if APR_HAS_UNICODE_FS - if (apr_os_level >= APR_WIN_NT) + IF_WIN_OS_IS_UNICODE { apr_wchar_t wpath[APR_PATH_MAX]; apr_status_t rv; @@ -210,12 +214,14 @@ APR_DECLARE(apr_status_t) apr_filepath_get(char **rootpath, apr_int32_t flags, if ((rv = unicode_to_utf8_path(path, sizeof(path), wpath))) return rv; } - else #endif +#if APR_HAS_ANSI_FS + ELSE_WIN_OS_IS_ANSI { if (!GetCurrentDirectory(sizeof(path), path)) return apr_get_os_error(); } +#endif if (!(flags & APR_FILEPATH_NATIVE)) { for (*rootpath = path; **rootpath; ++*rootpath) { if (**rootpath == '\\') @@ -231,7 +237,7 @@ APR_DECLARE(apr_status_t) apr_filepath_set(const char *rootpath, apr_pool_t *p) { #if APR_HAS_UNICODE_FS - if (apr_os_level >= APR_WIN_NT) + IF_WIN_OS_IS_UNICODE { apr_wchar_t wpath[APR_PATH_MAX]; apr_status_t rv; @@ -241,11 +247,13 @@ APR_DECLARE(apr_status_t) apr_filepath_set(const char *rootpath, if (!SetCurrentDirectoryW(wpath)) return apr_get_os_error(); } - else #endif +#if APR_HAS_ANSI_FS + ELSE_WIN_OS_IS_ANSI { if (!SetCurrentDirectory(rootpath)) return apr_get_os_error(); } +#endif return APR_SUCCESS; } diff --git a/file_io/win32/open.c b/file_io/win32/open.c index cbc57950a..af821c17c 100644 --- a/file_io/win32/open.c +++ b/file_io/win32/open.c @@ -168,7 +168,8 @@ apr_status_t unicode_to_utf8_path(char* retstr, apr_size_t retlen, void *res_name_from_filename(const char *file, int global, apr_pool_t *pool) { #if APR_HAS_UNICODE_FS - if (apr_os_level >= APR_WIN_NT) { + IF_WIN_OS_IS_UNICODE + { apr_wchar_t *wpre, *wfile, *ch; apr_size_t n = strlen(file) + 1; apr_size_t r, d; @@ -205,8 +206,9 @@ void *res_name_from_filename(const char *file, int global, apr_pool_t *pool) } return wfile; } - else #endif +#if APR_HAS_ANSI_FS + ELSE_WIN_OS_IS_ANSI { char *nfile, *ch; apr_size_t n = strlen(file) + 1; @@ -247,6 +249,7 @@ void *res_name_from_filename(const char *file, int global, apr_pool_t *pool) } return nfile; } +#endif } @@ -333,7 +336,8 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, const char *fname, } #if APR_HAS_UNICODE_FS - if (apr_os_level >= APR_WIN_NT) { + IF_WIN_OS_IS_UNICODE + { apr_wchar_t wfname[APR_PATH_MAX]; if (rv = utf8_to_unicode_path(wfname, sizeof(wfname) / sizeof(apr_wchar_t), fname)) @@ -341,11 +345,12 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, const char *fname, handle = CreateFileW(wfname, oflags, sharemode, NULL, createflags, attributes, 0); } - else #endif +#if APR_HAS_ANSI_FS + ELSE_WIN_OS_IS_ANSI handle = CreateFileA(fname, oflags, sharemode, NULL, createflags, attributes, 0); - +#endif if (handle == INVALID_HANDLE_VALUE) { return apr_get_os_error(); } @@ -424,7 +429,7 @@ APR_DECLARE(apr_status_t) apr_file_close(apr_file_t *file) APR_DECLARE(apr_status_t) apr_file_remove(const char *path, apr_pool_t *cont) { #if APR_HAS_UNICODE_FS - if (apr_os_level >= APR_WIN_NT) + IF_WIN_OS_IS_UNICODE { apr_wchar_t wpath[APR_PATH_MAX]; apr_status_t rv; @@ -435,10 +440,12 @@ APR_DECLARE(apr_status_t) apr_file_remove(const char *path, apr_pool_t *cont) if (DeleteFileW(wpath)) return APR_SUCCESS; } - else #endif +#if APR_HAS_ANSI_FS + ELSE_WIN_OS_IS_ANSI if (DeleteFile(path)) return APR_SUCCESS; +#endif return apr_get_os_error(); } @@ -446,7 +453,7 @@ APR_DECLARE(apr_status_t) apr_file_rename(const char *frompath, const char *topath, apr_pool_t *cont) { - if (apr_os_level >= APR_WIN_NT) + IF_WIN_OS_IS_UNICODE { #if APR_HAS_UNICODE_FS apr_wchar_t wfrompath[APR_PATH_MAX], wtopath[APR_PATH_MAX]; @@ -468,7 +475,8 @@ APR_DECLARE(apr_status_t) apr_file_rename(const char *frompath, return APR_SUCCESS; #endif } - else +#if APR_HAS_ANSI_FS + ELSE_WIN_OS_IS_ANSI { /* Windows 95 and 98 do not support MoveFileEx, so we'll use * the old MoveFile function. However, MoveFile requires that @@ -488,6 +496,7 @@ APR_DECLARE(apr_status_t) apr_file_rename(const char *frompath, if (MoveFile(frompath, topath)) return APR_SUCCESS; } +#endif return apr_get_os_error(); } diff --git a/include/arch/win32/fileio.h b/include/arch/win32/fileio.h index 77d497937..01f761e3c 100644 --- a/include/arch/win32/fileio.h +++ b/include/arch/win32/fileio.h @@ -225,9 +225,11 @@ struct apr_dir_t { WIN32_FIND_DATAW *entry; } w; #endif +#if APR_HAS_ANSI_FS struct { WIN32_FIND_DATAA *entry; } n; +#endif }; }; diff --git a/include/arch/win32/misc.h b/include/arch/win32/misc.h index 454deb5cf..5f5f6762e 100644 --- a/include/arch/win32/misc.h +++ b/include/arch/win32/misc.h @@ -112,15 +112,22 @@ typedef enum { APR_WIN_98 = 14, APR_WIN_98_SE = 16, APR_WIN_ME = 18, - APR_WIN_NT = 30, - APR_WIN_NT_3_5 = 35, + + APR_WIN_UNICODE = 20, /* Prior versions support only narrow chars */ + + APR_WIN_CE_3 = 23, /* CE is an odd beast, not supporting */ + /* some pre-NT features, such as the */ + APR_WIN_NT = 30, /* narrow charset APIs (fooA fns), while */ + APR_WIN_NT_3_5 = 35, /* not supporting some NT-family features. */ APR_WIN_NT_3_51 = 36, + APR_WIN_NT_4 = 40, APR_WIN_NT_4_SP2 = 42, APR_WIN_NT_4_SP3 = 43, APR_WIN_NT_4_SP4 = 44, APR_WIN_NT_4_SP5 = 45, APR_WIN_NT_4_SP6 = 46, + APR_WIN_2000 = 50, APR_WIN_2000_SP1 = 51, APR_WIN_2000_SP2 = 52, @@ -129,6 +136,36 @@ typedef enum { extern apr_oslevel_e apr_os_level; +apr_status_t apr_get_oslevel(struct apr_pool_t *, apr_oslevel_e *); + +/* The APR_HAS_ANSI_FS symbol is PRIVATE, and internal to APR. + * APR only supports char data for filenames. Like most applications, + * characters >127 are essentially undefined. APR_HAS_UNICODE_FS lets + * the application know that utf-8 is the encoding method of APR, and + * only incidently hints that we have Wide OS calls. + * + * APR_HAS_ANSI_FS is simply an OS flag to tell us all calls must be + * the unicode eqivilant. + */ + +#if defined(_WIN32_WCE) || defined(WINNT) +#define APR_HAS_ANSI_FS 0 +#else +#define APR_HAS_ANSI_FS 1 +#endif + +/* IF_WIN_OS_IS_UNICODE / ELSE_WIN_OS_IS_ANSI help us keep the code trivial + * where have runtime tests for unicode-ness, that aren't needed in any + * build which supports only WINNT or WCE. + */ +#if APR_HAS_ANSI_FS && APR_HAS_UNICODE_FS +#define IF_WIN_OS_IS_UNICODE if (apr_os_level >= APR_WIN_UNICODE) +#define ELSE_WIN_OS_IS_ANSI else +#else APR_HAS_UNICODE_FS +#define IF_WIN_OS_IS_UNICODE +#define ELSE_WIN_OS_IS_ANSI +#endif /* WINNT */ + typedef enum { DLL_WINBASEAPI = 0, // kernel32 From WinBase.h DLL_WINADVAPI = 1, // advapi32 From WinBase.h @@ -254,7 +291,6 @@ APR_DECLARE_LATE_DLL_FUNC(DLL_WINADVAPI, BOOL, WINAPI, GetSecurityInfo, 0, ( ppDacl, ppSacl, ppSecurityDescriptor)); #define GetSecurityInfo apr_winapi_GetSecurityInfo -apr_status_t apr_get_oslevel(struct apr_pool_t *, apr_oslevel_e *); #endif /* WIN32 */ #endif /* ! MISC_H */ diff --git a/misc/win32/misc.c b/misc/win32/misc.c index 102db5db8..fdcfd4505 100644 --- a/misc/win32/misc.c +++ b/misc/win32/misc.c @@ -122,6 +122,7 @@ apr_status_t apr_get_oslevel(apr_pool_t *cont, apr_oslevel_e *level) apr_os_level = APR_WIN_XP; } } +#ifndef WINNT else if (oslev.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { char *prevision; if (prevision = oslev.szCSDVersion) { @@ -147,6 +148,18 @@ apr_status_t apr_get_oslevel(apr_pool_t *cont, apr_oslevel_e *level) apr_os_level = APR_WIN_ME; } } +#endif +#ifdef _WIN32_WCE + else if (oslev.dwPlatformId == VER_PLATFORM_WIN32_CE) + { + if (oslev.dwMajorVersion < 3) { + apr_os_level = APR_WIN_UNSUP; + } + else { + apr_os_level = APR_WIN_CE_3; + } + } +#endif else { apr_os_level = APR_WIN_UNSUP; } diff --git a/shmem/win32/shm.c b/shmem/win32/shm.c index 3d619f6d8..41919ab4f 100644 --- a/shmem/win32/shm.c +++ b/shmem/win32/shm.c @@ -144,15 +144,17 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, } #if APR_HAS_UNICODE_FS - if (apr_os_level >= APR_WIN_NT) + IF_WIN_OS_IS_UNICODE { hMap = CreateFileMappingW(hFile, psec, PAGE_READWRITE, 0, size, mapkey); } - else #endif +#if APR_HAS_ANSI_FS + ELSE_WIN_OS_IS_ANSI { hMap = CreateFileMappingA(hFile, psec, PAGE_READWRITE, 0, size, mapkey); } +#endif err = apr_get_os_error(); if (file) { @@ -214,15 +216,17 @@ APR_DECLARE(apr_status_t) apr_shm_attach(apr_shm_t **m, } #if APR_HAS_UNICODE_FS - if (apr_os_level >= APR_WIN_NT) + IF_WIN_OS_IS_UNICODE { hMap = OpenFileMappingW(FILE_MAP_READ | FILE_MAP_WRITE, FALSE, mapkey); } - else #endif +#if APR_HAS_ANSI_FS + ELSE_WIN_OS_IS_ANSI { hMap = OpenFileMappingA(FILE_MAP_READ | FILE_MAP_WRITE, FALSE, mapkey); } +#endif if (!hMap) { return apr_get_os_error(); diff --git a/threadproc/win32/proc.c b/threadproc/win32/proc.c index bd831759b..10ea0f850 100644 --- a/threadproc/win32/proc.c +++ b/threadproc/win32/proc.c @@ -386,7 +386,8 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, ++iEnvBlockLen; #if APR_HAS_UNICODE_FS - if (apr_os_level >= APR_WIN_NT) { + IF_WIN_OS_IS_UNICODE + { apr_wchar_t *pNext; pEnvBlock = (char *)apr_palloc(cont, iEnvBlockLen * 2); dwCreationFlags |= CREATE_UNICODE_ENVIRONMENT; @@ -407,8 +408,9 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, *(pNext++) = L'\0'; *pNext = L'\0'; } - else #endif /* APR_HAS_UNICODE_FS */ +#if APR_HAS_ANSI_FS + ELSE_WIN_OS_IS_ANSI { char *pNext; pEnvBlock = (char *)apr_palloc(cont, iEnvBlockLen); @@ -424,10 +426,11 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, *(pNext++) = '\0'; *pNext = '\0'; } +#endif /* APR_HAS_ANSI_FS */ } #if APR_HAS_UNICODE_FS - if (apr_os_level >= APR_WIN_NT) + IF_WIN_OS_IS_UNICODE { STARTUPINFOW si; apr_size_t nprg = strlen(progname) + 1; @@ -482,8 +485,10 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, wcwd, /* Current directory name */ &si, &pi); } - else { #endif /* APR_HAS_UNICODE_FS */ +#if APR_HAS_ANSI_FS + ELSE_WIN_OS_IS_ANSI + { STARTUPINFOA si; memset(&si, 0, sizeof(si)); si.cb = sizeof(si); @@ -512,6 +517,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, attr->currdir, /* Current directory name */ &si, &pi); } +#endif /* APR_HAS_ANSI_FS */ /* Check CreateProcess result */ diff --git a/user/win32/userinfo.c b/user/win32/userinfo.c index 10ced7d09..54ba7e9cb 100644 --- a/user/win32/userinfo.c +++ b/user/win32/userinfo.c @@ -135,7 +135,8 @@ APR_DECLARE(apr_status_t) apr_get_home_directory(char **dirname, const char *use return APR_FROM_OS_ERROR(rv); #if APR_HAS_UNICODE_FS - if (apr_os_level >= APR_WIN_NT) { + IF_WIN_OS_IS_UNICODE + { keylen = sizeof(regkey); rv = RegQueryValueExW(key, L"ProfileImagePath", NULL, &type, @@ -162,8 +163,9 @@ APR_DECLARE(apr_status_t) apr_get_home_directory(char **dirname, const char *use else return APR_ENOENT; } - else -#endif /* APR_HAS_UNICODE_FS */ +#endif +#if APR_HAS_ANSI_FS + ELSE_WIN_OS_IS_ANSI { keylen = sizeof(regkey); rv = RegQueryValueEx(key, "ProfileImagePath", NULL, &type, @@ -182,6 +184,7 @@ APR_DECLARE(apr_status_t) apr_get_home_directory(char **dirname, const char *use else return APR_ENOENT; } +#endif /* APR_HAS_ANSI_FS */ for (fixch = *dirname; *fixch; ++fixch) if (*fixch == '\\') *fixch = '/'; |