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
6db2cf1b
Commit
6db2cf1b
authored
Sep 02, 2010
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 02, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
urlmon: Use StartEx in file protocol handler's Start implementation.
parent
d8bfb7f8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
92 deletions
+6
-92
file.c
dlls/urlmon/file.c
+6
-92
No files found.
dlls/urlmon/file.c
View file @
6db2cf1b
...
...
@@ -102,107 +102,21 @@ static HRESULT WINAPI FileProtocol_Start(IInternetProtocolEx *iface, LPCWSTR szU
DWORD
grfPI
,
HANDLE_PTR
dwReserved
)
{
FileProtocol
*
This
=
PROTOCOL_THIS
(
iface
);
BINDINFO
bindinfo
;
DWORD
grfBINDF
=
0
;
LARGE_INTEGER
size
;
DWORD
len
;
LPWSTR
url
,
mime
=
NULL
,
file_name
;
WCHAR
null_char
=
0
;
BOOL
first_call
=
FALSE
;
IUri
*
uri
;
HRESULT
hres
;
static
const
WCHAR
wszFile
[]
=
{
'f'
,
'i'
,
'l'
,
'e'
,
':'
};
TRACE
(
"(%p)->(%s %p %p %08x %lx)
\n
"
,
This
,
debugstr_w
(
szUrl
),
pOIProtSink
,
pOIBindInfo
,
grfPI
,
dwReserved
);
if
(
!
szUrl
||
strlenW
(
szUrl
)
<
sizeof
(
wszFile
)
/
sizeof
(
WCHAR
)
||
memcmp
(
szUrl
,
wszFile
,
sizeof
(
wszFile
)))
return
E_INVALIDARG
;
memset
(
&
bindinfo
,
0
,
sizeof
(
bindinfo
));
bindinfo
.
cbSize
=
sizeof
(
BINDINFO
);
hres
=
IInternetBindInfo_GetBindInfo
(
pOIBindInfo
,
&
grfBINDF
,
&
bindinfo
);
if
(
FAILED
(
hres
))
{
WARN
(
"GetBindInfo failed: %08x
\n
"
,
hres
);
hres
=
CreateUri
(
szUrl
,
Uri_CREATE_FILE_USE_DOS_PATH
,
0
,
&
uri
);
if
(
FAILED
(
hres
))
return
hres
;
}
ReleaseBindInfo
(
&
bindinfo
);
hres
=
IInternetProtocolEx_StartEx
(
PROTOCOLEX
(
This
),
uri
,
pOIProtSink
,
pOIBindInfo
,
grfPI
,
(
HANDLE
*
)
dwReserved
);
len
=
lstrlenW
(
szUrl
)
+
16
;
url
=
heap_alloc
(
len
*
sizeof
(
WCHAR
));
hres
=
CoInternetParseUrl
(
szUrl
,
PARSE_ENCODE
,
0
,
url
,
len
,
&
len
,
0
);
if
(
FAILED
(
hres
))
{
heap_free
(
url
);
IUri_Release
(
uri
);
return
hres
;
}
if
(
!
(
grfBINDF
&
BINDF_FROMURLMON
))
IInternetProtocolSink_ReportProgress
(
pOIProtSink
,
BINDSTATUS_DIRECTBIND
,
NULL
);
if
(
This
->
file
==
INVALID_HANDLE_VALUE
)
{
WCHAR
*
ptr
;
first_call
=
TRUE
;
IInternetProtocolSink_ReportProgress
(
pOIProtSink
,
BINDSTATUS_SENDINGREQUEST
,
&
null_char
);
file_name
=
url
+
sizeof
(
wszFile
)
/
sizeof
(
WCHAR
);
/* Strip both forward and back slashes */
if
(
(
file_name
[
0
]
==
'/'
&&
file_name
[
1
]
==
'/'
)
||
(
file_name
[
0
]
==
'\\'
&&
file_name
[
1
]
==
'\\'
))
file_name
+=
2
;
if
(
*
file_name
==
'/'
)
file_name
++
;
for
(
ptr
=
file_name
;
*
ptr
;
ptr
++
)
{
if
(
*
ptr
==
'?'
||
*
ptr
==
'#'
)
{
*
ptr
=
0
;
break
;
}
}
if
(
file_name
[
1
]
==
'|'
)
file_name
[
1
]
=
':'
;
This
->
file
=
CreateFileW
(
file_name
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
This
->
file
==
INVALID_HANDLE_VALUE
)
{
IInternetProtocolSink_ReportResult
(
pOIProtSink
,
INET_E_RESOURCE_NOT_FOUND
,
GetLastError
(),
NULL
);
heap_free
(
url
);
return
INET_E_RESOURCE_NOT_FOUND
;
}
IInternetProtocolSink_ReportProgress
(
pOIProtSink
,
BINDSTATUS_CACHEFILENAMEAVAILABLE
,
file_name
);
hres
=
FindMimeFromData
(
NULL
,
url
,
NULL
,
0
,
NULL
,
0
,
&
mime
,
0
);
if
(
SUCCEEDED
(
hres
))
{
IInternetProtocolSink_ReportProgress
(
pOIProtSink
,
(
grfBINDF
&
BINDF_FROMURLMON
)
?
BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE
:
BINDSTATUS_MIMETYPEAVAILABLE
,
mime
);
CoTaskMemFree
(
mime
);
}
}
heap_free
(
url
);
if
(
GetFileSizeEx
(
This
->
file
,
&
size
))
{
This
->
size
=
size
.
u
.
LowPart
;
IInternetProtocolSink_ReportData
(
pOIProtSink
,
BSCF_FIRSTDATANOTIFICATION
|
BSCF_LASTDATANOTIFICATION
,
This
->
size
,
This
->
size
);
}
if
(
first_call
)
IInternetProtocolSink_ReportResult
(
pOIProtSink
,
S_OK
,
0
,
NULL
);
return
S_OK
;
}
static
HRESULT
WINAPI
FileProtocol_Continue
(
IInternetProtocolEx
*
iface
,
PROTOCOLDATA
*
pProtocolData
)
...
...
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