summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-09-16 05:48:29 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-09-16 05:48:29 +0200
commitdb872cfe3713315a5163bf0db8e9644019c9c664 (patch)
treef9b2fadb67515ab1f0dc12d67953caeff4773336
parente970efc721abafb9d0a30579454d18b1d502a272 (diff)
downloadsamba-db872cfe3713315a5163bf0db8e9644019c9c664.tar.gz
samba-db872cfe3713315a5163bf0db8e9644019c9c664.tar.bz2
samba-db872cfe3713315a5163bf0db8e9644019c9c664.zip
Remove more hand-written marshallers.
-rw-r--r--source4/lib/com/dcom/dcom.h3
-rw-r--r--source4/lib/wmi/wbemdata.c252
-rw-r--r--source4/lib/wmi/wmi.h16
-rw-r--r--source4/libcli/util/ntstatus.h1
-rw-r--r--source4/librpc/idl/wmi.idl294
-rw-r--r--source4/librpc/ndr/ndr_wmi.c759
-rw-r--r--source4/librpc/ndr/ndr_wmi.h3
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm2
8 files changed, 134 insertions, 1196 deletions
diff --git a/source4/lib/com/dcom/dcom.h b/source4/lib/com/dcom/dcom.h
index 3ce0478172..0d8c145d7e 100644
--- a/source4/lib/com/dcom/dcom.h
+++ b/source4/lib/com/dcom/dcom.h
@@ -54,7 +54,7 @@ WERROR dcom_create_object(struct com_context *ctx, struct GUID *clsid, const cha
WERROR dcom_get_class_object(struct com_context *ctx, struct GUID *clsid, const char *server, struct GUID *iid, struct IUnknown **ip);
NTSTATUS dcom_get_pipe(struct IUnknown *iface, struct dcerpc_pipe **pp);
NTSTATUS dcom_OBJREF_from_IUnknown(struct OBJREF *o, struct IUnknown *p);
-NTSTATUS dcom_IUnknown_from_OBJREF(struct com_context *ctx, struct IUnknown **_p, struct OBJREF *o);
+NTSTATUS dcom_IUnknown_from_OBJREF(TALLOC_CTX *mem_ctx, struct com_context *ctx, struct IUnknown **_p, struct OBJREF *o);
uint64_t dcom_get_current_oxid(void);
void dcom_add_server_credentials(struct com_context *ctx, const char *server, struct cli_credentials *credentials);
WERROR dcom_query_interface(struct IUnknown *d, uint32_t cRefs, uint16_t cIids, struct GUID *iids, struct IUnknown **ip, WERROR *results);
@@ -70,5 +70,6 @@ void dcom_release_continue(struct composite_context *cr);
#define IUnknown_ipid(d) ((d)->obj.u_objref.u_standard.std.ipid)
struct composite_context *dcom_release_send(struct IUnknown *d, TALLOC_CTX *mem_ctx);
marshal_fn dcom_marshal_by_clsid(struct GUID *clsid);
+unmarshal_fn dcom_unmarshal_by_clsid(struct GUID *clsid);
#endif /* _DCOM_H */
diff --git a/source4/lib/wmi/wbemdata.c b/source4/lib/wmi/wbemdata.c
index 58bf177c0c..57e4022e7c 100644
--- a/source4/lib/wmi/wbemdata.c
+++ b/source4/lib/wmi/wbemdata.c
@@ -33,7 +33,7 @@
#include "lib/talloc/talloc.h"
#include "libcli/composite/composite.h"
#include "lib/wmi/wmi.h"
-#include "librpc/ndr/ndr_wmi.h"
+#include "librpc/gen_ndr/ndr_wmi.h"
enum {
DATATYPE_CLASSOBJECT = 2,
@@ -44,7 +44,7 @@ enum {
static enum ndr_err_code marshal(TALLOC_CTX *mem_ctx, struct IUnknown *pv, struct OBJREF *o)
{
struct ndr_push *ndr;
- struct WbemClassObject *wco;
+ struct IWbemClassObject *wco;
struct MInterfacePointer *mp;
mp = (struct MInterfacePointer *)((char *)o - offsetof(struct MInterfacePointer, obj)); /* FIXME:high remove this Mumbo Jumbo */
@@ -58,7 +58,7 @@ static enum ndr_err_code marshal(TALLOC_CTX *mem_ctx, struct IUnknown *pv, struc
uint32_t ofs;
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0x12345678));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
- NDR_CHECK(ndr_push_WbemClassObject(ndr, NDR_SCALARS | NDR_BUFFERS, wco));
+ NDR_CHECK(ndr_push_IWbemClassObject(ndr, NDR_SCALARS | NDR_BUFFERS, wco));
ofs = ndr->offset;
ndr->offset = 4;
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ofs - 8));
@@ -70,7 +70,7 @@ static enum ndr_err_code marshal(TALLOC_CTX *mem_ctx, struct IUnknown *pv, struc
o->u_objref.u_custom.size = ndr->offset;
mp->size = sizeof(struct OBJREF) - sizeof(union OBJREF_Types) + sizeof(struct u_custom) + o->u_objref.u_custom.size - 4;
if (DEBUGLVL(9)) {
- NDR_PRINT_DEBUG(WbemClassObject, wco);
+ NDR_PRINT_DEBUG(IWbemClassObject, wco);
}
return NDR_ERR_SUCCESS;
}
@@ -78,7 +78,7 @@ static enum ndr_err_code marshal(TALLOC_CTX *mem_ctx, struct IUnknown *pv, struc
static enum ndr_err_code unmarshal(TALLOC_CTX *mem_ctx, struct OBJREF *o, struct IUnknown **pv)
{
struct ndr_pull *ndr;
- struct WbemClassObject *wco;
+ struct IWbemClassObject *wco;
enum ndr_err_code ndr_err;
uint32_t u;
@@ -99,12 +99,12 @@ static enum ndr_err_code unmarshal(TALLOC_CTX *mem_ctx, struct OBJREF *o, struct
DEBUG(1, ("unmarshall_IWbemClassObject: Incorrect data_size"));
return NDR_ERR_BUFSIZE;
}
- wco = talloc_zero(*pv, struct WbemClassObject);
+ wco = talloc_zero(*pv, struct IWbemClassObject);
ndr->current_mem_ctx = wco;
- ndr_err = ndr_pull_WbemClassObject(ndr, NDR_SCALARS | NDR_BUFFERS, wco);
+ ndr_err = ndr_pull_IWbemClassObject(ndr, NDR_SCALARS | NDR_BUFFERS, wco);
if (NDR_ERR_CODE_IS_SUCCESS(ndr_err) && (DEBUGLVL(9))) {
- NDR_PRINT_DEBUG(WbemClassObject, wco);
+ NDR_PRINT_DEBUG(IWbemClassObject, wco);
}
if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
@@ -115,7 +115,7 @@ static enum ndr_err_code unmarshal(TALLOC_CTX *mem_ctx, struct OBJREF *o, struct
return NDR_ERR_SUCCESS;
}
-WERROR dcom_IWbemClassObject_from_WbemClassObject(struct com_context *ctx, struct IWbemClassObject **_p, struct WbemClassObject *wco)
+WERROR dcom_IWbemClassObject_from_WbemClassObject(struct com_context *ctx, struct IWbemClassObject **_p, struct IWbemClassObject *wco)
{
struct IWbemClassObject *p;
@@ -134,9 +134,9 @@ WERROR dcom_IWbemClassObject_from_WbemClassObject(struct com_context *ctx, struc
WERROR IWbemClassObject_GetMethod(struct IWbemClassObject *d, TALLOC_CTX *mem_ctx, const char *name, uint32_t flags, struct IWbemClassObject **in, struct IWbemClassObject **out)
{
uint32_t i;
- struct WbemClassObject *wco;
+ struct IWbemClassObject *wco;
- wco = (struct WbemClassObject *)d->object_data;
+ wco = (struct IWbemClassObject *)d->object_data;
for (i = 0; i < wco->obj_methods->count; ++i)
if (!strcmp(wco->obj_methods->method[i].name, name)) {
if (in) dcom_IWbemClassObject_from_WbemClassObject(d->ctx, in, wco->obj_methods->method[i].in);
@@ -146,7 +146,7 @@ WERROR IWbemClassObject_GetMethod(struct IWbemClassObject *d, TALLOC_CTX *mem_ct
return WERR_NOT_FOUND;
}
-void WbemClassObject_CreateInstance(struct WbemClassObject *wco)
+void IWbemClassObject_CreateInstance(struct IWbemClassObject *wco)
{
uint32_t i;
@@ -169,222 +169,18 @@ WERROR IWbemClassObject_Clone(struct IWbemClassObject *d, TALLOC_CTX *mem_ctx, s
WERROR IWbemClassObject_SpawnInstance(struct IWbemClassObject *d, TALLOC_CTX *mem_ctx, uint32_t flags, struct IWbemClassObject **instance)
{
- struct WbemClassObject *wco, *nwco;
+ struct IWbemClassObject *wco, *nwco;
- wco = (struct WbemClassObject *)d->object_data;
- nwco = talloc_zero(mem_ctx, struct WbemClassObject);
+ wco = (struct IWbemClassObject *)d->object_data;
+ nwco = talloc_zero(mem_ctx, struct IWbemClassObject);
nwco->flags = WCF_INSTANCE;
nwco->obj_class = wco->obj_class;
- WbemClassObject_CreateInstance(nwco);
+ IWbemClassObject_CreateInstance(nwco);
dcom_IWbemClassObject_from_WbemClassObject(d->ctx, instance, nwco);
return WERR_OK;
}
-void duplicate_WbemQualifier(TALLOC_CTX *mem_ctx, const struct WbemQualifier *src, struct WbemQualifier *dst)
-{
- dst->name = src->name;
- if (src->name) dst->name = talloc_strdup(mem_ctx, src->name);
-
- dst->flavors = src->flavors;
-
- dst->cimtype = src->cimtype;
-
- duplicate_CIMVAR(mem_ctx, &src->value, &dst->value, src->cimtype);
-}
-
-void duplicate_CIMSTRINGS(TALLOC_CTX *mem_ctx, const struct CIMSTRINGS *src, struct CIMSTRINGS *dst)
-{
- uint32_t i;
-
- dst->count = src->count;
- for (i = 0; i < src->count; ++i)
- dst->item[i] = talloc_strdup(mem_ctx, src->item[i]);
-}
-
-void duplicate_WbemQualifiers(TALLOC_CTX *mem_ctx, const struct WbemQualifiers *src, struct WbemQualifiers *dst)
-{
- uint32_t i;
-
- dst->count = src->count;
- for (i = 0; i < src->count; ++i) {
- dst->item[i] = talloc_zero(mem_ctx, struct WbemQualifier);
- duplicate_WbemQualifier(dst->item[i], src->item[i], dst->item[i]);
- }
-}
-
-void duplicate_WbemClass(TALLOC_CTX *mem_ctx, const struct WbemClass *src, struct WbemClass *dst)
-{
- uint32_t i;
-
- dst->u_0 = src->u_0;
-
- dst->__CLASS = src->__CLASS;
- if (src->__CLASS) dst->__CLASS = talloc_strdup(mem_ctx, src->__CLASS);
-
- duplicate_CIMSTRINGS(mem_ctx, &src->__DERIVATION, &dst->__DERIVATION);
- duplicate_WbemQualifiers(mem_ctx, &src->qualifiers, &dst->qualifiers);
-
- dst->__PROPERTY_COUNT = src->__PROPERTY_COUNT;
-
- dst->properties = talloc_array(mem_ctx, struct WbemClassProperty, src->__PROPERTY_COUNT);
- for (i = 0; i < src->__PROPERTY_COUNT; ++i) {
- dst->properties[i].property.name = talloc_strdup(dst->properties, src->properties[i].property.name);
- dst->properties[i].property.desc = talloc_memdup(dst->properties, src->properties[i].property.desc, sizeof(*src->properties[i].property.desc));
- duplicate_WbemQualifiers(dst->properties[i].property.desc, &src->properties[i].property.desc->qualifiers, &dst->properties[i].property.desc->qualifiers);
- }
-
- for (i = 0; i < src->__PROPERTY_COUNT; ++i) {
- dst->properties[i].default_flags = src->properties[i].default_flags;
- duplicate_CIMVAR(dst->properties, &src->properties[i].default_values, &dst->properties[i].default_values, src->properties[i].property.desc->cimtype);
- }
-}
-
-void duplicate_WbemMethod(TALLOC_CTX *mem_ctx, const struct WbemMethod *src, struct WbemMethod *dst)
-{
- dst->name = src->name;
- if (src->name) dst->name = talloc_strdup(mem_ctx, src->name);
-
- dst->u0 = src->u0;
- dst->u1 = src->u1;
-
- dst->qualifiers = talloc_zero(mem_ctx, struct WbemQualifiers);
- duplicate_WbemQualifiers(dst->qualifiers, src->qualifiers, dst->qualifiers);
-
- dst->in = src->in;
- if (src->in) {
- dst->in = talloc_zero(mem_ctx, struct WbemClassObject);
- duplicate_WbemClassObject(dst->in, src->in, dst->in);
- }
-
- dst->out = src->out;
- if (src->out) {
- dst->out = talloc_zero(mem_ctx, struct WbemClassObject);
- duplicate_WbemClassObject(dst->out, src->out, dst->out);
- }
-}
-
-void duplicate_WbemMethods(TALLOC_CTX *mem_ctx, const struct WbemMethods *src, struct WbemMethods *dst)
-{
- uint32_t i;
-
- dst->count = src->count;
- dst->u0 = src->u0;
- for (i = 0; i < src->count; ++i)
- duplicate_WbemMethod(mem_ctx, &src->method[i], &dst->method[i]);
-}
-
-void duplicate_WbemInstance(TALLOC_CTX *mem_ctx, const struct WbemInstance *src, struct WbemInstance *dst, const struct WbemClass *cls)
-{
- uint32_t i;
-
- dst->u1_0 = src->u1_0;
-
- dst->__CLASS = src->__CLASS;
- if (src->__CLASS) dst->__CLASS = talloc_strdup(mem_ctx, src->__CLASS);
-
- dst->default_flags = talloc_array(mem_ctx, uint8_t, cls->__PROPERTY_COUNT);
- dst->data = talloc_array(mem_ctx, union CIMVAR, cls->__PROPERTY_COUNT);
- for (i = 0; i < cls->__PROPERTY_COUNT; ++i) {
- dst->default_flags[i] = src->default_flags[i];
- duplicate_CIMVAR(dst->data, &src->data[i], &dst->data[i], cls->properties[i].property.desc->cimtype);
- }
-
- dst->u2_4 = src->u2_4;
- dst->u3_1 = src->u3_1;
-}
-
-void duplicate_WbemClassObject(TALLOC_CTX *mem_ctx, const struct WbemClassObject *src, struct WbemClassObject *dst)
-{
- dst->flags = src->flags;
- if (src->flags & WCF_CLASS) {
- dst->__SERVER = talloc_strdup(mem_ctx, src->__SERVER);
- dst->__NAMESPACE = talloc_strdup(mem_ctx, src->__NAMESPACE);
- }
- if (src->flags & WCF_DECORATIONS) {
- dst->sup_class = talloc_zero(mem_ctx, struct WbemClass);
- duplicate_WbemClass(dst->sup_class, src->sup_class, dst->sup_class);
-
- dst->sup_methods = talloc_zero(mem_ctx, struct WbemMethods);
- duplicate_WbemMethods(dst->sup_methods, src->sup_methods, dst->sup_methods);
-
- dst->obj_methods = talloc_zero(mem_ctx, struct WbemMethods);
- duplicate_WbemMethods(dst->obj_methods, src->obj_methods, dst->obj_methods);
- }
- if (src->flags & (WCF_CLASS | WCF_INSTANCE)) {
- dst->obj_class = talloc_zero(mem_ctx, struct WbemClass);
- duplicate_WbemClass(dst->obj_class, src->obj_class, dst->obj_class);
- }
- if (src->flags & WCF_INSTANCE) {
- dst->instance = talloc_zero(mem_ctx, struct WbemInstance);
- duplicate_WbemInstance(dst->instance, src->instance, dst->instance, src->obj_class);
- }
-}
-
-void duplicate_CIMVAR(TALLOC_CTX *mem_ctx, const union CIMVAR *src, union CIMVAR *dst, enum CIMTYPE_ENUMERATION cimtype)
-{
- uint32_t i;
-
- switch (cimtype & CIM_TYPEMASK) {
- case CIM_SINT8:
- case CIM_UINT8:
- case CIM_SINT16:
- case CIM_UINT16:
- case CIM_SINT32:
- case CIM_UINT32:
- case CIM_SINT64:
- case CIM_UINT64:
- case CIM_REAL32:
- case CIM_REAL64:
- case CIM_BOOLEAN:
- *dst = *src;
- break;
- case CIM_STRING:
- case CIM_DATETIME:
- case CIM_REFERENCE:
- dst->v_string = talloc_strdup(mem_ctx, src->v_string);
- break;
- case CIM_OBJECT:
- dst->v_object = talloc_zero(mem_ctx, struct WbemClassObject);
- duplicate_WbemClassObject(dst->v_object, src->v_object, dst->v_object);
- break;
- case CIM_ARR_SINT8:
- case CIM_ARR_UINT8:
- dst->a_uint8 = talloc_memdup(mem_ctx, src->a_uint8, sizeof(struct arr_uint8));
- dst->a_uint8->item = talloc_memdup(dst->a_uint8, src->a_uint8->item, src->a_uint8->count);
- break;
- case CIM_ARR_SINT16:
- case CIM_ARR_UINT16:
- case CIM_ARR_BOOLEAN:
- dst->a_uint8 = talloc_memdup(mem_ctx, src->a_uint8, sizeof(struct arr_uint8));
- dst->a_uint8->item = talloc_memdup(dst->a_uint8, src->a_uint8->item, 2*src->a_uint8->count);
- break;
- case CIM_ARR_SINT32:
- case CIM_ARR_UINT32:
- case CIM_ARR_REAL32:
- dst->a_uint8 = talloc_memdup(mem_ctx, src->a_uint8, sizeof(struct arr_uint8));
- dst->a_uint8->item = talloc_memdup(dst->a_uint8, src->a_uint8->item, 4*src->a_uint8->count);
- break;
- case CIM_ARR_SINT64:
- case CIM_ARR_UINT64:
- case CIM_ARR_REAL64:
- dst->a_uint8 = talloc_memdup(mem_ctx, src->a_uint8, sizeof(struct arr_uint8));
- dst->a_uint8->item = talloc_memdup(dst->a_uint8, src->a_uint8->item, 8*src->a_uint8->count);
- break;
- case CIM_ARR_STRING:
- case CIM_ARR_DATETIME:
- case CIM_ARR_REFERENCE:
- dst->a_uint8 = talloc_memdup(mem_ctx, src->a_uint8, sizeof(struct arr_uint8));
- dst->a_uint8->item = talloc_memdup(dst->a_uint8, src->a_uint8->item, 4*src->a_uint8->count);
- for (i = 0; i < src->a_uint8->count; ++i)
- dst->a_string->item[i] = talloc_strdup(dst->a_uint8->item, src->a_string->item[i]);
- break;
- default:
- DEBUG(0, ("duplicate_CIMVAR: cimtype 0x%04X not supported\n", cimtype & CIM_TYPEMASK));
- break;
- }
-}
-
-WERROR WbemClassObject_Get(struct WbemClassObject *d, TALLOC_CTX *mem_ctx, const char *name, uint32_t flags, union CIMVAR *val, enum CIMTYPE_ENUMERATION *cimtype, uint32_t *flavor)
+WERROR IWbemClassObject_Get(struct IWbemClassObject *d, TALLOC_CTX *mem_ctx, const char *name, uint32_t flags, union CIMVAR *val, enum CIMTYPE_ENUMERATION *cimtype, uint32_t *flavor)
{
uint32_t i;
for (i = 0; i < d->obj_class->__PROPERTY_COUNT; ++i) {
@@ -402,10 +198,10 @@ WERROR WbemClassObject_Get(struct WbemClassObject *d, TALLOC_CTX *mem_ctx, const
WERROR IWbemClassObject_Put(struct IWbemClassObject *d, TALLOC_CTX *mem_ctx, const char *name, uint32_t flags, union CIMVAR *val, enum CIMTYPE_ENUMERATION cimtype)
{
- struct WbemClassObject *wco;
+ struct IWbemClassObject *wco;
uint32_t i;
- wco = (struct WbemClassObject *)d->object_data;
+ wco = (struct IWbemClassObject *)d->object_data;
for (i = 0; i < wco->obj_class->__PROPERTY_COUNT; ++i) {
if (!strcmp(wco->obj_class->properties[i].property.name, name)) {
if (cimtype && cimtype != wco->obj_class->properties[i].property.desc->cimtype) return WERR_INVALID_PARAM;
@@ -465,7 +261,7 @@ struct IEnumWbemClassObject_data {
#define NDR_CHECK_CONST(val, exp) NDR_CHECK_EXPR((val) == (exp))
-static enum ndr_err_code WBEMDATA_Parse(TALLOC_CTX *mem_ctx, uint8_t *data, uint32_t size, struct IEnumWbemClassObject *d, uint32_t uCount, struct WbemClassObject **apObjects)
+static enum ndr_err_code WBEMDATA_Parse(TALLOC_CTX *mem_ctx, uint8_t *data, uint32_t size, struct IEnumWbemClassObject *d, uint32_t uCount, struct IWbemClassObject **apObjects)
{
struct ndr_pull *ndr;
uint32_t u, i, ofs_next;
@@ -524,14 +320,14 @@ static enum ndr_err_code WBEMDATA_Parse(TALLOC_CTX *mem_ctx, uint8_t *data, uint
NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &guid));
switch (datatype) {
case DATATYPE_CLASSOBJECT:
- apObjects[i] = talloc_zero(d->ctx, struct WbemClassObject);
+ apObjects[i] = talloc_zero(d->ctx, struct IWbemClassObject);
ndr->current_mem_ctx = apObjects[i];
NDR_CHECK(ndr_pull_WbemClassObject(ndr, NDR_SCALARS|NDR_BUFFERS, apObjects[i]));
ndr->current_mem_ctx = d->ctx;
add_pair_guid_ptr(ecod, &ecod->cache, &guid, apObjects[i]->obj_class);
break;
case DATATYPE_OBJECT:
- apObjects[i] = talloc_zero(d->ctx, struct WbemClassObject);
+ apObjects[i] = talloc_zero(d->ctx, struct IWbemClassObject);
apObjects[i]->obj_class = get_ptr_by_guid(ecod->cache, &guid);
(void)talloc_reference(apObjects[i], apObjects[i]->obj_class);
ndr->current_mem_ctx = apObjects[i];
@@ -544,13 +340,13 @@ static enum ndr_err_code WBEMDATA_Parse(TALLOC_CTX *mem_ctx, uint8_t *data, uint
}
ndr->offset = ofs_next;
if (DEBUGLVL(9)) {
- NDR_PRINT_DEBUG(WbemClassObject, apObjects[i]);
+ NDR_PRINT_DEBUG(IWbemClassObject, apObjects[i]);
}
}
return NDR_ERR_SUCCESS;
}
-WERROR IEnumWbemClassObject_SmartNext(struct IEnumWbemClassObject *d, TALLOC_CTX *mem_ctx, int32_t lTimeout, uint32_t uCount, struct WbemClassObject **apObjects, uint32_t *puReturned)
+WERROR IEnumWbemClassObject_SmartNext(struct IEnumWbemClassObject *d, TALLOC_CTX *mem_ctx, int32_t lTimeout, uint32_t uCount, struct IWbemClassObject **apObjects, uint32_t *puReturned)
{
WERROR result;
NTSTATUS status;
diff --git a/source4/lib/wmi/wmi.h b/source4/lib/wmi/wmi.h
index 085e01215f..32543a8ca7 100644
--- a/source4/lib/wmi/wmi.h
+++ b/source4/lib/wmi/wmi.h
@@ -34,23 +34,13 @@ const char *wmi_errstr(WERROR werror);
/* The following definitions come from lib/wmi/wbemdata.c */
-WERROR dcom_IWbemClassObject_from_WbemClassObject(struct com_context *ctx, struct IWbemClassObject **_p, struct WbemClassObject *wco);
WERROR IWbemClassObject_GetMethod(struct IWbemClassObject *d, TALLOC_CTX *mem_ctx, const char *name, uint32_t flags, struct IWbemClassObject **in, struct IWbemClassObject **out);
-void WbemClassObject_CreateInstance(struct WbemClassObject *wco);
+void WbemClassObject_CreateInstance(struct IWbemClassObject *wco);
WERROR IWbemClassObject_Clone(struct IWbemClassObject *d, TALLOC_CTX *mem_ctx, struct IWbemClassObject **copy);
WERROR IWbemClassObject_SpawnInstance(struct IWbemClassObject *d, TALLOC_CTX *mem_ctx, uint32_t flags, struct IWbemClassObject **instance);
-void duplicate_WbemQualifier(TALLOC_CTX *mem_ctx, const struct WbemQualifier *src, struct WbemQualifier *dst);
-void duplicate_CIMSTRINGS(TALLOC_CTX *mem_ctx, const struct CIMSTRINGS *src, struct CIMSTRINGS *dst);
-void duplicate_WbemQualifiers(TALLOC_CTX *mem_ctx, const struct WbemQualifiers *src, struct WbemQualifiers *dst);
-void duplicate_WbemClass(TALLOC_CTX *mem_ctx, const struct WbemClass *src, struct WbemClass *dst);
-void duplicate_WbemMethod(TALLOC_CTX *mem_ctx, const struct WbemMethod *src, struct WbemMethod *dst);
-void duplicate_WbemMethods(TALLOC_CTX *mem_ctx, const struct WbemMethods *src, struct WbemMethods *dst);
-void duplicate_WbemInstance(TALLOC_CTX *mem_ctx, const struct WbemInstance *src, struct WbemInstance *dst, const struct WbemClass *cls);
-void duplicate_WbemClassObject(TALLOC_CTX *mem_ctx, const struct WbemClassObject *src, struct WbemClassObject *dst);
-void duplicate_CIMVAR(TALLOC_CTX *mem_ctx, const union CIMVAR *src, union CIMVAR *dst, enum CIMTYPE_ENUMERATION cimtype);
-WERROR WbemClassObject_Get(struct WbemClassObject *d, TALLOC_CTX *mem_ctx, const char *name, uint32_t flags, union CIMVAR *val, enum CIMTYPE_ENUMERATION *cimtype, uint32_t *flavor);
+WERROR IWbemClassObject_Get(struct IWbemClassObject *d, TALLOC_CTX *mem_ctx, const char *name, uint32_t flags, union CIMVAR *val, enum CIMTYPE_ENUMERATION *cimtype, uint32_t *flavor);
WERROR IWbemClassObject_Put(struct IWbemClassObject *d, TALLOC_CTX *mem_ctx, const char *name, uint32_t flags, union CIMVAR *val, enum CIMTYPE_ENUMERATION cimtype);
-WERROR IEnumWbemClassObject_SmartNext(struct IEnumWbemClassObject *d, TALLOC_CTX *mem_ctx, int32_t lTimeout, uint32_t uCount, struct WbemClassObject **apObjects, uint32_t *puReturned);
+WERROR IEnumWbemClassObject_SmartNext(struct IEnumWbemClassObject *d, TALLOC_CTX *mem_ctx, int32_t lTimeout, uint32_t uCount, struct IWbemClassObject **apObjects, uint32_t *puReturned);
struct composite_context *dcom_proxy_IEnumWbemClassObject_Release_send(struct IUnknown *d, TALLOC_CTX *mem_ctx);
void wmi_init(struct com_context **ctx, struct cli_credentials *credentials);
diff --git a/source4/libcli/util/ntstatus.h b/source4/libcli/util/ntstatus.h
index 9c7bee0dfe..7d223ae789 100644
--- a/source4/libcli/util/ntstatus.h
+++ b/source4/libcli/util/ntstatus.h
@@ -597,6 +597,7 @@ typedef uint32_t NTSTATUS;
#define NT_STATUS_DOWNGRADE_DETECTED NT_STATUS(0xC0000000 | 0x0388)
#define NT_STATUS_RPC_PROTSEQ_NOT_SUPPORTED NT_STATUS(0xC0000000 | 0x20004)
#define NT_STATUS_RPC_UNSUPPORTED_NAME_SYNTAX NT_STATUS(0xC0000000 | 0x20026)
+#define NT_STATUS_RPC_NT_CALL_FAILED NT_STATUS(0xC0000000 | 0x2001B)
/* I use NT_STATUS_FOOBAR when I have no idea what error code to use -
diff --git a/source4/librpc/idl/wmi.idl b/source4/librpc/idl/wmi.idl
index 8d2e31b6f0..3a65345c72 100644
--- a/source4/librpc/idl/wmi.idl
+++ b/source4/librpc/idl/wmi.idl
@@ -24,7 +24,7 @@ import "misc.idl";
interface IWbemClassObject : IUnknown
{
- typedef struct {
+ typedef [noprint] struct {
[value(0x72657355)] uint32 flags;
[string, charset(UTF16)] uint16 data[];
} BSTR;
@@ -205,27 +205,24 @@ coclass WbemClassObject
typedef [public,noprint] enum
{
- WBEM_FLAG_RETURN_IMMEDIATELY = 0x10,
- WBEM_FLAG_RETURN_WBEM_COMPLETE = 0,
- WBEM_FLAG_BIDIRECTIONAL = 0,
- WBEM_FLAG_FORWARD_ONLY = 0x20,
- WBEM_FLAG_NO_ERROR_OBJECT = 0x40,
- WBEM_FLAG_RETURN_ERROR_OBJECT = 0,
- WBEM_FLAG_SEND_STATUS = 0x80,
- WBEM_FLAG_DONT_SEND_STATUS = 0,
- WBEM_FLAG_ENSURE_LOCATABLE = 0x100,
- WBEM_FLAG_DIRECT_READ = 0x200,
- WBEM_FLAG_SEND_ONLY_SELECTED = 0,
-
- WBEM_RETURN_WHEN_COMPLETE = 0,
- WBEM_RETURN_IMMEDIATELY = 0x10,
-
- WBEM_MASK_RESERVED_FLAGS = 0x1F000,
-
- WBEM_FLAG_USE_AMENDED_QUALIFIERS = 0x20000,
-
- WBEM_FLAG_STRONG_VALIDATION = 0x100000
-
+ WBEM_FLAG_RETURN_WBEM_COMPLETE = 0,
+ WBEM_FLAG_BIDIRECTIONAL = 0,
+ WBEM_FLAG_RETURN_IMMEDIATELY = 0x000010,
+ WBEM_FLAG_FORWARD_ONLY = 0x000020,
+ WBEM_FLAG_NO_ERROR_OBJECT = 0x000040,
+ WBEM_FLAG_SEND_STATUS = 0x000080,
+ WBEM_FLAG_ENSURE_LOCATABLE = 0x000100,
+ WBEM_FLAG_DIRECT_READ = 0x000200,
+ WBEM_FLAG_USE_AMENDED_QUALIFIERS = 0x020000,
+ WBEM_FLAG_STRONG_VALIDATION = 0x100000,
+ WBEM_FLAG_RETURN_ERROR_OBJECT = 0,
+ WBEM_FLAG_DONT_SEND_STATUS = 0,
+ WBEM_FLAG_SEND_ONLY_SELECTED = 0,
+
+ WBEM_RETURN_WHEN_COMPLETE = 0,
+ WBEM_RETURN_IMMEDIATELY = WBEM_FLAG_RETURN_IMMEDIATELY,
+
+ WBEM_MASK_RESERVED_FLAGS = 0x001F000
} WBEM_GENERIC_FLAG_TYPE;
typedef [public,noprint,v1_enum] enum tag_WBEM_TIMEOUT_TYPE
@@ -236,26 +233,28 @@ coclass WbemClassObject
typedef [public,v1_enum] enum
{
- CIM_EMPTY = 0,
-
- CIM_SINT8 = 16,
- CIM_UINT8 = 17,
- CIM_SINT16 = 2,
- CIM_UINT16 = 18,
- CIM_SINT32 = 3,
- CIM_UINT32 = 19,
- CIM_SINT64 = 20,
- CIM_UINT64 = 21,
- CIM_REAL32 = 4,
- CIM_REAL64 = 5,
- CIM_BOOLEAN = 11,
- CIM_STRING = 8,
- CIM_DATETIME = 101,
- CIM_REFERENCE = 102,
- CIM_CHAR16 = 103,
- CIM_OBJECT = 13,
-
- CIM_FLAG_ARRAY = 0x2000,
+ CIM_EMPTY = 0,
+ CIM_SINT16 = 2,
+ CIM_SINT32 = 3,
+ CIM_REAL32 = 4,
+ CIM_REAL64 = 5,
+ CIM_STRING = 8,
+
+ CIM_BOOLEAN = 11,
+ CIM_OBJECT = 13,
+ CIM_SINT8 = 16,
+ CIM_UINT8 = 17,
+ CIM_UINT16 = 18,
+ CIM_UINT32 = 19,
+ CIM_SINT64 = 20,
+ CIM_UINT64 = 21,
+ CIM_DATETIME = 101,
+ CIM_REFERENCE = 102,
+ CIM_CHAR16 = 103,
+
+ CIM_FLAG_ARRAY = 0x2000,
+ CIM_ILLEGAL = 0x0fff,
+ CIM_TYPEMASK = 0x2fff,
CIM_ARR_SINT8 = CIM_FLAG_ARRAY | CIM_SINT8,
CIM_ARR_UINT8 = CIM_FLAG_ARRAY | CIM_UINT8,
@@ -272,98 +271,10 @@ coclass WbemClassObject
CIM_ARR_DATETIME = CIM_FLAG_ARRAY | CIM_DATETIME,
CIM_ARR_REFERENCE = CIM_FLAG_ARRAY | CIM_REFERENCE,
CIM_ARR_CHAR16 = CIM_FLAG_ARRAY | CIM_CHAR16,
- CIM_ARR_OBJECT = CIM_FLAG_ARRAY | CIM_OBJECT,
+ CIM_ARR_OBJECT = CIM_FLAG_ARRAY | CIM_OBJECT
- CIM_ILLEGAL = 0xfff,
- CIM_TYPEMASK = 0x2FFF
} CIMTYPE_ENUMERATION;
- typedef [public] struct {
- uint32 count;
- int8 item[count];
- } arr_int8;
-
- typedef [public] struct {
- uint32 count;
- uint8 item[count];
- } arr_uint8;
-
- typedef [public] struct {
- uint32 count;
- int16 item[count];
- } arr_int16;
-
- typedef [public] struct {
- uint32 count;
- uint16 item[count];
- } arr_uint16;
-
- typedef [public] struct {
- uint32 count;
- int32 item[count];
- } arr_int32;
-
- typedef [public] struct {
- uint32 count;
- uint32 item[count];
- } arr_uint32;
-
- typedef [public] struct {
- uint32 count;
- dlong item[count];
- } arr_dlong;
-
- typedef [public] struct {
- uint32 count;
- udlong item[count];
- } arr_udlong;
-
- typedef [public] struct {
- uint32 count;
- [relative,charset(UTF16)] uint16 *item[count];
- } arr_CIMSTRING;
-
- typedef [public] struct {
- uint32 count;
- [relative,subcontext(4)] WbemClassObject *item[count];
- } arr_WbemClassObject;
-
-// FIXME:avg implement rest of types
- typedef [public,nodiscriminant] union
- {
- [case(CIM_SINT8)] int8 v_sint8;
- [case(CIM_UINT8)] uint8 v_uint8;
- [case(CIM_SINT16)] int16 v_sint16;
- [case(CIM_UINT16)] uint16 v_uint16;
- [case(CIM_SINT32)] int32 v_sint32;
- [case(CIM_UINT32)] uint32 v_uint32;
- [case(CIM_SINT64)] dlong v_sint64;
- [case(CIM_UINT64)] udlong v_uint64;
- [case(CIM_REAL32)] uint32 v_real32;
- [case(CIM_REAL64)] udlong v_real64;
- [case(CIM_BOOLEAN)] uint16 v_boolean;
- [case(CIM_STRING),relative,charset(UTF16)] uint16 *v_string;
- [case(CIM_DATETIME),relative,charset(UTF16)] uint16 *v_datetime;
- [case(CIM_REFERENCE),relative,charset(UTF16)] uint16 *v_reference;
- [case(CIM_OBJECT),subcontext(4),relative] WbemClassObject *v_object;
-
- [case(CIM_ARR_SINT8),relative] arr_int8 *a_sint8;
- [case(CIM_ARR_UINT8),relative] arr_uint8 *a_uint8;
- [case(CIM_ARR_SINT16),relative] arr_int16 *a_sint16;
- [case(CIM_ARR_UINT16),relative] arr_uint16 *a_uint16;
- [case(CIM_ARR_SINT32),relative] arr_int32 *a_sint32;
- [case(CIM_ARR_UINT32),relative] arr_uint32 *a_uint32;
- [case(CIM_ARR_SINT64),relative] arr_dlong *a_sint64;
- [case(CIM_ARR_UINT64),relative] arr_udlong *a_uint64;
- [case(CIM_ARR_REAL32),relative] arr_uint32 *a_real32;
- [case(CIM_ARR_REAL64),relative] arr_udlong *a_real64;
- [case(CIM_ARR_BOOLEAN),relative] arr_uint16 *a_boolean;
- [case(CIM_ARR_STRING),relative] arr_CIMSTRING *a_string;
- [case(CIM_ARR_DATETIME),relative] arr_CIMSTRING *a_datetime;
- [case(CIM_ARR_REFERENCE),relative] arr_CIMSTRING *a_reference;
- [case(CIM_ARR_OBJECT),relative] arr_WbemClassObject *a_object;
- } CIMVAR;
-
typedef [public,bitmap8bit] bitmap
{
WBEM_FLAVOR_FLAG_PROPAGATE_TO_INSTANCE = 0x1,
@@ -384,17 +295,17 @@ coclass WbemClassObject
typedef [public,bitmap8bit] bitmap
{
- WCF_DECORATIONS = 1,
- WCF_INSTANCE = 2,
- WCF_CLASS = 4,
- WCF_CLASS_PART_INTERNAL = 8
-// WCF_CLASS_PART_SHARED = 0x104
+ WCF_DECORATIONS = 1,
+ WCF_INSTANCE = 2,
+ WCF_CLASS = 4,
+ WCF_CLASS_PART_INTERNAL = 8
+ // WCF_CLASS_PART_SHARED = 0x104
} WCO_FLAGS;
typedef [public,nopull,nopush] struct
{
- uint32 count;
- [ref,charset(UTF16)] uint16 *item[count];
+ uint32 count;
+ [ref,charset(UTF16)] uint16 *item[count];
} CIMSTRINGS;
typedef [public,bitmap8bit] bitmap {
@@ -403,26 +314,29 @@ coclass WbemClassObject
} DEFAULT_FLAGS;
WERROR OpenNamespace(
- [in] BSTR strNamespace,
- [in] long lFlags,
- [in] IWbemContext* pCtx,
- [out, in, unique] IWbemServices** ppWorkingNamespace,
- [out, in, unique] IWbemCallResult** ppResult
- );
+ [in] BSTR strNamespace,
+ [in] long lFlags,
+ [in] IWbemContext* pCtx,
+ [out, in, unique] IWbemServices** ppWorkingNamespace,
+ [out, in, unique] IWbemCallResult** ppResult
+ );
+
WERROR CancelAsyncCall(
- [in] IWbemObjectSink* pSink
- );
+ [in] IWbemObjectSink* pSink
+ );
+
WERROR QueryObjectSink(
- [in] long lFlags,
- [out] IWbemObjectSink** ppResponseHandler
- );
+ [in] long lFlags,
+ [out] IWbemObjectSink** ppResponseHandler
+ );
+
WERROR GetObject(
- [in] BSTR strObjectPath,
- [in] long lFlags,
- [in] IWbemContext* pCtx,
- [out, in, unique] IWbemClassObject** ppObject,
- [out, in, unique] IWbemCallResult** ppCallResult
- );
+ [in] BSTR strObjectPath,
+ [in] long lFlags,
+ [in] IWbemContext* pCtx,
+ [out, in, unique] IWbemClassObject** ppObject,
+ [out, in, unique] IWbemCallResult** ppCallResult
+ );
WERROR GetObjectAsync(
@@ -431,6 +345,7 @@ coclass WbemClassObject
[in] IWbemContext* pCtx,
[in] IWbemObjectSink* pResponseHandler
);
+
WERROR PutClass(
[in] IWbemClassObject* pObject,
[in] long lFlags,
@@ -581,9 +496,8 @@ coclass WbemClassObject
[call_as(Next)] WERROR IEnumWbemClassObject_Next(
[in] int32 lTimeout,
[in] uint32 uCount,
- [out, size_is(uCount), length_is(*puReturned)]
- IWbemClassObject** apObjects,
- [out] uint32* puReturned
+ [out, size_is(uCount), length_is(*puReturned)] IWbemClassObject** apObjects,
+ [out] uint32* puReturned
);
WERROR NextAsync(
@@ -653,32 +567,31 @@ coclass WbemClassObject
] interface IWbemLevel1Login : IUnknown
{
WERROR EstablishPosition(
- [in, unique, string, charset(UTF16)] uint16* wszLocaleList,
- [in] DWORD dwNumLocales,
- [out] DWORD* reserved
- );
+ [in, unique, string, charset(UTF16)] uint16* wszLocaleList,
+ [in] DWORD dwNumLocales,
+ [out] DWORD* reserved
+ );
WERROR RequestChallenge(
- [in, unique, string, charset(UTF16)] uint16* wszNetworkResource,
- [in, unique, string, charset(UTF16)] uint16* wszUser,
- [out, size_is(16), length_is(16)] unsigned char* Nonce
- );
+ [in, unique, string, charset(UTF16)] uint16* wszNetworkResource,
+ [in, unique, string, charset(UTF16)] uint16* wszUser,
+ [out, size_is(16), length_is(16)] uint8 * Nonce
+ );
WERROR WBEMLogin(
- [in, unique, string, charset(UTF16)] uint16* wszPreferredLocale,
- [in, size_is(16), length_is(16), unique]
- unsigned char* AccessToken,
- [in] long lFlags,
- [in] IWbemContext* pCtx,
- [out] IWbemServices** ppNamespace
- );
+ [in, unique, string, charset(UTF16)] uint16* wszPreferredLocale,
+ [in, size_is(16), length_is(16), unique] uint8 * AccessToken,
+ [in] long lFlags,
+ [in] IWbemContext* pCtx,
+ [out] IWbemServices** ppNamespace
+ );
WERROR NTLMLogin(
- [in,unique,string,charset(UTF16)] uint16 *wszNetworkResource,
- [in,unique,string,charset(UTF16)] uint16 *wszPreferredLocale,
- [in] long lFlags,
- [in,unique] IWbemContext* pCtx,
- [out,ref] IWbemServices** ppNamespace
- );
+ [in,unique,string,charset(UTF16)] uint16 *wszNetworkResource,
+ [in,unique,string,charset(UTF16)] uint16 *wszPreferredLocale,
+ [in] long lFlags,
+ [in,unique] IWbemContext* pCtx,
+ [out,ref] IWbemServices** ppNamespace
+ );
}
@@ -733,16 +646,16 @@ coclass WbemClassObject
} WBEMDATA0;
WERROR IWbemWCOSmartEnum_Next(
- [in,ref] GUID *gEWCO,
- [in] uint32 lTimeOut,
- [in] uint32 uCount,
- // [in] uint32 unknown,
- // [in,ref] GUID *gWCO,
- [out,ref] uint32 *puReturned,
- [out,ref] uint32 *pSize,
- // [out,ref] WBEMDATA0 **pData
- [out,ref,noprint,size_is(,*pSize)] uint8 **pData
- );
+ [in,ref] GUID *gEWCO,
+ [in] uint32 lTimeOut,
+ [in] uint32 uCount,
+ // [in] uint32 unknown,
+ // [in,ref] GUID *gWCO,
+ [out,ref] uint32 *puReturned,
+ [out,ref] uint32 *pSize,
+ // [out,ref] WBEMDATA0 **pData
+ [out,ref,noprint,size_is(,*pSize)] uint8 **pData
+ );
}
[
@@ -752,7 +665,7 @@ coclass WbemClassObject
] interface IWbemFetchSmartEnum : IUnknown
{
WERROR Fetch([out] IWbemWCOSmartEnum** ppEnum);
- WERROR Test([out] WbemClassObject** ppEnum);
+ WERROR Test([out] IWbemClassObject** ppEnum);
}
[
@@ -763,7 +676,6 @@ coclass WbemClassObject
{
WERROR GetResultObject(
[in] long lTimeout,
- [out] IUnknown** ppResultObject,
[out] IWbemClassObject** ppResultObject
);
diff --git a/source4/librpc/ndr/ndr_wmi.c b/source4/librpc/ndr/ndr_wmi.c
index 69cbe95f40..6cf42471f8 100644
--- a/source4/librpc/ndr/ndr_wmi.c
+++ b/source4/librpc/ndr/ndr_wmi.c
@@ -88,762 +88,3 @@ void ndr_print_BSTR(struct ndr_print *ndr, const char *name, const struct BSTR *
{
ndr->print(ndr, "%-25s: BSTR(\"%s\")", name, r->data);
}
-
-enum ndr_err_code ndr_push_CIMSTRING(struct ndr_push *ndr, int ndr_flags, const CIMSTRING *r)
-{
- uint8_t u;
- enum ndr_err_code status;
-
- if (!(ndr_flags & NDR_SCALARS)) return NDR_ERR_SUCCESS;
-
- NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, 0));
- u = ndr->flags;
- ndr->flags |= LIBNDR_FLAG_STR_ASCII | LIBNDR_FLAG_STR_NULLTERM;
- status = ndr_push_string(ndr, NDR_SCALARS, *r);
- DEBUG(9, ("%08X: Push string: %s\n", ndr->offset, *r));
- ndr->flags = u;
- return status;
-}
-
-enum ndr_err_code ndr_pull_CIMSTRING(struct ndr_pull *ndr, int ndr_flags, CIMSTRING *r)
-{
- uint8_t u;
- enum ndr_err_code status;
-
- if (!(ndr_flags & NDR_SCALARS)) return NDR_ERR_SUCCESS;
-
- NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &u));
- switch (u) {
- case 0:
- u = ndr->flags;
- ndr->flags |= LIBNDR_FLAG_STR_ASCII | LIBNDR_FLAG_STR_NULLTERM;
- status = ndr_pull_string(ndr, NDR_SCALARS, r);
- DEBUG(10, ("%08X: Pull string: %s\n", ndr->offset, *r));
- ndr->flags = u;
- return status;
- case 1:
- u = ndr->flags;
- ndr->flags |= LIBNDR_FLAG_STR_NULLTERM;
- status = ndr_pull_string(ndr, NDR_SCALARS, r);
- DEBUG(10, ("%08X: Pull string: %s\n", ndr->offset, *r));
- ndr->flags = u;
- return status;
- default: return NDR_ERR_BAD_SWITCH;
- }
-}
-
-void ndr_print_CIMSTRING(struct ndr_print *ndr, const char *name, const CIMSTRING *r)
-{
- ndr->print(ndr, "%-25s: \"%s\"", name, *r);
-}
-
-enum ndr_err_code ndr_push_CIMSTRINGS(struct ndr_push *ndr, int ndr_flags, const struct CIMSTRINGS *r)
-{
- uint32_t ofs_size, ofs, i;
-
- if (!(ndr_flags & NDR_SCALARS)) return NDR_ERR_SUCCESS;
-
- ofs_size = ndr->offset;
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
-
- for (i = 0; i < r->count; ++i) {
- ofs = ndr->offset;
- NDR_CHECK(ndr_push_CIMSTRING(ndr, ndr_flags, &r->item[i]));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr->offset - ofs));
- }
- ofs = ndr->offset;
- ndr->offset = ofs_size;
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ofs - ofs_size));
- ndr->offset = ofs;
-
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ enum ndr_err_code ndr_pull_CIMSTRINGS(struct ndr_pull *ndr, int ndr_flags, struct CIMSTRINGS *r)
-{
- uint32_t endofs;
- uint32_t len;
- TALLOC_CTX *mem_ctx;
- uint32_t u;
-
- if (!(ndr_flags & NDR_SCALARS)) return NDR_ERR_SUCCESS;
-
- mem_ctx = ndr->current_mem_ctx;
-
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &endofs));
- endofs += ndr->offset - sizeof(endofs);
-
- r->count = 0;
- len = 5;
- r->item = talloc_array(mem_ctx, CIMSTRING, len);
- ndr->current_mem_ctx = r->item;
- while (ndr->offset < endofs) {
- if (r->count >= len) {
- len += 3;
- r->item = talloc_realloc(mem_ctx, r->item, CIMSTRING, len);
- }
- NDR_CHECK(ndr_pull_CIMSTRING(ndr, ndr_flags, &r->item[r->count]));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &u));
- ++r->count;
- }
-
- r->item = talloc_realloc(mem_ctx, r->item, CIMSTRING, r->count);
-
- ndr->current_mem_ctx = mem_ctx;
-
- return NDR_ERR_SUCCESS;
-}
-
-static const char *qualifier_keys[] = {[1] = "key", [3] = "read", [6] = "provider", [7] = "dynamic", [10] = "CIMTYPE" };
-#define arr_sizeof(a) (sizeof(a)/sizeof(a[0]))
-static const char *qn_unknown = "Unknown_qualifier_name";
-
-_PUBLIC_ enum ndr_err_code ndr_push_WbemQualifier(struct ndr_push *ndr, int ndr_flags, const struct WbemQualifier *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_relative_ptr1(ndr, r->name));
- NDR_CHECK(ndr_push_WBEM_FLAVOR_TYPE(ndr, NDR_SCALARS, r->flavors));
- NDR_CHECK(ndr_push_CIMTYPE_ENUMERATION(ndr, NDR_SCALARS, r->cimtype));
- NDR_CHECK(ndr_push_set_switch_value(ndr, &r->value, r->cimtype & CIM_TYPEMASK));
- NDR_CHECK(ndr_push_CIMVAR(ndr, NDR_SCALARS, &r->value));
- }
- if (ndr_flags & NDR_BUFFERS) {
- if (r->name) {
- uint32_t ofs;
- int32_t i;
- for (i = 0; i < arr_sizeof(qualifier_keys); ++i)
- if (qualifier_keys[i] && !strcmp(r->name, qualifier_keys[i])) break;
- if (i == arr_sizeof(qualifier_keys)) {
- if (!strncmp(qn_unknown, r->name, sizeof(qn_unknown) - 1))
- i = atoi(r->name + sizeof(qn_unknown) - 1);
- else
- i = -1;
- }
- if (i >= 0) {
- ofs = ndr->offset;
- NDR_CHECK(ndr_token_retrieve(&ndr->relative_list, r->name, &ndr->offset));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0x80000000 | i));
- ndr->offset = ofs;
- } else {
- NDR_CHECK(ndr_push_relative_ptr2(ndr, r->name));
- NDR_CHECK(ndr_push_CIMSTRING(ndr, NDR_SCALARS, &r->name));
- }
- }
- NDR_CHECK(ndr_push_CIMVAR(ndr, NDR_BUFFERS, &r->value));
- }
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ enum ndr_err_code ndr_pull_WbemQualifier(struct ndr_pull *ndr, int ndr_flags, struct WbemQualifier *r)
-{
- uint32_t _ptr_name;
- TALLOC_CTX *_mem_save_name_0;
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_name));
- if (_ptr_name != 0xFFFFFFFF) {
- NDR_PULL_ALLOC(ndr, r->name);
- NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->name, _ptr_name));
- } else {
- r->name = NULL;
- }
- NDR_CHECK(ndr_pull_WBEM_FLAVOR_TYPE(ndr, NDR_SCALARS, &r->flavors));
- NDR_CHECK(ndr_pull_CIMTYPE_ENUMERATION(ndr, NDR_SCALARS, &r->cimtype));
- NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->value, r->cimtype & CIM_TYPEMASK));
- NDR_CHECK(ndr_pull_CIMVAR(ndr, NDR_SCALARS, &r->value));
- }
- if (ndr_flags & NDR_BUFFERS) {
- uint32_t relofs;
- relofs = ndr_token_peek(&ndr->relative_list, r->name);
- if (relofs & 0x80000000) {
- relofs &= 0xFF;
- if ((relofs < sizeof(qualifier_keys)/sizeof(qualifier_keys[0])) && qualifier_keys[relofs]) {
- r->name = talloc_strdup(ndr->current_mem_ctx, qualifier_keys[relofs]);
- } else {
- r->name = talloc_asprintf(ndr->current_mem_ctx, "%s%d", qn_unknown, relofs);
- }
- } else if (r->name) {
- uint32_t _relative_save_offset;
- _relative_save_offset = ndr->offset;
- NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->name));
- _mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->name, 0);
- NDR_CHECK(ndr_pull_CIMSTRING(ndr, NDR_SCALARS, &r->name));
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, 0);
- ndr->offset = _relative_save_offset;
- }
- NDR_CHECK(ndr_pull_CIMVAR(ndr, NDR_BUFFERS, &r->value));
- }
- return NDR_ERR_SUCCESS;
-}
-
-enum ndr_err_code ndr_push_WbemQualifiers(struct ndr_push *ndr, int ndr_flags, const struct WbemQualifiers *r)
-{
- uint32_t i, ofs, ofs_size;
-
- if (ndr_flags & NDR_SCALARS) {
- ofs_size = ndr->offset;
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
- for (i = 0; i < r->count; ++i)
- NDR_CHECK(ndr_push_WbemQualifier(ndr, NDR_SCALARS, r->item[i]));
- ofs = ndr->offset;
- ndr->offset = ofs_size;
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ofs - ofs_size));
- ndr->offset = ofs;
- }
- if (ndr_flags & NDR_BUFFERS) {
- for (i = 0; i < r->count; ++i)
- NDR_CHECK(ndr_push_WbemQualifier(ndr, NDR_BUFFERS, r->item[i]));
- }
- return NDR_ERR_SUCCESS;
-}
-
-enum ndr_err_code ndr_pull_WbemQualifiers(struct ndr_pull *ndr, int ndr_flags, struct WbemQualifiers *r)
-{
- uint32_t endofs;
- uint32_t len;
- TALLOC_CTX *mem_ctx;
-
- mem_ctx = ndr->current_mem_ctx;
-
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &endofs));
- endofs += ndr->offset - 4;
-
- r->count = 0;
- len = 10;
- r->item = talloc_array(mem_ctx, struct WbemQualifier*, len);
- ndr->current_mem_ctx = r->item;
- while (ndr->offset < endofs) {
- if (r->count >= len) {
- len += 3;
- r->item = talloc_realloc(mem_ctx, r->item, struct WbemQualifier*, len);
- }
- NDR_PULL_ALLOC(ndr, r->item[r->count]);
- NDR_CHECK(ndr_pull_WbemQualifier(ndr, NDR_SCALARS, r->item[r->count]));
- ++r->count;
- }
- r->item = talloc_realloc(mem_ctx, r->item, struct WbemQualifier*, r->count);
- }
- if (ndr_flags & NDR_BUFFERS) {
- uint32_t i;
- ndr->current_mem_ctx = r->item;
- for (i = 0; i < r->count; ++i) {
- NDR_CHECK(ndr_pull_WbemQualifier(ndr, NDR_BUFFERS, r->item[i]));
- }
- }
-
- ndr->current_mem_ctx = mem_ctx;
-
- return NDR_ERR_SUCCESS;
-}
-
-enum ndr_err_code ndr_push_DataWithStack(struct ndr_push *ndr, ndr_push_flags_fn_t fn, const void *r)
-{
- uint32_t ofs, ofs_size, ofs_ssize;
-
- ofs_size = ndr->offset;
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
-
- NDR_CHECK(fn(ndr, NDR_SCALARS, r));
-
- ofs_ssize = ndr->offset;
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
- ndr->relative_base_offset = ndr->offset;
-
- NDR_CHECK(fn(ndr, NDR_BUFFERS, r));
-
- ofs = ndr->offset;
- ndr->offset = ofs_size;
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ofs-ofs_size));
- ndr->offset = ofs_ssize;
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, (ofs-ofs_ssize-4) | 0x80000000));
- ndr->offset = ofs;
-
- return NDR_ERR_SUCCESS;
-}
-
-enum ndr_err_code ndr_pull_DataWithStack(struct ndr_pull *ndr, ndr_pull_flags_fn_t fn, void *r)
-{
- uint32_t end, size, ssize, ndrend;
-
- end = ndr->offset;
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &size));
- NDR_PULL_NEED_BYTES(ndr, size - 4);
- end += size;
- ndrend = ndr->data_size;
- ndr->data_size = end;
-
- NDR_CHECK(fn(ndr, NDR_SCALARS, r));
-
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &ssize));
- if (!(ssize & 0x80000000))
- return ndr_pull_error(ndr, NDR_ERR_VALIDATE, "ndr_pull_DataWithStack(%08X): Stack size without 31th bit set: 0x%08X", ndr->offset - 4, ssize);
- ssize &= 0x7FFFFFFF;
- NDR_PULL_NEED_BYTES(ndr, ssize);
- ndr->data_size = ndr->offset + ssize;
-
- ndr->relative_base_offset = ndr->offset;
-
- NDR_CHECK(fn(ndr, NDR_BUFFERS, r));
-
- ndr->data_size = ndrend;
- ndr->offset = end;
-
- return NDR_ERR_SUCCESS;
-}
-
-enum ndr_err_code ndr_push_uint32_flags(struct ndr_push *ndr, int ndr_flags, uint32_t v)
-{
- if (ndr_flags & NDR_SCALARS)
- return ndr_push_uint32(ndr, NDR_SCALARS, v);
- return NDR_ERR_SUCCESS;
-}
-
-enum ndr_err_code ndr_pull_uint32_flags(struct ndr_pull *ndr, int ndr_flags, uint32_t *v)
-{
- if (ndr_flags & NDR_SCALARS)
- return ndr_pull_uint32(ndr, NDR_SCALARS, v);
- return NDR_ERR_SUCCESS;
-}
-
-void copy_bits(const uint8_t *src, uint32_t bsrc, uint8_t *dst, uint32_t bdst, uint32_t count)
-{
- uint8_t mask;
-
- src += bsrc >> 3;
- bsrc &= 7;
- dst += bdst >> 3;
- bdst &= 7;
- mask = ((1 << count) - 1);
- *dst &= ~(mask << bdst);
- *dst |= ((*src >> bsrc) & mask) << bdst;
-}
-
-#define IS_CIMTYPE_PTR(t) (((t) & CIM_FLAG_ARRAY) || ((t) == CIM_STRING) || ((t) == CIM_DATETIME) || ((t) == CIM_REFERENCE))
-enum ndr_err_code ndr_push_WbemInstance_priv(struct ndr_push *ndr, int ndr_flags, const struct WbemClassObject *r)
-{
- int i;
- if (ndr_flags & NDR_SCALARS) {
- uint32_t ofs, vofs;
-
- NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->instance->u1_0));
-
- if (r->instance->__CLASS) {
- NDR_CHECK(ndr_push_relative_ptr1(ndr, r->instance->__CLASS));
- } else {
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0xFFFFFFFF));
- }
-
- ofs = ndr->offset;
- NDR_PUSH_NEED_BYTES(ndr, r->obj_class->data_size);
-
- for (i = 0; i < r->obj_class->__PROPERTY_COUNT; ++i) {
- copy_bits(&r->instance->properties[i].default_flags, 0, ndr->data + ndr->offset, 2*r->obj_class->properties[i].property.desc->nr, 2);
- }
- i = 0xFF;
- copy_bits((uint8_t *)&i, 0, ndr->data + ndr->offset, 2*r->obj_class->__PROPERTY_COUNT, (8 - 2*r->obj_class->__PROPERTY_COUNT) % 7);
- vofs = ofs + ((r->obj_class->__PROPERTY_COUNT + 3) >> 2);
-
- for (i = 0; i < r->obj_class->__PROPERTY_COUNT; ++i) {
- NDR_CHECK(ndr_push_set_switch_value(ndr, &r->instance->data[i], r->obj_class->properties[i].property.desc->cimtype & CIM_TYPEMASK));
- ndr->offset = vofs + r->obj_class->properties[i].property.desc->offset;
- NDR_CHECK(ndr_push_CIMVAR(ndr, NDR_SCALARS, &r->instance->data[i]));
- }
- ndr->offset = ofs + r->obj_class->data_size;
-
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->instance->u2_4));
- NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->instance->u3_1));
- }
- if (ndr_flags & NDR_BUFFERS) {
- if (r->instance->__CLASS) {
- NDR_CHECK(ndr_push_relative_ptr2(ndr, r->instance->__CLASS));
- NDR_CHECK(ndr_push_CIMSTRING(ndr, NDR_SCALARS, &r->instance->__CLASS));
- }
- for (i = 0; i < r->obj_class->__PROPERTY_COUNT; ++i) {
- NDR_CHECK(ndr_push_CIMVAR(ndr, NDR_BUFFERS, &r->instance->data[i]));
- }
- }
- return NDR_ERR_SUCCESS;
-}
-
-enum ndr_err_code ndr_pull_WbemInstance_priv(struct ndr_pull *ndr, int ndr_flags, const struct WbemClassObject *r)
-{
- int i;
-
- if (!r->obj_class) {
-DEBUG(1,("ndr_pull_WbemInstance_priv: There is no class for given instance\n"));
- return NDR_ERR_VALIDATE;
- }
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
- if (ndr_flags & NDR_SCALARS) {
- uint32_t ofs, vofs;
- uint32_t _ptr___CLASS;
-
- NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->instance->u1_0));
-
- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr___CLASS));
- if (_ptr___CLASS != 0xFFFFFFFF) {
- NDR_PULL_ALLOC(ndr, r->instance->__CLASS);
- NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->instance->__CLASS, _ptr___CLASS));
- } else {
- r->instance->__CLASS = NULL;
- }
-
- ofs = ndr->offset;
- NDR_PULL_NEED_BYTES(ndr, r->obj_class->data_size);
- NDR_PULL_ALLOC_N(ndr, r->instance->default_flags, r->obj_class->__PROPERTY_COUNT);
- for (i = 0; i < r->obj_class->__PROPERTY_COUNT; ++i) {
- r->instance->default_flags[i] = 0;
- copy_bits(ndr->data + ndr->offset, 2*r->obj_class->properties[i].property.desc->nr, &r->instance->properties[i].default_flags, 0, 2);
- }
- vofs = ofs + ((r->obj_class->__PROPERTY_COUNT + 3) >> 2);
-
- NDR_PULL_ALLOC_N(ndr, r->instance->data, r->obj_class->__PROPERTY_COUNT);
- memset(r->instance->data, 0, sizeof(*r->instance->data) * r->obj_class->__PROPERTY_COUNT);
- for (i = 0; i < r->obj_class->__PROPERTY_COUNT; ++i) {
- NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->instance->data[i], r->obj_class->properties[i].property.desc->cimtype & CIM_TYPEMASK));
- ndr->offset = vofs + r->obj_class->properties[i].property.desc->offset;
- NDR_CHECK(ndr_pull_CIMVAR(ndr, NDR_SCALARS, &r->instance->data[i]));
- }
- ndr->offset = ofs + r->obj_class->data_size;
-
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->instance->u2_4));
- NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->instance->u3_1));
- }
- if (ndr_flags & NDR_BUFFERS) {
- if (r->instance->__CLASS) {
- uint32_t _relative_save_offset;
- _relative_save_offset = ndr->offset;
- NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->instance->__CLASS));
- NDR_CHECK(ndr_pull_CIMSTRING(ndr, NDR_SCALARS, &r->instance->__CLASS));
- ndr->offset = _relative_save_offset;
- }
- for (i = 0; i < r->obj_class->__PROPERTY_COUNT; ++i) {
- NDR_CHECK(ndr_pull_CIMVAR(ndr, NDR_BUFFERS, &r->instance->data[i]));
- }
- }
- return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_WbemInstance_priv(struct ndr_print *ndr, const char *name, const struct WbemClassObject *r)
-{
- int i;
-
- ndr_print_array_uint8(ndr, "default_flags", r->instance->default_flags, r->obj_class->__PROPERTY_COUNT);
-
- ndr->print(ndr, "%s: ARRAY(%d)", "data", r->obj_class->__PROPERTY_COUNT);
- ndr->depth++;
- for (i = 0; i < r->obj_class->__PROPERTY_COUNT; ++i) {
- ndr->print(ndr, "%s[%d]", "data", i);
- ndr->depth++;
- ndr_print_set_switch_value(ndr, &r->instance->data[i], r->obj_class->properties[i].property.desc->cimtype & CIM_TYPEMASK);
- ndr_print_CIMVAR(ndr, r->obj_class->properties[i].property.name, &r->instance->data[i]);
- ndr->depth--;
- }
- ndr->depth--;
-}
-
-enum ndr_err_code ndr_push_WbemClassObject(struct ndr_push *ndr, int ndr_flags, const struct WbemClassObject *r)
-{
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
- NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->flags));
- if (r->flags & WCF_CLASS) {
- NDR_CHECK(ndr_push_CIMSTRING(ndr, NDR_SCALARS, &r->__SERVER));
- NDR_CHECK(ndr_push_CIMSTRING(ndr, NDR_SCALARS, &r->__NAMESPACE));
- }
- if (r->flags & WCF_DECORATIONS) {
- NDR_CHECK(ndr_push_DataWithStack(ndr, (ndr_push_flags_fn_t)ndr_push_WbemClass, r->sup_class));
- NDR_CHECK(ndr_push_DataWithStack(ndr, (ndr_push_flags_fn_t)ndr_push_WbemMethods, r->sup_methods));
- }
- if (r->flags & (WCF_CLASS | WCF_INSTANCE)) {
- NDR_CHECK(ndr_push_DataWithStack(ndr, (ndr_push_flags_fn_t)ndr_push_WbemClass, r->obj_class));
- }
- if (r->flags & WCF_DECORATIONS) {
- NDR_CHECK(ndr_push_DataWithStack(ndr, (ndr_push_flags_fn_t)ndr_push_WbemMethods, r->obj_methods));
- }
- if (r->flags & WCF_INSTANCE) {
- NDR_CHECK(ndr_push_DataWithStack(ndr, (ndr_push_flags_fn_t)ndr_push_WbemInstance_priv, r));
- }
- return NDR_ERR_SUCCESS;
-}
-
-enum ndr_err_code ndr_pull_WbemClassObject(struct ndr_pull *ndr, int ndr_flags, struct WbemClassObject *r)
-{
- TALLOC_CTX *tc;
-
- tc = NDR_PULL_GET_MEM_CTX(ndr);
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
- NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->flags));
- if (r->flags & WCF_CLASS) {
- NDR_CHECK(ndr_pull_CIMSTRING(ndr, NDR_SCALARS, &r->__SERVER));
- NDR_CHECK(ndr_pull_CIMSTRING(ndr, NDR_SCALARS, &r->__NAMESPACE));
- }
- if (r->flags & WCF_DECORATIONS) {
- r->sup_class = talloc_zero(r, struct WbemClass);
- NDR_PULL_SET_MEM_CTX(ndr, r->sup_class, 0);
- NDR_CHECK(ndr_pull_DataWithStack(ndr, (ndr_pull_flags_fn_t)ndr_pull_WbemClass, r->sup_class));
- r->sup_methods = talloc_zero(r, struct WbemMethods);
- NDR_PULL_SET_MEM_CTX(ndr, r->sup_methods, 0);
- NDR_CHECK(ndr_pull_DataWithStack(ndr, (ndr_pull_flags_fn_t)ndr_pull_WbemMethods, r->sup_methods));
- NDR_PULL_SET_MEM_CTX(ndr, tc, 0);
- } else
- r->sup_class = NULL;
- if (r->flags & (WCF_CLASS | WCF_INSTANCE)) {
- r->obj_class = talloc_zero(r, struct WbemClass);
- NDR_PULL_SET_MEM_CTX(ndr, r->obj_class, 0);
- NDR_CHECK(ndr_pull_DataWithStack(ndr, (ndr_pull_flags_fn_t)ndr_pull_WbemClass, r->obj_class));
- NDR_PULL_SET_MEM_CTX(ndr, tc, 0);
- }
- if (r->flags & WCF_DECORATIONS) {
- r->obj_methods = talloc_zero(r, struct WbemMethods);
- NDR_PULL_SET_MEM_CTX(ndr, r->obj_methods, 0);
- NDR_CHECK(ndr_pull_DataWithStack(ndr, (ndr_pull_flags_fn_t)ndr_pull_WbemMethods, r->obj_methods));
- NDR_PULL_SET_MEM_CTX(ndr, tc, 0);
- }
- if (r->flags & WCF_INSTANCE) {
- r->instance = talloc_zero(r, struct WbemInstance);
- NDR_PULL_SET_MEM_CTX(ndr, r->instance, 0);
- NDR_CHECK(ndr_pull_DataWithStack(ndr, (ndr_pull_flags_fn_t)ndr_pull_WbemInstance_priv, r));
- NDR_PULL_SET_MEM_CTX(ndr, tc, 0);
- } else
- r->instance = NULL;
- return NDR_ERR_SUCCESS;
-}
-
-enum ndr_err_code ndr_pull_WbemClassObject_Object(struct ndr_pull *ndr, int ndr_flags, struct WbemClassObject *r)
-{
- TALLOC_CTX *tc;
-
- tc = NDR_PULL_GET_MEM_CTX(ndr);
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
- NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->flags));
- if (r->flags & WCF_CLASS) {
- NDR_CHECK(ndr_pull_CIMSTRING(ndr, NDR_SCALARS, &r->__SERVER));
- NDR_CHECK(ndr_pull_CIMSTRING(ndr, NDR_SCALARS, &r->__NAMESPACE));
- }
- if (r->flags & WCF_INSTANCE) {
- r->instance = talloc_zero(r, struct WbemInstance);
- NDR_PULL_SET_MEM_CTX(ndr, r->instance, 0);
- NDR_CHECK(ndr_pull_DataWithStack(ndr, (ndr_pull_flags_fn_t)ndr_pull_WbemInstance_priv, r));
- NDR_PULL_SET_MEM_CTX(ndr, tc, 0);
- } else
- r->instance = NULL;
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ void ndr_print_WbemClassObject(struct ndr_print *ndr, const char *name, const struct WbemClassObject *r)
-{
- ndr_print_struct(ndr, name, "WbemClassObject");
- {
- uint32_t _flags_save_STRUCT = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
- ndr->depth++;
- ndr_print_WCO_FLAGS(ndr, "flags", r->flags);
- if (r->flags & WCF_CLASS) {
- ndr_print_ptr(ndr, "__SERVER", r->__SERVER);
- ndr->depth++;
- ndr_print_CIMSTRING(ndr, "__SERVER", &r->__SERVER);
- ndr->depth--;
- ndr_print_ptr(ndr, "__NAMESPACE", r->__NAMESPACE);
- ndr->depth++;
- ndr_print_CIMSTRING(ndr, "__NAMESPACE", &r->__NAMESPACE);
- ndr->depth--;
- }
- if (r->flags & WCF_DECORATIONS) {
- ndr_print_ptr(ndr, "sup_class", r->sup_class);
- ndr->depth++;
- if (r->sup_class) {
- ndr_print_WbemClass(ndr, "sup_class", r->sup_class);
- }
- ndr->depth--;
- ndr_print_ptr(ndr, "sup_methods", r->sup_methods);
- ndr->depth++;
- if (r->sup_methods) {
- ndr_print_WbemMethods(ndr, "sup_methods", r->sup_methods);
- }
- ndr->depth--;
- }
- if (r->flags & (WCF_CLASS | WCF_INSTANCE)) {
- ndr_print_ptr(ndr, "obj_class", r->obj_class);
- ndr->depth++;
- if (r->obj_class) {
- ndr_print_WbemClass(ndr, "obj_class", r->obj_class);
- }
- ndr->depth--;
- }
- if (r->flags & WCF_DECORATIONS) {
- ndr_print_ptr(ndr, "obj_methods", r->obj_methods);
- ndr->depth++;
- if (r->obj_methods) {
- ndr_print_WbemMethods(ndr, "obj_methods", r->obj_methods);
- }
- ndr->depth--;
- }
- if (r->flags & WCF_INSTANCE) {
- ndr_print_ptr(ndr, "instance", r->instance);
- ndr->depth++;
- if (r->instance) {
- ndr_print_WbemInstance_priv(ndr, "instance", r);
- }
- ndr->depth--;
- }
- ndr->depth--;
- ndr->flags = _flags_save_STRUCT;
- }
-}
-
-_PUBLIC_ enum ndr_err_code ndr_push_WbemClass(struct ndr_push *ndr, int ndr_flags, const struct WbemClass *r)
-{
- uint32_t cntr_properties_0;
- uint32_t i, ofs, vofs;
- {
- uint32_t _flags_save_STRUCT = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->u_0));
- if (r->__CLASS) {
- NDR_CHECK(ndr_push_relative_ptr1(ndr, r->__CLASS));
- } else {
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0xFFFFFFFF));
- }
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->data_size));
- NDR_CHECK(ndr_push_CIMSTRINGS(ndr, NDR_SCALARS, &r->__DERIVATION));
- NDR_CHECK(ndr_push_WbemQualifiers(ndr, NDR_SCALARS, &r->qualifiers));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->__PROPERTY_COUNT));
- for (cntr_properties_0 = 0; cntr_properties_0 < r->__PROPERTY_COUNT; cntr_properties_0++) {
- NDR_CHECK(ndr_push_WbemProperty(ndr, NDR_SCALARS, &r->properties[cntr_properties_0].property));
- }
-
- ofs = ndr->offset;
- NDR_PUSH_NEED_BYTES(ndr, r->data_size);
-
- for (i = 0; i < r->__PROPERTY_COUNT; ++i) {
- copy_bits(&r->properties[i].default_flags, 0, ndr->data + ndr->offset, 2*r->properties[i].property.desc->nr, 2);
- }
- i = 0xFF;
- copy_bits((uint8_t *)&i, 0, ndr->data + ndr->offset, 2*r->__PROPERTY_COUNT, (8 - 2*r->__PROPERTY_COUNT) % 7);
- vofs = ofs + ((r->__PROPERTY_COUNT + 3) >> 2);
- for (i = 0; i < r->__PROPERTY_COUNT; ++i) {
- NDR_CHECK(ndr_push_set_switch_value(ndr, &r->properties[i].default_values, r->properties[i].property.desc->cimtype & CIM_TYPEMASK));
- ndr->offset = vofs + r->properties[i].property.desc->offset;
- if ((r->properties[i].default_flags & DEFAULT_FLAG_EMPTY) && IS_CIMTYPE_PTR(r->properties[i].property.desc->cimtype & CIM_TYPEMASK)) {
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0xFFFFFFFF));
- } else {
- NDR_CHECK(ndr_push_CIMVAR(ndr, NDR_SCALARS, &r->properties[i].default_values));
- }
- }
- ndr->offset = ofs + r->data_size;
- }
- if (ndr_flags & NDR_BUFFERS) {
- if (r->__CLASS) {
- NDR_CHECK(ndr_push_relative_ptr2(ndr, r->__CLASS));
- NDR_CHECK(ndr_push_CIMSTRING(ndr, NDR_SCALARS, &r->__CLASS));
- }
- NDR_CHECK(ndr_push_CIMSTRINGS(ndr, NDR_BUFFERS, &r->__DERIVATION));
- NDR_CHECK(ndr_push_WbemQualifiers(ndr, NDR_BUFFERS, &r->qualifiers));
- for (cntr_properties_0 = 0; cntr_properties_0 < r->__PROPERTY_COUNT; cntr_properties_0++) {
- NDR_CHECK(ndr_push_WbemProperty(ndr, NDR_BUFFERS, &r->properties[cntr_properties_0].property));
- }
- for (i = 0; i < r->__PROPERTY_COUNT; ++i) {
- if (r->properties[i].default_flags & DEFAULT_FLAG_EMPTY) continue;
- NDR_CHECK(ndr_push_CIMVAR(ndr, NDR_BUFFERS, &r->properties[i].default_values));
- }
- }
- ndr->flags = _flags_save_STRUCT;
- }
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ enum ndr_err_code ndr_pull_WbemClass(struct ndr_pull *ndr, int ndr_flags, struct WbemClass *r)
-{
- uint32_t _ptr___CLASS;
- uint32_t cntr_properties_0;
- TALLOC_CTX *_mem_save_properties_0;
- uint32_t i;
-
- {
- uint32_t _flags_save_STRUCT = ndr->flags;
-
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->u_0));
- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr___CLASS));
- if (_ptr___CLASS != 0xFFFFFFFF) {
- NDR_PULL_ALLOC(ndr, r->__CLASS);
- NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->__CLASS, _ptr___CLASS));
- } else {
- r->__CLASS = NULL;
- }
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->data_size));
- NDR_CHECK(ndr_pull_CIMSTRINGS(ndr, NDR_SCALARS, &r->__DERIVATION));
- NDR_CHECK(ndr_pull_WbemQualifiers(ndr, NDR_SCALARS, &r->qualifiers));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->__PROPERTY_COUNT));
- NDR_PULL_ALLOC_N(ndr, r->properties, r->__PROPERTY_COUNT);
- _mem_save_properties_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->properties, 0);
- for (cntr_properties_0 = 0; cntr_properties_0 < r->__PROPERTY_COUNT; cntr_properties_0++) {
- NDR_CHECK(ndr_pull_WbemProperty(ndr, NDR_SCALARS, &(r->properties)[cntr_properties_0]));
- }
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_properties_0, 0);
-
- NDR_PULL_NEED_BYTES(ndr, r->data_size);
-
- NDR_PULL_ALLOC_N(ndr, r->default_flags, r->__PROPERTY_COUNT);
- NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->default_flags, ndr->offset));
-
- NDR_PULL_ALLOC_N(ndr, r->default_values, r->__PROPERTY_COUNT);
- memset(r->default_values, 0, sizeof(*r->default_values) * r->__PROPERTY_COUNT);
- NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->default_values, ndr->offset + ((r->__PROPERTY_COUNT + 3) >> 2)));
-
- ndr->offset += r->data_size;
- }
- if (ndr_flags & NDR_BUFFERS) {
- if (r->__CLASS) {
- TALLOC_CTX *_mem_save___CLASS_0;
- uint32_t _relative_save_offset;
- _relative_save_offset = ndr->offset;
- NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->__CLASS));
- _mem_save___CLASS_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->__CLASS, 0);
- NDR_CHECK(ndr_pull_CIMSTRING(ndr, NDR_SCALARS, &r->__CLASS));
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save___CLASS_0, 0);
- ndr->offset = _relative_save_offset;
- }
- NDR_CHECK(ndr_pull_CIMSTRINGS(ndr, NDR_BUFFERS, &r->__DERIVATION));
- NDR_CHECK(ndr_pull_WbemQualifiers(ndr, NDR_BUFFERS, &r->qualifiers));
- _mem_save_properties_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->properties, 0);
- for (cntr_properties_0 = 0; cntr_properties_0 < r->__PROPERTY_COUNT; cntr_properties_0++) {
- NDR_CHECK(ndr_pull_WbemProperty(ndr, NDR_BUFFERS, &(r->properties)[cntr_properties_0].property));
- }
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_properties_0, 0);
- {
- uint32_t ofs;
- NDR_CHECK(ndr_token_retrieve(&ndr->relative_list, r->default_flags, &ofs));
- for (i = 0; i < r->__PROPERTY_COUNT; ++i) {
- r->properties[i].default_flags = 0;
- copy_bits(ndr->data + ofs, 2*r->properties[i].property.desc->nr, &r->properties[i].default_flags, 0, 2);
- }
- }
- {
- uint32_t ofs;
- uint32_t _relative_save_offset;
- _relative_save_offset = ndr->offset;
- NDR_CHECK(ndr_token_retrieve(&ndr->relative_list, r->default_values, &ofs));
- for (i=0; i < r->__PROPERTY_COUNT; ++i) {
- if (r->properties[i].default_flags & DEFAULT_FLAG_EMPTY) continue;
- NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->properties[i].default_values, r->properties[i].property.desc->cimtype & CIM_TYPEMASK));
- ndr->offset = ofs + r->properties[i].property.desc->offset;
- NDR_CHECK(ndr_pull_CIMVAR(ndr, NDR_SCALARS|NDR_BUFFERS, &r->properties[i].default_values));
- }
- ndr->offset = _relative_save_offset;
- }
- }
- ndr->flags = _flags_save_STRUCT;
- }
- return NDR_ERR_SUCCESS;
-}
diff --git a/source4/librpc/ndr/ndr_wmi.h b/source4/librpc/ndr/ndr_wmi.h
index 0dbf3844ba..539b9e882b 100644
--- a/source4/librpc/ndr/ndr_wmi.h
+++ b/source4/librpc/ndr/ndr_wmi.h
@@ -1,6 +1,3 @@
typedef const char *CIMSTRING;
-enum ndr_err_code ndr_pull_WbemClassObject_Object(struct ndr_pull *ndr, int ndr_flags, struct WbemClassObject *r);
-enum ndr_err_code ndr_pull_WbemClassObject(struct ndr_pull *ndr, int ndr_flags, struct WbemClassObject *r);
-enum ndr_err_code ndr_push_WbemClassObject(struct ndr_push *ndr, int ndr_flags, const struct WbemClassObject *r);
enum ndr_err_code ndr_pull_CIMSTRING(struct ndr_pull *ndr, int ndr_flags, CIMSTRING *r);
enum ndr_err_code ndr_push_CIMSTRING(struct ndr_push *ndr, int ndr_flags, const CIMSTRING *r);
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm b/source4/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm
index f7eb36f317..ca9f37a053 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm
@@ -110,7 +110,7 @@ static $tn dcom_proxy_$interface->{NAME}_$name(struct $interface->{NAME} *d, TAL
foreach my $a (@{$fn->{ELEMENTS}}) {
next unless (has_property($a, "in"));
if (Parse::Pidl::Typelist::typeIs($a->{TYPE}, "INTERFACE")) {
- $res .="\tNDR_CHECK(dcom_OBJREF_from_IUnknown(&r.in.$a->{NAME}.obj, $a->{NAME}));\n";
+ $res .="\tNDR_CHECK(dcom_OBJREF_from_IUnknown(mem_ctx, &r.in.$a->{NAME}.obj, $a->{NAME}));\n";
} else {
$res .= "\tr.in.$a->{NAME} = $a->{NAME};\n";
}