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

2021-05-02 Thread Liu Hao

在 2021-05-02 17:58, DAVID MAY 写道:

On 2/05/2021 1:28 pm, Liu Hao wrote:


Please use `WINBOOL` instead of `BOOL` as the latter is a builtin type
on Mac.

There are more `BOOL`s in the original file, they should be replaced as
well.



See attached patch with changes you requested.



Thanks for the work! I pushed this one.


--
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-05-02 Thread DAVID MAY
On 2/05/2021 1:28 pm, Liu Hao wrote:
> 
> Please use `WINBOOL` instead of `BOOL` as the latter is a builtin type
> on Mac.
> 
> There are more `BOOL`s in the original file, they should be replaced as
> well.
> 

See attached patch with changes you requested.

-- 
David May
--- doc/mingw64-shlwapi.h   2021-04-28 21:40:36.145098000 +0800
+++ shlwapi.h   2021-05-02 14:40:21.915360200 +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);
   LWSTDAPI_(DWORD) StrCatChainW(LPWSTR pszDst,DWORD cchDst,DWORD ichAt,LPCWSTR 
pszSrc);
   LWSTDAPI SHLoadIndirectString(LPCWSTR pszSource,LPWSTR pszOutBuf,UINT 
cchOutBuf,void **ppvReserved);
+
 #if (_WIN32_IE >= 0x0603)
   LWSTDAPI_(WINBOOL) IsCharSpaceA(CHAR wch);
   LWSTDAPI_(WINBOOL) IsCharSpaceW(WCHAR wch);
@@ -206,9 +246,6 @@
 #define PathIsHTMLFileA(pszPath) 
PathIsContentTypeA(pszPath,SZ_CONTENTTYPE_HTMLA)
 #define PathIsHTMLFileW(pszPath) 
PathIsContentTypeW(pszPath,SZ_CONTENTTYPE_HTMLW)
 
-#define STIF_DEFAULT __MSABI_LONG(0x)
-#define STIF_SUPPORT_HEX __MSABI_LONG(0x0001)
-
 #define StrCatA lstrcatA
 #define StrCmpA lstrcmpA
 #define StrCmpIA lstrcmpiA
@@ -239,6 +276,17 @@
 
 #endif
 
+#if (NTDDI_VERSION >= NTDDI_VISTASP1) 
+  enum tagSFBS_FLAGS {
+  

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

2021-05-01 Thread Liu Hao

在 2021-04-28 22:54, DAVID MAY 写道:

Thank you for your feedback.

I removed those changes.  Updated patch attached.




Thanks for the update. This patch looks mostly good, except for one thing:



+  STDAPI_(BOOL) SHRegGetBoolValueFromHKCUHKLM(PCWSTR pszKey, PCWSTR pszValue, 
BOOL fDefault);
+  LWSTDAPI_(BOOL) IsOS(DWORD dwOS);
+  LWSTDAPI_(BOOL) SHCreateThreadWithHandle(LPTHREAD_START_ROUTINE 
pfnThreadProc, void *pData, SHCT_FLAGS dwflags, LPTHREAD_START_ROUTINE 
pfnCallback, HANDLE *pHandle);



Please use `WINBOOL` instead of `BOOL` as the latter is a builtin type on 
Mac.


There are more `BOOL`s in the original file, they should be replaced as well.



--
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 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] 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] Add missing function declarations to mingw-w64-headers/include/shlwapi.h

2021-04-27 Thread 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.

--
David May

On Wed, 28 Apr 2021 01:13 Biswapriyo Nath, mailto:nathbap...@gmail.com>> wrote:

1. Does changing all `#ifndef` to `#if !defined()` make any difference?
2. It is not necessary to comment every #ifdef...#endif sections. If you
want comment use C89 comment style like this /*...*/
3. Remove comma from last element in enum. C89 :(

___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


--- /mingw64/x86_64-w64-mingw32/include/shlwapi.h   2021-04-28 
12:05:23.395469400 +0800
+++ ./shlwapi.h 2021-04-28 11:55:54.444212500 +0800
@@ -3,19 +3,21 @@
  * This file is part of the mingw-w64 runtime package.
  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
  */
-#ifndef _INC_SHLWAPI
+
+#if !defined(_INC_SHLWAPI)
 #define _INC_SHLWAPI
 
 #include <_mingw_unicode.h>
 #include 
 
-#ifndef NOSHLWAPI
+#if !defined(NOSHLWAPI)
 
 #include 
 #include 
 
-#ifndef WINSHLWAPI
-#if !defined(_SHLWAPI_)
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM) 
+#if !defined(WINSHLWAPI) 
+#if !defined(_SHLWAPI_) 
 #define LWSTDAPI EXTERN_C DECLSPEC_IMPORT HRESULT WINAPI
 #define LWSTDAPI_(type) EXTERN_C DECLSPEC_IMPORT type WINAPI
 #define LWSTDAPIV EXTERN_C DECLSPEC_IMPORT HRESULT STDAPIVCALLTYPE
@@ -25,32 +27,48 @@
 #define LWSTDAPI_(type) STDAPI_(type)
 #define LWSTDAPIV STDAPIV
 #define LWSTDAPIV_(type) STDAPIV_(type)
-#endif
-#endif
-
-#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
+#endif 
+#endif 
 
-#ifndef _WINRESRC_
-#ifndef _WIN32_IE
+#if !defined(_WINRESRC_)
+#if !defined(_WIN32_IE)
 #define _WIN32_IE 0x0601
-#endif
-#endif
+#endif 
+#endif 
 
 #include 
 
-#ifdef __cplusplus
+#if !defined(__IBindCtx_FWD_DEFINED__)
+#define __IBindCtx_FWD_DEFINED__
+typedef interface IBindCtx IBindCtx;
+#endif 
+
+#if defined(__cplusplus)
 extern "C" {
-#endif
+#endif 
 
-#ifndef NO_SHLWAPI_STRFCNS
+#if !defined(NO_SHLWAPI_STRFCNS) 
   LWSTDAPI_(LPSTR) StrChrA(LPCSTR lpStart,WORD wMatch);
   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,14 +100,16 @@
   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);
-#if (_WIN32_IE >= 0x0600)
+#if (_WIN32_IE >= 0x0600) 
   LWSTDAPI_(WINBOOL) StrToInt64ExA(LPCSTR pszString,DWORD dwFlags,LONGLONG 
*pllRet);
   LWSTDAPI_(WINBOOL) StrToInt64ExW(LPCWSTR pszString,DWORD dwFlags,LONGLONG 
*pllRet);
-#endif
+#endif 
   LWSTDAPI_(WINBOOL) StrTrimA(LPSTR psz,LPCSTR pszTrimChars);
   LWSTDAPI_(WINBOOL) StrTrimW(LPWSTR psz,LPCWSTR pszTrimChars);
   LWSTDAPI_(LPWSTR) StrCatW(LPWSTR psz1,LPCWSTR psz2);
@@ -122,10 +142,26 @@
   LWSTDAPI StrRetToBSTR(STRRET *pstr,LPCITEMIDLIST pidl,BSTR *pbstr);
   LWSTDAPI SHStrDupA(LPCSTR psz,WCHAR **ppwsz);
   

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

2021-04-27 Thread Biswapriyo Nath
1. Does changing all `#ifndef` to `#if !defined()` make any difference?
2. It is not necessary to comment every #ifdef...#endif sections. If you
want comment use C89 comment style like this /*...*/
3. Remove comma from last element in enum. C89 :(

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


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

2021-04-27 Thread DAVID MAY
Hello.

Last year I raised msys2/MINGW-packages issue 7451 regarding some
missing function declarations in the MSYS2 version of the C include file
shlwapi.h for the Microsoft DLL shlwapi.dll.

Since then I have created a fairly complete shlwapi.h file based on the
Microsoft official documentation, the existing MSYS2 version of
shlwapi.h and the Wine Project version of shlwapi.h .

I have tested my version of shlwapi.h against an adapted version of the
Wine Project's unit test suite for their shlwapi.dll and have used it to
successfully build the C++ project which originally caused problems for me.

It was suggested in the discussion for issue 7451 that, to submit this
as a change to MSYS2, I should submit a patch to this mailing list.
There is not much information on the MSYS2 website about the specific
procedure for doing that so I would appreciate advice.

Anyway, a patch is attached.


--
Yours faithfully,

David May

--- /mingw64/x86_64-w64-mingw32/include/shlwapi.h   2021-04-09 
11:16:05.0 +0800
+++ ./shlwapi.h 2021-04-27 14:58:48.758151600 +0800
@@ -3,19 +3,21 @@
  * This file is part of the mingw-w64 runtime package.
  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
  */
-#ifndef _INC_SHLWAPI
+
+#if !defined(_INC_SHLWAPI)
 #define _INC_SHLWAPI
 
 #include <_mingw_unicode.h>
 #include 
 
-#ifndef NOSHLWAPI
+#if !defined(NOSHLWAPI)
 
 #include 
 #include 
 
-#ifndef WINSHLWAPI
-#if !defined(_SHLWAPI_)
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM) // 
WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM)
+#if !defined(WINSHLWAPI) // !WINSHLWAPI
+#if !defined(_SHLWAPI_) // !_SHLWAPI_
 #define LWSTDAPI EXTERN_C DECLSPEC_IMPORT HRESULT WINAPI
 #define LWSTDAPI_(type) EXTERN_C DECLSPEC_IMPORT type WINAPI
 #define LWSTDAPIV EXTERN_C DECLSPEC_IMPORT HRESULT STDAPIVCALLTYPE
@@ -25,32 +27,48 @@
 #define LWSTDAPI_(type) STDAPI_(type)
 #define LWSTDAPIV STDAPIV
 #define LWSTDAPIV_(type) STDAPIV_(type)
-#endif
-#endif
-
-#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
+#endif // !_SHLWAPI_
+#endif // !WINSHLWAPI
 
-#ifndef _WINRESRC_
-#ifndef _WIN32_IE
+#if !defined(_WINRESRC_)
+#if !defined(_WIN32_IE)
 #define _WIN32_IE 0x0601
-#endif
-#endif
+#endif // !_WIN32_IE
+#endif // !_WINRESRC_
 
 #include 
 
-#ifdef __cplusplus
+#if !defined(__IBindCtx_FWD_DEFINED__)
+#define __IBindCtx_FWD_DEFINED__
+typedef interface IBindCtx IBindCtx;
+#endif // !__IBindCtx_FWD_DEFINED__
+
+#if defined(__cplusplus)
 extern "C" {
-#endif
+#endif // __cplusplus
 
-#ifndef NO_SHLWAPI_STRFCNS
+#if !defined(NO_SHLWAPI_STRFCNS) // !NO_SHLWAPI_STRFCNS
   LWSTDAPI_(LPSTR) StrChrA(LPCSTR lpStart,WORD wMatch);
   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,14 +100,16 @@
   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);
-#if (_WIN32_IE >= 0x0600)
+#if (_WIN32_IE >= 0x0600) // _WIN32_IE
   LWSTDAPI_(WINBOOL) StrToInt64ExA(LPCSTR pszString,DWORD dwFlags,LONGLONG 
*pllRet);
   LWSTDAPI_(WINBOOL) StrToInt64ExW(LPCWSTR pszString,DWORD dwFlags,LONGLONG 
*pllRet);
-#endif
+#endif // _WIN32_IE
   LWSTDAPI_(WINBOOL) StrTrimA(LPSTR psz,LPCSTR pszTrimChars);
   LWSTDAPI_(WINBOOL) StrTrimW(LPWSTR psz,LPCWSTR pszTrimChars);
   LWSTDAPI_(LPWSTR) StrCatW(LPWSTR psz1,LPCWSTR psz2);
@@ -122,10 +142,26 @@
   LWSTDAPI