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
d3446e1f
Commit
d3446e1f
authored
Sep 30, 2021
by
Nikolay Sivov
Committed by
Alexandre Julliard
Sep 30, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Use public function to get file extension in GetClassFile().
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
966d74a1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
85 additions
and
112 deletions
+85
-112
Makefile.in
dlls/ole32/Makefile.in
+1
-1
filemoniker.c
dlls/ole32/filemoniker.c
+79
-82
moniker.c
dlls/ole32/moniker.c
+5
-26
moniker.h
dlls/ole32/moniker.h
+0
-3
No files found.
dlls/ole32/Makefile.in
View file @
d3446e1f
MODULE
=
ole32.dll
IMPORTLIB
=
ole32
IMPORTS
=
uuid advapi32 user32 gdi32 combase rpcrt4
IMPORTS
=
uuid advapi32 user32 gdi32 combase rpcrt4
kernelbase
DELAYIMPORTS
=
oleaut32
EXTRADEFS
=
-D_OLE32_
...
...
dlls/ole32/filemoniker.c
View file @
d3446e1f
...
...
@@ -631,6 +631,85 @@ static void free_stringtable(LPOLESTR *stringTable)
CoTaskMemFree
(
stringTable
);
}
static
int
FileMonikerImpl_DecomposePath
(
LPCOLESTR
str
,
LPOLESTR
**
stringTable
)
{
LPOLESTR
word
;
int
i
=
0
,
j
,
tabIndex
=
0
,
ret
=
0
;
LPOLESTR
*
strgtable
;
int
len
=
lstrlenW
(
str
);
TRACE
(
"%s, %p
\n
"
,
debugstr_w
(
str
),
*
stringTable
);
strgtable
=
CoTaskMemAlloc
((
len
+
1
)
*
sizeof
(
*
strgtable
));
if
(
strgtable
==
NULL
)
return
E_OUTOFMEMORY
;
word
=
CoTaskMemAlloc
((
len
+
1
)
*
sizeof
(
WCHAR
));
if
(
word
==
NULL
)
{
ret
=
E_OUTOFMEMORY
;
goto
lend
;
}
while
(
str
[
i
]
!=
0
){
if
(
str
[
i
]
==
L'\\'
)
{
strgtable
[
tabIndex
]
=
CoTaskMemAlloc
(
2
*
sizeof
(
WCHAR
));
if
(
strgtable
[
tabIndex
]
==
NULL
)
{
ret
=
E_OUTOFMEMORY
;
goto
lend
;
}
lstrcpyW
(
strgtable
[
tabIndex
++
],
L"
\\
"
);
i
++
;
}
else
{
for
(
j
=
0
;
str
[
i
]
&&
str
[
i
]
!=
L'\\'
;
i
++
,
j
++
)
word
[
j
]
=
str
[
i
];
word
[
j
]
=
0
;
strgtable
[
tabIndex
]
=
CoTaskMemAlloc
(
sizeof
(
WCHAR
)
*
(
j
+
1
));
if
(
strgtable
[
tabIndex
]
==
NULL
)
{
ret
=
E_OUTOFMEMORY
;
goto
lend
;
}
lstrcpyW
(
strgtable
[
tabIndex
++
],
word
);
}
}
strgtable
[
tabIndex
]
=
NULL
;
*
stringTable
=
strgtable
;
ret
=
tabIndex
;
lend:
if
(
ret
<
0
)
{
for
(
i
=
0
;
i
<
tabIndex
;
i
++
)
CoTaskMemFree
(
strgtable
[
i
]);
CoTaskMemFree
(
strgtable
);
}
CoTaskMemFree
(
word
);
return
ret
;
}
/******************************************************************************
* FileMoniker_ComposeWith
*/
...
...
@@ -971,88 +1050,6 @@ failed:
}
/******************************************************************************
* DecomposePath (local function)
*/
int
FileMonikerImpl_DecomposePath
(
LPCOLESTR
str
,
LPOLESTR
**
stringTable
)
{
LPOLESTR
word
;
int
i
=
0
,
j
,
tabIndex
=
0
,
ret
=
0
;
LPOLESTR
*
strgtable
;
int
len
=
lstrlenW
(
str
);
TRACE
(
"%s, %p
\n
"
,
debugstr_w
(
str
),
*
stringTable
);
strgtable
=
CoTaskMemAlloc
((
len
+
1
)
*
sizeof
(
*
strgtable
));
if
(
strgtable
==
NULL
)
return
E_OUTOFMEMORY
;
word
=
CoTaskMemAlloc
((
len
+
1
)
*
sizeof
(
WCHAR
));
if
(
word
==
NULL
)
{
ret
=
E_OUTOFMEMORY
;
goto
lend
;
}
while
(
str
[
i
]
!=
0
){
if
(
str
[
i
]
==
L'\\'
)
{
strgtable
[
tabIndex
]
=
CoTaskMemAlloc
(
2
*
sizeof
(
WCHAR
));
if
(
strgtable
[
tabIndex
]
==
NULL
)
{
ret
=
E_OUTOFMEMORY
;
goto
lend
;
}
lstrcpyW
(
strgtable
[
tabIndex
++
],
L"
\\
"
);
i
++
;
}
else
{
for
(
j
=
0
;
str
[
i
]
&&
str
[
i
]
!=
L'\\'
;
i
++
,
j
++
)
word
[
j
]
=
str
[
i
];
word
[
j
]
=
0
;
strgtable
[
tabIndex
]
=
CoTaskMemAlloc
(
sizeof
(
WCHAR
)
*
(
j
+
1
));
if
(
strgtable
[
tabIndex
]
==
NULL
)
{
ret
=
E_OUTOFMEMORY
;
goto
lend
;
}
lstrcpyW
(
strgtable
[
tabIndex
++
],
word
);
}
}
strgtable
[
tabIndex
]
=
NULL
;
*
stringTable
=
strgtable
;
ret
=
tabIndex
;
lend:
if
(
ret
<
0
)
{
for
(
i
=
0
;
i
<
tabIndex
;
i
++
)
CoTaskMemFree
(
strgtable
[
i
]);
CoTaskMemFree
(
strgtable
);
}
CoTaskMemFree
(
word
);
return
ret
;
}
/******************************************************************************
* FileMoniker_RelativePathTo
*/
static
HRESULT
WINAPI
...
...
dlls/ole32/moniker.c
View file @
d3446e1f
...
...
@@ -32,6 +32,7 @@
#include "compobj_private.h"
#include "moniker.h"
#include "irot.h"
#include "pathcch.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
ole
);
...
...
@@ -910,10 +911,9 @@ HRESULT WINAPI GetClassFile(LPCOLESTR filePathName,CLSID *pclsid)
{
IStorage
*
pstg
=
0
;
HRESULT
res
;
int
nbElm
,
length
,
i
;
LONG
sizeProgId
,
ret
;
LPOLESTR
*
pathDec
=
0
,
absFile
=
0
,
progId
=
0
;
LPWSTR
extension
;
LPOLESTR
progId
=
0
;
const
WCHAR
*
extension
;
TRACE
(
"%s, %p
\n
"
,
debugstr_w
(
filePathName
),
pclsid
);
...
...
@@ -954,26 +954,9 @@ HRESULT WINAPI GetClassFile(LPCOLESTR filePathName,CLSID *pclsid)
/* if the above strategies fail then search for the extension key in the registry */
/* get the last element (absolute file) in the path name */
nbElm
=
FileMonikerImpl_DecomposePath
(
filePathName
,
&
pathDec
);
absFile
=
pathDec
[
nbElm
-
1
];
/* failed if the path represents a directory and not an absolute file name*/
if
(
!
wcscmp
(
absFile
,
L"
\\
"
))
{
CoTaskMemFree
(
pathDec
);
res
=
PathCchFindExtension
(
filePathName
,
PATHCCH_MAX_CCH
,
&
extension
);
if
(
FAILED
(
res
)
||
!
extension
||
!*
extension
||
!
wcscmp
(
extension
,
L"."
))
return
MK_E_INVALIDEXTENSION
;
}
/* get the extension of the file */
extension
=
NULL
;
length
=
lstrlenW
(
absFile
);
for
(
i
=
length
-
1
;
(
i
>=
0
)
&&
*
(
extension
=
&
absFile
[
i
])
!=
'.'
;
i
--
)
/* nothing */
;
if
(
!
extension
||
!
wcscmp
(
extension
,
L"."
))
{
CoTaskMemFree
(
pathDec
);
return
MK_E_INVALIDEXTENSION
;
}
ret
=
RegQueryValueW
(
HKEY_CLASSES_ROOT
,
extension
,
NULL
,
&
sizeProgId
);
if
(
!
ret
)
{
...
...
@@ -990,10 +973,6 @@ HRESULT WINAPI GetClassFile(LPCOLESTR filePathName,CLSID *pclsid)
else
res
=
HRESULT_FROM_WIN32
(
ret
);
for
(
i
=
0
;
pathDec
[
i
]
!=
NULL
;
i
++
)
CoTaskMemFree
(
pathDec
[
i
]);
CoTaskMemFree
(
pathDec
);
return
res
!=
S_OK
?
MK_E_INVALIDEXTENSION
:
res
;
}
...
...
dlls/ole32/moniker.h
View file @
d3446e1f
...
...
@@ -38,9 +38,6 @@ HRESULT WINAPI ClassMoniker_CreateInstance(IClassFactory *iface, IUnknown *pUnk,
HRESULT
WINAPI
PointerMoniker_CreateInstance
(
IClassFactory
*
iface
,
IUnknown
*
pUnk
,
REFIID
riid
,
void
**
ppv
);
HRESULT
WINAPI
ComCat_CreateInstance
(
IClassFactory
*
iface
,
IUnknown
*
pUnk
,
REFIID
riid
,
void
**
ppv
);
/* This function decomposes a String path to a String Table containing all the elements ("\" or "subDirectory" or "Directory" or "FileName") of the path */
int
FileMonikerImpl_DecomposePath
(
LPCOLESTR
str
,
LPOLESTR
**
stringTable
)
DECLSPEC_HIDDEN
;
HRESULT
FileMoniker_CreateFromDisplayName
(
LPBC
pbc
,
LPCOLESTR
szDisplayName
,
LPDWORD
pchEaten
,
LPMONIKER
*
ppmk
)
DECLSPEC_HIDDEN
;
HRESULT
ClassMoniker_CreateFromDisplayName
(
LPBC
pbc
,
LPCOLESTR
szDisplayName
,
...
...
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