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
8c688724
Commit
8c688724
authored
Dec 11, 2017
by
Nikolay Sivov
Committed by
Alexandre Julliard
Dec 11, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wshom: Implement Popup() method.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
8a8b5090
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
123 additions
and
4 deletions
+123
-4
shell.c
dlls/wshom.ocx/shell.c
+74
-4
wshom.c
dlls/wshom.ocx/tests/wshom.c
+49
-0
No files found.
dlls/wshom.ocx/shell.c
View file @
8c688724
...
...
@@ -1275,11 +1275,81 @@ static HRESULT WINAPI WshShell3_Run(IWshShell3 *iface, BSTR cmd, VARIANT *style,
}
}
st
atic
HRESULT
WINAPI
WshShell3_Popup
(
IWshShell3
*
iface
,
BSTR
Text
,
VARIANT
*
SecondsToWait
,
VARIANT
*
Title
,
VARIANT
*
Type
,
int
*
button
)
st
ruct
popup_thread_param
{
FIXME
(
"(%s %s %s %s %p): stub
\n
"
,
debugstr_w
(
Text
),
debugstr_variant
(
SecondsToWait
),
debugstr_variant
(
Title
),
debugstr_variant
(
Type
),
button
);
return
E_NOTIMPL
;
WCHAR
*
text
;
VARIANT
title
;
VARIANT
type
;
INT
button
;
};
static
DWORD
WINAPI
popup_thread_proc
(
void
*
arg
)
{
static
const
WCHAR
defaulttitleW
[]
=
{
'W'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
' '
,
'S'
,
'c'
,
'r'
,
'i'
,
'p'
,
't'
,
' '
,
'H'
,
'o'
,
's'
,
't'
,
0
};
struct
popup_thread_param
*
param
=
(
struct
popup_thread_param
*
)
arg
;
param
->
button
=
MessageBoxW
(
NULL
,
param
->
text
,
is_optional_argument
(
&
param
->
title
)
?
defaulttitleW
:
V_BSTR
(
&
param
->
title
),
V_I4
(
&
param
->
type
));
return
0
;
}
static
HRESULT
WINAPI
WshShell3_Popup
(
IWshShell3
*
iface
,
BSTR
text
,
VARIANT
*
seconds_to_wait
,
VARIANT
*
title
,
VARIANT
*
type
,
int
*
button
)
{
struct
popup_thread_param
param
;
DWORD
tid
,
status
;
VARIANT
timeout
;
HANDLE
hthread
;
HRESULT
hr
;
TRACE
(
"(%s %s %s %s %p)
\n
"
,
debugstr_w
(
text
),
debugstr_variant
(
seconds_to_wait
),
debugstr_variant
(
title
),
debugstr_variant
(
type
),
button
);
if
(
!
seconds_to_wait
||
!
title
||
!
type
||
!
button
)
return
E_POINTER
;
VariantInit
(
&
timeout
);
if
(
!
is_optional_argument
(
seconds_to_wait
))
{
hr
=
VariantChangeType
(
&
timeout
,
seconds_to_wait
,
0
,
VT_I4
);
if
(
FAILED
(
hr
))
return
hr
;
}
VariantInit
(
&
param
.
type
);
if
(
!
is_optional_argument
(
type
))
{
hr
=
VariantChangeType
(
&
param
.
type
,
type
,
0
,
VT_I4
);
if
(
FAILED
(
hr
))
return
hr
;
}
if
(
is_optional_argument
(
title
))
param
.
title
=
*
title
;
else
{
VariantInit
(
&
param
.
title
);
hr
=
VariantChangeType
(
&
param
.
title
,
title
,
0
,
VT_BSTR
);
if
(
FAILED
(
hr
))
return
hr
;
}
param
.
text
=
text
;
param
.
button
=
-
1
;
hthread
=
CreateThread
(
NULL
,
0
,
popup_thread_proc
,
&
param
,
0
,
&
tid
);
status
=
MsgWaitForMultipleObjects
(
1
,
&
hthread
,
FALSE
,
V_I4
(
&
timeout
)
?
V_I4
(
&
timeout
)
*
1000
:
INFINITE
,
0
);
if
(
status
==
WAIT_TIMEOUT
)
{
PostThreadMessageW
(
tid
,
WM_QUIT
,
0
,
0
);
MsgWaitForMultipleObjects
(
1
,
&
hthread
,
FALSE
,
INFINITE
,
0
);
param
.
button
=
-
1
;
}
*
button
=
param
.
button
;
VariantClear
(
&
param
.
title
);
CloseHandle
(
hthread
);
return
S_OK
;
}
static
HRESULT
WINAPI
WshShell3_CreateShortcut
(
IWshShell3
*
iface
,
BSTR
PathLink
,
IDispatch
**
Shortcut
)
...
...
dlls/wshom.ocx/tests/wshom.c
View file @
8c688724
...
...
@@ -566,6 +566,54 @@ static void test_registry(void)
IWshShell3_Release
(
sh3
);
}
static
void
test_popup
(
void
)
{
static
const
WCHAR
textW
[]
=
{
'T'
,
'e'
,
'x'
,
't'
,
0
};
VARIANT
timeout
,
type
,
title
,
optional
;
IWshShell
*
sh
;
int
button
;
HRESULT
hr
;
BSTR
text
;
hr
=
CoCreateInstance
(
&
CLSID_WshShell
,
NULL
,
CLSCTX_INPROC_SERVER
|
CLSCTX_INPROC_HANDLER
,
&
IID_IWshShell
,
(
void
**
)
&
sh
);
ok
(
hr
==
S_OK
,
"Failed to create WshShell object, hr %#x.
\n
"
,
hr
);
button
=
123
;
text
=
SysAllocString
(
textW
);
hr
=
IWshShell_Popup
(
sh
,
NULL
,
NULL
,
NULL
,
NULL
,
&
button
);
ok
(
hr
==
E_POINTER
,
"Unexpected retval %#x.
\n
"
,
hr
);
ok
(
button
==
123
,
"Unexpected button id %d.
\n
"
,
button
);
hr
=
IWshShell_Popup
(
sh
,
text
,
NULL
,
NULL
,
NULL
,
&
button
);
ok
(
hr
==
E_POINTER
,
"Unexpected retval %#x.
\n
"
,
hr
);
ok
(
button
==
123
,
"Unexpected button id %d.
\n
"
,
button
);
V_VT
(
&
optional
)
=
VT_ERROR
;
V_ERROR
(
&
optional
)
=
DISP_E_PARAMNOTFOUND
;
V_VT
(
&
timeout
)
=
VT_I2
;
V_I2
(
&
timeout
)
=
1
;
V_VT
(
&
type
)
=
VT_I2
;
V_I2
(
&
type
)
=
1
;
V_VT
(
&
title
)
=
VT_BSTR
;
V_BSTR
(
&
title
)
=
NULL
;
hr
=
IWshShell_Popup
(
sh
,
text
,
&
timeout
,
&
optional
,
&
type
,
&
button
);
ok
(
hr
==
S_OK
,
"Unexpected retval %#x.
\n
"
,
hr
);
ok
(
button
==
-
1
,
"Unexpected button id %d.
\n
"
,
button
);
hr
=
IWshShell_Popup
(
sh
,
text
,
&
timeout
,
&
title
,
&
optional
,
&
button
);
ok
(
hr
==
S_OK
,
"Unexpected retval %#x.
\n
"
,
hr
);
ok
(
button
==
-
1
,
"Unexpected button id %d.
\n
"
,
button
);
SysFreeString
(
text
);
IWshShell_Release
(
sh
);
}
START_TEST
(
wshom
)
{
IUnknown
*
unk
;
...
...
@@ -583,6 +631,7 @@ START_TEST(wshom)
test_wshshell
();
test_registry
();
test_popup
();
CoUninitialize
();
}
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