[Mingw-w64-public] [PATCH] Add vsprintf_s wrapper

2013-05-09 Thread Erik van Pienbroek
Hi,

Recently one of our users reported an issue where an attempt was done to
run a Qt5 based application on Windows XP [1]. Upon startup the user got
a fatal error that the symbol vsprintf_s couldn't be found in
msvcrt.dll. It turned out that this symbol is only available in the
msvcrt.dll in later versions of Windows.

As the mingw-w64-crt already contains various wrappers for other secure
API functions I decided to implement a wrapper for vsprintf_s as well.

We've been using this patch for some time now in Fedora without issues
and we would like to propose it for inclusion in the upstream mingw-w64
repo.

The patch doesn't contain an updated Makefile.in as I'm using a
different version of autotools which causes too much other parts to
change as well, so automake need to be run before committing this patch
(I don't have commit rights to the mingw-w64 repo).

Regards,

Erik van Pienbroek
Fedora MinGW SIG

[1]: https://bugzilla.redhat.com/show_bug.cgi?id=917323
--- mingw-w64-crt/Makefile.am.orig	2013-03-04 19:48:33.103373245 +0100
+++ mingw-w64-crt/Makefile.am	2013-03-04 19:49:42.175932725 +0100
@@ -244,6 +244,7 @@
   secapi/_vcprintf_s.c secapi/_vcprintf_s_l.c \
   secapi/_cwprintf_s.c secapi/_cwprintf_s_l.c \
   secapi/_vcwprintf_s.c secapi/_vcwprintf_s_l.c \
+  secapi/vsprintf_s.c \
   secapi/_access_s.c secapi/_waccess_s.c \
   secapi/_chsize_s.c secapi/_mktemp_s.c secapi/_wmktemp_s.c \
   secapi/_umask_s.c \
--- /dev/null	2013-03-03 23:07:12.487394095 +0100
+++ mingw-w64-crt/secapi/vsprintf_s.c	2013-03-04 19:48:26.188317233 +0100
@@ -0,0 +1,40 @@
+#include 
+#include 
+#include 
+
+HMODULE __mingw_get_msvcrt_handle(void);
+int __cdecl vsprintf (char *, const char *, va_list);
+int __cdecl vsprintf_s (char *, size_t, const char *, va_list);
+static int __cdecl _int_vsprintf_s (char *, size_t, const char *, va_list);
+static int __cdecl _stub (char *, size_t, const char *, va_list);
+
+int __cdecl (*__MINGW_IMP_SYMBOL(vsprintf_s))(char *, size_t, const char *, va_list) = 
+ _stub;
+
+static int __cdecl
+_stub (char *_DstBuf, size_t _Size, const char *_Format, va_list _ArgList)
+{
+  int __cdecl (*f)(char *, size_t, const char *, va_list) = __MINGW_IMP_SYMBOL(vsprintf_s);
+
+  if (f == _stub)
+{
+	f = (int __cdecl (*)(char *, size_t, const char *, va_list))
+	GetProcAddress (__mingw_get_msvcrt_handle (), "vprintf_s");
+	if (!f)
+	  f = _int_vsprintf_s;
+	__MINGW_IMP_SYMBOL(vsprintf_s) = f;
+}
+  return (*f)(_DstBuf, _Size, _Format, _ArgList);
+}
+
+int __cdecl
+vsprintf_s (char *_DstBuf, size_t _Size, const char *_Format, va_list _ArgList)
+{
+  return _stub (_DstBuf, _Size, _Format, _ArgList);
+}
+
+static int __cdecl
+_int_vsprintf_s (char *_DstBuf, size_t _Size, const char *_Format, va_list _ArgList)
+{
+  return vsprintf (_DstBuf, _Format, _ArgList);
+}
--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] [PATCH] Add declaration for HidD_GetHidGuid

2013-05-09 Thread Erik van Pienbroek
Hi,

The attached patch was contributed to us by Conrad Meyer [1] and adds a
declaration for the function HidD_GetHidGuid [2] to hidsdi.h. Could it
be applied in the mingw-w64 repo?

Regards,

Erik van Pienbroek
Fedora MinGW SIG

[1]: https://bugzilla.redhat.com/show_bug.cgi?id=917400
[2]: http://msdn.microsoft.com/en-us/library/ff538924%28v=vs.85%29.aspx

--- mingw-w64-headers/include/hidsdi.h.orig	2013-05-09 13:02:00.501973553 +0200
+++ mingw-w64-headers/include/hidsdi.h	2013-05-09 13:02:42.189673325 +0200
@@ -41,6 +41,10 @@
 HidD_SetFeature(HANDLE HidDeviceObject, PVOID ReportBuffer,
 		ULONG ReportBufferLength);
 
+  /* http://msdn.microsoft.com/en-us/library/ff538924(v=vs.85).aspx */
+HIDAPI VOID NTAPI
+HidD_GetHidGuid(LPGUID HidGuid);
+
 #ifdef __cplusplus
 }
 #endif
--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] [PATCH] Add vsprintf_s wrapper

2013-05-09 Thread Kai Tietz
2013/5/9 Erik van Pienbroek :
> Hi,
>
> Recently one of our users reported an issue where an attempt was done to
> run a Qt5 based application on Windows XP [1]. Upon startup the user got
> a fatal error that the symbol vsprintf_s couldn't be found in
> msvcrt.dll. It turned out that this symbol is only available in the
> msvcrt.dll in later versions of Windows.
>
> As the mingw-w64-crt already contains various wrappers for other secure
> API functions I decided to implement a wrapper for vsprintf_s as well.
>
> We've been using this patch for some time now in Fedora without issues
> and we would like to propose it for inclusion in the upstream mingw-w64
> repo.
>
> The patch doesn't contain an updated Makefile.in as I'm using a
> different version of autotools which causes too much other parts to
> change as well, so automake need to be run before committing this patch
> (I don't have commit rights to the mingw-w64 repo).
>
> Regards,
>
> Erik van Pienbroek
> Fedora MinGW SIG
>
> [1]: https://bugzilla.redhat.com/show_bug.cgi?id=917323

Thanks, patch is ok.  Sadly I don't have right now the proper
autotools available too, so JonY would you mind to commit it and
regenerate the autotool-files?

Thanks in advance,
Kai

--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] [PATCH] Add declaration for HidD_GetHidGuid

2013-05-09 Thread Kai Tietz
Thanks, applied at rev. 5848.

Cheers,
Kai

--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] [PATCH] Add vsprintf_s wrapper

2013-05-09 Thread JonY
On 5/9/2013 19:39, Kai Tietz wrote:
> 2013/5/9 Erik van Pienbroek:
>> Hi,
>>
>> Recently one of our users reported an issue where an attempt was done to
>> run a Qt5 based application on Windows XP [1]. Upon startup the user got
>> a fatal error that the symbol vsprintf_s couldn't be found in
>> msvcrt.dll. It turned out that this symbol is only available in the
>> msvcrt.dll in later versions of Windows.
>>
>> As the mingw-w64-crt already contains various wrappers for other secure
>> API functions I decided to implement a wrapper for vsprintf_s as well.
>>
>> We've been using this patch for some time now in Fedora without issues
>> and we would like to propose it for inclusion in the upstream mingw-w64
>> repo.
>>
>> The patch doesn't contain an updated Makefile.in as I'm using a
>> different version of autotools which causes too much other parts to
>> change as well, so automake need to be run before committing this patch
>> (I don't have commit rights to the mingw-w64 repo).
>>
>> Regards,
>>
>> Erik van Pienbroek
>> Fedora MinGW SIG
>>
>> [1]: https://bugzilla.redhat.com/show_bug.cgi?id=917323
> 
> Thanks, patch is ok.  Sadly I don't have right now the proper
> autotools available too, so JonY would you mind to commit it and
> regenerate the autotool-files?
> 
> Thanks in advance,
> Kai
> 

Done as trunk r5849.




signature.asc
Description: OpenPGP digital signature
--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public