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
2b90a7d6
Commit
2b90a7d6
authored
Feb 21, 2008
by
Jacek Caban
Committed by
Alexandre Julliard
Feb 21, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
urlmon: Optimize registering urlmon protocols.
parent
ae8457e4
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
54 deletions
+59
-54
session.c
dlls/urlmon/session.c
+54
-33
urlmon_main.c
dlls/urlmon/urlmon_main.c
+4
-21
urlmon_main.h
dlls/urlmon/urlmon_main.h
+1
-0
No files found.
dlls/urlmon/session.c
View file @
2b90a7d6
...
...
@@ -101,6 +101,58 @@ static HRESULT get_protocol_cf(LPCWSTR schema, DWORD schema_len, CLSID *pclsid,
return
CoGetClassObject
(
&
clsid
,
CLSCTX_INPROC_SERVER
,
NULL
,
&
IID_IClassFactory
,
(
void
**
)
ret
);
}
static
HRESULT
register_namespace
(
IClassFactory
*
cf
,
REFIID
clsid
,
LPCWSTR
protocol
,
BOOL
urlmon_protocol
)
{
name_space
*
new_name_space
;
new_name_space
=
heap_alloc
(
sizeof
(
name_space
));
if
(
!
urlmon_protocol
)
IClassFactory_AddRef
(
cf
);
new_name_space
->
cf
=
cf
;
new_name_space
->
clsid
=
*
clsid
;
new_name_space
->
protocol
=
heap_strdupW
(
protocol
);
new_name_space
->
next
=
name_space_list
;
name_space_list
=
new_name_space
;
return
S_OK
;
}
static
HRESULT
unregister_namespace
(
IClassFactory
*
cf
,
LPCWSTR
protocol
,
BOOL
urlmon_protocol
)
{
name_space
*
iter
,
*
last
=
NULL
;
for
(
iter
=
name_space_list
;
iter
;
iter
=
iter
->
next
)
{
if
(
iter
->
cf
==
cf
&&
!
strcmpW
(
iter
->
protocol
,
protocol
))
break
;
last
=
iter
;
}
if
(
iter
)
{
if
(
last
)
last
->
next
=
iter
->
next
;
else
name_space_list
=
iter
->
next
;
if
(
!
urlmon_protocol
)
IClassFactory_Release
(
iter
->
cf
);
heap_free
(
iter
->
protocol
);
heap_free
(
iter
);
}
return
S_OK
;
}
void
register_urlmon_namespace
(
IClassFactory
*
cf
,
REFIID
clsid
,
LPCWSTR
protocol
,
BOOL
do_register
)
{
if
(
do_register
)
register_namespace
(
cf
,
clsid
,
protocol
,
TRUE
);
else
unregister_namespace
(
cf
,
protocol
,
TRUE
);
}
BOOL
is_registered_protocol
(
LPCWSTR
url
)
{
DWORD
schema_len
;
...
...
@@ -209,8 +261,6 @@ static HRESULT WINAPI InternetSession_RegisterNameSpace(IInternetSession *iface,
IClassFactory
*
pCF
,
REFCLSID
rclsid
,
LPCWSTR
pwzProtocol
,
ULONG
cPatterns
,
const
LPCWSTR
*
ppwzPatterns
,
DWORD
dwReserved
)
{
name_space
*
new_name_space
;
TRACE
(
"(%p %s %s %d %p %d)
\n
"
,
pCF
,
debugstr_guid
(
rclsid
),
debugstr_w
(
pwzProtocol
),
cPatterns
,
ppwzPatterns
,
dwReserved
);
...
...
@@ -222,47 +272,18 @@ static HRESULT WINAPI InternetSession_RegisterNameSpace(IInternetSession *iface,
if
(
!
pCF
||
!
pwzProtocol
)
return
E_INVALIDARG
;
new_name_space
=
heap_alloc
(
sizeof
(
name_space
));
IClassFactory_AddRef
(
pCF
);
new_name_space
->
cf
=
pCF
;
new_name_space
->
clsid
=
*
rclsid
;
new_name_space
->
protocol
=
heap_strdupW
(
pwzProtocol
);
new_name_space
->
next
=
name_space_list
;
name_space_list
=
new_name_space
;
return
S_OK
;
return
register_namespace
(
pCF
,
rclsid
,
pwzProtocol
,
FALSE
);
}
static
HRESULT
WINAPI
InternetSession_UnregisterNameSpace
(
IInternetSession
*
iface
,
IClassFactory
*
pCF
,
LPCWSTR
pszProtocol
)
{
name_space
*
iter
,
*
last
=
NULL
;
TRACE
(
"(%p %s)
\n
"
,
pCF
,
debugstr_w
(
pszProtocol
));
if
(
!
pCF
||
!
pszProtocol
)
return
E_INVALIDARG
;
for
(
iter
=
name_space_list
;
iter
;
iter
=
iter
->
next
)
{
if
(
iter
->
cf
==
pCF
&&
!
strcmpW
(
iter
->
protocol
,
pszProtocol
))
break
;
last
=
iter
;
}
if
(
!
iter
)
return
S_OK
;
if
(
last
)
last
->
next
=
iter
->
next
;
else
name_space_list
=
iter
->
next
;
IClassFactory_Release
(
iter
->
cf
);
heap_free
(
iter
->
protocol
);
heap_free
(
iter
);
return
S_OK
;
return
unregister_namespace
(
pCF
,
pszProtocol
,
FALSE
);
}
static
HRESULT
WINAPI
InternetSession_RegisterMimeFilter
(
IInternetSession
*
iface
,
...
...
dlls/urlmon/urlmon_main.c
View file @
2b90a7d6
...
...
@@ -210,31 +210,14 @@ static const struct object_creation_info object_creation[] =
static
void
init_session
(
BOOL
init
)
{
IInternetSession
*
session
;
int
i
;
CoInternetGetSession
(
0
,
&
session
,
0
);
for
(
i
=
0
;
i
<
sizeof
(
object_creation
)
/
sizeof
(
object_creation
[
0
]);
i
++
)
{
if
(
object_creation
[
i
].
protocol
)
{
if
(
init
)
{
IInternetSession_RegisterNameSpace
(
session
,
object_creation
[
i
].
cf
,
object_creation
[
i
].
clsid
,
object_creation
[
i
].
protocol
,
0
,
NULL
,
0
);
/* make sure that the AddRef on the class factory doesn't keep us loaded */
URLMON_UnlockModule
();
}
else
{
/* make sure that the Release on the class factory doesn't unload us */
URLMON_LockModule
();
IInternetSession_UnregisterNameSpace
(
session
,
object_creation
[
i
].
cf
,
object_creation
[
i
].
protocol
);
}
}
}
IInternetSession_Release
(
session
);
if
(
object_creation
[
i
].
protocol
)
register_urlmon_namespace
(
object_creation
[
i
].
cf
,
object_creation
[
i
].
clsid
,
object_creation
[
i
].
protocol
,
init
);
}
}
/*******************************************************************************
...
...
dlls/urlmon/urlmon_main.h
View file @
2b90a7d6
...
...
@@ -68,6 +68,7 @@ void UMCloseCacheFileStream(IUMCacheStream *pstr);
IInternetProtocolInfo
*
get_protocol_info
(
LPCWSTR
url
);
HRESULT
get_protocol_handler
(
LPCWSTR
url
,
CLSID
*
clsid
,
IClassFactory
**
ret
);
BOOL
is_registered_protocol
(
LPCWSTR
);
void
register_urlmon_namespace
(
IClassFactory
*
,
REFIID
,
LPCWSTR
,
BOOL
);
HRESULT
bind_to_storage
(
LPCWSTR
url
,
IBindCtx
*
pbc
,
REFIID
riid
,
void
**
ppv
);
HRESULT
bind_to_object
(
IMoniker
*
mon
,
LPCWSTR
url
,
IBindCtx
*
pbc
,
REFIID
riid
,
void
**
ppv
);
...
...
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