Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
a7f0e61e
Commit
a7f0e61e
authored
Jan 24, 2022
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Avoid using Windows types where possible.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
dbfdcb13
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
368 additions
and
387 deletions
+368
-387
client.c
tools/widl/client.c
+1
-1
hash.c
tools/widl/hash.c
+5
-5
hash.h
tools/widl/hash.h
+5
-7
header.c
tools/widl/header.c
+7
-7
parser.l
tools/widl/parser.l
+2
-2
parser.y
tools/widl/parser.y
+3
-3
proxy.c
tools/widl/proxy.c
+3
-3
register.c
tools/widl/register.c
+9
-9
server.c
tools/widl/server.c
+1
-1
typegen.c
tools/widl/typegen.c
+1
-1
typelib.c
tools/widl/typelib.c
+1
-1
typelib_struct.h
tools/widl/typelib_struct.h
+269
-269
typetree.c
tools/widl/typetree.c
+9
-9
utils.h
tools/widl/utils.h
+1
-1
widl.c
tools/widl/widl.c
+4
-4
widltypes.h
tools/widl/widltypes.h
+10
-8
write_msft.c
tools/widl/write_msft.c
+37
-56
No files found.
tools/widl/client.c
View file @
a7f0e61e
...
...
@@ -437,7 +437,7 @@ static void write_stubdescriptor(type_t *iface, int expr_eval_routines)
static
void
write_clientinterfacedecl
(
type_t
*
iface
)
{
unsigned
int
ver
=
get_attrv
(
iface
->
attrs
,
ATTR_VERSION
);
const
UUID
*
uuid
=
get_attrp
(
iface
->
attrs
,
ATTR_UUID
);
const
uuid_t
*
uuid
=
get_attrp
(
iface
->
attrs
,
ATTR_UUID
);
const
str_list_t
*
endpoints
=
get_attrp
(
iface
->
attrs
,
ATTR_ENDPOINT
);
if
(
endpoints
)
write_endpoints
(
client
,
iface
->
name
,
endpoints
);
...
...
tools/widl/hash.c
View file @
a7f0e61e
...
...
@@ -503,10 +503,10 @@ static const unsigned char Lookup_224[128 * 3] = {
* skind and lcid, while the low word is based on a repeated string
* hash of skind/str.
*/
unsigned
int
lhash_val_of_name_sys
(
syskind_t
skind
,
LCID
lcid
,
LPCSTR
lpStr
)
unsigned
int
lhash_val_of_name_sys
(
syskind_t
skind
,
int
lcid
,
const
char
*
lpStr
)
{
ULONG
nOffset
,
nMask
=
skind
==
SYS_MAC
?
1
:
0
;
ULONG
nHiWord
,
nLoWord
=
0x0deadbee
;
unsigned
int
nOffset
,
nMask
=
skind
==
SYS_MAC
?
1
:
0
;
unsigned
int
nHiWord
,
nLoWord
=
0x0deadbee
;
const
unsigned
char
*
str
=
(
const
unsigned
char
*
)
lpStr
,
*
pnLookup
=
NULL
;
if
(
!
str
)
...
...
@@ -669,7 +669,7 @@ unsigned int lhash_val_of_name_sys( syskind_t skind, LCID lcid, LPCSTR lpStr)
/* Hash a single 512-bit block. This is the core of the algorithm. */
static
void
sha1_transform
(
struct
sha1_context
*
ctx
)
{
DWORD
a
,
b
,
c
,
d
,
e
,
*
block
=
(
DWORD
*
)
ctx
->
buffer
;
unsigned
int
a
,
b
,
c
,
d
,
e
,
*
block
=
(
unsigned
int
*
)
ctx
->
buffer
;
/* Copy ctx->state[] to working variables */
a
=
ctx
->
state
[
0
];
...
...
@@ -748,7 +748,7 @@ void sha1_update(struct sha1_context *ctx, const char *data, size_t data_size)
}
}
void
sha1_finalize
(
struct
sha1_context
*
ctx
,
DWORD
result
[
5
])
void
sha1_finalize
(
struct
sha1_context
*
ctx
,
unsigned
int
result
[
5
])
{
unsigned
int
*
count
,
length_hi
,
length_lo
,
i
;
size_t
pad_size
,
buffer_size
;
...
...
tools/widl/hash.h
View file @
a7f0e61e
...
...
@@ -22,19 +22,17 @@
#ifndef __WIDL_HASH_H
#define __WIDL_HASH_H
#include "windef.h"
extern
unsigned
int
lhash_val_of_name_sys
(
syskind_t
skind
,
LCID
lcid
,
LPCSTR
lpStr
);
extern
unsigned
int
lhash_val_of_name_sys
(
syskind_t
skind
,
int
lcid
,
const
char
*
lpStr
);
struct
sha1_context
{
DWORD
state
[
5
];
DWORD
count
[
2
];
char
buffer
[
64
];
unsigned
int
state
[
5
];
unsigned
int
count
[
2
];
char
buffer
[
64
];
};
void
sha1_init
(
struct
sha1_context
*
ctx
);
void
sha1_update
(
struct
sha1_context
*
ctx
,
const
char
*
data
,
size_t
data_size
);
void
sha1_finalize
(
struct
sha1_context
*
ctx
,
DWORD
hash
[
5
]);
void
sha1_finalize
(
struct
sha1_context
*
ctx
,
unsigned
int
hash
[
5
]);
#endif
tools/widl/header.c
View file @
a7f0e61e
...
...
@@ -141,7 +141,7 @@ static char *format_parameterized_type_args(const type_t *type, const char *pref
return
buf
;
}
static
void
write_guid
(
FILE
*
f
,
const
char
*
guid_prefix
,
const
char
*
name
,
const
UUID
*
uuid
)
static
void
write_guid
(
FILE
*
f
,
const
char
*
guid_prefix
,
const
char
*
name
,
const
uuid_t
*
uuid
)
{
if
(
!
uuid
)
return
;
fprintf
(
f
,
"DEFINE_GUID(%s_%s, 0x%08x, 0x%04x, 0x%04x, 0x%02x,0x%02x, 0x%02x,"
...
...
@@ -151,7 +151,7 @@ static void write_guid(FILE *f, const char *guid_prefix, const char *name, const
uuid
->
Data4
[
6
],
uuid
->
Data4
[
7
]);
}
static
void
write_uuid_decl
(
FILE
*
f
,
type_t
*
type
,
const
UUID
*
uuid
)
static
void
write_uuid_decl
(
FILE
*
f
,
type_t
*
type
,
const
uuid_t
*
uuid
)
{
fprintf
(
f
,
"#ifdef __CRT_UUID_DECL
\n
"
);
fprintf
(
f
,
"__CRT_UUID_DECL(%s, 0x%08x, 0x%04x, 0x%04x, 0x%02x,0x%02x, 0x%02x,"
...
...
@@ -162,7 +162,7 @@ static void write_uuid_decl(FILE *f, type_t *type, const UUID *uuid)
fprintf
(
f
,
"#endif
\n
"
);
}
static
const
char
*
uuid_string
(
const
UUID
*
uuid
)
static
const
char
*
uuid_string
(
const
uuid_t
*
uuid
)
{
static
char
buf
[
37
];
...
...
@@ -937,7 +937,7 @@ static void write_declaration(FILE *header, const var_t *v)
static
void
write_library
(
FILE
*
header
,
const
typelib_t
*
typelib
)
{
const
UUID
*
uuid
=
get_attrp
(
typelib
->
attrs
,
ATTR_UUID
);
const
uuid_t
*
uuid
=
get_attrp
(
typelib
->
attrs
,
ATTR_UUID
);
fprintf
(
header
,
"
\n
"
);
write_guid
(
header
,
"LIBID"
,
typelib
->
name
,
uuid
);
fprintf
(
header
,
"
\n
"
);
...
...
@@ -1680,7 +1680,7 @@ static void write_widl_using_method_macros(FILE *header, const type_t *iface, co
static
void
write_widl_using_macros
(
FILE
*
header
,
type_t
*
iface
)
{
const
UUID
*
uuid
=
get_attrp
(
iface
->
attrs
,
ATTR_UUID
);
const
uuid_t
*
uuid
=
get_attrp
(
iface
->
attrs
,
ATTR_UUID
);
const
char
*
name
=
iface
->
short_name
?
iface
->
short_name
:
iface
->
name
;
char
*
macro
;
...
...
@@ -1702,7 +1702,7 @@ static void write_widl_using_macros(FILE *header, type_t *iface)
static
void
write_com_interface_end
(
FILE
*
header
,
type_t
*
iface
)
{
int
dispinterface
=
is_attr
(
iface
->
attrs
,
ATTR_DISPINTERFACE
);
const
UUID
*
uuid
=
get_attrp
(
iface
->
attrs
,
ATTR_UUID
);
const
uuid_t
*
uuid
=
get_attrp
(
iface
->
attrs
,
ATTR_UUID
);
expr_t
*
contract
=
get_attrp
(
iface
->
attrs
,
ATTR_CONTRACT
);
type_t
*
type
;
...
...
@@ -1836,7 +1836,7 @@ static void write_rpc_interface_end(FILE *header, const type_t *iface)
static
void
write_coclass
(
FILE
*
header
,
type_t
*
cocl
)
{
const
UUID
*
uuid
=
get_attrp
(
cocl
->
attrs
,
ATTR_UUID
);
const
uuid_t
*
uuid
=
get_attrp
(
cocl
->
attrs
,
ATTR_UUID
);
fprintf
(
header
,
"/*****************************************************************************
\n
"
);
fprintf
(
header
,
" * %s coclass
\n
"
,
cocl
->
name
);
...
...
tools/widl/parser.l
View file @
a7f0e61e
...
...
@@ -96,9 +96,9 @@ static unsigned int xstrtoul(const char *nptr, char **endptr, int base)
return val;
}
UUID
*parse_uuid(const char *u)
uuid_t
*parse_uuid(const char *u)
{
UUID* uuid = xmalloc(sizeof(UUID
));
uuid_t* uuid = xmalloc(sizeof(*uuid
));
char b[3];
/* it would be nice to use UuidFromStringA */
uuid->Data1 = strtoul(u, NULL, 16);
...
...
tools/widl/parser.y
View file @
a7f0e61e
...
...
@@ -50,7 +50,7 @@ static decl_spec_t *make_decl_spec(type_t *type, decl_spec_t *left, decl_spec_t
enum storage_class stgclass, enum type_qualifier qual, enum function_specifier func_specifier);
static attr_t *make_attr(enum attr_type type);
static attr_t *make_attrv(enum attr_type type, unsigned int val);
static attr_t *make_custom_attr(
UUID
*id, expr_t *pval);
static attr_t *make_custom_attr(
uuid_t
*id, expr_t *pval);
static expr_list_t *append_expr(expr_list_t *list, expr_t *expr);
static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, declarator_t *decl, int top);
static var_list_t *set_var_types(attr_list_t *attrs, decl_spec_t *decl_spec, declarator_list_t *decls);
...
...
@@ -141,7 +141,7 @@ static typelib_t *current_typelib;
typeref_t *typeref;
typeref_list_t *typeref_list;
char *str;
UUID
*uuid;
uuid_t
*uuid;
unsigned int num;
double dbl;
typelib_t *typelib;
...
...
@@ -1523,7 +1523,7 @@ attr_t *make_attrp(enum attr_type type, void *val)
return a;
}
static attr_t *make_custom_attr(
UUID
*id, expr_t *pval)
static attr_t *make_custom_attr(
uuid_t
*id, expr_t *pval)
{
attr_t *a = xmalloc(sizeof(attr_t));
attr_custdata_t *cstdata = xmalloc(sizeof(attr_custdata_t));
...
...
tools/widl/proxy.c
View file @
a7f0e61e
...
...
@@ -847,9 +847,9 @@ static int cmp_iid( const void *ptr1, const void *ptr2 )
{
const
type_t
*
const
*
iface1
=
ptr1
;
const
type_t
*
const
*
iface2
=
ptr2
;
const
UUID
*
uuid1
=
get_attrp
(
(
*
iface1
)
->
attrs
,
ATTR_UUID
);
const
UUID
*
uuid2
=
get_attrp
(
(
*
iface2
)
->
attrs
,
ATTR_UUID
);
return
memcmp
(
uuid1
,
uuid2
,
sizeof
(
UUID
)
);
const
uuid_t
*
uuid1
=
get_attrp
(
(
*
iface1
)
->
attrs
,
ATTR_UUID
);
const
uuid_t
*
uuid2
=
get_attrp
(
(
*
iface2
)
->
attrs
,
ATTR_UUID
);
return
memcmp
(
uuid1
,
uuid2
,
sizeof
(
*
uuid1
)
);
}
static
void
build_iface_list
(
const
statement_list_t
*
stmts
,
type_t
**
ifaces
[],
int
*
count
)
...
...
tools/widl/register.c
View file @
a7f0e61e
...
...
@@ -34,7 +34,7 @@
static
int
indent
;
static
const
char
*
format_uuid
(
const
UUID
*
uuid
)
static
const
char
*
format_uuid
(
const
uuid_t
*
uuid
)
{
static
char
buffer
[
40
];
sprintf
(
buffer
,
"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}"
,
...
...
@@ -76,8 +76,8 @@ static const type_t *find_ps_factory( const statement_list_t *stmts )
static
void
write_interface
(
const
type_t
*
iface
,
const
type_t
*
ps_factory
)
{
const
UUID
*
uuid
=
get_attrp
(
iface
->
attrs
,
ATTR_UUID
);
const
UUID
*
ps_uuid
=
get_attrp
(
ps_factory
->
attrs
,
ATTR_UUID
);
const
uuid_t
*
uuid
=
get_attrp
(
iface
->
attrs
,
ATTR_UUID
);
const
uuid_t
*
ps_uuid
=
get_attrp
(
ps_factory
->
attrs
,
ATTR_UUID
);
if
(
!
uuid
)
return
;
if
(
!
is_object
(
iface
))
return
;
...
...
@@ -109,8 +109,8 @@ static void write_interfaces( const statement_list_t *stmts, const type_t *ps_fa
static
void
write_typelib_interface
(
const
type_t
*
iface
,
const
typelib_t
*
typelib
)
{
const
UUID
*
typelib_uuid
=
get_attrp
(
typelib
->
attrs
,
ATTR_UUID
);
const
UUID
*
uuid
=
get_attrp
(
iface
->
attrs
,
ATTR_UUID
);
const
uuid_t
*
typelib_uuid
=
get_attrp
(
typelib
->
attrs
,
ATTR_UUID
);
const
uuid_t
*
uuid
=
get_attrp
(
iface
->
attrs
,
ATTR_UUID
);
unsigned
int
version
=
get_attrv
(
typelib
->
attrs
,
ATTR_VERSION
);
if
(
!
uuid
)
return
;
...
...
@@ -139,7 +139,7 @@ static void write_typelib_interfaces( const typelib_t *typelib )
static
int
write_coclass
(
const
type_t
*
class
,
const
typelib_t
*
typelib
)
{
const
UUID
*
uuid
=
get_attrp
(
class
->
attrs
,
ATTR_UUID
);
const
uuid_t
*
uuid
=
get_attrp
(
class
->
attrs
,
ATTR_UUID
);
const
char
*
descr
=
get_attrp
(
class
->
attrs
,
ATTR_HELPSTRING
);
const
char
*
progid
=
get_attrp
(
class
->
attrs
,
ATTR_PROGID
);
const
char
*
vi_progid
=
get_attrp
(
class
->
attrs
,
ATTR_VIPROGID
);
...
...
@@ -157,7 +157,7 @@ static int write_coclass( const type_t *class, const typelib_t *typelib )
if
(
progid
)
put_str
(
indent
,
"ProgId = s '%s'
\n
"
,
progid
);
if
(
typelib
)
{
const
UUID
*
typelib_uuid
=
get_attrp
(
typelib
->
attrs
,
ATTR_UUID
);
const
uuid_t
*
typelib_uuid
=
get_attrp
(
typelib
->
attrs
,
ATTR_UUID
);
put_str
(
indent
,
"TypeLib = s '%s'
\n
"
,
format_uuid
(
typelib_uuid
));
if
(
!
version
)
version
=
get_attrv
(
typelib
->
attrs
,
ATTR_VERSION
);
}
...
...
@@ -200,7 +200,7 @@ static void write_runtimeclasses_registry( const statement_list_t *stmts )
static
int
write_progid
(
const
type_t
*
class
)
{
const
UUID
*
uuid
=
get_attrp
(
class
->
attrs
,
ATTR_UUID
);
const
uuid_t
*
uuid
=
get_attrp
(
class
->
attrs
,
ATTR_UUID
);
const
char
*
descr
=
get_attrp
(
class
->
attrs
,
ATTR_HELPSTRING
);
const
char
*
progid
=
get_attrp
(
class
->
attrs
,
ATTR_PROGID
);
const
char
*
vi_progid
=
get_attrp
(
class
->
attrs
,
ATTR_VIPROGID
);
...
...
@@ -324,7 +324,7 @@ void write_typelib_regscript( const statement_list_t *stmts )
void
output_typelib_regscript
(
const
typelib_t
*
typelib
)
{
const
UUID
*
typelib_uuid
=
get_attrp
(
typelib
->
attrs
,
ATTR_UUID
);
const
uuid_t
*
typelib_uuid
=
get_attrp
(
typelib
->
attrs
,
ATTR_UUID
);
const
char
*
descr
=
get_attrp
(
typelib
->
attrs
,
ATTR_HELPSTRING
);
const
expr_t
*
lcid_expr
=
get_attrp
(
typelib
->
attrs
,
ATTR_LIBLCID
);
unsigned
int
version
=
get_attrv
(
typelib
->
attrs
,
ATTR_VERSION
);
...
...
tools/widl/server.c
View file @
a7f0e61e
...
...
@@ -399,7 +399,7 @@ static void write_stubdescriptor(type_t *iface, int expr_eval_routines)
static
void
write_serverinterfacedecl
(
type_t
*
iface
)
{
unsigned
int
ver
=
get_attrv
(
iface
->
attrs
,
ATTR_VERSION
);
UUID
*
uuid
=
get_attrp
(
iface
->
attrs
,
ATTR_UUID
);
uuid_t
*
uuid
=
get_attrp
(
iface
->
attrs
,
ATTR_UUID
);
const
str_list_t
*
endpoints
=
get_attrp
(
iface
->
attrs
,
ATTR_ENDPOINT
);
if
(
endpoints
)
write_endpoints
(
server
,
iface
->
name
,
endpoints
);
...
...
tools/widl/typegen.c
View file @
a7f0e61e
...
...
@@ -3506,7 +3506,7 @@ static unsigned int write_ip_tfs(FILE *file, const attr_list_t *attrs, type_t *t
else
{
const
type_t
*
base
=
is_ptr
(
type
)
?
type_pointer_get_ref_type
(
type
)
:
type
;
const
UUID
*
uuid
=
get_attrp
(
base
->
attrs
,
ATTR_UUID
);
const
uuid_t
*
uuid
=
get_attrp
(
base
->
attrs
,
ATTR_UUID
);
if
(
!
uuid
)
error
(
"%s: interface %s missing UUID
\n
"
,
__FUNCTION__
,
base
->
name
);
...
...
tools/widl/typelib.c
View file @
a7f0e61e
...
...
@@ -239,7 +239,7 @@ unsigned short get_type_vt(type_t *t)
return
0
;
}
static
void
msft_read_guid
(
void
*
data
,
MSFT_SegDir
*
segdir
,
int
offset
,
GUID
*
guid
)
static
void
msft_read_guid
(
void
*
data
,
MSFT_SegDir
*
segdir
,
int
offset
,
uuid_t
*
guid
)
{
memcpy
(
guid
,
(
char
*
)
data
+
segdir
->
pGuidTab
.
offset
+
offset
,
sizeof
(
*
guid
)
);
}
...
...
tools/widl/typelib_struct.h
View file @
a7f0e61e
...
...
@@ -49,13 +49,13 @@
*
*/
typedef
struct
tagMSFT_Header
{
/*0x00*/
INT
magic1
;
/* 0x5446534D "MSFT" */
INT
magic2
;
/* 0x00010002 version nr? */
INT
posguid
;
/* position of libid in guid table */
/*0x00*/
int
magic1
;
/* 0x5446534D "MSFT" */
int
magic2
;
/* 0x00010002 version nr? */
int
posguid
;
/* position of libid in guid table */
/* (should be, else -1) */
INT
lcid
;
/* locale id */
/*0x10*/
INT
lcid2
;
INT
varflags
;
/* (largely) unknown flags */
int
lcid
;
/* locale id */
/*0x10*/
int
lcid2
;
int
varflags
;
/* (largely) unknown flags */
/* the lower nibble is syskind */
/* 0x40 always seems to be set */
/* 0x10 set with a helpfile defined */
...
...
@@ -63,30 +63,30 @@ typedef struct tagMSFT_Header {
case the offset to the name in the stringtable
appears right after this struct, before the
typeinfo offsets */
INT
version
;
/* set with SetVersion() */
INT
flags
;
/* set with SetFlags() */
/*0x20*/
INT
nrtypeinfos
;
/* number of typeinfo's (till so far) */
INT
helpstring
;
/* position of help string in stringtable */
INT
helpstringcontext
;
INT
helpcontext
;
/*0x30*/
INT
nametablecount
;
/* number of names in name table */
INT
nametablechars
;
/* nr of characters in name table */
INT
NameOffset
;
/* offset of name in name table */
INT
helpfile
;
/* position of helpfile in stringtable */
/*0x40*/
INT
CustomDataOffset
;
/* if -1 no custom data, else it is offset */
int
version
;
/* set with SetVersion() */
int
flags
;
/* set with SetFlags() */
/*0x20*/
int
nrtypeinfos
;
/* number of typeinfo's (till so far) */
int
helpstring
;
/* position of help string in stringtable */
int
helpstringcontext
;
int
helpcontext
;
/*0x30*/
int
nametablecount
;
/* number of names in name table */
int
nametablechars
;
/* nr of characters in name table */
int
NameOffset
;
/* offset of name in name table */
int
helpfile
;
/* position of helpfile in stringtable */
/*0x40*/
int
CustomDataOffset
;
/* if -1 no custom data, else it is offset */
/* in customer data/guid offset table */
INT
res44
;
/* unknown always: 0x20 (guid hash size?) */
INT
res48
;
/* unknown always: 0x80 (name hash size?) */
INT
dispatchpos
;
/* HREFTYPE to IDispatch, or -1 if no IDispatch */
/*0x50*/
INT
nimpinfos
;
/* number of impinfos */
int
res44
;
/* unknown always: 0x20 (guid hash size?) */
int
res48
;
/* unknown always: 0x80 (name hash size?) */
int
dispatchpos
;
/* HREFTYPE to IDispatch, or -1 if no IDispatch */
/*0x50*/
int
nimpinfos
;
/* number of impinfos */
}
MSFT_Header
;
/* segments in the type lib file have a structure like this: */
typedef
struct
tagMSFT_pSeg
{
INT
offset
;
/* absolute offset in file */
INT
length
;
/* length of segment */
INT
res08
;
/* unknown always -1 */
INT
res0c
;
/* unknown always 0x0f in the header */
int
offset
;
/* absolute offset in file */
int
length
;
/* length of segment */
int
res08
;
/* unknown always -1 */
int
res0c
;
/* unknown always 0x0f in the header */
/* 0x03 in the typeinfo_data */
}
MSFT_pSeg
;
...
...
@@ -118,60 +118,60 @@ typedef struct tagMSFT_SegDir {
/* base type info data */
typedef
struct
tagMSFT_TypeInfoBase
{
/*000*/
INT
typekind
;
/* it is the TKIND_xxx */
/*000*/
int
typekind
;
/* it is the TKIND_xxx */
/* some byte alignment stuff */
INT
memoffset
;
/* points past the file, if no elements */
INT
res2
;
/* zero if no element, N*0x40 */
INT
res3
;
/* -1 if no element, (N-1)*0x38 */
/*010*/
INT
res4
;
/* always? 3 */
INT
res5
;
/* always? zero */
INT
cElement
;
/* counts elements, HI=cVars, LO=cFuncs */
INT
res7
;
/* always? zero */
/*020*/
INT
res8
;
/* always? zero */
INT
res9
;
/* always? zero */
INT
resA
;
/* always? zero */
INT
posguid
;
/* position in guid table */
/*030*/
INT
flags
;
/* Typeflags */
INT
NameOffset
;
/* offset in name table */
INT
version
;
/* element version */
INT
docstringoffs
;
/* offset of docstring in string tab */
/*040*/
INT
helpstringcontext
;
/* */
INT
helpcontext
;
/* */
INT
oCustData
;
/* offset in customer data table */
INT16
cImplTypes
;
/* nr of implemented interfaces */
INT16
cbSizeVft
;
/* virtual table size, including inherits */
/*050*/
INT
size
;
/* size in bytes, at least for structures */
int
memoffset
;
/* points past the file, if no elements */
int
res2
;
/* zero if no element, N*0x40 */
int
res3
;
/* -1 if no element, (N-1)*0x38 */
/*010*/
int
res4
;
/* always? 3 */
int
res5
;
/* always? zero */
int
cElement
;
/* counts elements, HI=cVars, LO=cFuncs */
int
res7
;
/* always? zero */
/*020*/
int
res8
;
/* always? zero */
int
res9
;
/* always? zero */
int
resA
;
/* always? zero */
int
posguid
;
/* position in guid table */
/*030*/
int
flags
;
/* Typeflags */
int
NameOffset
;
/* offset in name table */
int
version
;
/* element version */
int
docstringoffs
;
/* offset of docstring in string tab */
/*040*/
int
helpstringcontext
;
/* */
int
helpcontext
;
/* */
int
oCustData
;
/* offset in customer data table */
short
cImplTypes
;
/* nr of implemented interfaces */
short
cbSizeVft
;
/* virtual table size, including inherits */
/*050*/
int
size
;
/* size in bytes, at least for structures */
/* FIXME: name of this field */
INT
datatype1
;
/* position in type description table */
int
datatype1
;
/* position in type description table */
/* or in base interfaces */
/* if coclass: offset in reftable */
/* if interface: reference to inherited if */
INT
datatype2
;
/* for interfaces: hiword is num of inherited funcs */
int
datatype2
;
/* for interfaces: hiword is num of inherited funcs */
/* loword is num of inherited interfaces */
INT
res18
;
/* always? 0 */
/*060*/
INT
res19
;
/* always? -1 */
int
res18
;
/* always? 0 */
/*060*/
int
res19
;
/* always? -1 */
}
MSFT_TypeInfoBase
;
/* layout of an entry with information on imported types */
typedef
struct
tagMSFT_ImpInfo
{
INT
flags
;
/* bits 0 - 15: count */
int
flags
;
/* bits 0 - 15: count */
/* bit 16: if set oGuid is an offset to Guid */
/* if clear oGuid is a typeinfo index in the specified typelib */
/* bits 24 - 31: TKIND of reference */
INT
oImpFile
;
/* offset in the Import File table */
INT
oGuid
;
/* offset in Guid table or typeinfo index (see bit 16 of flags) */
int
oImpFile
;
/* offset in the Import File table */
int
oGuid
;
/* offset in Guid table or typeinfo index (see bit 16 of flags) */
}
MSFT_ImpInfo
;
#define MSFT_IMPINFO_OFFSET_IS_GUID 0x00010000
/* function description data */
typedef
struct
{
/*
INT
recsize; record size including some extra stuff */
INT
DataType
;
/* data type of the member, eg return of function */
INT
Flags
;
/* something to do with attribute flags (LOWORD) */
INT16
VtableOffset
;
/* offset in vtable */
INT16
funcdescsize
;
/* size of reconstituted FUNCDESC and related structs */
INT
FKCCIC
;
/* bit string with the following */
/*
int
recsize; record size including some extra stuff */
int
DataType
;
/* data type of the member, eg return of function */
int
Flags
;
/* something to do with attribute flags (LOWORD) */
short
VtableOffset
;
/* offset in vtable */
short
funcdescsize
;
/* size of reconstituted FUNCDESC and related structs */
int
FKCCIC
;
/* bit string with the following */
/* meaning (bit 0 is the lsb): */
/* bits 0 - 2: FUNCKIND */
/* bits 3 - 6: INVOKEKIND */
...
...
@@ -181,86 +181,86 @@ typedef struct {
/* bit 13: oEntry is numeric */
/* bit 14: has retval param */
/* bits 16 - 31: index of next function with same id */
INT16
nrargs
;
/* number of arguments (including optional ????) */
INT16
nroargs
;
/* nr of optional arguments */
short
nrargs
;
/* number of arguments (including optional ????) */
short
nroargs
;
/* nr of optional arguments */
/* optional attribute fields, the number of them is variable */
INT
OptAttr
[
1
];
int
OptAttr
[
1
];
/*
0*
INT
helpcontext;
1*
INT
oHelpString;
2*
INT
oEntry; // either offset in string table or numeric as it is (see bit 13 of FKCCIC) //
3*
INT
res9; // unknown (-1) //
4*
INT
resA; // unknown (-1) //
5*
INT
HelpStringContext;
0*
int
helpcontext;
1*
int
oHelpString;
2*
int
oEntry; // either offset in string table or numeric as it is (see bit 13 of FKCCIC) //
3*
int
res9; // unknown (-1) //
4*
int
resA; // unknown (-1) //
5*
int
HelpStringContext;
// these are controlled by a bit set in the FKCCIC field //
6*
INT
oCustData; // custom data for function //
7*
INT
oArgCustData[1]; // custom data per argument //
6*
int
oCustData; // custom data for function //
7*
int
oArgCustData[1]; // custom data per argument //
*/
}
MSFT_FuncRecord
;
/* after this may follow an array with default value pointers if the
* appropriate bit in the FKCCIC field has been set:
*
INT
oDefaultValue[nrargs];
*
int
oDefaultValue[nrargs];
*/
/* Parameter info one per argument*/
typedef
struct
{
INT
DataType
;
INT
oName
;
INT
Flags
;
int
DataType
;
int
oName
;
int
Flags
;
}
MSFT_ParameterInfo
;
/* Variable description data */
typedef
struct
{
/*
INT
recsize; // record size including some extra stuff */
INT
DataType
;
/* data type of the variable */
INT
Flags
;
/* VarFlags (LOWORD) */
INT16
VarKind
;
/* VarKind */
INT16
vardescsize
;
/* size of reconstituted VARDESC and related structs */
INT
OffsValue
;
/* value of the variable or the offset */
/*
int
recsize; // record size including some extra stuff */
int
DataType
;
/* data type of the variable */
int
Flags
;
/* VarFlags (LOWORD) */
short
VarKind
;
/* VarKind */
short
vardescsize
;
/* size of reconstituted VARDESC and related structs */
int
OffsValue
;
/* value of the variable or the offset */
/* in the data structure */
/* optional attribute fields, the number of them is variable */
/* controlled by record length */
INT
HelpContext
;
INT
oHelpString
;
INT
res9
;
/* unknown (-1) */
INT
oCustData
;
/* custom data for variable */
INT
HelpStringContext
;
int
HelpContext
;
int
oHelpString
;
int
res9
;
/* unknown (-1) */
int
oCustData
;
/* custom data for variable */
int
HelpStringContext
;
}
MSFT_VarRecord
;
/* Structure of the reference data */
typedef
struct
{
INT
reftype
;
/* either offset in type info table, then it's */
int
reftype
;
/* either offset in type info table, then it's */
/* a multiple of 64 */
/* or offset in the external reference table */
/* with an offset of 1 */
INT
flags
;
INT
oCustData
;
/* custom data */
INT
onext
;
/* next offset, -1 if last */
int
flags
;
int
oCustData
;
/* custom data */
int
onext
;
/* next offset, -1 if last */
}
MSFT_RefRecord
;
/* this is how a guid is stored */
typedef
struct
{
GUID
guid
;
INT
hreftype
;
/* -2 for the typelib guid, typeinfo offset
uuid_t
guid
;
int
hreftype
;
/* -2 for the typelib guid, typeinfo offset
for typeinfo guid, low two bits are 01 if
this is an imported typeinfo, low two bits
are 10 if this is an imported typelib (used
by imported typeinfos) */
INT
next_hash
;
/* offset to next guid in the hash bucket */
int
next_hash
;
/* offset to next guid in the hash bucket */
}
MSFT_GuidEntry
;
/* some data preceding entries in the name table */
typedef
struct
{
INT
hreftype
;
/* is -1 if name is for neither a typeinfo,
int
hreftype
;
/* is -1 if name is for neither a typeinfo,
a variable, or a function (that is, name
is for a typelib or a function parameter).
otherwise is the offset of the first
typeinfo that this name refers to (either
to the typeinfo itself or to a member of
the typeinfo */
INT
next_hash
;
/* offset to next name in the hash bucket */
INT
namelen
;
/* only lower 8 bits are valid */
int
next_hash
;
/* offset to next name in the hash bucket */
int
namelen
;
/* only lower 8 bits are valid */
/* 0x1000 if name is only used once as a variable name */
/* 0x2000 if name is a variable in an enumeration */
/* 0x3800 if name is typeinfo name */
...
...
@@ -268,9 +268,9 @@ typedef struct {
}
MSFT_NameIntro
;
/* the custom data table directory has entries like this */
typedef
struct
{
INT
GuidOffset
;
INT
DataOffset
;
INT
next
;
/* next offset in the table, -1 if it's the last */
int
GuidOffset
;
int
DataOffset
;
int
next
;
/* next offset in the table, -1 if it's the last */
}
MSFT_CDGuid
;
...
...
@@ -285,25 +285,25 @@ typedef struct {
#include "pshpack1.h"
typedef
struct
{
/*00*/
DWORD
SLTG_magic
;
/* 0x47544c53 == "SLTG" */
/*04*/
WORD
nrOfFileBlks
;
/* no of SLTG_BlkEntry's + 1 */
/*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 */
/*00*/
unsigned
int
SLTG_magic
;
/* 0x47544c53 == "SLTG" */
/*04*/
unsigned
short
nrOfFileBlks
;
/* no of SLTG_BlkEntry's + 1 */
/*06*/
unsigned
short
res06
;
/* ?? always 9 */
/*08*/
unsigned
short
res08
;
/* some kind of len/offset ?? */
/*0a*/
unsigned
short
first_blk
;
/* 1 based index into blk entries that
corresponds to first block in file */
/*0c*/
unsigned
int
res0c
;
/* always 0x000204ff */
/*10*/
unsigned
int
res10
;
/* always 0x00000000 */
/*14*/
unsigned
int
res14
;
/* always 0x000000c0 */
/*18*/
unsigned
int
res18
;
/* always 0x46000000 */
/*1c*/
unsigned
int
res1c
;
/* always 0x00000044 */
/*20*/
unsigned
int
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
;
/*00*/
unsigned
int
len
;
/*04*/
unsigned
short
index_string
;
/* offs from start of SLTG_Magic to index string */
/*06*/
unsigned
short
next
;
}
SLTG_BlkEntry
;
/* The order of the blocks in the file is given by starting at Block
...
...
@@ -311,9 +311,9 @@ typedef struct {
/* 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" */
/*00*/
unsigned
char
res00
;
/* always 0x01 */
/*01*/
char
CompObj_magic
[
8
];
/* always "CompObj" */
/*09*/
char
dir_magic
[
4
];
/* always "dir" */
}
SLTG_Magic
;
#define SLTG_COMPOBJ_MAGIC "CompObj"
...
...
@@ -326,13 +326,13 @@ uniqueness. I guess successive chars increment when we need to wrap
the first one. */
typedef
struct
{
/*00*/
CHAR
string
[
11
];
/*00*/
char
string
[
11
];
}
SLTG_Index
;
/* This is followed by SLTG_pad9 */
typedef
struct
{
/*00*/
CHAR
pad
[
9
];
/* 9 '\0's */
/*00*/
char
pad
[
9
];
/* 9 '\0's */
}
SLTG_Pad9
;
...
...
@@ -342,25 +342,25 @@ 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
;
typedef
unsigned
short
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
;
/*00*/
unsigned
short
magic
;
/* 0x51cc */
/*02*/
unsigned
short
res02
;
/* 0x0003, 0x0004 */
/*04*/
unsigned
short
name
;
/* offset to name in name table */
/*06*/
SLTG_Name
res06
;
/* maybe this is just WORD == 0xffff */
SLTG_Name
helpstring
;
SLTG_Name
helpfile
;
unsigned
int
helpcontext
;
unsigned
short
syskind
;
/* == 1 for win32, 0 for win16 */
unsigned
short
lcid
;
/* == 0x409, 0x809 etc */
unsigned
int
res12
;
/* == 0 */
unsigned
short
libflags
;
/* LIBFLAG_* */
unsigned
short
maj_vers
;
unsigned
short
min_vers
;
uuid_t
uuid
;
}
SLTG_LibBlk
;
#define SLTG_LIBBLK_MAGIC 0x51cc
...
...
@@ -368,18 +368,18 @@ typedef struct {
/* 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
;
unsigned
short
small_no
;
SLTG_Name
index_name
;
/* This refers to a name in the directory */
SLTG_Name
other_name
;
/* Another one of these weird names */
unsigned
short
res1a
;
/* 0xffff */
unsigned
short
name_offs
;
/* offset to name in name table */
unsigned
short
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 ? */
unsigned
short
res20
;
/* 0xffff */
unsigned
int
helpcontext
;
unsigned
short
res26
;
/* 0xffff */
uuid_t
uuid
;
}
SLTG_OtherTypeInfo
;
/* Next we get WORD 0x0003 followed by a DWORD which if we add to
...
...
@@ -387,104 +387,104 @@ typedef struct {
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 */
/*00*/
unsigned
short
magic
;
/* 0x0501 */
/*02*/
unsigned
int
href_table
;
/* if not 0xffffffff, then byte offset from
beginning of struct to href table */
/*06*/
unsigned
int
res06
;
/* 0xffffffff */
/*0a*/
unsigned
int
elem_table
;
/* offset to members */
/*0e*/
unsigned
int
res0e
;
/* 0xffffffff */
/*12*/
unsigned
short
major_version
;
/* major version number */
/*14*/
unsigned
short
minor_version
;
/* minor version number */
/*16*/
unsigned
int
res16
;
/* 0xfffe0000 */
/*1a*/
unsigned
char
typeflags1
;
/* 0x02 | top 5 bits hold l5sbs of TYPEFLAGS */
/*1b*/
unsigned
char
typeflags2
;
/* TYPEFLAGS >> 5 */
/*1c*/
unsigned
char
typeflags3
;
/* 0x02*/
/*1d*/
unsigned
char
typekind
;
/* 0x03 == TKIND_INTERFACE etc. */
/*1e*/
unsigned
int
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
;
/*08*/
WORD
res08
;
/*0a*/
WORD
res0a
;
/*0c*/
WORD
res0c
;
/*0e*/
WORD
res0e
;
/*10*/
WORD
res10
;
/*12*/
WORD
res12
;
/*14*/
WORD
tdescalias_vt
;
/* for TKIND_ALIAS */
/*16*/
WORD
res16
;
/*18*/
WORD
res18
;
/*1a*/
WORD
res1a
;
/*1c*/
WORD
res1c
;
/*1e*/
WORD
res1e
;
/*20*/
WORD
cbSizeInstance
;
/*22*/
WORD
cbAlignment
;
/*24*/
WORD
res24
;
/*26*/
WORD
res26
;
/*28*/
WORD
cbSizeVft
;
/*2a*/
WORD
res2a
;
/*2c*/
WORD
res2c
;
/*2e*/
WORD
res2e
;
/*30*/
WORD
res30
;
/*32*/
WORD
res32
;
/*34*/
WORD
res34
;
/*00*/
unsigned
short
cFuncs
;
/*02*/
unsigned
short
cVars
;
/*04*/
unsigned
short
cImplTypes
;
/*06*/
unsigned
short
res06
;
/*08*/
unsigned
short
res08
;
/*0a*/
unsigned
short
res0a
;
/*0c*/
unsigned
short
res0c
;
/*0e*/
unsigned
short
res0e
;
/*10*/
unsigned
short
res10
;
/*12*/
unsigned
short
res12
;
/*14*/
unsigned
short
tdescalias_vt
;
/* for TKIND_ALIAS */
/*16*/
unsigned
short
res16
;
/*18*/
unsigned
short
res18
;
/*1a*/
unsigned
short
res1a
;
/*1c*/
unsigned
short
res1c
;
/*1e*/
unsigned
short
res1e
;
/*20*/
unsigned
short
cbSizeInstance
;
/*22*/
unsigned
short
cbAlignment
;
/*24*/
unsigned
short
res24
;
/*26*/
unsigned
short
res26
;
/*28*/
unsigned
short
cbSizeVft
;
/*2a*/
unsigned
short
res2a
;
/*2c*/
unsigned
short
res2c
;
/*2e*/
unsigned
short
res2e
;
/*30*/
unsigned
short
res30
;
/*32*/
unsigned
short
res32
;
/*34*/
unsigned
short
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 */
/*00*/
unsigned
short
res00
;
/* 0x0001 sometimes 0x0003 ?? */
/*02*/
unsigned
short
res02
;
/* 0xffff */
/*04*/
unsigned
char
res04
;
/* 0x01 */
/*05*/
unsigned
int
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 */
/*00*/
unsigned
short
magic
;
/* 0x120a */
/*02*/
unsigned
short
next
;
/* offset in bytes to next block from start of block
group, 0xffff if last item */
/*04*/
unsigned
short
name
;
/* offset to name within name table */
/*06*/
unsigned
short
value
;
/* offset to value from start of block group */
/*08*/
unsigned
short
res08
;
/* 0x56 */
/*0a*/
unsigned
int
memid
;
/* memid */
/*0e*/
unsigned
short
helpcontext
;
/* 0xfffe == no context, 0x0001 == stored in EnumInfo struct, else offset
to value from start of block group */
/*10*/
unsigned
short
helpstring
;
/* offset from start of block group to string offset */
}
SLTG_EnumItem
;
#define SLTG_ENUMITEM_MAGIC 0x120a
typedef
struct
{
/*00*/
WORD
vt
;
/* vartype, 0xffff marks end. */
/*02*/
WORD
res02
;
/* ?, 0xffff marks end */
/*00*/
unsigned
short
vt
;
/* vartype, 0xffff marks end. */
/*02*/
unsigned
short
res02
;
/* ?, 0xffff marks end */
}
SLTG_AliasItem
;
#define SLTG_ALIASITEM_MAGIC 0x001d
typedef
struct
{
BYTE
magic
;
/* 0x4c or 0x6c */
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
unsigned
char
magic
;
/* 0x4c or 0x6c */
unsigned
char
inv
;
/* high nibble is INVOKE_KIND, low nibble = 2 */
unsigned
short
next
;
/* byte offset from beginning of group to next fn */
unsigned
short
name
;
/* Offset within name table to name */
unsigned
int
dispid
;
/* dispid */
unsigned
short
helpcontext
;
/* helpcontext (again 1 is special) */
unsigned
short
helpstring
;
/* helpstring offset to offset */
unsigned
short
arg_off
;
/* offset to args from start of block */
unsigned
char
nacc
;
/* lowest 3bits are CALLCONV, rest are no of args */
unsigned
char
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 == 0x6c */
unsigned
short
rettype
;
/* return type VT_?? or offset to ret type */
unsigned
short
vtblpos
;
/* position in vtbl? */
unsigned
short
funcflags
;
/* present if magic == 0x6c */
/* Param list starts, repeat next two as required */
#if 0
WORD
name; /* offset to 2nd letter of name */
WORD
+ type; /* VT_ of param */
unsigned short
name; /* offset to 2nd letter of name */
unsigned short
+ type; /* VT_ of param */
#endif
}
SLTG_Function
;
...
...
@@ -492,32 +492,32 @@ typedef struct {
#define SLTG_FUNCTION_WITH_FLAGS_MAGIC 0x6c
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 */
/*00*/
unsigned
char
magic
;
/* 0xdf */
/*01*/
unsigned
char
res01
;
/* 0x00 */
/*02*/
unsigned
int
res02
;
/* 0xffffffff */
/*06*/
unsigned
int
res06
;
/* 0xffffffff */
/*0a*/
unsigned
int
res0a
;
/* 0xffffffff */
/*0e*/
unsigned
int
res0e
;
/* 0xffffffff */
/*12*/
unsigned
int
res12
;
/* 0xffffffff */
/*16*/
unsigned
int
res16
;
/* 0xffffffff */
/*1a*/
unsigned
int
res1a
;
/* 0xffffffff */
/*1e*/
unsigned
int
res1e
;
/* 0xffffffff */
/*22*/
unsigned
int
res22
;
/* 0xffffffff */
/*26*/
unsigned
int
res26
;
/* 0xffffffff */
/*2a*/
unsigned
int
res2a
;
/* 0xffffffff */
/*2e*/
unsigned
int
res2e
;
/* 0xffffffff */
/*32*/
unsigned
int
res32
;
/* 0xffffffff */
/*36*/
unsigned
int
res36
;
/* 0xffffffff */
/*3a*/
unsigned
int
res3a
;
/* 0xffffffff */
/*3e*/
unsigned
int
res3e
;
/* 0xffffffff */
/*42*/
unsigned
short
res42
;
/* 0xffff */
/*44*/
unsigned
int
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
];
/*50*/
unsigned
short
res50
;
/* 0xffff */
/*52*/
unsigned
char
res52
;
/* 0x01 */
/*53*/
unsigned
int
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
...
...
@@ -527,47 +527,47 @@ typedef struct {
* the imported typelib.
*/
/*xx*/
BYTE
resxx
;
/* 0xdf */
/*xx*/
unsigned
char
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 ?? */
unsigned
short
res00
;
/* 0x0001 */
unsigned
char
res02
;
/* 0x02 */
unsigned
char
res03
;
/* 0x40 if internal ref, 0x00 if external ? */
unsigned
short
res04
;
/* 0xffff */
unsigned
short
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, ? */
unsigned
short
res00
;
/* 0x004a */
unsigned
short
next
;
/* byte offs to next interface */
unsigned
short
res04
;
/* 0xffff */
unsigned
char
impltypeflags
;
/* IMPLTYPEFLAG_* */
unsigned
char
res07
;
/* 0x80 */
unsigned
short
res08
;
/* 0x0012, 0x0028 ?? */
unsigned
short
ref
;
/* number in ref table ? */
unsigned
short
res0c
;
/* 0x4000 */
unsigned
short
res0e
;
/* 0xfffe */
unsigned
short
res10
;
/* 0xffff */
unsigned
short
res12
;
/* 0x001d */
unsigned
short
pos_in_table
;
/* 0x0, 0x4, ? */
}
SLTG_ImplInfo
;
#define SLTG_IMPL_MAGIC 0x004a
typedef
struct
{
BYTE
magic
;
/* 0x0a */
BYTE
typepos
;
WORD
next
;
WORD
name
;
WORD
byte_offs
;
/* pos in struct */
WORD
type
;
/* if typepos == 0x02 this is the type, else offset to type */
DWORD
memid
;
WORD
helpcontext
;
/* ?? */
WORD
helpstring
;
/* ?? */
unsigned
char
magic
;
/* 0x0a */
unsigned
char
typepos
;
unsigned
short
next
;
unsigned
short
name
;
unsigned
short
byte_offs
;
/* pos in struct */
unsigned
short
type
;
/* if typepos == 0x02 this is the type, else offset to type */
unsigned
int
memid
;
unsigned
short
helpcontext
;
/* ?? */
unsigned
short
helpstring
;
/* ?? */
}
SLTG_RecordItem
;
#define SLTG_RECORD_MAGIC 0x0a
...
...
tools/widl/typetree.c
View file @
a7f0e61e
...
...
@@ -160,7 +160,7 @@ static size_t append_var_list_signature(char **buf, size_t *len, size_t pos, var
static
size_t
append_type_signature
(
char
**
buf
,
size_t
*
len
,
size_t
pos
,
type_t
*
type
)
{
const
GUID
*
uuid
;
const
uuid_t
*
uuid
;
size_t
n
=
0
;
if
(
!
type
)
return
0
;
...
...
@@ -329,7 +329,7 @@ static char *format_parameterized_type_signature(type_t *type, typeref_list_t *p
size_t
len
=
0
,
pos
=
0
;
char
*
buf
=
NULL
;
typeref_t
*
ref
;
const
GUID
*
uuid
;
const
uuid_t
*
uuid
;
if
(
!
(
uuid
=
get_attrp
(
type
->
attrs
,
ATTR_UUID
)))
error_loc_info
(
&
type
->
loc_info
,
"cannot compute type signature, no uuid found for type %s.
\n
"
,
type
->
name
);
...
...
@@ -1237,18 +1237,18 @@ static void compute_interface_signature_uuid(type_t *iface)
static
const
int
version
=
5
;
struct
sha1_context
ctx
;
unsigned
char
hash
[
20
];
GUID
*
uuid
;
uuid_t
*
uuid
;
if
(
!
(
uuid
=
get_attrp
(
iface
->
attrs
,
ATTR_UUID
)))
{
uuid
=
xmalloc
(
sizeof
(
GUID
));
uuid
=
xmalloc
(
sizeof
(
*
uuid
));
iface
->
attrs
=
append_attr
(
iface
->
attrs
,
make_attrp
(
ATTR_UUID
,
uuid
));
}
sha1_init
(
&
ctx
);
sha1_update
(
&
ctx
,
winrt_pinterface_namespace
,
sizeof
(
winrt_pinterface_namespace
));
sha1_update
(
&
ctx
,
iface
->
signature
,
strlen
(
iface
->
signature
));
sha1_finalize
(
&
ctx
,
(
ULONG
*
)
hash
);
sha1_finalize
(
&
ctx
,
(
unsigned
int
*
)
hash
);
/* https://tools.ietf.org/html/rfc4122:
...
...
@@ -1263,10 +1263,10 @@ static void compute_interface_signature_uuid(type_t *iface)
hash
[
6
]
=
((
hash
[
6
]
&
0x0f
)
|
(
version
<<
4
));
hash
[
8
]
=
((
hash
[
8
]
&
0x3f
)
|
0x80
);
uuid
->
Data1
=
((
DWORD
)
hash
[
0
]
<<
24
)
|
((
DWORD
)
hash
[
1
]
<<
16
)
|
((
DWORD
)
hash
[
2
]
<<
8
)
|
(
DWORD
)
hash
[
3
];
uuid
->
Data2
=
((
WORD
)
hash
[
4
]
<<
8
)
|
(
WORD
)
hash
[
5
];
uuid
->
Data3
=
((
WORD
)
hash
[
6
]
<<
8
)
|
(
WORD
)
hash
[
7
];
memcpy
(
&
uuid
->
Data4
,
hash
+
8
,
sizeof
(
*
uuid
)
-
offsetof
(
GUID
,
Data4
));
uuid
->
Data1
=
((
unsigned
int
)
hash
[
0
]
<<
24
)
|
((
unsigned
int
)
hash
[
1
]
<<
16
)
|
((
unsigned
int
)
hash
[
2
]
<<
8
)
|
hash
[
3
];
uuid
->
Data2
=
((
unsigned
short
)
hash
[
4
]
<<
8
)
|
hash
[
5
];
uuid
->
Data3
=
((
unsigned
short
)
hash
[
6
]
<<
8
)
|
hash
[
7
];
memcpy
(
&
uuid
->
Data4
,
hash
+
8
,
sizeof
(
*
uuid
)
-
offsetof
(
uuid_t
,
Data4
));
}
type_t
*
type_parameterized_type_specialize_define
(
type_t
*
type
)
...
...
tools/widl/utils.h
View file @
a7f0e61e
...
...
@@ -35,7 +35,7 @@ size_t strappend(char **buf, size_t *len, size_t pos, const char* fmt, ...) __at
size_t
widl_getline
(
char
**
linep
,
size_t
*
lenp
,
FILE
*
fp
);
UUID
*
parse_uuid
(
const
char
*
u
);
uuid_t
*
parse_uuid
(
const
char
*
u
);
int
is_valid_uuid
(
const
char
*
s
);
/* buffer management */
...
...
tools/widl/widl.c
View file @
a7f0e61e
...
...
@@ -382,7 +382,7 @@ void write_dlldata(const statement_list_t *stmts)
write_dlldata_list
(
filenames
,
define_proxy_delegation
);
}
static
void
write_id_guid
(
FILE
*
f
,
const
char
*
type
,
const
char
*
guid_prefix
,
const
char
*
name
,
const
UUID
*
uuid
)
static
void
write_id_guid
(
FILE
*
f
,
const
char
*
type
,
const
char
*
guid_prefix
,
const
char
*
name
,
const
uuid_t
*
uuid
)
{
if
(
!
uuid
)
return
;
fprintf
(
f
,
"MIDL_DEFINE_GUID(%s, %s_%s, 0x%08x, 0x%04x, 0x%04x, 0x%02x,0x%02x, 0x%02x,"
...
...
@@ -402,7 +402,7 @@ static void write_id_data_stmts(const statement_list_t *stmts)
const
type_t
*
type
=
stmt
->
u
.
type
;
if
(
type_get_type
(
type
)
==
TYPE_INTERFACE
)
{
const
UUID
*
uuid
;
const
uuid_t
*
uuid
;
if
(
!
is_object
(
type
)
&&
!
is_attr
(
type
->
attrs
,
ATTR_DISPINTERFACE
))
continue
;
uuid
=
get_attrp
(
type
->
attrs
,
ATTR_UUID
);
...
...
@@ -416,13 +416,13 @@ static void write_id_data_stmts(const statement_list_t *stmts)
}
else
if
(
type_get_type
(
type
)
==
TYPE_COCLASS
)
{
const
UUID
*
uuid
=
get_attrp
(
type
->
attrs
,
ATTR_UUID
);
const
uuid_t
*
uuid
=
get_attrp
(
type
->
attrs
,
ATTR_UUID
);
write_id_guid
(
idfile
,
"CLSID"
,
"CLSID"
,
type
->
name
,
uuid
);
}
}
else
if
(
stmt
->
type
==
STMT_LIBRARY
)
{
const
UUID
*
uuid
=
get_attrp
(
stmt
->
u
.
lib
->
attrs
,
ATTR_UUID
);
const
uuid_t
*
uuid
=
get_attrp
(
stmt
->
u
.
lib
->
attrs
,
ATTR_UUID
);
write_id_guid
(
idfile
,
"IID"
,
"LIBID"
,
stmt
->
u
.
lib
->
name
,
uuid
);
write_id_data_stmts
(
stmt
->
u
.
lib
->
stmts
);
}
...
...
tools/widl/widltypes.h
View file @
a7f0e61e
...
...
@@ -23,14 +23,16 @@
#include <stdarg.h>
#include <assert.h>
#include "guiddef.h"
#include "ndrtypes.h"
#include "wine/list.h"
#ifndef UUID_DEFINED
#define UUID_DEFINED
typedef
GUID
UUID
;
#endif
typedef
struct
{
unsigned
int
Data1
;
unsigned
short
Data2
;
unsigned
short
Data3
;
unsigned
char
Data4
[
8
];
}
uuid_t
;
#define TRUE 1
#define FALSE 0
...
...
@@ -357,7 +359,7 @@ struct _expr_t {
};
struct
_attr_custdata_t
{
GUID
id
;
uuid_t
id
;
expr_t
*
pval
;
};
...
...
@@ -562,7 +564,7 @@ struct _typelib_entry_t {
struct
_importinfo_t
{
int
offset
;
GUID
guid
;
uuid_t
guid
;
int
flags
;
int
id
;
...
...
@@ -576,7 +578,7 @@ struct _importlib_t {
char
*
name
;
int
version
;
GUID
guid
;
uuid_t
guid
;
importinfo_t
*
importinfos
;
int
ntypeinfos
;
...
...
tools/widl/write_msft.c
View file @
a7f0e61e
...
...
@@ -39,10 +39,6 @@
#define NONAMELESSUNION
#include "widl.h"
#include "winerror.h"
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "typelib.h"
#include "typelib_struct.h"
#include "utils.h"
...
...
@@ -73,7 +69,7 @@ enum MSFT_segment_index {
typedef
struct
tagMSFT_ImpFile
{
int
guid
;
LCID
lcid
;
int
lcid
;
int
version
;
char
filename
[
0
];
/* preceded by two bytes of encoded (length << 2) + flags in the low two bits. */
}
MSFT_ImpFile
;
...
...
@@ -86,12 +82,12 @@ typedef struct _msft_typelib_t
unsigned
char
*
typelib_segment_data
[
MSFT_SEG_MAX
];
int
typelib_segment_block_length
[
MSFT_SEG_MAX
];
INT
typelib_typeinfo_offsets
[
0x200
];
/* Hope that's enough. */
int
typelib_typeinfo_offsets
[
0x200
];
/* Hope that's enough. */
INT
*
typelib_namehash_segment
;
INT
*
typelib_guidhash_segment
;
int
*
typelib_namehash_segment
;
int
*
typelib_guidhash_segment
;
INT
help_string_dll_offset
;
int
help_string_dll_offset
;
struct
_msft_typeinfo_t
*
typeinfos
;
struct
_msft_typeinfo_t
*
last_typeinfo
;
...
...
@@ -190,8 +186,7 @@ static void ctl2_init_segdir(
*
* The hash key for the GUID.
*/
static
int
ctl2_hash_guid
(
REFGUID
guid
)
/* [I] The guid to hash. */
static
int
ctl2_hash_guid
(
const
uuid_t
*
guid
)
{
int
hash
;
int
i
;
...
...
@@ -216,7 +211,7 @@ static int ctl2_hash_guid(
static
int
ctl2_find_guid
(
msft_typelib_t
*
typelib
,
/* [I] The typelib to operate against. */
int
hash_key
,
/* [I] The hash key for the guid. */
REFGUID
guid
)
/* [I] The guid to find. */
const
uuid_t
*
guid
)
/* [I] The guid to find. */
{
int
offset
;
MSFT_GuidEntry
*
guidentry
;
...
...
@@ -225,7 +220,7 @@ static int ctl2_find_guid(
while
(
offset
!=
-
1
)
{
guidentry
=
(
MSFT_GuidEntry
*
)
&
typelib
->
typelib_segment_data
[
MSFT_SEG_GUID
][
offset
];
if
(
!
memcmp
(
guidentry
,
guid
,
sizeof
(
GUID
)))
return
offset
;
if
(
!
memcmp
(
guidentry
,
guid
,
sizeof
(
*
guid
)))
return
offset
;
offset
=
guidentry
->
next_hash
;
}
...
...
@@ -691,7 +686,7 @@ static void alloc_importinfo(msft_typelib_t *typelib, importinfo_t *importinfo)
importlib
->
allocated
=
-
1
;
memcpy
(
&
guid
.
guid
,
&
importlib
->
guid
,
sizeof
(
GUID
));
memcpy
(
&
guid
.
guid
,
&
importlib
->
guid
,
sizeof
(
guid
.
guid
));
guid
.
hreftype
=
2
;
guid_idx
=
ctl2_alloc_guid
(
typelib
,
&
guid
);
...
...
@@ -710,13 +705,13 @@ static void alloc_importinfo(msft_typelib_t *typelib, importinfo_t *importinfo)
MSFT_GuidEntry
guid
;
guid
.
hreftype
=
0
;
memcpy
(
&
guid
.
guid
,
&
importinfo
->
guid
,
sizeof
(
GUID
));
memcpy
(
&
guid
.
guid
,
&
importinfo
->
guid
,
sizeof
(
guid
.
guid
));
impinfo
.
oGuid
=
ctl2_alloc_guid
(
typelib
,
&
guid
);
importinfo
->
offset
=
alloc_msft_importinfo
(
typelib
,
&
impinfo
);
typelib
->
typelib_segment_data
[
MSFT_SEG_GUID
][
impinfo
.
oGuid
+
sizeof
(
GUID
)]
typelib
->
typelib_segment_data
[
MSFT_SEG_GUID
][
impinfo
.
oGuid
+
sizeof
(
guid
.
guid
)]
=
importinfo
->
offset
+
1
;
if
(
!
strcmp
(
importinfo
->
name
,
"IDispatch"
))
...
...
@@ -1260,8 +1255,8 @@ static void write_default_value(msft_typelib_t *typelib, type_t *type, expr_t *e
write_int_value
(
typelib
,
out
,
vt
,
expr
->
cval
);
}
static
HRESULT
set_custdata
(
msft_typelib_t
*
typelib
,
REFGUID
guid
,
int
vt
,
const
void
*
value
,
int
*
offset
)
static
void
set_custdata
(
msft_typelib_t
*
typelib
,
const
uuid_t
*
guid
,
int
vt
,
const
void
*
value
,
int
*
offset
)
{
int
guidoffset
;
int
custoffset
;
...
...
@@ -1295,11 +1290,9 @@ static HRESULT set_custdata(msft_typelib_t *typelib, REFGUID guid,
custdata
[
1
]
=
data_out
;
custdata
[
2
]
=
*
offset
;
*
offset
=
custoffset
;
return
S_OK
;
}
static
HRESULT
set_custdata_attr
(
msft_typelib_t
*
typelib
,
attr_custdata_t
*
custdata
,
int
*
offset
)
static
void
set_custdata_attr
(
msft_typelib_t
*
typelib
,
attr_custdata_t
*
custdata
,
int
*
offset
)
{
switch
(
custdata
->
pval
->
type
)
{
case
EXPR_STRLIT
:
...
...
@@ -1314,11 +1307,9 @@ static HRESULT set_custdata_attr(msft_typelib_t *typelib, attr_custdata_t *custd
error
(
"custom() attribute with unknown type
\n
"
);
break
;
}
return
S_OK
;
}
static
HRESULT
add_func_desc
(
msft_typeinfo_t
*
typeinfo
,
var_t
*
func
,
int
index
)
static
int
add_func_desc
(
msft_typeinfo_t
*
typeinfo
,
var_t
*
func
,
int
index
)
{
int
offset
,
name_offset
;
int
*
typedata
,
typedata_size
;
...
...
@@ -1354,7 +1345,7 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, var_t *func, int index)
if
(
is_local
(
func
->
attrs
))
{
chat
(
"add_func_desc: skipping local function
\n
"
);
return
S_
FALSE
;
return
FALSE
;
}
if
(
type_function_get_args
(
func
->
declspec
.
type
))
...
...
@@ -1637,8 +1628,8 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, var_t *func, int index)
typeinfo
->
typeinfo
->
cElement
+=
1
;
namedata
=
typeinfo
->
typelib
->
typelib_segment_data
[
MSFT_SEG_NAME
]
+
name_offset
;
if
(
*
((
INT
*
)
namedata
)
==
-
1
)
{
*
((
INT
*
)
namedata
)
=
typeinfo
->
typelib
->
typelib_typeinfo_offsets
[
typeinfo
->
typeinfo
->
typekind
>>
16
];
if
(
*
((
int
*
)
namedata
)
==
-
1
)
{
*
((
int
*
)
namedata
)
=
typeinfo
->
typelib
->
typelib_typeinfo_offsets
[
typeinfo
->
typeinfo
->
typekind
>>
16
];
if
(
typeinfo
->
typekind
==
TKIND_MODULE
)
namedata
[
9
]
|=
0x10
;
}
else
...
...
@@ -1662,17 +1653,17 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, var_t *func, int index)
i
++
;
}
}
return
S_OK
;
return
TRUE
;
}
static
HRESULT
add_var_desc
(
msft_typeinfo_t
*
typeinfo
,
UINT
index
,
var_t
*
var
)
static
void
add_var_desc
(
msft_typeinfo_t
*
typeinfo
,
unsigned
int
index
,
var_t
*
var
)
{
int
offset
,
id
;
unsigned
int
typedata_size
;
int
extra_attr
=
0
;
INT
*
typedata
;
int
*
typedata
;
unsigned
int
var_datawidth
,
var_alignment
=
0
;
int
var_type_size
,
var_kind
=
0
/* VAR_PERINSTANCE */
;
int
var_type_size
,
var_kind
=
0
/* VAR_PERINSTANCE */
;
int
alignment
;
int
varflags
=
0
;
const
attr_t
*
attr
;
...
...
@@ -1853,11 +1844,10 @@ static HRESULT add_var_desc(msft_typeinfo_t *typeinfo, UINT index, var_t* var)
typeinfo
->
typeinfo
->
size
=
(
typeinfo
->
datawidth
+
(
alignment
-
1
))
&
~
(
alignment
-
1
);
offset
=
ctl2_alloc_name
(
typeinfo
->
typelib
,
var
->
name
);
if
(
offset
==
-
1
)
return
E_OUTOFMEMORY
;
namedata
=
typeinfo
->
typelib
->
typelib_segment_data
[
MSFT_SEG_NAME
]
+
offset
;
if
(
*
((
INT
*
)
namedata
)
==
-
1
)
{
*
((
INT
*
)
namedata
)
=
typeinfo
->
typelib
->
typelib_typeinfo_offsets
[
typeinfo
->
typeinfo
->
typekind
>>
16
];
if
(
*
((
int
*
)
namedata
)
==
-
1
)
{
*
((
int
*
)
namedata
)
=
typeinfo
->
typelib
->
typelib_typeinfo_offsets
[
typeinfo
->
typeinfo
->
typekind
>>
16
];
if
(
typeinfo
->
typekind
!=
TKIND_DISPATCH
)
namedata
[
9
]
|=
0x10
;
}
else
...
...
@@ -1867,11 +1857,9 @@ static HRESULT add_var_desc(msft_typeinfo_t *typeinfo, UINT index, var_t* var)
namedata
[
9
]
|=
0x20
;
}
typeinfo
->
var_names
[
var_num
]
=
offset
;
return
S_OK
;
}
static
HRESULT
add_impl_type
(
msft_typeinfo_t
*
typeinfo
,
type_t
*
ref
,
importinfo_t
*
importinfo
)
static
void
add_impl_type
(
msft_typeinfo_t
*
typeinfo
,
type_t
*
ref
,
importinfo_t
*
importinfo
)
{
if
(
importinfo
)
{
alloc_importinfo
(
typeinfo
->
typelib
,
importinfo
);
...
...
@@ -1886,7 +1874,6 @@ static HRESULT add_impl_type(msft_typeinfo_t *typeinfo, type_t *ref, importinfo_
}
typeinfo
->
typeinfo
->
cImplTypes
++
;
return
S_OK
;
}
static
msft_typeinfo_t
*
create_msft_typeinfo
(
msft_typelib_t
*
typelib
,
enum
type_kind
kind
,
...
...
@@ -2005,7 +1992,7 @@ static msft_typeinfo_t *create_msft_typeinfo(msft_typelib_t *typelib, enum type_
break
;
case
ATTR_UUID
:
guidentry
.
guid
=
*
(
GUID
*
)
attr
->
u
.
pval
;
guidentry
.
guid
=
*
(
uuid_t
*
)
attr
->
u
.
pval
;
guidentry
.
hreftype
=
typelib
->
typelib_typeinfo_offsets
[
typeinfo
->
typekind
>>
16
];
guidentry
.
next_hash
=
-
1
;
typeinfo
->
posguid
=
ctl2_alloc_guid
(
typelib
,
&
guidentry
);
...
...
@@ -2038,8 +2025,8 @@ static void add_dispatch(msft_typelib_t *typelib)
int
guid_offset
,
impfile_offset
,
hash_key
;
MSFT_GuidEntry
guidentry
;
MSFT_ImpInfo
impinfo
;
GUID
stdole
=
{
0x00020430
,
0x0000
,
0x0000
,{
0xc0
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x46
}};
GUID
iid_idispatch
=
{
0x00020400
,
0x0000
,
0x0000
,{
0xc0
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x46
}};
static
const
uuid_t
stdole
=
{
0x00020430
,
0x0000
,
0x0000
,{
0xc0
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x46
}};
static
const
uuid_t
iid_idispatch
=
{
0x00020400
,
0x0000
,
0x0000
,{
0xc0
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x46
}};
if
(
typelib
->
typelib_header
.
dispatchpos
!=
-
1
)
return
;
...
...
@@ -2137,7 +2124,7 @@ static void add_dispinterface_typeinfo(msft_typelib_t *typelib, type_t *dispinte
{
idx
=
0
;
LIST_FOR_EACH_ENTRY
(
func
,
type_dispiface_get_methods
(
dispinterface
),
var_t
,
entry
)
if
(
add_func_desc
(
msft_typeinfo
,
func
,
idx
)
==
S_OK
)
if
(
add_func_desc
(
msft_typeinfo
,
func
,
idx
))
idx
++
;
}
...
...
@@ -2215,7 +2202,7 @@ static void add_interface_typeinfo(msft_typelib_t *typelib, type_t *interface)
STATEMENTS_FOR_EACH_FUNC
(
stmt_func
,
type_iface_get_stmts
(
interface
)
)
{
var_t
*
func
=
stmt_func
->
u
.
var
;
if
(
add_func_desc
(
msft_typeinfo
,
func
,
idx
)
==
S_OK
)
if
(
add_func_desc
(
msft_typeinfo
,
func
,
idx
))
idx
++
;
}
...
...
@@ -2427,7 +2414,7 @@ static void add_module_typeinfo(msft_typelib_t *typelib, type_t *module)
STATEMENTS_FOR_EACH_FUNC
(
stmt
,
module
->
details
.
module
->
stmts
)
{
var_t
*
func
=
stmt
->
u
.
var
;
if
(
add_func_desc
(
msft_typeinfo
,
func
,
idx
)
==
S_OK
)
if
(
add_func_desc
(
msft_typeinfo
,
func
,
idx
))
idx
++
;
}
...
...
@@ -2520,17 +2507,11 @@ static void set_version(msft_typelib_t *typelib)
static
void
set_guid
(
msft_typelib_t
*
typelib
)
{
MSFT_GuidEntry
guidentry
;
MSFT_GuidEntry
guidentry
=
{
{
0
},
-
2
,
-
1
}
;
int
offset
;
void
*
ptr
;
GUID
guid
=
{
0
,
0
,
0
,{
0
,
0
,
0
,
0
,
0
,
0
}};
guidentry
.
guid
=
guid
;
guidentry
.
hreftype
=
-
2
;
guidentry
.
next_hash
=
-
1
;
uuid_t
*
ptr
=
get_attrp
(
typelib
->
typelib
->
attrs
,
ATTR_UUID
);
ptr
=
get_attrp
(
typelib
->
typelib
->
attrs
,
ATTR_UUID
);
if
(
ptr
)
guidentry
.
guid
=
*
(
GUID
*
)
ptr
;
if
(
ptr
)
guidentry
.
guid
=
*
ptr
;
offset
=
ctl2_alloc_guid
(
typelib
,
&
guidentry
);
typelib
->
typelib_header
.
posguid
=
offset
;
...
...
@@ -2772,9 +2753,9 @@ int create_msft_typelib(typelib_t *typelib)
time_t
cur_time
;
char
*
time_override
;
unsigned
int
version
=
7
<<
24
|
555
;
/* 7.00.0555 */
GUID
midl_time_guid
=
{
0xde77ba63
,
0x517c
,
0x11d1
,{
0xa2
,
0xda
,
0x00
,
0x00
,
0xf8
,
0x77
,
0x3c
,
0xe9
}};
GUID
midl_version_guid
=
{
0xde77ba64
,
0x517c
,
0x11d1
,{
0xa2
,
0xda
,
0x00
,
0x00
,
0xf8
,
0x77
,
0x3c
,
0xe9
}};
GUID
midl_info_guid
=
{
0xde77ba65
,
0x517c
,
0x11d1
,{
0xa2
,
0xda
,
0x00
,
0x00
,
0xf8
,
0x77
,
0x3c
,
0xe9
}};
static
const
uuid_t
midl_time_guid
=
{
0xde77ba63
,
0x517c
,
0x11d1
,{
0xa2
,
0xda
,
0x00
,
0x00
,
0xf8
,
0x77
,
0x3c
,
0xe9
}};
static
const
uuid_t
midl_version_guid
=
{
0xde77ba64
,
0x517c
,
0x11d1
,{
0xa2
,
0xda
,
0x00
,
0x00
,
0xf8
,
0x77
,
0x3c
,
0xe9
}};
static
const
uuid_t
midl_info_guid
=
{
0xde77ba65
,
0x517c
,
0x11d1
,{
0xa2
,
0xda
,
0x00
,
0x00
,
0xf8
,
0x77
,
0x3c
,
0xe9
}};
char
info_string
[
128
];
msft
=
xmalloc
(
sizeof
(
*
msft
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment