mirror of
https://github.com/reactos/reactos.git
synced 2025-01-01 03:54:02 +00:00
[WBEMDISP] Sync with Wine Staging 4.0. CORE-15682
This commit is contained in:
parent
727f534b9f
commit
8786e12d13
3 changed files with 108 additions and 45 deletions
|
@ -438,8 +438,19 @@ static HRESULT WINAPI propertyset_Item( ISWbemPropertySet *iface, BSTR name,
|
||||||
|
|
||||||
static HRESULT WINAPI propertyset_get_Count( ISWbemPropertySet *iface, LONG *count )
|
static HRESULT WINAPI propertyset_get_Count( ISWbemPropertySet *iface, LONG *count )
|
||||||
{
|
{
|
||||||
FIXME( "\n" );
|
static const WCHAR propcountW[] = {'_','_','P','R','O','P','E','R','T','Y','_','C','O','U','N','T',0};
|
||||||
return E_NOTIMPL;
|
struct propertyset *propertyset = impl_from_ISWbemPropertySet( iface );
|
||||||
|
HRESULT hr;
|
||||||
|
VARIANT val;
|
||||||
|
|
||||||
|
TRACE( "%p, %p\n", propertyset, count );
|
||||||
|
|
||||||
|
hr = IWbemClassObject_Get( propertyset->object, propcountW, 0, &val, NULL, NULL );
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
*count = V_I4( &val );
|
||||||
|
}
|
||||||
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI propertyset_Add( ISWbemPropertySet *iface, BSTR name, WbemCimtypeEnum type,
|
static HRESULT WINAPI propertyset_Add( ISWbemPropertySet *iface, BSTR name, WbemCimtypeEnum type,
|
||||||
|
@ -489,10 +500,12 @@ static HRESULT SWbemPropertySet_create( IWbemClassObject *wbem_object, ISWbemPro
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DISPID_BASE 0x1800000
|
#define DISPID_BASE 0x1800000
|
||||||
|
#define DISPID_BASE_METHOD 0x1000000
|
||||||
|
|
||||||
struct member
|
struct member
|
||||||
{
|
{
|
||||||
BSTR name;
|
BSTR name;
|
||||||
|
BOOL is_method;
|
||||||
DISPID dispid;
|
DISPID dispid;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -504,6 +517,7 @@ struct object
|
||||||
struct member *members;
|
struct member *members;
|
||||||
UINT nb_members;
|
UINT nb_members;
|
||||||
DISPID last_dispid;
|
DISPID last_dispid;
|
||||||
|
DISPID last_dispid_method;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline struct object *impl_from_ISWbemObject(
|
static inline struct object *impl_from_ISWbemObject(
|
||||||
|
@ -585,41 +599,83 @@ static HRESULT WINAPI object_GetTypeInfo(
|
||||||
|
|
||||||
static HRESULT init_members( struct object *object )
|
static HRESULT init_members( struct object *object )
|
||||||
{
|
{
|
||||||
LONG bound, i;
|
IWbemClassObject *sig_in, *sig_out;
|
||||||
SAFEARRAY *sa;
|
LONG i = 0, count = 0;
|
||||||
|
BSTR name;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
if (object->members) return S_OK;
|
if (object->members) return S_OK;
|
||||||
|
|
||||||
hr = IWbemClassObject_GetNames( object->object, NULL, 0, NULL, &sa );
|
hr = IWbemClassObject_BeginEnumeration( object->object, 0 );
|
||||||
if (FAILED( hr )) return hr;
|
if (SUCCEEDED( hr ))
|
||||||
hr = SafeArrayGetUBound( sa, 1, &bound );
|
|
||||||
if (FAILED( hr ))
|
|
||||||
{
|
{
|
||||||
SafeArrayDestroy( sa );
|
while (IWbemClassObject_Next( object->object, 0, NULL, NULL, NULL, NULL ) == S_OK) count++;
|
||||||
return hr;
|
IWbemClassObject_EndEnumeration( object->object );
|
||||||
}
|
}
|
||||||
if (!(object->members = heap_alloc( sizeof(struct member) * (bound + 1) )))
|
|
||||||
|
hr = IWbemClassObject_BeginMethodEnumeration( object->object, 0 );
|
||||||
|
if (SUCCEEDED( hr ))
|
||||||
{
|
{
|
||||||
SafeArrayDestroy( sa );
|
while (IWbemClassObject_NextMethod( object->object, 0, &name, &sig_in, &sig_out ) == S_OK)
|
||||||
return E_OUTOFMEMORY;
|
{
|
||||||
|
count++;
|
||||||
|
SysFreeString( name );
|
||||||
|
IWbemClassObject_Release( sig_in );
|
||||||
|
IWbemClassObject_Release( sig_out );
|
||||||
}
|
}
|
||||||
for (i = 0; i <= bound; i++)
|
IWbemClassObject_EndMethodEnumeration( object->object );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(object->members = heap_alloc( sizeof(struct member) * count ))) return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
hr = IWbemClassObject_BeginEnumeration( object->object, 0 );
|
||||||
|
if (SUCCEEDED( hr ))
|
||||||
{
|
{
|
||||||
hr = SafeArrayGetElement( sa, &i, &object->members[i].name );
|
while (IWbemClassObject_Next( object->object, 0, &name, NULL, NULL, NULL ) == S_OK)
|
||||||
if (FAILED( hr ))
|
|
||||||
{
|
{
|
||||||
for (i--; i >= 0; i--) SysFreeString( object->members[i].name );
|
object->members[i].name = name;
|
||||||
SafeArrayDestroy( sa );
|
object->members[i].is_method = FALSE;
|
||||||
|
object->members[i].dispid = 0;
|
||||||
|
if (++i > count)
|
||||||
|
{
|
||||||
|
IWbemClassObject_EndEnumeration( object->object );
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
TRACE( "added property %s\n", debugstr_w(name) );
|
||||||
|
}
|
||||||
|
IWbemClassObject_EndEnumeration( object->object );
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = IWbemClassObject_BeginMethodEnumeration( object->object, 0 );
|
||||||
|
if (SUCCEEDED( hr ))
|
||||||
|
{
|
||||||
|
while (IWbemClassObject_NextMethod( object->object, 0, &name, &sig_in, &sig_out ) == S_OK)
|
||||||
|
{
|
||||||
|
object->members[i].name = name;
|
||||||
|
object->members[i].is_method = TRUE;
|
||||||
|
object->members[i].dispid = 0;
|
||||||
|
if (++i > count)
|
||||||
|
{
|
||||||
|
IWbemClassObject_EndMethodEnumeration( object->object );
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
IWbemClassObject_Release( sig_in );
|
||||||
|
IWbemClassObject_Release( sig_out );
|
||||||
|
TRACE( "added method %s\n", debugstr_w(name) );
|
||||||
|
}
|
||||||
|
IWbemClassObject_EndMethodEnumeration( object->object );
|
||||||
|
}
|
||||||
|
|
||||||
|
object->nb_members = count;
|
||||||
|
TRACE( "added %u members\n", object->nb_members );
|
||||||
|
return S_OK;
|
||||||
|
|
||||||
|
error:
|
||||||
|
for (--i; i >= 0; i--) SysFreeString( object->members[i].name );
|
||||||
heap_free( object->members );
|
heap_free( object->members );
|
||||||
object->members = NULL;
|
object->members = NULL;
|
||||||
return E_OUTOFMEMORY;
|
object->nb_members = 0;
|
||||||
}
|
return E_FAIL;
|
||||||
object->members[i].dispid = 0;
|
|
||||||
}
|
|
||||||
object->nb_members = bound + 1;
|
|
||||||
SafeArrayDestroy( sa );
|
|
||||||
return S_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static DISPID get_member_dispid( struct object *object, const WCHAR *name )
|
static DISPID get_member_dispid( struct object *object, const WCHAR *name )
|
||||||
|
@ -629,7 +685,13 @@ static DISPID get_member_dispid( struct object *object, const WCHAR *name )
|
||||||
{
|
{
|
||||||
if (!strcmpiW( object->members[i].name, name ))
|
if (!strcmpiW( object->members[i].name, name ))
|
||||||
{
|
{
|
||||||
if (!object->members[i].dispid) object->members[i].dispid = ++object->last_dispid;
|
if (!object->members[i].dispid)
|
||||||
|
{
|
||||||
|
if (object->members[i].is_method)
|
||||||
|
object->members[i].dispid = ++object->last_dispid_method;
|
||||||
|
else
|
||||||
|
object->members[i].dispid = ++object->last_dispid;
|
||||||
|
}
|
||||||
return object->members[i].dispid;
|
return object->members[i].dispid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -701,7 +763,7 @@ static HRESULT WINAPI object_Invoke(
|
||||||
TRACE( "%p, %x, %s, %u, %x, %p, %p, %p, %p\n", object, member, debugstr_guid(riid),
|
TRACE( "%p, %x, %s, %u, %x, %p, %p, %p, %p\n", object, member, debugstr_guid(riid),
|
||||||
lcid, flags, params, result, excep_info, arg_err );
|
lcid, flags, params, result, excep_info, arg_err );
|
||||||
|
|
||||||
if (member <= DISPID_BASE)
|
if (member <= DISPID_BASE_METHOD)
|
||||||
{
|
{
|
||||||
hr = get_typeinfo( ISWbemObject_tid, &typeinfo );
|
hr = get_typeinfo( ISWbemObject_tid, &typeinfo );
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
|
@ -1044,6 +1106,7 @@ static HRESULT SWbemObject_create( IWbemClassObject *wbem_object, ISWbemObject *
|
||||||
object->members = NULL;
|
object->members = NULL;
|
||||||
object->nb_members = 0;
|
object->nb_members = 0;
|
||||||
object->last_dispid = DISPID_BASE;
|
object->last_dispid = DISPID_BASE;
|
||||||
|
object->last_dispid_method = DISPID_BASE_METHOD;
|
||||||
|
|
||||||
*obj = &object->ISWbemObject_iface;
|
*obj = &object->ISWbemObject_iface;
|
||||||
TRACE( "returning iface %p\n", *obj );
|
TRACE( "returning iface %p\n", *obj );
|
||||||
|
@ -1641,7 +1704,7 @@ static HRESULT WINAPI services_DeleteAsync(
|
||||||
static BSTR build_query_string( const WCHAR *class )
|
static BSTR build_query_string( const WCHAR *class )
|
||||||
{
|
{
|
||||||
static const WCHAR selectW[] = {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',0};
|
static const WCHAR selectW[] = {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',0};
|
||||||
UINT len = strlenW(class) + sizeof(selectW) / sizeof(selectW[0]);
|
UINT len = strlenW(class) + ARRAY_SIZE(selectW);
|
||||||
BSTR ret;
|
BSTR ret;
|
||||||
|
|
||||||
if (!(ret = SysAllocStringLen( NULL, len ))) return NULL;
|
if (!(ret = SysAllocStringLen( NULL, len ))) return NULL;
|
||||||
|
@ -2074,7 +2137,7 @@ static BSTR build_resource_string( BSTR server, BSTR namespace )
|
||||||
if (server && *server) len_server = strlenW( server );
|
if (server && *server) len_server = strlenW( server );
|
||||||
else len_server = 1;
|
else len_server = 1;
|
||||||
if (namespace && *namespace) len_namespace = strlenW( namespace );
|
if (namespace && *namespace) len_namespace = strlenW( namespace );
|
||||||
else len_namespace = sizeof(defaultW) / sizeof(defaultW[0]) - 1;
|
else len_namespace = ARRAY_SIZE(defaultW) - 1;
|
||||||
|
|
||||||
if (!(ret = SysAllocStringLen( NULL, 2 + len_server + 1 + len_namespace ))) return NULL;
|
if (!(ret = SysAllocStringLen( NULL, 2 + len_server + 1 + len_namespace ))) return NULL;
|
||||||
|
|
||||||
|
@ -2304,7 +2367,7 @@ static HRESULT WINAPI security_Invoke(
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI security_get_ImpersonationLevel_(
|
static HRESULT WINAPI security_get_ImpersonationLevel(
|
||||||
ISWbemSecurity *iface,
|
ISWbemSecurity *iface,
|
||||||
WbemImpersonationLevelEnum *impersonation_level )
|
WbemImpersonationLevelEnum *impersonation_level )
|
||||||
{
|
{
|
||||||
|
@ -2318,7 +2381,7 @@ static HRESULT WINAPI security_get_ImpersonationLevel_(
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI security_put_ImpersonationLevel_(
|
static HRESULT WINAPI security_put_ImpersonationLevel(
|
||||||
ISWbemSecurity *iface,
|
ISWbemSecurity *iface,
|
||||||
WbemImpersonationLevelEnum impersonation_level )
|
WbemImpersonationLevelEnum impersonation_level )
|
||||||
{
|
{
|
||||||
|
@ -2329,7 +2392,7 @@ static HRESULT WINAPI security_put_ImpersonationLevel_(
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI security_get_AuthenticationLevel_(
|
static HRESULT WINAPI security_get_AuthenticationLevel(
|
||||||
ISWbemSecurity *iface,
|
ISWbemSecurity *iface,
|
||||||
WbemAuthenticationLevelEnum *authentication_level )
|
WbemAuthenticationLevelEnum *authentication_level )
|
||||||
{
|
{
|
||||||
|
@ -2343,7 +2406,7 @@ static HRESULT WINAPI security_get_AuthenticationLevel_(
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI security_put_AuthenticationLevel_(
|
static HRESULT WINAPI security_put_AuthenticationLevel(
|
||||||
ISWbemSecurity *iface,
|
ISWbemSecurity *iface,
|
||||||
WbemAuthenticationLevelEnum authentication_level )
|
WbemAuthenticationLevelEnum authentication_level )
|
||||||
{
|
{
|
||||||
|
@ -2354,7 +2417,7 @@ static HRESULT WINAPI security_put_AuthenticationLevel_(
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI security_get_Privileges_(
|
static HRESULT WINAPI security_get_Privileges(
|
||||||
ISWbemSecurity *iface,
|
ISWbemSecurity *iface,
|
||||||
ISWbemPrivilegeSet **privilege_set )
|
ISWbemPrivilegeSet **privilege_set )
|
||||||
{
|
{
|
||||||
|
@ -2376,11 +2439,11 @@ static const ISWbemSecurityVtbl security_vtbl =
|
||||||
security_GetTypeInfo,
|
security_GetTypeInfo,
|
||||||
security_GetIDsOfNames,
|
security_GetIDsOfNames,
|
||||||
security_Invoke,
|
security_Invoke,
|
||||||
security_get_ImpersonationLevel_,
|
security_get_ImpersonationLevel,
|
||||||
security_put_ImpersonationLevel_,
|
security_put_ImpersonationLevel,
|
||||||
security_get_AuthenticationLevel_,
|
security_get_AuthenticationLevel,
|
||||||
security_put_AuthenticationLevel_,
|
security_put_AuthenticationLevel,
|
||||||
security_get_Privileges_
|
security_get_Privileges
|
||||||
};
|
};
|
||||||
|
|
||||||
static HRESULT ISWbemSecurity_create( ISWbemSecurity **obj )
|
static HRESULT ISWbemSecurity_create( ISWbemSecurity **obj )
|
||||||
|
@ -2392,8 +2455,8 @@ static HRESULT ISWbemSecurity_create( ISWbemSecurity **obj )
|
||||||
if (!(security = heap_alloc( sizeof(*security) ))) return E_OUTOFMEMORY;
|
if (!(security = heap_alloc( sizeof(*security) ))) return E_OUTOFMEMORY;
|
||||||
security->ISWbemSecurity_iface.lpVtbl = &security_vtbl;
|
security->ISWbemSecurity_iface.lpVtbl = &security_vtbl;
|
||||||
security->refs = 1;
|
security->refs = 1;
|
||||||
security->implevel = wbemImpersonationLevelAnonymous;
|
security->implevel = wbemImpersonationLevelImpersonate;
|
||||||
security->authlevel = wbemAuthenticationLevelDefault;
|
security->authlevel = wbemAuthenticationLevelPktPrivacy;
|
||||||
|
|
||||||
*obj = &security->ISWbemSecurity_iface;
|
*obj = &security->ISWbemSecurity_iface;
|
||||||
TRACE( "returning iface %p\n", *obj );
|
TRACE( "returning iface %p\n", *obj );
|
||||||
|
|
|
@ -374,7 +374,7 @@ static HRESULT WINAPI WinMGMTS_ParseDisplayName(IParseDisplayName *iface, IBindC
|
||||||
ULONG *pchEaten, IMoniker **ppmkOut)
|
ULONG *pchEaten, IMoniker **ppmkOut)
|
||||||
{
|
{
|
||||||
static const WCHAR prefixW[] = {'w','i','n','m','g','m','t','s',':',0};
|
static const WCHAR prefixW[] = {'w','i','n','m','g','m','t','s',':',0};
|
||||||
const DWORD prefix_len = sizeof(prefixW) / sizeof(prefixW[0]) - 1;
|
const DWORD prefix_len = ARRAY_SIZE(prefixW) - 1;
|
||||||
ISWbemLocator *locator = NULL;
|
ISWbemLocator *locator = NULL;
|
||||||
ISWbemServices *services = NULL;
|
ISWbemServices *services = NULL;
|
||||||
ISWbemObject *obj = NULL;
|
ISWbemObject *obj = NULL;
|
||||||
|
|
|
@ -194,7 +194,7 @@ reactos/dll/win32/uxtheme # Forked
|
||||||
reactos/dll/win32/vbscript # Synced to WineStaging-4.0
|
reactos/dll/win32/vbscript # Synced to WineStaging-4.0
|
||||||
reactos/dll/win32/version # Synced to WineStaging-4.0
|
reactos/dll/win32/version # Synced to WineStaging-4.0
|
||||||
reactos/dll/win32/vssapi # Synced to WineStaging-2.9
|
reactos/dll/win32/vssapi # Synced to WineStaging-2.9
|
||||||
reactos/dll/win32/wbemdisp # Synced to WineStaging-3.3
|
reactos/dll/win32/wbemdisp # Synced to WineStaging-4.0
|
||||||
reactos/dll/win32/wbemprox # Synced to WineStaging-3.9
|
reactos/dll/win32/wbemprox # Synced to WineStaging-3.9
|
||||||
reactos/dll/win32/windowscodecs # Synced to WineStaging-3.9
|
reactos/dll/win32/windowscodecs # Synced to WineStaging-3.9
|
||||||
reactos/dll/win32/windowscodecsext # Synced to WineStaging-2.9
|
reactos/dll/win32/windowscodecsext # Synced to WineStaging-2.9
|
||||||
|
|
Loading…
Reference in a new issue