[PATCH] msvcr90: Implement _stat32, _fstat32, _wstat32
Detlef Riekenberg
wine.dev at web.de
Sun Jan 23 10:46:30 CST 2011
This avoid a crash in the app "Rossmann fotowelt", which is using QT for the UI.
--
By by ... Detlef
---
dlls/msvcr100/msvcr100.spec | 6 ++--
dlls/msvcr80/msvcr80.spec | 6 ++--
dlls/msvcr90/msvcr90.c | 60 +++++++++++++++++++++++++++++++++++++++++++
dlls/msvcr90/msvcr90.spec | 6 ++--
include/msvcrt/sys/stat.h | 17 ++++++++++++
include/msvcrt/wchar.h | 15 ++++++++++
6 files changed, 101 insertions(+), 9 deletions(-)
diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec
index c103916..b4a0f7b 100644
--- a/dlls/msvcr100/msvcr100.spec
+++ b/dlls/msvcr100/msvcr100.spec
@@ -651,7 +651,7 @@
@ cdecl _fseeki64(ptr int64 long) msvcrt._fseeki64
@ stub _fseeki64_nolock
@ cdecl _fsopen(str str long) msvcrt._fsopen
-@ stub _fstat32
+@ cdecl _fstat32(long ptr) msvcr90._fstat32
@ stub _fstat32i64
@ cdecl _fstat64(long ptr) msvcrt._fstat64
@ cdecl _fstat64i32(long ptr) msvcr90._fstat64i32
@@ -1123,7 +1123,7 @@
@ stub _sprintf_s_l
@ varargs _sscanf_l(str str ptr) msvcrt._sscanf_l
@ varargs _sscanf_s_l(str str ptr) msvcrt._sscanf_s_l
-@ stub _stat32
+@ cdecl _stat32(str ptr) msvcr90._stat32
@ stub _stat32i64
@ cdecl _stat64(str ptr) msvcrt._stat64
@ cdecl _stat64i32(str ptr) msvcr90._stat64i32
@@ -1393,7 +1393,7 @@
@ cdecl _wspawnvpe(long wstr ptr ptr) msvcrt._wspawnvpe
@ cdecl _wsplitpath(wstr ptr ptr ptr ptr) msvcrt._wsplitpath
@ cdecl _wsplitpath_s(wstr ptr long ptr long ptr long ptr long) msvcrt._wsplitpath_s
-@ stub _wstat32
+@ cdecl _wstat32(wstr ptr) msvcr90._wstat32
@ stub _wstat32i64
@ cdecl _wstat64(wstr ptr) msvcrt._wstat64
@ cdecl _wstat64i32(wstr ptr) msvcr90._wstat64i32
diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec
index 4879e13..814edf2 100644
--- a/dlls/msvcr80/msvcr80.spec
+++ b/dlls/msvcr80/msvcr80.spec
@@ -492,7 +492,7 @@
@ cdecl _fseeki64(ptr int64 long) msvcrt._fseeki64
@ stub _fseeki64_nolock
@ cdecl _fsopen(str str long) msvcrt._fsopen
-@ stub _fstat32
+@ cdecl _fstat32(long ptr) msvcr90._fstat32
@ stub _fstat32i64
@ cdecl _fstat64(long ptr) msvcrt._fstat64
@ cdecl _fstat64i32(long ptr) msvcr90._fstat64i32
@@ -977,7 +977,7 @@
@ stub _sprintf_s_l
@ varargs _sscanf_l(str str ptr) msvcrt._sscanf_l
@ varargs _sscanf_s_l(str str ptr) msvcrt._sscanf_s_l
-@ stub _stat32
+@ cdecl _stat32(str ptr) msvcr90._stat32
@ stub _stat32i64
@ cdecl _stat64(str ptr) msvcrt._stat64
@ cdecl _stat64i32(str ptr) msvcr90._stat64i32
@@ -1249,7 +1249,7 @@
@ cdecl _wspawnvpe(long wstr ptr ptr) msvcrt._wspawnvpe
@ cdecl _wsplitpath(wstr ptr ptr ptr ptr) msvcrt._wsplitpath
@ cdecl _wsplitpath_s(wstr ptr long ptr long ptr long ptr long) msvcrt._wsplitpath_s
-@ stub _wstat32
+@ cdecl _wstat32(wstr ptr) msvcr90._wstat32
@ stub _wstat32i64
@ cdecl _wstat64(wstr ptr) msvcrt._wstat64
@ cdecl _wstat64i32(wstr ptr) msvcr90._wstat64i32
diff --git a/dlls/msvcr90/msvcr90.c b/dlls/msvcr90/msvcr90.c
index 523ceec..34ee20f 100644
--- a/dlls/msvcr90/msvcr90.c
+++ b/dlls/msvcr90/msvcr90.c
@@ -31,6 +31,24 @@
WINE_DEFAULT_DEBUG_CHANNEL(msvcr90);
/*********************************************************************
+ * msvcr90_stat64_to_stat32 [internal]
+ */
+static void msvcr90_stat64_to_stat32(const struct _stat64 *buf64, struct _stat32 *buf)
+{
+ buf->st_dev = buf64->st_dev;
+ buf->st_ino = buf64->st_ino;
+ buf->st_mode = buf64->st_mode;
+ buf->st_nlink = buf64->st_nlink;
+ buf->st_uid = buf64->st_uid;
+ buf->st_gid = buf64->st_gid;
+ buf->st_rdev = buf64->st_rdev;
+ buf->st_size = buf64->st_size;
+ buf->st_atime = buf64->st_atime;
+ buf->st_mtime = buf64->st_mtime;
+ buf->st_ctime = buf64->st_ctime;
+}
+
+/*********************************************************************
* DllMain (MSVCR90.@)
*/
BOOL WINAPI DllMain(HINSTANCE hdll, DWORD reason, LPVOID reserved)
@@ -136,6 +154,48 @@ void* CDECL _recalloc(void* mem, size_t num, size_t size)
}
/*********************************************************************
+ * _fstat32 (MSVCR90.@)
+ */
+int CDECL _fstat32(int fd, struct _stat32* buf)
+{
+ int ret;
+ struct _stat64 buf64;
+
+ ret = _fstat64(fd, &buf64);
+ if (!ret)
+ msvcr90_stat64_to_stat32(&buf64, buf);
+ return ret;
+}
+
+/*********************************************************************
+ * _stat32 (MSVCR90.@)
+ */
+int CDECL _stat32(const char *path, struct _stat32* buf)
+{
+ int ret;
+ struct _stat64 buf64;
+
+ ret = _stat64(path, &buf64);
+ if (!ret)
+ msvcr90_stat64_to_stat32(&buf64, buf);
+ return ret;
+}
+
+/*********************************************************************
+ * _wstat32 (MSVCR90.@)
+ */
+int CDECL _wstat32(const wchar_t *path, struct _stat32* buf)
+{
+ int ret;
+ struct _stat64 buf64;
+
+ ret = _wstat64(path, &buf64);
+ if (!ret)
+ msvcr90_stat64_to_stat32(&buf64, buf);
+ return ret;
+}
+
+/*********************************************************************
* _fstat64i32 (MSVCRT.@)
*/
diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec
index aa0f981..e39ef87 100644
--- a/dlls/msvcr90/msvcr90.spec
+++ b/dlls/msvcr90/msvcr90.spec
@@ -484,7 +484,7 @@
@ cdecl _fseeki64(ptr int64 long) msvcrt._fseeki64
@ stub _fseeki64_nolock
@ cdecl _fsopen(str str long) msvcrt._fsopen
-@ stub _fstat32
+@ cdecl _fstat32(long ptr)
@ stub _fstat32i64
@ cdecl _fstat64(long ptr) msvcrt._fstat64
@ cdecl _fstat64i32(long ptr)
@@ -963,7 +963,7 @@
@ stub _sprintf_s_l
@ varargs _sscanf_l(str str ptr) msvcrt._sscanf_l
@ varargs _sscanf_s_l(str str ptr) msvcrt._sscanf_s_l
-@ stub _stat32
+@ cdecl _stat32(str ptr)
@ stub _stat32i64
@ cdecl _stat64(str ptr) msvcrt._stat64
@ cdecl _stat64i32(str ptr)
@@ -1233,7 +1233,7 @@
@ cdecl _wspawnvpe(long wstr ptr ptr) msvcrt._wspawnvpe
@ cdecl _wsplitpath(wstr ptr ptr ptr ptr) msvcrt._wsplitpath
@ cdecl _wsplitpath_s(wstr ptr long ptr long ptr long ptr long) msvcrt._wsplitpath_s
-@ stub _wstat32
+@ cdecl _wstat32(wstr ptr)
@ stub _wstat32i64
@ cdecl _wstat64(wstr ptr) msvcrt._wstat64
@ cdecl _wstat64i32(wstr ptr)
diff --git a/include/msvcrt/sys/stat.h b/include/msvcrt/sys/stat.h
index 9362d2d..6509e04 100644
--- a/include/msvcrt/sys/stat.h
+++ b/include/msvcrt/sys/stat.h
@@ -83,6 +83,20 @@ struct stat {
time_t st_ctime;
};
+struct _stat32 {
+ _dev_t st_dev;
+ _ino_t st_ino;
+ unsigned short st_mode;
+ short st_nlink;
+ short st_uid;
+ short st_gid;
+ _dev_t st_rdev;
+ _off_t st_size;
+ __time32_t st_atime;
+ __time32_t st_mtime;
+ __time32_t st_ctime;
+};
+
struct _stat32i64 {
_dev_t st_dev;
_ino_t st_ino;
@@ -146,6 +160,8 @@ extern "C" {
int __cdecl _fstat(int,struct _stat*);
int __cdecl _stat(const char*,struct _stat*);
+int __cdecl _fstat32(int, struct _stat32*);
+int __cdecl _stat32(const char*, struct _stat32*);
int __cdecl _fstati64(int,struct _stati64*);
int __cdecl _stati64(const char*,struct _stati64*);
int __cdecl _fstat64(int,struct _stat64*);
@@ -155,6 +171,7 @@ int __cdecl _umask(int);
#ifndef _WSTAT_DEFINED
#define _WSTAT_DEFINED
int __cdecl _wstat(const wchar_t*,struct _stat*);
+int __cdecl _wstat32(const wchar_t*, struct _stat32*);
int __cdecl _wstati64(const wchar_t*,struct _stati64*);
int __cdecl _wstat64(const wchar_t*,struct _stat64*);
#endif /* _WSTAT_DEFINED */
diff --git a/include/msvcrt/wchar.h b/include/msvcrt/wchar.h
index f7656b2..21f2b3f 100644
--- a/include/msvcrt/wchar.h
+++ b/include/msvcrt/wchar.h
@@ -148,6 +148,20 @@ struct stat {
time_t st_ctime;
};
+struct _stat32 {
+ _dev_t st_dev;
+ _ino_t st_ino;
+ unsigned short st_mode;
+ short st_nlink;
+ short st_uid;
+ short st_gid;
+ _dev_t st_rdev;
+ _off_t st_size;
+ __time32_t st_atime;
+ __time32_t st_mtime;
+ __time32_t st_ctime;
+};
+
struct _stati64 {
_dev_t st_dev;
_ino_t st_ino;
@@ -264,6 +278,7 @@ int __cdecl _wsystem(const wchar_t*);
#ifndef _WSTAT_DEFINED
#define _WSTAT_DEFINED
int __cdecl _wstat(const wchar_t*,struct _stat*);
+int __cdecl _wstat32(const wchar_t*, struct _stat32*);
int __cdecl _wstati64(const wchar_t*,struct _stati64*);
int __cdecl _wstat64(const wchar_t*,struct _stat64*);
#endif /* _WSTAT_DEFINED */
--
1.7.1
More information about the wine-patches
mailing list