Implemented the remaining 64-bit file functions, and added a few other
functions and exported variables.
Removed the almost empty lconv.c file.
diff --git a/dlls/msvcrt/Makefile.in b/dlls/msvcrt/Makefile.in
index 4e31ed2..edab9d1 100644
--- a/dlls/msvcrt/Makefile.in
+++ b/dlls/msvcrt/Makefile.in
@@ -21,7 +21,6 @@
exit.c \
file.c \
heap.c \
- lconv.c \
locale.c \
lock.c \
main.c \
diff --git a/dlls/msvcrt/dir.c b/dlls/msvcrt/dir.c
index 9c91a3c..69a4dc5 100644
--- a/dlls/msvcrt/dir.c
+++ b/dlls/msvcrt/dir.c
@@ -46,8 +46,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
-/* INTERNAL: Translate finddata_t to PWIN32_FIND_DATAA */
-static void msvcrt_fttofd(LPWIN32_FIND_DATAA fd, struct _finddata_t* ft)
+/* INTERNAL: Translate WIN32_FIND_DATAA to finddata_t */
+static void msvcrt_fttofd( const WIN32_FIND_DATAA *fd, struct _finddata_t* ft)
{
DWORD dw;
@@ -66,8 +66,8 @@
strcpy(ft->name, fd->cFileName);
}
-/* INTERNAL: Translate wfinddata_t to PWIN32_FIND_DATAA */
-static void msvcrt_wfttofd(LPWIN32_FIND_DATAW fd, struct _wfinddata_t* ft)
+/* INTERNAL: Translate WIN32_FIND_DATAW to wfinddata_t */
+static void msvcrt_wfttofd( const WIN32_FIND_DATAW *fd, struct _wfinddata_t* ft)
{
DWORD dw;
@@ -86,6 +86,46 @@
strcpyW(ft->name, fd->cFileName);
}
+/* INTERNAL: Translate WIN32_FIND_DATAA to finddatai64_t */
+static void msvcrt_fttofdi64( const WIN32_FIND_DATAA *fd, struct _finddatai64_t* ft)
+{
+ DWORD dw;
+
+ if (fd->dwFileAttributes == FILE_ATTRIBUTE_NORMAL)
+ ft->attrib = 0;
+ else
+ ft->attrib = fd->dwFileAttributes;
+
+ RtlTimeToSecondsSince1970( (LARGE_INTEGER *)&fd->ftCreationTime, &dw );
+ ft->time_create = dw;
+ RtlTimeToSecondsSince1970( (LARGE_INTEGER *)&fd->ftLastAccessTime, &dw );
+ ft->time_access = dw;
+ RtlTimeToSecondsSince1970( (LARGE_INTEGER *)&fd->ftLastWriteTime, &dw );
+ ft->time_write = dw;
+ ft->size = ((__int64)fd->nFileSizeHigh) << 32 | fd->nFileSizeLow;
+ strcpy(ft->name, fd->cFileName);
+}
+
+/* INTERNAL: Translate WIN32_FIND_DATAW to wfinddatai64_t */
+static void msvcrt_wfttofdi64( const WIN32_FIND_DATAW *fd, struct _wfinddatai64_t* ft)
+{
+ DWORD dw;
+
+ if (fd->dwFileAttributes == FILE_ATTRIBUTE_NORMAL)
+ ft->attrib = 0;
+ else
+ ft->attrib = fd->dwFileAttributes;
+
+ RtlTimeToSecondsSince1970( (LARGE_INTEGER *)&fd->ftCreationTime, &dw );
+ ft->time_create = dw;
+ RtlTimeToSecondsSince1970( (LARGE_INTEGER *)&fd->ftLastAccessTime, &dw );
+ ft->time_access = dw;
+ RtlTimeToSecondsSince1970( (LARGE_INTEGER *)&fd->ftLastWriteTime, &dw );
+ ft->time_write = dw;
+ ft->size = ((__int64)fd->nFileSizeHigh) << 32 | fd->nFileSizeLow;
+ strcpyW(ft->name, fd->cFileName);
+}
+
/*********************************************************************
* _chdir (MSVCRT.@)
*/
@@ -182,6 +222,44 @@
}
/*********************************************************************
+ * _findfirsti64 (MSVCRT.@)
+ */
+long _findfirsti64(const char * fspec, struct _finddatai64_t* ft)
+{
+ WIN32_FIND_DATAA find_data;
+ HANDLE hfind;
+
+ hfind = FindFirstFileA(fspec, &find_data);
+ if (hfind == INVALID_HANDLE_VALUE)
+ {
+ MSVCRT__set_errno(GetLastError());
+ return -1;
+ }
+ msvcrt_fttofdi64(&find_data,ft);
+ TRACE(":got handle %p\n",hfind);
+ return (long)hfind;
+}
+
+/*********************************************************************
+ * _wfindfirsti64 (MSVCRT.@)
+ */
+long _wfindfirsti64(const MSVCRT_wchar_t * fspec, struct _wfinddatai64_t* ft)
+{
+ WIN32_FIND_DATAW find_data;
+ HANDLE hfind;
+
+ hfind = FindFirstFileW(fspec, &find_data);
+ if (hfind == INVALID_HANDLE_VALUE)
+ {
+ MSVCRT__set_errno(GetLastError());
+ return -1;
+ }
+ msvcrt_wfttofdi64(&find_data,ft);
+ TRACE(":got handle %p\n",hfind);
+ return (long)hfind;
+}
+
+/*********************************************************************
* _findnext (MSVCRT.@)
*/
int _findnext(long hand, struct _finddata_t * ft)
@@ -216,6 +294,40 @@
}
/*********************************************************************
+ * _findnexti64 (MSVCRT.@)
+ */
+int _findnexti64(long hand, struct _finddatai64_t * ft)
+{
+ WIN32_FIND_DATAA find_data;
+
+ if (!FindNextFileA((HANDLE)hand, &find_data))
+ {
+ *MSVCRT__errno() = MSVCRT_ENOENT;
+ return -1;
+ }
+
+ msvcrt_fttofdi64(&find_data,ft);
+ return 0;
+}
+
+/*********************************************************************
+ * _wfindnexti64 (MSVCRT.@)
+ */
+int _wfindnexti64(long hand, struct _wfinddatai64_t * ft)
+{
+ WIN32_FIND_DATAW find_data;
+
+ if (!FindNextFileW((HANDLE)hand, &find_data))
+ {
+ *MSVCRT__errno() = MSVCRT_ENOENT;
+ return -1;
+ }
+
+ msvcrt_wfttofdi64(&find_data,ft);
+ return 0;
+}
+
+/*********************************************************************
* _getcwd (MSVCRT.@)
*/
char* _getcwd(char * buf, int size)
diff --git a/dlls/msvcrt/errno.c b/dlls/msvcrt/errno.c
index 3f8089c..9461a42 100644
--- a/dlls/msvcrt/errno.c
+++ b/dlls/msvcrt/errno.c
@@ -164,3 +164,11 @@
}
return old;
}
+
+/******************************************************************************
+ * _seterrormode (MSVCRT.@)
+ */
+void _seterrormode(int mode)
+{
+ SetErrorMode( mode );
+}
diff --git a/dlls/msvcrt/exit.c b/dlls/msvcrt/exit.c
index a719d1c..c831bad 100644
--- a/dlls/msvcrt/exit.c
+++ b/dlls/msvcrt/exit.c
@@ -42,6 +42,8 @@
extern int MSVCRT_app_type;
extern char *MSVCRT__pgmptr;
+void (*_aexit_rtn)(int) = MSVCRT__exit;
+
/* INTERNAL: call atexit functions */
void __MSVCRT__call_atexit(void)
{
@@ -142,7 +144,7 @@
}
else
_cprintf("\nruntime error R60%d\n",errnum);
- MSVCRT__exit(255);
+ _aexit_rtn(255);
}
/*********************************************************************
diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c
index b801e83..a928701 100644
--- a/dlls/msvcrt/file.c
+++ b/dlls/msvcrt/file.c
@@ -551,7 +551,7 @@
}
/*********************************************************************
- * _lseek (MSVCRT.@)
+ * _lseeki64 (MSVCRT.@)
*/
__int64 _lseeki64(int fd, __int64 offset, int whence)
{
@@ -716,6 +716,25 @@
}
/*********************************************************************
+ * _filelengthi64 (MSVCRT.@)
+ */
+__int64 _filelengthi64(int fd)
+{
+ __int64 curPos = _lseeki64(fd, 0, SEEK_CUR);
+ if (curPos != -1)
+ {
+ __int64 endPos = _lseeki64(fd, 0, SEEK_END);
+ if (endPos != -1)
+ {
+ if (endPos != curPos)
+ _lseeki64(fd, curPos, SEEK_SET);
+ return endPos;
+ }
+ }
+ return -1;
+}
+
+/*********************************************************************
* _fileno (MSVCRT.@)
*/
int _fileno(MSVCRT_FILE* file)
@@ -1368,9 +1387,9 @@
}
/*********************************************************************
- * _wstat (MSVCRT.@)
+ * _wstati64 (MSVCRT.@)
*/
-int _wstat(const MSVCRT_wchar_t* path, struct _stat * buf)
+int _wstati64(const MSVCRT_wchar_t* path, struct _stati64 * buf)
{
DWORD dw;
WIN32_FILE_ATTRIBUTE_DATA hfi;
@@ -1418,25 +1437,47 @@
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("%d %d 0x%08lx%08lx %ld %ld %ld\n", buf->st_mode,buf->st_nlink,
+ (long)(buf->st_size >> 32),(long)buf->st_size,
buf->st_atime,buf->st_mtime, buf->st_ctime);
return 0;
}
/*********************************************************************
+ * _wstat (MSVCRT.@)
+ */
+int _wstat(const MSVCRT_wchar_t* path, struct _stat * buf)
+{
+ int ret;
+ struct _stati64 bufi64;
+
+ ret = _wstati64( path, &bufi64 );
+ if (!ret) msvcrt_cp_from_stati64(&bufi64, buf);
+ return ret;
+}
+
+/*********************************************************************
* _tell (MSVCRT.@)
*/
-LONG _tell(int fd)
+long _tell(int fd)
{
return _lseek(fd, 0, SEEK_CUR);
}
/*********************************************************************
+ * _telli64 (MSVCRT.@)
+ */
+__int64 _telli64(int fd)
+{
+ return _lseeki64(fd, 0, SEEK_CUR);
+}
+
+/*********************************************************************
* _tempnam (MSVCRT.@)
*/
char *_tempnam(const char *dir, const char *prefix)
diff --git a/dlls/msvcrt/lconv.c b/dlls/msvcrt/lconv.c
deleted file mode 100644
index 44c3ea8..0000000
--- a/dlls/msvcrt/lconv.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * msvcrt.dll lconv functions
- *
- * Copyright 2002 Uwe Bonnes
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * NOTE: just stubs for now 020325
- */
-
-#include "wine/debug.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
-
-
-/*********************************************************************
- * __lconv_init (MSVCRT.@)
- */
-void __lconv_init(void)
-{
- FIXME(" stub\n");
-}
diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c
index 2e137c3..b125794 100644
--- a/dlls/msvcrt/locale.c
+++ b/dlls/msvcrt/locale.c
@@ -584,6 +584,14 @@
}
/*********************************************************************
+ * __lconv_init (MSVCRT.@)
+ */
+void __lconv_init(void)
+{
+ FIXME(" stub\n");
+}
+
+/*********************************************************************
* _Gettnames (MSVCRT.@)
*/
void *_Gettnames(void)
diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c
index 384b22b..2e0eaf8 100644
--- a/dlls/msvcrt/math.c
+++ b/dlls/msvcrt/math.c
@@ -468,6 +468,14 @@
}
/*********************************************************************
+ * __fpecode (MSVCRT.@)
+ */
+int *__fpecode(void)
+{
+ return &msvcrt_get_thread_data()->fpecode;
+}
+
+/*********************************************************************
* ldexp (MSVCRT.@)
*/
double MSVCRT_ldexp(double num, long exp)
diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h
index 888b0ac..382e126 100644
--- a/dlls/msvcrt/msvcrt.h
+++ b/dlls/msvcrt/msvcrt.h
@@ -40,6 +40,7 @@
unsigned long doserrno;
char *mbstok_next; /* next ptr for mbstok() */
char *efcvt_buffer; /* buffer for ecvt/fcvt */
+ int fpecode;
terminate_function terminate_handler;
unexpected_function unexpected_handler;
_se_translator_function se_translator;
diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec
index 0d130cd..631f197 100644
--- a/dlls/msvcrt/msvcrt.spec
+++ b/dlls/msvcrt/msvcrt.spec
@@ -89,7 +89,7 @@
@ cdecl __crtLCMapStringA(long long str long ptr long long long)
@ cdecl __dllonexit(ptr ptr ptr)
@ cdecl __doserrno()
-@ stub __fpecode #()
+@ cdecl __fpecode()
@ cdecl __getmainargs(ptr ptr ptr long ptr)
@ extern __initenv MSVCRT___initenv
@ cdecl __isascii(long) MSVCRT___isascii
@@ -160,7 +160,7 @@
@ cdecl _adj_fprem1()
@ cdecl _adj_fptan()
@ cdecl _adjust_fdiv()
-@ stub _aexit_rtn
+@ extern _aexit_rtn
@ cdecl _amsg_exit(long) MSVCRT__amsg_exit
@ cdecl _assert(str str long) MSVCRT__assert
@ stub _atodbl #(ptr str)
@@ -223,13 +223,13 @@
@ cdecl _filbuf(ptr)
@ stub _fileinfo
@ cdecl _filelength(long)
-@ stub _filelengthi64 #(long)
+@ cdecl -ret64 _filelengthi64(long)
@ cdecl _fileno(ptr)
@ cdecl _findclose(long)
@ cdecl _findfirst(str ptr)
-@ stub _findfirsti64 #(str ptr)
+@ cdecl _findfirsti64(str ptr)
@ cdecl _findnext(long ptr)
-@ stub _findnexti64 #(long ptr)
+@ cdecl _findnexti64(long ptr)
@ cdecl _finite( double )
@ cdecl _flsbuf(long ptr)
@ cdecl _flushall()
@@ -322,7 +322,7 @@
@ cdecl _lock(long)
@ cdecl _locking(long long long)
@ cdecl _logb( double )
-@ stub _longjmpex
+@ cdecl -i386 longjmpex(ptr long) MSVCRT_longjmp
@ cdecl _lrotl(long long)
@ cdecl _lrotr(long long)
@ cdecl _lsearch(ptr ptr long long ptr)
@@ -344,7 +344,7 @@
@ cdecl _mbctolower(long)
@ stub _mbctombb #(long)
@ cdecl _mbctoupper(long)
-@ stub _mbctype
+@ extern _mbctype MSVCRT_mbctype
@ stub _mbsbtype #(str long)
@ cdecl _mbscat(str str) strcat
@ cdecl _mbschr(str long)
@@ -396,7 +396,7 @@
@ cdecl _onexit(ptr)
@ varargs _open(str long)
@ cdecl _open_osfhandle(long long)
-@ stub _osver
+@ extern _osver MSVCRT__osver
@ stub _outp #(long long)
@ stub _outpd #(long long)
@ stub _outpw #(long long)
@@ -425,7 +425,7 @@
@ stdcall -i386 _seh_longjmp_unwind(ptr)
@ cdecl _set_error_mode(long)
@ stub _set_sbh_threshold #(long)
-@ stub _seterrormode #(long)
+@ cdecl _seterrormode(long)
@ cdecl -i386 _setjmp(ptr) MSVCRT__setjmp
@ cdecl -i386 _setjmp3(ptr long) MSVCRT__setjmp3
@ stub _setmaxstdio #(long)
@@ -467,7 +467,7 @@
@ extern _sys_errlist MSVCRT__sys_errlist
@ extern _sys_nerr MSVCRT__sys_nerr
@ cdecl _tell(long)
-@ stub _telli64 #(long)
+@ cdecl -ret64 _telli64(long)
@ cdecl _tempnam(str str)
@ stub _timezone # extern
@ cdecl _tolower(long) MSVCRT__tolower
@@ -515,9 +515,9 @@
@ stub _wexecvpe #(wstr ptr ptr)
@ cdecl _wfdopen(long wstr)
@ cdecl _wfindfirst(wstr ptr)
-@ stub _wfindfirsti64 #(wstr ptr)
+@ cdecl _wfindfirsti64(wstr ptr)
@ cdecl _wfindnext(long ptr)
-@ stub _wfindnexti64 #(long ptr)
+@ cdecl _wfindnexti64(long ptr)
@ cdecl _wfopen(wstr wstr)
@ stub _wfreopen #(wstr wstr ptr)
@ cdecl _wfsopen(wstr wstr long)
@@ -553,7 +553,7 @@
@ stub _wspawnvpe #(long wstr ptr ptr)
@ cdecl _wsplitpath(wstr wstr wstr wstr wstr)
@ cdecl _wstat(wstr ptr)
-@ stub _wstati64 #(wstr ptr)
+@ cdecl _wstati64(wstr ptr)
@ stub _wstrdate #(ptr)
@ stub _wstrtime #(ptr)
@ stub _wsystem #(wstr)