https://git.reactos.org/?p=reactos.git;a=commitdiff;h=12e94103e6bc8b8696dc2…
commit 12e94103e6bc8b8696dc2d4acc38dabe4b69ca0f
Author: Amine Khaldi <amine.khaldi(a)reactos.org>
AuthorDate: Sat Mar 24 13:12:02 2018 +0100
Commit: Amine Khaldi <amine.khaldi(a)reactos.org>
CommitDate: Sat Mar 24 13:12:02 2018 +0100
[WBEMDISP] Sync with Wine Staging 3.3. CORE-14434
---
dll/win32/wbemdisp/CMakeLists.txt | 4 +-
dll/win32/wbemdisp/locator.c | 268 +++++++++++++++++++++++++++++++++-
dll/win32/wbemdisp/main.c | 20 ++-
dll/win32/wbemdisp/precomp.h | 26 ++++
dll/win32/wbemdisp/wbemdisp_private.h | 36 -----
media/doc/README.WINE | 2 +-
6 files changed, 308 insertions(+), 48 deletions(-)
diff --git a/dll/win32/wbemdisp/CMakeLists.txt b/dll/win32/wbemdisp/CMakeLists.txt
index c449313019..439e110067 100644
--- a/dll/win32/wbemdisp/CMakeLists.txt
+++ b/dll/win32/wbemdisp/CMakeLists.txt
@@ -6,7 +6,7 @@ spec2def(wbemdisp.dll wbemdisp.spec)
list(APPEND SOURCE
locator.c
main.c
- wbemdisp_private.h)
+ precomp.h)
add_idl_headers(wbemdisp_idlheader wbemdisp_classes.idl)
add_typelib(wbemdisp_tlb.idl)
@@ -28,5 +28,5 @@ set_module_type(wbemdisp win32dll)
target_link_libraries(wbemdisp uuid wine)
add_dependencies(wbemdisp stdole2 wbemdisp_idlheader)
add_importlibs(wbemdisp oleaut32 ole32 msvcrt kernel32 ntdll)
-add_pch(wbemdisp wbemdisp_private.h SOURCE)
+add_pch(wbemdisp precomp.h SOURCE)
add_cd_file(TARGET wbemdisp DESTINATION reactos/system32/wbem FOR all)
diff --git a/dll/win32/wbemdisp/locator.c b/dll/win32/wbemdisp/locator.c
index 951e4648d0..18d735392e 100644
--- a/dll/win32/wbemdisp/locator.c
+++ b/dll/win32/wbemdisp/locator.c
@@ -16,11 +16,29 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#define COBJMACROS
+
+#include "config.h"
+#include <stdarg.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "initguid.h"
+#include "objbase.h"
+#include "wmiutils.h"
+#include "wbemcli.h"
+#include "wbemdisp.h"
+
+#include "wine/debug.h"
+#include "wine/heap.h"
+#include "wine/unicode.h"
#include "wbemdisp_private.h"
+#include "wbemdisp_classes.h"
-#include <wbemcli.h>
+WINE_DEFAULT_DEBUG_CHANNEL(wbemdisp);
static HRESULT EnumVARIANT_create( IEnumWbemClassObject *, IEnumVARIANT ** );
+static HRESULT ISWbemSecurity_create( ISWbemSecurity ** );
enum type_id
{
@@ -30,6 +48,7 @@ enum type_id
ISWbemProperty_tid,
ISWbemPropertySet_tid,
ISWbemServices_tid,
+ ISWbemSecurity_tid,
last_tid
};
@@ -43,7 +62,8 @@ static REFIID wbemdisp_tid_id[] =
&IID_ISWbemObjectSet,
&IID_ISWbemProperty,
&IID_ISWbemPropertySet,
- &IID_ISWbemServices
+ &IID_ISWbemServices,
+ &IID_ISWbemSecurity
};
static HRESULT get_typeinfo( enum type_id tid, ITypeInfo **ret )
@@ -1856,8 +1876,12 @@ static HRESULT WINAPI services_get_Security_(
ISWbemServices *iface,
ISWbemSecurity **objWbemSecurity )
{
- FIXME( "\n" );
- return E_NOTIMPL;
+ TRACE( "%p, %p\n", iface, objWbemSecurity );
+
+ if (!objWbemSecurity)
+ return E_INVALIDARG;
+
+ return ISWbemSecurity_create( objWbemSecurity );
}
static const ISWbemServicesVtbl services_vtbl =
@@ -2111,8 +2135,12 @@ static HRESULT WINAPI locator_get_Security_(
ISWbemLocator *iface,
ISWbemSecurity **objWbemSecurity )
{
- FIXME( "%p, %p\n", iface, objWbemSecurity );
- return E_NOTIMPL;
+ TRACE( "%p, %p\n", iface, objWbemSecurity );
+
+ if (!objWbemSecurity)
+ return E_INVALIDARG;
+
+ return ISWbemSecurity_create( objWbemSecurity );
}
static const ISWbemLocatorVtbl locator_vtbl =
@@ -2143,3 +2171,231 @@ HRESULT SWbemLocator_create( void **obj )
TRACE( "returning iface %p\n", *obj );
return S_OK;
}
+
+struct security
+{
+ ISWbemSecurity ISWbemSecurity_iface;
+ LONG refs;
+ WbemImpersonationLevelEnum implevel;
+ WbemAuthenticationLevelEnum authlevel;
+};
+
+static inline struct security *impl_from_ISWbemSecurity( ISWbemSecurity *iface )
+{
+ return CONTAINING_RECORD( iface, struct security, ISWbemSecurity_iface );
+}
+
+static ULONG WINAPI security_AddRef(
+ ISWbemSecurity *iface )
+{
+ struct security *security = impl_from_ISWbemSecurity( iface );
+ return InterlockedIncrement( &security->refs );
+}
+
+static ULONG WINAPI security_Release(
+ ISWbemSecurity *iface )
+{
+ struct security *security = impl_from_ISWbemSecurity( iface );
+ LONG refs = InterlockedDecrement( &security->refs );
+ if (!refs)
+ {
+ TRACE( "destroying %p\n", security );
+ heap_free( security );
+ }
+ return refs;
+}
+
+static HRESULT WINAPI security_QueryInterface(
+ ISWbemSecurity *iface,
+ REFIID riid,
+ void **ppvObject )
+{
+ struct security *security = impl_from_ISWbemSecurity( iface );
+ TRACE( "%p, %s, %p\n", security, debugstr_guid( riid ), ppvObject );
+
+ if (IsEqualGUID( riid, &IID_ISWbemSecurity ) ||
+ IsEqualGUID( riid, &IID_IDispatch ) ||
+ IsEqualGUID( riid, &IID_IUnknown ))
+ {
+ *ppvObject = iface;
+ }
+ else
+ {
+ FIXME( "interface %s not implemented\n", debugstr_guid(riid) );
+ return E_NOINTERFACE;
+ }
+ ISWbemSecurity_AddRef( iface );
+ return S_OK;
+}
+
+static HRESULT WINAPI security_GetTypeInfoCount(
+ ISWbemSecurity *iface,
+ UINT *count )
+{
+ struct security *security = impl_from_ISWbemSecurity( iface );
+ TRACE( "%p, %p\n", security, count );
+
+ *count = 1;
+ return S_OK;
+}
+
+static HRESULT WINAPI security_GetTypeInfo(
+ ISWbemSecurity *iface,
+ UINT index,
+ LCID lcid,
+ ITypeInfo **info )
+{
+ struct security *security = impl_from_ISWbemSecurity( iface );
+ TRACE( "%p, %u, %u, %p\n", security, index, lcid, info );
+
+ return get_typeinfo( ISWbemSecurity_tid, info );
+}
+
+static HRESULT WINAPI security_GetIDsOfNames(
+ ISWbemSecurity *iface,
+ REFIID riid,
+ LPOLESTR *names,
+ UINT count,
+ LCID lcid,
+ DISPID *dispid )
+{
+ struct security *security = impl_from_ISWbemSecurity( iface );
+ ITypeInfo *typeinfo;
+ HRESULT hr;
+
+ TRACE( "%p, %s, %p, %u, %u, %p\n", security, debugstr_guid(riid), names,
count, lcid, dispid );
+
+ if (!names || !count || !dispid) return E_INVALIDARG;
+
+ hr = get_typeinfo( ISWbemSecurity_tid, &typeinfo );
+ if (SUCCEEDED(hr))
+ {
+ hr = ITypeInfo_GetIDsOfNames( typeinfo, names, count, dispid );
+ ITypeInfo_Release( typeinfo );
+ }
+ return hr;
+}
+
+static HRESULT WINAPI security_Invoke(
+ ISWbemSecurity *iface,
+ DISPID member,
+ REFIID riid,
+ LCID lcid,
+ WORD flags,
+ DISPPARAMS *params,
+ VARIANT *result,
+ EXCEPINFO *excep_info,
+ UINT *arg_err )
+{
+ struct security *security = impl_from_ISWbemSecurity( iface );
+ ITypeInfo *typeinfo;
+ HRESULT hr;
+
+ TRACE( "%p, %d, %s, %d, %d, %p, %p, %p, %p\n", security, member,
debugstr_guid(riid),
+ lcid, flags, params, result, excep_info, arg_err );
+
+ hr = get_typeinfo( ISWbemSecurity_tid, &typeinfo );
+ if (SUCCEEDED(hr))
+ {
+ hr = ITypeInfo_Invoke( typeinfo, &security->ISWbemSecurity_iface, member,
flags,
+ params, result, excep_info, arg_err );
+ ITypeInfo_Release( typeinfo );
+ }
+ return hr;
+}
+
+static HRESULT WINAPI security_get_ImpersonationLevel_(
+ ISWbemSecurity *iface,
+ WbemImpersonationLevelEnum *impersonation_level )
+{
+ struct security *security = impl_from_ISWbemSecurity( iface );
+ FIXME( "%p, %p: stub\n", security, impersonation_level );
+
+ if (!impersonation_level)
+ return E_INVALIDARG;
+
+ *impersonation_level = security->implevel;
+ return S_OK;
+}
+
+static HRESULT WINAPI security_put_ImpersonationLevel_(
+ ISWbemSecurity *iface,
+ WbemImpersonationLevelEnum impersonation_level )
+{
+ struct security *security = impl_from_ISWbemSecurity( iface );
+ FIXME( "%p, %d: stub\n", security, impersonation_level );
+
+ security->implevel = impersonation_level;
+ return S_OK;
+}
+
+static HRESULT WINAPI security_get_AuthenticationLevel_(
+ ISWbemSecurity *iface,
+ WbemAuthenticationLevelEnum *authentication_level )
+{
+ struct security *security = impl_from_ISWbemSecurity( iface );
+ FIXME( "%p, %p: stub\n", security, authentication_level );
+
+ if (!authentication_level)
+ return E_INVALIDARG;
+
+ *authentication_level = security->authlevel;
+ return S_OK;
+}
+
+static HRESULT WINAPI security_put_AuthenticationLevel_(
+ ISWbemSecurity *iface,
+ WbemAuthenticationLevelEnum authentication_level )
+{
+ struct security *security = impl_from_ISWbemSecurity( iface );
+ FIXME( "%p, %d: stub\n", security, authentication_level );
+
+ security->authlevel = authentication_level;
+ return S_OK;
+}
+
+static HRESULT WINAPI security_get_Privileges_(
+ ISWbemSecurity *iface,
+ ISWbemPrivilegeSet **privilege_set )
+{
+ struct security *security = impl_from_ISWbemSecurity( iface );
+ FIXME( "%p, %p: stub\n", security, privilege_set );
+
+ if (!privilege_set)
+ return E_INVALIDARG;
+
+ return E_NOTIMPL;
+}
+
+static const ISWbemSecurityVtbl security_vtbl =
+{
+ security_QueryInterface,
+ security_AddRef,
+ security_Release,
+ security_GetTypeInfoCount,
+ security_GetTypeInfo,
+ security_GetIDsOfNames,
+ security_Invoke,
+ security_get_ImpersonationLevel_,
+ security_put_ImpersonationLevel_,
+ security_get_AuthenticationLevel_,
+ security_put_AuthenticationLevel_,
+ security_get_Privileges_
+};
+
+static HRESULT ISWbemSecurity_create( ISWbemSecurity **obj )
+{
+ struct security *security;
+
+ TRACE( "%p\n", obj );
+
+ if (!(security = heap_alloc( sizeof(*security) ))) return E_OUTOFMEMORY;
+ security->ISWbemSecurity_iface.lpVtbl = &security_vtbl;
+ security->refs = 1;
+ security->implevel = wbemImpersonationLevelAnonymous;
+ security->authlevel = wbemAuthenticationLevelDefault;
+
+ *obj = &security->ISWbemSecurity_iface;
+ TRACE( "returning iface %p\n", *obj );
+ return S_OK;
+}
diff --git a/dll/win32/wbemdisp/main.c b/dll/win32/wbemdisp/main.c
index e6a3dc28b0..9d9b0adf40 100644
--- a/dll/win32/wbemdisp/main.c
+++ b/dll/win32/wbemdisp/main.c
@@ -16,11 +16,25 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#include "config.h"
+#include <stdarg.h>
+
+#define COBJMACROS
+
+#include "windef.h"
+#include "winbase.h"
+#include "objbase.h"
+#include "wmiutils.h"
+#include "wbemdisp.h"
+#include "rpcproxy.h"
+
+#include "wine/debug.h"
+#include "wine/heap.h"
+#include "wine/unicode.h"
#include "wbemdisp_private.h"
+#include "wbemdisp_classes.h"
-#include <rpcproxy.h>
-#include <wmiutils.h>
-#include <wbemdisp_classes.h>
+WINE_DEFAULT_DEBUG_CHANNEL(wbemdisp);
static HINSTANCE instance;
diff --git a/dll/win32/wbemdisp/precomp.h b/dll/win32/wbemdisp/precomp.h
new file mode 100644
index 0000000000..c1f67ee56a
--- /dev/null
+++ b/dll/win32/wbemdisp/precomp.h
@@ -0,0 +1,26 @@
+
+#ifndef _WBEMDISP_PRECOMP_H_
+#define _WBEMDISP_PRECOMP_H_
+
+#include <wine/config.h>
+
+#include <stdarg.h>
+
+#define WIN32_NO_STATUS
+#define _INC_WINDOWS
+#define COM_NO_WINDOWS_H
+
+#define COBJMACROS
+
+#include <windef.h>
+#include <winbase.h>
+#include <objbase.h>
+#include <oleauto.h>
+#include <wbemdisp.h>
+
+#include <wine/debug.h>
+#include <wine/unicode.h>
+
+#include "wbemdisp_private.h"
+
+#endif /* !_WBEMDISP_PRECOMP_H_ */
diff --git a/dll/win32/wbemdisp/wbemdisp_private.h
b/dll/win32/wbemdisp/wbemdisp_private.h
index 301d5d34e4..b03a13e2ea 100644
--- a/dll/win32/wbemdisp/wbemdisp_private.h
+++ b/dll/win32/wbemdisp/wbemdisp_private.h
@@ -16,40 +16,4 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#ifndef _WBEMDISP_PRIVATE_H_
-#define _WBEMDISP_PRIVATE_H_
-
-#include <wine/config.h>
-
-#include <stdarg.h>
-
-#define WIN32_NO_STATUS
-#define _INC_WINDOWS
-#define COM_NO_WINDOWS_H
-
-#define COBJMACROS
-
-#include <windef.h>
-#include <winbase.h>
-#include <objbase.h>
-#include <oleauto.h>
-#include <wbemdisp.h>
-
-#include <wine/debug.h>
-#include <wine/unicode.h>
-
-WINE_DEFAULT_DEBUG_CHANNEL(wbemdisp);
-
HRESULT SWbemLocator_create(LPVOID *) DECLSPEC_HIDDEN;
-
-static inline void* __WINE_ALLOC_SIZE(1) heap_alloc(size_t size)
-{
- return HeapAlloc(GetProcessHeap(), 0, size);
-}
-
-static inline BOOL heap_free(void *mem)
-{
- return HeapFree(GetProcessHeap(), 0, mem);
-}
-
-#endif /* _WBEMDISP_PRIVATE_H_ */
diff --git a/media/doc/README.WINE b/media/doc/README.WINE
index 45607118d9..3e1658c9b5 100644
--- a/media/doc/README.WINE
+++ b/media/doc/README.WINE
@@ -194,7 +194,7 @@ reactos/dll/win32/uxtheme # Forked
reactos/dll/win32/vbscript # Synced to WineStaging-3.3
reactos/dll/win32/version # Synced to WineStaging-3.3
reactos/dll/win32/vssapi # Synced to WineStaging-2.9
-reactos/dll/win32/wbemdisp # Synced to Wine-3.0
+reactos/dll/win32/wbemdisp # Synced to WineStaging-3.3
reactos/dll/win32/wbemprox # Synced to Wine-3.0
reactos/dll/win32/windowscodecs # Synced to WineStaging-3.3
reactos/dll/win32/windowscodecsext # Synced to WineStaging-2.9