31#define NONAMELESSUNION
48static const GUID sltg_library_guid = { 0x204ff,0,0,{ 0xc0,0,0,0,0,0,0,0x46 } };
260 data->allocated = 0x10;
266 int name_offset =
index->size;
269 chat(
"add_index: name_offset %d, \"%s\"\n", name_offset,
name);
271 if (new_size >
index->allocated)
278 index->size = new_size;
285 static const char compobj[] = { 1,
'C',
'o',
'm',
'p',
'O',
'b',
'j',0 };
300 aligned_size = (new_size + 0x1f) & ~0x1f;
301 if (aligned_size - new_size < 4)
302 new_size = aligned_size;
304 new_size = (new_size + 1) & ~1;
368 sltg->
library.libflags |= 0x02;
371 sltg->
library.libflags |= 0x04;
374 sltg->
library.libflags |= 0x01;
433 if (
typelib->library.helpstring)
449 *(
int *)
p =
typelib->library.helpcontext;
456 *(
int *)
p =
typelib->library.version;
467 static char name[11] =
"0000000000";
475 error(
"too many index names\n");
493 block->index_string = 0;
516 if (new_size >
block->allocated)
523 block->size = new_size;
528 error(
"add_module_typeinfo: %s not implemented\n",
type->name);
533 const char *index_name, *other_name;
536 int size, helpcontext = 0;
549 size =
sizeof(
short) * 8 + 10 * 2 +
sizeof(
int) +
sizeof(
GUID);
555 p = (
short *)((
char *)
p +
strlen(index_name));
558 p = (
short *)((
char *)
p +
strlen(other_name));
563 *(
int *)
p = helpcontext;
583 ti->
res16 = 0xfffe0000;
584 ti->
misc.unknown1 = 0x02;
586 ti->
misc.unknown2 = 0x02;
587 ti->
misc.typekind = kind;
595 int i, hrefinfo_size;
614 tail->cImplTypes = 0;
616 tail->funcs_off = -1;
618 tail->impls_off = -1;
619 tail->funcs_bytes = -1;
620 tail->vars_bytes = -1;
621 tail->impls_bytes = -1;
622 tail->tdescalias_vt = -1;
626 tail->simple_alias = 0;
628 tail->cbSizeInstance = 0;
629 tail->cbAlignment = 4;
638 tail->type_bytes = 0;
649 hrefinfo.
magic = 0xdf;
672 hrefinfo.
resxx = 0xdf;
697 const unsigned char *
p = (
const unsigned char *)
data;
702 chat(
"dump_var_desc: size %d bytes\n",
size);
764 error(
"get_element_size: unrecognized vt %d\n",
vt);
777 if (hrefmap->
href[
i] == typelib_href)
797 chat(
"typelib href %d mapped to local href %d\n", typelib_href, href);
803 short flags,
short base_offset,
int *size_instance,
struct sltg_hrefmap *hrefmap)
805 short vt, vt_flags, desc_offset;
807 chat(
"write_var_desc: type %p, type->name %s\n",
839 chat(
"write_var_desc: VT_CARRAY: %d dimensions, %d elements\n", num_dims, elements);
841 array_start =
data->size;
843 size =
sizeof(*array) + (num_dims - 1) * 8 ;
846 array->cDims = num_dims;
847 array->fFeatures = 0x0004;
852 bound =
array->bound;
870 size_instance =
NULL;
875 desc_offset =
data->size;
878 vt_off[1] = array_start + base_offset;
885 desc_offset =
data->size;
895 chat(
"write_var_desc: vt VT_PTR | 0x0400 | %04x\n", param_flags);
905 chat(
"write_var_desc: vt %d, flags %04x\n",
vt,
flags);
907 vt_flags =
vt |
flags | param_flags;
917 chat(
"write_var_desc: VT_USERDEFINED, type %p, name %s, real type %d, href %d\n",
920 if (
type->typelib_idx == -1)
922 chat(
"write_var_desc: trying to ref not added type\n");
942 error(
"write_var_desc: VT_USERDEFINED - unhandled type %d\n",
947 if (
type->typelib_idx == -1)
948 error(
"write_var_desc: trying to ref not added type\n");
951 chat(
"write_var_desc: VT_USERDEFINED, local href %d\n", href);
966 const char *index_name;
970 int member_offset, var_count = 0, var_data_size = 0, size_instance = 0;
971 short *type_desc_offset =
NULL;
973 if (
type->typelib_idx != -1)
return;
975 chat(
"add_structure_typeinfo: type %p, type->name %s\n",
type,
type->name);
989 var_data =
xmalloc(var_count *
sizeof(*var_data));
990 type_desc_offset =
xmalloc(var_count *
sizeof(*type_desc_offset));
996 chat(
"add_structure_typeinfo: var %p (%s), type %p (%s)\n",
1001 base_offset = var_data_size + (
i + 1) *
sizeof(
struct sltg_variable);
1003 base_offset, &size_instance, &hrefmap);
1006 if (var_data[
i].
size >
sizeof(
short))
1007 var_data_size += var_data[
i].
size;
1021 member_offset =
data.size;
1034 short next = member_offset;
1046 if (var_data[
i].
size >
sizeof(
short))
1049 var_data_size =
next - member_offset + type_desc_offset[
i];
1058 variable.next =
i < var_count - 1 ?
next - member_offset : -1;
1065 if (var_data[
i].
size >
sizeof(
short))
1074 tail.cVars = var_count;
1076 tail.vars_bytes = var_data_size;
1077 tail.cbSizeInstance = size_instance;
1092 for (
i = 0;
i < importlib->ntypeinfos;
i++)
1094 if (!
strcmp(
name, importlib->importinfos[
i].name))
1096 chat(
"Found %s in importlib list\n",
name);
1097 return &importlib->importinfos[
i];
1114 if (!
func->attrs)
return 0;
1145 *dispid =
expr->cval;
1191 if (!
param->attrs)
return 0;
1213 chat(
"unhandled param attr %d\n",
attr->type);
1237 int funcflags = 0, invokekind = 1 , helpcontext;
1240 short ret_desc_offset, *arg_desc_offset, arg_offset;
1245 old_size =
data->size;
1249 0, 0, base_offset,
NULL, hrefmap);
1255 if (ret_data.
size >
sizeof(
short))
1257 arg_data_size += ret_data.
size;
1258 arg_offset += ret_data.
size;
1267 arg_data =
xmalloc(arg_count *
sizeof(*arg_data));
1268 arg_desc_offset =
xmalloc(arg_count *
sizeof(*arg_desc_offset));
1270 arg_offset += arg_count * 2 *
sizeof(
short);
1277 chat(
"add_func_desc: arg[%d] %p (%s), type %p (%s)\n",
1283 arg_offset,
NULL, hrefmap);
1286 if (arg_data[
i].
size >
sizeof(
short))
1288 arg_data_size += arg_data[
i].
size;
1289 arg_offset += arg_data[
i].
size;;
1294 if (!
arg->attrs)
continue;
1308 if (base_offset != -1)
1309 chat(
"add_func_desc: flags %#x, dispid %#x, invokekind %d, helpcontext %#x, helpstring %s\n",
1312 func_desc.
magic = 0x6c;
1313 func_desc.
flags = (invokekind << 4) | 0x02;
1314 if (
idx & 0x80000000)
1316 func_desc.
next = -1;
1320 func_desc.
next = base_offset +
sizeof(func_desc) + arg_data_size + arg_count * 2 *
sizeof(
short);
1325 func_desc.
arg_off = arg_count ? base_offset +
sizeof(func_desc) : -1;
1326 func_desc.
nacc = (arg_count << 3) | 4 ;
1328 if (ret_data.
size >
sizeof(
short))
1330 func_desc.
rettype = base_offset +
sizeof(func_desc) + ret_desc_offset;
1346 if (ret_data.
size >
sizeof(
short))
1350 arg_offset += ret_data.
size;
1357 arg_offset += arg_count * 2 *
sizeof(
short);
1361 short name, type_offset;
1365 if (arg_data[
i].
size >
sizeof(
short))
1367 type_offset = (arg_offset + arg_desc_offset[
i]);
1368 arg_offset += arg_data[
i].
size;
1373 type_offset = *(
short *)arg_data[
i].
data;
1379 if (base_offset != -1)
1380 chat(
"add_func_desc: arg[%d] - name %s (%#x), type_offset %#x\n",
1386 for (
i = 0;
i < arg_count;
i++)
1388 if (arg_data[
i].
size >
sizeof(
short))
1393 return data->size - old_size;
1400 impl_info.
res00 = 0x004a;
1401 impl_info.
next = -1;
1402 impl_info.
res04 = -1;
1404 impl_info.
res07 = 0x80;
1405 impl_info.
res08 = 0x0012;
1406 impl_info.
ref = href;
1407 impl_info.
res0c = 0x4001;
1408 impl_info.
res0e = -2;
1409 impl_info.
res10 = -1;
1410 impl_info.
res12 = 0x001d;
1420 short inherit_href = -1;
1423 const char *index_name;
1427 int member_offset, base_offset, func_data_size,
i;
1428 int func_count, inherited_func_count = 0;
1429 int dispid, inherit_level = 0;
1433 chat(
"add_interface_typeinfo: type %p, type->name %s\n", iface, iface->
name);
1437 error(
"interface %s is referenced but not defined\n", iface->
name);
1443 error(
"support for dispinterface %s is not implemented\n", iface->
name);
1456 chat(
"add_interface_typeinfo: inheriting from base interface %s\n", inherit->
name);
1464 error(
"support for imported interfaces is not implemented\n");
1489 func_data_size =
data.size;
1503 member_offset =
data.size;
1509 member.extra = func_data_size;
1510 if (inherit_href != -1)
1517 if (inherit_href != -1)
1521 dispid = 0x60000000 | (inherit_level << 16);
1525 int idx = inherited_func_count +
i;
1527 if (
i == func_count - 1)
idx |= 0x80000000;
1530 idx, dispid +
i, base_offset, &hrefmap);
1536 tail.cFuncs = func_count;
1538 tail.funcs_bytes = func_data_size;
1545 if (inherit_href != -1)
1549 tail.impls_bytes = 0;
1560 error(
"add_enum_typeinfo: %s not implemented\n",
type->name);
1565 error(
"add_union_typeinfo: %s not implemented\n",
type->name);
1570 error(
"add_coclass_typeinfo: %s not implemented\n",
type->name);
1621 for (; type_entry; type_entry = type_entry->
next)
1642 error(
"add_statement: unhandled statement type %d\n", stmt->
type);
1653 short n_file_blocks;
1655 short size_of_index;
1661 struct sltg_block_entry
1670 header.magic = 0x47544c53;
1676 header.res1c = 0x00000044;
1677 header.res20 = 0xffff0000;
1689 chat(
"sltg_write_header: writing block entry %d: length %#x, index_string %#x, next %#x\n",
1702 chat(
"sltg_write_header: writing library block entry %d: length %#x, index_string %#x, next %#x\n",
1706 chat(
"sltg_write_header: writing index: %d bytes\n", sltg->
index.size);
1714 chat(
"sltg_write_header: writing block %d: %d bytes\n",
i,
block->length);
1725 chat(
"sltg_write_header: writing library block %d: %d bytes\n",
i,
block->length);
1728 chat(
"sltg_write_header: writing pad 0x40 bytes\n");
1742 for (
i = 0;
i <
typelib->typeinfo_count;
i++)
1744 chat(
"sltg_write_typeinfo: writing block %d: %d bytes\n",
i,
block->length);
1754 static const char dummy[6];
1756 chat(
"sltg_write_helpstrings: writing dummy 6 bytes\n");
1763 static const short dummy[6] = { 0xffff,1,2,0xff00,0xffff,0xffff };
1766 chat(
"sltg_write_nametable: writing 12+0x200+%d bytes\n",
typelib->name_table.size);
1769 memset(pad, 0xff, 0x200);
1777 static const short dummy1[] = { 1,0xfffe,0x0a03,0,0xffff,0xffff };
1778 static const short dummy2[] = { 0xffff,0xffff,0x0200,0,0,0 };
1779 static const char dummy3[] = { 0xf4,0x39,0xb2,0x71,0,0,0,0,0,0,0,0,0,0,0,0 };
1780 static const char TYPELIB[] = { 8,0,0,0,
'T',
'Y',
'P',
'E',
'L',
'I',
'B',0 };
1792 put_data(TYPELIB,
sizeof(TYPELIB));
1800 int library_block_start;
1801 int *name_table_offset;
1808 put_data(&library_block_start,
sizeof(library_block_start));
1813 chat(
"*name_table_offset = %#x\n", *name_table_offset);
1820 char typelib_id[13] =
"#1";
1835 void *library_block;
1836 int library_block_size, library_block_index;
1856 add_block_index(&sltg, library_block, library_block_size, library_block_index);
int strcmp(const char *String1, const char *String2)
ACPI_SIZE strlen(const char *String)
char * strcpy(char *DstString, const char *SrcString)
struct outqueuenode * tail
coclass MediaStreamFilter helpstring("Stream Class")
void * xrealloc(void *oldmem, size_t size)
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
GLuint GLuint GLsizei GLenum type
GLuint GLuint GLsizei count
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLuint GLsizei GLsizei * length
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
#define memcpy(s1, s2, n)
#define sprintf(buf, format,...)
static const ASMPROP_RES defaults[ASM_NAME_MAX_PARAMS]
static HRESULT flush_output_buffer(mxwriter *This)
static unsigned __int64 next
#define offsetof(TYPE, MEMBER)
__WINE_SERVER_LIST_INLINE unsigned int list_count(const struct list *list)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
union _statement_t::@5030 u
struct _type_list_t * next
union _type_t::@5029 details
struct iface_details * iface
const attr_list_t * attrs
struct sltg_block * typeinfo
struct sltg_library library
struct sltg_block * blocks
struct sltg_data name_table
static int type_array_is_decl_as_ptr(const type_t *type)
static enum type_type type_get_type(const type_t *type)
static type_t * type_function_get_rettype(const type_t *type)
static type_t * type_alias_get_aliasee(const type_t *type)
static var_list_t * type_struct_get_fields(const type_t *type)
static int type_is_alias(const type_t *type)
static type_t * type_iface_get_inherit(const type_t *type)
static type_t * type_array_get_element(const type_t *type)
static unsigned int type_array_get_dim(const type_t *type)
static statement_list_t * type_iface_get_stmts(const type_t *type)
static type_t * type_pointer_get_ref(const type_t *type)
unsigned int pointer_size
static var_list_t * type_get_function_args(const type_t *func_type)
#define STATEMENTS_FOR_EACH_FUNC(stmt, stmts)
_In_ ULONG _In_opt_ PVOID pvData
static void add_block_index(struct sltg_typelib *sltg, void *data, int size, int index)
static int add_func_desc(struct sltg_typelib *typelib, struct sltg_data *data, var_t *func, int idx, int dispid, short base_offset, struct sltg_hrefmap *hrefmap)
static const GUID sltg_library_guid
static void write_hrefmap(struct sltg_data *data, const struct sltg_hrefmap *hrefmap)
static void dump_var_desc(const char *data, int size)
static int get_param_flags(const var_t *param)
static void init_name_table(struct sltg_typelib *sltg)
static void init_sltg_data(struct sltg_data *data)
int create_sltg_typelib(typelib_t *typelib)
static importinfo_t * find_importinfo(typelib_t *typelib, const char *name)
static void init_sltg_tail(struct sltg_tail *tail)
static void add_coclass_typeinfo(struct sltg_typelib *typelib, type_t *type)
static void init_index(struct sltg_data *index)
static void append_data(struct sltg_data *block, const void *data, int size)
static int local_href(struct sltg_hrefmap *hrefmap, int typelib_href)
static void * create_library_block(struct sltg_typelib *typelib, int *size, int *index)
static void init_library(struct sltg_typelib *sltg)
static int add_name(struct sltg_typelib *sltg, const char *name)
static void add_block(struct sltg_typelib *sltg, void *data, int size, const char *name)
static short write_var_desc(struct sltg_typelib *typelib, struct sltg_data *data, type_t *type, short param_flags, short flags, short base_offset, int *size_instance, struct sltg_hrefmap *hrefmap)
static const char * new_index_name(void)
static void add_interface_typeinfo(struct sltg_typelib *typelib, type_t *type)
static void add_module_typeinfo(struct sltg_typelib *typelib, type_t *type)
static void sltg_write_nametable(struct sltg_typelib *typelib)
static void add_structure_typeinfo(struct sltg_typelib *typelib, type_t *type)
static void sltg_write_remainder(void)
static void write_impl_href(struct sltg_data *data, short href)
static void sltg_write_header(struct sltg_typelib *sltg, int *library_block_start)
static void sltg_add_typeinfo(struct sltg_typelib *sltg, void *data, int size, const char *name)
static void save_all_changes(struct sltg_typelib *typelib)
static void add_union_typeinfo(struct sltg_typelib *typelib, type_t *type)
static void add_statement(struct sltg_typelib *typelib, const statement_t *stmt)
static const char * add_typeinfo_block(struct sltg_typelib *typelib, const type_t *type, int kind)
static int get_element_size(type_t *type)
static void add_enum_typeinfo(struct sltg_typelib *typelib, type_t *type)
static void init_typeinfo(struct sltg_typeinfo_header *ti, const type_t *type, int kind, const struct sltg_hrefmap *hrefmap)
static int get_func_flags(const var_t *func, int *dispid, int *invokekind, int *helpcontext, const char **helpstring)
static void add_type_typeinfo(struct sltg_typelib *typelib, type_t *type)
static void sltg_write_helpstrings(struct sltg_typelib *typelib)
static void sltg_write_typeinfo(struct sltg_typelib *typelib)
static int add_index(struct sltg_data *index, const char *name)
static unsigned int block