ReactOS  0.4.14-dev-49-gfb4591c
typelib.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  VARENUM {
  VT_EMPTY = 0, VT_NULL = 1, VT_I2 = 2, VT_I4 = 3,
  VT_R4 = 4, VT_R8 = 5, VT_CY = 6, VT_DATE = 7,
  VT_BSTR = 8, VT_DISPATCH = 9, VT_ERROR = 10, VT_BOOL = 11,
  VT_VARIANT = 12, VT_UNKNOWN = 13, VT_DECIMAL = 14, VT_I1 = 16,
  VT_UI1 = 17, VT_UI2 = 18, VT_UI4 = 19, VT_I8 = 20,
  VT_UI8 = 21, VT_INT = 22, VT_UINT = 23, VT_VOID = 24,
  VT_HRESULT = 25, VT_PTR = 26, VT_SAFEARRAY = 27, VT_CARRAY = 28,
  VT_USERDEFINED = 29, VT_LPSTR = 30, VT_LPWSTR = 31, VT_RECORD = 36,
  VT_INT_PTR = 37, VT_UINT_PTR = 38, VT_FILETIME = 64, VT_BLOB = 65,
  VT_STREAM = 66, VT_STORAGE = 67, VT_STREAMED_OBJECT = 68, VT_STORED_OBJECT = 69,
  VT_BLOB_OBJECT = 70, VT_CF = 71, VT_CLSID = 72, VT_VERSIONED_STREAM = 73,
  VT_BSTR_BLOB = 0xfff, VT_VECTOR = 0x1000, VT_ARRAY = 0x2000, VT_BYREF = 0x4000,
  VT_RESERVED = 0x8000, VT_ILLEGAL = 0xffff, VT_ILLEGALMASKED = 0xfff, VT_TYPEMASK = 0xfff,
  VT_EMPTY = 0, VT_NULL = 1, VT_I2 = 2, VT_I4 = 3,
  VT_R4 = 4, VT_R8 = 5, VT_CY = 6, VT_DATE = 7,
  VT_BSTR = 8, VT_DISPATCH = 9, VT_ERROR = 10, VT_BOOL = 11,
  VT_VARIANT = 12, VT_UNKNOWN = 13, VT_DECIMAL = 14, VT_I1 = 16,
  VT_UI1 = 17, VT_UI2 = 18, VT_UI4 = 19, VT_I8 = 20,
  VT_UI8 = 21, VT_INT = 22, VT_UINT = 23, VT_VOID = 24,
  VT_HRESULT = 25, VT_PTR = 26, VT_SAFEARRAY = 27, VT_CARRAY = 28,
  VT_USERDEFINED = 29, VT_LPSTR = 30, VT_LPWSTR = 31, VT_RECORD = 36,
  VT_INT_PTR = 37, VT_UINT_PTR = 38, VT_FILETIME = 64, VT_BLOB = 65,
  VT_STREAM = 66, VT_STORAGE = 67, VT_STREAMED_OBJECT = 68, VT_STORED_OBJECT = 69,
  VT_BLOB_OBJECT = 70, VT_CF = 71, VT_CLSID = 72, VT_VERSIONED_STREAM = 73,
  VT_BSTR_BLOB = 0xfff, VT_VECTOR = 0x1000, VT_ARRAY = 0x2000, VT_BYREF = 0x4000,
  VT_RESERVED = 0x8000, VT_ILLEGAL = 0xffff, VT_ILLEGALMASKED = 0xfff, VT_TYPEMASK = 0xfff
}
 

Functions

void add_importlib (const char *name, typelib_t *typelib)
 
unsigned short get_type_vt (type_t *t)
 
int create_msft_typelib (typelib_t *typelib)
 
int create_sltg_typelib (typelib_t *typelib)
 

Enumeration Type Documentation

◆ VARENUM

Enumerator
VT_EMPTY 
VT_NULL 
VT_I2 
VT_I4 
VT_R4 
VT_R8 
VT_CY 
VT_DATE 
VT_BSTR 
VT_DISPATCH 
VT_ERROR 
VT_BOOL 
VT_VARIANT 
VT_UNKNOWN 
VT_DECIMAL 
VT_I1 
VT_UI1 
VT_UI2 
VT_UI4 
VT_I8 
VT_UI8 
VT_INT 
VT_UINT 
VT_VOID 
VT_HRESULT 
VT_PTR 
VT_SAFEARRAY 
VT_CARRAY 
VT_USERDEFINED 
VT_LPSTR 
VT_LPWSTR 
VT_RECORD 
VT_INT_PTR 
VT_UINT_PTR 
VT_FILETIME 
VT_BLOB 
VT_STREAM 
VT_STORAGE 
VT_STREAMED_OBJECT 
VT_STORED_OBJECT 
VT_BLOB_OBJECT 
VT_CF 
VT_CLSID 
VT_VERSIONED_STREAM 
VT_BSTR_BLOB 
VT_VECTOR 
VT_ARRAY 
VT_BYREF 
VT_RESERVED 
VT_ILLEGAL 
VT_ILLEGALMASKED 
VT_TYPEMASK 
VT_EMPTY 
VT_NULL 
VT_I2 
VT_I4 
VT_R4 
VT_R8 
VT_CY 
VT_DATE 
VT_BSTR 
VT_DISPATCH 
VT_ERROR 
VT_BOOL 
VT_VARIANT 
VT_UNKNOWN 
VT_DECIMAL 
VT_I1 
VT_UI1 
VT_UI2 
VT_UI4 
VT_I8 
VT_UI8 
VT_INT 
VT_UINT 
VT_VOID 
VT_HRESULT 
VT_PTR 
VT_SAFEARRAY 
VT_CARRAY 
VT_USERDEFINED 
VT_LPSTR 
VT_LPWSTR 
VT_RECORD 
VT_INT_PTR 
VT_UINT_PTR 
VT_FILETIME 
VT_BLOB 
VT_STREAM 
VT_STORAGE 
VT_STREAMED_OBJECT 
VT_STORED_OBJECT 
VT_BLOB_OBJECT 
VT_CF 
VT_CLSID 
VT_VERSIONED_STREAM 
VT_BSTR_BLOB 
VT_VECTOR 
VT_ARRAY 
VT_BYREF 
VT_RESERVED 
VT_ILLEGAL 
VT_ILLEGALMASKED 
VT_TYPEMASK 

Definition at line 35 of file typelib.h.

35  {
36  VT_EMPTY = 0,
37  VT_NULL = 1,
38  VT_I2 = 2,
39  VT_I4 = 3,
40  VT_R4 = 4,
41  VT_R8 = 5,
42  VT_CY = 6,
43  VT_DATE = 7,
44  VT_BSTR = 8,
45  VT_DISPATCH = 9,
46  VT_ERROR = 10,
47  VT_BOOL = 11,
48  VT_VARIANT = 12,
49  VT_UNKNOWN = 13,
50  VT_DECIMAL = 14,
51  VT_I1 = 16,
52  VT_UI1 = 17,
53  VT_UI2 = 18,
54  VT_UI4 = 19,
55  VT_I8 = 20,
56  VT_UI8 = 21,
57  VT_INT = 22,
58  VT_UINT = 23,
59  VT_VOID = 24,
60  VT_HRESULT = 25,
61  VT_PTR = 26,
62  VT_SAFEARRAY = 27,
63  VT_CARRAY = 28,
64  VT_USERDEFINED = 29,
65  VT_LPSTR = 30,
66  VT_LPWSTR = 31,
67  VT_RECORD = 36,
68  VT_INT_PTR = 37,
69  VT_UINT_PTR = 38,
70  VT_FILETIME = 64,
71  VT_BLOB = 65,
72  VT_STREAM = 66,
73  VT_STORAGE = 67,
74  VT_STREAMED_OBJECT = 68,
75  VT_STORED_OBJECT = 69,
76  VT_BLOB_OBJECT = 70,
77  VT_CF = 71,
78  VT_CLSID = 72,
80  VT_BSTR_BLOB = 0xfff,
81  VT_VECTOR = 0x1000,
82  VT_ARRAY = 0x2000,
83  VT_BYREF = 0x4000,
84  VT_RESERVED = 0x8000,
85  VT_ILLEGAL = 0xffff,
86  VT_ILLEGALMASKED = 0xfff,
87  VT_TYPEMASK = 0xfff
88 };
Definition: typelib.h:77
Definition: typelib.h:41
Definition: typelib.h:61
Definition: typelib.h:51
Definition: typelib.h:57
Definition: typelib.h:54
Definition: typelib.h:42
Definition: typelib.h:38
Definition: typelib.h:52
Definition: typelib.h:40
Definition: typelib.h:39
Definition: typelib.h:55
Definition: typelib.h:56
Definition: typelib.h:53

Function Documentation

◆ add_importlib()

void add_importlib ( const char name,
typelib_t typelib 
)

Definition at line 391 of file typelib.c.

393 {
395 
396  if(!typelib) return;
397 
399  if(!strcmp(name, importlib->name))
400  return;
401 
402  chat("add_importlib: %s\n", name);
403 
404  importlib = xmalloc(sizeof(*importlib));
405  memset( importlib, 0, sizeof(*importlib) );
406  importlib->name = xstrdup(name);
407 
409  list_add_head( &typelib->importlibs, &importlib->entry );
410 }
static void read_importlib(importlib_t *importlib)
Definition: typelib.c:352
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
static ITypeLib * typelib
Definition: apps.c:105
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
void * xmalloc(int size)
Definition: uimain.c:747
importlib("stdole2.tlb")
uint32_t entry
Definition: isohybrid.c:63
void chat(const char *s,...)
Definition: utils.c:131
Definition: name.c:36
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
char * xstrdup(const char *s)
Definition: uimain.c:768
#define memset(x, y, z)
Definition: compat.h:39

Referenced by yyparse().

◆ create_msft_typelib()

int create_msft_typelib ( typelib_t typelib)

Definition at line 2657 of file write_msft.c.

2658 {
2659  msft_typelib_t *msft;
2660  int failed = 0;
2661  const statement_t *stmt;
2662  time_t cur_time;
2663  char *time_override;
2664  unsigned int version = 7 << 24 | 555; /* 7.00.0555 */
2665  GUID midl_time_guid = {0xde77ba63,0x517c,0x11d1,{0xa2,0xda,0x00,0x00,0xf8,0x77,0x3c,0xe9}};
2666  GUID midl_version_guid = {0xde77ba64,0x517c,0x11d1,{0xa2,0xda,0x00,0x00,0xf8,0x77,0x3c,0xe9}};
2667  GUID midl_info_guid = {0xde77ba65,0x517c,0x11d1,{0xa2,0xda,0x00,0x00,0xf8,0x77,0x3c,0xe9}};
2668  char info_string[128];
2669 
2670  msft = xmalloc(sizeof(*msft));
2671  memset(msft, 0, sizeof(*msft));
2672  msft->typelib = typelib;
2673 
2674  ctl2_init_header(msft);
2675  ctl2_init_segdir(msft);
2676 
2678 
2679  /*
2680  * The following two calls return an offset or -1 if out of memory. We
2681  * specifically need an offset of 0, however, so...
2682  */
2683  if (ctl2_alloc_segment(msft, MSFT_SEG_GUIDHASH, 0x80, 0x80)) { failed = 1; }
2684  if (ctl2_alloc_segment(msft, MSFT_SEG_NAMEHASH, 0x200, 0x200)) { failed = 1; }
2685 
2686  if(failed)
2687  {
2688  free(msft);
2689  return 0;
2690  }
2691 
2694 
2695  memset(msft->typelib_guidhash_segment, 0xff, 0x80);
2696  memset(msft->typelib_namehash_segment, 0xff, 0x200);
2697 
2698  set_lib_flags(msft);
2699  set_lcid(msft);
2700  set_help_file_name(msft);
2701  set_doc_string(msft);
2702  set_guid(msft);
2703  set_version(msft);
2704  set_name(msft);
2705  set_help_context(msft);
2706  set_help_string_dll(msft);
2708 
2709  /* midl adds two sets of custom data to the library: the current unix time
2710  and midl's version number */
2711  time_override = getenv( "WIDL_TIME_OVERRIDE");
2712  cur_time = time_override ? atol( time_override) : time(NULL);
2713  sprintf(info_string, "Created by WIDL version %s at %s\n", PACKAGE_VERSION, ctime(&cur_time));
2714  set_custdata(msft, &midl_info_guid, VT_BSTR, info_string, &msft->typelib_header.CustomDataOffset);
2715  set_custdata(msft, &midl_time_guid, VT_UI4, &cur_time, &msft->typelib_header.CustomDataOffset);
2716  set_custdata(msft, &midl_version_guid, VT_UI4, &version, &msft->typelib_header.CustomDataOffset);
2717 
2718  if (typelib->stmts)
2719  LIST_FOR_EACH_ENTRY( stmt, typelib->stmts, const statement_t, entry )
2720  add_entry(msft, stmt);
2721 
2722  save_all_changes(msft);
2723  free(msft);
2724  return 1;
2725 }
typelib_t * typelib
Definition: write_msft.c:96
#define PACKAGE_VERSION
Definition: config.h:835
INT varflags
Definition: typelib.h:65
#define free
Definition: debug_ros.c:5
static void set_help_file_name(msft_typelib_t *typelib)
Definition: write_msft.c:2441
time_t cur_time
static ITypeLib * typelib
Definition: apps.c:105
static void set_lcid(msft_typelib_t *typelib)
Definition: write_msft.c:2483
static void save_all_changes(msft_typelib_t *typelib)
Definition: write_msft.c:2590
__u16 time
Definition: mkdosfs.c:366
static void set_name(msft_typelib_t *typelib)
Definition: write_msft.c:2395
static void ctl2_init_header(msft_typelib_t *typelib)
Definition: write_msft.c:150
#define sprintf(buf, format,...)
Definition: sprintf.c:55
static void set_lib_flags(msft_typelib_t *typelib)
Definition: write_msft.c:2493
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
void * xmalloc(int size)
Definition: uimain.c:747
INT * typelib_guidhash_segment
Definition: write_msft.c:105
smooth NULL
Definition: ftsmooth.c:416
static void set_guid(msft_typelib_t *typelib)
Definition: write_msft.c:2410
static const WCHAR version[]
Definition: asmname.c:64
unsigned char * typelib_segment_data[MSFT_SEG_MAX]
Definition: write_msft.c:99
static int ctl2_alloc_segment(msft_typelib_t *typelib, enum MSFT_segment_index segment, int size, int block_size)
Definition: write_msft.c:396
__u16 ctime
Definition: mkdosfs.c:362
static void add_entry(msft_typelib_t *typelib, const statement_t *stmt)
Definition: write_msft.c:2356
static void set_help_string_dll(msft_typelib_t *typelib)
Definition: write_msft.c:2462
static void set_help_string_context(msft_typelib_t *typelib)
Definition: write_msft.c:2477
_Check_return_ long __cdecl atol(_In_z_ const char *_Str)
MSFT_Header typelib_header
Definition: write_msft.c:97
uint32_t entry
Definition: isohybrid.c:63
unsigned int pointer_size
Definition: widl.c:158
static void set_version(msft_typelib_t *typelib)
Definition: write_msft.c:2405
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
__kernel_time_t time_t
Definition: linux.h:252
static HRESULT set_custdata(msft_typelib_t *typelib, REFGUID guid, int vt, const void *value, int *offset)
Definition: write_msft.c:1247
INT * typelib_namehash_segment
Definition: write_msft.c:104
static void set_help_context(msft_typelib_t *typelib)
Definition: write_msft.c:2456
INT CustomDataOffset
Definition: typelib.h:79
static void set_doc_string(msft_typelib_t *typelib)
Definition: write_msft.c:2430
#define memset(x, y, z)
Definition: compat.h:39
static void ctl2_init_segdir(msft_typelib_t *typelib)
Definition: write_msft.c:181

Referenced by write_typelib_regscript().

◆ create_sltg_typelib()

int create_sltg_typelib ( typelib_t typelib)

Definition at line 1831 of file write_sltg.c.

1832 {
1833  struct sltg_typelib sltg;
1834  const statement_t *stmt;
1835  void *library_block;
1836  int library_block_size, library_block_index;
1837 
1838  sltg.typelib = typelib;
1839  sltg.typeinfo_count = 0;
1840  sltg.typeinfo_size = 0;
1841  sltg.typeinfo = NULL;
1842  sltg.blocks = NULL;
1843  sltg.n_file_blocks = 0;
1844  sltg.first_block = 1;
1845 
1846  init_index(&sltg.index);
1847  init_name_table(&sltg);
1848  init_library(&sltg);
1849 
1850  library_block = create_library_block(&sltg, &library_block_size, &library_block_index);
1851 
1852  if (typelib->stmts)
1853  LIST_FOR_EACH_ENTRY(stmt, typelib->stmts, const statement_t, entry)
1854  add_statement(&sltg, stmt);
1855 
1856  add_block_index(&sltg, library_block, library_block_size, library_block_index);
1857 
1858  save_all_changes(&sltg);
1859 
1860  return 1;
1861 }
static void init_name_table(struct sltg_typelib *sltg)
Definition: write_sltg.c:320
static ITypeLib * typelib
Definition: apps.c:105
static void * create_library_block(struct sltg_typelib *typelib, int *size, int *index)
Definition: write_sltg.c:418
static void add_block_index(struct sltg_typelib *sltg, void *data, int size, int index)
Definition: write_sltg.c:382
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
static void init_index(struct sltg_data *index)
Definition: write_sltg.c:283
static void add_statement(struct sltg_typelib *typelib, const statement_t *stmt)
Definition: write_sltg.c:1603
smooth NULL
Definition: ftsmooth.c:416
static void save_all_changes(struct sltg_typelib *typelib)
Definition: write_sltg.c:1798
uint32_t entry
Definition: isohybrid.c:63
static void init_library(struct sltg_typelib *sltg)
Definition: write_sltg.c:325

Referenced by write_typelib_regscript().

◆ get_type_vt()

unsigned short get_type_vt ( type_t t)

Definition at line 129 of file typelib.c.

130 {
131  unsigned short vt;
132 
133  chat("get_type_vt: %p type->name %s\n", t, t->name);
134  if (t->name) {
135  vt = builtin_vt(t);
136  if (vt) return vt;
137  }
138 
139  if (type_is_alias(t) && is_attr(t->attrs, ATTR_PUBLIC))
140  return VT_USERDEFINED;
141 
142  switch (type_get_type(t)) {
143  case TYPE_BASIC:
144  switch (type_basic_get_type(t)) {
145  case TYPE_BASIC_BYTE:
146  return VT_UI1;
147  case TYPE_BASIC_CHAR:
148  case TYPE_BASIC_INT8:
149  if (type_basic_get_sign(t) > 0)
150  return VT_UI1;
151  else
152  return VT_I1;
153  case TYPE_BASIC_WCHAR:
154  return VT_I2; /* mktyplib seems to parse wchar_t as short */
155  case TYPE_BASIC_INT16:
156  if (type_basic_get_sign(t) > 0)
157  return VT_UI2;
158  else
159  return VT_I2;
160  case TYPE_BASIC_INT:
161  if (type_basic_get_sign(t) > 0)
162  return VT_UINT;
163  else
164  return VT_INT;
165  case TYPE_BASIC_INT32:
166  case TYPE_BASIC_LONG:
168  if (type_basic_get_sign(t) > 0)
169  return VT_UI4;
170  else
171  return VT_I4;
172  case TYPE_BASIC_INT64:
173  case TYPE_BASIC_HYPER:
174  if (type_basic_get_sign(t) > 0)
175  return VT_UI8;
176  else
177  return VT_I8;
178  case TYPE_BASIC_INT3264:
179  if (pointer_size == 8)
180  {
181  if (type_basic_get_sign(t) > 0)
182  return VT_UI8;
183  else
184  return VT_I8;
185  }
186  else
187  {
188  if (type_basic_get_sign(t) > 0)
189  return VT_UI4;
190  else
191  return VT_I4;
192  }
193  case TYPE_BASIC_FLOAT:
194  return VT_R4;
195  case TYPE_BASIC_DOUBLE:
196  return VT_R8;
197  case TYPE_BASIC_HANDLE:
198  error("handles can't be used in typelibs\n");
199  }
200  break;
201 
202  case TYPE_POINTER:
203  return VT_PTR;
204 
205  case TYPE_ARRAY:
207  {
208  if (match(type_array_get_element(t)->name, "SAFEARRAY"))
209  return VT_SAFEARRAY;
210  return VT_PTR;
211  }
212  else
213  return VT_CARRAY;
214 
215  case TYPE_INTERFACE:
216  if(match(t->name, "IUnknown"))
217  return VT_UNKNOWN;
218  if(match(t->name, "IDispatch"))
219  return VT_DISPATCH;
220  return VT_USERDEFINED;
221 
222  case TYPE_ENUM:
223  case TYPE_STRUCT:
224  case TYPE_COCLASS:
225  case TYPE_MODULE:
226  case TYPE_UNION:
228  return VT_USERDEFINED;
229 
230  case TYPE_VOID:
231  return VT_VOID;
232 
233  case TYPE_ALIAS:
234  /* aliases should be filtered out by the type_get_type call above */
235  assert(0);
236  break;
237 
238  case TYPE_FUNCTION:
239  error("get_type_vt: functions not supported\n");
240  break;
241 
242  case TYPE_BITFIELD:
243  error("get_type_vt: bitfields not supported\n");
244  break;
245  }
246  return 0;
247 }
Definition: compat.h:1939
Definition: compat.h:1955
#define error(str)
Definition: mkdosfs.c:1605
Definition: compat.h:1951
static type_t * type_array_get_element(const type_t *type)
Definition: typetree.h:253
GLdouble GLdouble t
Definition: gl.h:2047
#define assert(x)
Definition: debug.h:53
static enum type_basic_type type_basic_get_type(const type_t *type)
Definition: typetree.h:73
IUnknownVtbl vt
Definition: typelib.c:6130
static int type_is_alias(const type_t *type)
Definition: typetree.h:274
static enum type_type type_get_type(const type_t *type)
Definition: typetree.h:68
static int match(const char *n, const char *m)
Definition: typelib.c:123
Definition: compat.h:1940
unsigned int pointer_size
Definition: widl.c:158
void chat(const char *s,...)
Definition: utils.c:131
Definition: name.c:36
static int type_basic_get_sign(const type_t *type)
Definition: typetree.h:80
static int type_array_is_decl_as_ptr(const type_t *type)
Definition: typetree.h:260
int is_attr(const attr_list_t *list, enum attr_type t)
Definition: header.c:99
Definition: compat.h:1941
Definition: compat.h:1938
static unsigned short builtin_vt(const type_t *t)
Definition: typelib.c:82

Referenced by add_typedef_typeinfo(), encode_type(), encode_var(), get_element_size(), write_args(), write_default_value(), and write_var_desc().