57 unsigned char Data4[ 8 ];
61static const GUID sltg_library_guid = { 0x204ff,0,0,{ 0xc0,0,0,0,0,0,0,0x46 } };
262 int name_offset =
index->size;
265 chat(
"add_index: name_offset %d, \"%s\"\n", name_offset,
name);
281 static const char compobj[] = { 1,
'C',
'o',
'm',
'p',
'O',
'b',
'j',0 };
290 int name_offset = name_table->
size;
296 aligned_size = (
new_size + 0x1f) & ~0x1f;
311 name_table->
data[name_table->
size - 1] = 0;
368 sltg->
library.libflags |= 0x02;
371 sltg->
library.libflags |= 0x04;
374 sltg->
library.libflags |= 0x01;
418 if (
typelib->library.helpstring)
434 *(
int *)
p =
typelib->library.helpcontext;
441 *(
int *)
p =
typelib->library.version;
452 static char name[11] =
"AAAAAAAAAA";
460 error(
"too many index names\n");
498 error(
"add_module_typeinfo: %s not implemented\n",
type->name);
504 const char *index_name, *other_name;
556 ti->
res16 = 0xfffe0000;
557 ti->
misc.unknown1 = 0x02;
559 ti->
misc.unknown2 = 0x02;
560 ti->
misc.typekind = kind;
566 int i, hrefinfo_size;
589 hrefinfo.
magic = 0xdf;
596 hrefinfo.
resxx = 0xdf;
621 const unsigned char *
p = (
const unsigned char *)
data;
626 chat(
"dump_var_desc: size %d bytes\n",
size);
694 error(
"get_element_size: unrecognized vt %d\n",
vt);
707 if (hrefmap->
href[
i] == typelib_href)
727 chat(
"typelib href %d mapped to local href %d\n", typelib_href, href);
733 short flags,
short base_offset,
int *size_instance,
struct sltg_hrefmap *hrefmap)
735 short vt, vt_flags, desc_offset;
737 chat(
"write_var_desc: type %p, type->name %s\n",
769 chat(
"write_var_desc: VT_CARRAY: %d dimensions, %d elements\n", num_dims, elements);
771 array_start =
data->size;
773 size =
sizeof(*array) + (num_dims - 1) * 8 ;
776 array->cDims = num_dims;
777 array->fFeatures = 0x0004;
782 bound =
array->bound;
800 size_instance =
NULL;
805 desc_offset =
data->size;
808 vt_off[1] = array_start + base_offset;
815 desc_offset =
data->size;
825 chat(
"write_var_desc: vt VT_PTR | 0x0400 | %04x\n", param_flags);
835 chat(
"write_var_desc: vt %d, flags %04x\n",
vt,
flags);
837 vt_flags =
vt |
flags | param_flags;
847 chat(
"write_var_desc: VT_USERDEFINED, type %p, name %s, real type %d, href %d\n",
850 if (
type->typelib_idx == -1)
852 chat(
"write_var_desc: trying to ref not added type\n");
872 error(
"write_var_desc: VT_USERDEFINED - unhandled type %d\n",
877 if (
type->typelib_idx == -1)
878 error(
"write_var_desc: trying to ref not added type\n");
881 chat(
"write_var_desc: VT_USERDEFINED, local href %d\n", href);
896 tail->cImplTypes = 0;
898 tail->funcs_off = -1;
900 tail->impls_off = -1;
901 tail->funcs_bytes = -1;
902 tail->vars_bytes = -1;
903 tail->impls_bytes = -1;
904 tail->tdescalias_vt = -1;
908 tail->simple_alias = 0;
910 tail->cbSizeInstance = 0;
911 tail->cbAlignment = 4;
920 tail->type_bytes = 0;
927 const char *index_name;
931 int member_offset, var_count = 0, var_data_size = 0, size_instance = 0;
932 short *type_desc_offset =
NULL;
934 if (
type->typelib_idx != -1)
return;
936 chat(
"add_structure_typeinfo: type %p, type->name %s\n",
type,
type->name);
950 var_data =
xmalloc(var_count *
sizeof(*var_data));
951 type_desc_offset =
xmalloc(var_count *
sizeof(*type_desc_offset));
957 chat(
"add_structure_typeinfo: var %p (%s), type %p (%s)\n",
958 var,
var->name,
var->declspec.type,
var->declspec.type->name);
962 base_offset = var_data_size + (
i + 1) *
sizeof(
struct sltg_variable);
964 base_offset, &size_instance, &hrefmap);
967 if (var_data[
i].
size >
sizeof(
short))
968 var_data_size += var_data[
i].
size;
982 member_offset =
data.size;
995 short next = member_offset;
1007 if (var_data[
i].
size >
sizeof(
short))
1010 var_data_size =
next - member_offset + type_desc_offset[
i];
1019 variable.next =
i < var_count - 1 ?
next - member_offset : -1;
1026 if (var_data[
i].
size >
sizeof(
short))
1034 tail.cVars = var_count;
1036 tail.vars_bytes = var_data_size;
1037 tail.cbSizeInstance = size_instance;
1052 for (
i = 0;
i < importlib->ntypeinfos;
i++)
1054 if (!
strcmp(
name, importlib->importinfos[
i].name))
1056 chat(
"Found %s in importlib list\n",
name);
1057 return &importlib->importinfos[
i];
1074 if (!
func->attrs)
return 0;
1105 *dispid =
expr->cval;
1151 if (!
param->attrs)
return 0;
1173 chat(
"unhandled param attr %d\n",
attr->type);
1179 flags |=
in ? 0x8000 : 0x4000;
1192 int funcflags = 0, invokekind = 1 , helpcontext;
1195 short ret_desc_offset, *arg_desc_offset, arg_offset;
1204 0, 0, base_offset,
NULL, hrefmap);
1210 if (ret_data.
size >
sizeof(
short))
1212 arg_data_size += ret_data.
size;
1213 arg_offset += ret_data.
size;
1222 arg_data =
xmalloc(arg_count *
sizeof(*arg_data));
1223 arg_desc_offset =
xmalloc(arg_count *
sizeof(*arg_desc_offset));
1225 arg_offset += arg_count * 2 *
sizeof(
short);
1232 chat(
"add_func_desc: arg[%d] %p (%s), type %p (%s)\n",
1233 i,
arg,
arg->name,
arg->declspec.type,
arg->declspec.type->name);
1239 arg_offset,
NULL, hrefmap);
1242 if (arg_data[
i].
size >
sizeof(
short))
1244 arg_data_size += arg_data[
i].
size;
1245 arg_offset += arg_data[
i].
size;
1250 if (!
arg->attrs)
continue;
1262 if (base_offset != -1)
1263 chat(
"add_func_desc: flags %#x, dispid %#x, invokekind %d, helpcontext %#x, helpstring %s\n",
1266 func_desc.
magic = 0x6c;
1267 func_desc.
flags = (invokekind << 4) | 0x02;
1268 if (
idx & 0x80000000)
1270 func_desc.
next = -1;
1274 func_desc.
next = base_offset +
sizeof(func_desc) + arg_data_size + arg_count * 2 *
sizeof(
short);
1279 func_desc.
arg_off = arg_count ? base_offset +
sizeof(func_desc) : -1;
1280 func_desc.
nacc = (arg_count << 3) | 4 ;
1282 if (ret_data.
size >
sizeof(
short))
1284 func_desc.
rettype = base_offset +
sizeof(func_desc) + ret_desc_offset;
1300 if (ret_data.
size >
sizeof(
short))
1304 arg_offset += ret_data.
size;
1311 arg_offset += arg_count * 2 *
sizeof(
short);
1315 short name, type_offset;
1319 if (arg_data[
i].
size >
sizeof(
short))
1321 type_offset = (arg_offset + arg_desc_offset[
i]);
1322 arg_offset += arg_data[
i].
size;
1327 type_offset = *(
short *)arg_data[
i].
data;
1333 if (base_offset != -1)
1334 chat(
"add_func_desc: arg[%d] - name %s (%#x), type_offset %#x\n",
1340 for (
i = 0;
i < arg_count;
i++)
1342 if (arg_data[
i].
size >
sizeof(
short))
1354 impl_info.
res00 = 0x004a;
1355 impl_info.
next = -1;
1356 impl_info.
res04 = -1;
1358 impl_info.
res07 = 0x80;
1359 impl_info.
res08 = 0x0012;
1360 impl_info.
ref = href;
1361 impl_info.
res0c = 0x4001;
1362 impl_info.
res0e = -2;
1363 impl_info.
res10 = -1;
1364 impl_info.
res12 = 0x001d;
1374 short inherit_href = -1;
1377 const char *index_name;
1381 int member_offset, base_offset, func_data_size,
i;
1382 int func_count, inherited_func_count = 0;
1383 int dispid, inherit_level = 0;
1387 chat(
"add_interface_typeinfo: type %p, type->name %s\n", iface, iface->
name);
1391 error(
"interface %s is referenced but not defined\n", iface->
name);
1397 error(
"support for dispinterface %s is not implemented\n", iface->
name);
1410 chat(
"add_interface_typeinfo: inheriting from base interface %s\n", inherit->
name);
1418 error(
"support for imported interfaces is not implemented\n");
1443 func_data_size =
data.size;
1457 member_offset =
data.size;
1463 member.extra = func_data_size;
1464 if (inherit_href != -1)
1471 if (inherit_href != -1)
1475 dispid = 0x60000000 | (inherit_level << 16);
1479 int idx = inherited_func_count +
i;
1481 if (
i == func_count - 1)
idx |= 0x80000000;
1484 idx, dispid +
i, base_offset, &hrefmap);
1490 tail.cFuncs = func_count;
1492 tail.funcs_bytes = func_data_size;
1499 if (inherit_href != -1)
1503 tail.impls_bytes = 0;
1514 error(
"add_enum_typeinfo: %s not implemented\n",
type->name);
1519 error(
"add_union_typeinfo: %s not implemented\n",
type->name);
1524 error(
"add_coclass_typeinfo: %s not implemented\n",
type->name);
1600 error(
"add_statement: unhandled statement type %d\n", stmt->
type);
1613 short size_of_index;
1619 struct sltg_block_entry
1627 header.magic = 0x47544c53;
1633 header.res1c = 0x00000044;
1634 header.res20 = 0xffff0000;
1644 chat(
"sltg_write_header: writing block entry %d: length %#x, index_string %#x, next %#x\n",
1657 chat(
"sltg_write_header: writing library block entry %d: length %#x, index_string %#x, next %#x\n",
1661 chat(
"sltg_write_header: writing index: %d bytes\n", sltg->
index.size);
1669 chat(
"sltg_write_header: writing block %d: %d bytes\n",
i, sltg->
blocks[
i].length);
1676 chat(
"sltg_write_header: writing library block %d: %d bytes\n",
i, sltg->
blocks[
i].length);
1679 chat(
"sltg_write_header: writing pad 0x40 bytes\n");
1690 for (
i = 0;
i <
typelib->typeinfo_count;
i++)
1692 chat(
"sltg_write_typeinfo: writing block %d: %d bytes\n",
i,
typelib->typeinfo[
i].length);
1699 static const char dummy[6];
1701 chat(
"sltg_write_helpstrings: writing dummy 6 bytes\n");
1708 static const short dummy[6] = { 0xffff,1,2,0xff00,0xffff,0xffff };
1711 chat(
"sltg_write_nametable: writing 12+0x200+%d bytes\n",
typelib->name_table.size);
1714 memset(pad, 0xff, 0x200);
1722 static const short dummy1[] = { 1,0xfffe,0x0a03,0,0xffff,0xffff };
1723 static const short dummy2[] = { 0xffff,0xffff,0x0200,0,0,0 };
1724 static const char dummy3[] = { 0xf4,0x39,0xb2,0x71,0,0,0,0,0,0,0,0,0,0,0,0 };
1725 static const char TYPELIB[] = { 8,0,0,0,
'T',
'Y',
'P',
'E',
'L',
'I',
'B',0 };
1737 put_data(TYPELIB,
sizeof(TYPELIB));
1745 int library_block_start;
1746 int *name_table_offset;
1753 put_data(&library_block_start,
sizeof(library_block_start));
1758 chat(
"*name_table_offset = %#x\n", *name_table_offset);
1765 char typelib_id[13] =
"#1";
1769 snprintf(typelib_id,
sizeof(typelib_id),
"#%d",
expr->cval);
1781 void *library_block;
1782 int library_block_size, library_block_index;
1786 error(
"Only 32-bit platform is supported\n");
1807 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)
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
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)
static HRESULT flush_output_buffer(mxwriter *This)
_In_ LPWSTR _In_ DWORD _In_ LPCVOID pvData
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)
typeref_list_t * type_list
union _statement_t::@5358 u
union _type_t::@5357 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_array_get_element_type(const type_t *type)
static type_t * type_alias_get_aliasee_type(const type_t *type)
static var_list_t * type_struct_get_fields(const type_t *type)
static type_t * type_pointer_get_ref_type(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 var_list_t * type_function_get_args(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)
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
unsigned int pointer_size
#define STATEMENTS_FOR_EACH_FUNC(stmt, stmts)
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_sltg_data(struct sltg_data *data)
static void sltg_add_typeinfo(struct sltg_typelib *sltg, void *data, int length, const char *name)
static int add_name(struct sltg_data *name_table, const char *name)
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 init_typeinfo(struct sltg_typeinfo_header *ti, const type_t *type, short kind, const struct sltg_hrefmap *hrefmap)
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 void init_name_table(struct sltg_data *name_table)
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 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_block_index(struct sltg_typelib *sltg, void *data, int length, int index)
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 save_all_changes(struct sltg_typelib *typelib)
static void add_union_typeinfo(struct sltg_typelib *typelib, type_t *type)
static const char * add_typeinfo_block(struct sltg_typelib *typelib, const type_t *type, short kind)
static void add_statement(struct sltg_typelib *typelib, const statement_t *stmt)
static int get_element_size(type_t *type)
static void add_enum_typeinfo(struct sltg_typelib *typelib, type_t *type)
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