Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Yoann Laissus
wine
Commits
e2186422
Commit
e2186422
authored
24 years ago
by
Francois Jacques
Committed by
Alexandre Julliard
24 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Updated the load process so that all typelibs (and not just the first
one, as it used to) stored in a DLL can be loaded.
parent
edfde7f9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/oleaut32/typelib.c
+55
-5
55 additions, 5 deletions
dlls/oleaut32/typelib.c
with
55 additions
and
5 deletions
dlls/oleaut32/typelib.c
+
55
−
5
View file @
e2186422
...
...
@@ -27,11 +27,10 @@
#include
<stdlib.h>
#include
<string.h>
#include
<stdio.h>
#include
<
assert
.h>
#include
<
ctype
.h>
#include
"winerror.h"
#include
"winreg.h"
/* for HKEY_LOCAL_MACHINE */
#include
"winnls.h"
/* for PRIMARYLANGID */
#include
"wine/winestring.h"
#include
"ole.h"
#include
"heap.h"
#include
"wine/obj_base.h"
...
...
@@ -1158,13 +1157,62 @@ int TLB_ReadTypeLib(LPSTR pszFileName, ITypeLib2 **ppTypeLib)
int
ret
=
E_FAIL
;
DWORD
dwSignature
=
0
;
HFILE
hFile
;
int
nStrLen
=
strlen
(
pszFileName
);
int
i
;
PCHAR
pszTypeLibIndex
=
NULL
;
PCHAR
pszDllName
=
NULL
;
TRACE
(
"%s
\n
"
,
pszFileName
);
*
ppTypeLib
=
NULL
;
/* is it a DLL? */
for
(
i
=
0
;
i
<
nStrLen
;
++
i
)
{
pszFileName
[
i
]
=
tolower
(
pszFileName
[
i
]);
}
pszTypeLibIndex
=
strstr
(
pszFileName
,
".dll"
);
/* find if there's a back-slash after .DLL (good sign of the presence of a typelib index) */
if
(
pszTypeLibIndex
)
{
pszTypeLibIndex
=
strstr
(
pszTypeLibIndex
,
"
\\
"
);
}
/* is there any thing after trailing back-slash ? */
if
(
pszTypeLibIndex
&&
pszTypeLibIndex
<
pszFileName
+
nStrLen
)
{
/* yes -> it's a index! store DLL name, without the trailing back-slash */
size_t
nMemToAlloc
=
pszTypeLibIndex
-
pszFileName
;
pszDllName
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
nMemToAlloc
+
1
);
strncpy
(
pszDllName
,
pszFileName
,
nMemToAlloc
);
/* move index string pointer pass the backslash */
++
pszTypeLibIndex
;
}
else
{
/* No index, reset variable to 1 */
pszDllName
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
nStrLen
+
1
);
strncpy
(
pszDllName
,
pszFileName
,
nStrLen
);
pszTypeLibIndex
=
"1
\0
"
;
}
TRACE
(
"File name without index %s
\n
"
,
pszDllName
);
TRACE
(
"Index of typelib %s
\n
"
,
pszTypeLibIndex
);
/* check the signature of the file */
hFile
=
CreateFileA
(
psz
File
Name
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
0
,
-
1
);
hFile
=
CreateFileA
(
psz
Dll
Name
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
0
,
-
1
);
if
(
INVALID_HANDLE_VALUE
!=
hFile
)
{
HANDLE
hMapping
=
CreateFileMappingA
(
hFile
,
NULL
,
PAGE_READONLY
|
SEC_COMMIT
,
0
,
0
,
NULL
);
...
...
@@ -1192,11 +1240,11 @@ int TLB_ReadTypeLib(LPSTR pszFileName, ITypeLib2 **ppTypeLib)
if
(
(
WORD
)
dwSignature
==
IMAGE_DOS_SIGNATURE
)
{
/* find the typelibrary resource*/
HINSTANCE
hinstDLL
=
LoadLibraryExA
(
psz
File
Name
,
0
,
DONT_RESOLVE_DLL_REFERENCES
|
HINSTANCE
hinstDLL
=
LoadLibraryExA
(
psz
Dll
Name
,
0
,
DONT_RESOLVE_DLL_REFERENCES
|
LOAD_LIBRARY_AS_DATAFILE
|
LOAD_WITH_ALTERED_SEARCH_PATH
);
if
(
hinstDLL
)
{
HRSRC
hrsrc
=
FindResourceA
(
hinstDLL
,
MAKEINTRESOURCEA
(
1
),
"TYPELIB"
);
HRSRC
hrsrc
=
FindResourceA
(
hinstDLL
,
MAKEINTRESOURCEA
(
atoi
(
pszTypeLibIndex
)
),
"TYPELIB"
);
if
(
hrsrc
)
{
HGLOBAL
hGlobal
=
LoadResource
(
hinstDLL
,
hrsrc
);
...
...
@@ -1221,6 +1269,8 @@ int TLB_ReadTypeLib(LPSTR pszFileName, ITypeLib2 **ppTypeLib)
}
}
HeapFree
(
GetProcessHeap
(),
0
,
pszDllName
);
if
(
*
ppTypeLib
)
ret
=
S_OK
;
else
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment