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
f165e25e
Commit
f165e25e
authored
Feb 02, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
Feb 03, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Handles handling clean up.
parent
e1815f5e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
132 additions
and
110 deletions
+132
-110
dialogs.c
dlls/wininet/dialogs.c
+3
-3
ftp.c
dlls/wininet/ftp.c
+25
-18
http.c
dlls/wininet/http.c
+11
-15
internet.c
dlls/wininet/internet.c
+66
-71
internet.h
dlls/wininet/internet.h
+27
-3
No files found.
dlls/wininet/dialogs.c
View file @
f165e25e
...
...
@@ -70,7 +70,7 @@ static BOOL WININET_GetProxyServer( HINTERNET hRequest, LPWSTR szBuf, DWORD sz )
BOOL
ret
=
FALSE
;
LPWSTR
p
;
lpwhr
=
(
http_request_t
*
)
WININET_GetO
bject
(
hRequest
);
lpwhr
=
(
http_request_t
*
)
get_handle_o
bject
(
hRequest
);
if
(
NULL
==
lpwhr
)
return
FALSE
;
...
...
@@ -107,7 +107,7 @@ static BOOL WININET_GetServer( HINTERNET hRequest, LPWSTR szBuf, DWORD sz )
http_session_t
*
lpwhs
=
NULL
;
BOOL
ret
=
FALSE
;
lpwhr
=
(
http_request_t
*
)
WININET_GetO
bject
(
hRequest
);
lpwhr
=
(
http_request_t
*
)
get_handle_o
bject
(
hRequest
);
if
(
NULL
==
lpwhr
)
return
FALSE
;
...
...
@@ -246,7 +246,7 @@ static BOOL WININET_SetAuthorization( HINTERNET hRequest, LPWSTR username,
BOOL
ret
=
FALSE
;
LPWSTR
p
,
q
;
lpwhr
=
(
http_request_t
*
)
WININET_GetO
bject
(
hRequest
);
lpwhr
=
(
http_request_t
*
)
get_handle_o
bject
(
hRequest
);
if
(
!
lpwhr
)
return
FALSE
;
...
...
dlls/wininet/ftp.c
View file @
f165e25e
...
...
@@ -288,7 +288,7 @@ BOOL WINAPI FtpPutFileW(HINTERNET hConnect, LPCWSTR lpszLocalFile,
return
FALSE
;
}
lpwfs
=
(
ftp_session_t
*
)
WININET_GetO
bject
(
hConnect
);
lpwfs
=
(
ftp_session_t
*
)
get_handle_o
bject
(
hConnect
);
if
(
!
lpwfs
)
{
INTERNET_SetLastError
(
ERROR_INVALID_HANDLE
);
...
...
@@ -470,7 +470,7 @@ BOOL WINAPI FtpSetCurrentDirectoryW(HINTERNET hConnect, LPCWSTR lpszDirectory)
goto
lend
;
}
lpwfs
=
(
ftp_session_t
*
)
WININET_GetO
bject
(
hConnect
);
lpwfs
=
(
ftp_session_t
*
)
get_handle_o
bject
(
hConnect
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
...
...
@@ -610,7 +610,7 @@ BOOL WINAPI FtpCreateDirectoryW(HINTERNET hConnect, LPCWSTR lpszDirectory)
appinfo_t
*
hIC
=
NULL
;
BOOL
r
=
FALSE
;
lpwfs
=
(
ftp_session_t
*
)
WININET_GetO
bject
(
hConnect
);
lpwfs
=
(
ftp_session_t
*
)
get_handle_o
bject
(
hConnect
);
if
(
!
lpwfs
)
{
INTERNET_SetLastError
(
ERROR_INVALID_HANDLE
);
...
...
@@ -766,7 +766,7 @@ HINTERNET WINAPI FtpFindFirstFileW(HINTERNET hConnect,
appinfo_t
*
hIC
=
NULL
;
HINTERNET
r
=
NULL
;
lpwfs
=
(
ftp_session_t
*
)
WININET_GetO
bject
(
hConnect
);
lpwfs
=
(
ftp_session_t
*
)
get_handle_o
bject
(
hConnect
);
if
(
NULL
==
lpwfs
||
WH_HFTPSESSION
!=
lpwfs
->
hdr
.
htype
)
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
...
...
@@ -964,7 +964,7 @@ BOOL WINAPI FtpGetCurrentDirectoryW(HINTERNET hFtpSession, LPWSTR lpszCurrentDir
TRACE
(
"%p %p %p
\n
"
,
hFtpSession
,
lpszCurrentDirectory
,
lpdwCurrentDirectory
);
lpwfs
=
(
ftp_session_t
*
)
WININET_GetO
bject
(
hFtpSession
);
lpwfs
=
(
ftp_session_t
*
)
get_handle_o
bject
(
hFtpSession
);
if
(
NULL
==
lpwfs
)
{
INTERNET_SetLastError
(
ERROR_INVALID_HANDLE
);
...
...
@@ -1327,6 +1327,7 @@ static HINTERNET FTP_FtpOpenFileW(ftp_session_t *lpwfs,
ftp_file_t
*
lpwh
=
NULL
;
appinfo_t
*
hIC
=
NULL
;
HINTERNET
handle
=
NULL
;
DWORD
res
=
ERROR_SUCCESS
;
TRACE
(
"
\n
"
);
...
...
@@ -1364,8 +1365,8 @@ static HINTERNET FTP_FtpOpenFileW(ftp_session_t *lpwfs,
lpwh
->
lpFtpSession
=
lpwfs
;
list_add_head
(
&
lpwfs
->
hdr
.
children
,
&
lpwh
->
hdr
.
entry
);
handle
=
WININET_AllocHandle
(
&
lpwh
->
hdr
);
if
(
!
handle
)
res
=
alloc_handle
(
&
lpwh
->
hdr
,
&
handle
);
if
(
res
!=
ERROR_SUCCESS
)
goto
lend
;
/* Indicate that a download is currently in progress */
...
...
@@ -1440,6 +1441,8 @@ lend:
if
(
lpwh
)
WININET_Release
(
&
lpwh
->
hdr
);
if
(
res
!=
ERROR_SUCCESS
)
INTERNET_SetLastError
(
res
);
return
handle
;
}
...
...
@@ -1501,7 +1504,7 @@ HINTERNET WINAPI FtpOpenFileW(HINTERNET hFtpSession,
TRACE
(
"(%p,%s,0x%08x,0x%08x,0x%08lx)
\n
"
,
hFtpSession
,
debugstr_w
(
lpszFileName
),
fdwAccess
,
dwFlags
,
dwContext
);
lpwfs
=
(
ftp_session_t
*
)
WININET_GetO
bject
(
hFtpSession
);
lpwfs
=
(
ftp_session_t
*
)
get_handle_o
bject
(
hFtpSession
);
if
(
!
lpwfs
)
{
INTERNET_SetLastError
(
ERROR_INVALID_HANDLE
);
...
...
@@ -1624,7 +1627,7 @@ BOOL WINAPI FtpGetFileW(HINTERNET hInternet, LPCWSTR lpszRemoteFile, LPCWSTR lps
return
FALSE
;
}
lpwfs
=
(
ftp_session_t
*
)
WININET_GetO
bject
(
hInternet
);
lpwfs
=
(
ftp_session_t
*
)
get_handle_o
bject
(
hInternet
);
if
(
!
lpwfs
)
{
INTERNET_SetLastError
(
ERROR_INVALID_HANDLE
);
...
...
@@ -1818,7 +1821,7 @@ BOOL WINAPI FtpDeleteFileW(HINTERNET hFtpSession, LPCWSTR lpszFileName)
appinfo_t
*
hIC
=
NULL
;
BOOL
r
=
FALSE
;
lpwfs
=
(
ftp_session_t
*
)
WININET_GetO
bject
(
hFtpSession
);
lpwfs
=
(
ftp_session_t
*
)
get_handle_o
bject
(
hFtpSession
);
if
(
!
lpwfs
)
{
INTERNET_SetLastError
(
ERROR_INVALID_HANDLE
);
...
...
@@ -1963,7 +1966,7 @@ BOOL WINAPI FtpRemoveDirectoryW(HINTERNET hFtpSession, LPCWSTR lpszDirectory)
appinfo_t
*
hIC
=
NULL
;
BOOL
r
=
FALSE
;
lpwfs
=
(
ftp_session_t
*
)
WININET_GetO
bject
(
hFtpSession
);
lpwfs
=
(
ftp_session_t
*
)
get_handle_o
bject
(
hFtpSession
);
if
(
!
lpwfs
)
{
INTERNET_SetLastError
(
ERROR_INVALID_HANDLE
);
...
...
@@ -2113,7 +2116,7 @@ BOOL WINAPI FtpRenameFileW(HINTERNET hFtpSession, LPCWSTR lpszSrc, LPCWSTR lpszD
appinfo_t
*
hIC
=
NULL
;
BOOL
r
=
FALSE
;
lpwfs
=
(
ftp_session_t
*
)
WININET_GetO
bject
(
hFtpSession
);
lpwfs
=
(
ftp_session_t
*
)
get_handle_o
bject
(
hFtpSession
);
if
(
!
lpwfs
)
{
INTERNET_SetLastError
(
ERROR_INVALID_HANDLE
);
...
...
@@ -2279,7 +2282,7 @@ BOOL WINAPI FtpCommandW( HINTERNET hConnect, BOOL fExpectResponse, DWORD dwFlags
return
FALSE
;
}
lpwfs
=
(
ftp_session_t
*
)
WININET_GetO
bject
(
hConnect
);
lpwfs
=
(
ftp_session_t
*
)
get_handle_o
bject
(
hConnect
);
if
(
!
lpwfs
)
{
INTERNET_SetLastError
(
ERROR_INVALID_HANDLE
);
...
...
@@ -2451,6 +2454,7 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName,
ftp_session_t
*
lpwfs
=
NULL
;
HINTERNET
handle
=
NULL
;
char
szaddr
[
INET_ADDRSTRLEN
];
DWORD
res
;
TRACE
(
"%p Server(%s) Port(%d) User(%s) Paswd(%s)
\n
"
,
hIC
,
debugstr_w
(
lpszServerName
),
...
...
@@ -2492,11 +2496,11 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName,
lpwfs
->
lpAppInfo
=
hIC
;
list_add_head
(
&
hIC
->
hdr
.
children
,
&
lpwfs
->
hdr
.
entry
);
handle
=
WININET_AllocHandle
(
&
lpwfs
->
hdr
);
if
(
!
handle
)
res
=
alloc_handle
(
&
lpwfs
->
hdr
,
&
handle
);
if
(
res
!=
ERROR_SUCCESS
)
{
ERR
(
"Failed to alloc handle
\n
"
);
INTERNET_SetLastError
(
ERROR_OUTOFMEMORY
);
INTERNET_SetLastError
(
res
);
goto
lerror
;
}
...
...
@@ -2604,7 +2608,7 @@ lerror:
if
(
!
bSuccess
&&
handle
)
{
WININET_FreeHandle
(
handle
);
InternetCloseHandle
(
handle
);
handle
=
NULL
;
}
...
...
@@ -3531,6 +3535,7 @@ static HINTERNET FTP_ReceiveFileList(ftp_session_t *lpwfs, INT nSocket, LPCWSTR
LPFILEPROPERTIESW
lpafp
=
NULL
;
LPWININETFTPFINDNEXTW
lpwfn
=
NULL
;
HINTERNET
handle
=
0
;
DWORD
res
;
TRACE
(
"(%p,%d,%s,%p,%08lx)
\n
"
,
lpwfs
,
nSocket
,
debugstr_w
(
lpszSearchFile
),
lpFindFileData
,
dwContext
);
...
...
@@ -3555,7 +3560,9 @@ static HINTERNET FTP_ReceiveFileList(ftp_session_t *lpwfs, INT nSocket, LPCWSTR
lpwfn
->
lpFtpSession
=
lpwfs
;
list_add_head
(
&
lpwfs
->
hdr
.
children
,
&
lpwfn
->
hdr
.
entry
);
handle
=
WININET_AllocHandle
(
&
lpwfn
->
hdr
);
res
=
alloc_handle
(
&
lpwfn
->
hdr
,
&
handle
);
if
(
res
!=
ERROR_SUCCESS
)
SetLastError
(
res
);
}
}
...
...
dlls/wininet/http.c
View file @
f165e25e
...
...
@@ -1066,7 +1066,7 @@ BOOL WINAPI HttpAddRequestHeadersW(HINTERNET hHttpRequest,
if
(
!
lpszHeader
)
return
TRUE
;
lpwhr
=
(
http_request_t
*
)
WININET_GetO
bject
(
hHttpRequest
);
lpwhr
=
(
http_request_t
*
)
get_handle_o
bject
(
hHttpRequest
);
if
(
lpwhr
&&
lpwhr
->
hdr
.
htype
==
WH_HHTTPREQ
)
res
=
HTTP_HttpAddRequestHeadersW
(
lpwhr
,
lpszHeader
,
dwHeaderLength
,
dwModifier
);
if
(
lpwhr
)
...
...
@@ -2604,12 +2604,9 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *lpwhs,
goto
lend
;
}
handle
=
WININET_AllocHandle
(
&
lpwhr
->
hdr
);
if
(
NULL
==
handle
)
{
res
=
ERROR_OUTOFMEMORY
;
res
=
alloc_handle
(
&
lpwhr
->
hdr
,
&
handle
);
if
(
res
!=
ERROR_SUCCESS
)
goto
lend
;
}
if
((
res
=
NETCON_init
(
&
lpwhr
->
netConnection
,
dwFlags
&
INTERNET_FLAG_SECURE
))
!=
ERROR_SUCCESS
)
{
...
...
@@ -2727,7 +2724,7 @@ HINTERNET WINAPI HttpOpenRequestW(HINTERNET hHttpSession,
TRACE
(
"
\t
accept type: %s
\n
"
,
debugstr_w
(
lpszAcceptTypes
[
i
]));
}
lpwhs
=
(
http_session_t
*
)
WININET_GetO
bject
(
hHttpSession
);
lpwhs
=
(
http_session_t
*
)
get_handle_o
bject
(
hHttpSession
);
if
(
NULL
==
lpwhs
||
lpwhs
->
hdr
.
htype
!=
WH_HHTTPSESSION
)
{
res
=
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
;
...
...
@@ -3174,7 +3171,7 @@ BOOL WINAPI HttpQueryInfoW(HINTERNET hHttpRequest, DWORD dwInfoLevel,
TRACE
(
"
\n
"
);
}
lpwhr
=
(
http_request_t
*
)
WININET_GetO
bject
(
hHttpRequest
);
lpwhr
=
(
http_request_t
*
)
get_handle_o
bject
(
hHttpRequest
);
if
(
NULL
==
lpwhr
||
lpwhr
->
hdr
.
htype
!=
WH_HHTTPREQ
)
{
res
=
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
;
...
...
@@ -4045,7 +4042,7 @@ BOOL WINAPI HttpEndRequestW(HINTERNET hRequest,
return
FALSE
;
}
lpwhr
=
(
http_request_t
*
)
WININET_GetO
bject
(
hRequest
);
lpwhr
=
(
http_request_t
*
)
get_handle_o
bject
(
hRequest
);
if
(
NULL
==
lpwhr
||
lpwhr
->
hdr
.
htype
!=
WH_HHTTPREQ
)
{
...
...
@@ -4160,7 +4157,7 @@ BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest,
TRACE
(
"(%p, %p, %p, %08x, %08lx)
\n
"
,
hRequest
,
lpBuffersIn
,
lpBuffersOut
,
dwFlags
,
dwContext
);
lpwhr
=
(
http_request_t
*
)
WININET_GetO
bject
(
hRequest
);
lpwhr
=
(
http_request_t
*
)
get_handle_o
bject
(
hRequest
);
if
(
NULL
==
lpwhr
||
lpwhr
->
hdr
.
htype
!=
WH_HHTTPREQ
)
{
...
...
@@ -4259,7 +4256,7 @@ BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders,
TRACE
(
"%p, %s, %i, %p, %i)
\n
"
,
hHttpRequest
,
debugstr_wn
(
lpszHeaders
,
dwHeaderLength
),
dwHeaderLength
,
lpOptional
,
dwOptionalLength
);
lpwhr
=
(
http_request_t
*
)
WININET_GetO
bject
(
hHttpRequest
);
lpwhr
=
(
http_request_t
*
)
get_handle_o
bject
(
hHttpRequest
);
if
(
NULL
==
lpwhr
||
lpwhr
->
hdr
.
htype
!=
WH_HHTTPREQ
)
{
res
=
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
;
...
...
@@ -4444,7 +4441,7 @@ DWORD HTTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName,
{
http_session_t
*
lpwhs
=
NULL
;
HINTERNET
handle
=
NULL
;
DWORD
res
=
ERROR_SUCCESS
;
DWORD
res
;
TRACE
(
"-->
\n
"
);
...
...
@@ -4473,11 +4470,10 @@ DWORD HTTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName,
lpwhs
->
lpAppInfo
=
hIC
;
list_add_head
(
&
hIC
->
hdr
.
children
,
&
lpwhs
->
hdr
.
entry
);
handle
=
WININET_AllocHandle
(
&
lpwhs
->
hdr
);
if
(
NULL
==
handle
)
res
=
alloc_handle
(
&
lpwhs
->
hdr
,
&
handle
);
if
(
res
!=
ERROR_SUCCESS
)
{
ERR
(
"Failed to alloc handle
\n
"
);
res
=
ERROR_OUTOFMEMORY
;
goto
lerror
;
}
...
...
dlls/wininet/internet.c
View file @
f165e25e
This diff is collapsed.
Click to expand it.
dlls/wininet/internet.h
View file @
f165e25e
...
...
@@ -58,6 +58,31 @@ typedef struct
DWORD
security_flags
;
}
WININET_NETCONNECTION
;
static
inline
void
*
__WINE_ALLOC_SIZE
(
1
)
heap_alloc
(
size_t
len
)
{
return
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
}
static
inline
void
*
__WINE_ALLOC_SIZE
(
1
)
heap_alloc_zero
(
size_t
len
)
{
return
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
len
);
}
static
inline
void
*
__WINE_ALLOC_SIZE
(
2
)
heap_realloc
(
void
*
mem
,
size_t
len
)
{
return
HeapReAlloc
(
GetProcessHeap
(),
0
,
mem
,
len
);
}
static
inline
void
*
__WINE_ALLOC_SIZE
(
2
)
heap_realloc_zero
(
void
*
mem
,
size_t
len
)
{
return
HeapReAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
mem
,
len
);
}
static
inline
BOOL
heap_free
(
void
*
mem
)
{
return
HeapFree
(
GetProcessHeap
(),
0
,
mem
);
}
static
inline
LPWSTR
heap_strdupW
(
LPCWSTR
str
)
{
LPWSTR
ret
=
NULL
;
...
...
@@ -409,11 +434,10 @@ typedef struct WORKREQ
}
WORKREQUEST
,
*
LPWORKREQUEST
;
HINTERNET
WININET_AllocHandle
(
object_header_t
*
info
);
object_header_t
*
WININET_GetO
bject
(
HINTERNET
hinternet
);
DWORD
alloc_handle
(
object_header_t
*
,
HINTERNET
*
);
object_header_t
*
get_handle_o
bject
(
HINTERNET
hinternet
);
object_header_t
*
WININET_AddRef
(
object_header_t
*
info
);
BOOL
WININET_Release
(
object_header_t
*
info
);
BOOL
WININET_FreeHandle
(
HINTERNET
hinternet
);
DWORD
INET_QueryOption
(
object_header_t
*
,
DWORD
,
void
*
,
DWORD
*
,
BOOL
);
...
...
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