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
f0d17b5c
Commit
f0d17b5c
authored
Sep 09, 2013
by
Nikolay Sivov
Committed by
Alexandre Julliard
Sep 09, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Fix handle leak on consecutive Init() calls.
parent
891cf2ac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
2 deletions
+37
-2
assoc.c
dlls/shell32/assoc.c
+9
-2
assoc.c
dlls/shell32/tests/assoc.c
+28
-0
No files found.
dlls/shell32/assoc.c
View file @
f0d17b5c
...
...
@@ -184,6 +184,10 @@ static HRESULT WINAPI IQueryAssociations_fnInit(
FIXME
(
"hwnd != NULL not supported
\n
"
);
if
(
cfFlags
!=
0
)
FIXME
(
"unsupported flags: %x
\n
"
,
cfFlags
);
RegCloseKey
(
This
->
hkeySource
);
RegCloseKey
(
This
->
hkeyProgID
);
This
->
hkeySource
=
This
->
hkeyProgID
=
NULL
;
if
(
pszAssoc
!=
NULL
)
{
ret
=
RegOpenKeyExW
(
HKEY_CLASSES_ROOT
,
...
...
@@ -191,8 +195,8 @@ static HRESULT WINAPI IQueryAssociations_fnInit(
0
,
KEY_READ
,
&
This
->
hkeySource
);
if
(
ret
!=
ERROR_SUCCESS
)
return
E_FAIL
;
if
(
ret
)
return
S_OK
;
/* if this is not a prog id */
if
((
*
pszAssoc
==
'.'
)
||
(
*
pszAssoc
==
'{'
))
{
...
...
@@ -468,6 +472,9 @@ static HRESULT WINAPI IQueryAssociations_fnGetString(
if
(
!
pcchOut
)
return
E_UNEXPECTED
;
if
(
!
This
->
hkeySource
&&
!
This
->
hkeyProgID
)
return
HRESULT_FROM_WIN32
(
ERROR_NO_ASSOCIATION
);
switch
(
str
)
{
case
ASSOCSTR_COMMAND
:
...
...
dlls/shell32/tests/assoc.c
View file @
f0d17b5c
...
...
@@ -103,6 +103,8 @@ struct assoc_getstring_test
};
static
const
WCHAR
httpW
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
0
};
static
const
WCHAR
httpsW
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
's'
,
0
};
static
const
WCHAR
badW
[]
=
{
'b'
,
'a'
,
'd'
,
'b'
,
'a'
,
'd'
,
0
};
static
struct
assoc_getstring_test
getstring_tests
[]
=
{
...
...
@@ -163,6 +165,31 @@ static void test_IQueryAssociations_GetString(void)
IQueryAssociations_Release
(
assoc
);
}
static
void
test_IQueryAssociations_Init
(
void
)
{
IQueryAssociations
*
assoc
;
HRESULT
hr
;
DWORD
len
;
hr
=
CoCreateInstance
(
&
CLSID_QueryAssociations
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IQueryAssociations
,
(
void
*
)
&
assoc
);
ok
(
hr
==
S_OK
,
"failed to create object, 0x%x
\n
"
,
hr
);
hr
=
IQueryAssociations_Init
(
assoc
,
0
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"Init failed, 0x%08x
\n
"
,
hr
);
hr
=
IQueryAssociations_Init
(
assoc
,
0
,
httpW
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"Init failed, 0x%08x
\n
"
,
hr
);
hr
=
IQueryAssociations_Init
(
assoc
,
0
,
badW
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
||
broken
(
hr
==
S_FALSE
)
/* pre-vista */
,
"Init failed, 0x%08x
\n
"
,
hr
);
len
=
0
;
hr
=
IQueryAssociations_GetString
(
assoc
,
0
,
ASSOCSTR_EXECUTABLE
,
NULL
,
NULL
,
&
len
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_NO_ASSOCIATION
)
||
broken
(
hr
==
E_FAIL
)
/* pre-vista */
,
"got 0x%08x
\n
"
,
hr
);
IQueryAssociations_Release
(
assoc
);
}
START_TEST
(
assoc
)
{
IQueryAssociations
*
qa
;
...
...
@@ -176,6 +203,7 @@ START_TEST(assoc)
{
test_IQueryAssociations_QueryInterface
();
test_IQueryAssociations_GetString
();
test_IQueryAssociations_Init
();
IQueryAssociations_Release
(
qa
);
}
...
...
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