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
559b1d2c
Commit
559b1d2c
authored
Feb 02, 2022
by
Paul Gofman
Committed by
Alexandre Julliard
Feb 02, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hnetcfg: Implement static_ports_Remove().
Signed-off-by:
Paul Gofman
<
pgofman@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
de05efde
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
4 deletions
+45
-4
port.c
dlls/hnetcfg/port.c
+44
-3
policy.c
dlls/hnetcfg/tests/policy.c
+1
-1
No files found.
dlls/hnetcfg/port.c
View file @
559b1d2c
...
...
@@ -515,7 +515,8 @@ enum port_mapping_parameter
PM_ENABLED
,
PM_DESC
,
PM_LEASE_DURATION
,
PM_LAST
PM_LAST
,
PM_REMOVE_PORT_LAST
=
PM_INTERNAL
,
};
static
struct
xml_value_desc
port_mapping_template
[]
=
...
...
@@ -602,6 +603,41 @@ static void update_mapping_list(void)
}
}
static
BOOL
remove_port_mapping
(
LONG
port
,
BSTR
protocol
)
{
struct
xml_value_desc
mapping_desc
[
PM_REMOVE_PORT_LAST
];
DWORD
status
=
0
;
BSTR
error_str
;
WCHAR
portW
[
6
];
BOOL
ret
;
AcquireSRWLockExclusive
(
&
upnp_gateway_connection_lock
);
memcpy
(
mapping_desc
,
port_mapping_template
,
sizeof
(
mapping_desc
)
);
swprintf
(
portW
,
ARRAY_SIZE
(
portW
),
L"%u"
,
port
);
mapping_desc
[
PM_EXTERNAL_IP
].
value
=
SysAllocString
(
L""
);
mapping_desc
[
PM_EXTERNAL
].
value
=
SysAllocString
(
portW
);
mapping_desc
[
PM_PROTOCOL
].
value
=
protocol
;
ret
=
request_service
(
L"DeletePortMapping"
,
mapping_desc
,
PM_REMOVE_PORT_LAST
,
NULL
,
0
,
&
status
,
&
error_str
);
if
(
ret
&&
status
!=
HTTP_STATUS_OK
)
{
WARN
(
"status %u, server returned error %s.
\n
"
,
status
,
debugstr_w
(
error_str
)
);
SysFreeString
(
error_str
);
ret
=
FALSE
;
}
else
if
(
!
ret
)
{
WARN
(
"Request failed.
\n
"
);
}
update_mapping_list
();
ReleaseSRWLockExclusive
(
&
upnp_gateway_connection_lock
);
SysFreeString
(
mapping_desc
[
PM_EXTERNAL_IP
].
value
);
SysFreeString
(
mapping_desc
[
PM_EXTERNAL
].
value
);
return
ret
;
}
static
BOOL
init_gateway_connection
(
void
)
{
static
const
char
upnp_search_request
[]
=
...
...
@@ -1402,9 +1438,14 @@ static HRESULT WINAPI static_ports_Remove(
LONG
port
,
BSTR
protocol
)
{
FIXME
(
"iface %p, port %d, protocol %s stub
.
\n
"
,
iface
,
port
,
debugstr_w
(
protocol
)
);
TRACE
(
"iface %p, port %d, protocol %s
.
\n
"
,
iface
,
port
,
debugstr_w
(
protocol
)
);
return
E_NOTIMPL
;
if
(
!
is_valid_protocol
(
protocol
))
return
E_INVALIDARG
;
if
(
port
<
0
||
port
>
65535
)
return
E_INVALIDARG
;
if
(
!
remove_port_mapping
(
port
,
protocol
))
return
E_FAIL
;
return
S_OK
;
}
static
HRESULT
WINAPI
static_ports_Add
(
...
...
dlls/hnetcfg/tests/policy.c
View file @
559b1d2c
...
...
@@ -280,7 +280,7 @@ static void test_static_port_mapping_collection( IStaticPortMappingCollection *p
hr
=
IStaticPortMappingCollection_Remove
(
ports
,
12345
,
(
BSTR
)
L"UDP"
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IStaticPortMappingCollection_Remove
(
ports
,
12345
,
(
BSTR
)
L"UDP"
);
todo_wine
ok
(
hr
==
S_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
IEnumVARIANT_Release
(
enum_ports
);
}
...
...
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