From 2973c0865fb0f4741edcc51680ce460b8b09a894 Mon Sep 17 00:00:00 2001 From: Earnie Boyd Date: Wed, 26 Sep 2012 11:38:55 -0400 Subject: [PATCH] Make the changes work. * include/sys/stat.h (stat, fstat): Change __NO_INLINE__ filter to _NO_OLDNAMES. (_fstat64i32, _stat64i32): Define to be equal to _fstat64 and _stat64 respectively when __NO_INLINE__ is defined. Remove _CRTIMP from declaration due to inline function. (_wstat64i32): Define an inline function or define to _wstat64 since it is missing from libmsvcrt.a. Remove _CRTIMP from declaration due to inline function. (xstat): Remove. * include/commctrl.h (tagTVINSERTSTRUCTA, tagTVINSERTSTRUCTW): Move to after the definition of TVITEMXA and TVITEMXW. (TVINSERTSTRUCT, TV_INSERTSTRUCT): Move UNICODE amp to after the definition of TVINSERTSTRUCTA and TVINSERTSTRUCTW. * include/winuser.h (INPUT_MOUSE, INPUT_KEYBOARD, INPUT_HARDWARE): Move to always define based on assumption of lowest supported OS. These appeared in NT version 4 service pack 3. (tagMOUSEINPUT, tagKEYBDINPUT, tagHARDWAREINPUT, tagINPUT): Ditto. (SendInput): Ditto. * include/time.h (_HAVE_32BIT_TIME_T): New macro stating that msvcrt.dll contains the 32bit time functions. (_USE_32BIT_TIME_T): If set then determine if _HAVE_32BIT_TIME_T is set and use the 32bit time functions else use the 64bit time functions and force datatype conversions. * include/wchar.h: Match stat components to sys/stat.h. * include/string.h (strcasecmp, strncasecmp): When __NO_INLINE__ defined map functions to _stricmp and _strincmp respectfully. * Makefile.in (libws2_32.a): Add src/libws2_32/ws2_32.o symbols to the library. Override global target with a specific one. (libscrnsavw_a_OBJECTS): Correct typo. (extra_OBJECTS): New variable containing extra objects to build. (libdinput_a_OBJECTS, libdmoguids_a_OBJECTS, libdxguid_a_OBJECTS, libstrmiids_a_OBJECTS, libws2_32_a_OBJECTS): Correctly define targets. --- ChangeLog | 39 ++++++++++++++++ Makefile.in | 34 +++++++++----- include/commctrl.h | 67 ++++++++++++++------------- include/string.h | 4 ++ include/sys/stat.h | 62 ++++++++++++++----------- include/time.h | 11 ++++- include/wchar.h | 132 ++++++++++++++++++++++++++--------------------------- include/winuser.h | 67 +++++++++++++-------------- 8 files changed, 246 insertions(+), 170 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1a2baed..f8839a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,44 @@ +2012-09-26 Earnie Boyd + + Make the changes work. + + * include/sys/stat.h (stat, fstat): Change __NO_INLINE__ filter to + _NO_OLDNAMES. + (_fstat64i32, _stat64i32): Define to be equal to _fstat64 and _stat64 + respectively when __NO_INLINE__ is defined. + Remove _CRTIMP from declaration due to inline function. + (_wstat64i32): Define an inline function or define to _wstat64 since it + is missing from libmsvcrt.a. + Remove _CRTIMP from declaration due to inline function. + (xstat): Remove. + * include/commctrl.h (tagTVINSERTSTRUCTA, tagTVINSERTSTRUCTW): Move to + after the definition of TVITEMXA and TVITEMXW. + (TVINSERTSTRUCT, TV_INSERTSTRUCT): Move UNICODE amp to after the + definition of TVINSERTSTRUCTA and TVINSERTSTRUCTW. + * include/winuser.h (INPUT_MOUSE, INPUT_KEYBOARD, INPUT_HARDWARE): + Move to always define based on assumption of lowest supported OS. + These appeared in NT version 4 service pack 3. + (tagMOUSEINPUT, tagKEYBDINPUT, tagHARDWAREINPUT, tagINPUT): Ditto. + (SendInput): Ditto. + * include/time.h (_HAVE_32BIT_TIME_T): New macro stating that + msvcrt.dll contains the 32bit time functions. + (_USE_32BIT_TIME_T): If set then determine if _HAVE_32BIT_TIME_T is set + and use the 32bit time functions else use the 64bit time functions and + force datatype conversions. + * include/wchar.h: Match stat components to sys/stat.h. + * include/string.h (strcasecmp, strncasecmp): When __NO_INLINE__ defined + map functions to _stricmp and _strincmp respectfully. + * Makefile.in (libws2_32.a): Add src/libws2_32/ws2_32.o symbols to the + library. Override global target with a specific one. + (libscrnsavw_a_OBJECTS): Correct typo. + (extra_OBJECTS): New variable containing extra objects to build. + (libdinput_a_OBJECTS, libdmoguids_a_OBJECTS, libdxguid_a_OBJECTS, + libstrmiids_a_OBJECTS, libws2_32_a_OBJECTS): Correctly define targets. + 2012-09-21 Earnie Boyd + Make the changes work. + * Makefile.in (ofmt_stub.o): Add stub to libmsvcrt.a through libmsvcr71d.a. (libmoldname*.a): Change the DLLNAME to msvcr*.dll as appropriate. diff --git a/Makefile.in b/Makefile.in index 20b232a..bf7bc01 100644 --- a/Makefile.in +++ b/Makefile.in @@ -157,7 +157,7 @@ libscrnsave_a_OBJECTS := $(libscrnsave_a_SOURCES:.c=.o) scrnsave_o_CFLAGS := -UUNICODE libscrnsavw_a_SOURCES := src/libscrnsave/scrnsave.c -libscrnsavw_a_OBJECTS := src/libscrnsave/srcnsavw.o +libscrnsavw_a_OBJECTS := src/libscrnsave/scrnsavw.o scrnsavw_o_CFLAGS := -DUNICODE liblargeint_a_SOURCES := src/liblargeint/largeint.c @@ -172,6 +172,11 @@ libdxguid_a_OBJECTS := $(libdxguid_a_SOURCES:.c=.o) libstrmiids_a_SOURCES := misc/src/libstrmiids/strmiids.c libstrmiids_a_OBJECTS := $(libstrmiids_a_SOURCES:.c=.o) +libws2_32_a_SOURCES := src/libws2_32/ws2_32.c +libws2_32_a_OBJECTS := $(libws2_32_a_SOURCES:.c=.o) + +extra_OBJECTS := $(libws2_32_a_OBJECTS) src/libcrt/crt/ofmt_stub.o + msvcrt_DEF = \ msvcrt.def msvcr70.def msvcr71.def msvcr80.def msvcr90.def msvcr100.def \ msvcrtd.def msvcr70d.def msvcr71d.def msvcr80d.def msvcr90d.def msvcr100d.def @@ -616,7 +621,7 @@ ALL_SOURCES := \ $(libdxerr8_a_SOURCES) \ $(libdxerr9_a_SOURCES) -all: $(msvcrt_DEF) $(moldname_DEF) $(lib_LIBRARIES) $(bin_LIBRARIES) $(lib_OBJECTS) +all: $(msvcrt_DEF) $(moldname_DEF) $(lib_LIBRARIES) $(bin_LIBRARIES) $(lib_OBJECTS) $(extra_OBJECTS) $(msvcrt_DEF): lib/lib32/msvcrt.def.in N=`echo $@ | sed -e 's|\([a-z]*\)\([0-9]*\).*|\1|'`; \ @@ -697,7 +702,7 @@ lib%.a: %.def fi $(RANLIB) $@ -lib%.a: %.o +lib%.a: src/lib%/%.o @echo Making library $@ from $?. $(AR) rc $@ $*.o $(RANLIB) $@ @@ -736,7 +741,7 @@ libmingw32.a: $(libmingw32_a_OBJECTS) $(AR) rc $@ $(libmingw32_a_OBJECTS) $(RANLIB) $@ -libmingwex.a: $(libmingwex_a_OBJECTS) $(winapi_lib_LIBRARIES) +libmingwex.a: $(libmingwex_a_OBJECTS) $(AR) rc $@ $(libmingwex_a_OBJECTS) $(RANLIB) $@ @@ -775,14 +780,11 @@ libdinput.a libdinput8.a: $(libdinput_a_OBJECTS) $(AR) rc $@ $(libdinput_a_OBJECTS) $(RANLIB) $@ -$(libdinput_a_OBJECTS) \ -$(libdmoguids_a_OBJECTS) \ -$(libdxguid_a_OBJECTS) \ -$(libstrmiids_a_OBJECTS): \ - $(libdinput_a_SOURCES) \ - $(libdmoguids_a_SOURCES) \ - $(libdxguid_a_SOURCES) \ - $(libstrmiids_a_SOURCES) +$(libdinput_a_OBJECTS) : $(libdinput_a_SOURCES) +$(libdmoguids_a_OBJECTS) : $(libdmoguids_a_SOURCES) +$(libdxguid_a_OBJECTS) : $(libdxguid_a_SOURCES) +$(libstrmiids_a_OBJECTS) : $(libstrmiids_a_SOURCES) +$(libws2_32_a_OBJECTS) : $(libws2_32_a_SOURCES) $(MKDIR_P) $(@D) $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -o $@ $< @@ -806,6 +808,14 @@ libstrmiids.a: $(libstrmiids_a_OBJECTS) $(AR) rc $@ $(libstrmiids_a_OBJECTS) $(RANLIB) $@ +# Note this target will override the previous global rules and give a warning +# from the make process. It is needed due to the extra ws2_32.o object file. +libws2_32.a: lib/lib32/ws2_32.def $(libws2_32_a_OBJECTS) + @echo Making library $@ from $(subst lib,,$(@:.a=.def)). + $(DLLTOOL) $(DLLTOOL_FLAGS) $(subst lib,,$(@:.a=.dll)) --def $(addprefix $(top_srcdir)/lib/lib32/,$(subst lib,,$(@:.a=.def))) --output-lib $@ + $(AR) rc $@ $(libws2_32_a_OBJECTS) + $(RANLIB) $@ + _libm_dummy.c: @echo "static int __mingw_libm_dummy;" > _libm_dummy.c diff --git a/include/commctrl.h b/include/commctrl.h index efc035e..60e26c2 100644 --- a/include/commctrl.h +++ b/include/commctrl.h @@ -1621,36 +1621,6 @@ typedef struct tagTVITEMW { #define _TV_ITEMW tagTVITEMW #define TV_ITEMW TVITEMW #define LPTV_ITEMW LPTVITEMW -typedef struct tagTVINSERTSTRUCTA { - HTREEITEM hParent; - HTREEITEM hInsertAfter; -#if (_WIN32_IE >= 0x0400) - _ANONYMOUS_UNION union { - TVITEMEXA itemex; - TV_ITEMA item; - } DUMMYUNIONNAME; -#else - TV_ITEMA item; -#endif -} TVINSERTSTRUCTA,*LPTVINSERTSTRUCTA; -#define _TV_INSERTSTRUCTA tagTVINSERTSTRUCTA -#define TV_INSERTSTRUCTA TVINSERTSTRUCTA -#define LPTV_INSERTSTRUCTA LPTVINSERTSTRUCTA -typedef struct tagTVINSERTSTRUCTW { - HTREEITEM hParent; - HTREEITEM hInsertAfter; -#if (_WIN32_IE >= 0x0400) - _ANONYMOUS_UNION union { - TVITEMEXW itemex; - TV_ITEMW item; - } DUMMYUNIONNAME; -#else - TV_ITEMW item; -#endif -} TVINSERTSTRUCTW,*LPTVINSERTSTRUCTW; -#define _TV_INSERTSTRUCTW tagTVINSERTSTRUCTW -#define TV_INSERTSTRUCTW TVINSERTSTRUCTW -#define LPTV_INSERTSTRUCTW LPTVINSERTSTRUCTW typedef struct tagTVHITTESTINFO { POINT pt; UINT flags; @@ -2153,8 +2123,6 @@ typedef __AW(TOOLTIPTEXT) TOOLTIPTEXT,*LPTOOLTIPTEXT; typedef __AW(NMTTDISPINFO) NMTTDISPINFO, *LPNMTTDISPINFO; typedef __AW(TV_ITEM) TV_ITEM,*LPTV_ITEM; typedef __AW(TVITEM) TVITEM,*LPTVITEM; -typedef __AW(TV_INSERTSTRUCT) TV_INSERTSTRUCT,*LPTV_INSERTSTRUCT; -typedef __AW(TVINSERTSTRUCT) TVINSERTSTRUCT,*LPTVINSERTSTRUCT; typedef __AW(NM_TREEVIEW) NM_TREEVIEW,*LPNM_TREEVIEW; typedef __AW(NMTREEVIEW) NMTREEVIEW,*LPNMTREEVIEW; typedef __AW(NMHDDISPINFO) NMHDDISPINFO, *LPNMHDDISPINFO; @@ -3331,6 +3299,41 @@ INT WINAPI DrawShadowText(HDC,LPCWSTR,UINT,RECT*,DWORD,COLORREF,COLORREF,INT,INT #endif /* RC_INVOKED */ #endif /* _WIN32_IE >= 0x0501 */ +#ifndef RC_INVOKED +typedef struct tagTVINSERTSTRUCTA { + HTREEITEM hParent; + HTREEITEM hInsertAfter; +#if (_WIN32_IE >= 0x0400) + _ANONYMOUS_UNION union { + TVITEMEXA itemex; + TV_ITEMA item; + } DUMMYUNIONNAME; +#else + TV_ITEMA item; +#endif +} TVINSERTSTRUCTA,*LPTVINSERTSTRUCTA; +#define _TV_INSERTSTRUCTA tagTVINSERTSTRUCTA +#define TV_INSERTSTRUCTA TVINSERTSTRUCTA +#define LPTV_INSERTSTRUCTA LPTVINSERTSTRUCTA +typedef struct tagTVINSERTSTRUCTW { + HTREEITEM hParent; + HTREEITEM hInsertAfter; +#if (_WIN32_IE >= 0x0400) + _ANONYMOUS_UNION union { + TVITEMEXW itemex; + TV_ITEMW item; + } DUMMYUNIONNAME; +#else + TV_ITEMW item; +#endif +} TVINSERTSTRUCTW,*LPTVINSERTSTRUCTW; +#define _TV_INSERTSTRUCTW tagTVINSERTSTRUCTW +#define TV_INSERTSTRUCTW TVINSERTSTRUCTW +#define LPTV_INSERTSTRUCTW LPTVINSERTSTRUCTW +typedef __AW(TV_INSERTSTRUCT) TV_INSERTSTRUCT,*LPTV_INSERTSTRUCT; +typedef __AW(TVINSERTSTRUCT) TVINSERTSTRUCT,*LPTVINSERTSTRUCT; +#endif /* ! RC_INVOKED */ + #ifdef __cplusplus } #endif diff --git a/include/string.h b/include/string.h index b33b3a0..98e4b72 100644 --- a/include/string.h +++ b/include/string.h @@ -106,6 +106,8 @@ int __cdecl __MINGW_NOTHROW strcasecmp (const char*, const char *); __CRT_INLINE int __cdecl __MINGW_NOTHROW strcasecmp (const char * __sz1, const char * __sz2) {return _stricmp (__sz1, __sz2);} +#else +#define strcasecmp _stricmp #endif _CRTIMP int __cdecl __MINGW_NOTHROW stricoll (const char*, const char*); @@ -117,6 +119,8 @@ int __cdecl __MINGW_NOTHROW strncasecmp (const char *, const char *, size_t); __CRT_INLINE int __cdecl __MINGW_NOTHROW strncasecmp (const char * __sz1, const char * __sz2, size_t __sizeMaxCompare) {return _strnicmp (__sz1, __sz2, __sizeMaxCompare);} +#else +#define strncasecmp _strnicmp #endif _CRTIMP char* __cdecl __MINGW_NOTHROW strnset (char*, int, size_t); diff --git a/include/sys/stat.h b/include/sys/stat.h index 75e84d7..7d7f5ca 100644 --- a/include/sys/stat.h +++ b/include/sys/stat.h @@ -110,25 +110,6 @@ struct _stat32 __time32_t st_ctime; /* Creation time */ }; -#ifndef _NO_OLDNAMES -/* NOTE: Must be the same as _stat above. */ -struct xstat -{ - dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */ - ino_t st_ino; /* Always zero ? */ - mode_t st_mode; /* See above constants */ - short st_nlink; /* Number of links. */ - short st_uid; /* User: Maybe significant on NT ? */ - short st_gid; /* Group: Ditto */ - dev_t st_rdev; /* Seems useless (not even filled in) */ - off_t st_size; /* File size in bytes */ - time_t st_atime; /* Accessed date (always 00:00 hrs local - * on FAT) */ - time_t st_mtime; /* Modified time */ - time_t st_ctime; /* Creation time */ -}; -#endif /* _NO_OLDNAMES */ - struct _stat64 { dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */ ino_t st_ino; /* Always zero ? */ @@ -207,11 +188,11 @@ extern "C" { _CRTIMP int __cdecl __MINGW_NOTHROW _stat32 (const char*, struct _stat32*); _CRTIMP int __cdecl __MINGW_NOTHROW _stat64 (const char*, struct _stat64*); _CRTIMP int __cdecl __MINGW_NOTHROW _stat32i64 (const char*, struct _stat32i64*); -_CRTIMP int __cdecl __MINGW_NOTHROW _stat64i32 (const char*, struct _stat64i32*); +int __cdecl __MINGW_NOTHROW _stat64i32 (const char*, struct _stat64i32*); _CRTIMP int __cdecl __MINGW_NOTHROW _fstat32 (int, struct _stat32*); _CRTIMP int __cdecl __MINGW_NOTHROW _fstat64 (int, struct _stat64*); _CRTIMP int __cdecl __MINGW_NOTHROW _fstat32i64 (int, struct _stat32i64*); -_CRTIMP int __cdecl __MINGW_NOTHROW _fstat64i32 (int, struct _stat64i32*); +int __cdecl __MINGW_NOTHROW _fstat64i32 (int, struct _stat64i32*); #ifndef __NO_INLINE__ __CRT_INLINE int __cdecl _fstat64i32(int desc, struct _stat64i32 *_stat) { @@ -255,8 +236,12 @@ _CRTIMP int __cdecl __MINGW_NOTHROW _fstat64i32 (int, struct _stat64i32*); _stat->st_ctime = st.st_ctime; return ret; } +#else +#define _stat64i32 _stat64 +#define _fstat64i32 _fstat64 #endif -#if !defined(__NO_INLINE__) && !defined(__STRICT_ANSI__) + +#if !defined(_NO_OLDNAMES) && !defined(__STRICT_ANSI__) #ifdef _USE_32BIT_TIME_T #define stat(a,b) _stat32(a,b) #define fstat(a,b) _fstat32(a,b) @@ -266,22 +251,47 @@ _CRTIMP int __cdecl __MINGW_NOTHROW _fstat64i32 (int, struct _stat64i32*); #endif #define stat _stat #define fstat _fstat -#endif /* !defined(__NO_INLINE__) && !defined(__STRICT_ANSI__) */ +#endif /* !defined(_NO_OLDNAMES) && !defined(__STRICT_ANSI__) */ #if !defined ( _WSTAT_DEFINED) /* also declared in wchar.h */ _CRTIMP int __cdecl __MINGW_NOTHROW _wstat32 (const wchar_t*, struct _stat32*); _CRTIMP int __cdecl __MINGW_NOTHROW _wstat64 (const wchar_t*, struct _stat64*); _CRTIMP int __cdecl __MINGW_NOTHROW _wstat32i64 (const wchar_t*, struct _stat32i64*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wstat64i32 (const wchar_t*, struct _stat64i32*); +int __cdecl __MINGW_NOTHROW _wstat64i32 (const wchar_t*, struct _stat64i32*); +#ifndef __NO_INLINE__ + __CRT_INLINE int __cdecl _wstat64i32(const wchar_t *fname, struct _stat64i32 *_stat) + { + struct _stat64 st; + int ret = _wstat64(fname, &st); + if (ret == -1) { + memset(_stat, 0, sizeof(struct _stat64i32)); + return -1; + } + _stat->st_dev = st.st_dev; + _stat->st_ino = st.st_ino; + _stat->st_mode = st.st_mode; + _stat->st_nlink = st.st_nlink; + _stat->st_uid = st.st_uid; + _stat->st_gid = st.st_gid; + _stat->st_rdev = st.st_rdev; + _stat->st_size = (_off_t) st.st_size; + _stat->st_atime = st.st_atime; + _stat->st_mtime = st.st_mtime; + _stat->st_ctime = st.st_ctime; + return ret; + } +#else +#define _wstat64i32 _wstat64 +#endif #ifdef _USE_32BIT_TIME_T #define _wstat _wstat32 #define _wstati64 _wstat32i64 -#else +#else /* !_USE_32BIT_TIME_T */ #define _wstat _wstat64i32 #define _wstati64 _wstat64 -#endif /* !_USE_32BIT_TIME_T */ +#endif /* _USE_32BIT_TIME_T */ #define _WSTAT_DEFINED #endif /* _WSTAT_DEFIND */ diff --git a/include/time.h b/include/time.h index 2bccfa4..c45e5ba 100644 --- a/include/time.h +++ b/include/time.h @@ -162,6 +162,7 @@ _CRTALIAS char* __cdecl __MINGW_NOTHROW ctime (const time_t* _v) { return( _CRTALIAS struct tm* __cdecl __MINGW_NOTHROW gmtime (const time_t* _v) { return(_gmtime64 (_v)); } _CRTALIAS struct tm* __cdecl __MINGW_NOTHROW localtime (const time_t* _v) { return(_localtime64 (_v)); } #else +#ifdef _HAVE_32BIT_TIME_T _CRTALIAS time_t __cdecl __MINGW_NOTHROW time (time_t* _v) { return(_time32 (_v)); } _CRTALIAS double __cdecl __MINGW_NOTHROW difftime (time_t _v1, time_t _v2) { return(_difftime32 (_v1,_v2)); } _CRTALIAS time_t __cdecl __MINGW_NOTHROW mktime (struct tm* _v) { return(_mktime32 (_v)); } @@ -169,9 +170,17 @@ _CRTALIAS time_t __cdecl __MINGW_NOTHROW _mkgmtime (struct tm* _v) { return _CRTALIAS char* __cdecl __MINGW_NOTHROW ctime (const time_t* _v) { return(_ctime32 (_v)); } _CRTALIAS struct tm* __cdecl __MINGW_NOTHROW gmtime (const time_t* _v) { return(_gmtime32 (_v)); } _CRTALIAS struct tm* __cdecl __MINGW_NOTHROW localtime (const time_t* _v) { return(_localtime32 (_v)); } +#else +_CRTALIAS time_t __cdecl __MINGW_NOTHROW time (time_t* _v) { return((__time32_t)_time64 ((__time64_t)_v)); } +_CRTALIAS double __cdecl __MINGW_NOTHROW difftime (time_t _v1, time_t _v2) { return(_difftime64 ((__time64_t)_v1,(__time64_t)_v2)); } +_CRTALIAS time_t __cdecl __MINGW_NOTHROW mktime (struct tm* _v) { return((__time32_t)_mktime64 (_v)); } +_CRTALIAS time_t __cdecl __MINGW_NOTHROW _mkgmtime (struct tm* _v) { return((__time32_t)_mkgmtime64 (_v)); } +_CRTALIAS char* __cdecl __MINGW_NOTHROW ctime (const time_t* _v) { return(_ctime64 ((__time64_t)_v)); } +_CRTALIAS struct tm* __cdecl __MINGW_NOTHROW gmtime (const time_t* _v) { return(_gmtime64 ((__time64_t)_v)); } +_CRTALIAS struct tm* __cdecl __MINGW_NOTHROW localtime (const time_t* _v) { return(_localtime64 ((__time64_t)_v)); } +#endif /* _HAVE_32BIT_TIME_T */ #endif /* !_USE_32BIT_TIME_T */ - /* * _daylight: non zero if daylight savings time is used. * _timezone: difference in seconds between GMT and local time. diff --git a/include/wchar.h b/include/wchar.h index 4ce793e..87cf639 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -450,26 +450,23 @@ _CRTIMP int __cdecl __MINGW_NOTHROW _wrmdir (const wchar_t*); * invalid, they will cause localtime et. al. to return NULL. And calling * asctime with a NULL pointer causes an Invalid Page Fault. So watch it! */ -struct _stat +struct _stat32 { - _dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */ - _ino_t st_ino; /* Always zero ? */ - _mode_t st_mode; /* See above constants */ - short st_nlink; /* Number of links. */ - short st_uid; /* User: Maybe significant on NT ? */ - short st_gid; /* Group: Ditto */ - _dev_t st_rdev; /* Seems useless (not even filled in) */ - _off_t st_size; /* File size in bytes */ - time_t st_atime; /* Accessed date (always 00:00 hrs local + _dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */ + _ino_t st_ino; /* Always zero ? */ + _mode_t st_mode; /* See above constants */ + short st_nlink; /* Number of links. */ + short st_uid; /* User: Maybe significant on NT ? */ + short st_gid; /* Group: Ditto */ + _dev_t st_rdev; /* Seems useless (not even filled in) */ + _off_t st_size; /* File size in bytes */ + __time32_t st_atime; /* Accessed date (always 00:00 hrs local * on FAT) */ - time_t st_mtime; /* Modified time */ - time_t st_ctime; /* Creation time */ + __time32_t st_mtime; /* Modified time */ + __time32_t st_ctime; /* Creation time */ }; -#ifndef _NO_OLDNAMES -/* NOTE: Must be the same as _stat above. */ -struct stat -{ +struct _stat64 { dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */ ino_t st_ino; /* Always zero ? */ mode_t st_mode; /* See above constants */ @@ -477,18 +474,17 @@ struct stat short st_uid; /* User: Maybe significant on NT ? */ short st_gid; /* Group: Ditto */ dev_t st_rdev; /* Seems useless (not even filled in) */ - off_t st_size; /* File size in bytes */ - time_t st_atime; /* Accessed date (always 00:00 hrs local + __int64 st_size; /* File size in bytes */ + __time64_t st_atime; /* Accessed date (always 00:00 hrs local * on FAT) */ - time_t st_mtime; /* Modified time */ - time_t st_ctime; /* Creation time */ + __time64_t st_mtime; /* Modified time */ + __time64_t st_ctime; /* Creation time */ }; -#endif /* _NO_OLDNAMES */ struct _stati64 { _dev_t st_dev; _ino_t st_ino; - unsigned short st_mode; + _mode_t st_mode; short st_nlink; short st_uid; short st_gid; @@ -498,36 +494,6 @@ struct _stati64 { time_t st_mtime; time_t st_ctime; }; - -struct __stat64 -{ - _dev_t st_dev; - _ino_t st_ino; - _mode_t st_mode; - short st_nlink; - short st_uid; - short st_gid; - _dev_t st_rdev; - __int64 st_size; - __time64_t st_atime; - __time64_t st_mtime; - __time64_t st_ctime; -}; - -struct __stat32 -{ - _dev_t st_dev; - _ino_t st_ino; - _mode_t st_mode; - short st_nlink; - short st_uid; - short st_gid; - _dev_t st_rdev; - __int32 st_size; - __time32_t st_atime; - __time32_t st_mtime; - __time32_t st_ctime; -}; struct _stat32i64 { _dev_t st_dev; _ino_t st_ino; @@ -555,29 +521,63 @@ struct _stat64i32 { __time64_t st_ctime; }; +#define __stat64 _stat64 +#ifdef _USE_32BIT_TIME_T +#define _fstat _fstat32 +#define _fstati64 _fstat32i64 +#define _stat _stat32 +#define _stati64 _stat32i64 +#else /* !_USE_32BIT_TIME_T */ +#define _fstat _fstat64i32 +#define _fstati64 _fstat64 +#define _stat _stat64i32 +#define _stati64 _stat64 +#endif /* _USE_32BIT_TIME_T */ #define _STAT_DEFINED #endif /* _STAT_DEFINED */ -#if !defined ( _WSTAT_DEFINED) -/* also declared in sys/stat.h */ -_CRTIMP int __cdecl __MINGW_NOTHROW _wstat (const wchar_t*, struct _stat*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wstati64 (const wchar_t*, struct _stati64*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wstat64 (const wchar_t*, struct __stat64*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wstat32 (const wchar_t*, struct __stat32*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wstat32i64 (const wchar_t*, struct _stat32i64*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wstat64i32 (const wchar_t*, struct _stat64i32*); +#if !defined ( _WSTAT_DEFINED) /* also declared in sys/stat.h */ +_CRTIMP int __cdecl __MINGW_NOTHROW _wstat32 (const wchar_t*, struct _stat32*); +_CRTIMP int __cdecl __MINGW_NOTHROW _wstat64 (const wchar_t*, struct _stat64*); +_CRTIMP int __cdecl __MINGW_NOTHROW _wstat32i64 (const wchar_t*, struct _stat32i64*); +int __cdecl __MINGW_NOTHROW _wstat64i32 (const wchar_t*, struct _stat64i32*); +#ifndef __NO_INLINE__ + __CRT_INLINE int __cdecl _wstat64i32(const wchar_t *fname, struct _stat64i32 *_stat) + { + struct _stat64 st; + int ret = _wstat64(fname, &st); + if (ret == -1) { + memset(_stat, 0, sizeof(struct _stat64i32)); + return -1; + } + _stat->st_dev = st.st_dev; + _stat->st_ino = st.st_ino; + _stat->st_mode = st.st_mode; + _stat->st_nlink = st.st_nlink; + _stat->st_uid = st.st_uid; + _stat->st_gid = st.st_gid; + _stat->st_rdev = st.st_rdev; + _stat->st_size = (_off_t) st.st_size; + _stat->st_atime = st.st_atime; + _stat->st_mtime = st.st_mtime; + _stat->st_ctime = st.st_ctime; + return ret; + } +#else +#define _wstat64i32 _wstat64 +#endif -#ifndef _USE_32BIT_TIME_T -_CRTALIAS int __cdecl __MINGW_NOTHROW _wstat (const wchar_t* _v1, struct _stat* _v2) { return(_wstat64i32 (_v1,(struct _stat64i32*)_v2)); } -_CRTALIAS int __cdecl __MINGW_NOTHROW _wstati64 (const wchar_t* _v1, struct _stati64* _v2) { return(_wstat64 (_v1,(struct __stat64*)_v2)); } +#ifdef _USE_32BIT_TIME_T +#define _wstat _wstat32 +#define _wstati64 _wstat32i64 #else -_CRTALIAS int __cdecl __MINGW_NOTHROW _wstat (const wchar_t* _v1, struct _stat* _v2) { return(_wstat32 (_v1,(struct __stat32*)_v2)); } -_CRTALIAS int __cdecl __MINGW_NOTHROW _wstati64 (const wchar_t* _v1, struct _stati64* _v2) { return(_wstat32i64 (_v1,(struct _stat32i64*)_v2)); } +#define _wstat _wstat64i32 +#define _wstati64 _wstat64 #endif /* !_USE_32BIT_TIME_T */ #define _WSTAT_DEFINED -#endif /* ! _WSTAT_DEFIND */ +#endif /* _WSTAT_DEFIND */ #ifndef _WLOCALE_DEFINED /* also declared in locale.h */ _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wsetlocale (int, const wchar_t*); diff --git a/include/winuser.h b/include/winuser.h index 88d8506..40c96c1 100644 --- a/include/winuser.h +++ b/include/winuser.h @@ -2115,6 +2115,10 @@ extern "C" { #define MAPVK_VSC_TO_VK_EX 3 #define MAPVK_VK_TO_VSC_EX 4 +#define INPUT_MOUSE 0x00000000 +#define INPUT_KEYBOARD 0x00000001 +#define INPUT_HARDWARE 0x00000002 + #ifndef RC_INVOKED typedef BOOL(CALLBACK *DLGPROC)(HWND,UINT,WPARAM,LPARAM); typedef VOID(CALLBACK *TIMERPROC)(HWND,UINT,UINT,DWORD); @@ -2860,6 +2864,35 @@ typedef struct { ULONG_PTR dwExtraInfo; } MSLLHOOKSTRUCT, *PMSLLHOOKSTRUCT; +typedef struct tagMOUSEINPUT { + LONG dx; + LONG dy; + DWORD mouseData; + DWORD dwFlags; + DWORD time; + ULONG_PTR dwExtraInfo; +} MOUSEINPUT,*PMOUSEINPUT; +typedef struct tagKEYBDINPUT { + WORD wVk; + WORD wScan; + DWORD dwFlags; + DWORD time; + ULONG_PTR dwExtraInfo; +} KEYBDINPUT,*PKEYBDINPUT; +typedef struct tagHARDWAREINPUT { + DWORD uMsg; + WORD wParamL; + WORD wParamH; +} HARDWAREINPUT,*PHARDWAREINPUT; +typedef struct tagINPUT { + DWORD type; + _ANONYMOUS_UNION union { + MOUSEINPUT mi; + KEYBDINPUT ki; + HARDWAREINPUT hi; + } DUMMYUNIONNAME; +} INPUT,*PINPUT,*LPINPUT; + #define AnsiToOem CharToOemA #define OemToAnsi OemToCharA #define AnsiToOemBuff CharToOemBuffA @@ -3375,7 +3408,7 @@ WINUSERAPI BOOL WINAPI ScrollWindow(HWND,int,int,LPCRECT,LPCRECT); WINUSERAPI int WINAPI ScrollWindowEx(HWND,int,int,LPCRECT,LPCRECT,HRGN,LPRECT,UINT); WINUSERAPI LONG WINAPI SendDlgItemMessageA(HWND,int,UINT,WPARAM,LPARAM); WINUSERAPI LONG WINAPI SendDlgItemMessageW(HWND,int,UINT,WPARAM,LPARAM); - +WINUSERAPI UINT WINAPI SendInput(UINT,LPINPUT,int); WINUSERAPI LRESULT WINAPI SendMessageA(HWND,UINT,WPARAM,LPARAM); WINUSERAPI BOOL WINAPI SendMessageCallbackA(HWND,UINT,WPARAM,LPARAM,SENDASYNCPROC,DWORD); WINUSERAPI BOOL WINAPI SendMessageCallbackW(HWND,UINT,WPARAM,LPARAM,SENDASYNCPROC,DWORD); @@ -3689,9 +3722,6 @@ typedef __AW(NONCLIENTMETRICS) NONCLIENTMETRICS,*LPNONCLIENTMETRICS; #define DC_GRADIENT 0x00000020 #define TPM_RECURSE 1 #define SW_SMOOTHSCROLL 0x0010 -#define INPUT_MOUSE 0x00000000 -#define INPUT_KEYBOARD 0x00000001 -#define INPUT_HARDWARE 0x00000002 #define MONITOR_DEFAULTTONULL 0 #define MONITOR_DEFAULTTOPRIMARY 1 #define MONITOR_DEFAULTTONEAREST 2 @@ -3717,34 +3747,6 @@ typedef struct { UINT uCount; DWORD dwTimeout; } FLASHWINFO,*PFLASHWINFO; -typedef struct tagMOUSEINPUT { - LONG dx; - LONG dy; - DWORD mouseData; - DWORD dwFlags; - DWORD time; - ULONG_PTR dwExtraInfo; -} MOUSEINPUT,*PMOUSEINPUT; -typedef struct tagKEYBDINPUT { - WORD wVk; - WORD wScan; - DWORD dwFlags; - DWORD time; - ULONG_PTR dwExtraInfo; -} KEYBDINPUT,*PKEYBDINPUT; -typedef struct tagHARDWAREINPUT { - DWORD uMsg; - WORD wParamL; - WORD wParamH; -} HARDWAREINPUT,*PHARDWAREINPUT; -typedef struct tagINPUT { - DWORD type; - _ANONYMOUS_UNION union { - MOUSEINPUT mi; - KEYBDINPUT ki; - HARDWAREINPUT hi; - } DUMMYUNIONNAME; -} INPUT,*PINPUT,*LPINPUT; WINUSERAPI BOOL WINAPI FlashWindowEx(PFLASHWINFO); WINUSERAPI DWORD WINAPI GetClipboardSequenceNumber(void); WINUSERAPI BOOL WINAPI GetTitleBarInfo(HWND,PTITLEBARINFO); @@ -3752,7 +3754,6 @@ WINUSERAPI DWORD WINAPI InSendMessageEx(LPVOID); WINUSERAPI HMONITOR WINAPI MonitorFromPoint(POINT,DWORD); WINUSERAPI HMONITOR WINAPI MonitorFromRect(LPCRECT,DWORD); WINUSERAPI HMONITOR WINAPI MonitorFromWindow(HWND,DWORD); -WINUSERAPI UINT WINAPI SendInput(UINT,LPINPUT,int); WINUSERAPI BOOL WINAPI UnregisterDeviceNotification(HANDLE); #ifndef NOGDI -- 2.11.0