Re: [Mingw-w64-public] [PATCH] headers: Add coclasses in rdpencomapi.idl

2021-04-28 Thread Liu Hao

在 2021-04-29 01:47, Biswapriyo Nath 写道:

It seems that lh_mouse misses my previous updated patch of
rdpencomapi.idl. I should have sent full patch at once. But no
problem. Here is the addition to that rdpencomapi.idl. Also
Makefile.in was not regenerated last time.



Oops, apologies. Updated and pushed. Thanks!


--
Best regards,
Liu Hao



OpenPGP_signature
Description: OpenPGP digital signature
___
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] crt: Increase precision of gettimeofday() if possible.

2021-04-28 Thread Vincent Torri
On Wed, Apr 28, 2021 at 9:35 PM Christian Franke
 wrote:
>
> Liu Hao wrote:
> > 在 4/27/21 2:00 AM, Christian Franke 写道:
> >>
> >> Which complexity do you mean - the extra cost of the system call or
> >> the extra 15 lines of code?
> >>
> >
> > It's actually both.
> >
> > Wall clocks are not meant to be steady, because they are free to jump
> > back and forth due to NTP synchronization, and arithmetic operations
> > aren't predicable either due to leap seconds.
>
> That's all correct. But there are several use cases where a higher than
> this ~15.6ms (1/64s) resolution is needed and where occasional clock
> jumps are acceptable - for example debug logs.
>
> If there were no use cases, the evolution
>time() -> ftime(...) -> gettimeofday(...) ->
> clock_gettime(CLOCK_REALTIME,...)
> would possibly never have happened :-)
>
> BTW.1: Hack:
> Do this once in the program
>#ifdef _WIN32
>  timeBeginPeriod(1);

https://docs.microsoft.com/fr-fr/windows/win32/api/timeapi/nf-timeapi-timebeginperiod?redirectedfrom=MSDN

"Setting a higher resolution can improve the accuracy of time-out
intervals in wait functions. However, it can also reduce overall
system performance, because the thread scheduler switches tasks more
often. High resolutions can also prevent the CPU power management
system from entering power-saving modes. "

also, just for more information about this discussion:
https://devblogs.microsoft.com/oldnewthing/20170921-00/?p=97057

Vincent Torri


___
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] crt: Increase precision of gettimeofday() if possible.

2021-04-28 Thread Christian Franke

Liu Hao wrote:

在 4/27/21 2:00 AM, Christian Franke 写道:


Which complexity do you mean - the extra cost of the system call or 
the extra 15 lines of code?




It's actually both.

Wall clocks are not meant to be steady, because they are free to jump 
back and forth due to NTP synchronization, and arithmetic operations 
aren't predicable either due to leap seconds. 


That's all correct. But there are several use cases where a higher than 
this ~15.6ms (1/64s) resolution is needed and where occasional clock 
jumps are acceptable - for example debug logs.


If there were no use cases, the evolution
  time() -> ftime(...) -> gettimeofday(...) -> 
clock_gettime(CLOCK_REALTIME,...)

would possibly never have happened :-)

BTW.1: Hack:
Do this once in the program
  #ifdef _WIN32
    timeBeginPeriod(1);
  #endif
or start another program which does: Playback a video, run a VM in VBox, 
run VS 2019, ...
... and the resolution of GetSystemTimeAsFileTime() increases from 1/64s 
to 1-2ms.


BTW.2: The *ftime*() functions from newer versions of MSVC CRT also use 
GetSystemTimePreciseAsFileTime() if available.



Introduction of more overhead upon each call, for some unpredictable 
and unreliable accuracy, is futile.


I guess then it is not worth the effort to provide a related patch for 
clock_gettime(CLOCK_REALTIME, ...) ?-)





There are also some issues in this patch. You can't assign a `void*` 
to a pointer-to-function.


The 'void *' was a hack to silence this warning from gcc 10.2.0:

get_time = (GetSystemTimeAsFileTime_t) GetProcAddress (...)
"warning: cast between incompatible function types from ‘FARPROC’ {aka 
‘long long int (*)()’} to ‘void (*)(struct _FILETIME *)’ 
[-Wcast-function-type]"


A detour via 'intptr_t' would also help but might be considered as ugly 
as 'void *':


get_time = (GetSystemTimeAsFileTime_t)(intptr_t) GetProcAddress (...)


And you can't use `volatile` variables for synchronization; you have 
to use `_Atomic` which yet adds more complexity in code.


That's right, in theory, 'volatile' would still allow to read the 
pointer in two halves or so. Using '_Atomic' instead actually changes 
the code generated by gcc 10.2.0 -O2, but only few register assignments 
but no memory accesses.








AFAICS, my patch would switch the Mingw-w64 column to '2'.

BTW: None of the above provide an extra high_resolution_clock:
GNU Libstdc++ Headers: using high_resolution_clock = system_clock;
Cygwin (Clang headers), MSVC16: using high_resolution_clock = 
steady_clock;




`high_resolution_clock` should call `QueryPerformanceCounter()` on 
Windows or `clock_gettime()` on POSIX systems. `gettimeofday()` is 
apparently not an option, as it is not suitable for measurement. The 
libstdc++ implementation should be considered faulty. I suggest people 
avoid its use.




Several issues accumulate here:
- The Mingw-w64 implementations of 'gettimeofday()' and 
'clock_gettime(CLOCK_REALTIME,...)' provide only 1/64s resolution.
- Mingw-w64 libstdc++ packages are usually configured with 
_GLIBCXX_USE_GETTIMEOFDAY set and _GLIBCXX_USE_CLOCK_REALTIME and 
..._MONOTONIC unset.
- Libstdc++ sets 'using high_resolution_clock = system_clock'. This 
should be configurable.
As a consequence, the steady_clock is not steady and the 
high_resolution_clock has no high resolution.


- Defining _GLIBCXX_USE_CLOCK_MONOTONIC would fix the steady_clock. 
Drawback: Without '-static', the 'libwinpthreads-1.dll' is required.
- And then  'using high_resolution_clock = steady_clock' would fix the 
high_resolution clock. Drawback: same as above + fix is outside 
Mingw-w64 source tree.


--
Best regards,
Christian Franke



___
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] crt: Increase precision of gettimeofday() if possible.

2021-04-28 Thread sotrdg sotrdg
https://github.com/expnkx/fast_io/blob/725695664091bc4e8fbb05df446aaad93642bbf5/include/fast_io_hosted/time.h#L406
This is my implementation for clock_gettime

Sent from Mail for Windows 10

From: Corinna Vinschen
Sent: Wednesday, April 28, 2021 15:05
To: 
mingw-w64-public@lists.sourceforge.net
Subject: Re: [Mingw-w64-public] [PATCH] crt: Increase precision of 
gettimeofday() if possible.

On Apr 26 20:00, Christian Franke wrote:
> System calls and resolutions of C++11 clocks:
>
>Mingw-w64 MSVC16  Cygwin
> system_clock::now()   12   2
> steady_clock::now()   13   3
> high_resolution_clock::now()  13   3
>
> where
> 1: GetSystemTimeAsFileTime: >15ms to 1ms (unpredictable)
> 2: GetSystemTimePreciseAsFileTime: <1us
> 3: QueryPerformanceCounter: <500ns

Not quite.  Newer Windows versions support better alternatives compared
to QueryPerformanceCounter.  Thus on newer systems Cygwin uses

  QueryUnbiasedInterruptTimePrecise for CLOCK_MONOTONIC{_RAW}
  QueryUnbiasedInterruptTimefor CLOCK_MONOTONIC_COARSE
  QueryInterruptTimePrecise for CLOCK_BOOTTIME{_ALARM}

and, of course

  GetSystemTimePreciseAsFileTimefor CLOCK_REALTIME
  GetSystemTimeAsFileTime   for CLOCK_REALTIME_COARSE

Apart from style issues, I vote for using GetSystemTimePreciseAsFileTime
for CLOCK_REALTIME and only fall back to GetSystemTimeAsFileTime for
CLOCK_REALTIME_COARSE or if the OS doesn't support the precise call.

Please do keep in mind that there are assumptions of a minimum
precision of gettimeofday in the wild, which are not really in our
hands.  If we can avoid upstream code to #ifdef time computations
for Mingw separately, rather than just using gettimeofday on all
supported platforms, it's certainly a win-win, isn't it?


Corinna



___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


___
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] crt: Increase precision of gettimeofday() if possible.

2021-04-28 Thread Corinna Vinschen
On Apr 26 20:00, Christian Franke wrote:
> System calls and resolutions of C++11 clocks:
> 
>    Mingw-w64 MSVC16  Cygwin
> system_clock::now()   1    2   2
> steady_clock::now()   1    3   3
> high_resolution_clock::now()  1    3   3
> 
> where
> 1: GetSystemTimeAsFileTime: >15ms to 1ms (unpredictable)
> 2: GetSystemTimePreciseAsFileTime: <1us
> 3: QueryPerformanceCounter: <500ns

Not quite.  Newer Windows versions support better alternatives compared
to QueryPerformanceCounter.  Thus on newer systems Cygwin uses

  QueryUnbiasedInterruptTimePrecise for CLOCK_MONOTONIC{_RAW}
  QueryUnbiasedInterruptTimefor CLOCK_MONOTONIC_COARSE
  QueryInterruptTimePrecise for CLOCK_BOOTTIME{_ALARM}

and, of course

  GetSystemTimePreciseAsFileTimefor CLOCK_REALTIME
  GetSystemTimeAsFileTime   for CLOCK_REALTIME_COARSE

Apart from style issues, I vote for using GetSystemTimePreciseAsFileTime
for CLOCK_REALTIME and only fall back to GetSystemTimeAsFileTime for
CLOCK_REALTIME_COARSE or if the OS doesn't support the precise call.

Please do keep in mind that there are assumptions of a minimum 
precision of gettimeofday in the wild, which are not really in our
hands.  If we can avoid upstream code to #ifdef time computations
for Mingw separately, rather than just using gettimeofday on all
supported platforms, it's certainly a win-win, isn't it?


Corinna



___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] [PATCH] headers: Add coclasses in rdpencomapi.idl

2021-04-28 Thread Biswapriyo Nath
It seems that lh_mouse misses my previous updated patch of
rdpencomapi.idl. I should have sent full patch at once. But no
problem. Here is the addition to that rdpencomapi.idl. Also
Makefile.in was not regenerated last time.
From aa44619f81115fab1cc41804d9531295a87db7f0 Mon Sep 17 00:00:00 2001
From: Biswapriyo Nath 
Date: Wed, 28 Apr 2021 23:12:56 +0530
Subject: [PATCH] headers: Add coclasses in rdpencomapi.idl

Signed-off-by: Biswapriyo Nath 
---
 mingw-w64-headers/include/rdpencomapi.idl | 318 ++
 1 file changed, 318 insertions(+)

diff --git a/mingw-w64-headers/include/rdpencomapi.idl 
b/mingw-w64-headers/include/rdpencomapi.idl
index 121f29d..0dbc4ef 100644
--- a/mingw-w64-headers/include/rdpencomapi.idl
+++ b/mingw-w64-headers/include/rdpencomapi.idl
@@ -617,4 +617,322 @@ interface IRDPSRAPITransportStreamBuffer : IUnknown
   HRESULT Context([in] IUnknown *pContext);
 }
 
+[object, uuid(ea81c254-f5af-4e40-982e-3e63bb595276), local, 
pointer_default(unique)]
+interface IRDPSRAPITransportStreamEvents : IUnknown
+{
+  [id(DISPID_RDPSRAPI_EVENT_ON_STREAM_SENDCOMPLETED)]
+  void OnWriteCompleted([in] IRDPSRAPITransportStreamBuffer *pBuffer);
+
+  [id(DISPID_RDPSRAPI_EVENT_ON_STREAM_DATARECEIVED)]
+  void OnReadCompleted([in] IRDPSRAPITransportStreamBuffer *pBuffer);
+
+  [id(DISPID_RDPSRAPI_EVENT_ON_STREAM_CLOSED)]
+  void OnStreamClosed([in] HRESULT hrReason);
+}
+
+[object, uuid(36cfa065-43bb-4ef7-aed7-9b88a5053036), pointer_default(unique)]
+interface IRDPSRAPITransportStream : IUnknown
+{
+  [id(DISPID_RDPSRAPI_METHOD_STREAM_ALLOCBUFFER)]
+  HRESULT AllocBuffer([in] long maxPayload, [out, retval] 
IRDPSRAPITransportStreamBuffer **ppBuffer);
+
+  [id(DISPID_RDPSRAPI_METHOD_STREAM_FREEBUFFER)]
+  HRESULT FreeBuffer([in] IRDPSRAPITransportStreamBuffer *pBuffer);
+
+  [id(DISPID_RDPSRAPI_METHOD_STREAMSENDDATA)]
+  HRESULT WriteBuffer([in] IRDPSRAPITransportStreamBuffer *pBuffer);
+
+  [id(DISPID_RDPSRAPI_METHOD_STREAMREADDATA)]
+  HRESULT ReadBuffer([in] IRDPSRAPITransportStreamBuffer *pBuffer);
+
+  [id(DISPID_RDPSRAPI_METHOD_STREAMOPEN)]
+  HRESULT Open([in] IRDPSRAPITransportStreamEvents *pCallbacks);
+
+  [id(DISPID_RDPSRAPI_METHOD_STREAMCLOSE)]
+  HRESULT Close(void);
+}
+
+[object, uuid(eeb20886-e470-4cf6-842b-2739c0ec5cfb), dual, 
pointer_default(unique)]
+interface IRDPSRAPISharingSession : IDispatch
+{
+  [id(DISPID_RDPSRAPI_METHOD_OPEN)]
+  HRESULT Open(void);
+
+  [id(DISPID_RDPSRAPI_METHOD_CLOSE)]
+  HRESULT Close(void);
+
+  [propput, id(DISPID_RDPSRAPI_PROP_SESSION_COLORDEPTH)]
+  HRESULT ColorDepth([in] long colorDepth);
+
+  [propget, id(DISPID_RDPSRAPI_PROP_SESSION_COLORDEPTH)]
+  HRESULT ColorDepth([out, retval] long *pColorDepth);
+
+  [propget, id(DISPID_RDPSRAPI_PROP_SESSION_PROPERTIES)]
+  HRESULT Properties([out, retval] IRDPSRAPISessionProperties **ppVal);
+
+  [propget, id(DISPID_RDPSRAPI_PROP_ATTENDEES)]
+  HRESULT Attendees([out, retval] IRDPSRAPIAttendeeManager **ppVal);
+
+  [propget, id(DISPID_RDPSRAPI_PROP_INVITATIONS)]
+  HRESULT Invitations([out, retval] IRDPSRAPIInvitationManager **ppVal);
+
+  [propget, id(DISPID_RDPSRAPI_PROP_APPLICATION_FILTER)]
+  HRESULT ApplicationFilter([out, retval] IRDPSRAPIApplicationFilter **ppVal);
+
+  [propget, id(DISPID_RDPSRAPI_PROP_CHANNELMANAGER)]
+  HRESULT VirtualChannelManager([out, retval] IRDPSRAPIVirtualChannelManager 
**ppVal);
+
+  [id(DISPID_RDPSRAPI_METHOD_PAUSE)]
+  HRESULT Pause(void);
+
+  [id(DISPID_RDPSRAPI_METHOD_RESUME)]
+  HRESULT Resume(void);
+
+  [id(DISPID_RDPSRAPI_METHOD_CONNECTTOCLIENT)]
+  HRESULT ConnectToClient([in] BSTR bstrConnectionString);
+
+  [id(DISPID_RDPSRAPI_METHOD_SETSHAREDRECT)]
+  HRESULT SetDesktopSharedRect([in] long left, [in] long top, [in] long right, 
[in] long bottom);
+
+  [id(DISPID_RDPSRAPI_METHOD_GETSHAREDRECT)]
+  HRESULT GetDesktopSharedRect([out] long *pleft, [out] long *ptop, [out] long 
*pright, [out] long *pbottom);
+}
+
+[object, uuid(fee4ee57-e3e8-4205-8fb0-8fd1d0675c21), dual, 
pointer_default(unique)]
+interface IRDPSRAPISharingSession2 : IRDPSRAPISharingSession
+{
+  [id(DISPID_RDPSRAPI_METHOD_CONNECTUSINGTRANSPORTSTREAM)]
+  HRESULT ConnectUsingTransportStream([in] IRDPSRAPITransportStream *pStream, 
[in] BSTR bstrGroup, [in] BSTR bstrAuthenticatedAttendeeName);
+
+  [propget, id(DISPID_RDPSRAPI_PROP_FRAMEBUFFER)]
+  HRESULT FrameBuffer([out, retval] IRDPSRAPIFrameBuffer **ppVal);
+
+  [id(DISPID_RDPSRAPI_METHOD_SENDCONTROLLEVELCHANGERESPONSE)]
+  HRESULT SendControlLevelChangeResponse([in] IRDPSRAPIAttendee *pAttendee, 
[in] CTRL_LEVEL RequestedLevel, [in] long ReasonCode);
+}
+
+[uuid(cc802d05-ae07-4c15-b496-db9d22aa0a84), version(1.0)]
+library RDPCOMAPILib
+{
+  importlib("stdole32.tlb");
+  importlib("stdole2.tlb");
+
+  typedef enum
+  {
+CONST_MAX_CHANNEL_MESSAGE_SIZE = 1024,
+CONST_MAX_CHANNEL_NAME_LEN = 8,
+CONST_MAX_LEGACY_CHANNEL_MESSAGE_SIZE = 409600,
+CONST_ATTENDEE_ID_EVERYONE = -1,
+CONST_ATTENDEE_ID_HOST = 0,
+

Re: [Mingw-w64-public] Add missing function declarations to mingw-w64-headers/include/shlwapi.h

2021-04-28 Thread DAVID MAY
Thank you for your feedback.

I removed those changes.  Updated patch attached.

--
David May

On 28/04/2021 5:59 pm, Liu Hao wrote:
> 在 4/28/21 12:50 PM, DAVID MAY 写道:
>> Thanks for the feedback.
>>
>> Regarding points 1 and 2: While changing the #ifdefs and adding comments
>> (actually just labels) was not necessary, keeping track of the
>> unlabelled #ifdefs and #ifs gave me headaches.  The labels helped.
>> Anyway, all labels are now removed.
>>
>> Regarding point 3:  I have changed the code to C89 style and added a
>> check for C89 conformance to my tests.
>>
>> An updated patch is attached.
>>
> 
> The reason why sometimes `#ifndef ...` is preferred to `#if
> !defined(...)` is that the former is aligned with `#define ...` in an
> editor, like this:
> 
>   ```
>   #ifndef SOME_MACRO
>   #define SOME_MACRO 1
>   #endif
>   ```
> 
> And please submit an isolated and atomic patch - not one that changes
> `#ifndef` to `#if !defined`, and adds other stuff at the same time. If
> it is really necessary for you, please send a distinct patch.
> 
> 
--- doc/mingw64-shlwapi.h   2021-04-28 21:40:36.145098000 +0800
+++ shlwapi.h   2021-04-28 22:01:14.220795200 +0800
@@ -14,6 +14,7 @@
 #include 
 #include 
 
+#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM) 
 #ifndef WINSHLWAPI
 #if !defined(_SHLWAPI_)
 #define LWSTDAPI EXTERN_C DECLSPEC_IMPORT HRESULT WINAPI
@@ -28,8 +29,6 @@
 #endif
 #endif
 
-#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
-
 #ifndef _WINRESRC_
 #ifndef _WIN32_IE
 #define _WIN32_IE 0x0601
@@ -38,6 +37,11 @@
 
 #include 
 
+#ifndef __IBindCtx_FWD_DEFINED__
+#define __IBindCtx_FWD_DEFINED__
+  typedef interface IBindCtx IBindCtx;
+#endif 
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -47,10 +51,23 @@
   LWSTDAPI_(LPWSTR) StrChrW(LPCWSTR lpStart,WCHAR wMatch);
   LWSTDAPI_(LPSTR) StrChrIA(LPCSTR lpStart,WORD wMatch);
   LWSTDAPI_(LPWSTR) StrChrIW(LPCWSTR lpStart,WCHAR wMatch);
+  LWSTDAPI_(PCWSTR) StrChrNW(PCWSTR pszStart, WCHAR wMatch, UINT cchMax);
+  LWSTDAPI_(PCWSTR) StrChrNIW(PCWSTR pszStart, WCHAR wMatch, UINT cchMax);
   LWSTDAPI_(int) StrCmpNA(LPCSTR lpStr1,LPCSTR lpStr2,int nChar);
   LWSTDAPI_(int) StrCmpNW(LPCWSTR lpStr1,LPCWSTR lpStr2,int nChar);
   LWSTDAPI_(int) StrCmpNIA(LPCSTR lpStr1,LPCSTR lpStr2,int nChar);
   LWSTDAPI_(int) StrCmpNIW(LPCWSTR lpStr1,LPCWSTR lpStr2,int nChar);
+
+  LWSTDAPI_(int) StrCmpNCA(LPCSTR pszStr1, LPCSTR pszStr2, int nChar);
+  LWSTDAPI_(int) StrCmpNCW(LPCWSTR pszStr1, LPCWSTR pszStr2, int nChar);
+
+#define StrCmpNC __MINGW_NAME_AW(StrCmpNC)
+
+  LWSTDAPI_(int)  StrCmpNICA(LPCSTR pszStr1, LPCSTR pszStr2, int nChar);
+  LWSTDAPI_(int)  StrCmpNICW(LPCWSTR pszStr1, LPCWSTR pszStr2, int nChar);
+
+#define StrCmpNIC __MINGW_NAME_AW(StrCmpNIC)
+
   LWSTDAPI_(int) StrCSpnA(LPCSTR lpStr,LPCSTR lpSet);
   LWSTDAPI_(int) StrCSpnW(LPCWSTR lpStr,LPCWSTR lpSet);
   LWSTDAPI_(int) StrCSpnIA(LPCSTR lpStr,LPCSTR lpSet);
@@ -82,13 +99,20 @@
   LWSTDAPI_(LPWSTR) StrStrW(LPCWSTR lpFirst,LPCWSTR lpSrch);
   LWSTDAPI_(LPSTR) StrStrIA(LPCSTR lpFirst,LPCSTR lpSrch);
   LWSTDAPI_(LPWSTR) StrStrIW(LPCWSTR lpFirst,LPCWSTR lpSrch);
+  LWSTDAPI_(PCWSTR) StrStrNW(PCWSTR pszFirst, PCWSTR pszSrch, UINT cchMax);
+  LWSTDAPI_(PCWSTR) StrStrNIW(PCWSTR pszFirst, PCWSTR pszSrch, UINT cchMax);
   LWSTDAPI_(int) StrToIntA(LPCSTR lpSrc);
   LWSTDAPI_(int) StrToIntW(LPCWSTR lpSrc);
-  LWSTDAPI_(WINBOOL) StrToIntExA(LPCSTR pszString,DWORD dwFlags,int *piRet);
-  LWSTDAPI_(WINBOOL) StrToIntExW(LPCWSTR pszString,DWORD dwFlags,int *piRet);
+
+#define STIF_DEFAULT __MSABI_LONG(0x)
+#define STIF_SUPPORT_HEX __MSABI_LONG(0x0001)
+  typedef int STIF_FLAGS;
+
+  LWSTDAPI_(WINBOOL) StrToIntExA(LPCSTR pszString,STIF_FLAGS dwFlags,int 
*piRet);
+  LWSTDAPI_(WINBOOL) StrToIntExW(LPCWSTR pszString,STIF_FLAGS dwFlags,int 
*piRet);
 #if (_WIN32_IE >= 0x0600)
-  LWSTDAPI_(WINBOOL) StrToInt64ExA(LPCSTR pszString,DWORD dwFlags,LONGLONG 
*pllRet);
-  LWSTDAPI_(WINBOOL) StrToInt64ExW(LPCWSTR pszString,DWORD dwFlags,LONGLONG 
*pllRet);
+  LWSTDAPI_(WINBOOL) StrToInt64ExA(LPCSTR pszString,STIF_FLAGS 
dwFlags,LONGLONG *pllRet);
+  LWSTDAPI_(WINBOOL) StrToInt64ExW(LPCWSTR pszString,STIF_FLAGS 
dwFlags,LONGLONG *pllRet);
 #endif
   LWSTDAPI_(WINBOOL) StrTrimA(LPSTR psz,LPCSTR pszTrimChars);
   LWSTDAPI_(WINBOOL) StrTrimW(LPWSTR psz,LPCWSTR pszTrimChars);
@@ -122,9 +146,25 @@
   LWSTDAPI StrRetToBSTR(STRRET *pstr,LPCITEMIDLIST pidl,BSTR *pbstr);
   LWSTDAPI SHStrDupA(LPCSTR psz,WCHAR **ppwsz);
   LWSTDAPI SHStrDupW(LPCWSTR psz,WCHAR **ppwsz);
+
+#ifdef __cplusplus
+  inline HRESULT SHLocalStrDupW(PCWSTR psz, PWSTR *ppsz) {
+*ppsz = StrDupW(psz);
+return *ppsz ? S_OK : E_OUTOFMEMORY;
+  }
+
+  inline HRESULT SHLocalStrDupA(PCSTR psz, PSTR *ppsz) {
+*ppsz = StrDupA(psz);
+return *ppsz ? S_OK : E_OUTOFMEMORY;
+  }
+
+#define SHLocalStrDup __MINGW_NAME_AW(SHLocalStrDup)
+#endif 
+
   LWSTDAPI_(int) StrCmpLogicalW(LPCWSTR psz1,LPCWSTR psz2);
   

Re: [Mingw-w64-public] [PATCH] headers/sec_api: Add strnlen_s definition.

2021-04-28 Thread Liu Hao

在 2021-04-28 14:31, Biswapriyo Nath 写道:

Subject: [PATCH] headers/sec_api: Add strnlen_s definition.

Signed-off-by: Biswapriyo Nath
---
  mingw-w64-headers/crt/sec_api/string_s.h | 4 
  1 file changed, 4 insertions(+)


Subject: [PATCH] headers: Add rdpencomapi.idl file.

Signed-off-by: Biswapriyo Nath 
---
 mingw-w64-headers/Makefile.am |   1 +
 mingw-w64-headers/include/rdpencomapi.idl | 620 ++
 2 files changed, 621 insertions(+)
 create mode 100644 mingw-w64-headers/include/rdpencomapi.idl



Thanks. These patches look good to me. I pushed them to master.


--
Best regards,
Liu Hao



OpenPGP_signature
Description: OpenPGP digital signature
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] Add missing function declarations to mingw-w64-headers/include/shlwapi.h

2021-04-28 Thread Liu Hao

在 4/28/21 12:50 PM, DAVID MAY 写道:

Thanks for the feedback.

Regarding points 1 and 2: While changing the #ifdefs and adding comments
(actually just labels) was not necessary, keeping track of the
unlabelled #ifdefs and #ifs gave me headaches.  The labels helped.
Anyway, all labels are now removed.

Regarding point 3:  I have changed the code to C89 style and added a
check for C89 conformance to my tests.

An updated patch is attached.



The reason why sometimes `#ifndef ...` is preferred to `#if !defined(...)` is that the former is 
aligned with `#define ...` in an editor, like this:


  ```
  #ifndef SOME_MACRO
  #define SOME_MACRO 1
  #endif
  ```

And please submit an isolated and atomic patch - not one that changes `#ifndef` to `#if !defined`, 
and adds other stuff at the same time. If it is really necessary for you, please send a distinct patch.



--
Best regards,
Liu Hao



OpenPGP_signature
Description: OpenPGP digital signature
___
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] crt: Increase precision of gettimeofday() if possible.

2021-04-28 Thread Liu Hao

在 4/27/21 2:00 AM, Christian Franke 写道:


Which complexity do you mean - the extra cost of the system call or the extra 
15 lines of code?



It's actually both.

Wall clocks are not meant to be steady, because they are free to jump back and forth due to NTP 
synchronization, and arithmetic operations aren't predicable either due to leap seconds. 
Introduction of more overhead upon each call, for some unpredictable and unreliable accuracy, is futile.


There are also some issues in this patch. You can't assign a `void*` to a pointer-to-function. And 
you can't use `volatile` variables for synchronization; you have to use `_Atomic` which yet adds 
more complexity in code.





AFAICS, my patch would switch the Mingw-w64 column to '2'.

BTW: None of the above provide an extra high_resolution_clock:
GNU Libstdc++ Headers: using high_resolution_clock = system_clock;
Cygwin (Clang headers), MSVC16: using high_resolution_clock = steady_clock;



`high_resolution_clock` should call `QueryPerformanceCounter()` on Windows or `clock_gettime()` on 
POSIX systems. `gettimeofday()` is apparently not an option, as it is not suitable for measurement. 
The libstdc++ implementation should be considered faulty. I suggest people avoid its use.



--
Best regards,
Liu Hao



OpenPGP_signature
Description: OpenPGP digital signature
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] [PATCH] headers/sec_api: Add strnlen_s definition.

2021-04-28 Thread Biswapriyo Nath

From 130a886913d019bd19e8b3cc02873a40a890e000 Mon Sep 17 00:00:00 2001
From: Biswapriyo Nath 
Date: Wed, 28 Apr 2021 12:00:37 +0530
Subject: [PATCH] headers/sec_api: Add strnlen_s definition.

Signed-off-by: Biswapriyo Nath 
---
 mingw-w64-headers/crt/sec_api/string_s.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/mingw-w64-headers/crt/sec_api/string_s.h 
b/mingw-w64-headers/crt/sec_api/string_s.h
index 8f29587..f1a9e34 100644
--- a/mingw-w64-headers/crt/sec_api/string_s.h
+++ b/mingw-w64-headers/crt/sec_api/string_s.h
@@ -43,6 +43,10 @@ extern "C" {
   _CRTIMP errno_t __cdecl strcat_s(char *_Dst, rsize_t _SizeInBytes, const 
char * _Src);
   __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1(errno_t, strcat_s, char, _Dest, const 
char *, _Source)
 
+  __forceinline size_t __cdecl strnlen_s(const char * _src, size_t _count) {
+return _src ? strnlen(_src, _count) : 0;
+  }
+
   _SECIMP errno_t __cdecl memmove_s(void *_dest,size_t _numberOfElements,const 
void *_src,size_t _count);
 #ifndef _WSTRING_S_DEFINED
 #define _WSTRING_S_DEFINED
-- 
2.31.1

___
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] headers: Add rdpencomapi.idl file.

2021-04-28 Thread Biswapriyo Nath
Forgot to add the coclasses. Here is the new updated patch.

On Wed, Apr 28, 2021 at 1:49 AM Biswapriyo Nath  wrote:
>
>
From 2b091db263eca8253850918436d8c7199efa7a7e Mon Sep 17 00:00:00 2001
From: Biswapriyo Nath 
Date: Wed, 28 Apr 2021 11:58:16 +0530
Subject: [PATCH] headers: Add rdpencomapi.idl file.

Signed-off-by: Biswapriyo Nath 
---
 mingw-w64-headers/Makefile.am |   1 +
 mingw-w64-headers/include/rdpencomapi.idl | 938 ++
 2 files changed, 939 insertions(+)
 create mode 100644 mingw-w64-headers/include/rdpencomapi.idl

diff --git a/mingw-w64-headers/Makefile.am b/mingw-w64-headers/Makefile.am
index 35900d5..6e8bc73 100644
--- a/mingw-w64-headers/Makefile.am
+++ b/mingw-w64-headers/Makefile.am
@@ -188,6 +188,7 @@ IDL_SRCS = \
   include/portabledevicetypes.idl \
   include/propidl.idl \
   include/propsys.idl \
+  include/rdpencomapi.idl \
   include/regbag.idl \
   include/sapi51.idl \
   include/sapi53.idl \
diff --git a/mingw-w64-headers/include/rdpencomapi.idl 
b/mingw-w64-headers/include/rdpencomapi.idl
new file mode 100644
index 000..0dbc4ef
--- /dev/null
+++ b/mingw-w64-headers/include/rdpencomapi.idl
@@ -0,0 +1,938 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+
+import "oaidl.idl";
+import "ocidl.idl";
+
+cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)")
+
+const int DISPID_RDPSRAPI_METHOD_OPEN = 100;
+const int DISPID_RDPSRAPI_METHOD_CLOSE = 101;
+const int DISPID_RDPSRAPI_METHOD_SETSHAREDRECT = 102;
+const int DISPID_RDPSRAPI_METHOD_GETSHAREDRECT = 103;
+const int DISPID_RDPSRAPI_METHOD_VIEWERCONNECT = 104;
+const int DISPID_RDPSRAPI_METHOD_VIEWERDISCONNECT = 105;
+const int DISPID_RDPSRAPI_METHOD_TERMINATE_CONNECTION = 106;
+const int DISPID_RDPSRAPI_METHOD_CREATE_INVITATION = 107;
+const int DISPID_RDPSRAPI_METHOD_REQUEST_CONTROL = 108;
+const int DISPID_RDPSRAPI_METHOD_VIRTUAL_CHANNEL_CREATE = 109;
+const int DISPID_RDPSRAPI_METHOD_VIRTUAL_CHANNEL_SEND_DATA = 110;
+const int DISPID_RDPSRAPI_METHOD_VIRTUAL_CHANNEL_SET_ACCESS = 111;
+const int DISPID_RDPSRAPI_METHOD_PAUSE = 112;
+const int DISPID_RDPSRAPI_METHOD_RESUME = 113;
+const int DISPID_RDPSRAPI_METHOD_SHOW_WINDOW = 114;
+const int DISPID_RDPSRAPI_METHOD_REQUEST_COLOR_DEPTH_CHANGE = 115;
+const int DISPID_RDPSRAPI_METHOD_STARTREVCONNECTLISTENER = 116;
+const int DISPID_RDPSRAPI_METHOD_CONNECTTOCLIENT = 117;
+const int DISPID_RDPSRAPI_METHOD_SET_RENDERING_SURFACE = 118;
+const int DISPID_RDPSRAPI_METHOD_SEND_MOUSE_BUTTON_EVENT = 119;
+const int DISPID_RDPSRAPI_METHOD_SEND_MOUSE_MOVE_EVENT = 120;
+const int DISPID_RDPSRAPI_METHOD_SEND_MOUSE_WHEEL_EVENT = 121;
+const int DISPID_RDPSRAPI_METHOD_SEND_KEYBOARD_EVENT = 122;
+const int DISPID_RDPSRAPI_METHOD_SEND_SYNC_EVENT = 123;
+const int DISPID_RDPSRAPI_METHOD_BEGIN_TOUCH_FRAME = 124;
+const int DISPID_RDPSRAPI_METHOD_ADD_TOUCH_INPUT = 125;
+const int DISPID_RDPSRAPI_METHOD_END_TOUCH_FRAME = 126;
+const int DISPID_RDPSRAPI_METHOD_CONNECTUSINGTRANSPORTSTREAM = 127;
+const int DISPID_RDPSRAPI_METHOD_SENDCONTROLLEVELCHANGERESPONSE = 148;
+const int DISPID_RDPSRAPI_METHOD_GETFRAMEBUFFERBITS = 149;
+
+const int DISPID_RDPSRAPI_PROP_DISPIDVALUE = 200;
+const int DISPID_RDPSRAPI_PROP_ID = 201;
+const int DISPID_RDPSRAPI_PROP_SESSION_PROPERTIES = 202;
+const int DISPID_RDPSRAPI_PROP_ATTENDEES = 203;
+const int DISPID_RDPSRAPI_PROP_INVITATIONS = 204;
+const int DISPID_RDPSRAPI_PROP_INVITATION = 205;
+const int DISPID_RDPSRAPI_PROP_CHANNELMANAGER = 206;
+const int DISPID_RDPSRAPI_PROP_VIRTUAL_CHANNEL_GETNAME = 207;
+const int DISPID_RDPSRAPI_PROP_VIRTUAL_CHANNEL_GETFLAGS = 208;
+const int DISPID_RDPSRAPI_PROP_VIRTUAL_CHANNEL_GETPRIORITY = 209;
+const int DISPID_RDPSRAPI_PROP_WINDOWID = 210;
+const int DISPID_RDPSRAPI_PROP_APPLICATION = 211;
+const int DISPID_RDPSRAPI_PROP_WINDOWSHARED = 212;
+const int DISPID_RDPSRAPI_PROP_WINDOWNAME = 213;
+const int DISPID_RDPSRAPI_PROP_APPNAME = 214;
+const int DISPID_RDPSRAPI_PROP_APPLICATION_FILTER = 215;
+const int DISPID_RDPSRAPI_PROP_WINDOW_LIST = 216;
+const int DISPID_RDPSRAPI_PROP_APPLICATION_LIST = 217;
+const int DISPID_RDPSRAPI_PROP_APPFILTER_ENABLED = 218;
+const int DISPID_RDPSRAPI_PROP_APPFILTERENABLED = 219;
+const int DISPID_RDPSRAPI_PROP_SHARED = 220;
+const int DISPID_RDPSRAPI_PROP_INVITATIONITEM = 221;
+const int DISPID_RDPSRAPI_PROP_DBG_CLX_CMDLINE = 222;
+const int DISPID_RDPSRAPI_PROP_APPFLAGS = 223;
+const int DISPID_RDPSRAPI_PROP_WNDFLAGS = 224;
+const int DISPID_RDPSRAPI_PROP_PROTOCOL_TYPE = 225;
+const int DISPID_RDPSRAPI_PROP_LOCAL_PORT = 226;
+const int DISPID_RDPSRAPI_PROP_LOCAL_IP = 227;
+const int DISPID_RDPSRAPI_PROP_PEER_PORT = 228;
+const int DISPID_RDPSRAPI_PROP_PEER_IP = 229;
+const int DISPID_RDPSRAPI_PROP_ATTENDEE_FLAGS = 230;
+const int DISPID_RDPSRAPI_PROP_CONINFO = 231;
+const int