Re: [Mingw-w64-public] Patch for incorrect heap function declarations in winnt.h

2025-01-03 Thread LIU Hao

在 2025-01-04 09:39, Duncan Ogilvie 写道:

Today I was trying to use System Informer's phnt headers with mingw-w64.
There are some missing headers and other minor issues, but I can work
around them. Unfortunately it was not possible to work around a few errors
related to incorrect function declarations related to heap management.

Attached a patch. The return type should be NTSTATUS, but this isn't
available in winnt.h, so I used LONG, which is what NTSTATUS is. I
cross-referenced with Wine, ReactOS and they all match my patched return
types.


There was no attachment..? Please send patches as TXT files. Thanks.


--
Best regards,
LIU Hao


OpenPGP_signature.asc
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 for incorrect heap function declarations in winnt.h

2025-01-03 Thread Duncan Ogilvie
Today I was trying to use System Informer's phnt headers with mingw-w64.
There are some missing headers and other minor issues, but I can work
around them. Unfortunately it was not possible to work around a few errors
related to incorrect function declarations related to heap management.

Attached a patch. The return type should be NTSTATUS, but this isn't
available in winnt.h, so I used LONG, which is what NTSTATUS is. I
cross-referenced with Wine, ReactOS and they all match my patched return
types.

Best regards,

Duncan

___
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 for incorrect heap function declarations in winnt.h

2025-01-03 Thread Duncan Ogilvie
Apologies, I am using gmail and was born too late to have learned how
to use a mailing list 😅

From 758f4b203d8dc42ef19910d226eeb735f5dc15d6 Mon Sep 17 00:00:00 2001
From: Duncan Ogilvie 
Date: Sat, 4 Jan 2025 02:34:26 +0100
Subject: [PATCH] Fix a few return types in winnt.h

---
 mingw-w64-headers/include/winnt.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mingw-w64-headers/include/winnt.h
b/mingw-w64-headers/include/winnt.h
index b6d1f58ed..2781198fa 100644
--- a/mingw-w64-headers/include/winnt.h
+++ b/mingw-w64-headers/include/winnt.h
@@ -9705,10 +9705,10 @@ typedef DWORD (WINAPI
*PRTL_RUN_ONCE_INIT_FN)(PRTL_RUN_ONCE, PVOID, PVOID *);
 #define VERIFIER_STOP(Code,Msg,P1,S1,P2,S2,P3,S3,P4,S4) {
RtlApplicationVerifierStop
((Code),(Msg),(ULONG_PTR)(P1),(S1),(ULONG_PTR)(P2),(S2),(ULONG_PTR)(P3),(S3),(ULONG_PTR)(P4),(S4));
}

 VOID NTAPI RtlApplicationVerifierStop(ULONG_PTR Code,PSTR
Message,ULONG_PTR Param1,PSTR Description1,ULONG_PTR Param2,PSTR
Description2,ULONG_PTR Param3,PSTR Description3,ULONG_PTR Param4,PSTR
Description4);
-NTSYSAPI DWORD NTAPI RtlSetHeapInformation(PVOID
HeapHandle,HEAP_INFORMATION_CLASS HeapInformationClass,PVOID
HeapInformation,SIZE_T HeapInformationLength);
-NTSYSAPI DWORD NTAPI RtlQueryHeapInformation(PVOID
HeapHandle,HEAP_INFORMATION_CLASS HeapInformationClass,PVOID
HeapInformation,SIZE_T HeapInformationLength,PSIZE_T ReturnLength);
-DWORD NTAPI RtlMultipleAllocateHeap(PVOID HeapHandle,DWORD
Flags,SIZE_T Size,DWORD Count,PVOID *Array);
-DWORD NTAPI RtlMultipleFreeHeap(PVOID HeapHandle,DWORD
Flags,DWORD Count,PVOID *Array);
+NTSYSAPI LONG NTAPI RtlSetHeapInformation(PVOID
HeapHandle,HEAP_INFORMATION_CLASS HeapInformationClass,PVOID
HeapInformation,SIZE_T HeapInformationLength);
+NTSYSAPI LONG NTAPI RtlQueryHeapInformation(PVOID
HeapHandle,HEAP_INFORMATION_CLASS HeapInformationClass,PVOID
HeapInformation,SIZE_T HeapInformationLength,PSIZE_T ReturnLength);
+ULONG NTAPI RtlMultipleAllocateHeap(PVOID HeapHandle,DWORD
Flags,SIZE_T Size,DWORD Count,PVOID *Array);
+ULONG NTAPI RtlMultipleFreeHeap(PVOID HeapHandle,DWORD
Flags,DWORD Count,PVOID *Array);

 typedef struct _HARDWARE_COUNTER_DATA {
   HARDWARE_COUNTER_TYPE Type;
-- 
2.47.0.windows.2

Also opened a merge request on SourceForge, but they don't appear to be used?

Thanks,

Duncan

On Sat, 4 Jan 2025 at 02:44, LIU Hao  wrote:
>
> 在 2025-01-04 09:39, Duncan Ogilvie 写道:
> > Today I was trying to use System Informer's phnt headers with mingw-w64.
> > There are some missing headers and other minor issues, but I can work
> > around them. Unfortunately it was not possible to work around a few errors
> > related to incorrect function declarations related to heap management.
> >
> > Attached a patch. The return type should be NTSTATUS, but this isn't
> > available in winnt.h, so I used LONG, which is what NTSTATUS is. I
> > cross-referenced with Wine, ReactOS and they all match my patched return
> > types.
>
> There was no attachment..? Please send patches as TXT files. Thanks.
>
>
> --
> 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 for incorrect heap function declarations in winnt.h

2025-01-03 Thread LIU Hao

在 2025-01-04 10:02, Duncan Ogilvie 写道:

Apologies, I am using gmail and was born too late to have learned how
to use a mailing list 😅


Oh welcome; no need to apologize. It's said that GMail doesn't send a correct MIME type for patches, 
so they may get filtered out. But please don't send a patch inline. Varieties of mail clients can 
mess up with whitespace characters, making patches inapplicable with `git am`.




--
Best regards,
LIU Hao


OpenPGP_signature.asc
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] getmainargs changes

2025-01-03 Thread Lasse Collin
There is more information about the issue at .
Seems that it may have been released in mid-December already.

-- 
Lasse Collin


___
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 for incorrect heap function declarations in winnt.h

2025-01-03 Thread LIU Hao

在 2025-01-04 10:15, LIU Hao 写道:

在 2025-01-04 10:02, Duncan Ogilvie 写道:

Apologies, I am using gmail and was born too late to have learned how
to use a mailing list 😅


Oh welcome; no need to apologize. It's said that GMail doesn't send a correct MIME type for patches, 
so they may get filtered out. But please don't send a patch inline. Varieties of mail clients can 
mess up with whitespace characters, making patches inapplicable with `git am`.


Attached is a patch from 
https://sourceforge.net/p/mingw-w64/mingw-w64/merge-requests/27/

Is there a reason why you changed the return type of `RtlMultipleAllocateHeap` from `DWORD` to 
`ULONG`? They are the same type and interchangeable.


Using `LONG` in place of `NTSTATUS` is fine.


--
Best regards,
LIU Hao
From 3e75e52b9a5d0e0b999230fc91a2f85aba0fcd82 Mon Sep 17 00:00:00 2001
From: Duncan Ogilvie 
Date: Sat, 4 Jan 2025 02:34:26 +0100
Subject: [PATCH] Fix a few return types in winnt.h

---
 mingw-w64-headers/include/winnt.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mingw-w64-headers/include/winnt.h b/mingw-w64-headers/include/winnt.h
index b6d1f58ed..2781198fa 100644
--- a/mingw-w64-headers/include/winnt.h
+++ b/mingw-w64-headers/include/winnt.h
@@ -9705,10 +9705,10 @@ typedef DWORD (WINAPI *PRTL_RUN_ONCE_INIT_FN)(PRTL_RUN_ONCE, PVOID, PVOID *);
 #define VERIFIER_STOP(Code,Msg,P1,S1,P2,S2,P3,S3,P4,S4) { RtlApplicationVerifierStop ((Code),(Msg),(ULONG_PTR)(P1),(S1),(ULONG_PTR)(P2),(S2),(ULONG_PTR)(P3),(S3),(ULONG_PTR)(P4),(S4)); }
 
 VOID NTAPI RtlApplicationVerifierStop(ULONG_PTR Code,PSTR Message,ULONG_PTR Param1,PSTR Description1,ULONG_PTR Param2,PSTR Description2,ULONG_PTR Param3,PSTR Description3,ULONG_PTR Param4,PSTR Description4);
-NTSYSAPI DWORD NTAPI RtlSetHeapInformation(PVOID HeapHandle,HEAP_INFORMATION_CLASS HeapInformationClass,PVOID HeapInformation,SIZE_T HeapInformationLength);
-NTSYSAPI DWORD NTAPI RtlQueryHeapInformation(PVOID HeapHandle,HEAP_INFORMATION_CLASS HeapInformationClass,PVOID HeapInformation,SIZE_T HeapInformationLength,PSIZE_T ReturnLength);
-DWORD NTAPI RtlMultipleAllocateHeap(PVOID HeapHandle,DWORD Flags,SIZE_T Size,DWORD Count,PVOID *Array);
-DWORD NTAPI RtlMultipleFreeHeap(PVOID HeapHandle,DWORD Flags,DWORD Count,PVOID *Array);
+NTSYSAPI LONG NTAPI RtlSetHeapInformation(PVOID HeapHandle,HEAP_INFORMATION_CLASS HeapInformationClass,PVOID HeapInformation,SIZE_T HeapInformationLength);
+NTSYSAPI LONG NTAPI RtlQueryHeapInformation(PVOID HeapHandle,HEAP_INFORMATION_CLASS HeapInformationClass,PVOID HeapInformation,SIZE_T HeapInformationLength,PSIZE_T ReturnLength);
+ULONG NTAPI RtlMultipleAllocateHeap(PVOID HeapHandle,DWORD Flags,SIZE_T Size,DWORD Count,PVOID *Array);
+ULONG NTAPI RtlMultipleFreeHeap(PVOID HeapHandle,DWORD Flags,DWORD Count,PVOID *Array);
 
 typedef struct _HARDWARE_COUNTER_DATA {
   HARDWARE_COUNTER_TYPE Type;
-- 
2.43.0



OpenPGP_signature.asc
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 for incorrect heap function declarations in winnt.h

2025-01-03 Thread Biswapriyo Nath
The new ones in your patch also seem incorrect. For example, I have
looked into https://github.com/winsiderss/systeminformer/tree/master/phnt
and RtlSetHeapInformation and RtlQueryHeapInformation return NTSTATUS.
Also, I verified that by looking into those functions in ntdll.


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