+ All Categories
Home > Documents > The Unofficial TLIB

The Unofficial TLIB

Date post: 04-Apr-2018
Category:
Upload: davbrat
View: 233 times
Download: 0 times
Share this document with a friend

of 34

Transcript
  • 7/30/2019 The Unofficial TLIB

    1/34

    * The Unofficial ** ** TypeLib Data Format ** ** Specification ** ** *

    * by TheirCorp *

    * Table of ** Contents *

    Part One:

    Introduction

    * Introduction* Notes on this Document* Physical Layout of TypeLib Data

    Part Two:Data Structures

    * The TypeLib Header* Offsets to TypeInfos* Segment Directory* TypeInfo Table* ImportInfo Table* Imported TypeLib Table* References Table* Lib Table* GUID Table* Unknown 01* Name Table* String Table* Type Descriptors

    * Array Descriptors* Custom Data Table* GUID Offsets* Unknown 02* Unknown 03* Function Records and Property Records Array* Function Record* Parameter Info* Property Record* ID, Name and Reference Arrays

    Part Three:Equates

    * Locale IDs* Data-Types (Variable-Types)* Calling Convention Codes* Function Type Codes* Function Flags* Invocation Kind Flags* Parameter Flags* System Kind Codes* Type Kind Codes* Type Flags

  • 7/30/2019 The Unofficial TLIB

    2/34

    * ** Introduction *

    *--*--*--*--*--*--*--*--*--*--*--*--*What is TypeLib Data?

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

    TypeLib data comes in only(?) two internal formats: "MSFT" and "SLTG". Thisdocument only covers the MSFT format. The details of the SLGT format were notknown at the time of this writing, and so will be published later, if ever. SLGTformat data is relatively rare anyway: perhaps a few percent of the files on a32-bit system will have any. It would certainly be good to know it though. Itappears 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.htmlThe primary source file studied (along with #included files) was:...reactos\dll\win32\oleaut32\typelib.cSome (mostly minor) aspects of the format have not been confirmed by TheirCorpand so are based entirely on (sometimes unclear) comments from ReactOS sourcecode. 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 distributea 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.txtThere is expected to be an HTML version in the future.

    TheirCorp's website is:http://theircorp.freezoka.com/index.php

    * Notes on this *

    * Document *

    *--*--*--*--*--*--*--*--*--*--*--*--*COM Terminology and ODL Syntax

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

    COM Topics

  • 7/30/2019 The Unofficial TLIB

    3/34

    http://msdn.microsoft.com/en-us/library/aa139695.aspx

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

    Automation Programming Referencehttp://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. Thewords "function" and "method" are treated as synonymous. It wasn't clear fromthe 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 "SegmentDirectory" section. This is to help you distinguish between them.

    Items named "Unknown..." are thought to contain useful information, but no onefeels 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 nouseful 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 datamight be absent.

    *--*--*--*--*--*--*--*--*--*--*--*--*Data Types

    *--*--*--*--*--*--*--*--*--*--*--*--*The data types composing the structures encountered in this format areindicated 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 exceptionsshould be obvious enough.

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

  • 7/30/2019 The Unofficial TLIB

    4/34

    *--*--*--*--*--*--*--*--*--*--*--*--*Offsets

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

    *--*--*--*--*--*--*--*--*--*--*--*--*Arrays

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

    *--*--*--*--*--*--*--*--*--*--*--*--*Notation for Structures

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

    The example below, shows a field named "Field Name" which is an array ofsixteen 32-bit signed integers, and which might be absent (note the questionmark).

    +-----------------------------------------------------+| Field Name 32[16]| ?+-----------------------------------------------------+

  • 7/30/2019 The Unofficial TLIB

    5/34

    * The Physical Layout ** of the TypeLib Data *

    +=====================================================+| TypeLib Header |+=====================================================+

    | Offsets to TypeInfos |+=====================================================+| Segment Directory |-->------->------++=====================================================+ \

    +

  • 7/30/2019 The Unofficial TLIB

    6/34

    +-----------------------------------------------------+| 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'sformat. A value of "SLGT" indicates the file is of another TypeLib format whichis 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"

  • 7/30/2019 The Unofficial TLIB

    7/34

    *--*--*--*--*--*--*--*--*--*--*--*--*Locale ID 2

    *--*--*--*--*--*--*--*--*--*--*--*--*Unknown

    *--*--*--*--*--*--*--*--*--*--*--*--*Varflags

    *--*--*--*--*--*--*--*--*--*--*--*--*Flags (largely unknown)* The lower four bits is the SysKind code (see the table)* Bit 5 = 1 if a helpfile is defined* Bit 8 = 1 if the TypeLib File Name field is present

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

    / | | e | | p | | |\ | | N | | F | | |\ | | a | | i | | |/ | | m | | l | | |

    \ | | | | | | | | 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

  • 7/30/2019 The Unofficial TLIB

    8/34

    *--*--*--*--*--*--*--*--*--*--*--*--*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 ifbit 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" fieldof the TlbHeader.

    +-----------------------------------------------------+| Offset[1] 32 |+-----------------------------------------------------+| Offset[2] 32 |+-----------------------------------------------------+

    .......+-----------------------------------------------------+| Offset[TypeInfoCount] 32 |+-----------------------------------------------------+

  • 7/30/2019 The Unofficial TLIB

    9/34

    * 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 standarddata 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 TypeLibData" diagram don't have segment descriptors:* TlbHeader* Offsets to TypeInfo Data* Segment Directory* Function and Property Records

  • 7/30/2019 The Unofficial TLIB

    10/34

    The diagram below shows the segments in the order in which their descriptorsappear 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 |

  • 7/30/2019 The Unofficial TLIB

    11/34

    +-----------------------------------------------------+| 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

    *--*--*--*--*--*--*--*--*--*--*--*--*Function Records

    *--*--*--*--*--*--*--*--*--*--*--*--*File offset to an array of Function Records and Property Records, if there areany functions or properties present (that is, if either Function Count orProperty Count are greater than zero), otherwise it's FileLength + 1 (it pointsto 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.

  • 7/30/2019 The Unofficial TLIB

    12/34

    *--*--*--*--*--*--*--*--*--*--*--*--*Reconstituted Size of TypeInfo Data

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

    *--*--*--*--*--*--*--*--*--*--*--*--*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

    *--*--*--*--*--*--*--*--*--*--*--*--*

  • 7/30/2019 The Unofficial TLIB

    13/34

    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

    *--*--*--*--*--*--*--*--*--*--*--*--*Unknown3

    *--*--*--*--*--*--*--*--*--*--*--*--*

    *--*--*--*--*--*--*--*--*--*--*--*--*DataType1

    *--*--*--*--*--*--*--*--*--*--*--*--*Offset into Type Descriptor Table, or in base interfaces.* If TypeKind is a coclass, then DataType1 is an offset into RefTable* If TypeKind is a interface, then DataType1 is a reference to inheritedinterface

    * If TypeKind is a module, then DataType1 is an offset into the Name Table of

    the DllName

    *--*--*--*--*--*--*--*--*--*--*--*--*DataType2

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

    *--*--*--*--*--*--*--*--*--*--*--*--*Reserved7

    *--*--*--*--*--*--*--*--*--*--*--*--*Always? 0

    *--*--*--*--*--*--*--*--*--*--*--*--*Reserved8

    *--*--*--*--*--*--*--*--*--*--*--*--*Always? -1

    *--*--*--*--*--*--*--*--*--*--*--*--*Note:*--*--*--*--*--*--*--*--*--*--*--*--*The order of the "Implemented Interfaces" and "Virtual Table Size" arereversed for bigendian format.

  • 7/30/2019 The Unofficial TLIB

    14/34

    * 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 TypeInfoindex 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 |

  • 7/30/2019 The Unofficial TLIB

    15/34

    +-----------------------------------------------------+| Size (times 4) 16 |+-----------------------------------------------------+

    *--*--*--*--*--*--*--*--*--*--*--*--*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.

    * 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

    *--*--*--*--*--*--*--*--*--*--*--*--*?

    *--*--*--*--*--*--*--*--*--*--*--*--*

  • 7/30/2019 The Unofficial TLIB

    16/34

    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 tablewith 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:* = 01 for an imported TypeInfo* = 10 for an imported TypeLib (used by imported TypeInfos)

    *--*--*--*--*--*--*--*--*--*--*--*--*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 containsoffsets into the name table.

  • 7/30/2019 The Unofficial TLIB

    17/34

    * Name Table ** ( TlbName[Name Table Count] ) *

    This segment contains an array of the variable-lengthed TlbName structures. Itstores 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 ofthe TlbHeader.The total number of characters in all the names combined is given by the "NameTable Chars" field of the TlbHeader.A TlbName is always a multiple of four bytes long. When its length needsadjusting, it is padded with the letter "W". The letter "W" can apparently besafely 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 itselfor 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 anypadding.

    *--*--*--*--*--*--*--*--*--*--*--*--*Flags?

    *--*--*--*--*--*--*--*--*--*--*--*--*

    *--*--*--*--*--*--*--*--*--*--*--*--*Hash Code

    *--*--*--*--*--*--*--*--*--*--*--*--*

  • 7/30/2019 The Unofficial TLIB

    18/34

    *--*--*--*--*--*--*--*--*--*--*--*--*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 multipleof 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 fourbytes.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 bytesand also a multiple of four bytes.

    * Type Descriptors *

    This segment is an array of Type Descriptors. Although a Type Descriptor isonly eight bytes, it's comparatively complicated to decode. Initially, it isuseful to regard it as four 16-bit integers, until it's determined whether itdefines one data type or two:* When values are to be referenced with pointers, they are classified as"ByRef" and the "By Ref" flag (bit# 14) in Value2 is set. The primary datatype in this case is a pointer (VT_Ptr) and obviously the type of data itpoints to needs to be specified.

    * Both arrays and vectors are considered to be data types themselves, and

  • 7/30/2019 The Unofficial TLIB

    19/34

    obviously, the data types of their elements need to be specified also.* In all other cases, only one data type needs to be specified, and bits onethrough fourteen of Value2 are set to indicate this. Bits zero and fifteenare undefined in these cases, although it appears that bit zero is alwaysset when the data type is user-defined (VT_UserDefined), and never when itisn't.

    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 || | || | |+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

    * Value1 contains a data type code in its lower twelve bits. One can applyVT_TypeMask to mask out the upper four bits.

    * If (Value2 AND 0x7FFE) = 0x7FFE then Value1 contains the ONLY data typedefined (see "Value2").

    * The interpretations of Value3 and Value4 are based partly on Value1 (see"Value3 and Value4").

    *--*--*--*--*--*--*--*--*--*--*--*--*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 onlydata type defined. Otherwise, the primary type is either ByRef, an array or avector and therefore, there's a secondary data type to be defined. If so, thenthe 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 primarytype, or often, the very same code.Presumably, only one of the flag bits will ever be set. The reserved bithasn't been encountered yet while studying the format.

  • 7/30/2019 The Unofficial TLIB

    20/34

    *--*--*--*--*--*--*--*--*--*--*--*--*

    Value3 and Value4*--*--*--*--*--*--*--*--*--*--*--*--*Under some conditions, these two are combined to form a single Dword. Thisis done by using Value3 as the low word, and Value4 as the high word. Notethat the resulting combinations are often subjected to additional operationssuch as ANDing and division.

    * If (Value1 AND VT_TypeMask) equals either VT_Ptr or VT_SafeArray then Value3 and Value4 are interpreted as follows:

    * If Value4 is negative (MSB = 1) then (Value3 AND 0x7FF8) yields an offsetinto the Type Descriptor Table.

    * If Value4 is NOT negative (MSB = 0) then Value2 and Value3 are to becombined to form a Dword, then ANDed with (Value3 \ 8) to yield an offsetinto a Type Descriptor file. This doesn't sound sensible, but it lookslike what the ReactOS code was doing.

    * If (Value1 AND VT_TypeMask) equals VT_CArray then Value3 and Value4 arecombined to form a Dword offset into the Array Descriptor Table

    * If (Value1 AND VT_TypeMask) equals VT_UserDefined then Value3 and Value4 arecombined to form a Dword, then ANDed with 0xFFFFFFF8 to yield an offset intothe Type Descriptor Table

    * Array Descriptors *

    An Array Descriptor segment consists of an array of descriptors in the form ofArrayDesc 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 "intarray[]".

    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 anoffset 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

  • 7/30/2019 The Unofficial TLIB

    21/34

    in the array, otherwise the datatype code is in the high-byte.

    *--*--*--*--*--*--*--*--*--*--*--*--*Bound's

    *--*--*--*--*--*--*--*--*--*--*--*--*Contains one SafeArrayBound structure for each dimension of the array, tellinghow 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. Itcontains at minimum, an identifier which incorporates values from a time-stamp, the file's size and perhaps other things. The identifier is updatedevery time the ODL/IDL source is compiled.

    * GUID Offsets ** *

    This segment contains 32-bit offsets into the GUID Table. Some offsets areset 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.

  • 7/30/2019 The Unofficial TLIB

    22/34

    * Function Records and ** Property Records Array *

    This section contains one or more array groups, each describing functions orproperties 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 "FunctionCount" and "Property Count" fields of the TypeInfo structure.

    Physical Layout of an Array Group

    +=====================================================+| Size of FuncRecord Array 32 |+=====================================================+

  • 7/30/2019 The Unofficial TLIB

    23/34

    the ones that precede it in the order indicated in the diagram. So, if there'sa HelpStringContext, then there must also be the HelpContext, HelpString, Entry,Reserved2 and Reserved3 fields, but not necessarily a "Custom Data" field.

    The FuncRecord Structure

    +-----------------------------------------------------+ 16 | |+-----------------------------------------------------+ || Func Desc Size 16 | |+-----------------------------------------------------+ || FKCCIC 32 | \+-----------------------------------------------------+ \ RecordSize| Parameter Count 16 | | 32[ParamCount]| ? |+-----------------------------------------------------+ || Parameter Info ParamInfo[ParamCount]| ? /+-----------------------------------------------------+

  • 7/30/2019 The Unofficial TLIB

    24/34

    If the MSB = 1, then the low byte is valid. So far it seems to always bevalid, except for pointers. When MSB does equal 1, the low byte is the codefor 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-timestorage, and aren't a part of the TypeLib format.

    *--*--*--*--*--*--*--*--*--*--*--*--*FKCCIC*--*--*--*--*--*--*--*--*--*--*--*--*This field is 32 bits wide, but only the meanings of the lower thirteen bitsare known.

    +-+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+/ | | | | |/ | 15 14 13 12| 11 10 9 8 | 7 6 5 4 | 3 2 1 0 |\ +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+| | ? | ? | ? | D | | | | | C | | | | | | | |/ | | | | e | | u | | || | | | | f | Calling | s | Invocation | Function |

    / | | | | V | Convention | t | Kind | Kind |\ | | | | a | | D | | |\ | | | | l | | a | | |/ | | | | u | | t | | |

    \ | | | | e | | | | | a | | | | | | | |+--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

    * Bits zero through two contain the FunctionKind (see table)* Bits three through six contain the InvocationKind (see table)* Bit seven is set if there is custom data is present* Bits eight through eleven contain the CallingConvention (see table)* Bit twelve is set if there a default value is present

    *--*--*--*--*--*--*--*--*--*--*--*--*Parameter Count

    *--*--*--*--*--*--*--*--*--*--*--*--*

    *--*--*--*--*--*--*--*--*--*--*--*--*

    Unknown2*--*--*--*--*--*--*--*--*--*--*--*--*

    *--*--*--*--*--*--*--*--*--*--*--*--*HelpContext

    *--*--*--*--*--*--*--*--*--*--*--*--*

    *--*--*--*--*--*--*--*--*--*--*--*--*

  • 7/30/2019 The Unofficial TLIB

    25/34

    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 offsetinto the Custom Data Table where the default value can be found. The only timean 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 theParamFlags field of its ParamInfo structure will be set, but the existence ofa set bit 5 of a ParamFlags field alone, might not reliably indicate thepresence 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 forall the parameters in the FuncRecord, but the only valid elements will bethe ones for those which actually have default values.

    *--*--*--*--*--*--*--*--*--*--*--*--*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 arereversed for bigendian format.

    * Parameter Info *

  • 7/30/2019 The Unofficial TLIB

    26/34

    * ParamInfo[ParamCount] *

    The ParamInfo Structure

    +-----------------------------------------------------+| DataType 16 |+-----------------------------------------------------+

    | Flags 16 |+-----------------------------------------------------+| Name ==> 32 |+-----------------------------------------------------+| ParamFlags 32 |+-----------------------------------------------------+

    *--*--*--*--*--*--*--*--*--*--*--*--*DataType

    *--*--*--*--*--*--*--*--*--*--*--*--*The data-type code for the parameter.

    *--*--*--*--*--*--*--*--*--*--*--*--*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 theparameter (see the "Parameter Flags" equates):

    Bit# 0: InBit# 1: OutBit# 2: LCIDBit# 3: RetValBit# 4: OptBit# 5: HasDefaultBit# 6: HasCustData

    * Property Record *

  • 7/30/2019 The Unofficial TLIB

    27/34

    * ( PropRecord ) *

    These occur in arrays referenced by the "Function Records" field of a TypeInfostructure. They may be accompanied by zero or more Function Records (describedabove). 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 recordsize. The rule is: "if there's room for it, then it's there..." The thing toremember is, that if a particular optional field is present, then so are allthe ones that precede it in the order indicated in the diagram. So, if "CustomData" is there, then there must also be the Unknown, HelpContext, HelpStringand Reserved fields, but not necessarily a HelpStringContext field.

    The PropRecord Structure

    +-----------------------------------------------------+

  • 7/30/2019 The Unofficial TLIB

    28/34

    *--*--*--*--*--*--*--*--*--*--*--*--*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-timestorage, and aren't a part of the TypeLib format.

    *--*--*--*--*--*--*--*--*--*--*--*--*OffsValue

    *--*--*--*--*--*--*--*--*--*--*--*--*Value of the variable or the offset in the data structure

    *--*--*--*--*--*--*--*--*--*--*--*--*Unknown

    *--*--*--*--*--*--*--*--*--*--*--*--*

    *--*--*--*--*--*--*--*--*--*--*--*--*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 bigendianformat.

    * ID, Name and ** Reference Arrays *

    These three Dword arrays each have one element for every method and property:1) Method/Property IDs2) Offsets to names in Name Table3) Offsets to Records

  • 7/30/2019 The Unofficial TLIB

    29/34

    They are always at the very end of an Array Group of Function Records andProperty 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 toFunctionCount + 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. and Locality

    *--*--*--*--*--*--*--*--*--*--*--*--*---------0x0401 ARA Arabic Saudi Arabia0x0801 ARI Arabic Iraq0x0C01 ARE Arabic Egypt0x1001 ARL Arabic Libya0x1401 ARG Arabic Algeria0x1801 ARM Arabic Morocco0x1C01 ART Arabic Tunisia0x2001 ARO Arabic Oman0x2401 ARY Arabic Yemen0x2801 ARS Arabic Syria0x2C01 ARJ Arabic Jordan

  • 7/30/2019 The Unofficial TLIB

    30/34

    0x3001 ARB Arabic Lebanon0x3401 ARK Arabic Kuwait0x3801 ARU Arabic U.A.E.0x3C01 ARH Arabic Bahrain0x4001 ARQ Arabic Qatar0x0402 BGR Bulgarian Bulgaria0x0403 CAT Catalan Spain0x0404 CHT Chinese Taiwan

    0x0804 CHS Chinese PRC0x0C04 ZHH Chinese Hong Kong0x1004 ZHI Chinese Singapore0x1404 ZHM Chinese Macau0x0405 CSY Czech Czech Republic0x0406 DAN Danish Denmark0x0407 GERMANY German Germany0x0807 DES German Switzerland0x0C07 DEA German Austria0x1007 DEL German Luxembourg0x1407 DEC German Liechtenstein0x0408 ELL Greek Greece0x0409 USA English United States0x0809 ENG English United Kingdom0x0C09 ENA English Australia0x1009 ENC English Canada0x1409 ENZ English New Zealand

    0x1809 ENI English Ireland0x1C09 ENS English South Africa0x2009 ENJ English Jamaica0x2409 ENB English Caribbean0x2809 ENL English Belize0x2C09 ENT English Trinidad0x3009 ENW English Zimbabwe0x3409 ENP English Philippines0x040A SPAIN Spanish Spain0x080A ESM Spanish Mexico0x0C0A ESN Spanish Spain (International Sort)0x100A ESG Spanish Guatemala0x140A ESC Spanish Costa Rica0x180A ESA Spanish Panama0x1C0A ESD Spanish Dominican Republic0x200A ESV Spanish Venezuela0x240A ESO Spanish Colombia

    0x280A ESR Spanish Peru0x2C0A ESS Spanish Argentina0x300A ESF Spanish Ecuador0x340A ESL Spanish Chile0x380A ESY Spanish Uruguay0x3C0A ESZ Spanish Paraguay0x400A ESB Spanish Bolivia0x440A ESE Spanish El Salvador0x480A ESH Spanish Honduras0x4C0A ESI Spanish Nicaragua0x500A ESU Spanish Puerto Rico0x040B FIN Finnish Finland0x040C FRANCE French France0x080C FRB French Belgium0x0C0C FRC French Canada0x100C FRS French Switzerland0x140C FRL French Luxembourg

    0x180C FRM French Monaco0x040D HEB Hebrew Israel0x040E HUN Hungarian Hungary0x040F ISL Icelandic Iceland0x0410 ITALY Italian Italy0x0810 ITS Italian Switzerland0x0411 JAPAN Japanese Japan0x0412 KOREA Korean Korea0x0413 NLD Dutch Netherlands0x0813 NLB Dutch Belgium0x0414 NOR Norwegian Norway (Bokml)0x0814 NON Norwegian Norway (Nynorsk)

  • 7/30/2019 The Unofficial TLIB

    31/34

    0x0415 PLK Polish Poland0x0416 BRAZIL Portuguese Brazil0x0816 PTG Portuguese Portugal0x0418 ROM Romanian Romania0x0419 RUS Russian Russia0x041A HRV Croatian Croatia0x081A SRL Serbian Serbia (Latin)0x0C1A SRB Serbian Serbia (Cyrillic)

    0x041B SKY Slovak Slovakia0x041C SQI Albanian Albania0x041D SVE Swedish Sweden0x081D SVF Swedish Finland0x041E THA Thai Thailand0x041F TRK Turkish Turkey0x0420 URP Urdu Pakistan0x0421 IND Indonesian Indonesia0x0422 UKR Ukrainian Ukraine0x0423 BEL Belarusian Belarus0x0424 SLV Slovene Slovenia0x0425 ETI Estonian Estonia0x0426 LVI Latvian Latvia0x0427 LTH Lithuanian Lithuania0x0827 LTC Classic Lithuanian Lithuania0x0429 FAR Farsi Iran0x042A VIT Vietnamese Viet Nam

    0x042B HYE Armenian Armenia0x042C AZE Azeri Azerbaijan (Latin)0x082C AZE Azeri Azerbaijan (Cyrillic)0x042D EUQ Basque Spain0x042F MKI Macedonian Macedonia0x0436 AFK Afrikaans South Africa0x0437 KAT Georgian Georgia0x0438 FOS Faeroese Faeroe Islands0x0439 HIN Hindi India0x043E MSL Malay Malaysia0x083E MSB Malay Brunei Darussalam0x043F KAZ Kazak Kazakstan0x0441 SWK Swahili Kenya0x0443 UZB Uzbek Uzbekistan (Latin)0x0843 UZB Uzbek Uzbekistan (Cyrillic)0x0444 TAT Tatar Tatarstan0x0445 BEN Bengali India

    0x0446 PAN Punjabi India0x0447 GUJ Gujarati India0x0448 ORI Oriya India0x0449 TAM Tamil India0x044A TEL Telugu India0x044B KAN Kannada India0x044C MAL Malayalam India0x044D ASM Assamese India0x044E MAR Marathi India0x044F SAN Sanskrit India0x0457 KOK Konkani India0x0000 Language-Neutral, Language-Neutral0x0400 Process Default Language, Process Default Language

    * Data-Types ** (Variable-Types) *

    Codes, masks and flags relating to variable types.

    *--*--*--*--*--*--*--*--*--*--*--*--*Variable Types

    *--*--*--*--*--*--*--*--*--*--*--*--*VT_Empty = 0

  • 7/30/2019 The Unofficial TLIB

    32/34

    VT_Null = 1VT_I2 = 2VT_I4 = 3VT_R4 = 4VT_R8 = 5VT_Cy = 6VT_Date = 7VT_BStr = 8

    VT_Dispatch = 9VT_Error = 10VT_Bool = 11VT_Variant = 12VT_Unknown = 13VT_Decimal = 14VT_I1 = 16VT_UI1 = 17VT_UI2 = 18VT_UI4 = 19VT_I8 = 20VT_UI8 = 21VT_Int = 22VT_UInt = 23VT_Void = 24VT_HResult = 25VT_Ptr = 26

    VT_SafeArray = 27VT_CArray = 28VT_UserDefined = 29VT_LPStr = 30VT_LPWStr = 31VT_Record = 36VT_FileTime = 64VT_Blob = 65VT_Stream = 66VT_Storage = 67VT_Streamed_Object = 68VT_Stored_Object = 69VT_Blob_Object = 70VT_CF = 71VT_ClsID = 72

    *--*--*--*--*--*--*--*--*--*--*--*--*Flags

    *--*--*--*--*--*--*--*--*--*--*--*--*VT_Bstr_Blob = 0x0FFFVT_Vector = 0x1000VT_Array = 0x2000VT_ByRef = 0x4000VT_Reserved = 0x8000

    *--*--*--*--*--*--*--*--*--*--*--*--*Masks

    *--*--*--*--*--*--*--*--*--*--*--*--*VT_Illegal = 0xFFFF

    VT_IllegalMasked = 0x0FFFVT_TypeMask = 0x0FFF

    * Calling Convention ** Codes *

    CC_FASTCALL = 0CC_CDECL = 1CC_MSCPASCAL = 2

  • 7/30/2019 The Unofficial TLIB

    33/34

    CC_PASCAL = 2CC_MACPASCAL = 3CC_STDCALL = 4CC_FPFASTCALL = 5CC_SYSCALL = 6CC_MPWCDECL = 7CC_MPWPASCAL = 8CC_MAX = 9

    * Function Type ** Codes *

    FUNC_VIRTUAL = 0FUNC_PUREVIRTUAL = 1FUNC_NONVIRTUAL = 2FUNC_STATIC = 3FUNC_DISPATCH = 4

    * Function Flags ** *

    FUNCFLAG_FRESTRICTED = 0x000001

    FUNCFLAG_FSOURCE = 0x000002FUNCFLAG_FBINDABLE = 0x000004FUNCFLAG_FREQUESTEDIT = 0x000008FUNCFLAG_FDISPLAYBIND = 0x000010FUNCFLAG_FDEFAULTBIND = 0x000020FUNCFLAG_FHIDDEN = 0x000040FUNCFLAG_FUSESGETLASTERROR = 0x000080FUNCFLAG_FDEFAULTCOLLELEM = 0x000100FUNCFLAG_FUIDEFAULT = 0x000200FUNCFLAG_FNONBROWSABLE = 0x000400FUNCFLAG_FREPLACEABLE = 0x000800FUNCFLAG_FIMMEDIATEBIND = 0x001000#If Def(MAC)FUNCFLAG_FORCELONG = 0x7FFFFFFF#Endif

    * Invocation Kind ** Flags *

    INVOKE_FUNC = 1INVOKE_PROPERTYGET = 2INVOKE_PROPERTYPUT = 4INVOKE_PROPERTYPUTREF = 8

    * Parameter Flags ** *

    PARAMFLAG_NONE = 0x0000

    PARAMFLAG_FIN = 0x0001PARAMFLAG_FOUT = 0x0002PARAMFLAG_FLCID = 0x0004PARAMFLAG_FRETVAL = 0x0008PARAMFLAG_FOPT = 0x0010PARAMFLAG_FHASDEFAULT = 0x0020PARAMFLAG_FHASCUSTDATA = 0x0040

    * System Kind *

  • 7/30/2019 The Unofficial TLIB

    34/34

    * Codes *

    SYS_WIN16 = 0SYS_WIN32 = 1SYS_MAC = 2

    *--*--*--*--*--*--*--*--*--*--*--*--*

    Notes:*--*--*--*--*--*--*--*--*--*--*--*--*SYS_WIN16 --- The target operating system for the type library is 16-bit Windowssystems. By default, data members are packed.

    SYS_WIN32 --- The target operating system for the type library is 32-bit Windowssystems. By default, data members are naturally aligned (for example, 2-byteintegers are aligned on even-byte boundaries; 4-byte integers are aligned onquad-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_ENUM = 0TKIND_RECORD = 1TKIND_MODULE = 2TKIND_INTERFACE = 3TKIND_DISPATCH = 4TKIND_COCLASS = 5TKIND_ALIAS = 6TKIND_UNION = 7TKIND_MAX = 8

    * Type Flags ** *

    TYPEFLAG_FAPPOBJECT = 0x00001TYPEFLAG_FCANCREATE = 0x00002TYPEFLAG_FLICENSED = 0x00004TYPEFLAG_FPREDECLID = 0x00008TYPEFLAG_FHIDDEN = 0x00010TYPEFLAG_FCONTROL = 0x00020TYPEFLAG_FDUAL = 0x00040TYPEFLAG_FNONEXTENSIBLE = 0x00080TYPEFLAG_FOLEAUTOMATION = 0x00100TYPEFLAG_FRESTRICTED = 0x00200TYPEFLAG_FAGGREGATABLE = 0x00400TYPEFLAG_FREPLACEABLE = 0x00800TYPEFLAG_FDISPATCHABLE = 0x01000TYPEFLAG_FREVERSEBIND = 0x02000


Recommended