mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-15 08:55:06 +00:00
widl: Try to find imported typelib using .tlb extension if it wasn't specified.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
cb563dbac6
commit
fbdf119e2c
|
@ -326,22 +326,42 @@ static void read_msft_importlib(importlib_t *importlib, int fd)
|
||||||
free(typeinfo_offs);
|
free(typeinfo_offs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int open_typelib(const char *name)
|
||||||
|
{
|
||||||
|
char *file_name;
|
||||||
|
int fd;
|
||||||
|
|
||||||
|
file_name = wpp_find_include(name, NULL);
|
||||||
|
if(!file_name)
|
||||||
|
return open(name, O_RDONLY | O_BINARY );
|
||||||
|
|
||||||
|
fd = open(file_name, O_RDONLY | O_BINARY );
|
||||||
|
free(file_name);
|
||||||
|
return fd;
|
||||||
|
}
|
||||||
|
|
||||||
static void read_importlib(importlib_t *importlib)
|
static void read_importlib(importlib_t *importlib)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
INT magic;
|
INT magic;
|
||||||
char *file_name;
|
|
||||||
|
|
||||||
file_name = wpp_find_include(importlib->name, NULL);
|
fd = open_typelib(importlib->name);
|
||||||
if(file_name) {
|
|
||||||
fd = open(file_name, O_RDONLY | O_BINARY );
|
/* widl extension: if importlib name has no .tlb extension, try using .tlb */
|
||||||
free(file_name);
|
if(fd < 0) {
|
||||||
}else {
|
const char *p = strrchr(importlib->name, '.');
|
||||||
fd = open(importlib->name, O_RDONLY | O_BINARY );
|
size_t len = p ? p - importlib->name : strlen(importlib->name);
|
||||||
|
if(strcmp(importlib->name + len, ".tlb")) {
|
||||||
|
char *tlb_name = xmalloc(len + 5);
|
||||||
|
memcpy(tlb_name, importlib->name, len);
|
||||||
|
strcpy(tlb_name + len, ".tlb");
|
||||||
|
fd = open_typelib(tlb_name);
|
||||||
|
free(tlb_name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(fd < 0)
|
if(fd < 0)
|
||||||
error("Could not open importlib %s.\n", importlib->name);
|
error("Could not find importlib %s.\n", importlib->name);
|
||||||
|
|
||||||
tlb_read(fd, &magic, sizeof(magic));
|
tlb_read(fd, &magic, sizeof(magic));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue