You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@locus.apache.org on 2000/11/11 04:23:12 UTC
cvs commit: apache-2.0/src/lib/apr/dso/win32 dso.c
wrowe 00/11/10 19:23:11
Modified: src/lib/apr/file_io/win32 dir.c
src/lib/apr/dso/win32 dso.c
Log:
More files affected by APR_HAS_UNICODE_FS on Win32.
Revision Changes Path
1.38 +38 -4 apache-2.0/src/lib/apr/file_io/win32/dir.c
Index: dir.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/dir.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- dir.c 2000/11/11 02:20:29 1.37
+++ dir.c 2000/11/11 03:23:11 1.38
@@ -243,17 +243,43 @@
apr_status_t apr_make_dir(const char *path, apr_fileperms_t perm, apr_pool_t *cont)
{
- if (!CreateDirectory(path, NULL)) {
- return apr_get_os_error();
+#if APR_HAS_UNICODE_FS
+ apr_oslevel_e os_level;
+ if (!apr_get_oslevel(cont, &os_level) && os_level >= APR_WIN_NT)
+ {
+ apr_wchar_t *wpath = utf8_to_unicode_path(path, cont);
+ if (!wpath)
+ return APR_ENAMETOOLONG;
+ if (!CreateDirectoryW(wpath, NULL)) {
+ return apr_get_os_error();
+ }
}
+ else
+#endif
+ if (!CreateDirectory(path, NULL)) {
+ return apr_get_os_error();
+ }
return APR_SUCCESS;
}
apr_status_t apr_remove_dir(const char *path, apr_pool_t *cont)
{
- if (!RemoveDirectory(path)) {
- return apr_get_os_error();
+#if APR_HAS_UNICODE_FS
+ apr_oslevel_e os_level;
+ if (!apr_get_oslevel(cont, &os_level) && os_level >= APR_WIN_NT)
+ {
+ apr_wchar_t *wpath = utf8_to_unicode_path(path, cont);
+ if (!wpath)
+ return APR_ENAMETOOLONG;
+ if (!RemoveDirectoryW(wpath)) {
+ return apr_get_os_error();
+ }
}
+ else
+#endif
+ if (!RemoveDirectory(path)) {
+ return apr_get_os_error();
+ }
return APR_SUCCESS;
}
@@ -320,6 +346,13 @@
return APR_SUCCESS;
}
+/* XXX: This is sort of blinkin stupid on win32... consider,
+ * our open doesn't open the dir, it sets up the apr_dir_t,
+ * and on the first apr_readdir it actually does a FindFirstFile
+ * if the handle is closed, or else a FindNextFile that is based
+ * on cached info that we simply don't have our hands on when
+ * we use this function. Maybe APR_ENOTIMPL would be better?
+ */
apr_status_t apr_put_os_dir(apr_dir_t **dir, apr_os_dir_t *thedir, apr_pool_t *cont)
{
if (cont == NULL) {
@@ -329,6 +362,7 @@
(*dir) = (apr_dir_t *)apr_pcalloc(cont, sizeof(apr_dir_t));
(*dir)->cntxt = cont;
}
+ (*dir)->dirhand = thedir;
(*dir)->dirhand = thedir;
return APR_SUCCESS;
}
1.14 +37 -16 apache-2.0/src/lib/apr/dso/win32/dso.c
Index: dso.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/dso/win32/dso.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- dso.c 2000/10/08 06:00:27 1.13
+++ dso.c 2000/11/11 03:23:11 1.14
@@ -54,6 +54,8 @@
#include "dso.h"
#include "apr_strings.h"
+#include "apr_private.h"
+#include "fileio.h"
#if APR_HAS_DSO
@@ -61,25 +63,44 @@
apr_pool_t *ctx)
{
HINSTANCE os_handle;
- char fspec[MAX_PATH], *p = fspec;
UINT em;
- /* Must convert path from / to \ notation.
- * Per PR2555, the LoadLibraryEx function is very picky about slashes.
- * Debugging on NT 4 SP 6a reveals First Chance Exception within NTDLL.
- * LoadLibrary in the MS PSDK also reveals that it -explicitly- states
- * that backslashes must be used for the LoadLibrary family of calls.
- */
- apr_cpystrn(fspec, path, MAX_PATH);
- while (p = strchr(p, '/'))
- *p = '\\';
+#if APR_HAS_UNICODE_FS
+ apr_oslevel_e os_level;
+ if (!apr_get_oslevel(ctx, &os_level) && os_level >= APR_WIN_NT)
+ {
+ apr_wchar_t *wpath = utf8_to_unicode_path(path, ctx);
+ if (!wpath)
+ return APR_ENAMETOOLONG;
+
+ /* Prevent ugly popups from killing our app */
+ em = SetErrorMode(SEM_FAILCRITICALERRORS);
+ os_handle = LoadLibraryExW(wpath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
+ if (!os_handle)
+ os_handle = LoadLibraryExW(wpath, NULL, 0);
+ SetErrorMode(em);
+ }
+ else
+#endif
+ {
+ char fspec[MAX_PATH], *p = fspec;
+ /* Must convert path from / to \ notation.
+ * Per PR2555, the LoadLibraryEx function is very picky about slashes.
+ * Debugging on NT 4 SP 6a reveals First Chance Exception within NTDLL.
+ * LoadLibrary in the MS PSDK also reveals that it -explicitly- states
+ * that backslashes must be used for the LoadLibrary family of calls.
+ */
+ apr_cpystrn(fspec, path, MAX_PATH);
+ while (p = strchr(p, '/'))
+ *p = '\\';
- /* Prevent ugly popups from killing our app */
- em = SetErrorMode(SEM_FAILCRITICALERRORS);
- os_handle = LoadLibraryEx(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
- if (!os_handle)
- os_handle = LoadLibraryEx(path, NULL, 0);
- SetErrorMode(em);
+ /* Prevent ugly popups from killing our app */
+ em = SetErrorMode(SEM_FAILCRITICALERRORS);
+ os_handle = LoadLibraryEx(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
+ if (!os_handle)
+ os_handle = LoadLibraryEx(path, NULL, 0);
+ SetErrorMode(em);
+ }
*res_handle = apr_pcalloc(ctx, sizeof(*res_handle));
if(os_handle == NULL) {