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
583605be
Commit
583605be
authored
Feb 01, 2022
by
Paul Gofman
Committed by
Alexandre Julliard
Feb 01, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hnetcfg: Get gateway description location in init_gateway_connection().
Signed-off-by:
Paul Gofman
<
pgofman@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
cbf2ca57
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
0 deletions
+46
-0
port.c
dlls/hnetcfg/port.c
+46
-0
No files found.
dlls/hnetcfg/port.c
View file @
583605be
...
...
@@ -27,6 +27,7 @@
#include "string.h"
#include "assert.h"
#include "winsock2.h"
#include "winhttp.h"
#include "ole2.h"
#include "netfw.h"
#include "natupnp.h"
...
...
@@ -40,11 +41,49 @@ static struct
{
LONG
refs
;
BOOL
winsock_initialized
;
WCHAR
locationW
[
256
];
}
upnp_gateway_connection
;
static
SRWLOCK
upnp_gateway_connection_lock
=
SRWLOCK_INIT
;
static
BOOL
parse_search_response
(
char
*
response
,
WCHAR
*
locationW
,
unsigned
int
location_size
)
{
char
*
saveptr
=
NULL
,
*
tok
,
*
tok2
;
unsigned
int
status
;
tok
=
strtok_s
(
response
,
"
\n
"
,
&
saveptr
);
if
(
!
tok
)
return
FALSE
;
/* HTTP/1.1 200 OK */
tok2
=
strtok
(
tok
,
" "
);
if
(
!
tok2
)
return
FALSE
;
tok2
=
strtok
(
NULL
,
" "
);
if
(
!
tok2
)
return
FALSE
;
status
=
atoi
(
tok2
);
if
(
status
!=
HTTP_STATUS_OK
)
{
WARN
(
"status %u.
\n
"
,
status
);
return
FALSE
;
}
while
((
tok
=
strtok_s
(
NULL
,
"
\n
"
,
&
saveptr
)))
{
tok2
=
strtok
(
tok
,
" "
);
if
(
!
tok2
)
continue
;
if
(
!
stricmp
(
tok2
,
"LOCATION:"
))
{
tok2
=
strtok
(
NULL
,
"
\r
"
);
if
(
!
tok2
)
{
WARN
(
"Error parsing location.
\n
"
);
return
FALSE
;
}
return
!!
MultiByteToWideChar
(
CP_UTF8
,
0
,
tok2
,
-
1
,
locationW
,
location_size
/
2
);
}
}
return
FALSE
;
}
static
void
gateway_connection_cleanup
(
void
)
{
TRACE
(
".
\n
"
);
...
...
@@ -118,6 +157,13 @@ static BOOL init_gateway_connection(void)
return
FALSE
;
}
TRACE
(
"Received reply from gateway, len %d.
\n
"
,
len
);
buffer
[
len
]
=
0
;
if
(
!
parse_search_response
(
buffer
,
upnp_gateway_connection
.
locationW
,
sizeof
(
upnp_gateway_connection
.
locationW
)
))
{
WARN
(
"Error parsing response.
\n
"
);
return
FALSE
;
}
TRACE
(
"Gateway description location %s.
\n
"
,
debugstr_w
(
upnp_gateway_connection
.
locationW
)
);
return
TRUE
;
}
...
...
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