From d106cb2ee59a6517d28660efeeb4f8f5a976f56b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 7 May 2008 16:04:21 +0200 Subject: Reimport COM and DCOM libraries. --- source4/lib/com/main.c | 111 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 source4/lib/com/main.c (limited to 'source4/lib/com/main.c') diff --git a/source4/lib/com/main.c b/source4/lib/com/main.c new file mode 100644 index 0000000000..3e4127f246 --- /dev/null +++ b/source4/lib/com/main.c @@ -0,0 +1,111 @@ +/* + Unix SMB/CIFS implementation. + Main COM functionality + Copyright (C) 2004 Jelmer Vernooij + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" +#include "dlinklist.h" +#include "lib/com/com.h" +#include "lib/events/events.h" +#include "librpc/gen_ndr/com_dcom.h" +#include "build.h" + +WERROR com_init_ctx(struct com_context **ctx, struct event_context *event_ctx) +{ + *ctx = talloc(NULL, struct com_context); + if (event_ctx == NULL) { + event_ctx = event_context_init(*ctx); + } + (*ctx)->event_ctx = event_ctx; + return WERR_OK; +} + +WERROR com_create_object(struct com_context *ctx, struct GUID *clsid, int num_ifaces, struct GUID *iid, struct IUnknown **ip, WERROR *results) +{ + struct IUnknown *iunk = NULL; + struct IClassFactory *factory; + WERROR error; + int i; + struct GUID classfact_iid; + + GUID_from_string(DCERPC_ICLASSFACTORY_UUID, &classfact_iid); + + /* Obtain class object */ + error = com_get_class_object(ctx, clsid, &classfact_iid, (struct IUnknown **)&factory); + if (!W_ERROR_IS_OK(error)) { + DEBUG(3, ("Unable to obtain class object for %s\n", GUID_string(NULL, clsid))); + return error; + } + + /* Run IClassFactory::CreateInstance() */ + error = IClassFactory_CreateInstance(factory, ctx, NULL, &classfact_iid, &iunk); + if (!W_ERROR_IS_OK(error)) { + DEBUG(3, ("Error while calling IClassFactory::CreateInstance : %s\n", win_errstr(error))); + return error; + } + + if (!iunk) { + DEBUG(0, ("IClassFactory_CreateInstance returned success but result pointer is still NULL!\n")); + return WERR_GENERAL_FAILURE; + } + + /* Release class object */ + IUnknown_Release(factory, ctx); + + error = WERR_OK; + + /* Do one or more QueryInterface calls */ + for (i = 0; i < num_ifaces; i++) { + results[i] = IUnknown_QueryInterface(iunk, ctx, &iid[i], &ip[i]); + if (!W_ERROR_IS_OK(results[i])) error = results[i]; + } + + return error; +} + +WERROR com_get_class_object(struct com_context *ctx, struct GUID *clsid, struct GUID *iid, struct IUnknown **ip) +{ + struct IUnknown *iu; + + iu = com_class_by_clsid(ctx, clsid); + if (!iu) { + return WERR_CLASS_NOT_REGISTERED; + } + + return IUnknown_QueryInterface(iu, ctx, iid, ip); +} + +NTSTATUS com_init(void) +{ + static BOOL initialized = False; + + init_module_fn static_init[] = STATIC_com_MODULES; + init_module_fn *shared_init; + + if (initialized) return NT_STATUS_OK; + initialized = True; + + shared_init = load_samba_modules(NULL, "com"); + + run_init_functions(static_init); + run_init_functions(shared_init); + + talloc_free(shared_init); + + return NT_STATUS_OK; +} -- cgit From 5b827dfd8b20e4c268a594e733765bef147020fb Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 18 Sep 2008 17:38:47 +0200 Subject: s4:lib/com: fix the build with automatic dependecies metze --- source4/lib/com/main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source4/lib/com/main.c') diff --git a/source4/lib/com/main.c b/source4/lib/com/main.c index 3e4127f246..882b479cfe 100644 --- a/source4/lib/com/main.c +++ b/source4/lib/com/main.c @@ -19,11 +19,10 @@ */ #include "includes.h" -#include "dlinklist.h" +#include "lib/util/dlinklist.h" #include "lib/com/com.h" #include "lib/events/events.h" #include "librpc/gen_ndr/com_dcom.h" -#include "build.h" WERROR com_init_ctx(struct com_context **ctx, struct event_context *event_ctx) { -- cgit From 495758a73e125e59921092c893c6e32ba7091fe1 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 19 Sep 2008 02:27:40 +0200 Subject: Fix COM compilation, add framework for COM python module. --- source4/lib/com/main.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'source4/lib/com/main.c') diff --git a/source4/lib/com/main.c b/source4/lib/com/main.c index 882b479cfe..bcc5fa393a 100644 --- a/source4/lib/com/main.c +++ b/source4/lib/com/main.c @@ -42,7 +42,7 @@ WERROR com_create_object(struct com_context *ctx, struct GUID *clsid, int num_if int i; struct GUID classfact_iid; - GUID_from_string(DCERPC_ICLASSFACTORY_UUID, &classfact_iid); + GUID_from_string(NDR_ICLASSFACTORY_UUID, &classfact_iid); /* Obtain class object */ error = com_get_class_object(ctx, clsid, &classfact_iid, (struct IUnknown **)&factory); @@ -88,23 +88,3 @@ WERROR com_get_class_object(struct com_context *ctx, struct GUID *clsid, struct return IUnknown_QueryInterface(iu, ctx, iid, ip); } - -NTSTATUS com_init(void) -{ - static BOOL initialized = False; - - init_module_fn static_init[] = STATIC_com_MODULES; - init_module_fn *shared_init; - - if (initialized) return NT_STATUS_OK; - initialized = True; - - shared_init = load_samba_modules(NULL, "com"); - - run_init_functions(static_init); - run_init_functions(shared_init); - - talloc_free(shared_init); - - return NT_STATUS_OK; -} -- cgit From 956599975573044f5f930ef23ce54c11db156ebe Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 11 Oct 2008 21:31:42 +0200 Subject: Fix include paths to new location of libutil. --- source4/lib/com/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib/com/main.c') diff --git a/source4/lib/com/main.c b/source4/lib/com/main.c index bcc5fa393a..daed8c11e5 100644 --- a/source4/lib/com/main.c +++ b/source4/lib/com/main.c @@ -19,7 +19,7 @@ */ #include "includes.h" -#include "lib/util/dlinklist.h" +#include "../lib/util/dlinklist.h" #include "lib/com/com.h" #include "lib/events/events.h" #include "librpc/gen_ndr/com_dcom.h" -- cgit