$res .= "NTSTATUS dcerpc_server_$interface->{NAME}_init(void);\n\n";
}
- $count = $interface->{INHERITED_FUNCTIONS};
foreach my $d (@{$data}) {
if ($d->{TYPE} eq "FUNCTION") {
my $u_name = uc $d->{NAME};
- $res .= "#define DCERPC_$u_name " . sprintf("0x%02x", $count) . "\n";
+ $res .= "#define DCERPC_$u_name (";
+
+ if (defined($interface->{BASE})) {
+ $res .= "DCERPC_" . uc $interface->{BASE} . "_CALL_COUNT + ";
+ }
+
+ $res .= sprintf("0x%02x", $count) . ")\n";
$count++;
}
}
- $res .= "\n\n";
+ $res .= "\n#define DCERPC_" . uc $interface->{NAME} . "_CALL_COUNT (";
+
+ if (defined($interface->{BASE})) {
+ $res .= "DCERPC_" . uc $interface->{BASE} . "_CALL_COUNT + ";
+ }
+
+ $res .= "$count)\n\n";
foreach my $d (@{$data}) {
($d->{TYPE} eq "CONST") &&
die("No such parent interface " . $x->{BASE});
}
- $x->{INHERITED_FUNCTIONS} = scalar @{$parent->{INHERITED_DATA}};
@{$x->{INHERITED_DATA}} = (@{$parent->{INHERITED_DATA}}, @{$x->{DATA}});
} else {
- $x->{INHERITED_FUNCTIONS} = 0;
$x->{INHERITED_DATA} = $x->{DATA};
}
}
die("No such parent interface " . $x->{BASE});
}
- $x->{INHERITED_FUNCTIONS} = scalar @{$parent->{INHERITED_DATA}};
@{$x->{INHERITED_DATA}} = (@{$parent->{INHERITED_DATA}}, @{$x->{DATA}});
} else {
- $x->{INHERITED_FUNCTIONS} = 0;
$x->{INHERITED_DATA} = $x->{DATA};
}
}
const char *domain;
const char *user;
const char *password;
+ uint32_t dcerpc_flags;
};
struct dcom_interface
* call RemQueryInterface if necessary */
return NT_STATUS_NOT_SUPPORTED;
}
+
+NTSTATUS dcerpc_IClassFactory_CreateInstance(struct dcom_interface *o, TALLOC_CTX *mem_ctx, struct IClassFactory_CreateInstance *rr)
+{
+ return NT_STATUS_NOT_SUPPORTED;
+}
+
+NTSTATUS dcerpc_IClassFactory_LockServer(struct dcom_interface *o, TALLOC_CTX *mem_ctx, struct IClassFactory_LockServer *rr)
+{
+ return NT_STATUS_NOT_SUPPORTED;
+}
i = 0;
do {
status = dcerpc_binding_from_STRINGBINDING(iface->ctx, &binding, iface->objref->u_objref.u_standard.saResAddr.stringbindings[i]);
- i++;
- } while (!NT_STATUS_IS_OK(status) && iface->objref->u_objref.u_standard.saResAddr.stringbindings[i]);
- if (NT_STATUS_IS_ERR(status)) {
- DEBUG(1, ("Error parsing string binding"));
- return status;
- }
+ if (NT_STATUS_IS_OK(status)) {
+ binding.flags = iface->ctx->dcerpc_flags;
+ status = dcerpc_pipe_connect_b(&po, &binding, DCERPC_IOXIDRESOLVER_UUID, DCERPC_IOXIDRESOLVER_VERSION, iface->ctx->domain, iface->ctx->user, iface->ctx->password);
+ } else {
+ DEBUG(1, ("Error parsing string binding - %s", nt_errstr(status)));
+ }
- status = dcerpc_pipe_connect_b(&po, &binding, DCERPC_IOXIDRESOLVER_UUID, DCERPC_IOXIDRESOLVER_VERSION, iface->ctx->domain, iface->ctx->user, iface->ctx->password);
+ i++;
+ } while (!NT_STATUS_IS_OK(status) && iface->objref->u_objref.u_standard.saResAddr.stringbindings[i]);
if (NT_STATUS_IS_ERR(status)) {
DEBUG(1, ("Error while connecting to OXID Resolver : %s\n", nt_errstr(status)));
i = 0;
do {
status = dcerpc_binding_from_STRINGBINDING(iface->ctx, &binding, m->bindings.stringbindings[i]);
+ if (NT_STATUS_IS_ERR(status)) {
+ DEBUG(1, ("Error parsing string binding"));
+ } else {
+ binding.flags = iface->ctx->dcerpc_flags;
+ status = dcerpc_pipe_connect_b(&m->pipe, &binding, GUID_string(iface->ctx, &iid) , 0.0, iface->ctx->domain, iface->ctx->user, iface->ctx->password);
+ }
+
i++;
} while (NT_STATUS_IS_ERR(status) && m->bindings.stringbindings[i]);
if (NT_STATUS_IS_ERR(status)) {
- DEBUG(1, ("Error parsing string binding"));
- return status;
- }
-
- status = dcerpc_pipe_connect_b(&m->pipe, &binding, GUID_string(iface->ctx, &iid) , 0.0, iface->ctx->domain, iface->ctx->user, iface->ctx->password);
-
- if (NT_STATUS_IS_ERR(status)) {
+ DEBUG(0, ("Unable to connect to remote host - %s\n", nt_errstr(status)));
return status;
}
} COMVERSION;
/* enumeration of additional information present in the call packet. */
- /* Should be an enum but DCE IDL does not support sparse enumerators. */
typedef enum {
- ORPCF_NULL = 0, /* no additional info in packet */
- ORPCF_LOCAL = 1, /* call is local to this machine */
- ORPCF_RESERVED1 = 2, /* reserved for local use */
- ORPCF_RESERVED2 = 4, /* reserved for local use */
- ORPCF_RESERVED3 = 8, /* reserved for local use */
- ORPCF_RESERVED4 = 16 /* reserved for local use */
+ ORPCF_NULL = 0x00, /* no additional info in packet */
+ ORPCF_LOCAL = 0x01, /* call is local to this machine */
+ ORPCF_RESERVED1 = 0x02, /* reserved for local use */
+ ORPCF_RESERVED2 = 0x04, /* reserved for local use */
+ ORPCF_RESERVED3 = 0x08, /* reserved for local use */
+ ORPCF_RESERVED4 = 0x10 /* reserved for local use */
} ORPC_FLAGS;
/* Extension to implicit parameters. */
} SECURITYBINDING;
/* signature value for OBJREF (object reference, actually the */
- /* marshaled form of a COM interface). */
+ /* marshaled form of a COM interface).
+ * MEOW apparently stands for "Microsoft Extended Object Wireformat"
+ */
const uint32 OBJREF_SIGNATURE = 0x574f454d; /* 'MEOW' */
/* flag values for OBJREF */
} OBJREF_Types;
/* OBJREF is the format of a marshaled interface pointer. */
- typedef [public] struct
+ typedef [public,flag(NDR_LITTLE_ENDIAN)] struct
{
uint32 signature;
uint32 flags; /* OBJREF flags (see above) */
pointer_default(unique)
] interface IClassFactory : IUnknown
{
- [local] WERROR CreateInstance(/*FIXME[in] IUnknown *pUnknown*/,
+ [local] WERROR IClassFactory_CreateInstance([in] MInterfacePointer *pUnknown,
[in] GUID *iid,
[out, iid_is(riid)] MInterfacePointer *ppv);
/* Set lock to TRUE when you want to do a lock
and set it to FALSE when you want to unlock */
- [local] WERROR LockServer([in] uint8 lock);
+ [local] WERROR IClassFactory_LockServer([in] uint8 lock);
[call_as(LockServer)] WERROR RemoteLockServer();
}
struct dcom_class
{
const char *name;
+ const char *prog_id;
struct GUID CLSID;
/* List of IID's implemented */
- uint32 cIIDs;
+ uint32 num_iids;
struct GUID *IID;
/* Pointers to functions this class implements */
+ void **interfaces;
};
struct dcom_object
struct dcom_interface_pointer
{
struct dcom_object *object;
+ struct dcerpc_interface_table *interface;
struct GUID ipid;
};
*/
static WERROR RemoteActivation(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct RemoteActivation *r)
{
+ struct IClassFactory_CreateInstance *cr;
+ struct IUnknown_Release *ur;
+ struct dcom_interface *o;
int i;
+
/* FIXME: CoGetClassObject() */
/* FIXME: IClassFactory::CreateInstance() */
- /* FIXME: Register newly created object with dcerpc subsystem */
- /* FIXME: IClassFactory::Release() */
+ /* FIXME: IUnknown::Release() */
ZERO_STRUCT(r->out);
r->out.ServerVersion.MajorVersion = COM_MAJOR_VERSION;
* r->out.interfaces */
r->out.ifaces = talloc_array_p(mem_ctx, struct pMInterfacePointer, r->in.Interfaces);
r->out.results = talloc_array_p(mem_ctx, WERROR, r->in.Interfaces);
+ r->out.hr = cr->out.result;
+
for (i = 0; i < r->in.Interfaces; i++) {
- ZERO_STRUCT(r->out.ifaces[i]);
- r->out.results[i] = WERR_NOT_SUPPORTED;
+ struct IUnknown_QueryInterface rr;
+ rr.in.iid = &r->in.pIIDs[i];
+ dcerpc_IUnknown_QueryInterface(o, mem_ctx, &rr);
+ ZERO_STRUCT(r->out.ifaces[i]);
+ r->out.results[i] = rr.out.result;
}
/* FIXME: */
r->out.pOxid = 0;
ZERO_STRUCT(r->out.ipidRemUnknown);
- r->out.hr = WERR_NOT_SUPPORTED;
- return WERR_NOT_SUPPORTED;
+ return WERR_OK;
}