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
ac65c3fb
Commit
ac65c3fb
authored
Jul 22, 2014
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jul 22, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wshom.ocx: Implement get_Item() for IWshEnvironment.
parent
7311a9fc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
3 deletions
+57
-3
shell.c
dlls/wshom.ocx/shell.c
+16
-2
wshom.c
dlls/wshom.ocx/tests/wshom.c
+41
-1
No files found.
dlls/wshom.ocx/shell.c
View file @
ac65c3fb
...
...
@@ -197,8 +197,22 @@ static HRESULT WINAPI WshEnvironment_Invoke(IWshEnvironment *iface, DISPID dispI
static
HRESULT
WINAPI
WshEnvironment_get_Item
(
IWshEnvironment
*
iface
,
BSTR
name
,
BSTR
*
value
)
{
WshEnvironment
*
This
=
impl_from_IWshEnvironment
(
iface
);
FIXME
(
"(%p)->(%s %p): stub
\n
"
,
This
,
debugstr_w
(
name
),
value
);
return
E_NOTIMPL
;
DWORD
len
;
TRACE
(
"(%p)->(%s %p)
\n
"
,
This
,
debugstr_w
(
name
),
value
);
if
(
!
value
)
return
E_POINTER
;
len
=
GetEnvironmentVariableW
(
name
,
NULL
,
0
);
*
value
=
SysAllocStringLen
(
NULL
,
len
);
if
(
!*
value
)
return
E_OUTOFMEMORY
;
if
(
len
)
GetEnvironmentVariableW
(
name
,
*
value
,
len
+
1
);
return
S_OK
;
}
static
HRESULT
WINAPI
WshEnvironment_put_Item
(
IWshEnvironment
*
iface
,
BSTR
name
,
BSTR
value
)
...
...
dlls/wshom.ocx/tests/wshom.c
View file @
ac65c3fb
...
...
@@ -36,6 +36,9 @@ static void test_wshshell(void)
static
const
WCHAR
desktopW
[]
=
{
'D'
,
'e'
,
's'
,
'k'
,
't'
,
'o'
,
'p'
,
0
};
static
const
WCHAR
lnk1W
[]
=
{
'f'
,
'i'
,
'l'
,
'e'
,
'.'
,
'l'
,
'n'
,
'k'
,
0
};
static
const
WCHAR
pathW
[]
=
{
'%'
,
'P'
,
'A'
,
'T'
,
'H'
,
'%'
,
0
};
static
const
WCHAR
sysW
[]
=
{
'S'
,
'Y'
,
'S'
,
'T'
,
'E'
,
'M'
,
0
};
static
const
WCHAR
path2W
[]
=
{
'P'
,
'A'
,
'T'
,
'H'
,
0
};
IWshEnvironment
*
env
;
IWshShell3
*
sh3
;
IDispatchEx
*
dispex
;
IWshCollection
*
coll
;
...
...
@@ -49,7 +52,7 @@ static void test_wshshell(void)
DISPPARAMS
dp
;
EXCEPINFO
ei
;
VARIANT
arg
,
res
;
BSTR
str
;
BSTR
str
,
ret
;
UINT
err
;
hr
=
CoCreateInstance
(
&
CLSID_WshShell
,
NULL
,
CLSCTX_INPROC_SERVER
|
CLSCTX_INPROC_HANDLER
,
...
...
@@ -131,6 +134,43 @@ static void test_wshshell(void)
ok
(
hr
==
E_POINTER
,
"got 0x%08x
\n
"
,
hr
);
SysFreeString
(
str
);
V_VT
(
&
arg
)
=
VT_BSTR
;
V_BSTR
(
&
arg
)
=
SysAllocString
(
sysW
);
hr
=
IWshShell3_get_Environment
(
sh3
,
&
arg
,
&
env
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
VariantClear
(
&
arg
);
hr
=
IWshEnvironment_get_Item
(
env
,
NULL
,
NULL
);
ok
(
hr
==
E_POINTER
,
"got 0x%08x
\n
"
,
hr
);
ret
=
(
BSTR
)
0x1
;
hr
=
IWshEnvironment_get_Item
(
env
,
NULL
,
&
ret
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
ret
&&
!*
ret
,
"got %p
\n
"
,
ret
);
SysFreeString
(
ret
);
/* invalid var name */
str
=
SysAllocString
(
lnk1W
);
hr
=
IWshEnvironment_get_Item
(
env
,
str
,
NULL
);
ok
(
hr
==
E_POINTER
,
"got 0x%08x
\n
"
,
hr
);
ret
=
NULL
;
hr
=
IWshEnvironment_get_Item
(
env
,
str
,
&
ret
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
ret
&&
*
ret
==
0
,
"got %s
\n
"
,
wine_dbgstr_w
(
ret
));
SysFreeString
(
ret
);
SysFreeString
(
str
);
/* valid name */
str
=
SysAllocString
(
path2W
);
hr
=
IWshEnvironment_get_Item
(
env
,
str
,
&
ret
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
ret
&&
*
ret
!=
0
,
"got %s
\n
"
,
wine_dbgstr_w
(
ret
));
SysFreeString
(
ret
);
SysFreeString
(
str
);
IWshEnvironment_Release
(
env
);
IWshCollection_Release
(
coll
);
IDispatch_Release
(
disp
);
IWshShell3_Release
(
sh3
);
...
...
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