Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
a09cd1b8
Commit
a09cd1b8
authored
Feb 06, 2007
by
Huw Davies
Committed by
Alexandre Julliard
Feb 06, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32: Call SearchPath before LoadLibrary so that we get the full path of native exes and dlls.
For builtin dlls prepend the system directory.
parent
12e3d642
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
21 deletions
+28
-21
typelib.c
dlls/oleaut32/typelib.c
+28
-21
No files found.
dlls/oleaut32/typelib.c
View file @
a09cd1b8
...
...
@@ -2214,37 +2214,41 @@ static int TLB_ReadTypeLib(LPCWSTR pszFileName, LPWSTR pszPath, UINT cchPath, IT
int
ret
=
TYPE_E_CANTLOADLIBRARY
;
INT
index
=
1
;
HINSTANCE
hinstDLL
;
LPWSTR
index_str
,
file
=
(
LPWSTR
)
pszFileName
;
*
ppTypeLib
=
NULL
;
lstrcpynW
(
pszPath
,
pszFileName
,
cchPath
);
/* first try loading as a dll and access the typelib as a resource */
hinstDLL
=
LoadLibraryExW
(
pszFileName
,
0
,
DONT_RESOLVE_DLL_REFERENCES
|
LOAD_LIBRARY_AS_DATAFILE
|
LOAD_WITH_ALTERED_SEARCH_PATH
);
if
(
!
hinstDLL
)
index_str
=
strrchrW
(
pszFileName
,
'\\'
);
if
(
index_str
&&
*++
index_str
!=
'\0'
)
{
/* it may have been specified with resource index appended to the
* path, so remove it and try again */
const
WCHAR
*
pIndexStr
=
strrchrW
(
pszFileName
,
'\\'
);
if
(
pIndexStr
&&
pIndexStr
!=
pszFileName
&&
*++
pIndexStr
!=
'\0'
)
LPWSTR
end_ptr
;
long
idx
=
strtolW
(
index_str
,
&
end_ptr
,
10
);
if
(
*
end_ptr
==
'\0'
)
{
in
dex
=
atoiW
(
pIndexStr
)
;
pszPath
[
pIndexStr
-
pszFileName
-
1
]
=
'\0'
;
hinstDLL
=
LoadLibraryExW
(
pszPath
,
0
,
DONT_RESOLVE_DLL_REFERENCES
|
LOAD_LIBRARY_AS_DATAFILE
|
LOAD_WITH_ALTERED_SEARCH_PATH
)
;
in
t
str_len
=
index_str
-
pszFileName
-
1
;
index
=
idx
;
file
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
str_len
+
1
)
*
sizeof
(
WCHAR
));
memcpy
(
file
,
pszFileName
,
str_len
*
sizeof
(
WCHAR
));
file
[
str_len
]
=
0
;
}
}
/* get the path to the specified typelib file */
if
(
!
hinstDLL
)
if
(
!
SearchPathW
(
NULL
,
file
,
NULL
,
cchPath
,
pszPath
,
NULL
))
{
/* otherwise, try loading as a regular file */
if
(
!
SearchPathW
(
NULL
,
pszFileName
,
NULL
,
cchPath
,
pszPath
,
NULL
))
return
TYPE_E_CANTLOADLIBRARY
;
if
(
strchrW
(
file
,
'\\'
))
{
lstrcpyW
(
pszPath
,
file
);
}
else
{
int
len
=
GetSystemDirectoryW
(
pszPath
,
cchPath
);
pszPath
[
len
]
=
'\\'
;
memcpy
(
pszPath
+
len
+
1
,
file
,
(
strlenW
(
file
)
+
1
)
*
sizeof
(
WCHAR
));
}
}
if
(
file
!=
pszFileName
)
HeapFree
(
GetProcessHeap
(),
0
,
file
);
TRACE_
(
typelib
)(
"File %s index %d
\n
"
,
debugstr_w
(
pszPath
),
index
);
/* We look the path up in the typelib cache. If found, we just addref it, and return the pointer. */
...
...
@@ -2257,13 +2261,16 @@ static int TLB_ReadTypeLib(LPCWSTR pszFileName, LPWSTR pszPath, UINT cchPath, IT
*
ppTypeLib
=
(
ITypeLib2
*
)
entry
;
ITypeLib_AddRef
(
*
ppTypeLib
);
LeaveCriticalSection
(
&
cache_section
);
FreeLibrary
(
hinstDLL
);
return
S_OK
;
}
}
LeaveCriticalSection
(
&
cache_section
);
/* now actually load and parse the typelib */
hinstDLL
=
LoadLibraryExW
(
pszPath
,
0
,
DONT_RESOLVE_DLL_REFERENCES
|
LOAD_LIBRARY_AS_DATAFILE
|
LOAD_WITH_ALTERED_SEARCH_PATH
);
if
(
hinstDLL
)
{
static
const
WCHAR
TYPELIBW
[]
=
{
'T'
,
'Y'
,
'P'
,
'E'
,
'L'
,
'I'
,
'B'
,
0
};
...
...
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