How does it work?

MagNumDB is a database that contains about 300,000 items. These items are constants, names, values all extracted from more than 4,000 header files (.h, .hxx, .hpp, .idl, etc.) provided by standard Windows and Visual Studio SDKs.
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.

 "C2P5"

To build this database, we have written a powerful C/C++ parser named C2P5 (for C/CPP/PreProcessor/Parser), tailored specifically for this task. 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). 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++ enum definitions
  • Special GUID constructs like DECLSPEC_UUID, DEFINE_GUIDSTRUCT or MIDL_INTERFACE
  • 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.

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 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 Lucene'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 Lucene'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: Lucene'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 Lucene's 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 sometimes compute the final value, because it sometimes require contextual information (custom defines, compiler architecture, etc.) that the parser doesn't have. 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.

 Database Metrics

  • Last update date: Tuesday, 17 October 2017
  • Items count: 304412
  • Parsed files count: 4278
  • Windows SDK version: 10.0.16299.0

 

 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 Simon Mourier V1.0.3. 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 Conditions
Index Score Name Type Value Hex value Signed value Guid formats Char type Storage type Source line(s) File path Conditions
1 5.723812 CompositionBorderMode::Hard Int32 2 0x00000002 2 System.Int32
Hard    = 2
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.16299.0\winrt\windows.ui.composition.idl(610,0)
2 3.372789 SHSTOCKICONID::SIID_DRIVEFIXED Int32 8 0x00000008 8 System.Int32
SIID_DRIVEFIXED = 8,          // fixed (hard disk) drive
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.16299.0\um\shellapi.h(1306,0)
  • If WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  • If (WINVER >= 0x0400)
  • If (NTDDI_VERSION >= NTDDI_VISTA)
3 3.372789 EVENT_TRACE_TYPE_MM_HPF Int32 14 0x0000000E 14 System.Int32
#define EVENT_TRACE_TYPE_MM_HPF                0x0E      // Hard page fault
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.16299.0\shared\evntrace.h(221,0)
  • If defined(_WINNT_) || defined(WINNT)
  • If WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM)
4 3.372789 EVENT_TRACE_FLAG_MEMORY_HARD_FAULTS Int32 8192 0x00002000 8192 System.Int32
#define EVENT_TRACE_FLAG_MEMORY_HARD_FAULTS 0x00002000  // hard faults only
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.16299.0\shared\evntrace.h(344,0)
  • If defined(_WINNT_) || defined(WINNT)
  • If WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM)
5 3.372789 CompositionBorderMode Enum
enum CompositionBorderMode
            {
                Inherit = 0,
                Soft    = 1,
                Hard    = 2
            };
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.16299.0\winrt\windows.ui.composition.idl(606,0)
6 3.338891 DIBUTTON_SOCCERD_FOUL Int32 520111112 0x1F004408 520111112 System.Int32
#define DIBUTTON_SOCCERD_FOUL                   0x1F004408 /* Initiate a foul / hard-foul */
#define DIBUTTON_SOCCERD_FOUL                   0x1F004408 /* Initiate a foul / hard-foul */
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.16299.0\um\dinput.h(4012,0)
  • If WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
7 2.861906 JET_errPatchFileMissing Int32 -538 0xFFFFFDE6 -538 System.Int32
#define JET_errPatchFileMissing				-538  /* Hard restore detected that patch file is missing from backup set */
#define JET_errPatchFileMissing				-538  /* Hard restore detected that patch file is missing from backup set */
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.16299.0\um\esent.h(3089,0)
  • If !defined(_JET_INCLUDED)
8 2.861906 JET_errLogTornWriteDuringHardRestore Int32 -570 0xFFFFFDC6 -570 System.Int32
#define JET_errLogTornWriteDuringHardRestore	-570	/* torn-write was detected in a backup set during hard restore */
#define JET_errLogTornWriteDuringHardRestore	-570	/* torn-write was detected in a backup set during hard restore */
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.16299.0\um\esent.h(3125,0)
  • If !defined(_JET_INCLUDED)
9 2.861906 JET_errLogCorruptDuringHardRestore Int32 -573 0xFFFFFDC3 -573 System.Int32
#define JET_errLogCorruptDuringHardRestore		-573	/* corruption was detected in a backup set during hard restore */
#define JET_errLogCorruptDuringHardRestore		-573	/* corruption was detected in a backup set during hard restore */
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.16299.0\um\esent.h(3127,0)
  • If !defined(_JET_INCLUDED)
10 2.861906 JET_errLogCorruptDuringHardRecovery Int32 -574 0xFFFFFDC2 -574 System.Int32
#define JET_errLogCorruptDuringHardRecovery	 	-574	/* corruption was detected during hard recovery (log was not part of a backup set) */
#define JET_errLogCorruptDuringHardRecovery	 	-574	/* corruption was detected during hard recovery (log was not part of a backup set) */
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.16299.0\um\esent.h(3128,0)
  • If !defined(_JET_INCLUDED)
11 2.698231 JET_errRestoreOfNonBackupDatabase Int32 -615 0xFFFFFD99 -615 System.Int32
#define JET_errRestoreOfNonBackupDatabase	-615	//	hard recovery attempted on a database that wasn't a backup database
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.16299.0\um\esent.h(3164,0)
  • If !defined(_JET_INCLUDED)
12 2.698231 ULineBreakTag Enum
typedef enum ULineBreakTag {
    /** Tag value for soft line breaks, positions at which a line break
      *  is acceptable but not required                */
    UBRK_LINE_SOFT            = 0,
    /** Upper bound for soft line breaks.              */
    /** Upper bound for soft line breaks.              */
    UBRK_LINE_SOFT_LIMIT      = 100,
    /** Tag value for a hard, or mandatory line break  */
    /** Tag value for a hard, or mandatory line break  */
    UBRK_LINE_HARD            = 100,
    /** Upper bound for hard line breaks.              */
    /** Upper bound for hard line breaks.              */
    UBRK_LINE_HARD_LIMIT      = 200
} ULineBreakTag;
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.16299.0\um\icu.h(25449,0)
  • If (NTDDI_VERSION >= NTDDI_WIN10_RS3)
  • If !UCONFIG_NO_BREAK_ITERATION
  • If (NTDDI_VERSION >= NTDDI_WIN10_RS2)
13 2.698231 FOFX_PREFERHARDLINK Int32 131072 0x00020000 131072 System.Int32
#define FOFX_PREFERHARDLINK          0x00020000  // Create hard link if possible
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.16299.0\um\shobjidl_core.h(15751,0)
  • If WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  • If (NTDDI_VERSION >= NTDDI_WINXP) || (_WIN32_IE >= _WIN32_IE_IE70)
  • If (_WIN32_IE >= _WIN32_IE_IE70)
14 2.384922 JET_errLogTornWriteDuringHardRecovery Int32 -571 0xFFFFFDC5 -571 System.Int32
#define JET_errLogTornWriteDuringHardRecovery	-571	/* torn-write was detected during hard recovery (log was not part of a backup set) */
#define JET_errLogTornWriteDuringHardRecovery	-571	/* torn-write was detected during hard recovery (log was not part of a backup set) */
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.16299.0\um\esent.h(3126,0)
  • If !defined(_JET_INCLUDED)
15 1.907937 USentenceBreakTag Enum
typedef enum USentenceBreakTag {
    /** Tag value for for sentences  ending with a sentence terminator
      */
    UBRK_SENTENCE_TERM       = 0,
    /** Upper bound for tags for sentences ended by sentence terminators.    */
    /** Upper bound for tags for sentences ended by sentence terminators.    */
    UBRK_SENTENCE_TERM_LIMIT = 100,
    /** Tag value for for sentences that do not contain an ending
      */
    UBRK_SENTENCE_SEP        = 100,
    /** Upper bound for tags for sentences ended by a separator.              */
    /** Upper bound for tags for sentences ended by a separator.              */
    UBRK_SENTENCE_SEP_LIMIT  = 200
    /** Tag value for a hard, or mandatory line break  */
    /** Tag value for a hard, or mandatory line break  */
} USentenceBreakTag;
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.16299.0\um\icu.h(25474,0)
  • If (NTDDI_VERSION >= NTDDI_WIN10_RS3)
  • If !UCONFIG_NO_BREAK_ITERATION
  • If (NTDDI_VERSION >= NTDDI_WIN10_RS2)
16 0.5059183 SHSTOCKICONID Enum
typedef enum SHSTOCKICONID
{
    SIID_DOCNOASSOC = 0,          // document (blank page), no associated program
    SIID_DOCASSOC = 1,            // document with an associated program
    SIID_APPLICATION = 2,         // generic application with no custom icon
    SIID_FOLDER = 3,              // folder (closed)
    SIID_FOLDEROPEN = 4,          // folder (open)
    SIID_DRIVE525 = 5,            // 5.25" floppy disk drive
    SIID_DRIVE35 = 6,             // 3.5" floppy disk drive
    SIID_DRIVEREMOVE = 7,         // removable drive
    SIID_DRIVEFIXED = 8,          // fixed (hard disk) drive
    SIID_DRIVENET = 9,            // network drive
    SIID_DRIVENETDISABLED = 10,   // disconnected network drive
    SIID_DRIVECD = 11,            // CD drive
    SIID_DRIVERAM = 12,           // RAM disk drive
    SIID_WORLD = 13,              // entire network
    SIID_SERVER = 15,             // a computer on the network
    SIID_PRINTER = 16,            // printer
    SIID_MYNETWORK = 17,          // My network places
    SIID_FIND = 22,               // Find
    SIID_HELP = 23,               // Help
    SIID_SHARE = 28,              // overlay for shared items
    SIID_LINK = 29,               // overlay for shortcuts to items
    SIID_SLOWFILE = 30,           // overlay for slow items
    SIID_RECYCLER = 31,           // empty recycle bin
    SIID_RECYCLERFULL = 32,       // full recycle bin
    SIID_MEDIACDAUDIO = 40,       // Audio CD Media
    SIID_LOCK = 47,               // Security lock
    SIID_AUTOLIST = 49,           // AutoList
    SIID_PRINTERNET = 50,         // Network printer
    SIID_SERVERSHARE = 51,        // Server share
    SIID_PRINTERFAX = 52,         // Fax printer
    SIID_PRINTERFAXNET = 53,      // Networked Fax Printer
    SIID_PRINTERFILE = 54,        // Print to File
    SIID_STACK = 55,              // Stack
    SIID_MEDIASVCD = 56,          // SVCD Media
    SIID_STUFFEDFOLDER = 57,      // Folder containing other items
    SIID_DRIVEUNKNOWN = 58,       // Unknown drive
    SIID_DRIVEDVD = 59,           // DVD Drive
    SIID_MEDIADVD = 60,           // DVD Media
    SIID_MEDIADVDRAM = 61,        // DVD-RAM Media
    SIID_MEDIADVDRW = 62,         // DVD-RW Media
    SIID_MEDIADVDR = 63,          // DVD-R Media
    SIID_MEDIADVDROM = 64,        // DVD-ROM Media
    SIID_MEDIACDAUDIOPLUS = 65,   // CD+ (Enhanced CD) Media
    SIID_MEDIACDRW = 66,          // CD-RW Media
    SIID_MEDIACDR = 67,           // CD-R Media
    SIID_MEDIACDBURN = 68,        // Burning CD
    SIID_MEDIABLANKCD = 69,       // Blank CD Media
    SIID_MEDIACDROM = 70,         // CD-ROM Media
    SIID_AUDIOFILES = 71,         // Audio files
    SIID_IMAGEFILES = 72,         // Image files
    SIID_VIDEOFILES = 73,         // Video files
    SIID_MIXEDFILES = 74,         // Mixed files
    SIID_FOLDERBACK = 75,         // Folder back
    SIID_FOLDERFRONT = 76,        // Folder front
    SIID_SHIELD = 77,             // Security shield. Use for UAC prompts only.
    SIID_WARNING = 78,            // Warning
    SIID_INFO = 79,               // Informational
    SIID_ERROR = 80,              // Error
    SIID_KEY = 81,                // Key / Secure
    SIID_SOFTWARE = 82,           // Software
    SIID_RENAME = 83,             // Rename
    SIID_DELETE = 84,             // Delete
    SIID_MEDIAAUDIODVD = 85,      // Audio DVD Media
    SIID_MEDIAMOVIEDVD = 86,      // Movie DVD Media
    SIID_MEDIAENHANCEDCD = 87,    // Enhanced CD Media
    SIID_MEDIAENHANCEDDVD = 88,   // Enhanced DVD Media
    SIID_MEDIAHDDVD = 89,         // HD-DVD Media
    SIID_MEDIABLURAY = 90,        // BluRay Media
    SIID_MEDIAVCD = 91,           // VCD Media
    SIID_MEDIADVDPLUSR = 92,      // DVD+R Media
    SIID_MEDIADVDPLUSRW = 93,     // DVD+RW Media
    SIID_DESKTOPPC = 94,          // desktop computer
    SIID_MOBILEPC = 95,           // mobile computer (laptop/notebook)
    SIID_USERS = 96,              // users
    SIID_MEDIASMARTMEDIA = 97,    // Smart Media
    SIID_MEDIACOMPACTFLASH = 98,  // Compact Flash
    SIID_DEVICECELLPHONE = 99,    // Cell phone
    SIID_DEVICECAMERA = 100,      // Camera
    SIID_DEVICEVIDEOCAMERA = 101, // Video camera
    SIID_DEVICEAUDIOPLAYER = 102, // Audio player
    SIID_NETWORKCONNECT = 103,    // Connect to network
    SIID_INTERNET = 104,          // Internet
    SIID_ZIPFILE = 105,           // ZIP file
    SIID_SETTINGS = 106,          // Settings
    SIID_DRIVEHDDVD = 132,        // HDDVD Drive (all types)
    SIID_DRIVEBD = 133,           // BluRay Drive (all types)
    SIID_MEDIAHDDVDROM = 134,     // HDDVD-ROM Media
    SIID_MEDIAHDDVDR = 135,       // HDDVD-R Media
    SIID_MEDIAHDDVDRAM = 136,     // HDDVD-RAM Media
    SIID_MEDIABDROM = 137,        // BluRay ROM Media
    SIID_MEDIABDR = 138,          // BluRay R Media
    SIID_MEDIABDRE = 139,         // BluRay RE Media (Rewriable and RAM)
    SIID_CLUSTEREDDRIVE = 140,    // Clustered disk
    SIID_MAX_ICONS = 181,
} SHSTOCKICONID;
%ProgramFiles(x86)%\Windows Kits\10\Include\10.0.16299.0\um\shellapi.h(1296,0)
  • If WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  • If (WINVER >= 0x0400)
  • If (NTDDI_VERSION >= NTDDI_VISTA)