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
5dda6495
Commit
5dda6495
authored
Feb 02, 2017
by
Józef Kucia
Committed by
Alexandre Julliard
Feb 02, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comdlg32/tests: Add test for OLE initialization in file dialogs.
Signed-off-by:
Józef Kucia
<
jkucia@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
fdcd7e60
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
0 deletions
+69
-0
filedlg.c
dlls/comdlg32/tests/filedlg.c
+69
-0
No files found.
dlls/comdlg32/tests/filedlg.c
View file @
5dda6495
...
...
@@ -1266,6 +1266,74 @@ static void test_directory_filename(void)
todo_wine
ok
(
!
ret
,
"GetOpenFileNameW returned %#x
\n
"
,
ret
);
}
static
UINT_PTR
WINAPI
test_ole_init_wndproc
(
HWND
dlg
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
HRESULT
hr
;
hr
=
OleInitialize
(
NULL
);
ok
(
hr
==
S_FALSE
,
"OleInitialize() returned %#x
\n
"
,
hr
);
OleUninitialize
();
if
(
msg
==
WM_NOTIFY
)
PostMessageA
(
GetParent
(
dlg
),
WM_COMMAND
,
IDCANCEL
,
0
);
return
FALSE
;
}
static
LRESULT
CALLBACK
hook_proc
(
int
code
,
WPARAM
wp
,
LPARAM
lp
)
{
static
BOOL
first_dlg
=
TRUE
;
HRESULT
hr
;
if
(
code
==
HCBT_CREATEWND
)
{
CBT_CREATEWNDW
*
c
=
(
CBT_CREATEWNDW
*
)
lp
;
if
(
c
->
lpcs
->
lpszClass
==
(
LPWSTR
)
WC_DIALOG
)
{
/* OleInitialize() creates a window for the main apartment. Since
* Vista OleInitialize() is called before the file dialog is
* created. SimCity 2000 expects that the first window created
* after GetOpenFileA() is a file dialog window. Mark Vista+
* behavior as broken. */
hr
=
OleInitialize
(
NULL
);
todo_wine_if
(
first_dlg
)
ok
((
first_dlg
?
hr
==
S_OK
:
hr
==
S_FALSE
)
||
broken
(
first_dlg
&&
hr
==
S_FALSE
),
"OleInitialize() returned %#x (first dialog %#x)
\n
"
,
hr
,
first_dlg
);
OleUninitialize
();
first_dlg
=
FALSE
;
}
}
return
CallNextHookEx
(
NULL
,
code
,
wp
,
lp
);
}
static
void
test_ole_initialization
(
void
)
{
char
file
[
MAX_PATH
]
=
{
0
};
OPENFILENAMEA
ofn
=
{
0
};
HRESULT
hr
;
HHOOK
hook
;
BOOL
ret
;
hook
=
SetWindowsHookExW
(
WH_CBT
,
hook_proc
,
NULL
,
GetCurrentThreadId
());
ofn
.
lStructSize
=
OPENFILENAME_SIZE_VERSION_400A
;
ofn
.
lpstrFile
=
file
;
ofn
.
nMaxFile
=
MAX_PATH
;
ofn
.
lpfnHook
=
test_ole_init_wndproc
;
ofn
.
Flags
=
OFN_ENABLEHOOK
|
OFN_EXPLORER
;
ofn
.
hInstance
=
GetModuleHandleA
(
NULL
);
ret
=
GetOpenFileNameA
(
&
ofn
);
ok
(
!
ret
,
"GetOpenFileNameA returned %#x
\n
"
,
ret
);
hr
=
OleInitialize
(
NULL
);
ok
(
hr
==
S_OK
,
"OleInitialize() returned %#x
\n
"
,
hr
);
OleUninitialize
();
UnhookWindowsHookEx
(
hook
);
}
START_TEST
(
filedlg
)
{
test_DialogCancel
();
...
...
@@ -1280,4 +1348,5 @@ START_TEST(filedlg)
test_extension
();
test_null_filename
();
test_directory_filename
();
test_ole_initialization
();
}
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