Commit 9d3e458c authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

wshom/network: Implement UserDomain property.

parent e63da6ea
......@@ -114,9 +114,12 @@ static HRESULT WINAPI WshNetwork2_Invoke(IWshNetwork2 *iface, DISPID dispIdMembe
static HRESULT WINAPI WshNetwork2_get_UserDomain(IWshNetwork2 *iface, BSTR *user_domain)
{
FIXME("%p stub\n", user_domain);
TRACE("%p, %p.\n", iface, user_domain);
return E_NOTIMPL;
if (!user_domain)
return E_POINTER;
return get_env_var(L"USERDOMAIN", user_domain);
}
static HRESULT WINAPI WshNetwork2_get_UserName(IWshNetwork2 *iface, BSTR *user_name)
......
......@@ -538,16 +538,10 @@ static HRESULT WINAPI WshEnvironment_Invoke(IWshEnvironment *iface, DISPID dispI
return hr;
}
static HRESULT WINAPI WshEnvironment_get_Item(IWshEnvironment *iface, BSTR name, BSTR *value)
HRESULT get_env_var(const WCHAR *name, BSTR *value)
{
WshEnvironment *This = impl_from_IWshEnvironment(iface);
DWORD len;
TRACE("(%p)->(%s %p)\n", This, debugstr_w(name), value);
if (!value)
return E_POINTER;
len = GetEnvironmentVariableW(name, NULL, 0);
if (len)
{
......@@ -561,6 +555,18 @@ static HRESULT WINAPI WshEnvironment_get_Item(IWshEnvironment *iface, BSTR name,
return *value ? S_OK : E_OUTOFMEMORY;
}
static HRESULT WINAPI WshEnvironment_get_Item(IWshEnvironment *iface, BSTR name, BSTR *value)
{
WshEnvironment *This = impl_from_IWshEnvironment(iface);
TRACE("(%p)->(%s %p)\n", This, debugstr_w(name), value);
if (!value)
return E_POINTER;
return get_env_var(name, value);
}
static HRESULT WINAPI WshEnvironment_put_Item(IWshEnvironment *iface, BSTR name, BSTR value)
{
WshEnvironment *This = impl_from_IWshEnvironment(iface);
......
......@@ -745,6 +745,14 @@ static void test_wshnetwork(void)
SysFreeString(name);
SysFreeString(str);
str = NULL;
hr = IWshNetwork2_get_UserDomain(nw2, NULL);
ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
hr = IWshNetwork2_get_UserDomain(nw2, &str);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(!!str, "Unexpected pointer.\n");
SysFreeString(str);
IWshNetwork2_Release(nw2);
IDispatch_Release(disp);
}
......
......@@ -46,6 +46,7 @@ struct provideclassinfo {
};
extern void init_classinfo(const GUID *guid, IUnknown *outer, struct provideclassinfo *classinfo);
HRESULT get_env_var(const WCHAR *name, BSTR *value);
HRESULT WINAPI WshShellFactory_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**);
HRESULT WINAPI WshNetworkFactory_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment