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
d597fd12
Commit
d597fd12
authored
Mar 03, 2008
by
Jacek Caban
Committed by
Alexandre Julliard
Mar 03, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Moved InternetReadFileExA to vtbl.
parent
4fd668d0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
134 deletions
+86
-134
ftp.c
dlls/wininet/ftp.c
+3
-0
http.c
dlls/wininet/http.c
+69
-0
internet.c
dlls/wininet/internet.c
+13
-134
internet.h
dlls/wininet/internet.h
+1
-0
No files found.
dlls/wininet/ftp.c
View file @
d597fd12
...
...
@@ -1246,6 +1246,7 @@ static const HANDLEHEADERVtbl FTPFILEVtbl = {
NULL
,
NULL
,
FTPFILE_ReadFile
,
NULL
,
FTPFILE_WriteFile
,
NULL
,
NULL
...
...
@@ -2169,6 +2170,7 @@ static const HANDLEHEADERVtbl FTPSESSIONVtbl = {
NULL
,
NULL
,
NULL
,
NULL
,
NULL
};
...
...
@@ -3256,6 +3258,7 @@ static const HANDLEHEADERVtbl FTPFINDNEXTVtbl = {
NULL
,
NULL
,
NULL
,
NULL
,
FTPFINDNEXT_FindNextFileW
};
...
...
dlls/wininet/http.c
View file @
d597fd12
...
...
@@ -1431,6 +1431,73 @@ static DWORD HTTPREQ_ReadFile(WININETHANDLEHEADER *hdr, void *buffer, DWORD size
return
HTTPREQ_Read
(
req
,
buffer
,
size
,
read
,
TRUE
);
}
static
void
HTTPREQ_AsyncReadFileExProc
(
WORKREQUEST
*
workRequest
)
{
struct
WORKREQ_INTERNETREADFILEEXA
const
*
data
=
&
workRequest
->
u
.
InternetReadFileExA
;
WININETHTTPREQW
*
req
=
(
WININETHTTPREQW
*
)
workRequest
->
hdr
;
INTERNET_ASYNC_RESULT
iar
;
DWORD
res
;
TRACE
(
"INTERNETREADFILEEXA %p
\n
"
,
workRequest
->
hdr
);
res
=
HTTPREQ_Read
(
req
,
data
->
lpBuffersOut
->
lpvBuffer
,
data
->
lpBuffersOut
->
dwBufferLength
,
&
data
->
lpBuffersOut
->
dwBufferLength
,
TRUE
);
iar
.
dwResult
=
res
==
ERROR_SUCCESS
;
iar
.
dwError
=
res
;
INTERNET_SendCallback
(
&
req
->
hdr
,
req
->
hdr
.
dwContext
,
INTERNET_STATUS_REQUEST_COMPLETE
,
&
iar
,
sizeof
(
INTERNET_ASYNC_RESULT
));
}
static
DWORD
HTTPREQ_ReadFileExA
(
WININETHANDLEHEADER
*
hdr
,
INTERNET_BUFFERSA
*
buffers
,
DWORD
flags
,
DWORD_PTR
context
)
{
WININETHTTPREQW
*
req
=
(
WININETHTTPREQW
*
)
hdr
;
DWORD
res
;
if
(
flags
&
~
(
IRF_ASYNC
|
IRF_NO_WAIT
))
FIXME
(
"these dwFlags aren't implemented: 0x%x
\n
"
,
flags
&
~
(
IRF_ASYNC
|
IRF_NO_WAIT
));
if
(
buffers
->
dwStructSize
!=
sizeof
(
*
buffers
))
return
ERROR_INVALID_PARAMETER
;
INTERNET_SendCallback
(
&
req
->
hdr
,
req
->
hdr
.
dwContext
,
INTERNET_STATUS_RECEIVING_RESPONSE
,
NULL
,
0
);
/* FIXME: IRF_ASYNC may not be the right thing to test here;
* hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC is probably better */
if
(
flags
&
IRF_ASYNC
)
{
DWORD
available
=
0
;
NETCON_query_data_available
(
&
req
->
netConnection
,
&
available
);
if
(
!
available
)
{
WORKREQUEST
workRequest
;
workRequest
.
asyncproc
=
HTTPREQ_AsyncReadFileExProc
;
workRequest
.
hdr
=
WININET_AddRef
(
&
req
->
hdr
);
workRequest
.
u
.
InternetReadFileExA
.
lpBuffersOut
=
buffers
;
INTERNET_AsyncCall
(
&
workRequest
);
return
ERROR_IO_PENDING
;
}
}
res
=
HTTPREQ_Read
(
req
,
buffers
->
lpvBuffer
,
buffers
->
dwBufferLength
,
&
buffers
->
dwBufferLength
,
!
(
flags
&
IRF_NO_WAIT
));
if
(
res
==
ERROR_SUCCESS
)
{
DWORD
size
=
buffers
->
dwBufferLength
;
INTERNET_SendCallback
(
&
req
->
hdr
,
req
->
hdr
.
dwContext
,
INTERNET_STATUS_RESPONSE_RECEIVED
,
&
size
,
sizeof
(
size
));
}
return
res
;
}
static
BOOL
HTTPREQ_WriteFile
(
WININETHANDLEHEADER
*
hdr
,
const
void
*
buffer
,
DWORD
size
,
DWORD
*
written
)
{
LPWININETHTTPREQW
lpwhr
=
(
LPWININETHTTPREQW
)
hdr
;
...
...
@@ -1493,6 +1560,7 @@ static const HANDLEHEADERVtbl HTTPREQVtbl = {
HTTPREQ_CloseConnection
,
HTTPREQ_SetOption
,
HTTPREQ_ReadFile
,
HTTPREQ_ReadFileExA
,
HTTPREQ_WriteFile
,
HTTPREQ_QueryDataAvailable
,
NULL
...
...
@@ -3041,6 +3109,7 @@ static const HANDLEHEADERVtbl HTTPSESSIONVtbl = {
NULL
,
NULL
,
NULL
,
NULL
,
NULL
};
...
...
dlls/wininet/internet.c
View file @
d597fd12
...
...
@@ -478,6 +478,7 @@ static const HANDLEHEADERVtbl APPINFOVtbl = {
NULL
,
NULL
,
NULL
,
NULL
,
NULL
};
...
...
@@ -1700,61 +1701,6 @@ BOOL WINAPI InternetWriteFile(HINTERNET hFile, LPCVOID lpBuffer,
}
static
BOOL
INTERNET_ReadFile
(
LPWININETHANDLEHEADER
lpwh
,
LPVOID
lpBuffer
,
DWORD
dwNumOfBytesToRead
,
LPDWORD
pdwNumOfBytesRead
,
BOOL
bWait
)
{
BOOL
retval
=
FALSE
;
int
bytes_read
;
LPWININETHTTPREQW
lpwhr
;
switch
(
lpwh
->
htype
)
{
case
WH_HHTTPREQ
:
lpwhr
=
(
LPWININETHTTPREQW
)
lpwh
;
if
(
!
NETCON_recv
(
&
lpwhr
->
netConnection
,
lpBuffer
,
min
(
dwNumOfBytesToRead
,
lpwhr
->
dwContentLength
-
lpwhr
->
dwContentRead
),
bWait
?
MSG_WAITALL
:
0
,
&
bytes_read
))
{
if
(((
lpwhr
->
dwContentLength
!=
-
1
)
&&
(
lpwhr
->
dwContentRead
!=
lpwhr
->
dwContentLength
)))
ERR
(
"not all data received %d/%d
\n
"
,
lpwhr
->
dwContentRead
,
lpwhr
->
dwContentLength
);
/* always returns TRUE, even if the network layer returns an
* error */
*
pdwNumOfBytesRead
=
0
;
HTTP_FinishedReading
(
lpwhr
);
retval
=
TRUE
;
}
else
{
lpwhr
->
dwContentRead
+=
bytes_read
;
*
pdwNumOfBytesRead
=
bytes_read
;
if
(
lpwhr
->
lpszCacheFile
)
{
BOOL
res
;
res
=
WriteFile
(
lpwhr
->
hCacheFile
,
lpBuffer
,
bytes_read
,
NULL
,
NULL
);
if
(
!
res
)
WARN
(
"WriteFile failed: %u
\n
"
,
GetLastError
());
}
if
(
!
bytes_read
&&
(
lpwhr
->
dwContentRead
==
lpwhr
->
dwContentLength
))
retval
=
HTTP_FinishedReading
(
lpwhr
);
else
retval
=
TRUE
;
}
break
;
default:
break
;
}
return
retval
;
}
/***********************************************************************
* InternetReadFile (WININET.@)
*
...
...
@@ -1819,98 +1765,31 @@ BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer,
* SEE
* InternetOpenUrlA(), HttpOpenRequestA()
*/
void
AsyncInternetReadFileExProc
(
WORKREQUEST
*
workRequest
)
{
struct
WORKREQ_INTERNETREADFILEEXA
const
*
req
=
&
workRequest
->
u
.
InternetReadFileExA
;
INTERNET_ASYNC_RESULT
iar
;
BOOL
res
;
TRACE
(
"INTERNETREADFILEEXA %p
\n
"
,
workRequest
->
hdr
);
res
=
INTERNET_ReadFile
(
workRequest
->
hdr
,
req
->
lpBuffersOut
->
lpvBuffer
,
req
->
lpBuffersOut
->
dwBufferLength
,
&
req
->
lpBuffersOut
->
dwBufferLength
,
TRUE
);
iar
.
dwResult
=
res
;
iar
.
dwError
=
res
?
ERROR_SUCCESS
:
INTERNET_GetLastError
();
INTERNET_SendCallback
(
workRequest
->
hdr
,
workRequest
->
hdr
->
dwContext
,
INTERNET_STATUS_REQUEST_COMPLETE
,
&
iar
,
sizeof
(
INTERNET_ASYNC_RESULT
));
}
BOOL
WINAPI
InternetReadFileExA
(
HINTERNET
hFile
,
LPINTERNET_BUFFERSA
lpBuffersOut
,
DWORD
dwFlags
,
DWORD_PTR
dwContext
)
{
BOOL
retval
=
FALSE
;
LPWININETHANDLEHEADER
lpwh
;
LPWININETHANDLEHEADER
hdr
;
DWORD
res
=
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
;
TRACE
(
"(%p %p 0x%x 0x%lx)
\n
"
,
hFile
,
lpBuffersOut
,
dwFlags
,
dwContext
);
if
(
dwFlags
&
~
(
IRF_ASYNC
|
IRF_NO_WAIT
))
FIXME
(
"these dwFlags aren't implemented: 0x%x
\n
"
,
dwFlags
&
~
(
IRF_ASYNC
|
IRF_NO_WAIT
));
if
(
lpBuffersOut
->
dwStructSize
!=
sizeof
(
*
lpBuffersOut
))
{
INTERNET_SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
lpwh
=
(
LPWININETHANDLEHEADER
)
WININET_GetObject
(
hFile
);
if
(
!
lpwh
)
{
hdr
=
WININET_GetObject
(
hFile
);
if
(
!
hdr
)
{
INTERNET_SetLastError
(
ERROR_INVALID_HANDLE
);
return
FALSE
;
}
INTERNET_SendCallback
(
lpwh
,
lpwh
->
dwContext
,
INTERNET_STATUS_RECEIVING_RESPONSE
,
NULL
,
0
);
/* FIXME: IRF_ASYNC may not be the right thing to test here;
* hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC is probably better */
if
(
dwFlags
&
IRF_ASYNC
)
{
DWORD
dwDataAvailable
=
0
;
if
(
lpwh
->
htype
==
WH_HHTTPREQ
)
NETCON_query_data_available
(
&
((
LPWININETHTTPREQW
)
lpwh
)
->
netConnection
,
&
dwDataAvailable
);
if
(
!
dwDataAvailable
)
{
WORKREQUEST
workRequest
;
struct
WORKREQ_INTERNETREADFILEEXA
*
req
;
workRequest
.
asyncproc
=
AsyncInternetReadFileExProc
;
workRequest
.
hdr
=
WININET_AddRef
(
lpwh
);
req
=
&
workRequest
.
u
.
InternetReadFileExA
;
req
->
lpBuffersOut
=
lpBuffersOut
;
if
(
!
INTERNET_AsyncCall
(
&
workRequest
))
WININET_Release
(
lpwh
);
else
INTERNET_SetLastError
(
ERROR_IO_PENDING
);
goto
end
;
}
}
retval
=
INTERNET_ReadFile
(
lpwh
,
lpBuffersOut
->
lpvBuffer
,
lpBuffersOut
->
dwBufferLength
,
&
lpBuffersOut
->
dwBufferLength
,
!
(
dwFlags
&
IRF_NO_WAIT
));
if
(
hdr
->
vtbl
->
ReadFileExA
)
res
=
hdr
->
vtbl
->
ReadFileExA
(
hdr
,
lpBuffersOut
,
dwFlags
,
dwContext
);
if
(
retval
)
{
DWORD
dwBytesReceived
=
lpBuffersOut
->
dwBufferLength
;
INTERNET_SendCallback
(
lpwh
,
lpwh
->
dwContext
,
INTERNET_STATUS_RESPONSE_RECEIVED
,
&
dwBytesReceived
,
sizeof
(
dwBytesReceived
));
}
WININET_Release
(
hdr
);
end:
WININET_Release
(
lpwh
);
TRACE
(
"-- %s (%u, bytes read: %d)
\n
"
,
res
==
ERROR_SUCCESS
?
"TRUE"
:
"FALSE"
,
res
,
lpBuffersOut
->
dwBufferLength
);
TRACE
(
"-- %s (bytes read: %d)
\n
"
,
retval
?
"TRUE"
:
"FALSE"
,
lpBuffersOut
->
dwBufferLength
);
return
retval
;
if
(
res
!=
ERROR_SUCCESS
)
SetLastError
(
res
);
return
res
==
ERROR_SUCCESS
;
}
/***********************************************************************
...
...
dlls/wininet/internet.h
View file @
d597fd12
...
...
@@ -140,6 +140,7 @@ typedef struct {
void
(
*
CloseConnection
)(
WININETHANDLEHEADER
*
);
DWORD
(
*
SetOption
)(
WININETHANDLEHEADER
*
,
DWORD
,
void
*
,
DWORD
);
DWORD
(
*
ReadFile
)(
WININETHANDLEHEADER
*
,
void
*
,
DWORD
,
DWORD
*
);
DWORD
(
*
ReadFileExA
)(
WININETHANDLEHEADER
*
,
INTERNET_BUFFERSA
*
,
DWORD
,
DWORD_PTR
);
BOOL
(
*
WriteFile
)(
WININETHANDLEHEADER
*
,
const
void
*
,
DWORD
,
DWORD
*
);
DWORD
(
*
QueryDataAvailable
)(
WININETHANDLEHEADER
*
,
DWORD
*
,
DWORD
,
DWORD_PTR
);
DWORD
(
*
FindNextFileW
)(
WININETHANDLEHEADER
*
,
void
*
);
...
...
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