Re: [Mingw-w64-public] [RFC] Make Windows 10 DLLs closer to documentation

2023-06-06 Thread Steve Lhomme

Hi,

On 2023-06-06 18:16, LIU Hao wrote:

Attached are some patches about APIs yesterday.


This is an attempt to make these import libraries closer to MS 
documentation [1] [2], but:


   1) `GetFileVersionInfoW` isn't mentioned anywhere. According to its
  documentation [3] it should be imported from
  `api-ms-win-core-version-l1-1-0.dll` but that DLL exports no such
  function.


I think you mean api-ms-win-core-version-l1-1-1. This is how it's 
exported in the WACK XML files and also what WindowsApp.lib uses (in 19041).


The MS documentation is not 100% reliable. I started trying to update 
the doc with what is available in UWP 19H1 (what we target in VLC) but 
it turns out everything that has been added since RS5 is not mentioned 
in any doc. Check the last 2 commits in [5].


I sent patches upstream to see if they are willing to update the doc. 
This single change [6] for *all* Win10 UWP is still pending... I have 
little hope going forward...


For GetFileVersionInfoW it is documented to be in 
api-ms-win-core-version-l1-1-1, but in the MarkDown version of the 
documentation [7] under the "api_location" list. So I suggest relying on 
the markdown files, rather than the published version.


VerFindFileW is documented in the MarkDown file [8].

The changes in api-ms-win-core-winrt-error-l1-1-1 are documented as 
belonging there. For example, for RoClearError it doesn't show in the 
webpage but it does show in the MarkDown file, in the "api_location" 
element [9].



   2) `HSTRING_UserFree64` is documented as removed in 10.0.16299 [1] and
  should be imported from `combase.dll` [4]; and likewise others.


Indeed. I made a tool (private as I'm not sure how legally safe it is) 
to generate the .def files from the WACK XML files. I used it to find 
which DLLs are needed to export some functions. However, it seems that 
this export doesn't match any version of WindowsApp.lib (from 10240 to 
22261). So it's correct to remove all these calls. In this case the 
MarkDown doc is incorrect [10].


The entries in api-ms-win-ro-typeresolution-l1-1-1 are present in the 
DLLs and WindowsApp.lib but only since the 22000 SDK. They are not in 
sdk-api, so they can be removed.



   3) The change against `api-ms-win-security-cryptoapi-l1-1-0.def` should
  probably be reverted, as in 9464ea241865f218cdfee9784bb6dc1731a23647.


These are found in the WACK, in WindowsApp.lib since 16299 and in the 
MarkDown doc [11]. We should actually allow them in the headers for 
16299+ UWP builds. That will save me a few patches in VLC contribs.



BTW, since the online doc is now generated from the MarkDown files in 
that sdk-api repo, would it make sense to put some tools in mingw-w64 to 
parse those files and extract some data. I have some Python code that 
parses the frontmatter part of files to find various information. For 
example we could verify that the headers match the minimum allowed 
version for each API entry.


It would also be possible to make a tool that checks that we don't 
export any undocumented API, as your current patches do.



[1] https://learn.microsoft.com/en-us/uwp/win32-and-com/win32-apis
[2] 
https://learn.microsoft.com/en-us/uwp/win32-and-com/win32-extension-apis
[3] 
https://learn.microsoft.com/en-us/windows/win32/api/winver/nf-winver-getfileversioninfow
[4] 
https://learn.microsoft.com/en-us/windows/win32/api/inspectable/nf-inspectable-hstring_userfree64


[5] https://github.com/robUx4/sdk-api/commits/uwp-allowed-19041
[6] https://github.com/MicrosoftDocs/sdk-api/pull/1555
[7] 
https://github.com/MicrosoftDocs/sdk-api/blob/780ec86ec4992638894e184beed82690d84b0308/sdk-api-src/content/winver/nf-winver-getfileversioninfow.md?plain=1#L42
[8] 
https://github.com/MicrosoftDocs/sdk-api/blob/780ec86ec4992638894e184beed82690d84b0308/sdk-api-src/content/winver/nf-winver-verfindfilew.md?plain=1#L42
[9] 
https://github.com/MicrosoftDocs/sdk-api/blob/780ec86ec4992638894e184beed82690d84b0308/sdk-api-src/content/roerrorapi/nf-roerrorapi-roclearerror.md?plain=1#L41
[10] 
https://github.com/MicrosoftDocs/sdk-api/blob/780ec86ec4992638894e184beed82690d84b0308/sdk-api-src/content/inspectable/nf-inspectable-hstring_userfree64.md?plain=1#L42
[11] 
https://github.com/MicrosoftDocs/sdk-api/blob/780ec86ec4992638894e184beed82690d84b0308/sdk-api-src/content/wincrypt/nf-wincrypt-cryptacquirecontexta.md?plain=1#L42






--
Best regards,
LIU Hao



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


[Mingw-w64-public] [PATCH 2/2] crt/libsrc: Use wia.h for symbols in wia-uuid

2023-06-06 Thread Biswapriyo Nath

From ee5d9058605aaf75b465f31a7ec6b3f02c68e85d Mon Sep 17 00:00:00 2001
From: Biswapriyo Nath 
Date: Tue, 6 Jun 2023 21:49:04 +0530
Subject: [PATCH 2/2] crt/libsrc: Use wia.h for symbols in wia-uuid

Signed-off-by: Biswapriyo Nath 
---
 mingw-w64-crt/libsrc/wia-uuid.c | 116 
 1 file changed, 12 insertions(+), 104 deletions(-)

diff --git a/mingw-w64-crt/libsrc/wia-uuid.c b/mingw-w64-crt/libsrc/wia-uuid.c
index cd5609a..ab56e5b 100644
--- a/mingw-w64-crt/libsrc/wia-uuid.c
+++ b/mingw-w64-crt/libsrc/wia-uuid.c
@@ -1,106 +1,14 @@
-/* unknwn-uuid.c */
-/* Generate GUIDs for WIA interfaces */
-
-/* All IIDs defined in this file were extracted from
- * HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Interface\ */
-
-#define INITGUID
-#include 
-
-// Image types
-DEFINE_GUID(WiaImgFmt_UNDEFINED,0xb96b3ca9,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
-DEFINE_GUID(WiaImgFmt_RAWRGB,0xbca48b55,0xf272,0x4371,0xb0,0xf1,0x4a,0x15,0x0d,0x05,0x7b,0xb4);
-DEFINE_GUID(WiaImgFmt_MEMORYBMP,0xb96b3caa,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
-DEFINE_GUID(WiaImgFmt_BMP,0xb96b3cab,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
-DEFINE_GUID(WiaImgFmt_EMF,0xb96b3cac,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
-DEFINE_GUID(WiaImgFmt_WMF,0xb96b3cad,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
-DEFINE_GUID(WiaImgFmt_JPEG,0xb96b3cae,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
-DEFINE_GUID(WiaImgFmt_PNG,0xb96b3caf,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
-DEFINE_GUID(WiaImgFmt_GIF,0xb96b3cb0,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
-DEFINE_GUID(WiaImgFmt_TIFF,0xb96b3cb1,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
-DEFINE_GUID(WiaImgFmt_EXIF,0xb96b3cb2,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
-DEFINE_GUID(WiaImgFmt_PHOTOCD,0xb96b3cb3,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
-DEFINE_GUID(WiaImgFmt_FLASHPIX,0xb96b3cb4,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
-DEFINE_GUID(WiaImgFmt_ICO,0xb96b3cb5,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e);
-DEFINE_GUID(WiaImgFmt_CIFF,0x9821a8ab,0x3a7e,0x4215,0x94,0xe0,0xd2,0x7a,0x46,0x0c,0x03,0xb2);
-DEFINE_GUID(WiaImgFmt_PICT,0xa6bc85d8,0x6b3e,0x40ee,0xa9,0x5c,0x25,0xd4,0x82,0xe4,0x1a,0xdc);
-DEFINE_GUID(WiaImgFmt_JPEG2K,0x344ee2b2,0x39db,0x4dde,0x81,0x73,0xc4,0xb7,0x5f,0x8f,0x1e,0x49);
-DEFINE_GUID(WiaImgFmt_JPEG2KX,0x43e14614,0xc80a,0x4850,0xba,0xf3,0x4b,0x15,0x2d,0xc8,0xda,0x27);
-
-// Document and other types
-DEFINE_GUID(WiaImgFmt_RTF,0x573dd6a3,0x4834,0x432d,0xa9,0xb5,0xe1,0x98,0xdd,0x9e,0x89,0x0d);
-DEFINE_GUID(WiaImgFmt_XML,0xb9171457,0xdac8,0x4884,0xb3,0x93,0x15,0xb4,0x71,0xd5,0xf0,0x7e);
-DEFINE_GUID(WiaImgFmt_HTML,0xc99a4e62,0x99de,0x4a94,0xac,0xca,0x71,0x95,0x6a,0xc2,0x97,0x7d);
-DEFINE_GUID(WiaImgFmt_TXT,0xfafd4d82,0x723f,0x421f,0x93,0x18,0x30,0x50,0x1a,0xc4,0x4b,0x59);
-DEFINE_GUID(WiaImgFmt_MPG,0xecd757e4,0xd2ec,0x4f57,0x95,0x5d,0xbc,0xf8,0xa9,0x7c,0x4e,0x52);
-DEFINE_GUID(WiaImgFmt_AVI,0x32f8ca14,0x087c,0x4908,0xb7,0xc4,0x67,0x57,0xfe,0x7e,0x90,0xab);
-DEFINE_GUID(WiaImgFmt_ASF,0x8d948ee9,0xd0aa,0x4a12,0x9d,0x9a,0x9c,0xc5,0xde,0x36,0x19,0x9b);
-DEFINE_GUID(WiaImgFmt_SCRIPT,0xfe7d6c53,0x2dac,0x446a,0xb0,0xbd,0xd7,0x3e,0x21,0xe9,0x24,0xc9);
-DEFINE_GUID(WiaImgFmt_EXEC,0x485da097,0x141e,0x4aa5,0xbb,0x3b,0xa5,0x61,0x8d,0x95,0xd0,0x2b);
-DEFINE_GUID(WiaImgFmt_UNICODE16,0x1b7639b6,0x6357,0x47d1,0x9a,0x07,0x12,0x45,0x2d,0xc0,0x73,0xe9);
-DEFINE_GUID(WiaImgFmt_DPOF,0x369eeeab,0xa0e8,0x45ca,0x86,0xa6,0xa8,0x3c,0xe5,0x69,0x7e,0x28);
-
-// Audio types
-DEFINE_GUID(WiaAudFmt_WAV,0xf818e146,0x07af,0x40ff,0xae,0x55,0xbe,0x8f,0x2c,0x06,0x5d,0xbe);
-DEFINE_GUID(WiaAudFmt_MP3,0x0fbc71fb,0x43bf,0x49f2,0x91,0x90,0xe6,0xfe,0xcf,0xf3,0x7e,0x54);
-DEFINE_GUID(WiaAudFmt_AIFF,0x66e2bf4f,0xb6fc,0x443f,0x94,0xc8,0x2f,0x33,0xc8,0xa6,0x5a,0xaf);
-DEFINE_GUID(WiaAudFmt_WMA,0xd61d6413,0x8bc2,0x438f,0x93,0xad,0x21,0xbd,0x48,0x4d,0xb6,0xa1);
+/**
+ * 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.
+ */
 
-// Event GUIDs
-DEFINE_GUID(WIA_EVENT_DEVICE_DISCONNECTED,0x143e4e83,0x6497,0x11d2,0xa2,0x31,0x00,0xc0,0x4f,0xa3,0x18,0x09);
-DEFINE_GUID(WIA_EVENT_DEVICE_CONNECTED,0xa28bbade,0x64b6,0x11d2,0xa2,0x31,0x00,0xc0,0x4f,0xa3,0x18,0x09);
-DEFINE_GUID(WIA_EVENT_ITEM_DELETED,0x1d22a559,0xe14f,0x11d2,0xb3,0x26,0x00,0xc0,0x4f,0x68,0xce,0x61);
-DEFINE_GUID(WIA_EVENT_ITEM_CREATED,0x4c8f4ef5,0xe14f,0x11d2,0xb3,0x26,0x00,0xc0,0x4f,0x68,0xce,0x61);
-DEFINE_GUID(WIA_EVENT_TREE_UPDATED,0xc9859b91,0x4ab2,0x4cd6,0xa1,0xfc,0x58,0x2e,0xec,0x55,0xe5,0x85);
-DEFINE_GUID(WIA_EVENT_VOLUME_INSERT,0x9638bbfd,0xd1bd,0x11d2,0xb3,0x1f,0x00,0xc0,0x4f,0x68,0xce,0x61);
-DEFINE_GUID(WIA_EVENT_SCAN_IMAGE,0xa6c5a715,0x8c6e,0x11d2,0x97,0x7a,0x00,0x00,0xf8,0x7a,0x92,0x6f);

[Mingw-w64-public] [PATCH 1/2] headers: Add wia.idl

2023-06-06 Thread Biswapriyo Nath

From da3f44c338b40c51d0f289d8aebcaf45e6770ce8 Mon Sep 17 00:00:00 2001
From: Biswapriyo Nath 
Date: Tue, 6 Jun 2023 21:46:02 +0530
Subject: [PATCH 1/2] headers: Add wia.idl

Tested with 
https://learn.microsoft.com/en-us/windows/win32/wia/-wia-creating-a-wia-device-manager

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

diff --git a/mingw-w64-headers/Makefile.am b/mingw-w64-headers/Makefile.am
index 7c6ef85..4bc7160 100644
--- a/mingw-w64-headers/Makefile.am
+++ b/mingw-w64-headers/Makefile.am
@@ -248,6 +248,7 @@ IDL_SRCS = \
   include/wbemprov.idl \
   include/wbemtran.idl \
   include/wdstptmgmt.idl \
+  include/wia.idl \
   include/mediaobj.idl \
   include/medparam.idl \
   include/mmstream.idl \
diff --git a/mingw-w64-headers/include/wia.idl 
b/mingw-w64-headers/include/wia.idl
new file mode 100644
index 000..e2ce2fc
--- /dev/null
+++ b/mingw-w64-headers/include/wia.idl
@@ -0,0 +1,842 @@
+/**
+ * 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 "unknwn.idl";
+import "oaidl.idl";
+import "propidl.idl";
+
+cpp_quote("#include ")
+
+cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)")
+
+interface IEnumWIA_DEV_INFO;
+interface IWiaItem;
+interface IWiaEventCallback;
+interface IWiaPropertyStorage;
+interface IEnumWIA_FORMAT_INFO;
+interface IEnumWiaItem;
+interface IEnumWIA_DEV_CAPS;
+interface IWiaItem2;
+interface IWiaTransferCallback;
+
+typedef struct _WIA_DITHER_PATTERN_DATA {
+  LONG lSize;
+  BSTR bstrPatternName;
+  LONG lPatternWidth;
+  LONG lPatternLength;
+  LONG cbPattern;
+  BYTE *pbPattern;
+} WIA_DITHER_PATTERN_DATA, *PWIA_DITHER_PATTERN_DATA;
+
+typedef struct _WIA_PROPID_TO_NAME {
+  PROPID propid;
+  LPOLESTR pszName;
+} WIA_PROPID_TO_NAME, *PWIA_PROPID_TO_NAME;
+
+typedef struct _WIA_FORMAT_INFO {
+  GUID guidFormatID;
+  LONG lTymed;
+} WIA_FORMAT_INFO, *PWIA_FORMAT_INFO;
+
+/*
+ * wiadef.h requires WIA_FORMAT_INFO
+ */
+cpp_quote("#include ")
+
+typedef struct _WIA_DATA_CALLBACK_HEADER {
+  LONG lSize;
+  GUID guidFormatID;
+  LONG lBufferSize;
+  LONG lPageCount;
+} WIA_DATA_CALLBACK_HEADER, *PWIA_DATA_CALLBACK_HEADER;
+
+typedef struct _WIA_DATA_TRANSFER_INFO {
+  ULONG ulSize;
+  ULONG ulSection;
+  ULONG ulBufferSize;
+  WINBOOL bDoubleBuffer;
+  ULONG ulReserved1;
+  ULONG ulReserved2;
+  ULONG ulReserved3;
+} WIA_DATA_TRANSFER_INFO, *PWIA_DATA_TRANSFER_INFO;
+
+typedef struct _WIA_EXTENDED_TRANSFER_INFO {
+  ULONG ulSize;
+  ULONG ulMinBufferSize;
+  ULONG ulOptimalBufferSize;
+  ULONG ulMaxBufferSize;
+  ULONG ulNumBuffers;
+} WIA_EXTENDED_TRANSFER_INFO, *PWIA_EXTENDED_TRANSFER_INFO;
+
+typedef struct _WIA_DEV_CAP {
+  GUID guid;
+  ULONG ulFlags;
+  BSTR bstrName;
+  BSTR bstrDescription;
+  BSTR bstrIcon;
+  BSTR bstrCommandline;
+} WIA_DEV_CAP, *PWIA_DEV_CAP, WIA_EVENT_HANDLER, *PWIA_EVENT_HANDLER;
+
+typedef struct _WiaTransferParams {
+  LONG lMessage;
+  LONG lPercentComplete;
+  ULONG64 ulTransferredBytes;
+  HRESULT hrErrorStatus;
+} WiaTransferParams;
+
+[
+  object,
+  uuid(5eb2502a-8cf1-11d1-bf92-0060081ed811)
+]
+interface IWiaDevMgr : IUnknown
+{
+  HRESULT EnumDeviceInfo(
+[in] LONG lFlag,
+[retval, out] IEnumWIA_DEV_INFO **ppIEnum);
+
+  HRESULT CreateDevice(
+[in] BSTR bstrDeviceID,
+[out] IWiaItem **ppWiaItemRoot);
+
+  HRESULT SelectDeviceDlg(
+[in] HWND hwndParent,
+[in] LONG lDeviceType,
+[in] LONG lFlags,
+[in, out] BSTR *pbstrDeviceID,
+[retval, out] IWiaItem **ppItemRoot);
+
+  HRESULT SelectDeviceDlgID(
+[in] HWND hwndParent,
+[in] LONG lDeviceType,
+[in] LONG lFlags,
+[retval, out] BSTR *pbstrDeviceID);
+
+  HRESULT GetImageDlg(
+[in] HWND hwndParent,
+[in] LONG lDeviceType,
+[in] LONG lFlags,
+[in] LONG lIntent,
+[in] IWiaItem *pItemRoot,
+[in] BSTR bstrFilename,
+[in, out] GUID *pguidFormat);
+
+  HRESULT RegisterEventCallbackProgram(
+[in] LONG lFlags,
+[in] BSTR bstrDeviceID,
+[in] const GUID *pEventGUID,
+[in] BSTR bstrCommandline,
+[in] BSTR bstrName,
+[in] BSTR bstrDescription,
+[in] BSTR bstrIcon);
+
+  HRESULT RegisterEventCallbackInterface(
+[in] LONG lFlags,
+[in] BSTR bstrDeviceID,
+[in] const GUID *pEventGUID,
+[unique, in] IWiaEventCallback *pIWiaEventCallback,
+[out] IUnknown **pEventObject);
+
+  HRESULT RegisterEventCallbackCLSID(
+[in] LONG lFlags,
+[in] BSTR bstrDeviceID,
+[in] const GUID *pEventGUID,
+[unique, in] const GUID *pClsID,
+[in] BSTR bstrName,
+[in] BSTR bstrDescription,
+[in] BSTR bstrIcon);
+
+HRESULT AddDeviceDlg(
+[in] HWND hwndParent,
+[in] LONG lFlags);
+}
+
+[
+  

[Mingw-w64-public] [RFC] Make Windows 10 DLLs closer to documentation

2023-06-06 Thread LIU Hao

Attached are some patches about APIs yesterday.


This is an attempt to make these import libraries closer to MS documentation 
[1] [2], but:

  1) `GetFileVersionInfoW` isn't mentioned anywhere. According to its
 documentation [3] it should be imported from
 `api-ms-win-core-version-l1-1-0.dll` but that DLL exports no such
 function.

  2) `HSTRING_UserFree64` is documented as removed in 10.0.16299 [1] and
 should be imported from `combase.dll` [4]; and likewise others.

  3) The change against `api-ms-win-security-cryptoapi-l1-1-0.def` should
 probably be reverted, as in 9464ea241865f218cdfee9784bb6dc1731a23647.


[1] https://learn.microsoft.com/en-us/uwp/win32-and-com/win32-apis
[2] https://learn.microsoft.com/en-us/uwp/win32-and-com/win32-extension-apis
[3] 
https://learn.microsoft.com/en-us/windows/win32/api/winver/nf-winver-getfileversioninfow
[4] 
https://learn.microsoft.com/en-us/windows/win32/api/inspectable/nf-inspectable-hstring_userfree64



--
Best regards,
LIU Hao
From 34c7cc3991617049b21c9fcb7c4c80184b028d2e Mon Sep 17 00:00:00 2001
From: LIU Hao 
Date: Tue, 6 Jun 2023 23:38:10 +0800
Subject: [PATCH 1/4] crt: Remove undocumented APIs from
 api-ms-win-core-version-l1-1-1.def

https://learn.microsoft.com/en-us/uwp/win32-and-com/win32-extension-apis#apis-from-versiondll

Signed-off-by: LIU Hao 
---
 mingw-w64-crt/lib-common/api-ms-win-core-version-l1-1-1.def | 1 -
 mingw-w64-crt/lib32/api-ms-win-core-version-l1-1-1.def  | 1 -
 2 files changed, 2 deletions(-)

diff --git a/mingw-w64-crt/lib-common/api-ms-win-core-version-l1-1-1.def 
b/mingw-w64-crt/lib-common/api-ms-win-core-version-l1-1-1.def
index a4901802f..674f8e153 100644
--- a/mingw-w64-crt/lib-common/api-ms-win-core-version-l1-1-1.def
+++ b/mingw-w64-crt/lib-common/api-ms-win-core-version-l1-1-1.def
@@ -4,5 +4,4 @@ EXPORTS
 
 GetFileVersionInfoExW
 GetFileVersionInfoSizeExW
-GetFileVersionInfoW
 VerQueryValueW
diff --git a/mingw-w64-crt/lib32/api-ms-win-core-version-l1-1-1.def 
b/mingw-w64-crt/lib32/api-ms-win-core-version-l1-1-1.def
index 9a6bea936..f87248dfe 100644
--- a/mingw-w64-crt/lib32/api-ms-win-core-version-l1-1-1.def
+++ b/mingw-w64-crt/lib32/api-ms-win-core-version-l1-1-1.def
@@ -4,5 +4,4 @@ EXPORTS
 
 GetFileVersionInfoExW@20
 GetFileVersionInfoSizeExW@12
-VerFindFileW@32
 VerQueryValueW@16
-- 
2.41.0

From 6c616bd70231f9745f512535d79cc5a36be2f9af Mon Sep 17 00:00:00 2001
From: LIU Hao 
Date: Tue, 6 Jun 2023 23:45:59 +0800
Subject: [PATCH 2/4] crt: Remove undocumented APIs from
 api-ms-win-core-winrt-error-l1-1-1.def

https://learn.microsoft.com/en-us/uwp/win32-and-com/win32-apis#apis-from-api-ms-win-core-winrt-error-l1-1-1dll

Signed-off-by: LIU Hao 
---
 .../lib-common/api-ms-win-core-winrt-error-l1-1-1.def   | 4 
 mingw-w64-crt/lib32/api-ms-win-core-winrt-error-l1-1-1.def  | 6 --
 2 files changed, 10 deletions(-)

diff --git a/mingw-w64-crt/lib-common/api-ms-win-core-winrt-error-l1-1-1.def 
b/mingw-w64-crt/lib-common/api-ms-win-core-winrt-error-l1-1-1.def
index 2c70f3d9b..4881f02f7 100644
--- a/mingw-w64-crt/lib-common/api-ms-win-core-winrt-error-l1-1-1.def
+++ b/mingw-w64-crt/lib-common/api-ms-win-core-winrt-error-l1-1-1.def
@@ -3,16 +3,12 @@ LIBRARY api-ms-win-core-winrt-error-l1-1-1
 EXPORTS
 
 GetRestrictedErrorInfo
-IsErrorPropagationEnabled
 RoCaptureErrorContext
-RoClearError
 RoFailFastWithErrorContext
 RoGetErrorReportingFlags
-RoGetMatchingRestrictedErrorInfo
 RoOriginateError
 RoOriginateErrorW
 RoOriginateLanguageException
-RoReportFailedDelegate
 RoReportUnhandledError
 RoSetErrorReportingFlags
 RoTransformError
diff --git a/mingw-w64-crt/lib32/api-ms-win-core-winrt-error-l1-1-1.def 
b/mingw-w64-crt/lib32/api-ms-win-core-winrt-error-l1-1-1.def
index 3be66b015..6ae33dddf 100644
--- a/mingw-w64-crt/lib32/api-ms-win-core-winrt-error-l1-1-1.def
+++ b/mingw-w64-crt/lib32/api-ms-win-core-winrt-error-l1-1-1.def
@@ -3,18 +3,12 @@ LIBRARY api-ms-win-core-winrt-error-l1-1-1
 EXPORTS
 
 GetRestrictedErrorInfo@4
-IsErrorPropagationEnabled@0
 RoCaptureErrorContext@4
-RoClearError@0
 RoFailFastWithErrorContext@4
 RoGetErrorReportingFlags@4
-RoGetMatchingRestrictedErrorInfo@8
-RoInspectCapturedStackBackTrace@24
-RoInspectThreadErrorInfo@20
 RoOriginateError@8
 RoOriginateErrorW@12
 RoOriginateLanguageException@12
-RoReportFailedDelegate@8
 RoReportUnhandledError@4
 RoSetErrorReportingFlags@4
 RoTransformError@12
-- 
2.41.0

From d7be23e6e106fa6b102c4c52f473c4c6d72e5b09 Mon Sep 17 00:00:00 2001
From: LIU Hao 
Date: Tue, 6 Jun 2023 23:50:02 +0800
Subject: [PATCH 3/4] crt: Remove undocumented and removed APIs from
 api-ms-win-core-winrt-string-l1-1-0.def

https://learn.microsoft.com/en-us/uwp/win32-and-com/win32-apis#apis-from-api-ms-win-core-winrt-string-l1-1-0dll

Signed-off-by: LIU Hao 
---
 .../lib-common/api-ms-win-core-winrt-string-l1-1-0.def| 4 
 mingw-w64-crt/lib32/api-ms-win-core-winrt-string-l1-1-0.def   | 4 
 2 files changed, 8 deletions(-)

diff --git 

Re: [Mingw-w64-public] [PATCH] Define FLS_MAXIMUM_AVAILABLE as 4080 for WIN10_19H1

2023-06-06 Thread Luca Bacci
Hi! Right, the Windows SDK defines FLS_MAXIMUM_AVAILABLE unconditionally, let's 
do the same here.

Thank you!
Luca


Da: LIU Hao 
Inviato: lunedì, giugno 5, 2023 4:01:51 PM
A: mingw-w64-public@lists.sourceforge.net 
; Luca Bacci 
Oggetto: Re: [Mingw-w64-public] [PATCH] Define FLS_MAXIMUM_AVAILABLE as 4080 
for WIN10_19H1

在 2023-06-05 16:54, Luca Bacci 写道:
> Windows 10 19H1 raised the number of available FLS slots
> from 128 to 4080 [1] and the Windows SDK was updated
> accordingly

Let's think about this: This patch adds another imaginary macro 
`_WIN32_WINNT_WIN10_19H1` that is
referenced nowhere in Windows SDK. I'd prefer the previous patch (without any 
`#if`) for these reasons:

1) There isn't such a check in public Windows SDK headers.
2) 10.0.18362.0 is the earliest SDK that is available in Visual Studio 2022 and
it is exactly 19H1.
3) If the user does not define `NTDDI_VERSION` but defines `_WIN32_WINNT` to
`0x0A00` i.e. Windows 10, then `NTDDI_VERSION` is defined to latest, which
means Windows 10 targets should probably receive all latest stuff, including
the FLS extension.
4) Ironically, Windows 11 is still identified as version 10 for its `NTDDI_*`
macro.
5) And that's what was done in d78ef3552df8cdbfd1a275296921787975573d54.


--
Best regards,
LIU Hao



___
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: Revert changes to api-ms-win-crt-*.def

2023-06-06 Thread Martin Storsjö

On Tue, 6 Jun 2023, LIU Hao wrote:


在 2023/6/6 16:27, Martin Storsjö 写道:

These removed lots of manual modifications from these CRT specific
import libraries, modifications that are essential to how the UCRT
is linked.

Signed-off-by: Martin Storsjö 
---
  .../api-ms-win-crt-filesystem-l1-1-0.def  | 12 ---
  .../lib-common/api-ms-win-crt-heap-l1-1-0.def |  2 +-
  .../api-ms-win-crt-multibyte-l1-1-0.def   |  3 ++-
  .../api-ms-win-crt-process-l1-1-0.def | 17 +++
  .../api-ms-win-crt-stdio-l1-1-0.def   |  5 -
  .../api-ms-win-crt-string-l1-1-0.def  | 11 --
  .../lib-common/api-ms-win-crt-time-l1-1-0.def | 21 +--
  7 files changed, 52 insertions(+), 19 deletions(-)


This patch looks good to me.


Thanks, pushed.

For the record; if there are intentional function changes to the 
api-ms-win-crt-*.def files, it's good to try to see if the same should be 
changed in ucrtbase.def too. Some parts of them are handled differently 
(as ucrtbase.def uses msvcrt-common.def.in which sets up a bunch of 
aliases), but the generic interface of the combined api-ms-win-crt-*.def 
should be roughly equal to that of ucrtbase.def.


// Martin

___
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: Revert changes to api-ms-win-crt-*.def

2023-06-06 Thread LIU Hao

在 2023/6/6 16:27, Martin Storsjö 写道:

These removed lots of manual modifications from these CRT specific
import libraries, modifications that are essential to how the UCRT
is linked.

Signed-off-by: Martin Storsjö 
---
  .../api-ms-win-crt-filesystem-l1-1-0.def  | 12 ---
  .../lib-common/api-ms-win-crt-heap-l1-1-0.def |  2 +-
  .../api-ms-win-crt-multibyte-l1-1-0.def   |  3 ++-
  .../api-ms-win-crt-process-l1-1-0.def | 17 +++
  .../api-ms-win-crt-stdio-l1-1-0.def   |  5 -
  .../api-ms-win-crt-string-l1-1-0.def  | 11 --
  .../lib-common/api-ms-win-crt-time-l1-1-0.def | 21 +--
  7 files changed, 52 insertions(+), 19 deletions(-)


This patch looks good to me. I only did a quick glance at the lib-common parts and didn't notice 
those deletions. Apologies for the trouble.


--
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] crt: Revert changes to api-ms-win-crt-*.def

2023-06-06 Thread Martin Storsjö
These removed lots of manual modifications from these CRT specific
import libraries, modifications that are essential to how the UCRT
is linked.

Signed-off-by: Martin Storsjö 
---
 .../api-ms-win-crt-filesystem-l1-1-0.def  | 12 ---
 .../lib-common/api-ms-win-crt-heap-l1-1-0.def |  2 +-
 .../api-ms-win-crt-multibyte-l1-1-0.def   |  3 ++-
 .../api-ms-win-crt-process-l1-1-0.def | 17 +++
 .../api-ms-win-crt-stdio-l1-1-0.def   |  5 -
 .../api-ms-win-crt-string-l1-1-0.def  | 11 --
 .../lib-common/api-ms-win-crt-time-l1-1-0.def | 21 +--
 7 files changed, 52 insertions(+), 19 deletions(-)

diff --git a/mingw-w64-crt/lib-common/api-ms-win-crt-filesystem-l1-1-0.def 
b/mingw-w64-crt/lib-common/api-ms-win-crt-filesystem-l1-1-0.def
index 8d70bd626..45ae728ba 100644
--- a/mingw-w64-crt/lib-common/api-ms-win-crt-filesystem-l1-1-0.def
+++ b/mingw-w64-crt/lib-common/api-ms-win-crt-filesystem-l1-1-0.def
@@ -3,7 +3,8 @@ LIBRARY api-ms-win-crt-filesystem-l1-1-0
 EXPORTS
 
 _access
-access == _access
+; access is provided as an alias for __mingw_access
+; access == _access
 _access_s
 _chdir
 chdir == _chdir
@@ -11,12 +12,12 @@ _chdrive
 _chmod
 chmod == _chmod
 _findclose
-_findfirst == _findfirst32
+_findfirst == _findfirst64
 _findfirst32
 _findfirst32i64
 _findfirst64
 _findfirst64i32
-_findnext == _findnext32
+_findnext == _findnext64
 _findnext32
 _findnext32i64
 _findnext64
@@ -26,9 +27,6 @@ _fstat32i64
 _fstat64
 _fstat64i32
 _fullpath
-_getcwd
-getcwd == _getcwd
-_getdcwd
 _getdiskfree
 _getdrive
 _getdrives
@@ -64,8 +62,6 @@ _wfindnext32i64
 _wfindnext64
 _wfindnext64i32
 _wfullpath
-_wgetcwd
-_wgetdcwd
 _wmakepath
 _wmakepath_s
 _wmkdir
diff --git a/mingw-w64-crt/lib-common/api-ms-win-crt-heap-l1-1-0.def 
b/mingw-w64-crt/lib-common/api-ms-win-crt-heap-l1-1-0.def
index 344acd56e..fd793fe82 100644
--- a/mingw-w64-crt/lib-common/api-ms-win-crt-heap-l1-1-0.def
+++ b/mingw-w64-crt/lib-common/api-ms-win-crt-heap-l1-1-0.def
@@ -18,13 +18,13 @@ _get_heap_handle
 _heapchk
 _heapmin
 _heapwalk
+heapwalk == _heapwalk
 _malloc_base
 _msize
 _query_new_handler
 _query_new_mode
 _realloc_base
 _recalloc
-_resetstkoflw
 _set_new_mode
 calloc
 free
diff --git a/mingw-w64-crt/lib-common/api-ms-win-crt-multibyte-l1-1-0.def 
b/mingw-w64-crt/lib-common/api-ms-win-crt-multibyte-l1-1-0.def
index 9ae47af16..86d22500b 100644
--- a/mingw-w64-crt/lib-common/api-ms-win-crt-multibyte-l1-1-0.def
+++ b/mingw-w64-crt/lib-common/api-ms-win-crt-multibyte-l1-1-0.def
@@ -70,7 +70,8 @@ _mbbtombc
 _mbbtombc_l
 _mbbtype
 _mbbtype_l
-_mbcasemap
+; DATA added manually
+_mbcasemap DATA
 _mbccpy
 _mbccpy_l
 _mbccpy_s
diff --git a/mingw-w64-crt/lib-common/api-ms-win-crt-process-l1-1-0.def 
b/mingw-w64-crt/lib-common/api-ms-win-crt-process-l1-1-0.def
index a3ad9d75f..dafa456a5 100644
--- a/mingw-w64-crt/lib-common/api-ms-win-crt-process-l1-1-0.def
+++ b/mingw-w64-crt/lib-common/api-ms-win-crt-process-l1-1-0.def
@@ -4,23 +4,40 @@ EXPORTS
 
 _beep
 _cwait
+cwait == _cwait
 _execl
+execl == _execl
 _execle
+execle == _execle
 _execlp
+execlp == _execlp
 _execlpe
+execlpe == _execlpe
 _execv
+execv == _execv
 _execve
+execve == _execve
 _execvp
+execvp == _execvp
 _execvpe
+execvpe == _execvpe
 _loaddll
 _spawnl
+spawnl == _spawnl
 _spawnle
+spawnle == _spawnle
 _spawnlp
+spawnlp == _spawnlp
 _spawnlpe
+spawnlpe == _spawnlpe
 _spawnv
+spawnv == _spawnv
 _spawnve
+spawnve == _spawnve
 _spawnvp
+spawnvp == _spawnvp
 _spawnvpe
+spawnvpe == _spawnvpe
 _unloaddll
 _wexecl
 _wexecle
diff --git a/mingw-w64-crt/lib-common/api-ms-win-crt-stdio-l1-1-0.def 
b/mingw-w64-crt/lib-common/api-ms-win-crt-stdio-l1-1-0.def
index 460fd12ef..d59859ced 100644
--- a/mingw-w64-crt/lib-common/api-ms-win-crt-stdio-l1-1-0.def
+++ b/mingw-w64-crt/lib-common/api-ms-win-crt-stdio-l1-1-0.def
@@ -85,6 +85,7 @@ _getws_s
 _isatty
 isatty == _isatty
 _kbhit
+kbhit == _kbhit
 _locking
 _lseek
 lseek == _lseek
@@ -96,8 +97,10 @@ _open
 open == _open
 _open_osfhandle
 _pclose
+pclose == _pclose
 _pipe
 _popen
+popen == _popen
 _putc_nolock
 _putw
 putw == _putw
@@ -134,6 +137,7 @@ _wmktemp
 _wmktemp_s
 _wopen
 _wpopen
+wpopen == _wpopen
 _write
 write == _write
 _wsopen
@@ -175,7 +179,6 @@ getwc
 getwchar
 putc
 putchar
-putenv
 puts
 putwc
 putwchar
diff --git a/mingw-w64-crt/lib-common/api-ms-win-crt-string-l1-1-0.def 
b/mingw-w64-crt/lib-common/api-ms-win-crt-string-l1-1-0.def
index 78c9d163c..dcce58dbc 100644
--- a/mingw-w64-crt/lib-common/api-ms-win-crt-string-l1-1-0.def
+++ b/mingw-w64-crt/lib-common/api-ms-win-crt-string-l1-1-0.def
@@ -51,7 +51,10 @@ _strcoll_l
 _strdup
 strdup == _strdup
 _stricmp
+_strcmpi == _stricmp
+strcmpi == _stricmp
 stricmp == _stricmp
+strcasecmp == _stricmp
 _stricmp_l
 _stricoll
 stricoll == _stricoll
@@ -64,6 +67,8 @@ _strlwr_s_l
 _strncoll
 _strncoll_l
 _strnicmp
+strnicmp == _strnicmp
+strncasecmp == _strnicmp
 _strnicmp_l
 _strnicoll
 _strnicoll_l
@@ -92,6 +97,7 @@ _wcsdup
 wcsdup 

Re: [Mingw-w64-public] [PATCH 1/2] crt: add new found API entries api-ms-win-*.def

2023-06-06 Thread Martin Storsjö

On Thu, 1 Jun 2023, Steve Lhomme wrote:


The parameters size in lib32 were generated from values found in other .def
files of lib32.
---


I'm sorry to say, but this patch removed a lot of manual handmade 
customizations to the api-ms-win-crt-*.def files.


In particular, this now shows up as linker errors when trying to bootstrap 
a new toolchain:


ld.lld: error: duplicate symbol: __tzset
>>> defined at ../crt/ucrtbase_compat.c:135
>>>libmsvcrt.a(lib32_libucrt_extra_a-ucrtbase_compat.o)
>>> defined at api-ms-win-crt-time-l1-1-0.dll

Let's have a look at the questionable bits here:


diff --git a/mingw-w64-crt/lib-common/api-ms-win-core-version-l1-1-1.def 
b/mingw-w64-crt/lib-common/api-ms-win-core-version-l1-1-1.def
index ddbdd1d6c..a4901802f 100644
--- a/mingw-w64-crt/lib-common/api-ms-win-core-version-l1-1-1.def
+++ b/mingw-w64-crt/lib-common/api-ms-win-core-version-l1-1-1.def
@@ -4,5 +4,5 @@ EXPORTS

GetFileVersionInfoExW
GetFileVersionInfoSizeExW
-VerFindFileW
+GetFileVersionInfoW
VerQueryValueW


This removes a function that used to be here. Is that right/expected?


diff --git a/mingw-w64-crt/lib-common/api-ms-win-core-winrt-error-l1-1-1.def 
b/mingw-w64-crt/lib-common/api-ms-win-core-winrt-error-l1-1-1.def
index bd5ef539c..2c70f3d9b 100644
--- a/mingw-w64-crt/lib-common/api-ms-win-core-winrt-error-l1-1-1.def
+++ b/mingw-w64-crt/lib-common/api-ms-win-core-winrt-error-l1-1-1.def
@@ -9,8 +9,6 @@ RoClearError
RoFailFastWithErrorContext
RoGetErrorReportingFlags
RoGetMatchingRestrictedErrorInfo
-RoInspectCapturedStackBackTrace
-RoInspectThreadErrorInfo
RoOriginateError
RoOriginateErrorW
RoOriginateLanguageException


This removes functions, is that right/expected?


diff --git a/mingw-w64-crt/lib-common/api-ms-win-core-winrt-string-l1-1-0.def 
b/mingw-w64-crt/lib-common/api-ms-win-core-winrt-string-l1-1-0.def
index c1636e1c6..127d74961 100644
--- a/mingw-w64-crt/lib-common/api-ms-win-core-winrt-string-l1-1-0.def
+++ b/mingw-w64-crt/lib-common/api-ms-win-core-winrt-string-l1-1-0.def
@@ -19,7 +19,6 @@ WindowsDeleteStringBuffer
WindowsDuplicateString
WindowsGetStringLen
WindowsGetStringRawBuffer
-WindowsInspectString
WindowsIsStringEmpty
WindowsPreallocateStringBuffer
WindowsPromoteStringBuffer


Also a removal.


diff --git a/mingw-w64-crt/lib-common/api-ms-win-crt-filesystem-l1-1-0.def 
b/mingw-w64-crt/lib-common/api-ms-win-crt-filesystem-l1-1-0.def
index 45ae728ba..8d70bd626 100644
--- a/mingw-w64-crt/lib-common/api-ms-win-crt-filesystem-l1-1-0.def
+++ b/mingw-w64-crt/lib-common/api-ms-win-crt-filesystem-l1-1-0.def
@@ -3,8 +3,7 @@ LIBRARY api-ms-win-crt-filesystem-l1-1-0
EXPORTS

_access
-; access is provided as an alias for __mingw_access
-; access == _access
+access == _access


Here we explicitly say that this is commented out, manually, for specific 
reasons. Please don't undo such things!



_access_s
_chdir
chdir == _chdir
@@ -12,12 +11,12 @@ _chdrive
_chmod
chmod == _chmod
_findclose
-_findfirst == _findfirst64
+_findfirst == _findfirst32


These are intentionally set to the 64 bit version, since our UCRT 
environments default to 64 bit time_t, iirc. Lots of similar changes 
below.



_fstat64i32
_fullpath
+_getcwd
+getcwd == _getcwd
+_getdcwd
_getdiskfree


These symbols are in api-ms-win-crt-stdio-l1-1-0.def already, are they 
duplicated in api-ms-win-crt-filesystem-l1-1-0.def now too?



diff --git a/mingw-w64-crt/lib-common/api-ms-win-crt-heap-l1-1-0.def 
b/mingw-w64-crt/lib-common/api-ms-win-crt-heap-l1-1-0.def
index fd793fe82..344acd56e 100644
--- a/mingw-w64-crt/lib-common/api-ms-win-crt-heap-l1-1-0.def
+++ b/mingw-w64-crt/lib-common/api-ms-win-crt-heap-l1-1-0.def
@@ -18,13 +18,13 @@ _get_heap_handle
_heapchk
_heapmin
_heapwalk
-heapwalk == _heapwalk


This was a manually set up alias, don't remove.


_malloc_base
_msize
_query_new_handler
_query_new_mode
_realloc_base
_recalloc
+_resetstkoflw
_set_new_mode
calloc
free
diff --git a/mingw-w64-crt/lib-common/api-ms-win-crt-multibyte-l1-1-0.def 
b/mingw-w64-crt/lib-common/api-ms-win-crt-multibyte-l1-1-0.def
index 86d22500b..9ae47af16 100644
--- a/mingw-w64-crt/lib-common/api-ms-win-crt-multibyte-l1-1-0.def
+++ b/mingw-w64-crt/lib-common/api-ms-win-crt-multibyte-l1-1-0.def
@@ -70,8 +70,7 @@ _mbbtombc
_mbbtombc_l
_mbbtype
_mbbtype_l
-; DATA added manually
-_mbcasemap DATA
+_mbcasemap


Another case of manual changes removed.


_mbccpy
_mbccpy_l
_mbccpy_s
diff --git a/mingw-w64-crt/lib-common/api-ms-win-crt-process-l1-1-0.def 
b/mingw-w64-crt/lib-common/api-ms-win-crt-process-l1-1-0.def
index dafa456a5..a3ad9d75f 100644
--- a/mingw-w64-crt/lib-common/api-ms-win-crt-process-l1-1-0.def
+++ b/mingw-w64-crt/lib-common/api-ms-win-crt-process-l1-1-0.def
@@ -4,40 +4,23 @@ EXPORTS

_beep
_cwait
-cwait == _cwait
_execl
-execl == _execl
_execle
-execle == _execle
_execlp
-execlp == _execlp
_execlpe
-execlpe == _execlpe
_execv
-execv == _execv
_execve
-execve == _execve
_execvp
-execvp == _execvp
_execvpe

Re: [Mingw-w64-public] [PATCH] headers: Add missing macros in afunix.h

2023-06-06 Thread LIU Hao

在 2023/6/6 12:29, Biswapriyo Nath 写道:

 From 6732b188891a4eb01b3bd3d8bd8893d148a6c4fd Mon Sep 17 00:00:00 2001
From: Biswapriyo Nath
Date: Tue, 6 Jun 2023 09:57:57 +0530
Subject: [PATCH] headers: Add missing macros in afunix.h

Signed-off-by: Biswapriyo Nath
---
  mingw-w64-headers/include/afunix.h | 2 ++
  1 file changed, 2 insertions(+)


Thanks for the patch. Pushed to master now.

--
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