ConstScanner - 2022/01/03 - beta.3

Post your working scripts, libraries and tools.
User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

ConstScanner - 2022/01/03 - beta.3

07 Aug 2020, 13:51

image.png
image.png (46.47 KiB) Viewed 1660 times

Highlights:
  • Inspired by Constants.ahk (written by SKAN)
  • Scans and catalogs Integers, Floats, Strings, Structs, Enums, Macros, and UUIDs.
  • Automatically perform calculations and variable substitutions defined in macros to resolve constant values.
  • Set user-defined constants so you can keep your .data files lean with only the constants you want to list in a given API.
  • Create profiles of user-defined groups of headers.
  • All #preprocessors are now parsed to get a more accurate set of constants.
  • Flexible UI for searching and referencing API constants/structs/unions/enums/macros.
  • All listed Win32 API groups have been dumped to the Data File Repo.
  • Jump to where a value is defined in headers from the main list (right-click).
    (Define text editor settings in the Settings menu.)
  • Setup this script with a compiler of your choice for checking constants (recommended MSVC BuildTools or GCC variant, like MinGW32/64 or TDGCC).
    It sometimes doesn't work, this is a work-in-progress.
  • Double-click a constant in the list (or press F3) to get a larger display window (handy for browsing large structs and enums).
  • Toggle Value column between Hex and Decimal format with CTRL
  • Space, or from the List menu.
  • Each .data file now contains a sub-catalog of data types and their sizes that pertain to that API.
  • Drastically reduced number of duplicate constants.
  • No more "critical" constants.
    "Critical" used to mean that a value of a numeric constant was based on one or more duplicate constants. Now with the proper pre-defined constants, and #preprocessors being processed during scanning, there are no more "Critical" constants, and significantly fewer dupes.
=============================================================================
Important Changes:
=============================================================================
  • The old data files won't work with this update. Please download the ones you need again from here.
  • I do plan to make docs for how to actually use this script to scan headers for constants in the future. If people want this, let me know so I can bump it up on the priority list. I made a rough tutorial on the GitHub repo README.
=============================================================================
Updates
=============================================================================

Planned updates:
  • Dump x86 constants for Win10.
  • Dig into GCC MinGW compiler and its WIN32 source files.
    This will likely yield a different set of global constants for the GCC compiler. I plan to include these default global settings in the future.
  • Calculate struct sizes and field offsets (aligned and unaligned) without the compiler (I still will spot check with the compiler though).
Download on :arrow: GitHub

=============================================================================
*** Special Notes ***
=============================================================================

When searching for error codes, please note that when you have a return value or error value, like an HRESULT, on a 64-bit system it will come out as: 0xFFFFFFFFAABBCCDD, where 0xAABBCCDD is the actual code you are looking for. This will result in negative integers that seem to have nothing to do with the actual value in the database files, unless you look at it in hex format.

When you process these HRESULT-type values, you should use var := 64_bit_number & 0xFFFFFFFF to convert it to a 32-bit value, or at least use Format() to change it to hex so you can see the last 8 characters, which will help you find your error codes when using this tool.
Last edited by TheArkive on 03 Jan 2022, 12:50, edited 41 times in total.
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

Re: Win32 Constants List - lots of them

08 Aug 2020, 04:58

Commendable work! Thank you . It will come in handy for sure when covering new APIs.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: C++ Constants Scanner/Database - 2020/08/11 - a121

11 Aug 2020, 14:58

2020/08/11
  • added more GUI indicators when the GUI is busy
  • fixed file list filter when using "Load" button
User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: C++ Constants Scanner/Database - 2020/08/11 - a121

12 Aug 2020, 06:45

Found some incorrect constants. As always please do your own double checking. I'll modify this post when I have reason to believe the full list is accurate.
This script will be temporarily broken until I can work something out to either get less values but higher accuracy, or get more values AND higher accuracy.
Many more constant values will now be unresolved until i find a better way to resolve them.


All constants that are resolved should be accurate now.
Last edited by TheArkive on 09 Mar 2021, 11:51, edited 1 time in total.
User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: C++ Constants Scanner/Database - 2020/08/13 - a121

13 Aug 2020, 12:12

2020/08/13
  • added a confirmation dialog for scanning
  • fixed calculations to only use powershell now
    - it's accurate but slow to scan, search functions are still pretty snappy
  • re-saved windows constants (only scanned main folder - should still contain most of the relevant constants)
User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: C++ Constants Scanner/Database - 2020/12/21 - a122

21 Dec 2020, 05:52

Update 2020/12/21:
  • finished compiler integration for MSVC BuildTools and GCC variants, ie. MinGW32/64 and TDGCC
  • cleaned up the UI
  • added columns where X indicates a Dupe or Critical entry (in D and C columns)
  • reverted calculations involving type casting and functions until more compiler tests can be done
  • and lots more...
  • constant values should now be accurate
User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: C++ Constants Scanner/Database - 2021/01/30 - a122

30 Jan 2021, 15:48

2021/01/30
  • now this script also catalogs ENUM and STRUCT elements
  • created a profile system with several settings for each API the user wants to scan
  • created repo on github to store saved APIs
  • several win32 APIs saved on a separate repo ready to load and browse - see readme for details
User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: C++ Constants Scanner/Database - 2021/04/18 - a131

18 Apr 2021, 16:07

2021/04/18
  • Scanner now processes a few functions like MAKE_HRESULT().
  • Added user-defined constants in profile edit window.
  • Value search field will now change hex value to decimal on search.
  • Many more constants are now resolved on the database file repo, and no more extra constants from include files.
  • Only specified files in the profile edit window are scanned, no more branching includes.
*** Special Notes ***
Please be on the lookout for possible incorrect constant values. Mostly from trying to resolve some functions. The functions aren't difficult to replicate, and I did check values through the compiler, so I know they are right on my system, but if you find them to be wrong please let me know so I can investigate.

Also, for searching error codes, please note that when you have a return value or error value, like an HRESULT, on a 64-bit system it will come out as: 0xFFFFFFFFAABBCCDD, where 0xAABBCCDD is the actual code you are looking for. This will result in negative integers that seem to have nothing to do with the actual value in the database files, unless you look at it in hex.

When you process these HRESULT-type values, you should use var := 64_bit_number ^ 0xFFFFFFFF00000000 to convert it to a 32-bit value, or at least use Format() to change it to hex so you can see the last 8 characters, which will help you find your error codes when using this tool.
User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: C++ Constants Scanner/Database - 2021/05/08 - a134

08 May 2021, 09:34

2021/05/08
  • changes for a134
  • updated CLSAK, JXON, GuiCtlExt, and eval libs
  • changed match.value(n) (for regex) to match[n] and other regex changes
  • Added option to prepend comment char ";" on copying constants
  • Column widths are now remembered between sessions.
User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: C/C++ Constants Scanner/Database - 2021/12/30 - beta.3

30 Dec 2021, 09:09

2021/12/30
  • Removed Includes report, but the includes list is still contained in the data files
  • Updated README.
  • Rewrote the parser, now #preprocessors (ie #if, #ifdef, etc) are properly read which gives more complete/accurate values.
    Now there are almost no dupes, except for redeclared UUIDs and overloaded functions/macros.
  • Made several UI updates for modifying profile settings.
  • Removed old/unused includes.
  • Now sizeof() basic types (and extended typedefs) are recorded and can be browsed after loading a data file.
  • Updated eval() library.
  • Redumped all x64 values from previously listed APIs.
  • Now UUIDs/GUIDs are recorded and converted to the proper format for AHK {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}.
  • Structs/Unions/Enums indentation is now cleaned up and properly indented.
Last edited by TheArkive on 30 Dec 2021, 09:18, edited 1 time in total.
robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

Re: C/C++ Constants Scanner/Database - 2021/12/30 - beta.3

30 Dec 2021, 09:16

very nice work! thank you for the hard work
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.
User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: ConstScanner - 2022/01/03 - beta.3

03 Jan 2022, 11:35

2022/01/03
  • Updated Progress2 lib.
  • Cleaned up some dialogs to be more consistent with the rest of the UI changes.
  • Fixed sizeof(type *) to resolve to selected architecture pointer size.
  • Added a "Global Base Folder" option for users who just browse .data files.
    This enables the "Go to #Include" and "Include" menu functionality.
  • The Compile menu is now hidden unless you define your CLI compiler enviornment settings in the Settings tab.
  • Added the ability to edit values.
    This is mostly used for selectively cleaning up struct indentation.
  • Re-dumped all x64 .data files because most were missing some includes (re-download please!).
  • Finised dumping values into .data files for the remaining Win32 API references on the Microsoft site.
  • Updated readme with better setup instructions and explanation of features.
  • Now multiple .data files can be loaded.
  • Multiple loaded .data files can be saved to a new .data file.
This update post was slightly premature. The new .data files are now uploaded to the Data FIle Repo.

Return to “Scripts and Functions (v2)”

Who is online

Users browsing this forum: No registered users and 13 guests