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
6c8d315a
Commit
6c8d315a
authored
May 09, 2008
by
Hans Leidekker
Committed by
Alexandre Julliard
May 12, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wininet: Implement INTERNET_OPTION_USER_AGENT for InternetQueryOption.
parent
1c5bc9a7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
9 deletions
+42
-9
internet.c
dlls/wininet/internet.c
+35
-2
internet.c
dlls/wininet/tests/internet.c
+7
-7
No files found.
dlls/wininet/internet.c
View file @
6c8d315a
...
...
@@ -1895,9 +1895,42 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d
}
case
INTERNET_OPTION_USER_AGENT
:
FIXME
(
"INTERNET_OPTION_USER_AGENT
\n
"
);
break
;
{
DWORD
required
;
LPWININETAPPINFOW
ai
=
(
LPWININETAPPINFOW
)
lpwhh
;
TRACE
(
"INTERNET_OPTION_USER_AGENT
\n
"
);
if
(
lpwhh
->
htype
!=
INTERNET_HANDLE_TYPE_INTERNET
)
{
INTERNET_SetLastError
(
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
);
return
FALSE
;
}
if
(
bIsUnicode
)
{
required
=
(
strlenW
(
ai
->
lpszAgent
)
+
1
)
*
sizeof
(
WCHAR
);
if
(
*
lpdwBufferLength
<
required
)
INTERNET_SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
else
if
(
lpBuffer
)
{
strcpyW
(
lpBuffer
,
ai
->
lpszAgent
);
bSuccess
=
TRUE
;
}
}
else
{
required
=
WideCharToMultiByte
(
CP_ACP
,
0
,
ai
->
lpszAgent
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
if
(
*
lpdwBufferLength
<
required
)
INTERNET_SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
else
if
(
lpBuffer
)
{
WideCharToMultiByte
(
CP_ACP
,
0
,
ai
->
lpszAgent
,
-
1
,
lpBuffer
,
required
,
NULL
,
NULL
);
bSuccess
=
TRUE
;
}
}
*
lpdwBufferLength
=
required
;
break
;
}
case
INTERNET_OPTION_HTTP_VERSION
:
{
if
(
*
lpdwBufferLength
<
sizeof
(
HTTP_VERSION_INFO
))
...
...
dlls/wininet/tests/internet.c
View file @
6c8d315a
...
...
@@ -146,10 +146,10 @@ static void test_InternetQueryOptionA(void)
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
retval
=
InternetQueryOptionA
(
hinet
,
INTERNET_OPTION_USER_AGENT
,
buffer
,
&
len
);
err
=
GetLastError
();
todo_wine
ok
(
retval
==
1
,
"Got wrong return value %d
\n
"
,
retval
);
ok
(
retval
==
1
,
"Got wrong return value %d
\n
"
,
retval
);
if
(
retval
)
{
todo_wine
ok
(
!
strcmp
(
useragent
,
buffer
),
"Got wrong user agent string %s instead of %s
\n
"
,
buffer
,
useragent
);
ok
(
!
strcmp
(
useragent
,
buffer
),
"Got wrong user agent string %s instead of %s
\n
"
,
buffer
,
useragent
);
todo_wine
ok
(
len
==
strlen
(
useragent
),
"Got wrong user agent length %d instead of %d
\n
"
,
len
,
lstrlenA
(
useragent
));
}
ok
(
err
==
0xdeadbeef
,
"Got wrong error code %d
\n
"
,
err
);
...
...
@@ -160,9 +160,9 @@ static void test_InternetQueryOptionA(void)
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
100
);
retval
=
InternetQueryOptionA
(
hinet
,
INTERNET_OPTION_USER_AGENT
,
buffer
,
&
len
);
err
=
GetLastError
();
todo_wine
ok
(
len
==
strlen
(
useragent
)
+
1
,
"Got wrong user agent length %d instead of %d
\n
"
,
len
,
lstrlenA
(
useragent
)
+
1
);
ok
(
len
==
strlen
(
useragent
)
+
1
,
"Got wrong user agent length %d instead of %d
\n
"
,
len
,
lstrlenA
(
useragent
)
+
1
);
ok
(
!
retval
,
"Got wrong return value %d
\n
"
,
retval
);
todo_wine
ok
(
err
==
ERROR_INSUFFICIENT_BUFFER
,
"Got wrong error code %d
\n
"
,
err
);
ok
(
err
==
ERROR_INSUFFICIENT_BUFFER
,
"Got wrong error code %d
\n
"
,
err
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
hurl
=
InternetConnectA
(
hinet
,
"www.winehq.com"
,
INTERNET_DEFAULT_HTTP_PORT
,
NULL
,
NULL
,
INTERNET_SERVICE_HTTP
,
0
,
0
);
...
...
@@ -173,7 +173,7 @@ static void test_InternetQueryOptionA(void)
err
=
GetLastError
();
ok
(
len
==
0
,
"Got wrong user agent length %d instead of 0
\n
"
,
len
);
ok
(
retval
==
0
,
"Got wrong return value %d
\n
"
,
retval
);
todo_wine
ok
(
err
==
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
,
"Got wrong error code %d
\n
"
,
err
);
ok
(
err
==
ERROR_INTERNET_INCORRECT_HANDLE_TYPE
,
"Got wrong error code %d
\n
"
,
err
);
InternetCloseHandle
(
hurl
);
InternetCloseHandle
(
hinet
);
...
...
@@ -185,9 +185,9 @@ static void test_InternetQueryOptionA(void)
len
=
0
;
retval
=
InternetQueryOptionA
(
hinet
,
INTERNET_OPTION_USER_AGENT
,
NULL
,
&
len
);
err
=
GetLastError
();
todo_wine
ok
(
len
==
1
,
"Got wrong user agent length %d instead of %d
\n
"
,
len
,
1
);
ok
(
len
==
1
,
"Got wrong user agent length %d instead of %d
\n
"
,
len
,
1
);
ok
(
retval
==
0
,
"Got wrong return value %d
\n
"
,
retval
);
todo_wine
ok
(
err
==
ERROR_INSUFFICIENT_BUFFER
,
"Got wrong error code%d
\n
"
,
err
);
ok
(
err
==
ERROR_INSUFFICIENT_BUFFER
,
"Got wrong error code%d
\n
"
,
err
);
InternetCloseHandle
(
hinet
);
...
...
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