summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-09-19 02:39:03 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-09-19 02:39:03 +0200
commitb5e8d8d22ae599778e889a8df5a18c07c9180af5 (patch)
treec100e3ed4eac189b48b34db29f7024ebd0e7ab3a /source4
parent495758a73e125e59921092c893c6e32ba7091fe1 (diff)
downloadsamba-b5e8d8d22ae599778e889a8df5a18c07c9180af5.tar.gz
samba-b5e8d8d22ae599778e889a8df5a18c07c9180af5.tar.bz2
samba-b5e8d8d22ae599778e889a8df5a18c07c9180af5.zip
initialize a COM context.
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/com/pycom.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/source4/lib/com/pycom.c b/source4/lib/com/pycom.c
index b6d6b772a8..9222be438d 100644
--- a/source4/lib/com/pycom.c
+++ b/source4/lib/com/pycom.c
@@ -20,12 +20,18 @@
#include "includes.h"
#include <Python.h>
#include "lib/com/com.h"
+#include "librpc/ndr/libndr.h"
+#include "libcli/util/pyerrors.h"
+
+static struct com_context *py_com_ctx = NULL; /* FIXME: evil global */
static PyObject *py_get_class_object(PyObject *self, PyObject *args)
{
char *s_clsid, *s_iid;
struct GUID clsid, iid;
struct IUnknown *object;
+ NTSTATUS status;
+ WERROR error;
if (!PyArg_ParseTuple(args, "ss", &s_clsid, &s_iid))
return NULL;
@@ -42,7 +48,7 @@ static PyObject *py_get_class_object(PyObject *self, PyObject *args)
return NULL;
}
- error = com_get_class_object(ctx, &clsid, &iid, &object);
+ error = com_get_class_object(py_com_ctx, &clsid, &iid, &object);
if (!W_ERROR_IS_OK(error)) {
PyErr_FromWERROR(error);
return NULL;
@@ -61,8 +67,13 @@ static struct PyMethodDef com_methods[] = {
void initcom(void)
{
PyObject *m;
+ WERROR error;
- /* FIXME: Initialize COM context and attach it to m. */
+ error = com_init_ctx(&py_com_ctx, NULL);
+ if (!W_ERROR_IS_OK(error)) {
+ PyErr_FromWERROR(error);
+ return;
+ }
m = Py_InitModule3("com", com_methods, "Simple COM implementation");
if (m == NULL)