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
405e8cda
Commit
405e8cda
authored
Aug 15, 2008
by
Hans Leidekker
Committed by
Alexandre Julliard
Aug 19, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Implement WinHttpOpen and WinHttpCloseHandle.
parent
d5c0ccf9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
157 additions
and
43 deletions
+157
-43
Makefile.in
dlls/winhttp/Makefile.in
+2
-1
main.c
dlls/winhttp/main.c
+0
-36
session.c
dlls/winhttp/session.c
+121
-0
winhttp.c
dlls/winhttp/tests/winhttp.c
+6
-6
winhttp_private.h
dlls/winhttp/winhttp_private.h
+28
-0
No files found.
dlls/winhttp/Makefile.in
View file @
405e8cda
...
...
@@ -8,7 +8,8 @@ IMPORTS = kernel32
C_SRCS
=
\
handle.c
\
main.c
main.c
\
session.c
@MAKE_DLL_RULES@
...
...
dlls/winhttp/main.c
View file @
405e8cda
...
...
@@ -84,16 +84,6 @@ HRESULT WINAPI DllUnregisterServer(void)
}
/***********************************************************************
* WinHttpCheckPlatform (winhttp.@)
*/
BOOL
WINAPI
WinHttpCheckPlatform
(
void
)
{
FIXME
(
"stub
\n
"
);
SetLastError
(
ERROR_NOT_SUPPORTED
);
return
FALSE
;
}
/***********************************************************************
* WinHttpDetectAutoProxyConfigUrl (winhttp.@)
*/
BOOL
WINAPI
WinHttpDetectAutoProxyConfigUrl
(
DWORD
flags
,
LPWSTR
*
url
)
...
...
@@ -127,21 +117,6 @@ BOOL WINAPI WinHttpGetIEProxyConfigForCurrentUser(WINHTTP_CURRENT_USER_IE_PROXY_
}
/***********************************************************************
* WinHttpOpen (winhttp.@)
*/
HINTERNET
WINAPI
WinHttpOpen
(
LPCWSTR
pwszUserAgent
,
DWORD
dwAccessType
,
LPCWSTR
pwszProxyName
,
LPCWSTR
pwszProxyByPass
,
DWORD
dwFlags
)
{
FIXME
(
"(%s, %d, %s, %s, 0x%x): stub
\n
"
,
debugstr_w
(
pwszUserAgent
),
dwAccessType
,
debugstr_w
(
pwszProxyName
),
debugstr_w
(
pwszProxyByPass
),
dwFlags
);
SetLastError
(
ERROR_NOT_SUPPORTED
);
return
NULL
;
}
/***********************************************************************
* WinHttpConnect (winhttp.@)
*/
...
...
@@ -238,17 +213,6 @@ BOOL WINAPI WinHttpReadData (HINTERNET hInternet, LPVOID lpBuffer, DWORD dwNumbe
}
/***********************************************************************
* WinHttpReadData (winhttp.@)
*/
BOOL
WINAPI
WinHttpCloseHandle
(
HINTERNET
hInternet
)
{
FIXME
(
"stub
\n
"
);
SetLastError
(
ERROR_NOT_SUPPORTED
);
return
FALSE
;
}
/***********************************************************************
* WinHttpWriteData (winhttp.@)
*/
BOOL
WINAPI
WinHttpWriteData
(
HINTERNET
hRequest
,
LPCVOID
lpBuffer
,
...
...
dlls/winhttp/session.c
0 → 100644
View file @
405e8cda
/*
* Copyright 2008 Hans Leidekker for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include "wine/debug.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winhttp.h"
#include "winhttp_private.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
winhttp
);
static
void
set_last_error
(
DWORD
error
)
{
/* FIXME */
SetLastError
(
error
);
}
/***********************************************************************
* WinHttpCheckPlatform (winhttp.@)
*/
BOOL
WINAPI
WinHttpCheckPlatform
(
void
)
{
TRACE
(
"
\n
"
);
return
TRUE
;
}
/***********************************************************************
* session_destroy (internal)
*/
static
void
session_destroy
(
object_header_t
*
hdr
)
{
session_t
*
session
=
(
session_t
*
)
hdr
;
TRACE
(
"%p
\n
"
,
session
);
heap_free
(
session
->
agent
);
heap_free
(
session
->
proxy_server
);
heap_free
(
session
->
proxy_bypass
);
heap_free
(
session
->
proxy_username
);
heap_free
(
session
->
proxy_password
);
heap_free
(
session
);
}
static
const
object_vtbl_t
session_vtbl
=
{
session_destroy
,
NULL
,
NULL
};
/***********************************************************************
* WinHttpOpen (winhttp.@)
*/
HINTERNET
WINAPI
WinHttpOpen
(
LPCWSTR
agent
,
DWORD
access
,
LPCWSTR
proxy
,
LPCWSTR
bypass
,
DWORD
flags
)
{
session_t
*
session
;
HINTERNET
handle
=
NULL
;
TRACE
(
"%s, %u, %s, %s, 0x%08x
\n
"
,
debugstr_w
(
agent
),
access
,
debugstr_w
(
proxy
),
debugstr_w
(
bypass
),
flags
);
if
(
!
(
session
=
heap_alloc_zero
(
sizeof
(
session_t
)
)))
return
NULL
;
session
->
hdr
.
type
=
WINHTTP_HANDLE_TYPE_SESSION
;
session
->
hdr
.
vtbl
=
&
session_vtbl
;
session
->
hdr
.
flags
=
flags
;
session
->
hdr
.
refs
=
1
;
session
->
access
=
access
;
if
(
agent
&&
!
(
session
->
agent
=
strdupW
(
agent
)))
goto
end
;
if
(
proxy
&&
!
(
session
->
proxy_server
=
strdupW
(
proxy
)))
goto
end
;
if
(
bypass
&&
!
(
session
->
proxy_bypass
=
strdupW
(
bypass
)))
goto
end
;
if
(
!
(
handle
=
alloc_handle
(
&
session
->
hdr
)))
goto
end
;
session
->
hdr
.
handle
=
handle
;
end:
release_object
(
&
session
->
hdr
);
TRACE
(
"returning %p
\n
"
,
handle
);
return
handle
;
}
/***********************************************************************
* WinHttpCloseHandle (winhttp.@)
*/
BOOL
WINAPI
WinHttpCloseHandle
(
HINTERNET
handle
)
{
object_header_t
*
hdr
;
TRACE
(
"%p
\n
"
,
handle
);
if
(
!
(
hdr
=
grab_object
(
handle
)))
{
set_last_error
(
ERROR_INVALID_HANDLE
);
return
FALSE
;
}
release_object
(
hdr
);
free_handle
(
handle
);
return
TRUE
;
}
dlls/winhttp/tests/winhttp.c
View file @
405e8cda
...
...
@@ -36,7 +36,7 @@ static void test_OpenRequest (void)
session
=
WinHttpOpen
(
test_useragent
,
WINHTTP_ACCESS_TYPE_DEFAULT_PROXY
,
WINHTTP_NO_PROXY_NAME
,
WINHTTP_NO_PROXY_BYPASS
,
0
);
todo_wine
ok
(
session
!=
NULL
,
"WinHttpOpen failed to open session.
\n
"
);
ok
(
session
!=
NULL
,
"WinHttpOpen failed to open session.
\n
"
);
/* Test with a bad server name */
SetLastError
(
0xdeadbeef
);
...
...
@@ -69,7 +69,7 @@ static void test_OpenRequest (void)
ret
=
WinHttpCloseHandle
(
connection
);
todo_wine
ok
(
ret
==
TRUE
,
"WinHttpCloseHandle failed on closing connection, got %d.
\n
"
,
ret
);
ret
=
WinHttpCloseHandle
(
session
);
todo_wine
ok
(
ret
==
TRUE
,
"WinHttpCloseHandle failed on closing session, got %d.
\n
"
,
ret
);
ok
(
ret
==
TRUE
,
"WinHttpCloseHandle failed on closing session, got %d.
\n
"
,
ret
);
}
...
...
@@ -98,7 +98,7 @@ static void test_SendRequest (void)
session
=
WinHttpOpen
(
test_useragent
,
WINHTTP_ACCESS_TYPE_DEFAULT_PROXY
,
WINHTTP_NO_PROXY_NAME
,
WINHTTP_NO_PROXY_BYPASS
,
0
);
todo_wine
ok
(
session
!=
NULL
,
"WinHttpOpen failed to open session.
\n
"
);
ok
(
session
!=
NULL
,
"WinHttpOpen failed to open session.
\n
"
);
connection
=
WinHttpConnect
(
session
,
test_site
,
INTERNET_DEFAULT_HTTP_PORT
,
0
);
todo_wine
ok
(
connection
!=
NULL
,
...
...
@@ -142,7 +142,7 @@ static void test_SendRequest (void)
ret
=
WinHttpCloseHandle
(
connection
);
todo_wine
ok
(
ret
==
TRUE
,
"WinHttpCloseHandle failed on closing connection, got %d.
\n
"
,
ret
);
ret
=
WinHttpCloseHandle
(
session
);
todo_wine
ok
(
ret
==
TRUE
,
"WinHttpCloseHandle failed on closing session, got %d.
\n
"
,
ret
);
ok
(
ret
==
TRUE
,
"WinHttpCloseHandle failed on closing session, got %d.
\n
"
,
ret
);
}
static
void
test_WinHttpTimeFromSystemTime
(
void
)
...
...
@@ -227,7 +227,7 @@ static void test_WinHttpAddHeaders(void)
session
=
WinHttpOpen
(
test_useragent
,
WINHTTP_ACCESS_TYPE_DEFAULT_PROXY
,
WINHTTP_NO_PROXY_NAME
,
WINHTTP_NO_PROXY_BYPASS
,
0
);
todo_wine
ok
(
session
!=
NULL
,
"WinHttpOpen failed to open session.
\n
"
);
ok
(
session
!=
NULL
,
"WinHttpOpen failed to open session.
\n
"
);
connection
=
WinHttpConnect
(
session
,
test_site
,
INTERNET_DEFAULT_HTTP_PORT
,
0
);
todo_wine
ok
(
connection
!=
NULL
,
...
...
@@ -549,7 +549,7 @@ static void test_WinHttpAddHeaders(void)
ret
=
WinHttpCloseHandle
(
connection
);
todo_wine
ok
(
ret
==
TRUE
,
"WinHttpCloseHandle failed on closing connection, got %d.
\n
"
,
ret
);
ret
=
WinHttpCloseHandle
(
session
);
todo_wine
ok
(
ret
==
TRUE
,
"WinHttpCloseHandle failed on closing session, got %d.
\n
"
,
ret
);
ok
(
ret
==
TRUE
,
"WinHttpCloseHandle failed on closing session, got %d.
\n
"
,
ret
);
}
...
...
dlls/winhttp/winhttp_private.h
View file @
405e8cda
...
...
@@ -20,6 +20,7 @@
#define _WINE_WINHTTP_PRIVATE_H_
#include "wine/list.h"
#include "wine/unicode.h"
typedef
struct
_object_header_t
object_header_t
;
...
...
@@ -45,6 +46,23 @@ struct _object_header_t
struct
list
children
;
};
typedef
struct
{
object_header_t
hdr
;
LPWSTR
agent
;
DWORD
access
;
LPWSTR
proxy_server
;
LPWSTR
proxy_bypass
;
LPWSTR
proxy_username
;
LPWSTR
proxy_password
;
}
session_t
;
object_header_t
*
addref_object
(
object_header_t
*
);
object_header_t
*
grab_object
(
HINTERNET
);
void
release_object
(
object_header_t
*
);
HINTERNET
alloc_handle
(
object_header_t
*
);
BOOL
free_handle
(
HINTERNET
);
static
inline
void
*
heap_alloc
(
SIZE_T
size
)
{
return
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
...
...
@@ -65,4 +83,14 @@ static inline BOOL heap_free( LPVOID mem )
return
HeapFree
(
GetProcessHeap
(),
0
,
mem
);
}
static
inline
WCHAR
*
strdupW
(
const
WCHAR
*
src
)
{
WCHAR
*
dst
;
if
(
!
src
)
return
NULL
;
dst
=
heap_alloc
(
(
strlenW
(
src
)
+
1
)
*
sizeof
(
WCHAR
)
);
if
(
dst
)
strcpyW
(
dst
,
src
);
return
dst
;
}
#endif
/* _WINE_WINHTTP_PRIVATE_H_ */
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