2 * Copyright 2009 Hans Leidekker for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
29 #include "wine/debug.h"
30 #include "wine/unicode.h"
31 #include "wbemprox_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(wbemprox
);
37 IWbemLocator IWbemLocator_iface
;
41 static inline wbem_locator
*impl_from_IWbemLocator( IWbemLocator
*iface
)
43 return CONTAINING_RECORD(iface
, wbem_locator
, IWbemLocator_iface
);
46 static ULONG WINAPI
wbem_locator_AddRef(
49 wbem_locator
*wl
= impl_from_IWbemLocator( iface
);
50 return InterlockedIncrement( &wl
->refs
);
53 static ULONG WINAPI
wbem_locator_Release(
56 wbem_locator
*wl
= impl_from_IWbemLocator( iface
);
57 LONG refs
= InterlockedDecrement( &wl
->refs
);
60 TRACE("destroying %p\n", wl
);
66 static HRESULT WINAPI
wbem_locator_QueryInterface(
71 wbem_locator
*This
= impl_from_IWbemLocator( iface
);
73 TRACE("%p %s %p\n", This
, debugstr_guid( riid
), ppvObject
);
75 if ( IsEqualGUID( riid
, &IID_IWbemLocator
) ||
76 IsEqualGUID( riid
, &IID_IUnknown
) )
82 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
85 IWbemLocator_AddRef( iface
);
89 static HRESULT WINAPI
wbem_locator_ConnectServer(
91 const BSTR NetworkResource
,
98 IWbemServices
**ppNamespace
)
102 TRACE("%p, %s, %s, %s, %s, 0x%08x, %s, %p, %p)\n", iface
, debugstr_w(NetworkResource
), debugstr_w(User
),
103 debugstr_w(Password
), debugstr_w(Locale
), SecurityFlags
, debugstr_w(Authority
), pCtx
, ppNamespace
);
105 if (((NetworkResource
[0] == '\\' && NetworkResource
[1] == '\\') ||
106 (NetworkResource
[0] == '/' && NetworkResource
[1] == '/')) && NetworkResource
[2] != '.')
108 FIXME("remote computer not supported\n");
109 return WBEM_E_TRANSPORT_FAILURE
;
111 if (User
|| Password
|| Authority
)
112 FIXME("authentication not supported\n");
114 FIXME("specific locale not supported\n");
116 FIXME("unsupported flags\n");
118 hr
= WbemServices_create( NULL
, (void **)ppNamespace
);
120 return WBEM_NO_ERROR
;
122 return WBEM_E_FAILED
;
125 static const IWbemLocatorVtbl wbem_locator_vtbl
=
127 wbem_locator_QueryInterface
,
129 wbem_locator_Release
,
130 wbem_locator_ConnectServer
133 HRESULT
WbemLocator_create( IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
137 TRACE("(%p,%p)\n", pUnkOuter
, ppObj
);
139 wl
= heap_alloc( sizeof(*wl
) );
140 if (!wl
) return E_OUTOFMEMORY
;
142 wl
->IWbemLocator_iface
.lpVtbl
= &wbem_locator_vtbl
;
145 *ppObj
= &wl
->IWbemLocator_iface
;
147 TRACE("returning iface %p\n", *ppObj
);