Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
3469a021
Commit
3469a021
authored
Jul 14, 2009
by
Juan Lang
Committed by
Alexandre Julliard
Jul 15, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Implement WinHttpSetDefaultProxyConfiguration.
parent
461b1240
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
122 additions
and
8 deletions
+122
-8
Makefile.in
dlls/winhttp/Makefile.in
+1
-1
session.c
dlls/winhttp/session.c
+121
-2
winhttp.c
dlls/winhttp/tests/winhttp.c
+0
-5
No files found.
dlls/winhttp/Makefile.in
View file @
3469a021
...
...
@@ -5,7 +5,7 @@ VPATH = @srcdir@
MODULE
=
winhttp.dll
IMPORTLIB
=
winhttp
IMPORTS
=
shlwapi kernel32
DELAYIMPORTS
=
crypt32
DELAYIMPORTS
=
crypt32
advapi32
EXTRALIBS
=
@SOCKETLIBS@
C_SRCS
=
\
...
...
dlls/winhttp/session.c
View file @
3469a021
...
...
@@ -26,6 +26,7 @@
#include "winbase.h"
#include "winhttp.h"
#include "wincrypt.h"
#include "winreg.h"
#include "winhttp_private.h"
...
...
@@ -648,6 +649,26 @@ BOOL WINAPI WinHttpDetectAutoProxyConfigUrl( DWORD flags, LPWSTR *url )
return
FALSE
;
}
static
const
WCHAR
Connections
[]
=
{
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'M'
,
'i'
,
'c'
,
'r'
,
'o'
,
's'
,
'o'
,
'f'
,
't'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
'\\'
,
'C'
,
'u'
,
'r'
,
'r'
,
'e'
,
'n'
,
't'
,
'V'
,
'e'
,
'r'
,
's'
,
'i'
,
'o'
,
'n'
,
'\\'
,
'I'
,
'n'
,
't'
,
'e'
,
'r'
,
'n'
,
'e'
,
't'
,
' '
,
'S'
,
'e'
,
't'
,
't'
,
'i'
,
'n'
,
'g'
,
's'
,
'\\'
,
'C'
,
'o'
,
'n'
,
'n'
,
'e'
,
'c'
,
't'
,
'i'
,
'o'
,
'n'
,
's'
,
0
};
static
const
WCHAR
WinHttpSettings
[]
=
{
'W'
,
'i'
,
'n'
,
'H'
,
't'
,
't'
,
'p'
,
'S'
,
'e'
,
't'
,
't'
,
'i'
,
'n'
,
'g'
,
's'
,
0
};
static
const
DWORD
WINHTTPSETTINGS_MAGIC
=
0x18
;
static
const
DWORD
WINHTTP_PROXY_TYPE_DIRECT
=
1
;
static
const
DWORD
WINHTTP_PROXY_TYPE_PROXY
=
2
;
struct
winhttp_settings_header
{
DWORD
magic
;
DWORD
unknown
;
/* always zero? */
DWORD
flags
;
/* one of WINHTTP_PROXY_TYPE_* */
};
/***********************************************************************
* WinHttpGetDefaultProxyConfiguration (winhttp.@)
*/
...
...
@@ -703,8 +724,106 @@ BOOL WINAPI WinHttpGetProxyForUrl( HINTERNET hsession, LPCWSTR url, WINHTTP_AUTO
*/
BOOL
WINAPI
WinHttpSetDefaultProxyConfiguration
(
WINHTTP_PROXY_INFO
*
info
)
{
FIXME
(
"%p
\n
"
,
info
);
return
TRUE
;
LONG
l
;
HKEY
key
;
BOOL
ret
=
FALSE
;
const
WCHAR
*
src
;
TRACE
(
"%p
\n
"
,
info
);
if
(
!
info
)
{
set_last_error
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
switch
(
info
->
dwAccessType
)
{
case
WINHTTP_ACCESS_TYPE_NO_PROXY
:
break
;
case
WINHTTP_ACCESS_TYPE_NAMED_PROXY
:
if
(
!
info
->
lpszProxy
)
{
set_last_error
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
/* Only ASCII characters are allowed */
for
(
src
=
info
->
lpszProxy
;
*
src
;
src
++
)
if
(
*
src
>
0x7f
)
{
set_last_error
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
if
(
info
->
lpszProxyBypass
)
{
for
(
src
=
info
->
lpszProxyBypass
;
*
src
;
src
++
)
if
(
*
src
>
0x7f
)
{
set_last_error
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
}
break
;
default:
set_last_error
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
l
=
RegCreateKeyExW
(
HKEY_LOCAL_MACHINE
,
Connections
,
0
,
NULL
,
0
,
KEY_WRITE
,
NULL
,
&
key
,
NULL
);
if
(
!
l
)
{
DWORD
size
=
sizeof
(
struct
winhttp_settings_header
)
+
2
*
sizeof
(
DWORD
);
BYTE
*
buf
;
if
(
info
->
dwAccessType
==
WINHTTP_ACCESS_TYPE_NAMED_PROXY
)
{
size
+=
strlenW
(
info
->
lpszProxy
);
if
(
info
->
lpszProxyBypass
)
size
+=
strlenW
(
info
->
lpszProxyBypass
);
}
buf
=
heap_alloc
(
size
);
if
(
buf
)
{
struct
winhttp_settings_header
*
hdr
=
(
struct
winhttp_settings_header
*
)
buf
;
DWORD
*
len
=
(
DWORD
*
)(
hdr
+
1
);
hdr
->
magic
=
WINHTTPSETTINGS_MAGIC
;
hdr
->
unknown
=
0
;
if
(
info
->
dwAccessType
==
WINHTTP_ACCESS_TYPE_NAMED_PROXY
)
{
BYTE
*
dst
;
hdr
->
flags
=
WINHTTP_PROXY_TYPE_PROXY
;
*
len
++
=
strlenW
(
info
->
lpszProxy
);
for
(
dst
=
(
BYTE
*
)
len
,
src
=
info
->
lpszProxy
;
*
src
;
src
++
,
dst
++
)
*
dst
=
*
src
;
len
=
(
DWORD
*
)
dst
;
if
(
info
->
lpszProxyBypass
)
{
*
len
++
=
strlenW
(
info
->
lpszProxyBypass
);
for
(
dst
=
(
BYTE
*
)
len
,
src
=
info
->
lpszProxyBypass
;
*
src
;
src
++
,
dst
++
)
*
dst
=
*
src
;
}
else
*
len
++
=
0
;
}
else
{
hdr
->
flags
=
WINHTTP_PROXY_TYPE_DIRECT
;
*
len
++
=
0
;
*
len
++
=
0
;
}
l
=
RegSetValueExW
(
key
,
WinHttpSettings
,
0
,
REG_BINARY
,
buf
,
size
);
if
(
!
l
)
ret
=
TRUE
;
heap_free
(
buf
);
}
RegCloseKey
(
key
);
}
return
ret
;
}
/***********************************************************************
...
...
dlls/winhttp/tests/winhttp.c
View file @
3469a021
...
...
@@ -902,7 +902,6 @@ static void test_set_default_proxy_config(void)
SetLastError
(
0xdeadbeef
);
ret
=
WinHttpSetDefaultProxyConfiguration
(
NULL
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
...
...
@@ -911,7 +910,6 @@ static void test_set_default_proxy_config(void)
info
.
lpszProxy
=
info
.
lpszProxyBypass
=
NULL
;
SetLastError
(
0xdeadbeef
);
ret
=
WinHttpSetDefaultProxyConfiguration
(
&
info
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
...
...
@@ -920,13 +918,11 @@ static void test_set_default_proxy_config(void)
info
.
lpszProxy
=
info
.
lpszProxyBypass
=
NULL
;
SetLastError
(
0xdeadbeef
);
ret
=
WinHttpSetDefaultProxyConfiguration
(
&
info
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
info
.
lpszProxyBypass
=
normalString
;
SetLastError
(
0xdeadbeef
);
ret
=
WinHttpSetDefaultProxyConfiguration
(
&
info
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
...
...
@@ -934,7 +930,6 @@ static void test_set_default_proxy_config(void)
info
.
lpszProxy
=
wideString
;
SetLastError
(
0xdeadbeef
);
ret
=
WinHttpSetDefaultProxyConfiguration
(
&
info
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
...
...
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