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
19b6046e
Commit
19b6046e
authored
Feb 09, 2006
by
Robert Shearman
Committed by
Alexandre Julliard
Feb 09, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut: Move the call to SearchPath inside of TLB_ReadTypeLib.
parent
00ecbd05
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
32 deletions
+27
-32
typelib.c
dlls/oleaut32/typelib.c
+27
-32
No files found.
dlls/oleaut32/typelib.c
View file @
19b6046e
...
...
@@ -196,7 +196,7 @@ static WCHAR *get_lcid_subkey( LCID lcid, SYSKIND syskind, WCHAR *buffer )
return
buffer
;
}
int
TLB_ReadTypeLib
(
LPCWSTR
file
,
INT
index
,
ITypeLib2
**
ppTypel
ib
);
static
int
TLB_ReadTypeLib
(
LPCWSTR
pszFileName
,
LPWSTR
pszPath
,
UINT
cchPath
,
ITypeLib2
**
ppTypeL
ib
);
/****************************************************************************
...
...
@@ -333,38 +333,14 @@ HRESULT WINAPI LoadTypeLibEx(
REGKIND
regkind
,
/* [in] Specify kind of registration */
ITypeLib
**
pptLib
)
/* [out] Pointer to pointer to loaded type library */
{
WCHAR
szPath
[
MAX_PATH
+
1
],
szFileCopy
[
MAX_PATH
+
1
];
WCHAR
*
pIndexStr
;
WCHAR
szPath
[
MAX_PATH
+
1
];
HRESULT
res
;
INT
index
=
1
;
TRACE
(
"(%s,%d,%p)
\n
"
,
debugstr_w
(
szFile
),
regkind
,
pptLib
);
/* by default try and load using LoadLibrary (for builtin stdole32.tlb) */
memcpy
(
szPath
,
szFile
,
(
strlenW
(
szFile
)
+
1
)
*
sizeof
(
WCHAR
));
*
pptLib
=
NULL
;
if
(
!
SearchPathW
(
NULL
,
szFile
,
NULL
,
sizeof
(
szPath
)
/
sizeof
(
WCHAR
),
szPath
,
NULL
))
{
/* Look for a trailing '\\' followed by an index */
pIndexStr
=
strrchrW
(
szFile
,
'\\'
);
if
(
pIndexStr
&&
pIndexStr
!=
szFile
&&
*++
pIndexStr
!=
'\0'
)
{
index
=
atoiW
(
pIndexStr
);
memcpy
(
szFileCopy
,
szFile
,
(
pIndexStr
-
szFile
-
1
)
*
sizeof
(
WCHAR
));
szFileCopy
[
pIndexStr
-
szFile
-
1
]
=
'\0'
;
if
(
!
SearchPathW
(
NULL
,
szFileCopy
,
NULL
,
sizeof
(
szPath
)
/
sizeof
(
WCHAR
),
szPath
,
NULL
))
return
TYPE_E_CANTLOADLIBRARY
;
if
(
GetFileAttributesW
(
szFileCopy
)
&
FILE_ATTRIBUTE_DIRECTORY
)
return
TYPE_E_CANTLOADLIBRARY
;
}
}
TRACE
(
"File %s index %d
\n
"
,
debugstr_w
(
szPath
),
index
);
res
=
TLB_ReadTypeLib
(
sz
Path
,
index
,
(
ITypeLib2
**
)
pptLib
);
res
=
TLB_ReadTypeLib
(
sz
File
,
szPath
,
MAX_PATH
+
1
,
(
ITypeLib2
**
)
pptLib
);
if
(
SUCCEEDED
(
res
))
switch
(
regkind
)
...
...
@@ -2188,17 +2164,36 @@ static CRITICAL_SECTION cache_section = { &cache_section_debug, -1, 0, 0, 0, 0 }
*/
#define MSFT_SIGNATURE 0x5446534D
/* "MSFT" */
#define SLTG_SIGNATURE 0x47544c53
/* "SLTG" */
int
TLB_ReadTypeLib
(
LPCWSTR
pszFileName
,
INT
index
,
ITypeLib2
**
ppTypeLib
)
static
int
TLB_ReadTypeLib
(
LPCWSTR
pszFileName
,
LPWSTR
pszPath
,
UINT
cchPath
,
ITypeLib2
**
ppTypeLib
)
{
ITypeLibImpl
*
entry
;
int
ret
=
TYPE_E_CANTLOADLIBRARY
;
DWORD
dwSignature
=
0
;
HANDLE
hFile
;
TRACE_
(
typelib
)(
"%s:%d
\n
"
,
debugstr_w
(
pszFileName
),
index
);
INT
index
=
1
;
*
ppTypeLib
=
NULL
;
if
(
!
SearchPathW
(
NULL
,
pszFileName
,
NULL
,
cchPath
,
pszPath
,
NULL
))
{
WCHAR
szFileCopy
[
MAX_PATH
+
1
];
/* Look for a trailing '\\' followed by an index */
WCHAR
*
pIndexStr
=
strrchrW
(
pszFileName
,
'\\'
);
if
(
pIndexStr
&&
pIndexStr
!=
pszFileName
&&
*++
pIndexStr
!=
'\0'
)
{
index
=
atoiW
(
pIndexStr
);
memcpy
(
szFileCopy
,
pszFileName
,
(
pIndexStr
-
pszFileName
-
1
)
*
sizeof
(
WCHAR
));
szFileCopy
[
pIndexStr
-
pszFileName
-
1
]
=
'\0'
;
if
(
!
SearchPathW
(
NULL
,
szFileCopy
,
NULL
,
cchPath
,
pszPath
,
NULL
))
return
TYPE_E_CANTLOADLIBRARY
;
if
(
GetFileAttributesW
(
szFileCopy
)
&
FILE_ATTRIBUTE_DIRECTORY
)
return
TYPE_E_CANTLOADLIBRARY
;
}
}
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. */
EnterCriticalSection
(
&
cache_section
);
for
(
entry
=
tlb_cache_first
;
entry
!=
NULL
;
entry
=
entry
->
next
)
...
...
@@ -2215,7 +2210,7 @@ int TLB_ReadTypeLib(LPCWSTR pszFileName, INT index, ITypeLib2 **ppTypeLib)
LeaveCriticalSection
(
&
cache_section
);
/* check the signature of the file */
hFile
=
CreateFileW
(
psz
FileName
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
hFile
=
CreateFileW
(
psz
Path
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
if
(
INVALID_HANDLE_VALUE
!=
hFile
)
{
HANDLE
hMapping
=
CreateFileMappingW
(
hFile
,
NULL
,
PAGE_READONLY
|
SEC_COMMIT
,
0
,
0
,
NULL
);
...
...
@@ -2252,7 +2247,7 @@ int TLB_ReadTypeLib(LPCWSTR pszFileName, INT index, ITypeLib2 **ppTypeLib)
if
(((
WORD
)
dwSignature
==
IMAGE_DOS_SIGNATURE
)
||
(
dwSignature
==
0
))
{
/* find the typelibrary resource*/
HINSTANCE
hinstDLL
=
LoadLibraryExW
(
psz
FileName
,
0
,
DONT_RESOLVE_DLL_REFERENCES
|
HINSTANCE
hinstDLL
=
LoadLibraryExW
(
psz
Path
,
0
,
DONT_RESOLVE_DLL_REFERENCES
|
LOAD_LIBRARY_AS_DATAFILE
|
LOAD_WITH_ALTERED_SEARCH_PATH
);
if
(
hinstDLL
)
{
...
...
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