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
d9db9d8b
Commit
d9db9d8b
authored
Mar 09, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 10, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wshom.ocx: Implement Exec() method.
parent
e1d10572
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
242 additions
and
6 deletions
+242
-6
shell.c
dlls/wshom.ocx/shell.c
+223
-2
wshom.c
dlls/wshom.ocx/tests/wshom.c
+13
-0
wshom.idl
dlls/wshom.ocx/tests/wshom.idl
+2
-2
wshom.idl
dlls/wshom.ocx/wshom.idl
+2
-2
wshom_main.c
dlls/wshom.ocx/wshom_main.c
+1
-0
wshom_private.h
dlls/wshom.ocx/wshom_private.h
+1
-0
No files found.
dlls/wshom.ocx/shell.c
View file @
d9db9d8b
...
...
@@ -51,6 +51,13 @@ typedef struct
LONG
ref
;
}
WshEnvironment
;
typedef
struct
{
IWshExec
IWshExec_iface
;
LONG
ref
;
PROCESS_INFORMATION
info
;
}
WshExec
;
static
inline
WshCollection
*
impl_from_IWshCollection
(
IWshCollection
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
WshCollection
,
IWshCollection_iface
);
...
...
@@ -66,6 +73,213 @@ static inline WshEnvironment *impl_from_IWshEnvironment( IWshEnvironment *iface
return
CONTAINING_RECORD
(
iface
,
WshEnvironment
,
IWshEnvironment_iface
);
}
static
inline
WshExec
*
impl_from_IWshExec
(
IWshExec
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
WshExec
,
IWshExec_iface
);
}
static
HRESULT
WINAPI
WshExec_QueryInterface
(
IWshExec
*
iface
,
REFIID
riid
,
void
**
obj
)
{
WshExec
*
This
=
impl_from_IWshExec
(
iface
);
TRACE
(
"(%p)->(%s, %p)
\n
"
,
This
,
debugstr_guid
(
riid
),
obj
);
if
(
IsEqualGUID
(
riid
,
&
IID_IDispatch
)
||
IsEqualGUID
(
riid
,
&
IID_IWshExec
)
||
IsEqualGUID
(
riid
,
&
IID_IUnknown
))
{
*
obj
=
iface
;
}
else
{
FIXME
(
"Unknown iface %s
\n
"
,
debugstr_guid
(
riid
));
*
obj
=
NULL
;
return
E_NOINTERFACE
;
}
IWshExec_AddRef
(
iface
);
return
S_OK
;
}
static
ULONG
WINAPI
WshExec_AddRef
(
IWshExec
*
iface
)
{
WshExec
*
This
=
impl_from_IWshExec
(
iface
);
LONG
ref
=
InterlockedIncrement
(
&
This
->
ref
);
TRACE
(
"(%p) ref = %d
\n
"
,
This
,
ref
);
return
ref
;
}
static
ULONG
WINAPI
WshExec_Release
(
IWshExec
*
iface
)
{
WshExec
*
This
=
impl_from_IWshExec
(
iface
);
LONG
ref
=
InterlockedDecrement
(
&
This
->
ref
);
TRACE
(
"(%p) ref = %d
\n
"
,
This
,
ref
);
if
(
!
ref
)
{
CloseHandle
(
This
->
info
.
hThread
);
CloseHandle
(
This
->
info
.
hProcess
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
return
ref
;
}
static
HRESULT
WINAPI
WshExec_GetTypeInfoCount
(
IWshExec
*
iface
,
UINT
*
pctinfo
)
{
WshExec
*
This
=
impl_from_IWshExec
(
iface
);
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
pctinfo
);
*
pctinfo
=
1
;
return
S_OK
;
}
static
HRESULT
WINAPI
WshExec_GetTypeInfo
(
IWshExec
*
iface
,
UINT
iTInfo
,
LCID
lcid
,
ITypeInfo
**
ppTInfo
)
{
WshExec
*
This
=
impl_from_IWshExec
(
iface
);
TRACE
(
"(%p)->(%u %u %p)
\n
"
,
This
,
iTInfo
,
lcid
,
ppTInfo
);
return
get_typeinfo
(
IWshExec_tid
,
ppTInfo
);
}
static
HRESULT
WINAPI
WshExec_GetIDsOfNames
(
IWshExec
*
iface
,
REFIID
riid
,
LPOLESTR
*
rgszNames
,
UINT
cNames
,
LCID
lcid
,
DISPID
*
rgDispId
)
{
WshExec
*
This
=
impl_from_IWshExec
(
iface
);
ITypeInfo
*
typeinfo
;
HRESULT
hr
;
TRACE
(
"(%p)->(%s %p %u %u %p)
\n
"
,
This
,
debugstr_guid
(
riid
),
rgszNames
,
cNames
,
lcid
,
rgDispId
);
hr
=
get_typeinfo
(
IWshExec_tid
,
&
typeinfo
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
ITypeInfo_GetIDsOfNames
(
typeinfo
,
rgszNames
,
cNames
,
rgDispId
);
ITypeInfo_Release
(
typeinfo
);
}
return
hr
;
}
static
HRESULT
WINAPI
WshExec_Invoke
(
IWshExec
*
iface
,
DISPID
dispIdMember
,
REFIID
riid
,
LCID
lcid
,
WORD
wFlags
,
DISPPARAMS
*
pDispParams
,
VARIANT
*
pVarResult
,
EXCEPINFO
*
pExcepInfo
,
UINT
*
puArgErr
)
{
WshExec
*
This
=
impl_from_IWshExec
(
iface
);
ITypeInfo
*
typeinfo
;
HRESULT
hr
;
TRACE
(
"(%p)->(%d %s %d %d %p %p %p %p)
\n
"
,
This
,
dispIdMember
,
debugstr_guid
(
riid
),
lcid
,
wFlags
,
pDispParams
,
pVarResult
,
pExcepInfo
,
puArgErr
);
hr
=
get_typeinfo
(
IWshExec_tid
,
&
typeinfo
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
ITypeInfo_Invoke
(
typeinfo
,
&
This
->
IWshExec_iface
,
dispIdMember
,
wFlags
,
pDispParams
,
pVarResult
,
pExcepInfo
,
puArgErr
);
ITypeInfo_Release
(
typeinfo
);
}
return
hr
;
}
static
HRESULT
WINAPI
WshExec_get_Status
(
IWshExec
*
iface
,
WshExecStatus
*
status
)
{
WshExec
*
This
=
impl_from_IWshExec
(
iface
);
FIXME
(
"(%p)->(%p): stub
\n
"
,
This
,
status
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
WshExec_get_StdIn
(
IWshExec
*
iface
,
ITextStream
**
stream
)
{
WshExec
*
This
=
impl_from_IWshExec
(
iface
);
FIXME
(
"(%p)->(%p): stub
\n
"
,
This
,
stream
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
WshExec_get_StdOut
(
IWshExec
*
iface
,
ITextStream
**
stream
)
{
WshExec
*
This
=
impl_from_IWshExec
(
iface
);
FIXME
(
"(%p)->(%p): stub
\n
"
,
This
,
stream
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
WshExec_get_StdErr
(
IWshExec
*
iface
,
ITextStream
**
stream
)
{
WshExec
*
This
=
impl_from_IWshExec
(
iface
);
FIXME
(
"(%p)->(%p): stub
\n
"
,
This
,
stream
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
WshExec_get_ProcessID
(
IWshExec
*
iface
,
DWORD
*
pid
)
{
WshExec
*
This
=
impl_from_IWshExec
(
iface
);
FIXME
(
"(%p)->(%p): stub
\n
"
,
This
,
pid
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
WshExec_get_ExitCode
(
IWshExec
*
iface
,
DWORD
*
code
)
{
WshExec
*
This
=
impl_from_IWshExec
(
iface
);
FIXME
(
"(%p)->(%p): stub
\n
"
,
This
,
code
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
WshExec_Terminate
(
IWshExec
*
iface
)
{
WshExec
*
This
=
impl_from_IWshExec
(
iface
);
FIXME
(
"(%p): stub
\n
"
,
This
);
return
E_NOTIMPL
;
}
static
const
IWshExecVtbl
WshExecVtbl
=
{
WshExec_QueryInterface
,
WshExec_AddRef
,
WshExec_Release
,
WshExec_GetTypeInfoCount
,
WshExec_GetTypeInfo
,
WshExec_GetIDsOfNames
,
WshExec_Invoke
,
WshExec_get_Status
,
WshExec_get_StdIn
,
WshExec_get_StdOut
,
WshExec_get_StdErr
,
WshExec_get_ProcessID
,
WshExec_get_ExitCode
,
WshExec_Terminate
};
static
HRESULT
WshExec_create
(
BSTR
command
,
IWshExec
**
ret
)
{
STARTUPINFOW
si
=
{
0
};
WshExec
*
This
;
*
ret
=
NULL
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
This
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
IWshExec_iface
.
lpVtbl
=
&
WshExecVtbl
;
This
->
ref
=
1
;
if
(
!
CreateProcessW
(
NULL
,
command
,
NULL
,
NULL
,
FALSE
,
0
,
NULL
,
NULL
,
&
si
,
&
This
->
info
))
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
return
HRESULT_FROM_WIN32
(
GetLastError
());
}
*
ret
=
&
This
->
IWshExec_iface
;
return
S_OK
;
}
static
HRESULT
WINAPI
WshEnvironment_QueryInterface
(
IWshEnvironment
*
iface
,
REFIID
riid
,
void
**
obj
)
{
WshEnvironment
*
This
=
impl_from_IWshEnvironment
(
iface
);
...
...
@@ -1323,8 +1537,15 @@ static HRESULT WINAPI WshShell3_SendKeys(IWshShell3 *iface, BSTR Keys, VARIANT *
static
HRESULT
WINAPI
WshShell3_Exec
(
IWshShell3
*
iface
,
BSTR
command
,
IWshExec
**
ret
)
{
FIXME
(
"(%s %p): stub
\n
"
,
debugstr_w
(
command
),
ret
);
return
E_NOTIMPL
;
TRACE
(
"(%s %p)
\n
"
,
debugstr_w
(
command
),
ret
);
if
(
!
ret
)
return
E_POINTER
;
if
(
!
command
)
return
DISP_E_EXCEPTION
;
return
WshExec_create
(
command
,
ret
);
}
static
HRESULT
WINAPI
WshShell3_get_CurrentDirectory
(
IWshShell3
*
iface
,
BSTR
*
dir
)
...
...
dlls/wshom.ocx/tests/wshom.c
View file @
d9db9d8b
...
...
@@ -42,6 +42,7 @@ static void test_wshshell(void)
static
const
WCHAR
dummydirW
[]
=
{
'd'
,
'e'
,
'a'
,
'd'
,
'p'
,
'a'
,
'r'
,
'r'
,
'o'
,
't'
,
0
};
static
const
WCHAR
emptyW
[]
=
{
'e'
,
'm'
,
'p'
,
't'
,
'y'
,
0
};
IWshEnvironment
*
env
;
IWshExec
*
shexec
;
IWshShell3
*
sh3
;
IDispatchEx
*
dispex
;
IWshCollection
*
coll
;
...
...
@@ -234,6 +235,18 @@ if (0) /* crashes on native */
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_FILE_NOT_FOUND
),
"got 0x%08x
\n
"
,
hr
);
SysFreeString
(
str
);
/* Exec */
hr
=
IWshShell3_Exec
(
sh3
,
NULL
,
NULL
);
ok
(
hr
==
E_POINTER
,
"got 0x%08x
\n
"
,
hr
);
hr
=
IWshShell3_Exec
(
sh3
,
NULL
,
&
shexec
);
ok
(
hr
==
DISP_E_EXCEPTION
,
"got 0x%08x
\n
"
,
hr
);
str
=
SysAllocString
(
emptyW
);
hr
=
IWshShell3_Exec
(
sh3
,
str
,
&
shexec
);
ok
(
hr
==
HRESULT_FROM_WIN32
(
ERROR_FILE_NOT_FOUND
),
"got 0x%08x
\n
"
,
hr
);
SysFreeString
(
str
);
IWshCollection_Release
(
coll
);
IDispatch_Release
(
disp
);
IWshShell3_Release
(
sh3
);
...
...
dlls/wshom.ocx/tests/wshom.idl
View file @
d9db9d8b
...
...
@@ -434,10 +434,10 @@ library IWshRuntimeLibrary
HRESULT
StdErr
(
[
out
,
retval
]
ITextStream
**
stream
)
;
[
id
(
0
x0006
),
propget
]
HRESULT
ProcessID
(
[
out
,
retval
]
long
*
pid
)
;
HRESULT
ProcessID
(
[
out
,
retval
]
DWORD
*
pid
)
;
[
id
(
0
x0007
),
propget
]
HRESULT
ExitCode
(
[
out
,
retval
]
long
*
ExitC
ode
)
;
HRESULT
ExitCode
(
[
out
,
retval
]
DWORD
*
c
ode
)
;
[
id
(
0
x0008
)
]
HRESULT
Terminate
()
;
...
...
dlls/wshom.ocx/wshom.idl
View file @
d9db9d8b
...
...
@@ -436,10 +436,10 @@ library IWshRuntimeLibrary
HRESULT
StdErr
(
[
out
,
retval
]
ITextStream
**
stream
)
;
[
id
(
0
x0006
),
propget
]
HRESULT
ProcessID
(
[
out
,
retval
]
long
*
pid
)
;
HRESULT
ProcessID
(
[
out
,
retval
]
DWORD
*
pid
)
;
[
id
(
0
x0007
),
propget
]
HRESULT
ExitCode
(
[
out
,
retval
]
long
*
ExitC
ode
)
;
HRESULT
ExitCode
(
[
out
,
retval
]
DWORD
*
c
ode
)
;
[
id
(
0
x0008
)
]
HRESULT
Terminate
()
;
...
...
dlls/wshom.ocx/wshom_main.c
View file @
d9db9d8b
...
...
@@ -35,6 +35,7 @@ static REFIID tid_ids[] = {
&
IID_NULL
,
&
IID_IWshCollection
,
&
IID_IWshEnvironment
,
&
IID_IWshExec
,
&
IID_IWshShell3
,
&
IID_IWshShortcut
};
...
...
dlls/wshom.ocx/wshom_private.h
View file @
d9db9d8b
...
...
@@ -29,6 +29,7 @@ typedef enum tid_t {
NULL_tid
,
IWshCollection_tid
,
IWshEnvironment_tid
,
IWshExec_tid
,
IWshShell3_tid
,
IWshShortcut_tid
,
LAST_tid
...
...
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