The Unofficial



TypeLib Data Format



Specification




by TheirCorp

Yellow notes by Andrej Biasic








Table of

Contents






Part One:

Introduction



Part Two:

Data Structures



Part Three:

Equates



Introduction



What is TypeLib Data?

TypeLib data is used by operating systems to tell them how to connect COM
objects. COM stands for Component Object Model.
It commonly occurs alone in ".TLB" files and also as resources in PE (Portable
Executable) format files (.DLL, .EXE, .OCX, .OCA, ...).
When it occurs as a resource, it is in a section named "TYPELIB". There can be
multiple TypeLib resources in a PE file.

TypeLib data comes in only(?) two internal formats: "MSFT" and "SLTG". This
document only covers the MSFT format. The details of the SLGT format were not
known at the time of this writing, and so will be published later, if ever. SLGT
format data is relatively rare anyway: perhaps a few percent of the files on a
32-bit system will have any. It would certainly be good to know it though. It
appears PowerBASIC's latest compilers use SLTG, which is another good reason to
learn it.

Origins of this Document

This document is based largely on studies of code from the ReactOS project at:
http://www.reactos.org/en/index.html
The primary source file studied (along with #included files) was:
...reactos\dll\win32\oleaut32\typelib.c
Some (mostly minor) aspects of the format have not been confirmed by TheirCorp
and so are based entirely on (sometimes unclear) comments from ReactOS source
code. Some of these are marked as "According to ReactOS".

Credits and Copyleft

This document was created by TheirCorp.
You may freely distribute this file even if it's modified. If you do distribute
a modified version, please include a copy of, or a link to an original file.
And please always give credit to TheirCorp for the original.

This file's official home on the web is:
http://theircorp.freezoka.com/files/TypeLib.txt http://theircorp.byethost11.com/files/TypeLib.txt?i=1
There is expected to be an HTML version in the future.

TheirCorp's website is:
http://theircorp.freezoka.com/index.php (dead link)



Notes on this

Document




COM Terminology and ODL Syntax

Some of the names and terminology used are based on articles by Microsoft on
COM, automation and the syntax of .ODL/.IDL files. You can learn more about COM
technology at the following web pages:

COM Topics
http://msdn.microsoft.com/en-us/library/aa139695.aspx (dead link)

COM (Component Object Model)
http://msdn.microsoft.com/en-us/library/ms680573(VS.85).aspx

Automation Programming Reference
http://msdn.microsoft.com/en-us/library/ms221375.aspx

Microsoft Interface Definition Language (MIDL)
http://msdn.microsoft.com/en-us/library/aa367091(VS.85).aspx

Naming Conventions

The terms "variable type" and "data type" are used almost interchangeably. The
words "function" and "method" are treated as synonymous. It wasn't clear from
the available material what their proper usage is, or whether it really matters.

A data section is referred to as a "segment" if it has an entry in the "Segment
Directory" section. This is to help you distinguish between them.

Items named "Unknown..." are thought to contain useful information, but no one
feels sure what it's for. This is only a general rule at the moment.

Items named "Reserved..." are thought to never change in value or to contain no
useful information. This is only a general rule at the moment.

Diagrams

Diagrams of data structures are outlined like so:
+-----------------------------------------------------+
|                                                     |
+-----------------------------------------------------+
Other diagrams are outlined like so:
+=====================================================+
|                                                     |
+=====================================================+
Optional Data

A question mark following a box in a diagram, means the corresponding data
might be absent.

Data Types

The data types composing the structures encountered in this format are
indicated in a fairly language-neutral notation:

Byte 8
Word 16
Dword 32
Short Integer ±16
Long Integer ±32

The components of data structures are usually referred to as "fields".

Most hex values are prefixed with "0x", from C/C++ syntax. Any exceptions
should be obvious enough.

Most data types are preferentially interpreted as signed integers, because it
often makes it easier to write code to test for certain values. ReactOS seemed
to prefer signed integers also.

Offsets

A field which is an offset is indicated as such by following its name with
an arrow (==>).

Arrays

Arrays are indicated by a pair of square braces "[]", and usually containing an
indication of the number of its elements.

Notation for Structures

Diagrams of data structures will usually have an indicator of the data types of
its fields at their ends.

The example below, shows a field named "Field Name" which is an array of
sixteen 32-bit signed integers, and which might be absent (note the question
mark).
+-----------------------------------------------------+
| Field Name                                   ±32[16]| 
+-----------------------------------------------------+


The Physical Layout
of the TypeLib Data


     +=====================================================+
     | TypeLib Header                                      |
     +=====================================================+
     | Offsets to TypeInfos                                |
     +=====================================================+
     | Segment Directory                                   |-->------->------+
     +=====================================================+                  \
 +<--| TypeInfo Table                                      |<-+                |
/    +=====================================================+   \               |
|    | ImportInfo  Table                                   |<---+              |
|    +=====================================================+     \             |
|    | Imported Type Lib Table                             |<-----+            |
|    +=====================================================+       \           |
|    | References Table                                    |<-------+          |
|    +=====================================================+         \         |
|    | Lib Table                                           |<---------+        |
|    +=====================================================+           \       |
|    | GUID Table                                          |<-----------+      |
|    +=====================================================+             \     |
|    | Unknown 01                                          |<-------------+    |
|    +=====================================================+               \  /
|    | Name Table                                          |<---------------|+
|    +=====================================================+               /
|    | String Table                                        |<-------------+
|    +=====================================================+             /
|    | Type Descriptors                                 |<-----------+
|    +=====================================================+           /
|    | Array Descriptors                                |<---------+
|    +=====================================================+         /
|    | Custom Data                                         |<-------+
|    +=====================================================+       /
|    | GUID Offsets                                        |<-----+
|    +=====================================================+     /
|    | Unknown 02                                       |<---+
|    +=====================================================+   /
|    | Unknown 03                                       |<-+
\    +=====================================================+
 +-->| Function and Property Records                    |
     +=====================================================+
Those sections marked with a question mark may be absent in some files. All
the others are always(?) present.
The arrows indicate some of the more important references between sections:
There are many other references made between sections and segments, but that
would result in a cluttered, confusing diagram.


The TlbHeader Structure
+-----------------------------------------------------+
| Magic1                                          ±32 |
+-----------------------------------------------------+
| Magic2                                          ±32 |
+-----------------------------------------------------+
| GUID ==>                                        ±32 |
+-----------------------------------------------------+
| Locale ID                                       ±32 |
+-----------------------------------------------------+
| Locale ID 2                                     ±32 |
+-----------------------------------------------------+
| Varflags                                        ±32 |
+-----------------------------------------------------+
| Version                                         ±32 |
+-----------------------------------------------------+
| Flags                                           ±32 |
+-----------------------------------------------------+
| TypeInfo Count                                  ±32 |
+-----------------------------------------------------+
| Help String ==>                                 ±32 |
+-----------------------------------------------------+
| Help String Context                             ±32 |
+-----------------------------------------------------+
| Help Context                                    ±32 |
+-----------------------------------------------------+
| Name Table Count                                ±32 |
+-----------------------------------------------------+
| Name Table Chars                                ±32 |
+-----------------------------------------------------+
| TypeLib Name ==>                                ±32 |
+-----------------------------------------------------+
| Help File Name ==>                              ±32 |
+-----------------------------------------------------+
| Custom Data ==>                                 ±32 |
+-----------------------------------------------------+
| Reserved1                                       ±32 |
+-----------------------------------------------------+
| Reserved2                                       ±32 |
+-----------------------------------------------------+
| Dispatch Position                               ±32 |
+-----------------------------------------------------+
| ImportInfo Count                                ±32 |
+-----------------------------------------------------+
| TypeLib File Name ==>                           ±32 | 
+-----------------------------------------------------+
Magic1

This contains the string "MSFT" (0x5446534D) and is used to identify the file's
format. A value of "SLGT" indicates the file is of another TypeLib format which
is not nearly as common and which is not documented in this file.

Magic2

= 0x00010002 (the format's version number?)

GUID Offset

Offset into the GUID Table of the Lib ID, otherwise -1

Locale ID

The locale ID, for example 0x0409 = "USA", "English United States"

Locale ID 2

Unknown

Varflags

Flags (largely unknown)

   +-+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  /  |               |               |               |               |
 /   | 15  14  13  12| 11  10  9   8 | 7   6   5   4 | 3   2   1   0 |
 \   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  |  | ? | ? | ? | ? | ? | ? | D | F | ? | ? | H | ? |   |   |   |   |
 /   |                       | l | i |       | e |   |               |
 |   |                       | l | l |       | l |   |    SysKind    |
/    |                       |   | e |       | p |   |               |
\    |                       | H | N |       | F |   |               |
 \   |                       | e | a |       | i |   |               |
 /   |                       | l | m |       | l |   |               |
 \   |   |   |   |   |   |   | p | e |   |   | e |   |   |   |   |   |
  +--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
Version

Set with SetVersion()

Flags

Set with SetFlags()

TypeInfo Count

The number of TypeInfo structures present.

Help String Offset

Offset into String Table of help string.

Help String Context

Help Context

Name Table Count

Number of names in the Name Table.

Name Table Chars

Number of characters in the Name Table.

TypeLib Name Offset

Offset into the String Table of the TypeLib's name.

Help File Name Offset

Offset into the String Table of the help file's name.

Custom Data Offset

File offset to Custom Data/GUID Table, if present, otherwise -1

Reserved1

Unknown, always 0x20 (GUID hash size?)

Reserved2

Unknown, always 0x80 (name hash size?)

Dispatch Position

hRefType to IDispatch, or -1 if there's no IDispatch

ImportInfo Count

Number of ImpInfo structures.

TypeLib File Name Offset

Offset into String Table of TypeLib file name. This field is only present if
bit 8 of the VarFlags field is set.



Offsets to TypeInfos
( ±32[TypeInfo Count] )



This section is an array of 32-bit offsets to all the TypeInfo structures in
the file. The number of elements in the array is in the "TypeInfo Count" field
of the TlbHeader.
+-----------------------------------------------------+
| Offset[1]                                       ±32 |
+-----------------------------------------------------+
| Offset[2]                                       ±32 |
+-----------------------------------------------------+
	.......
+-----------------------------------------------------+
| Offset[TypeInfoCount]                           ±32 |
+-----------------------------------------------------+


Segment Directory
( SegDesc[15] )



The Segment Directory is an array of 15 segment descriptors in the form of
SegDesc structures. Each SegDesc contains a file offset to one of the standard
data segments and its length.

The SegDesc Structure
+-----------------------------------------------------+
| Offset                                          ±32 |
+-----------------------------------------------------+
| Length                                          ±32 |
+-----------------------------------------------------+
| Reserved1                                       ±32 |
+-----------------------------------------------------+
| Reserved2                                       ±32 |
+-----------------------------------------------------+
Offset

File offset to segment.

Length

Length of segment.

Reserved1

Unknown, always -1

Reserved2

Unknown, always 0x0F, though someone reported seeing a value of 0x03.

Note:

A SegDesc for any segment which is not present has an offset value of -1
(0xFFFFFFFF) and a length value of zero.


The Directory Layout


Notice that some of the sections mentioned in the "Physical Layout of TypeLib
Data"
diagram don't have segment descriptors:
The diagram below shows the segments in the order in which their descriptors
appear in the array. Each of the boxes represents one SegDesc structure.

Order of the Segment Descriptors
+=====================================================+
| TypeInfo Table                                      |
+=====================================================+
| Import Info                                         |
+=====================================================+
| Imported Files                                      |
+=====================================================+
| References Table                                    |
+=====================================================+
| Lib Table                                           |
+=====================================================+
| GUID Table                                          |
+=====================================================+
| Unknown 01                                          |
+=====================================================+
| Name Table                                          |
+=====================================================+
| String Table                                        |
+=====================================================+
| Type Descriptors                                    |
+=====================================================+
| Array Descriptors                                   |
+=====================================================+
| Custom Data                                         |
+=====================================================+
| GUID Offsets                                        |
+=====================================================+
| Unknown 02                                          |
+=====================================================+
| Unknown 03                                          |
+=====================================================+
Each of the segments is described in its own section of this document.



TypeInfo Table
( TypeInfo[TypeInfo Count] )



This segment is an array of TypeInfo structures. The number of them is in the
"TypeInfo Count" field of the TlbHeader.

The TypeInfo Structure
+-----------------------------------------------------+
| TypeKind                                        ±32 |
+-----------------------------------------------------+
| Function Records                                ±32 |
+-----------------------------------------------------+
| Memory Allocation                               ±32 |
+-----------------------------------------------------+
| Reconstituted Size                              ±32 |
+-----------------------------------------------------+
| Reserved1                                       ±32 |
+-----------------------------------------------------+
| Reserved2                                       ±32 |
+-----------------------------------------------------+
| Function Count                                  ±16 |
+-----------------------------------------------------+
| Property Count                                  ±16 |
+-----------------------------------------------------+
| Reserved3                                       ±32 |
+-----------------------------------------------------+
| Reserved4                                       ±32 |
+-----------------------------------------------------+
| Reserved5                                       ±32 |
+-----------------------------------------------------+
| Reserved6                                       ±32 |
+-----------------------------------------------------+
| GUID ==>                                        ±32 |
+-----------------------------------------------------+
| Type Flags                                      ±32 |
+-----------------------------------------------------+
| Name ==>                                        ±32 |
+-----------------------------------------------------+
| Version                                         ±32 |
+-----------------------------------------------------+
| DocString ==>                                   ±32 |
+-----------------------------------------------------+
| Help String Context                             ±32 |
+-----------------------------------------------------+
| Help Context                                    ±32 |
+-----------------------------------------------------+
| Custom Data ==>                                 ±32 |
+-----------------------------------------------------+
| Implemented Interfaces                          ±16 |
+-----------------------------------------------------+
| Virtual Table Size                              ±16 |
+-----------------------------------------------------+
| Unknown3                                        ±32 |
+-----------------------------------------------------+
| DataType1                                       ±32 |
+-----------------------------------------------------+
| DataType2                                       ±32 |
+-----------------------------------------------------+
| Reserved7                                       ±32 |
+-----------------------------------------------------+
| Reserved8                                       ±32 |
+-----------------------------------------------------+
TypeKind
   +-+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  /  |               |               |               |               |
 /   | 15  14  13  12| 11  10  9   8 | 7   6   5   4 | 3   2   1   0 |
 \   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  |  |   |   |   |   |   | ? | ? | ? | ? | ? | ? | ? |   |   |   |   |
 /   |     Alignment     |                           |   TypeKind    |
 |   |                   |                           |     Code      |
 \   |                   |                           |               |
  +--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
The lower 4 bits are the Type Kind code.
Bits 11 through 15 contain an alignment value

Note:
From ReactOS source code:

TypeInfo's zero-based index is left-shifted 16 places.

The alignment value (currently of unknown origin) is left-shifted 6 places, then left-shifted again 11 places.
Please, note that the alignment value appears twice in TypeKind; once left-shifted by 6 places, and twice by 11 places.


Function Records

File offset to an array of Function Records and Property Records, if there are
any functions or properties present (that is, if either Function Count or
Property Count are greater than zero), otherwise it's FileLength + 1 (it points
to just past the end of the file).

Memory Allocation

Recommended (or required?) amount of memory to allocate for...?
Equals 0 if there's no element.

Note:
From ReactOS source code:

"Zero if no element, N*0x40."
There's no indication of what is N, though.


Reconstituted Size of TypeInfo Data

Equals -1 if there's no element, otherwise, it's (probably) the size of the
reconstituted TypeInfo data for the operating system's internal use (the data
is stored more compactly in the file than when it's in RAM during use).

Note:
From ReactOS source code:

"-1 if no element, (N-1)*0x38."
There's no indication of what is N, though.


Reserved1

Always? 3

Reserved2

Always? zero

Function Count

Count of functions in array

Property Count

Count of properties in array

Reserved3 through Reserved6

Always? zero

GUID Offset

Offset into GUID Table of GUID

Type Flags

See the "Type Flags" section

Name Offset

Offset into the Name Table of the name

Version

Element version

DocString Offset

Offset into String Table of the DocString

Help String Context

Help Context

Custom Data Offset

Offset into the Custom Data Table of custom data

Implemented Interfaces

Number of implemented interfaces

Virtual Table Size

Virtual table size, not including inherits

Note:
From ReactOS source code:

"Virtual table size, including inherits (field cbSizeVft.)"


Unknown3

Note:
From ReactOS source code:

"Size in bytes, at least for structures."


DataType1

Offset into Type Descriptor Table, or in base interfaces.

DataType2

If 0x8000, entry above is valid, else it is zero?

Note:
From ReactOS source code:

"
For interfaces:
hiword is num of inherited funcs,
loword is num of inherited interfaces
"


Reserved7

Always? 0

Reserved8

Always? -1

Note:

The order of the "Implemented Interfaces" and "Virtual Table Size" are
reversed for bigendian format.



ImportInfo Table
( ImpInfo[ImportInfo Count] )



This segment contains information about imported types.

The ImpInfo structure:
+-----------------------------------------------------+
| Count                                           ±16 |
+-----------------------------------------------------+
| Flags                                             8 |
+-----------------------------------------------------+
| Type Kind                                         8 |
+-----------------------------------------------------+
| Import File ==>                                 ±32 |
+-----------------------------------------------------+
| GUID ==>                                        ±32 |
+-----------------------------------------------------+
Count

Flags

Bit 0 = 1 if "GUID Offset" is an offset to a GUID, or zero if it's a TypeInfo
index in the specified typelib

Type Kind

TypeKind of the reference

Import File Offset

Offset into the Import File table

GUID Offset

Offset into GUID table or TypeInfo index (see bit 0 of Flags)


Imported TypeLib Table
( TLBImpLib[] )


This segment contains information on imported files.

The TlbImpLib Structure
+-----------------------------------------------------+
| GUID ==>                                        ±32 |
+-----------------------------------------------------+
| LCID                                            ±32 |
+-----------------------------------------------------+
| MajVer                                           16 |
+-----------------------------------------------------+
| MinVer                                           16 |
+-----------------------------------------------------+
| Size (times 4)                                   16 |
+-----------------------------------------------------+
| File name                                           |
+-----------------------------------------------------+
| Padding                                       "W"[?]| 
+-----------------------------------------------------+
GUID Offset

Offset into the GUID table of the GUID

LCID

Locale ID

MajVer

MinVer

Size (times 4)

Divide this value by 4 to get the actual length of the file name.

File name

A file name is always a multiple of fourteen bytes long. When its length needs
adjusting, it is padded with the letter "W".

Padding

From zero to thriteen W's, as needed, to make the structure a multiple of fourteen bytes.



References Table
( RefRecord[] )



This segment consists of an array of RefRecord structures.

The RefRecord Structure
+-----------------------------------------------------+
| RefType                                         ±32 |
+-----------------------------------------------------+
| Flags                                           ±32 |
+-----------------------------------------------------+
| CustData ==>                                    ±32 |
+-----------------------------------------------------+
| Next ==>                                        ±32 |
+-----------------------------------------------------+
RefType

According to ReactOS:
If it's a multiple of 4, then it's an offset into the TypeInfo Table, other-
wise it's an offset into the external reference table with an offset of 1.

Flags

?

Note:
This flag seems to come from TypeInfo.TypeFlags.

CustData Offset

Offset into the Custom Data Table of the custom data, if any.

Next Offset

Next offset, or -1 if it's the last one.



Lib Table
( ±32[32] )



According to ReactOS:
This segment always exists, always the same size (0x80). Possibly a hash table
with offsets to GUID?



GUID Table
( GuidEntry[] )



Is an array of GUIDEntry structures.

The GUIDEntry Structure:
+-----------------------------------------------------+
| GUID                                           8[16]|
+-----------------------------------------------------+
| hRefType                                        ±32 |
+-----------------------------------------------------+
| Next Hash                                       ±32 |
+-----------------------------------------------------+
GUID

A 16-character string containing the GUID.

hRefType

= -2 for a TypeLib GUID TypeInfo offset for TypeInfo GUID.
Otherwise, the low two bits:

NextHash

Offset to next GUID in the hash bucket



Unknown 01
( ±32[128] )



According to ReactOS:
This segment is always created, always the same size (0x0200). It contains
offsets into the name table.



Name Table
( TlbName[Name Table Count] )



This segment contains an array of the variable-lengthed TlbName structures. It
stores the names of such things as: interfaces, functions, properties and para-
meters.
The number of names in the table is given by the "Name Table Count" field of
the TlbHeader.
The total number of characters in all the names combined is given by the "Name
Table Chars" field of the TlbHeader.
A TlbName is always a multiple of four bytes long. When its length needs
adjusting, it is padded with the letter "W". The letter "W" can apparently be
safely replaced with any other character(s).

The TlbName Structure
+-----------------------------------------------------+
| hRefType                                        ±32 |
+-----------------------------------------------------+
| Next Hash                                       ±32 |
+-----------------------------------------------------+
| Name Length                                       8 |
+-----------------------------------------------------+
| Flags?                                            8 |
+-----------------------------------------------------+
| Hash Code                                        16 |
+-----------------------------------------------------+
| Name String                           8[Name Length]|
+-----------------------------------------------------+
| Padding                                       "W"[?]| 
+-----------------------------------------------------+
hRefType

Is -1 if name is for neither a TypeInfo, a variable, or a function (that is,
the name is for a typelib or a function parameter). Otherwise it's the offset
of the first TypeInfo that this name refers to (either to the TypeInfo itself
or to a member of the TypeInfo.

Next Hash

Offset to next name in the hash bucket

Name Length

A one-byte field containing the length of the name in bytes, not counting any
padding.

Flags?

From ReactOS:

"0x10 if name is only used once as a variable name

0x20 if name is a variable in an enumeration

0x38 if name is typeinfo name"


Hash Code

Name String

The ASCII text of the name. They are not NULL-terminated.

Padding

From zero to three W's, as needed, to make the structure's length a multiple
of four bytes.



String Table
TlbString[]



This segment contains an array of the variable-lengthed TlbString structures.
It stores data such as "help strings".

A TlbString structure is a minimum of eight bytes and always a multiple of four
bytes.
When its length needs adjusting, it is padded as needed with the letter "W".
The letter "W" can apparently be safely replaced with any other character(s).

The TlbString Structure
+-----------------------------------------------------+
| Length                                           16 |
+-----------------------------------------------------+
| String Text                                8[Length]|
+-----------------------------------------------------+
| Padding                                       "W"[?]| 
+-----------------------------------------------------+
Length

The length of the text of the string only.

String Text

The ASCII text of the string. They are not NULL-terminated.

Padding

From zero to five W's, as needed, to make the structure at least eight bytes
and also a multiple of four bytes.



Type Descriptors



This segment is an array of Type Descriptors. Although a Type Descriptor is
only eight bytes, it's comparatively complicated to decode. Initially, it is
useful to regard it as four 16-bit integers, until it's determined whether it
defines one data type or two:
The Type Descriptor (viewed as four 16-bit integers)
+-----------------------------------------------------+
| Value1 (DataType1)                              ±16 |
+-----------------------------------------------------+
| Value2 (Flags)                                  ±16 |
+-----------------------------------------------------+
| Value3                                          ±16 |
+-----------------------------------------------------+
| Value4                                          ±16 |
+-----------------------------------------------------+
Value1
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| 15  14  13  12| 11  10  9   8 | 7   6   5   4 | 3   2   1   0 |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
|               |                                               |
|               |                                               |
|  undefined    |            Primary Data Type                  |
|               |                                               |
|               |                                               |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
Value2
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| 15  14  13  12| 11  10  9   8 | 7   6   5   4 | 3   2   1   0 |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| R | B | A | V |                                               |
| e | y | r | e |                                               |
| s | R | r | c |               Base Data Type                  |
| e | e | a | t |                                               |
| r | f | y | o |                                               |
| v |   |   | r |                                               |
| e |   |   |   |                                               |
| d |   |   |   |                                               |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
As mentioned above, if (Value2 AND 0x7FFE) = 0x7FFE then Value1 is the only
data type defined. Otherwise, the primary type is either ByRef, an array or a
vector and therefore, there's a secondary data type to be defined. If so, then
the following bit assignments apply.
The upper four bits are flags and the lower twelve contain the "base data type"
code. The base data type, is either one which is compatible with the primary
type, or often, the very same code.
Presumably, only one of the flag bits will ever be set. The reserved bit
hasn't been encountered yet while studying the format.

Value3 and Value4

Under some conditions, these two are combined to form a single Dword. This
is done by using Value3 as the low word, and Value4 as the high word. Note
that the resulting combinations are often subjected to additional operations
such as ANDing and division.

Note:
This is the most confusing part of this document.
Value1 will have only one of four possible values:

VT_Ptr (0x1A) or VT_SafeArray (0x1B).
In this case, we need to check Value4. If its MSB is 1, that is, if it is negative,
then Value3 will contain a data type code, otherwise Value4 is compounded with
Value3 to give an offset into this very same Type Descriptor array.

VT_CArray (0x1C).
Value3 and Value4 are compounded to give an offset into Array Descriptors array.

VT_UserDefined (0x1D).
Value3 and Value4 are compounded to give an offset into the TypeInfo table.

As an example, see Type Descriptors below for stdole2.tlb file.

Offset Value1 Value2 Value3 Value4 Compound
Address
Remark Data Type
0 1C 7FFE 0 0 0 Offset into the Array Descriptor array
8 1A 400C C 800C Data type code is in Value3 VT_Variant
10 1A 4003 3 8003 Data type code is in Value3 VT_I4
18 1A 4000 18 8000 Data type code is in Value3 VT_Void
20 1D 7FFF 0 0 0 Offset into the TypeInfo table GUID
28 1A 7FFF 20 0 20 Offset to another Type Descriptor
30 1A 7FFE 18 0 18 Offset to another Type Descriptor
38 1A 4013 17 8013 Data type code is in Value3 VT_UInt
40 1A 4010 10 8010 Data type code is in Value3 VT_I1
48 1A 7FFE 40 0 40 Offset to another Type Descriptor
50 1D 7FFF 64 0 64 Offset into the TypeInfo table DISPPARAMS
58 1A 7FFF 50 0 50 Offset to another Type Descriptor
60 1D 7FFF C8 0 C8 Offset into the TypeInfo table EXCEPINFO
68 1A 7FFF 60 0 60 Offset to another Type Descriptor
70 1A 4013 13 8013 Data type code is in Value3 VT_UI4
78 1D 7FFF 1F4 0 1F4 Offset into the TypeInfo table IEnumVARIANT
80 1A 7FFF 78 0 78 Offset to another Type Descriptor
88 1A 7FFF 80 0 80 Offset to another Type Descriptor
90 1A 4008 8 8008 Data type code is in Value3 VT_Bstr
98 1A 4006 6 8006 Data type code is in Value3 VT_Cy
A0 1A 400B B 800B Data type code is in Value3 VT_Bool
A8 1A 4002 2 8002 Data type code is in Value3 VT_I2
B0 1D 7FFF 76C 0 76C Offset into the TypeInfo table OLE_HANDLE
B8 1A 7FFF B0 0 B0 Offset to another Type Descriptor
C0 1D 7FFF BB8 0 BB8 Offset into the TypeInfo table IFont
C8 1A 7FFF C0 0 C0 Offset to another Type Descriptor
D0 1A 7FFF C8 0 C8 Offset to another Type Descriptor
D8 1D 7FFF C1C 0 C1C Offset into the TypeInfo table Font
E0 1D 7FFF 514 0 514 Offset into the TypeInfo table OLE_XSIZE_HIMETRIC
E8 1A 7FFF E0 0 E0 Offset to another Type Descriptor
F0 1D 7FFF 578 0 578 Offset into the TypeInfo table OLE_YSIZE_HIMETRIC
F8 1A 7FFF F0 0 F0 Offset to another Type Descriptor
100 1D 7FFF 44C 0 44C Offset into the TypeInfo table OLE_XPOS_HIMETRIC
108 1D 7FFF 4B0 0 480 Offset into the TypeInfo table OLE_YPOS_HIMETRIC
110 1A 4003 16 8003 Data type code is in Value3 VT_Int
118 1D 7FFF DAC 0 DAC Offset into the TypeInfo table Picture
120 1D 3 ED8 0 ED8 Offset into the TypeInfo table LoadPictureConstants
128 1D 7FFF E10 0 E10 Offset into the TypeInfo table IPictureDisp
130 1A 7FFF 128 0 128 Offset to another Type Descriptor
138 1A 7FFF 130 0 130 Offset to another Type Descriptor
140 1D 7FFF FA0 0 FA0 Offset into the TypeInfo table FontEvents



Array Descriptors



An Array Descriptor segment consists of an array of descriptors in the form of
ArrayDesc structures.

ArrayDesc's only appear for arrays for which the element count is specified.
That is, there would be an ArrayDesc for "int array[10]" ...but not for "int
array[]".

The ArrayDesc Structure
+-----------------------------------------------------+
| Type Descriptor                                  32 |
+-----------------------------------------------------+
| Dimensions                                       16 |
+-----------------------------------------------------+
| Data Type                                        16 |
+-----------------------------------------------------+
| Bound's                   SafeArrayBound[Dimensions]|
+-----------------------------------------------------+
Type Descriptor

If < 0 then the low-word contains the variable-type code, otherwise it's an
offset to another array descriptor.

Dimensions

The number of dimensions in the array.

Data Type

If the low-byte > 0, it contains the datatype code of the data which is stored
in the array, otherwise the datatype code is in the high-byte.

Bounds

Contains one SafeArrayBound structure for each dimension of the array, telling
how many elements are in the dimension and its lower bound.

The SafeArray Bound (SafeArrayBound) Structure
+-----------------------------------------------------+
| Elements in Array                                32 |
+-----------------------------------------------------+
| Lower Bound of Array                            ±32 |
+-----------------------------------------------------+
Elements in Array

The number of elements in the array

Lower Bound of Array

The lower bound of the array



Custom Data Table



This segment is used for custom data and default parameter values. It
contains at minimum, an identifier which incorporates values from a time-
stamp, the file's size and perhaps other things. The identifier is updated
every time the ODL/IDL source is compiled.



GUID Offsets



This segment contains 32-bit offsets into the GUID Table. Some offsets are
set to -1 (0xFFFFFFFF) to mark them as invalid.



Unknown 02



Details of this segment are unknown at this time.



Unknown 03



Details of this segment are unknown at this time.



Function Records and
Property Records Array



This section contains one or more array groups, each describing functions or
properties or both.
This section's file offset is in the "Function Records" field of the corre-
sponding TypeInfo structure.
The counts of the functions and properties described in it are in the "Function
Count" and "Property Count" fields of the TypeInfo structure.

Physical Layout of an Array Group
+=====================================================+
| Size of FuncRecord Array                        ±32 |
+=====================================================+ <-+
| Function Record            FuncRecord[FunctionCount]| ?  \
+=====================================================+     |
| Property Record            PropRecord[PropertyCount]| ?   |
+=====================================================+      \   Size of
| Method / Property ID               32[Func+Prop Cnt]|       |<-----
+=====================================================+      /  FuncRecord
| Name Offsets                       32[Func+Prop Cnt]|     |      Array
+=====================================================+     |
| Offsets to Records                 32[Func+Prop Cnt]|    /
+=====================================================+ <-+
Size of FuncRecord Array

This field contains the size of everything in the array group except for
itself.

Function Records and Property Records

Either one or both of these arrays will be present:
Function Records always(?) precede Property Records.

IDs, Names and Records Arrays

These, (the last three arrays), all have the same number of elements, which
is equal to the sum of the "Function Count" and "Property Count" fields of
the TypeInfo structure. That is, if there are four functions and three
properties, then they will all have seven elements each.

Method / Property ID 32[Function Count + Property Count]
Name Offsets 32[Function Count + Property Count]
Offsets to Records 32[Function Count + Property Count]

These are described more fully in a later section.



Function Record
( FuncRecord )



These occur in arrays referenced by the "Function Records" field of a TypeInfo
structure
. They may be accompanied by zero or more Property Records.
The number of optional fields is variable and is determined from the record
size. The rule is: "if there's room for it, then it's there...". The thing to
remember is, that if a particular optional field is present, then so are all
the ones that precede it in the order indicated in the diagram. So, if there's
a HelpStringContext, then there must also be the HelpContext, HelpString, Entry,
Reserved2 and Reserved3 fields, but not necessarily a "Custom Data" field.

Note:
There's a gotcha, though: If "Parameter Count" field is > 0, field
"Parameter Info" will be present, but it does not mean all preceding optional
fields will be present too, only the ones for which there's room.

The same goes for "Custom Data for Arguments". If FKCCIC's bit 12 is set and
there's room for "Custom Data for Arguments", then it will be there, even though
"Custom Data" may not exist.

The FuncRecord Structure
+-----------------------------------------------------+ <--+
| RecordSize                                       16 |     \
+-----------------------------------------------------+      |
| Unknown                                          16 |      |
+-----------------------------------------------------+      |
| DataType                                        ±16 |      |
+-----------------------------------------------------+      |
| Flags                                           ±16 |      |
+-----------------------------------------------------+      |
| Reserved1                                       ±32 |      |
+-----------------------------------------------------+      |
| Virtual Table ==>                               ±16 |      |
+-----------------------------------------------------+      |
| Func Desc Size                                  ±16 |      |
+-----------------------------------------------------+      |
| FKCCIC                                          ±32 |      \
+-----------------------------------------------------+       \    RecordSize
| Parameter Count                                 ±16 |        |<-----
+-----------------------------------------------------+       /
| Unknown2                                        ±16 |      /
+-----------------------------------------------------+      |
| HelpContext                                     ±32 |   |
+-----------------------------------------------------+      |
| HelpString                                      ±32 |   |
+-----------------------------------------------------+      |
| Entry                                           ±32 |   |
+-----------------------------------------------------+      |
| Reserved2                                       ±32 |   |
+-----------------------------------------------------+      |
| Reserved3                                       ±32 |   |
+-----------------------------------------------------+      |
| HelpStringContext                               ±32 |   |
+-----------------------------------------------------+      |
| Custom Data                                     ±32 |   |
+-----------------------------------------------------+      |
| Custom Data for Arguments ==>        ±32[ParamCount]|   |
+-----------------------------------------------------+      |
| Parameter Info                 ParamInfo[ParamCount]|  /
+-----------------------------------------------------+ <--+
RecordSize

The size of the FuncRecord structure, including optional fields and
ParamInfo's

Unknown

DataType

Data type returned by the function

Flags

If the MSB = 1, then the low byte is valid. So far it seems to always be
valid, except for pointers. When MSB does equal 1, the low byte is the code
for a data type that's equivalent to or compatible with that in DataType.

Reserved1

Virtual Table Offset

Func Desc Size

From ReactOS: Size of the reconstituted FUNCDESC and related structs.
The "structs" refered to are those used by the operating system for run-time
storage, and aren't a part of the TypeLib format.

FKCCIC

This field is 32 bits wide, but only the meanings of the lower thirteen bits
are known.

   +-+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  /  |               |               |               |               |
 /   | 15  14  13  12| 11  10  9   8 | 7   6   5   4 | 3   2   1   0 |
 \   +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  |  | ? | ? | I | D |   |   |   |   | C |   |   |   |   |   |   |   |
 /   |   |   | s | e |               | u |               |           |
 |   |   |   | I | f |    Calling    | s |  Invocation   | Function  |
/    |   |   | n | V |  Convention   | t |    Kind       |   Kind    |
\    |   |   | t | a |               | D |               |           |
 \   |   |   | R | l |               | a |               |           |
 /   |   |   | e | u |               | t |               |           |
 \   |   |   | s | e |   |   |   |   | a |   |   |   |   |   |   |   |
  +--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
Parameter Count

Unknown2

HelpContext

HelpString

Entry

Reserved2

Reserved3

HelpStringContext

Custom Data

Offset into the Custom Data Table of Custom Data for the function

Custom Data for Arguments

An array of Custom Data with one element for each parameter. If the MSB = 1,
then the default value is in the lower three bytes, otherwise, it's an offset
into the Custom Data Table where the default value can be found. The only time
an offset is resorted to, is when the default value can't fit into the lower
24 bits.
If a parameter has a default value, bit 5 (PARAMFLAG_FHASDEFAULT) of the
ParamFlags field of its ParamInfo structure will be set, but the existence of
a set bit 5 of a ParamFlags field alone, might not reliably indicate the
presence of a "Custom Data for Arguments" array. To determine if this (optional)
array is present, one should make sure that there's enough room for it to fit.

Note:

If even one parameter has a default value, then there will be elements for
all the parameters in the FuncRecord, but the only valid elements will be
the ones for those which actually have default values.

Note:
The entry in the Custom Data table - at least for strings -
has the following format:
+-------------------------+
| Data type code        16|
+-------------------------+
| Length                16|
+-------------------------+
| Null                  16| 
+-------------------------+
| Data           8[Length]|
+-------------------------+
| Padding           "W"[?]| 
+-------------------------+

Data type code

Data type code for the entry, i.e. 0008 (BSTR).

Length

Length of the string.

Null

Alway(?) zero.
It may not exist if Length is zero.

Data

A string is always a multiple of four bytes long (counting Null). When its
length needs adjusting, it is padded with the letter "W".

Padding

From zero to three W's, as needed, to make the structure a multiple of four bytes.


Parameter Info Array

Is an array of ParamInfo structures described in the next section.

Note:

The order of the "Virtual Table Offset" and "Func Desc Size" fields are
reversed for bigendian format.



Parameter Info
ParamInfo[ParamCount]



The ParamInfo Structure
+-----------------------------------------------------+
| DataType                                        ±16 |
+-----------------------------------------------------+
| Flags                                           ±16 |
+-----------------------------------------------------+
| Name ==>                                        ±32 |
+-----------------------------------------------------+
| ParamFlags                                      ±32 |
+-----------------------------------------------------+
DataType

The data-type code for the parameter.

Note:
DataType only contains parameter's data-type code when Flags is not zero.
When it is zero, it is an offset to Type Descriptors array.

Flags

?

Name Offset

Offset to the parameter's name in the Name Table

ParamFlags
   +-+---+---+---+---+---+---+---+---+
  /  |               |               |
 /   | 7   6   5   4 | 3   2   1   0 |
 \   +---+---+---+---+---+---+---+---+
  |  | ? | H | H | O | R | L | O | I |
 /   |   | a | a | p | e | C | u | n |
 |   |   | s | s | t | t | I | t |   |
/    |   | C | D | i | V | D |   |   |
\    |   | u | e | o | a |   |   |   |
 \   |   | s | f | n | l |   |   |   |
 /   |   | t | a | a |   |   |   |   |
 /   |   | o | u | l |   |   |   |   |
 \   |   | m | l |   |   |   |   |   |
  |  |   | D | t |   |   |   |   |   |
 /   |   | a |   |   |   |   |   |   |
|    |   | t |   |   |   |   |   |   |
 \   |   | a |   |   |   |   |   |   |
  +--+---+---+---+---+---+---+---+---+
As shown in the diagram, the lower seven bits contain flags describing the
parameter (see the "Parameter Flags" equates):

Bit# 0:In
Bit# 1:Out
Bit# 2:LCID
Bit# 3:RetVal
Bit# 4:Opt
Bit# 5:HasDefault
Bit# 6:HasCustData



Property Record
( PropRecord )



These occur in arrays referenced by the "Function Records" field of a TypeInfo
structure
. They may be accompanied by zero or more Function Records (described
above). The size of the required fields of the PropRecord structure is 20
(= 0x14).
The number of optional fields is variable and is determined from the record
size. The rule is: "if there's room for it, then it's there..." The thing to
remember is, that if a particular optional field is present, then so are all
the ones that precede it in the order indicated in the diagram. So, if "Custom
Data" is there, then there must also be the Unknown, HelpContext, HelpString
and Reserved fields, but not necessarily a HelpStringContext field.

The PropRecord Structure
+-----------------------------------------------------+ <---+
| RecordSize                                       16 |      \
+-----------------------------------------------------+       |
| PropNum                                          16 |       |
+-----------------------------------------------------+       |
| DataType                                        ±16 |       |
+-----------------------------------------------------+       \
| Flags                                           ±16 |        \ RecordSize
+-----------------------------------------------------+         |<------
| VarKind                                         ±16 |        /
+-----------------------------------------------------+       /
| Var Desc Size                                   ±16 |       |
+-----------------------------------------------------+       |
| OffsValue                                       ±32 |       |
+-----------------------------------------------------+       |
| Unknown                                         ±32 |    |
+-----------------------------------------------------+       |
| HelpContext                                     ±32 |    |
+-----------------------------------------------------+       |
| HelpString                                      ±32 |    |
+-----------------------------------------------------+       |
| Reserved                                        ±32 |    |
+-----------------------------------------------------+       |
| Custom Data ==>                                 ±32 |    |
+-----------------------------------------------------+       |
| HelpStringContext                               ±32 |   /
+-----------------------------------------------------+ <---+
RecordSize

Size of PropRecord

PropNum

Property number?

DataType

Data type of the variable

Note:
If bit four of OffsValue is 1, then this property is either a fixed-length array
or a pointer, otherwise DataType has the variable's data type code.

Being an array or a pointer, we get to its Array Descriptor in property reading
order.
It means that for the first array property we read from the file, its
corresponding array descriptor is the first one in Array Descriptors' array
and so on.

If we run out of array descriptors, then the Data Type is an offset into
Type Descriptors table.

Flags

VarFlags

VarKind

VarKind --- %VAR and %VarFlags

Var Desc Size

From ReactOS: Size of the reconstituted VARDESC and related structs.
The "structs" refered to are those used by the operating system for run-time
storage, and aren't a part of the TypeLib format.

OffsValue

Value of the variable or the offset in the data structure

Unknown

Note:
For an enum member, if the MSB = 1, then its value is in the lower three bytes.

HelpContext

HelpString

Reserved

Unknown (-1)

Custom Data offset

Custom data for variable

HelpStringContext

Note:

The order of the VarKind and VarDescSize fields are reversed for bigendian
format.



ID, Name and
Reference Arrays



These three Dword arrays each have one element for every method and property:
  1. Method/Property IDs
  2. Offsets to names in Name Table
  3. Offsets to Records
They are always at the very end of an Array Group of Function Records and
Property Records. In fact, it appears that "at the very end of the Array Group",
is the ONLY way to define their locations.
All three arrays have the same number of elements, that number being equal to
FunctionCount + PropertyCount.
The elements for functions (if any) come before those for properties (if any).

Method and Property ID Array
+-----------------------------------------------------+
| Method/Property ID 1                             32 |
+-----------------------------------------------------+
| Method/Property ID 2                             32 |
+-----------------------------------------------------+
		.....
+-----------------------------------------------------+
| Method/Property ID[Func+Prop Cnt]                32 |
+-----------------------------------------------------+
Offsets to names in Name Table
+-----------------------------------------------------+
| Name 1 ==>                                       32 |
+-----------------------------------------------------+
| Name 2 ==>                                       32 |
+-----------------------------------------------------+
		.....
+-----------------------------------------------------+
| Name[Func+Prop Cnt] ==>                          32 |
+-----------------------------------------------------+
Offsets to Records
+-----------------------------------------------------+
| Record 1 ==>                                     32 |
+-----------------------------------------------------+
| Record 2 ==>                                     32 |
+-----------------------------------------------------+
		.....
+-----------------------------------------------------+
| Record[Func+Prop Cnt] ==>                        32 |
+-----------------------------------------------------+


Locale IDs



Language
ID Abbr. Locality
0x0401ARAArabic Saudi Arabia
0x0801ARIArabic Iraq
0x0C01AREArabic Egypt
0x1001ARLArabic Libya
0x1401ARGArabic Algeria
0x1801ARMArabic Morocco
0x1C01ARTArabic Tunisia
0x2001AROArabic Oman
0x2401ARYArabic Yemen
0x2801ARSArabic Syria
0x2C01ARJArabic Jordan
0x3001ARBArabic Lebanon
0x3401ARKArabic Kuwait
0x3801ARUArabic U.A.E.
0x3C01ARHArabic Bahrain
0x4001ARQArabic Qatar
0x0402BGRBulgarian Bulgaria
0x0403CATCatalan Spain
0x0404CHTChinese Taiwan
0x0804CHSChinese PRC
0x0C04ZHHChinese Hong Kong
0x1004ZHIChinese Singapore
0x1404ZHMChinese Macau
0x0405CSYCzech Czech Republic
0x0406DANDanish Denmark
0x0407GERMANYGerman Germany
0x0807DESGerman Switzerland
0x0C07DEAGerman Austria
0x1007DELGerman Luxembourg
0x1407DECGerman Liechtenstein
0x0408ELLGreek Greece
0x0409USAEnglish United States
0x0809ENGEnglish United Kingdom
0x0C09ENAEnglish Australia
0x1009ENCEnglish Canada
0x1409ENZEnglish New Zealand
0x1809ENIEnglish Ireland
0x1C09ENSEnglish South Africa
0x2009ENJEnglish Jamaica
0x2409ENBEnglish Caribbean
0x2809ENLEnglish Belize
0x2C09ENTEnglish Trinidad
0x3009ENWEnglish Zimbabwe
0x3409ENPEnglish Philippines
0x040ASPAINSpanish Spain
0x080AESMSpanish Mexico
0x0C0AESNSpanish Spain (International Sort)
0x100AESGSpanish Guatemala
0x140AESCSpanish Costa Rica
0x180AESASpanish Panama
0x1C0AESDSpanish Dominican Republic
0x200AESVSpanish Venezuela
0x240AESOSpanish Colombia
0x280AESRSpanish Peru
0x2C0AESSSpanish Argentina
0x300AESFSpanish Ecuador
0x340AESLSpanish Chile
0x380AESYSpanish Uruguay
0x3C0AESZSpanish Paraguay
0x400AESBSpanish Bolivia
0x440AESESpanish El Salvador
0x480AESHSpanish Honduras
0x4C0AESISpanish Nicaragua
0x500AESUSpanish Puerto Rico
0x040BFINFinnish Finland
0x040CFRANCEFrench France
0x080CFRBFrench Belgium
0x0C0CFRCFrench Canada
0x100CFRSFrench Switzerland
0x140CFRLFrench Luxembourg
0x180CFRMFrench Monaco
0x040DHEBHebrew Israel
0x040EHUNHungarian Hungary
0x040FISLIcelandic Iceland
0x0410ITALYItalian Italy
0x0810ITSItalian Switzerland
0x0411JAPANJapanese Japan
0x0412KOREAKorean Korea
0x0413NLDDutch Netherlands
0x0813NLBDutch Belgium
0x0414NORNorwegian Norway (Bokmål)
0x0814NONNorwegian Norway (Nynorsk)
0x0415PLKPolish Poland
0x0416BRAZILPortuguese Brazil
0x0816PTGPortuguese Portugal
0x0418ROMRomanian Romania
0x0419RUSRussian Russia
0x041AHRVCroatian Croatia
0x081ASRLSerbian Serbia (Latin)
0x0C1ASRBSerbian Serbia (Cyrillic)
0x041BSKYSlovak Slovakia
0x041CSQIAlbanian Albania
0x041DSVESwedish Sweden
0x081DSVFSwedish Finland
0x041ETHAThai Thailand
0x041FTRKTurkish Turkey
0x0420URPUrdu Pakistan
0x0421INDIndonesian Indonesia
0x0422UKRUkrainian Ukraine
0x0423BELBelarusian Belarus
0x0424SLVSlovene Slovenia
0x0425ETIEstonian Estonia
0x0426LVILatvian Latvia
0x0427LTHLithuanian Lithuania
0x0827LTCClassic Lithuanian Lithuania
0x0429FARFarsi Iran
0x042AVITVietnamese Viet Nam
0x042BHYEArmenian Armenia
0x042CAZEAzeri Azerbaijan (Latin)
0x082CAZEAzeri Azerbaijan (Cyrillic)
0x042DEUQBasque Spain
0x042FMKIMacedonian Macedonia
0x0436AFKAfrikaans South Africa
0x0437KATGeorgian Georgia
0x0438FOSFaeroese Faeroe Islands
0x0439HINHindi India
0x043EMSLMalay Malaysia
0x083EMSBMalay Brunei Darussalam
0x043FKAZKazak Kazakstan
0x0441SWKSwahili Kenya
0x0443UZBUzbek Uzbekistan (Latin)
0x0843UZBUzbek Uzbekistan (Cyrillic)
0x0444TATTatar Tatarstan
0x0445BENBengali India
0x0446PANPunjabi India
0x0447GUJGujarati India
0x0448ORIOriya India
0x0449TAMTamil India
0x044ATELTelugu India
0x044BKANKannada India
0x044CMALMalayalam India
0x044DASMAssamese India
0x044EMARMarathi India
0x044FSANSanskrit India
0x0457KOKKonkani India
0x0000Language-Neutral, Language-Neutral
0x0400Process Default LanguageProcess Default Language



Data-Types
(Variable-Types)



Codes, masks and flags relating to variable types.

Variable Types

VT_Empty0
VT_Null1
VT_I22
VT_I43
VT_R44
VT_R85
VT_Cy6
VT_Date7
VT_BStr8
VT_Dispatch9
VT_Error10
VT_Bool11
VT_Variant12
VT_Unknown13
VT_Decimal14
VT_I116
VT_UI117
VT_UI218
VT_UI419
VT_I820
VT_UI821
VT_Int22
VT_UInt23
VT_Void24
VT_HResult25
VT_Ptr26
VT_SafeArray27
VT_CArray28
VT_UserDefined29
VT_LPStr30
VT_LPWStr31
VT_Record36
VT_FileTime64
VT_Blob65
VT_Stream66
VT_Storage67
VT_Streamed_Object68
VT_Stored_Object69
VT_Blob_Object70
VT_CF71
VT_ClsID72

Flags

VT_Bstr_Blob0x0FFF
VT_Vector0x1000
VT_Array0x2000
VT_ByRef0x4000
VT_Reserved0x8000

Masks

VT_Illegal0xFFFF
VT_IllegalMasked0x0FFF
VT_TypeMask0x0FFF



Calling Convention
Codes



CC_FASTCALL0
CC_CDECL1
CC_MSCPASCAL2
CC_PASCAL2
CC_MACPASCAL3
CC_STDCALL4
CC_FPFASTCALL5
CC_SYSCALL6
CC_MPWCDECL7
CC_MPWPASCAL8
CC_MAX9



Function Type
Codes



FUNC_VIRTUAL0
FUNC_PUREVIRTUAL1
FUNC_NONVIRTUAL2
FUNC_STATIC3
FUNC_DISPATCH4



Function Flags



FUNCFLAG_FRESTRICTED0x000001
FUNCFLAG_FSOURCE0x000002
FUNCFLAG_FBINDABLE0x000004
FUNCFLAG_FREQUESTEDIT0x000008
FUNCFLAG_FDISPLAYBIND0x000010
FUNCFLAG_FDEFAULTBIND0x000020
FUNCFLAG_FHIDDEN0x000040
FUNCFLAG_FUSESGETLASTERROR0x000080
FUNCFLAG_FDEFAULTCOLLELEM0x000100
FUNCFLAG_FUIDEFAULT0x000200
FUNCFLAG_FNONBROWSABLE0x000400
FUNCFLAG_FREPLACEABLE0x000800
FUNCFLAG_FIMMEDIATEBIND0x001000
#If Def(MAC)
FUNCFLAG_FORCELONG
#Endif
0x7FFFFFFF



Invocation Kind
Flags



INVOKE_FUNC1
INVOKE_PROPERTYGET2
INVOKE_PROPERTYPUT4
INVOKE_PROPERTYPUTREF8

Note:
In my experience, Invocation Kind Flags have the following values:

INVOKE_FUNC0
INVOKE_PROPERTYGET1
INVOKE_PROPERTYPUT2
INVOKE_PROPERTYPUTREF4



Parameter Flags



PARAMFLAG_NONE0x0000
PARAMFLAG_FIN0x0001
PARAMFLAG_FOUT0x0002
PARAMFLAG_FLCID0x0004
PARAMFLAG_FRETVAL0x0008
PARAMFLAG_FOPT0x0010
PARAMFLAG_FHASDEFAULT0x0020
PARAMFLAG_FHASCUSTDATA0x0040



System Kind
Codes



SYS_WIN160
SYS_WIN321
SYS_MAC2
SYS_WIN643

Notes:

SYS_WIN16 --- The target operating system for the type library is 16-bit Windows
systems. By default, data members are packed.

SYS_WIN32 --- The target operating system for the type library is 32-bit Windows
systems. By default, data members are naturally aligned (for example, 2-byte
integers are aligned on even-byte boundaries; 4-byte integers are aligned on
quad-word boundaries, and so on).

SYS_MAC --- The target operating system for the type library is Apple Macintosh.
By default, all data members are aligned on even-byte boundaries.



Type Kind
Codes



TKIND_ENUM0
TKIND_RECORD1
TKIND_MODULE2
TKIND_INTERFACE3
TKIND_DISPATCH4
TKIND_COCLASS5
TKIND_ALIAS6
TKIND_UNION7
TKIND_MAX8



Type Flags



TYPEFLAG_FAPPOBJECT0x00001
TYPEFLAG_FCANCREATE0x00002
TYPEFLAG_FLICENSED0x00004
TYPEFLAG_FPREDECLID0x00008
TYPEFLAG_FHIDDEN0x00010
TYPEFLAG_FCONTROL0x00020
TYPEFLAG_FDUAL0x00040
TYPEFLAG_FNONEXTENSIBLE0x00080
TYPEFLAG_FOLEAUTOMATION0x00100
TYPEFLAG_FRESTRICTED0x00200
TYPEFLAG_FAGGREGATABLE0x00400
TYPEFLAG_FREPLACEABLE0x00800
TYPEFLAG_FDISPATCHABLE0x01000
TYPEFLAG_FREVERSEBIND0x02000



Function Kinds



Virtual0
PureVirtual1
NonVirtual2
Static3
Dispatch4

Formato SLTG: http://www.koders.com/c/fidAC1D779B96D5B43EC35967A3B69BC6462E8418D7.aspx?s=decomposition (dead link)