_stati64 (before _fstati64)

Stefan Leichter Stefan.Leichter at camLine.com
Sun Nov 24 14:35:53 CST 2002


Hello,

by accident i have send this patch to wine-develop list instead of wine-patches.
This patch needs to be applied before my _fstati64 patch

ChangeLog
-------------
	converted implementation of _stat to _stati64
	implemented _stat by calling _stati64

--- dlls/msvcrt/msvcrt.0.spec	Wed Nov 20 20:52:14 2002
+++ dlls/msvcrt/msvcrt.spec	Sat Nov 23 21:25:45 2002
@@ -446,7 +446,7 @@
 @ cdecl _spawnvpe(long str ptr ptr) _spawnvpe
 @ forward _splitpath ntdll._splitpath
 @ cdecl _stat(str ptr) MSVCRT__stat
-@ stub _stati64 #(str ptr)
+@ cdecl _stati64 (str ptr) MSVCRT__stati64
 @ cdecl _statusfp() _statusfp
 @ cdecl _strcmpi(str str) strcasecmp
 @ cdecl _strdate(str) _strdate
--- dlls/msvcrt/file.0.c	Fri Oct 25 05:12:00 2002
+++ dlls/msvcrt/file.c	Sat Nov 23 21:25:53 2002
@@ -1135,9 +1135,9 @@
 }
 
 /*********************************************************************
- *		_stat (MSVCRT.@)
+ *		_stati64 (MSVCRT.@)
  */
-int MSVCRT__stat(const char* path, struct _stat * buf)
+int MSVCRT__stati64(const char* path, struct _stati64 * buf)
 {
   DWORD dw;
   WIN32_FILE_ATTRIBUTE_DATA hfi;
@@ -1153,7 +1153,7 @@
       return -1;
   }
 
-  memset(buf,0,sizeof(struct _stat));
+  memset(buf,0,sizeof(struct _stati64));
 
   /* FIXME: rdev isnt drive num,despite what the docs say-what is it?
      Bon 011120: This FIXME seems incorrect
@@ -1189,14 +1189,38 @@
 
   buf->st_mode  = mode;
   buf->st_nlink = 1;
-  buf->st_size  = hfi.nFileSizeLow;
+  buf->st_size  = ((__int64)hfi.nFileSizeHigh << 32) + hfi.nFileSizeLow;
   RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastAccessTime, &dw);
   buf->st_atime = dw;
   RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastWriteTime, &dw);
   buf->st_mtime = buf->st_ctime = dw;
-  TRACE("\n%d %d %d %ld %ld %ld\n", buf->st_mode,buf->st_nlink,buf->st_size,
+  TRACE("\n%d %d %ld %ld %ld %ld\n", buf->st_mode,buf->st_nlink,buf->st_size,
     buf->st_atime,buf->st_mtime, buf->st_ctime);
   return 0;
+}
+
+/*********************************************************************
+ *		_stat (MSVCRT.@)
+ */
+int MSVCRT__stat(const char* path, struct _stat * buf)
+{ int ret;
+  struct _stati64 bufi64;
+
+  ret = MSVCRT__stati64( path, &bufi64);
+  if (!ret)
+  { buf->st_dev   = bufi64.st_dev;
+    buf->st_ino   = bufi64.st_ino;
+    buf->st_mode  = bufi64.st_mode;
+    buf->st_nlink = bufi64.st_nlink;
+    buf->st_uid   = bufi64.st_uid;
+    buf->st_gid   = bufi64.st_gid;
+    buf->st_rdev  = bufi64.st_rdev;
+    buf->st_size  = (DWORD) bufi64.st_dev;
+    buf->st_atime = bufi64.st_atime;
+    buf->st_mtime = bufi64.st_mtime;
+    buf->st_ctime = bufi64.st_ctime;
+  }
+  return ret;
 }
 
 /*********************************************************************




More information about the wine-patches mailing list