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
c23c43e9
Commit
c23c43e9
authored
Jan 12, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Jan 13, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Allocate returned options strings with the process heap.
parent
69a73009
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
6 deletions
+40
-6
internet.c
dlls/wininet/internet.c
+37
-6
internet.c
dlls/wininet/tests/internet.c
+3
-0
No files found.
dlls/wininet/internet.c
View file @
c23c43e9
...
...
@@ -2522,6 +2522,37 @@ static WCHAR *get_proxy_autoconfig_url(void)
return
ret
;
}
static
WCHAR
*
copy_optionW
(
WCHAR
*
value
)
{
DWORD
len
;
void
*
tmp
;
if
(
!
value
)
return
NULL
;
len
=
(
wcslen
(
value
)
+
1
)
*
sizeof
(
WCHAR
);
if
(
!
(
tmp
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
)))
return
NULL
;
return
memcpy
(
tmp
,
value
,
len
);
}
static
char
*
copy_optionA
(
WCHAR
*
value
)
{
DWORD
len
;
void
*
tmp
;
if
(
!
value
)
return
NULL
;
len
=
wcslen
(
value
)
*
3
+
1
;
if
(
!
(
tmp
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
)))
return
NULL
;
WideCharToMultiByte
(
CP_ACP
,
0
,
value
,
-
1
,
tmp
,
len
,
NULL
,
NULL
);
return
tmp
;
}
static
DWORD
query_global_option
(
DWORD
option
,
void
*
buffer
,
DWORD
*
size
,
BOOL
unicode
)
{
/* FIXME: This function currently handles more options than it should. Options requiring
...
...
@@ -2642,25 +2673,25 @@ static DWORD query_global_option(DWORD option, void *buffer, DWORD *size, BOOL u
case
INTERNET_PER_CONN_PROXY_SERVER
:
if
(
unicode
)
optionW
->
Value
.
pszValue
=
wcsdup
(
pi
.
proxy
);
optionW
->
Value
.
pszValue
=
copy_optionW
(
pi
.
proxy
);
else
optionA
->
Value
.
pszValue
=
strdupWto
A
(
pi
.
proxy
);
optionA
->
Value
.
pszValue
=
copy_option
A
(
pi
.
proxy
);
break
;
case
INTERNET_PER_CONN_PROXY_BYPASS
:
if
(
unicode
)
optionW
->
Value
.
pszValue
=
wcsdup
(
pi
.
proxyBypass
);
optionW
->
Value
.
pszValue
=
copy_optionW
(
pi
.
proxyBypass
);
else
optionA
->
Value
.
pszValue
=
strdupWto
A
(
pi
.
proxyBypass
);
optionA
->
Value
.
pszValue
=
copy_option
A
(
pi
.
proxyBypass
);
break
;
case
INTERNET_PER_CONN_AUTOCONFIG_URL
:
if
(
!
url
)
optionW
->
Value
.
pszValue
=
NULL
;
else
if
(
unicode
)
optionW
->
Value
.
pszValue
=
wcsdup
(
url
);
optionW
->
Value
.
pszValue
=
copy_optionW
(
url
);
else
optionA
->
Value
.
pszValue
=
strdupWto
A
(
url
);
optionA
->
Value
.
pszValue
=
copy_option
A
(
url
);
break
;
case
INTERNET_PER_CONN_AUTODISCOVERY_FLAGS
:
...
...
dlls/wininet/tests/internet.c
View file @
c23c43e9
...
...
@@ -1307,6 +1307,9 @@ static void test_Option_PerConnectionOption(void)
list
.
pOptions
[
1
].
Value
.
dwValue
);
verifyProxyEnable
(
1
);
ret
=
HeapValidate
(
GetProcessHeap
(),
0
,
list
.
pOptions
[
0
].
Value
.
pszValue
);
ok
(
ret
,
"HeapValidate failed, last error %lu
\n
"
,
GetLastError
());
HeapFree
(
GetProcessHeap
(),
0
,
list
.
pOptions
[
0
].
Value
.
pszValue
);
HeapFree
(
GetProcessHeap
(),
0
,
list
.
pOptions
);
...
...
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