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
ce3ccccb
Commit
ce3ccccb
authored
Jul 08, 2023
by
Mohamad Al-Jaf
Committed by
Alexandre Julliard
Jul 24, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windows.networking.hostname: Duplicate passed HSTRING in IHostNameFactory::CreateHostName().
parent
95bfbdc8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
hostname.c
dlls/windows.networking.hostname/hostname.c
+11
-3
hostname.c
dlls/windows.networking.hostname/tests/hostname.c
+1
-1
No files found.
dlls/windows.networking.hostname/hostname.c
View file @
ce3ccccb
...
@@ -120,7 +120,7 @@ struct hostname
...
@@ -120,7 +120,7 @@ struct hostname
IHostName
IHostName_iface
;
IHostName
IHostName_iface
;
LONG
ref
;
LONG
ref
;
HSTRING
rawname
;
HSTRING
raw
_
name
;
};
};
static
inline
struct
hostname
*
impl_from_IHostName
(
IHostName
*
iface
)
static
inline
struct
hostname
*
impl_from_IHostName
(
IHostName
*
iface
)
...
@@ -161,7 +161,15 @@ static ULONG WINAPI hostname_Release( IHostName *iface )
...
@@ -161,7 +161,15 @@ static ULONG WINAPI hostname_Release( IHostName *iface )
{
{
struct
hostname
*
impl
=
impl_from_IHostName
(
iface
);
struct
hostname
*
impl
=
impl_from_IHostName
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
impl
->
ref
);
ULONG
ref
=
InterlockedDecrement
(
&
impl
->
ref
);
TRACE
(
"iface %p decreasing refcount to %lu.
\n
"
,
iface
,
ref
);
TRACE
(
"iface %p decreasing refcount to %lu.
\n
"
,
iface
,
ref
);
if
(
!
ref
)
{
WindowsDeleteString
(
impl
->
raw_name
);
free
(
impl
);
}
return
ref
;
return
ref
;
}
}
...
@@ -196,7 +204,7 @@ static HRESULT WINAPI hostname_get_RawName( IHostName *iface, HSTRING *value )
...
@@ -196,7 +204,7 @@ static HRESULT WINAPI hostname_get_RawName( IHostName *iface, HSTRING *value )
TRACE
(
"iface %p, value %p.
\n
"
,
iface
,
value
);
TRACE
(
"iface %p, value %p.
\n
"
,
iface
,
value
);
if
(
!
value
)
return
E_INVALIDARG
;
if
(
!
value
)
return
E_INVALIDARG
;
return
WindowsDuplicateString
(
impl
->
rawname
,
value
);
return
WindowsDuplicateString
(
impl
->
raw
_
name
,
value
);
}
}
static
HRESULT
WINAPI
hostname_get_DisplayName
(
IHostName
*
iface
,
HSTRING
*
value
)
static
HRESULT
WINAPI
hostname_get_DisplayName
(
IHostName
*
iface
,
HSTRING
*
value
)
...
@@ -255,7 +263,7 @@ static HRESULT WINAPI hostname_factory_CreateHostName( IHostNameFactory *iface,
...
@@ -255,7 +263,7 @@ static HRESULT WINAPI hostname_factory_CreateHostName( IHostNameFactory *iface,
impl
->
IHostName_iface
.
lpVtbl
=
&
hostname_vtbl
;
impl
->
IHostName_iface
.
lpVtbl
=
&
hostname_vtbl
;
impl
->
ref
=
1
;
impl
->
ref
=
1
;
impl
->
rawname
=
name
;
WindowsDuplicateString
(
name
,
&
impl
->
raw_name
)
;
*
value
=
&
impl
->
IHostName_iface
;
*
value
=
&
impl
->
IHostName_iface
;
TRACE
(
"created IHostName %p.
\n
"
,
*
value
);
TRACE
(
"created IHostName %p.
\n
"
,
*
value
);
...
...
dlls/windows.networking.hostname/tests/hostname.c
View file @
ce3ccccb
...
@@ -101,7 +101,7 @@ static void test_HostnameStatics(void)
...
@@ -101,7 +101,7 @@ static void test_HostnameStatics(void)
hr
=
WindowsCompareStringOrdinal
(
str
,
rawname
,
&
res
);
hr
=
WindowsCompareStringOrdinal
(
str
,
rawname
,
&
res
);
ok
(
hr
==
S_OK
,
"got hr %#lx.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got hr %#lx.
\n
"
,
hr
);
ok
(
!
res
,
"got unexpected string %s.
\n
"
,
debugstr_hstring
(
rawname
)
);
ok
(
!
res
,
"got unexpected string %s.
\n
"
,
debugstr_hstring
(
rawname
)
);
todo_wine
ok
(
str
!=
rawname
,
"got same HSTRINGs %p, %p.
\n
"
,
str
,
rawname
);
ok
(
str
!=
rawname
,
"got same HSTRINGs %p, %p.
\n
"
,
str
,
rawname
);
WindowsDeleteString
(
str
);
WindowsDeleteString
(
str
);
WindowsDeleteString
(
rawname
);
WindowsDeleteString
(
rawname
);
...
...
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