How does it work?

MagNumDB is a database that contains about 350,000 items. These items are constants, names, values all extracted from more than 6,000 header files (.h, .hxx, .hpp, .idl, etc.) provided by standard Windows and Visual Studio SDKs and WDKs.

Some values have been extracted from the very special uuid.lib file that contains the value of thousands of guids and property keys, not present anywhere else in header files. This can explain some duplicates (because names in uuid.lib are not always exactly the same as names in .h parsed files...).

It also contains around 36,0000 undocumented guids that we found ... meeeeep ...

 "C2P5"

To build this database, we have tried many existing parsers, things like CLANG or other fine tools, but they just don't suit our needs. They can't handle thousands of files that don't compile together, they can't handle some specific (or just very old) Microsoft constructs or annotations, they don't remember the stack of #define directives that led to a definition, they only give you a final AST, not a partial one, etc.

So, in the end, we have written a C/C++ parser named C2P5 (for C/CPP/PreProcessor/Parser), tailored specifically for computing constants. C2P5 is capable of preprocessing, parsing and partially evaluating all header files as if they were included in a one big virtual project (that of course, does not compile) on a 32G RAM machine. It currently supports the following preprocessor and C/C++ constructs:

  • #define preprocessor that define constants
  • #define preprocessor that define expression to compute constants
  • C and C++ constants, strings and enum definitions, and some level of pointerness
  • Special GUID constructs like DECLSPEC_UUID, DEFINE_GUIDSTRUCT, MIDL_INTERFACE, you name it
  • PROPERTYKEY constructs
  • Some IDL constructs
  • Etc.

The parser remembers dynamic preprocessor definitions (#if, #ifdef, etc.) that are conditions for constants definitions and expression computation. All parsed items are saved in the database, as well as the associated conditions. There may be more than one item corresponding to a given name, if there are differences in their associated conditions stack.

C2P5 supports the following types of constants, regardless of the way they are defined in source files:

  • integer, signed or unsigned, from 8-bit to 128-bit
  • floating point number, single (32-bit) or double (64-bit)
  • globally unique identifier, or guid, uuid, CLSID, IID, etc.
  • string, in narrow, wide, or utf-8/16/32 formats
  • character, in narrow, wide, or utf-8/16/32 formats
  • pointer, a constant cast as a pointer
  • property key, or PROPERTYKEY, or PKEY, a combination of a guid (fmtid) and a 32-bit integer (id).

 Powered by

C2P5 and this MagNumDB web site are written in C# and use a Lucene database as a full-text search engine. C2P5 uses a custom ANTLR4cs C grammar for expression parsing, not for preprocessor parsing.

 

 Frequently Asked Questions

  • Q: Can I run custom queries?
    A: Yes. You can use Lucene's query syntax. Note the Database is case insensitive. Check out the list of columns with their corresponding database column names:

    • Index: the item's index.
    • Name: the item's name, or title. For enum values, it's prefixed with the enum's name.
      Corresponding database field: title.
    • Type: the item's type, expressed in a specific, universal system.
      Corresponding database's field: valuetype, but use the value of the Storage type column for queries on items type.
    • Value: the item's value. For string values, it's displayed as is w/o quotes nor escaping.
      Corresponding database field: value. There is also a typedvalue field that can contain database's Int32, Int64, Float, Double or String typed values.
    • Hex Value: the item's hexadecimal value, only valid for integer types.
      There is no corresponding database field.
    • Signed Value: the item's signed value, only valid for integer and double types. Useful when you found a unsigned number and want to get the corresponding signed value (uint -> int for example).
      There is no corresponding database field.
    • Source lines(s): the source lines from which the item was extracted. Comments and characters such as TAB, CR are preserved.
      Corresponding database field: source.
    • File path: the file path from which the item was extracted, terminated by the line index.
      Corresponding database field: filepath. There are also directory and filename fields. filename is useful to query for values in a given file.
    • Score: Database's score value. Items are returned sorted by score.
    • Guid formats: a utility columns that proposes all possible guid formats. Only valid for guid types.
      There is no corresponding database field
    • Char type: the character encoding (narrow, wide, etc.). Only valid for char and string values.
      Corresponding database field: chartype.
    • Storage type: the exact storage type in the database. Only used for specific queries.
      Corresponding database field: valuetype.
    • Conditions: the list of preprocessor conditions for a given item. If a condition is surrounded with a REVERSE function, it means the reverse condition of what's surrounded was the condition.
      Corresponding database field: conditions. There may be multiple conditions fields for one item.

    Some important points to note:

    • If you search for a negative number (like error codes expressed using signed integers), you can surround the search with double quotes, for example searching for "-2147009290" is equivalent to searching for 0x80073CF6, 80073CF6 (or even 3CF6 in this specific case). If you don't surround negative numbers with double quotes, the system will search for signed and unsigned corresponding values.
    • The full-text search uses items' name, value, hex value, guid formats, source lines, etc. so refine your search if you get back too many items.
    • You can search for guid binary values using just a part of their full definition. For example, if you search for '79eac9c5', it will get you 3 guid entries
    • Leading wild card search (*whatever) is allowed, but it may slow down the search significantly.

    Here are some example or custom queries:

    title:wm_user returns the WM_USER Windows message item, not all items that reference the WM_USER token.

    title:wm_u* returns all items (Windows messages probably) whose name starts with WM_U*.

    value:1024 AND title:wm_* returns all items (Windows messages probably) whose name starts with WM_U* and value is 1024. Note AND must be UPPERCASE for database to understand it as an AND operator.

    value:"00000002-0000-0000-C000-000000000046" returns the IMalloc IID guid value.

  • Q: I always get back 400 items at most. Why?
    A: The MagNumDb site currently limits the number of returned items to this value by design. This should be enough for most real search scenarios (like enums with a big list of values).

  • Q: Some values are empty. Why?
    A: The expression evaluator cannot always compute the final value, because it sometimes require contextual information (custom defines, compiler architecture, etc.) that the parser doesn't have at parsing time. You can enable the Source line(s) column to check what's the corresponding source and try to work it out by yourself. The origin file path and line number is also included.

  • Q: Can I get all values for a given enum?
    A: Sure. For example, __VSHPROPID is the name of an enum, and a query like this: parent:__VSHPROPID will get all the enum's values (66 entries).

  • Q: I sometimes get back items whose name starts with "__magnumdb__enum_". Why?
    A: C allows unnamed enums. The MagNumDb parser just gives them a name, using the defining file name and a counter.

  • Q: I sometimes get back the same item/name twice or more with different values. For example:  TARGET_IS_NT60_OR_LATER. Why?
    A: This can be the case with defines. Their value may be different if they were surrounded by # directives (#if, #else, etc.) in the original source code. You can enable the Condition(s) column to check what are the corresponding conditions for a given item.
    Note: if a condition is surrounded with a funny REVERSE function token, it means the reverse condition of what's surrounded.

 Database Metrics

  • Last update date: Thursday August 29, 2019
  • Items count: 350276
  • Parsed files count: 7563
  • Windows SDK version: 10.0.18362.0
  • NetFx SDK version: 4.8
  • MSVC Tools version: 14.22.27905

 

 Contact

We welcome feedback.
Seen anything missing? A bug? A wrong value? Do you have any suggestion for improvements? Do you have an idea for a cool new feature?

Please contact us here

 About MagNumDB

MagNumDB  2017-2019 Simon Mourier V1.3.1. All rights reserved.

Profile for Simon Mourier at Stack Overflow, Q&A for professional and enthusiast programmers


All product names, logos, and brands are property of their respective owners. All company, product and service names used in this website are for identification purposes only.

All values, names, source code fragments displayed here have been extracted from files that are property of their respective owners.

THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND OTHER THAN AS SPECIFICALLY SET FORTH IN THE LICENSE AGREEMENT, INCLUDING WITHOUT LIMITATION WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Index Score Name Type Value Hex value Signed value Guid formats Char type Storage type Source line(s) File path Condition(s)
Index Score Name Type Value Hex value Signed value Guid formats Char type Storage type Source line(s) File path Condition(s)
1 6.373259 SZ_IE_MAIN String Main Narrow System.TypedString
#define SZ_IE_MAIN                      "Main"
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.18362.0\um\InetReg.h(48,0)
  • If WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
2 5.462793 PackageTypes::Main Int32 1 0x00000001 1 System.Int32
Main      = 0x1,
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.18362.0\winrt\windows.management.deployment.idl(211,0)
3 5.462793 AutomationLandmarkType::Main Int32 3 0x00000003 3 System.Int32
Main       = 3,
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.18362.0\winrt\windows.ui.xaml.automation.peers.idl(1058,0)
4 4.552327 eAVEncDDService::eAVEncDDService_CM Int32 0 0x00000000 0 System.Int32
eAVEncDDService_CM = 0,  // (Main Service: Complete Main)
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.18362.0\um\codecapi.h(1494,0)
  • If WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
5 3.862778 REGSTR_KEY_MAIN String Main Narrow System.TypedString
#define REGSTR_KEY_MAIN                 TEXT(SZ_IE_MAIN)
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.18362.0\um\InetReg.h(50,0)
  • If WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
6 3.641862 DIK_MINUS Int32 12 0x0000000C 12 System.Int32
#define DIK_MINUS           0x0C    /* - on main keyboard */
#define DIK_MINUS           0x0C    /* - on main keyboard */
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.18362.0\um\dinput.h(2055,0)
  • If WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  • Ifndef DIJ_RINGZERO
7 3.641862 DIK_RETURN Int32 28 0x0000001C 28 System.Int32
#define DIK_RETURN          0x1C    /* Enter on main keyboard */
#define DIK_RETURN          0x1C    /* Enter on main keyboard */
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.18362.0\um\dinput.h(2071,0)
  • If WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  • Ifndef DIJ_RINGZERO
8 3.641862 DIK_PERIOD Int32 52 0x00000034 52 System.Int32
#define DIK_PERIOD          0x34    /* . on main keyboard */
#define DIK_PERIOD          0x34    /* . on main keyboard */
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.18362.0\um\dinput.h(2095,0)
  • If WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  • Ifndef DIJ_RINGZERO
9 3.641862 DIK_SLASH Int32 53 0x00000035 53 System.Int32
#define DIK_SLASH           0x35    /* / on main keyboard */
#define DIK_SLASH           0x35    /* / on main keyboard */
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.18362.0\um\dinput.h(2096,0)
  • If WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  • Ifndef DIJ_RINGZERO
10 3.641862 DIKEYBOARD_MINUS UInt32 2164261900 0x8100040C -2130705396 System.UInt32
#define DIKEYBOARD_MINUS                        0x8100040C    /* - on main keyboard */
#define DIKEYBOARD_MINUS                        0x8100040C    /* - on main keyboard */
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.18362.0\um\dinput.h(3019,0)
  • If WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
11 3.641862 DIKEYBOARD_PERIOD UInt32 2164261940 0x81000434 -2130705356 System.UInt32
#define DIKEYBOARD_PERIOD                       0x81000434    /* . on main keyboard */
#define DIKEYBOARD_PERIOD                       0x81000434    /* . on main keyboard */
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.18362.0\um\dinput.h(3059,0)
  • If WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
12 3.641862 DIKEYBOARD_SLASH UInt32 2164261941 0x81000435 -2130705355 System.UInt32
#define DIKEYBOARD_SLASH                        0x81000435    /* / on main keyboard */
#define DIKEYBOARD_SLASH                        0x81000435    /* / on main keyboard */
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.18362.0\um\dinput.h(3060,0)
  • If WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
13 3.218982 PARTITION_MAIN_OS Int32 40 0x00000028 40 System.Int32
#define PARTITION_MAIN_OS               0x28      // Main OS partition
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.18362.0\shared\ntdddisk.h(315,0)
  • If WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM)
14 3.218982 AFX_IDW_TOOLBAR Int32 59392 0x0000E800 -6144 System.Int32
#define AFX_IDW_TOOLBAR                 0xE800  // main Toolbar for window
%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.22.27905\atlmfc\include\afxres.h(118,0)
  • Ifndef RC_INVOKED
15 3.186629 DIKEYBOARD_RETURN UInt32 2164261916 0x8100041C -2130705380 System.UInt32
#define DIKEYBOARD_RETURN                       0x8100041C    /* Enter on main keyboard */
#define DIKEYBOARD_RETURN                       0x8100041C    /* Enter on main keyboard */
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.18362.0\um\dinput.h(3035,0)
  • If WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
16 2.575185 AVENC_H264V_MAX_MBBITS Int32 3200 0x00000C80 3200 System.Int32
#define AVENC_H264V_MAX_MBBITS 3200 //Only applies to Baseline, Main, Extended profiles
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.18362.0\um\codecapi.h(1288,0)
  • If WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
17 2.575185 eAVEncDDService::eAVEncDDService_ME Int32 1 0x00000001 1 System.Int32
eAVEncDDService_ME = 1,  // (Main Service: Music and Effects (ME))
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.18362.0\um\codecapi.h(1495,0)
  • If WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
18 2.575185 MUI_FILETYPE_LANGUAGE_NEUTRAL_MAIN Int32 2 0x00000002 2 System.Int32
#define MUI_FILETYPE_LANGUAGE_NEUTRAL_MAIN  0x002   // GetFileMUIInfo found a LN main module resource file
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.18362.0\um\winnls.h(1013,0)
  • Ifndef NONLS
  • If WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES)
  • If (WINVER >= 0x0600)
19 2.575185 DISPID_VERBINVOKED Int32 202 0x000000CA -54 System.Int32
#define DISPID_VERBINVOKED           202    // A verb (either from the main or context menu) was invoked in the folder view
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.18362.0\um\shdispid.h(23,0)
  • If WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
20 2.575185 DISPID_WINDOWMOVE Int32 109 0x0000006D 109 System.Int32
#define DISPID_WINDOWMOVE         109   // sent when main window has been moved
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.18362.0\um\exdispid.h(28,0)
  • Ifndef EXDISPID_H_
  • If WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
21 2.575185 DISPID_WINDOWRESIZE Int32 110 0x0000006E 110 System.Int32
#define DISPID_WINDOWRESIZE       110   // sent when main window has been sized
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.18362.0\um\exdispid.h(29,0)
  • Ifndef EXDISPID_H_
  • If WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
22 2.575185 DISPID_WINDOWACTIVATE Int32 111 0x0000006F 111 System.Int32
#define DISPID_WINDOWACTIVATE     111   // sent when main window has been activated
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.18362.0\um\exdispid.h(30,0)
  • Ifndef EXDISPID_H_
  • If WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
23 2.575185 NdisHashFunctionToeplitz Int32 1 0x00000001 1 System.Int32
#define NdisHashFunctionToeplitz                            0x00000001 // supported hash function 1 -- Main RSS hash function
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.18362.0\shared\ntddndis.h(5573,0)
  • If WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM | WINAPI_PARTITION_GAMES)
  • If ((NTDDI_VERSION >= NTDDI_VISTA) || NDIS_SUPPORT_NDIS6)
24 2.575185 AutomationLandmarkType Enum
enum AutomationLandmarkType
                    {
                        None       = 0,
                        Custom     = 1,
                        Form       = 2,
                        Main       = 3,
                        Navigation = 4,
                        Search     = 5
                    };
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.18362.0\winrt\windows.ui.xaml.automation.peers.idl(1053,0)
25 2.575185 COINITIEE::COINITEE_MAIN Int32 2 0x00000002 2 System.Int32
COINITEE_MAIN           = 0x2           // Initialize prior to entering the main routine
%ProgramFiles(x86)%\Windows Kits\NETFXSDK\4.8\include\um\cor.h(221,0)
26 2.253287 DISPID_DEFAULTVERBINVOKED Int32 203 0x000000CB -53 System.Int32
#define DISPID_DEFAULTVERBINVOKED    203    // default verb (either from the main or context menu) was invoked in the folder view
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.18362.0\um\shdispid.h(24,0)
  • If WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
27 2.230176 eAVEncDDService Enum
enum eAVEncDDService
{
    eAVEncDDService_CM = 0,  // (Main Service: Complete Main)
    eAVEncDDService_ME = 1,  // (Main Service: Music and Effects (ME))
    eAVEncDDService_VI = 2,  // (Associated Service: Visually-Impaired (VI)
    eAVEncDDService_HI = 3,  // (Associated Service: Hearing-Impaired (HI))
    eAVEncDDService_D  = 4,  // (Associated Service: Dialog (D))
    eAVEncDDService_C  = 5,  // (Associated Service: Commentary (C))
    eAVEncDDService_E  = 6,  // (Associated Service: Emergency (E))
    eAVEncDDService_VO = 7   // (Associated Service: Voice Over (VO) / Karaoke)
};
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.18362.0\um\codecapi.h(1492,0)
  • If WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
28 1.931389 PackageTypes Enum
enum PackageTypes
            {
                None      = 0x0,
                Main      = 0x1,
                Framework = 0x2,
                Resource  = 0x4,
                Bundle    = 0x8,
                [contract(Windows.Foundation.UniversalApiContract, 1.0)]
                Xap       = 0x10,
                [contract(Windows.Foundation.UniversalApiContract, 3.0)]
                Optional  = 0x20
            };
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.18362.0\winrt\windows.management.deployment.idl(208,0)
29 1.931389 COINITIEE Enum
typedef enum tagCOINITEE
{
    COINITEE_DEFAULT        = 0x0,          // Default initialization mode. 
    COINITEE_DLL            = 0x1,          // Initialization mode for loading DLL. 
    COINITEE_MAIN           = 0x2           // Initialize prior to entering the main routine 
} COINITIEE;
%ProgramFiles(x86)%\Windows Kits\NETFXSDK\4.8\include\um\cor.h(217,0)
30 1.820931 __magnumdb__enum_msoci_h_8 Enum
enum
	{
	msocWindowFrameToplevel = 0,
		/* MDI Apps should return the MDI frame (not MDI client) or App frame
			TBS::m_hwnd. */

	msocWindowFrameOwner = 1,
		/* This is the window which owns the component. It could be same as
			of that window. For a toolbar set this will be TBS::m_hwnd. */

	msocWindowComponent = 2,
		/* This is the "main" window of the component (if it has one). */
		/* This is the "main" window of the component (if it has one). */

	msocWindowDlgOwner = 3,
		/* Caller wishes to display a dialog to be parented by the component.
			owner window. */  
	};
%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Professional\VSSDK\VisualStudioIntegration\Common\Inc\office10\msoci.h(213,0)
31 1.609491 PARTITION_MAIN_OS_GUID Guid 57434f53-8f45-405e-8a23-186d8a4330d3 N: 57434f538f45405e8a23186d8a4330d3
B: {57434f53-8f45-405e-8a23-186d8a4330d3}
P: (57434f53-8f45-405e-8a23-186d8a4330d3)
X: {0x57434f53,0x8f45,0x405e,{0x8a,0x23,0x18,0x6d,0x8a,0x43,0x30,0xd3}}
A: 534F4357458F5E408A23186D8A4330D3
System.Guid
DEFINE_GUID(PARTITION_MAIN_OS_GUID,         0x57434F53L, 0x8F45, 0x405E, 0x8A, 0x23, 0x18, 0x6D, 0x8A, 0x43, 0x30, 0xD3);    // Main OS partition
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.18362.0\shared\diskguid.h(56,0)
  • If WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM)
  • Ifdef DEFINE_GUID