⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 typelib.h

📁 ReactOS是一些高手根据Windows XP的内核编写出的类XP。内核实现机理和API函数调用几乎相同。甚至可以兼容XP的程序。喜欢研究系统内核的人可以看一看。
💻 H
📖 第 1 页 / 共 2 页
字号:
/*06*/  WORD res06;		/* ?? always 9 */
/*08*/  WORD res08;             /* some kind of len/offset ?? */
/*0a*/	WORD first_blk;		/* 1 based index into blk entries that
				   corresponds to first block in file */
/*0c*/	DWORD res0c;		/* always 0x000204ff */
/*10*/  DWORD res10;		/* always 0x00000000 */
/*14*/	DWORD res14;		/* always 0x000000c0 */
/*18*/	DWORD res18;		/* always 0x46000000 */
/*1c*/	DWORD res1c;		/* always 0x00000044 */
/*20*/	DWORD res20;		/* always 0xffff0000 */
} SLTG_Header;

/* This gets followed by a list of block entries */
typedef struct {
/*00*/  DWORD len;
/*04*/	WORD index_string; /* offs from start of SLTG_Magic to index string */
/*06*/  WORD next;
} SLTG_BlkEntry;

/* The order of the blocks in the file is given by starting at Block
   entry firt_blk and stepping through using the next pointer */

/* These then get followed by this magic */
typedef struct {
/*00*/ BYTE res00;		/* always 0x01 */
/*01*/ CHAR CompObj_magic[8];	/* always "CompObj" */
/*09*/ CHAR dir_magic[4];	/* always "dir" */
} SLTG_Magic;

#define SLTG_COMPOBJ_MAGIC "CompObj"
#define SLTG_DIR_MAGIC "dir"

/* Next we have SLTG_Header.nrOfFileBlks - 2 of Index strings.  These
are presumably unique to within the file and look something like
"AAAAAAAAAA" with the first character incremented from 'A' to ensure
uniqueness.  I guess successive chars increment when we need to wrap
the first one. */

typedef struct {
/*00*/ CHAR string[11];
} SLTG_Index;


/* This is followed by SLTG_pad9 */
typedef struct {
/*00*/ CHAR pad[9];	/* 9 '\0's */
} SLTG_Pad9;


/* Now we have the noOfFileBlks - 1 worth of blocks. The length of
each block is given by its entry in SLTG_BlkEntry. */

/* type SLTG_NAME in rather like a BSTR except that the length in
bytes is given by the first WORD and the string contains 8bit chars */

typedef WORD SLTG_Name;

/* The main library block looks like this.  This one seems to come last */

typedef struct {
/*00*/	WORD magic;		/* 0x51cc */
/*02*/  WORD res02;		/* 0x0003, 0x0004 */
/*04*/  WORD name;              /* offset to name in name table */
/*06*/  SLTG_Name res06;	/* maybe this is just WORD == 0xffff */
	SLTG_Name helpstring;
	SLTG_Name helpfile;
	DWORD helpcontext;
	WORD syskind;		/* == 1 for win32, 0 for win16 */
	WORD lcid;		/* == 0x409, 0x809 etc */
	DWORD res12;		/* == 0 */
 	WORD libflags;		/* LIBFLAG_* */
	WORD maj_vers;
	WORD min_vers;
	GUID uuid;
} SLTG_LibBlk;

#define SLTG_LIBBLK_MAGIC 0x51cc

/* we then get 0x40 bytes worth of 0xffff or small numbers followed by
   nrOfFileBlks - 2 of these */
typedef struct {
	WORD small_no;
	SLTG_Name index_name; /* This refers to a name in the directory */
	SLTG_Name other_name; /* Another one of these weird names */
	WORD res1a;	      /* 0xffff */
	WORD name_offs;	      /* offset to name in name table */
	WORD more_bytes;      /* if this is non-zero we get this many
				 bytes before the next element, which seem
				 to reference the docstring of the type ? */
	WORD res20;	      /* 0xffff */
	DWORD helpcontext;
	WORD res26;	      /* 0xffff */
        GUID uuid;
} SLTG_OtherTypeInfo;

/* Next we get WORD 0x0003 followed by a DWORD which if we add to
0x216 gives the offset to the name table from the start of the LibBlk
struct */

typedef struct {
/*00*/	WORD magic;		/* 0x0501 */
/*02*/	DWORD href_table;	/* if not 0xffffffff, then byte offset from
				   beginning of struct to href table */
/*06*/	DWORD res06;		/* 0xffffffff */
/*0a*/	DWORD elem_table;	/* offset to members */
/*0e*/	DWORD res0e;		/* 0xffffffff */
/*12*/	WORD major_version;	/* major version number */
/*14*/  WORD minor_version;	/* minor version number */
/*16*/	DWORD res16;	/* 0xfffe0000 */
/*1a*/	BYTE typeflags1;/* 0x02 | top 5 bits hold l5sbs of TYPEFLAGS */
/*1b*/	BYTE typeflags2;/* TYPEFLAGS >> 5 */
/*1c*/	BYTE typeflags3;/* 0x02*/
/*1d*/	BYTE typekind;	/* 0x03 == TKIND_INTERFACE etc. */
/*1e*/  DWORD res1e;	/* 0x00000000 or 0xffffffff */
} SLTG_TypeInfoHeader;

#define SLTG_TIHEADER_MAGIC 0x0501

typedef struct {
/*00*/  WORD cFuncs;
/*02*/  WORD cVars;
/*04*/  WORD cImplTypes;
/*06*/  WORD res06; /* always 0000 */
/*08*/  WORD funcs_off; /* offset to functions (starting from the member header) */
/*0a*/  WORD vars_off; /* offset to vars (starting from the member header) */
/*0c*/  WORD impls_off; /* offset to implemented types (starting from the member header) */
/*0e*/  WORD funcs_bytes; /* bytes used by function data */
/*10*/  WORD vars_bytes; /* bytes used by var data */
/*12*/  WORD impls_bytes; /* bytes used by implemented type data */
/*14*/  WORD tdescalias_vt; /* for TKIND_ALIAS */
/*16*/  WORD res16; /* always ffff */
/*18*/  WORD res18; /* always 0000 */
/*1a*/  WORD res1a; /* always 0000 */
/*1c*/  WORD simple_alias; /* tdescalias_vt is a vt rather than an offset? */
/*1e*/  WORD res1e; /* always 0000 */
/*20*/  WORD cbSizeInstance;
/*22*/  WORD cbAlignment;
/*24*/  WORD res24;
/*26*/  WORD res26;
/*28*/  WORD cbSizeVft;
/*2a*/  WORD res2a; /* always ffff */
/*2c*/  WORD res2c; /* always ffff */
/*2e*/  WORD res2e; /* always ffff */
/*30*/  WORD res30; /* always ffff */
/*32*/  WORD res32;
/*34*/  WORD res34;
} SLTG_TypeInfoTail;

typedef struct {
/*00*/ WORD res00; /* 0x0001 sometimes 0x0003 ?? */
/*02*/ WORD res02; /* 0xffff */
/*04*/ BYTE res04; /* 0x01 */
/*05*/ DWORD cbExtra; /* No of bytes that follow */
} SLTG_MemberHeader;

typedef struct {
/*00*/	WORD magic;	/* 0x120a */
/*02*/	WORD next;	/* offset in bytes to next block from start of block
                           group, 0xffff if last item */
/*04*/	WORD name;	/* offset to name within name table */
/*06*/	WORD value;	/* offset to value from start of block group */
/*08*/	WORD res08;	/* 0x56 */
/*0a*/	DWORD memid;	/* memid */
/*0e*/  WORD helpcontext;/* 0xfffe == no context, 0x0001 == stored in EnumInfo struct, else offset
			    to value from start of block group */
/*10*/	WORD helpstring;/* offset from start of block group to string offset */
} SLTG_EnumItem;

#define SLTG_ENUMITEM_MAGIC 0x120a

typedef struct {
	BYTE magic;	/* 0x4c, 0xcb or 0x8b with optional SLTG_FUNCTION_FLAGS_PRESENT flag */
	BYTE inv;	/* high nibble is INVOKE_KIND, low nibble = 2 */
	WORD next;	/* byte offset from beginning of group to next fn */
	WORD name;	/* Offset within name table to name */
	DWORD dispid;	/* dispid */
	WORD helpcontext; /* helpcontext (again 1 is special) */
	WORD helpstring;/* helpstring offset to offset */
	WORD arg_off;	/* offset to args from start of block */
	BYTE nacc;	/* lowest 3bits are CALLCONV, rest are no of args */
        BYTE retnextopt;/* if 0x80 bit set ret type follows else next WORD
			   is offset to ret type. No of optional args is
			   middle 6 bits */
	WORD rettype;	/* return type VT_?? or offset to ret type */
	WORD vtblpos;	/* position in vtbl? */
	WORD funcflags; /* present if magic & 0x20 */
/* Param list starts, repeat next two as required */
#if 0
	WORD  name;	/* offset to 2nd letter of name */
	WORD+ type;	/* VT_ of param */
#endif
} SLTG_Function;

#define SLTG_FUNCTION_FLAGS_PRESENT 0x20
#define SLTG_FUNCTION_MAGIC 0x4c
#define SLTG_DISPATCH_FUNCTION_MAGIC 0xcb
#define SLTG_STATIC_FUNCTION_MAGIC 0x8b

typedef struct {
/*00*/	BYTE magic;		/* 0xdf */
/*01*/  BYTE res01;		/* 0x00 */
/*02*/	DWORD res02;		/* 0xffffffff */
/*06*/	DWORD res06;		/* 0xffffffff */
/*0a*/	DWORD res0a;		/* 0xffffffff */
/*0e*/	DWORD res0e;		/* 0xffffffff */
/*12*/	DWORD res12;		/* 0xffffffff */
/*16*/	DWORD res16;		/* 0xffffffff */
/*1a*/	DWORD res1a;		/* 0xffffffff */
/*1e*/	DWORD res1e;		/* 0xffffffff */
/*22*/	DWORD res22;		/* 0xffffffff */
/*26*/	DWORD res26;		/* 0xffffffff */
/*2a*/	DWORD res2a;		/* 0xffffffff */
/*2e*/	DWORD res2e;		/* 0xffffffff */
/*32*/	DWORD res32;		/* 0xffffffff */
/*36*/	DWORD res36;		/* 0xffffffff */
/*3a*/	DWORD res3a;		/* 0xffffffff */
/*3e*/	DWORD res3e;		/* 0xffffffff */
/*42*/	WORD  res42;		/* 0xffff */
/*44*/	DWORD number;		/* this is 8 times the number of refs */
/*48*/	/* Now we have number bytes (8 for each ref) of SLTG_UnknownRefInfo */

/*50*/	WORD res50;		/* 0xffff */
/*52*/	BYTE res52;		/* 0x01 */
/*53*/	DWORD res53;		/* 0x00000000 */
/*57*/  SLTG_Name names[1];
  /*    Now we have number/8 SLTG_Names (first WORD is no of bytes in the ascii
   *    string).  Strings look like "*\Rxxxx*#n".  If xxxx == ffff then the
   *    ref refers to the nth type listed in this library (0 based).  Else
   *    the xxxx (which maybe fewer than 4 digits) is the offset into the name
   *    table to a string "*\G{<guid>}#1.0#0#C:\WINNT\System32\stdole32.tlb#"
   *    The guid is the typelib guid; the ref again refers to the nth type of
   *    the imported typelib.
   */

/*xx*/ BYTE resxx;		/* 0xdf */

} SLTG_RefInfo;

#define SLTG_REF_MAGIC 0xdf

typedef struct {
	WORD res00;	/* 0x0001 */
	BYTE res02;	/* 0x02 */
	BYTE res03;	/* 0x40 if internal ref, 0x00 if external ? */
	WORD res04;	/* 0xffff */
	WORD res06;	/* 0x0000, 0x0013 or 0xffff ?? */
} SLTG_UnknownRefInfo;

typedef struct {
  WORD res00; /* 0x004a */
  WORD next;  /* byte offs to next interface */
  WORD res04; /* 0xffff */
  BYTE impltypeflags; /* IMPLTYPEFLAG_* */
  BYTE res07; /* 0x80 */
  WORD res08; /* 0x0012, 0x0028 ?? */
  WORD ref;   /* number in ref table ? */
  WORD res0c; /* 0x4000 */
  WORD res0e; /* 0xfffe */
  WORD res10; /* 0xffff */
  WORD res12; /* 0x001d */
  WORD pos_in_table; /* 0x0, 0x4, ? */
} SLTG_ImplInfo;

#define SLTG_IMPL_MAGIC 0x004a

typedef struct {
  BYTE magic; /* 0x0a */
  BYTE flags;
  WORD next;
  WORD name;
  WORD byte_offs; /* pos in struct, or offset to const type */
  WORD type; /* if flags & 0x02 this is the type, else offset to type */
  DWORD memid;
  WORD helpcontext; /* ?? */
  WORD helpstring; /* ?? */
  WORD varflags; /* only present if magic & 0x02 */
} SLTG_Variable;

#define SLTG_VAR_MAGIC 0x0a
#define SLTG_VAR_WITH_FLAGS_MAGIC 0x2a


/* CARRAYs look like this
WORD type == VT_CARRAY
WORD offset from start of block to SAFEARRAY
WORD typeofarray
*/

#include "poppack.h"

HRESULT ITypeInfoImpl_GetInternalFuncDesc( ITypeInfo *iface, UINT index, const FUNCDESC **ppFuncDesc );

extern DWORD _invoke(FARPROC func,CALLCONV callconv, int nrargs, DWORD *args);

HRESULT TMARSHAL_DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv);

/* The OLE Automation ProxyStub Interface Class (aka Typelib Marshaler) */
DEFINE_OLEGUID( CLSID_PSDispatch,    0x00020420, 0x0000, 0x0000 );
DEFINE_OLEGUID( CLSID_PSEnumVariant, 0x00020421, 0x0000, 0x0000 );
DEFINE_OLEGUID( CLSID_PSTypeInfo,    0x00020422, 0x0000, 0x0000 );
DEFINE_OLEGUID( CLSID_PSTypeLib,     0x00020423, 0x0000, 0x0000 );
DEFINE_OLEGUID( CLSID_PSOAInterface, 0x00020424, 0x0000, 0x0000 );
DEFINE_OLEGUID( CLSID_PSTypeComp,    0x00020425, 0x0000, 0x0000 );

/*---------------------------END--------------------------------------------*/
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -