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
c9f821ef
Commit
c9f821ef
authored
Jun 23, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
Jun 24, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
urlmon: Reimplement CreateURLMonikerEx on top of IUri APIs.
parent
c461d312
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
53 deletions
+62
-53
umon.c
dlls/urlmon/umon.c
+62
-53
No files found.
dlls/urlmon/umon.c
View file @
c9f821ef
...
...
@@ -37,6 +37,7 @@ typedef struct {
LONG
ref
;
IUri
*
uri
;
BSTR
URLName
;
}
URLMoniker
;
...
...
@@ -98,6 +99,8 @@ static ULONG WINAPI URLMoniker_Release(IMoniker *iface)
TRACE
(
"(%p) ref=%u
\n
"
,
This
,
refCount
);
if
(
!
refCount
)
{
if
(
This
->
uri
)
IUri_Release
(
This
->
uri
);
SysFreeString
(
This
->
URLName
);
heap_free
(
This
);
...
...
@@ -504,55 +507,52 @@ static const IUriContainerVtbl UriContainerVtbl = {
UriContainer_GetIUri
};
static
URLMoniker
*
alloc_moniker
(
void
)
static
HRESULT
create_moniker
(
IUri
*
uri
,
URLMoniker
**
ret
)
{
URLMoniker
*
ret
;
ret
=
heap_alloc
(
sizeof
(
URLMoniker
));
if
(
!
ret
)
return
NULL
;
ret
->
IMoniker_iface
.
lpVtbl
=
&
URLMonikerVtbl
;
ret
->
IUriContainer_iface
.
lpVtbl
=
&
UriContainerVtbl
;
ret
->
ref
=
1
;
ret
->
URLName
=
NULL
;
return
ret
;
}
static
HRESULT
URLMoniker_Init
(
URLMoniker
*
This
,
LPCOLESTR
lpszLeftURLName
,
LPCOLESTR
lpszURLName
)
{
WCHAR
url
[
INTERNET_MAX_URL_LENGTH
];
URLMoniker
*
mon
;
HRESULT
hres
;
DWORD
sizeStr
=
0
;
TRACE
(
"(%p,%s,%s)
\n
"
,
This
,
debugstr_w
(
lpszLeftURLName
),
debugstr_w
(
lpszURLName
));
mon
=
heap_alloc
(
sizeof
(
*
mon
));
if
(
!
mon
)
return
E_OUTOFMEMORY
;
if
(
lpszLeftURLName
)
hres
=
CoInternetCombineUrl
(
lpszLeftURLName
,
lpszURLName
,
URL_FILE_USE_PATHURL
,
url
,
INTERNET_MAX_URL_LENGTH
,
&
sizeStr
,
0
);
else
hres
=
CoInternetParseUrl
(
lpszURLName
,
PARSE_CANONICALIZE
,
URL_FILE_USE_PATHURL
,
url
,
INTERNET_MAX_URL_LENGTH
,
&
sizeStr
,
0
);
mon
->
IMoniker_iface
.
lpVtbl
=
&
URLMonikerVtbl
;
mon
->
IUriContainer_iface
.
lpVtbl
=
&
UriContainerVtbl
;
mon
->
ref
=
1
;
if
(
FAILED
(
hres
))
return
hres
;
if
(
uri
)
{
/* FIXME: try to avoid it */
hres
=
IUri_GetDisplayUri
(
uri
,
&
mon
->
URLName
);
if
(
FAILED
(
hres
))
{
heap_free
(
mon
);
return
hres
;
}
This
->
URLName
=
SysAllocString
(
url
);
IUri_AddRef
(
uri
);
mon
->
uri
=
uri
;
}
else
{
mon
->
URLName
=
NULL
;
mon
->
uri
=
NULL
;
}
URLMON_LockModule
();
TRACE
(
"URLName = %s
\n
"
,
debugstr_w
(
This
->
URLName
));
*
ret
=
mon
;
return
S_OK
;
}
HRESULT
StdURLMoniker_Construct
(
IUnknown
*
outer
,
void
**
ppv
)
{
URLMoniker
*
mon
;
HRESULT
hres
;
TRACE
(
"(%p %p)
\n
"
,
outer
,
ppv
);
*
ppv
=
alloc_moniker
();
return
*
ppv
?
S_OK
:
E_OUTOFMEMORY
;
hres
=
create_moniker
(
NULL
,
&
mon
);
if
(
FAILED
(
hres
))
return
hres
;
*
ppv
=
&
mon
->
IMoniker_iface
;
return
S_OK
;
}
/***********************************************************************
...
...
@@ -573,9 +573,9 @@ HRESULT StdURLMoniker_Construct(IUnknown *outer, void **ppv)
*/
HRESULT
WINAPI
CreateURLMonikerEx
(
IMoniker
*
pmkContext
,
LPCWSTR
szURL
,
IMoniker
**
ppmk
,
DWORD
dwFlags
)
{
IUri
*
uri
,
*
base_uri
=
NULL
;
URLMoniker
*
obj
;
HRESULT
hres
;
LPOLESTR
lefturl
=
NULL
;
TRACE
(
"(%p, %s, %p, %08x)
\n
"
,
pmkContext
,
debugstr_w
(
szURL
),
ppmk
,
dwFlags
);
...
...
@@ -585,28 +585,37 @@ HRESULT WINAPI CreateURLMonikerEx(IMoniker *pmkContext, LPCWSTR szURL, IMoniker
if
(
!
szURL
||
!
ppmk
)
return
E_INVALIDARG
;
if
(
dwFlags
&
URL_MK_UNIFORM
)
FIXME
(
"ignoring flag URL_MK_UNIFORM
\n
"
);
if
(
!
(
obj
=
alloc_moniker
()))
return
E_OUTOFMEMORY
;
if
(
dwFlags
!=
URL_MK_LEGACY
)
FIXME
(
"Unsupported flags %x
\n
"
,
dwFlags
);
if
(
pmkContext
)
{
IBindCtx
*
bind
;
DWORD
dwMksys
=
0
;
IMoniker_IsSystemMoniker
(
pmkContext
,
&
dwMksys
);
if
(
dwMksys
==
MKSYS_URLMONIKER
&&
SUCCEEDED
(
CreateBindCtx
(
0
,
&
bind
)))
{
IMoniker_GetDisplayName
(
pmkContext
,
bind
,
NULL
,
&
lefturl
);
TRACE
(
"lefturl = %s
\n
"
,
debugstr_w
(
lefturl
));
IBindCtx_Release
(
bind
);
IUriContainer
*
uri_container
;
hres
=
IMoniker_QueryInterface
(
pmkContext
,
&
IID_IUriContainer
,
(
void
**
)
&
uri_container
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
IUriContainer_GetIUri
(
uri_container
,
&
base_uri
);
IUriContainer_Release
(
uri_container
);
if
(
FAILED
(
hres
))
return
hres
;
}
}
hres
=
URLMoniker_Init
(
obj
,
lefturl
,
szURL
);
CoTaskMemFree
(
lefturl
);
if
(
SUCCEEDED
(
hres
))
hres
=
URLMoniker_QueryInterface
(
&
obj
->
IMoniker_iface
,
&
IID_IMoniker
,
(
void
**
)
ppmk
);
IMoniker_Release
(
&
obj
->
IMoniker_iface
);
return
hres
;
if
(
base_uri
)
{
hres
=
CoInternetCombineUrlEx
(
base_uri
,
szURL
,
URL_FILE_USE_PATHURL
,
&
uri
,
0
);
IUri_Release
(
base_uri
);
}
else
{
hres
=
CreateUri
(
szURL
,
Uri_CREATE_FILE_USE_DOS_PATH
|
Uri_CREATE_ALLOW_RELATIVE
|
Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
,
0
,
&
uri
);
}
if
(
FAILED
(
hres
))
return
hres
;
hres
=
create_moniker
(
uri
,
&
obj
);
IUri_Release
(
uri
);
if
(
FAILED
(
hres
))
return
hres
;
*
ppmk
=
&
obj
->
IMoniker_iface
;
return
S_OK
;
}
/**********************************************************************
...
...
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