Ziggle() : A handy tool to lookup Win32 Constants

Post your working scripts, libraries and tools.
eugenesv
Posts: 178
Joined: 21 Dec 2015, 10:11

Re: Ziggle() : A handy tool to lookup Win32 Constants

08 Sep 2023, 06:05

Is it possible to somehow use this data directly in scripts like

Code: Select all

#include <constZiggle>
!Numpad8::{
  Cz := win32ConstantZiggle.m
  msgbox(Cz['__RPCNDR_H_VERSION__'])
}
so that you maintain readability later on instead of having raw numbers pasted in various dllcalls?

I've tried to naively load the converted attached data file in a Map('const_name','const_value',...) format, but then the AHK couldn't load, guess it's too big :)
And the load times plumetted when I cut the size to something AHK could load
But is there a simple yet performant way to achieve the same?
User avatar
SKAN
Posts: 1551
Joined: 29 Sep 2013, 16:58

Re: Ziggle() : A handy tool to lookup Win32 Constants

08 Sep 2023, 07:27

eugenesv wrote:
08 Sep 2023, 06:05
Is it possible to somehow use this data directly in scripts like
Include 173416 Constants? :shock:
Not suitable for a interpreted language, IMO.
eugenesv
Posts: 178
Joined: 21 Dec 2015, 10:11

Re: Ziggle() : A handy tool to lookup Win32 Constants

08 Sep 2023, 07:53

SKAN wrote:
08 Sep 2023, 07:27
eugenesv wrote:
08 Sep 2023, 06:05
Is it possible to somehow use this data directly in scripts like
Include 173416 Constants? :shock:
Not suitable for a interpreted language, IMO.
but I've seen some mentions in other posts about the possibility of embedding native functions within AHK, maybe they could load some memory-mapped file (or something?) and respond to calls from within AHK scripts with numbers (except they wouldn't have to string-parse the file every single time as that could be preparsed to whatever the best format for that function is)? This way it could be millions of constants :)?

This would also allow you to add more helpful aliases
User avatar
SKAN
Posts: 1551
Joined: 29 Sep 2013, 16:58

Ziggle() : Data file updated

13 Sep 2023, 06:57

GdiPlus constants were (almost) hand-compiled from header files and there were a few errors.
Attaching here a script of GdiPlus constants as well as data file that has been included in Ziggle3.zip
Attachments
GdiPlus.zip
(21.6 KiB) Downloaded 248 times
eugenesv
Posts: 178
Joined: 21 Dec 2015, 10:11

Re: Ziggle() : A handy tool to lookup Win32 Constants

18 Sep 2023, 09:35

By the way, there are a bunch of duplicate keys in the file

Spoiler
eugenesv
Posts: 178
Joined: 21 Dec 2015, 10:11

Re: Ziggle() : A handy tool to lookup Win32 Constants

18 Sep 2023, 09:58

And a slightly cleaned x64 version
  • removed duplicates (though haven't checked which of the dupes is correct, just left the first one). Also, some constants have legit different values with names only differing by CaSe (DISPID_MaxLength and DISPID_MAXLENGTH)
  • replaced all ptrsize'd conditionals like (A_PtrSize=8 ? "0xFFFFFFFFFFFFFFFF" : 4294967295) _SIZE_T_ERROR with the first "0xFFFFFFFFFFFFFFFF" value
  • removed () from ("0xFFFFFFFFFFFFFFFF") DWORD64_MAX
  • replaced (Chr(124)) with |
Attachments
ziggle_clean64.zip
(1.83 MiB) Downloaded 252 times
Last edited by eugenesv on 18 Sep 2023, 10:59, edited 1 time in total.
User avatar
SKAN
Posts: 1551
Joined: 29 Sep 2013, 16:58

Re: Ziggle() : A handy tool to lookup Win32 Constants

18 Sep 2023, 10:52

eugenesv wrote:
18 Sep 2023, 09:58
removed duplicates (though haven't checked which of the dupes is correct, just left the first one
That's almost correct, the second one is being picked from winrt subfolder
except IID_IResourceManager which has 3 entries?!
https://www.magnumdb.com/search?q=IID_IResourceManager

Unable to decide about

Code: Select all

SEC_E_INTERNAL_ERROR
SEC_E_UNSUPPORTED_FUNCTION
In Ziggle.txt, they have both signed/unsigned value.. According to MagnumDB they are unsigned numbers:
https://www.magnumdb.com/search?q=SEC_E_INTERNAL_ERROR
https://www.magnumdb.com/search?q=SEC_E_UNSUPPORTED_FUNCTION
  
replaced (A_PtrSize=8 ? "0xFFFFFFFFFFFFFFFF" : 4294967295) _SIZE_T_ERROR with the first "0xFFFFFFFFFFFFFFFF" value
https://www.magnumdb.com/search?q=_SIZE_T_ERROR
replaced (Chr(124)) with |
That might mess with search delimiter |.
eugenesv
Posts: 178
Joined: 21 Dec 2015, 10:11

Re: Ziggle() : A handy tool to lookup Win32 Constants

18 Sep 2023, 11:06

Out of curiousity, shouldn't the official Windows bindings be more authoritative vs the MagnumDB https://docs.rs/windows-sys/latest/windows_sys/Win32/Foundation/constant.SEC_E_INTERNAL_ERROR.html

SKAN wrote:
18 Sep 2023, 10:52
replaced (Chr(124)) with |
That might mess with search delimiter |.
Think that should be dealt with at the app layer rather than dirtying the database
eugenesv
Posts: 178
Joined: 21 Dec 2015, 10:11

Re: Ziggle() : A handy tool to lookup Win32 Constants

21 Sep 2023, 13:03

And FYI I've compiled your database to DLL so you can use a DllCall in AHK to avoid the need to do the work twice (find a constant, then find its value), see this post
eugenesv
Posts: 178
Joined: 21 Dec 2015, 10:11

Re: Ziggle() : A handy tool to lookup Win32 Constants

08 Oct 2023, 09:37

FYI I've also managed to extract most of the constants from the official Windows sys Rust library (112k out of 126k, missing are all the GUIDs and wide string literlas PCWSTR as their values escape the extraction process route I've used), and you might be interested in these discrepancies vs. the Ziggle data:

  • 0.5k constants with different values. Checked a few and the library seems to match the docs unlike Ziggle, but then there is also some weird integer wraparound going on

    Code: Select all

    Constant                  	crate     	ziggle     	Comment
    DEPENDENT_DISK_FLAG_PARENT	256       	32         0x00000100=256 per msdocs https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ne-virtdisk-dependent_disk_flag 
    PDH_INSUFFICIENT_BUFFER   	3221228482	-1073738814	 PDH_INSUFFICIENT_BUFFER   	3221228482	-1073738814	 0xC0000BC2=3221228482 per https://learn.microsoft.com/en-us/windows/win32/perfctrs/pdh-error-codes, Ziggle with wraparound i32 = crate
    
    winConst_vs_ziggle_diff_value_0.5k.txt.rar
    (7.13 KiB) Downloaded 248 times
  • 1.8k constants missing from Ziggle (haven't checked them, some seem to be just dupe in values (but different in type) like PRINTER_STANDARD_RIGHTS_READ same as STANDARD_RIGHTS_READ)

    winConst_vs_ziggle_extra_1.8k.txt.rar
    (14.23 KiB) Downloaded 267 times
Last edited by eugenesv on 09 Oct 2023, 08:54, edited 1 time in total.
User avatar
SKAN
Posts: 1551
Joined: 29 Sep 2013, 16:58

Re: Ziggle() : A handy tool to lookup Win32 Constants

09 Oct 2023, 00:34

eugenesv wrote:
08 Oct 2023, 09:37
  • 0.5k constants with different values...

    Code: Select all

    Constant                  	crate     	ziggle     	Comment
    DEPENDENT_DISK_FLAG_PARENT	256       	32         0x00000100=256 per msdocs https://learn.microsoft.com/en-us/windows/win32/api/virtdisk/ne-virtdisk-dependent_disk_flag 
    ...
    
 
Oh! My parser had a mistake. Thanks for the valuable feedback! :thumbup:
eugenesv wrote:
08 Oct 2023, 09:37
1.8k constants missing from Ziggle
 
After rectifying the code, I downloaded the latest zig bindings, updated Ziggle.txt and cross checked with your list.
Have included 1105 entries from your list (1809 entries) to Ziggle4.zip
Thanks.
Attachments
eugenesv_1.txt
(20.64 KiB) Downloaded 237 times
eugenesv
Posts: 178
Joined: 21 Dec 2015, 10:11

Re: Ziggle() : A handy tool to lookup Win32 Constants

09 Oct 2023, 08:49

FYI the results of the same simple cleaning process as described above based on Ziggle4, and the dupe file (which is now slightly bigger at 2k entries)
Noticed things like

Code: Select all

`\n	IMAGE_ARCHIVE_END
\n	IMAGE_ARCHIVE_END
which might indicate some parsing issue with AHK due to the backtick?
SKAN wrote:
09 Oct 2023, 00:34
Have included 1105 entries from your list (1809 entries)
Out of curiosity, what about the other ~700 entries?
Attachments
ziggle4_clean64_dupe.rar
(33.82 KiB) Downloaded 232 times
ziggle4_clean64.rar
(1.69 MiB) Downloaded 236 times
User avatar
SKAN
Posts: 1551
Joined: 29 Sep 2013, 16:58

Re: Ziggle() : A handy tool to lookup Win32 Constants

09 Oct 2023, 09:23

eugenesv wrote:
09 Oct 2023, 08:49
Noticed things like

Code: Select all

`\n	IMAGE_ARCHIVE_END
\n	IMAGE_ARCHIVE_END
which might indicate some parsing issue with AHK due to the backtick?
 
I will look into that.
 
SKAN wrote:
09 Oct 2023, 00:34
Have included 1105 entries from your list (1809 entries)
eugenesv wrote:
09 Oct 2023, 08:49
Out of curiosity, what about the other ~700 entries?
 
They have been included in latest zig bindings.
eugenesv
Posts: 178
Joined: 21 Dec 2015, 10:11

Re: Ziggle() : A handy tool to lookup Win32 Constants

09 Oct 2023, 10:06

And similar diff with the updated data - almost all are of the "wraparound" variety nowPDH_CANNOT_READ_NAME_STRINGS 3221228488 -1073738808

one with a type difference for
INVALID_SOCKET 18446744073709551615 4294967295
(in the lib it's max usize, so u64, guess it's u32 in whatever your database got it from, might want to hide it behind A_PtrSize check like other values?)

and a couple with a rounding difference
X3DAUDIO_2PI 6.2831855 6.283185307
winConst_vs_ziggle_diff_value_0.09k.rar
(1.44 KiB) Downloaded 249 times
(and everything is included in Ziggle, so no extras except for Success 0 UNKNOWN 0 FALSE 0 TRUE 1)
Attachments
winConst_vs_ziggle_extra_0.004k.rar
(135 Bytes) Downloaded 246 times
User avatar
SKAN
Posts: 1551
Joined: 29 Sep 2013, 16:58

Re: Ziggle() : A handy tool to lookup Win32 Constants

09 Oct 2023, 10:40

eugenesv wrote:
09 Oct 2023, 10:06
one with a type difference for
INVALID_SOCKET 18446744073709551615 4294967295
(in the lib it's max usize, so u64, guess it's u32 in whatever your database got it from, might want to hide it behind A_PtrSize check like other values?)
Unsigned 32 bit value. Should be -1 instead.
Why is invalid socket defined as ~0 in WinSock2.h (c++)?
eugenesv
Posts: 178
Joined: 21 Dec 2015, 10:11

Re: Ziggle() : A handy tool to lookup Win32 Constants

09 Oct 2023, 12:14

-1 is a way to set the unsigned type to MAX, so it should be u32MAX or u64MAX
eugenesv
Posts: 178
Joined: 21 Dec 2015, 10:11

Re: Ziggle() : A handy tool to lookup Win32 Constants

22 Oct 2023, 11:05

I've switched to the same WinMD parsing method (based on the MS Rust library) that the Zig data you referenced, so now the coverage is almost complete (except for generic interface GUIDs, haven't parsed them to concrete types unlike your Ziggle file) and should be the same, so FYI below are a few differences in case you find them useful for your database
  • the "wraparound" differences mentioned in previous posts
  • other differences, though this might be due to duplicates (in case of IIDs) so not really differences, but the limitations of my quick checks since I've only compared to the "cleaned up" Ziggle file that excluded the duplicates
    winConst_vs_ziggle_diff_value 2 misc 0.3k.log.rar
    (4.09 KiB) Downloaded 236 times
  • (this might be intentional on your part, so can be ignored) some struct constants with fields like PKEY_Devices_AepContainer_CanPair {fmtid:{0bba1ede-7566-4f47-90ec-25fc567ced2a},pid:3,} are only included as a single GUID value
    winConst_vs_ziggle_diff_value 3 struct 2.4k.log.rar
    (46.32 KiB) Downloaded 238 times
eugenesv
Posts: 178
Joined: 21 Dec 2015, 10:11

Re: Ziggle() : A handy tool to lookup Win32 Constants

22 Oct 2023, 11:13

and there are ~9k constants not included in your data
Attachments
winConst_vs_ziggle_extra 9k.log.rar
(99.36 KiB) Downloaded 227 times

Return to “Scripts and Functions (v2)”

Who is online

Users browsing this forum: DuyMinh, shipaddicted and 25 guests