[v2 PATCH] ucrtbase: Added _sopen_dispatch/_wsopen_dispatch
Nikolay Sivov
nsivov at codeweavers.com
Fri Oct 28 05:43:19 CDT 2016
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
v2: forward _wsopen/_wsopen_s and _sopen/_sopen_s to respective *_dispatch variants
.../api-ms-win-crt-stdio-l1-1-0.spec | 4 +--
dlls/msvcrt/file.c | 36 ++++++++++++++++------
dlls/ucrtbase/ucrtbase.spec | 4 +--
3 files changed, 31 insertions(+), 13 deletions(-)
diff --git a/dlls/api-ms-win-crt-stdio-l1-1-0/api-ms-win-crt-stdio-l1-1-0.spec b/dlls/api-ms-win-crt-stdio-l1-1-0/api-ms-win-crt-stdio-l1-1-0.spec
index 4b8be01..6acd08e 100644
--- a/dlls/api-ms-win-crt-stdio-l1-1-0/api-ms-win-crt-stdio-l1-1-0.spec
+++ b/dlls/api-ms-win-crt-stdio-l1-1-0/api-ms-win-crt-stdio-l1-1-0.spec
@@ -87,7 +87,7 @@
@ cdecl _setmaxstdio(long) ucrtbase._setmaxstdio
@ cdecl _setmode(long long) ucrtbase._setmode
@ varargs _sopen(str long long) ucrtbase._sopen
-@ stub _sopen_dispatch
+@ cdecl _sopen_dispatch(str long long long ptr long) ucrtbase._sopen_dispatch
@ cdecl _sopen_s(ptr str long long long) ucrtbase._sopen_s
@ cdecl _tell(long) ucrtbase._tell
@ cdecl -ret64 _telli64(long) ucrtbase._telli64
@@ -107,7 +107,7 @@
@ cdecl _wpopen(wstr wstr) ucrtbase._wpopen
@ cdecl _write(long ptr long) ucrtbase._write
@ varargs _wsopen(wstr long long) ucrtbase._wsopen
-@ stub _wsopen_dispatch
+@ cdecl _wsopen_dispatch(wstr long long long ptr long) ucrtbase._wsopen_dispatch
@ cdecl _wsopen_s(ptr wstr long long long) ucrtbase._wsopen_s
@ cdecl _wtempnam(wstr wstr) ucrtbase._wtempnam
@ cdecl _wtmpnam(ptr) ucrtbase._wtmpnam
diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c
index 432d5c7..37e5ece 100644
--- a/dlls/msvcrt/file.c
+++ b/dlls/msvcrt/file.c
@@ -2144,9 +2144,10 @@ static int check_bom(HANDLE h, int oflags, BOOL seek)
}
/*********************************************************************
- * _wsopen_s (MSVCRT.@)
+ * _wsopen_dispatch (UCRTBASE.@)
*/
-int CDECL MSVCRT__wsopen_s( int *fd, const MSVCRT_wchar_t* path, int oflags, int shflags, int pmode )
+int CDECL MSVCRT__wsopen_dispatch( const MSVCRT_wchar_t* path, int oflags, int shflags, int pmode,
+ int *fd, int secure )
{
DWORD access = 0, creation = 0, attrib;
SECURITY_ATTRIBUTES sa;
@@ -2306,6 +2307,15 @@ int CDECL MSVCRT__wsopen_s( int *fd, const MSVCRT_wchar_t* path, int oflags, int
return 0;
}
+
+/*********************************************************************
+ * _wsopen_s (MSVCRT.@)
+ */
+int CDECL MSVCRT__wsopen_s( int *fd, const MSVCRT_wchar_t* path, int oflags, int shflags, int pmode )
+{
+ return MSVCRT__wsopen_dispatch( path, oflags, shflags, pmode, fd, 1 );
+}
+
/*********************************************************************
* _wsopen (MSVCRT.@)
*/
@@ -2325,14 +2335,15 @@ int CDECL MSVCRT__wsopen( const MSVCRT_wchar_t *path, int oflags, int shflags, .
else
pmode = 0;
- MSVCRT__wsopen_s(&fd, path, oflags, shflags, pmode);
- return fd;
+ return MSVCRT__wsopen_dispatch(path, oflags, shflags, pmode, &fd, 0) ? -1 : fd;
}
+
/*********************************************************************
- * _sopen_s (MSVCRT.@)
+ * _sopen_dispatch (UCRTBASE.@)
*/
-int CDECL MSVCRT__sopen_s( int *fd, const char *path, int oflags, int shflags, int pmode )
+int CDECL MSVCRT__sopen_dispatch( const char *path, int oflags, int shflags,
+ int pmode, int *fd, int secure)
{
MSVCRT_wchar_t *pathW;
int ret;
@@ -2343,12 +2354,20 @@ int CDECL MSVCRT__sopen_s( int *fd, const char *path, int oflags, int shflags, i
if(!MSVCRT_CHECK_PMT(path && (pathW = msvcrt_wstrdupa(path))))
return MSVCRT_EINVAL;
- ret = MSVCRT__wsopen_s(fd, pathW, oflags, shflags, pmode);
+ ret = MSVCRT__wsopen_dispatch(pathW, oflags, shflags, pmode, fd, secure);
MSVCRT_free(pathW);
return ret;
}
/*********************************************************************
+ * _sopen_s (MSVCRT.@)
+ */
+int CDECL MSVCRT__sopen_s( int *fd, const char *path, int oflags, int shflags, int pmode )
+{
+ return MSVCRT__sopen_dispatch(path, oflags, shflags, pmode, fd, 1);
+}
+
+/*********************************************************************
* _sopen (MSVCRT.@)
*/
int CDECL MSVCRT__sopen( const char *path, int oflags, int shflags, ... )
@@ -2367,8 +2386,7 @@ int CDECL MSVCRT__sopen( const char *path, int oflags, int shflags, ... )
else
pmode = 0;
- MSVCRT__sopen_s(&fd, path, oflags, shflags, pmode);
- return fd;
+ return MSVCRT__sopen_dispatch(path, oflags, shflags, pmode, &fd, 0) ? -1 : fd;
}
/*********************************************************************
diff --git a/dlls/ucrtbase/ucrtbase.spec b/dlls/ucrtbase/ucrtbase.spec
index f0598ce..47608f9 100644
--- a/dlls/ucrtbase/ucrtbase.spec
+++ b/dlls/ucrtbase/ucrtbase.spec
@@ -1902,7 +1902,7 @@
@ stub _setsystime(ptr long)
@ cdecl _sleep(long) MSVCRT__sleep
@ varargs _sopen(str long long) MSVCRT__sopen
-@ stub _sopen_dispatch
+@ cdecl _sopen_dispatch(str long long long ptr long) MSVCRT__sopen_dispatch
@ cdecl _sopen_s(ptr str long long long) MSVCRT__sopen_s
@ varargs _spawnl(long str str)
@ varargs _spawnle(long str str)
@@ -2109,7 +2109,7 @@
@ cdecl _wsearchenv_s(wstr wstr ptr long) MSVCRT__wsearchenv_s
@ cdecl _wsetlocale(long wstr) MSVCRT__wsetlocale
@ varargs _wsopen(wstr long long) MSVCRT__wsopen
-@ stub _wsopen_dispatch
+@ cdecl _wsopen_dispatch(wstr long long long ptr long) MSVCRT__wsopen_dispatch
@ cdecl _wsopen_s(ptr wstr long long long) MSVCRT__wsopen_s
@ varargs _wspawnl(long wstr wstr)
@ varargs _wspawnle(long wstr wstr)
--
2.9.3
More information about the wine-patches
mailing list