_ fstati64

Stefan Leichter Stefan.Leichter at camLine.com
Sun Nov 24 04:11:18 CST 2002


ChangeLog
-------------
	converted implementation of _fstat to _fstati64
	implemented _fstat by calling _fstati64

--- dlls/msvcrt/msvcrt.2.spec	Sun Nov 24 11:04:11 2002
+++ dlls/msvcrt/msvcrt.spec	Sun Nov 24 11:06:46 2002
@@ -241,7 +241,7 @@
 @ cdecl _fputwchar(long) _fputwchar
 @ cdecl _fsopen(str str long) _fsopen
 @ cdecl _fstat(long ptr) MSVCRT__fstat
-@ stub _fstati64 #(long ptr)
+@ cdecl _fstati64(long ptr) MSVCRT__fstati64
 @ cdecl _ftime(ptr) _ftime
 @ forward _ftol ntdll._ftol
 @ cdecl _fullpath(ptr str long) _fullpath
--- dlls/msvcrt/file.2.c	Sun Nov 24 11:04:30 2002
+++ dlls/msvcrt/file.c	Sun Nov 24 11:05:24 2002
@@ -96,6 +96,19 @@
 #define LOCK_FILES     EnterCriticalSection(&MSVCRT_file_cs)
 #define UNLOCK_FILES   LeaveCriticalSection(&MSVCRT_file_cs)
 
+static void msvcrt_cp_from_stati64(struct _stati64 *bufi64, struct _stat *buf)
+{   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;
+}
 
 /* INTERNAL: Get the HANDLE for a fd */
 static HANDLE msvcrt_fdtoh(int fd)
@@ -684,9 +697,9 @@
 }
 
 /*********************************************************************
- *		_fstat (MSVCRT.@)
+ *		_fstati64 (MSVCRT.@)
  */
-int MSVCRT__fstat(int fd, struct _stat* buf)
+int MSVCRT__fstati64(int fd, struct _stati64* buf)
 {
   DWORD dw;
   BY_HANDLE_FILE_INFORMATION hfi;
@@ -704,7 +717,7 @@
   }
 
   memset(&hfi, 0, sizeof(hfi));
-  memset(buf, 0, sizeof(struct _stat));
+  memset(buf, 0, sizeof(struct _stati64));
   if (!GetFileInformationByHandle(hand, &hfi))
   {
     WARN(":failed-last error (%ld)\n",GetLastError());
@@ -713,7 +726,7 @@
   }
   FIXME(":dwFileAttributes = %ld, mode set to 0\n",hfi.dwFileAttributes);
   buf->st_nlink = hfi.nNumberOfLinks;
-  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);
@@ -722,6 +735,19 @@
 }
 
 /*********************************************************************
+ *		_fstat (MSVCRT.@)
+ */
+int MSVCRT__fstat(int fd, struct _stat* buf)
+{ int ret;
+  struct _stati64 bufi64;
+
+  ret = MSVCRT__fstati64(fd, &bufi64);
+  if (!ret)
+      msvcrt_cp_from_stati64(&bufi64, buf);
+  return ret;
+}
+
+/*********************************************************************
  *		_futime (MSVCRT.@)
  */
 int _futime(int fd, struct _utimbuf *t)
@@ -1224,18 +1250,7 @@
 
   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;
-  }
+      msvcrt_cp_from_stati64(&bufi64, buf);
   return ret;
 }
 



More information about the wine-patches mailing list