summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorblythe%netscape.com <devnull@localhost>2002-02-08 22:11:57 +0000
committerblythe%netscape.com <devnull@localhost>2002-02-08 22:11:57 +0000
commit8567274a90d686a5d32333e5309c65c5c269cf56 (patch)
treedbdd47381d1280a674c9133cf3a06bbc93a61e5c
parent44ae2c56c48c0b365f172b66d55f2186c26e8dc0 (diff)
downloadnspr-hg-8567274a90d686a5d32333e5309c65c5c269cf56.tar.gz
CreateFileA handled
-rw-r--r--pr/include/md/_win32_unicode.h22
-rw-r--r--pr/src/md/windows/w32unicode.c38
-rw-r--r--pr/src/md/windows/w95io.c6
3 files changed, 63 insertions, 3 deletions
diff --git a/pr/include/md/_win32_unicode.h b/pr/include/md/_win32_unicode.h
index b302e2c4..564a7ff2 100644
--- a/pr/include/md/_win32_unicode.h
+++ b/pr/include/md/_win32_unicode.h
@@ -59,4 +59,26 @@ LPWSTR _PR_MD_MALLOC_A2W(LPCSTR inString);
*/
LPWSTR _PR_MD_A2W(LPCSTR inString, LPWSTR outWideString, int inWideStringChars);
+#if defined(WINCE)
+/*
+ * WinCE Only
+ *
+ * Some of the functions we intend to proxy to get around multi-byte API
+ * assumptions are imported from DLLs. I would rather not fake out
+ * the linkage by prepending _imp_ ## functioname to make things happen.
+ * We need to provide our own linkage symbol for all this to work out.
+ */
+HANDLE
+WINAPI
+_MD_CreateFileA(
+ LPCSTR lpFileName,
+ DWORD dwDesiredAccess,
+ DWORD dwShareMode,
+ LPSECURITY_ATTRIBUTES lpSecurityAttributes,
+ DWORD dwCreationDisposition,
+ DWORD dwFlagsAndAttributes,
+ HANDLE hTemplateFile
+ );
+#endif /* WINCE */
+
#endif /* nspr_win32_unicode_h___ */
diff --git a/pr/src/md/windows/w32unicode.c b/pr/src/md/windows/w32unicode.c
index 31b9cad3..00db1770 100644
--- a/pr/src/md/windows/w32unicode.c
+++ b/pr/src/md/windows/w32unicode.c
@@ -237,4 +237,42 @@ CreateProcessA (
return retval;
}
+HANDLE
+WINAPI
+_MD_CreateFileA(
+ LPCSTR lpFileName,
+ DWORD dwDesiredAccess,
+ DWORD dwShareMode,
+ LPSECURITY_ATTRIBUTES lpSecurityAttributes,
+ DWORD dwCreationDisposition,
+ DWORD dwFlagsAndAttributes,
+ HANDLE hTemplateFile
+ )
+{
+ HANDLE retval = (HANDLE)INVALID_HANDLE_VALUE;
+ LPWSTR wideStr = NULL;
+ WCHAR widePath[MAX_PATH + 1];
+
+ wideStr = _PR_MD_A2W(lpFileName, widePath, sizeof(widePath) / sizeof(WCHAR));
+ if(NULL != wideStr)
+ {
+ retval = CreateFileW(
+ wideStr,
+ dwDesiredAccess,
+ dwShareMode,
+ lpSecurityAttributes,
+ dwCreationDisposition,
+ dwFlagsAndAttributes,
+ hTemplateFile
+ );
+ }
+ else
+ {
+ PR_SetError(PR_NAME_TOO_LONG_ERROR, 0);
+ }
+
+ return retval;
+}
+
+
#endif /* WINCE */ \ No newline at end of file
diff --git a/pr/src/md/windows/w95io.c b/pr/src/md/windows/w95io.c
index 772c44b8..fed44ba1 100644
--- a/pr/src/md/windows/w95io.c
+++ b/pr/src/md/windows/w95io.c
@@ -210,7 +210,7 @@ _PR_MD_OPEN(const char *name, PRIntn osflags, int mode)
#if !defined(WINCE)
CreateFile
#else
- CreateFileA
+ _MD_CreateFileA
#endif
(
name,
@@ -275,7 +275,7 @@ _PR_MD_OPEN_FILE(const char *name, PRIntn osflags, int mode)
#if !defined(WINCE)
CreateFile
#else
- CreateFileA
+ _MD_CreateFileA
#endif
(
name,
@@ -729,7 +729,7 @@ _PR_MD_STAT(const char *fn, struct stat *info)
#if !defined(WINCE)
CreateFile
#else
- CreateFileA
+ _MD_CreateFileA
#endif
(
fn,