More improvements.
authorJelmer Vernooij <jelmer@samba.org>
Fri, 12 Sep 2008 17:55:49 +0000 (19:55 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Mon, 15 Sep 2008 15:40:19 +0000 (17:40 +0200)
source4/lib/wmi/pywmi.i
source4/lib/wmi/tools/wmic.c
source4/lib/wmi/wmi.h
source4/lib/wmi/wmicore.c
source4/main.mk
source4/pidl/lib/Parse/Pidl/Samba4/COM/Header.pm

index c1114c3cee43eac70e712ef47395dd693727c7de..1889e774ae83090c7c76a1f705d633cd3e2b041b 100644 (file)
@@ -22,6 +22,8 @@
 
 %include "typemaps.i"
 %import "stdint.i"
 
 %include "typemaps.i"
 %import "stdint.i"
+%import "libcli/util/errors.i"
+%import "lib/talloc/talloc.i"
 
 %runtime %{
 void push_object(PyObject **stack, PyObject *o)
 
 %runtime %{
 void push_object(PyObject **stack, PyObject *o)
@@ -59,7 +61,6 @@ WERROR WBEM_ConnectServer(struct com_context *ctx, const char *server, const cha
 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 WbemClassObject **apObjects, uint32_t *puReturned);
 
-static PyObject *PyErr_SetFromWERROR(WERROR w);
 static PyObject *PyObject_FromCVAR(uint32_t cimtype, union CIMVAR *cvar);
 static PyObject *PySWbemObject_FromWbemClassObject(struct WbemClassObject *wco);
 
 static PyObject *PyObject_FromCVAR(uint32_t cimtype, union CIMVAR *cvar);
 static PyObject *PySWbemObject_FromWbemClassObject(struct WbemClassObject *wco);
 
@@ -240,23 +241,10 @@ static PyObject *PySWbemObject_FromWbemClassObject(struct WbemClassObject *wco)
 
 %}
 
 
 %}
 
-%typemap(out) WERROR {
-       if (!W_ERROR_IS_OK($1)) {
-               PyErr_SetFromWERROR($1);
-               return NULL;
-       }
-        $result = Py_None;
-        Py_INCREF(Py_None);
-}
-
 %typemap(in, numinputs=0) struct com_context *ctx {
        $1 = com_ctx;
 }
 
 %typemap(in, numinputs=0) struct com_context *ctx {
        $1 = com_ctx;
 }
 
-%typemap(in, numinputs=0) TALLOC_CTX *mem_ctx {
-       $1 = NULL;
-}
-
 %typemap(in, numinputs=0) struct IWbemServices **services (struct IWbemServices *temp) {
        $1 = &temp;
 }
 %typemap(in, numinputs=0) struct IWbemServices **services (struct IWbemServices *temp) {
        $1 = &temp;
 }
@@ -329,14 +317,6 @@ WERROR IEnumWbemClassObject_Reset(struct IEnumWbemClassObject *d, TALLOC_CTX *me
        if (error) return NULL;
 }
 
        if (error) return NULL;
 }
 
-%typemap(out) WERROR {
-       if (!W_ERROR_IS_OK($1)) {
-               PyErr_SetFromWERROR($1);
-               talloc_free(arg5); // FIXME:avg make it properly(how???)
-               return NULL;
-       }
-}
-
 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 WbemClassObject **apObjects, uint32_t *puReturned);
 
@@ -346,8 +326,6 @@ WERROR IEnumWbemClassObject_SmartNext(struct IEnumWbemClassObject *d, TALLOC_CTX
        mod_pywintypes = PyImport_ImportModule("pywintypes");
        ComError = PyObject_GetAttrString(mod_pywintypes, "com_error");
 
        mod_pywintypes = PyImport_ImportModule("pywintypes");
        ComError = PyObject_GetAttrString(mod_pywintypes, "com_error");
 
-//     talloc_enable_leak_report_full();
-
        lp_load();
         dcerpc_init();
         dcerpc_table_init();
        lp_load();
         dcerpc_init();
         dcerpc_table_init();
index 0e52b5905ab1c449eb1530b1bf6197025df7961b..611a2dc36fd85881208d00dfc432a90cad9e15ac 100644 (file)
@@ -36,7 +36,7 @@
 struct WBEMCLASS;
 struct WBEMOBJECT;
 
 struct WBEMCLASS;
 struct WBEMOBJECT;
 
-#include "wmi/proto.h"
+#include "wmi/wmi.h"
 
 struct program_args {
     char *hostname;
 
 struct program_args {
     char *hostname;
index 49acf24c9f8d11d241f517fafd44e70b2246f6a3..32cc88efd5c53f70c536e15c35a5ee25c5f69ed3 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef _WMI_H_
 #define _WMI_H_
 
 #ifndef _WMI_H_
 #define _WMI_H_
 
+#include "librpc/gen_ndr/com_wmi.h"
+
 /* The following definitions come from lib/wmi/wmicore.c  */
 
 
 /* The following definitions come from lib/wmi/wmicore.c  */
 
 
index cb896f4a5d3230320f101d6aa85ff0c32e897bf7..cdfe037b6919b1432e98a1b3526249165c56d6cb 100644 (file)
@@ -1,7 +1,29 @@
+/*
+   WMI Sample client
+   Copyright (C) 2006 Andrzej Hajda <andrzej.hajda@wp.pl>
+   Copyright (C) 2008 Jelmer Vernooij <jelmer@samba.org>
+
+   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 "auth/credentials/credentials.h"
 #include "librpc/gen_ndr/com_dcom.h"
 #include "lib/com/dcom/dcom.h"
 #include "includes.h"
 #include "auth/credentials/credentials.h"
 #include "librpc/gen_ndr/com_dcom.h"
 #include "lib/com/dcom/dcom.h"
+#include "librpc/gen_ndr/wmi.h"
+#include "librpc/gen_ndr/com_wmi.h"
 
 struct IWbemServices;
 struct IWbemContext;
 
 struct IWbemServices;
 struct IWbemContext;
@@ -12,9 +34,11 @@ struct IWbemContext;
                         } else { \
                             DEBUG(1, ("OK   : %s\n", msg)); \
                         }
                         } else { \
                             DEBUG(1, ("OK   : %s\n", msg)); \
                         }
-
-WERROR WBEM_ConnectServer(struct com_context *ctx, const char *server, const char *nspace, const char *user, const char *password,
-        const char *locale, uint32_t flags, const char *authority, struct IWbemContext* wbem_ctx, struct IWbemServices** services)
+/** FIXME: Use credentials struct rather than user/password here */
+WERROR WBEM_ConnectServer(struct com_context *ctx, const char *server, const char *nspace, 
+                         const char *user, const char *password, 
+                         const char *locale, uint32_t flags, const char *authority, 
+                         struct IWbemContext* wbem_ctx, struct IWbemServices** services)
 {
         struct GUID clsid;
         struct GUID iid;
 {
         struct GUID clsid;
         struct GUID iid;
index ac7c1d3f0be5f9ca380210a75ef1ca887710cc4a..017c58786ad8ac9b2d9f8a489af6cd5c57d41f2b 100644 (file)
@@ -28,7 +28,7 @@ mkinclude lib/torture/config.mk
 mkinclude lib/basic.mk
 mkinclude lib/com/config.mk
 # WMI fails at the moment
 mkinclude lib/basic.mk
 mkinclude lib/com/config.mk
 # WMI fails at the moment
-#mkinclude lib/wmi/config.mk
+mkinclude lib/wmi/config.mk
 mkinclude param/config.mk
 mkinclude smb_server/config.mk
 mkinclude rpc_server/config.mk
 mkinclude param/config.mk
 mkinclude smb_server/config.mk
 mkinclude rpc_server/config.mk
index bc592e7f803eaa182d061e8ffcbe08f2cb84d05e..855798b70bb5c33924da030971bde27665a51319 100644 (file)
@@ -130,6 +130,13 @@ sub Parse($$)
        $res .= "#include \"librpc/gen_ndr/orpc.h\"\n" . 
                        "#include \"$ndr_header\"\n\n";
 
        $res .= "#include \"librpc/gen_ndr/orpc.h\"\n" . 
                        "#include \"$ndr_header\"\n\n";
 
+       foreach (@{$idl})
+       {
+               if ($_->{TYPE} eq "INTERFACE" && has_property($_, "object")) {
+                       $res .="struct $_->{NAME};\n";
+               }
+       }
+
        foreach (@{$idl})
        {
                if ($_->{TYPE} eq "INTERFACE" && has_property($_, "object")) {
        foreach (@{$idl})
        {
                if ($_->{TYPE} eq "INTERFACE" && has_property($_, "object")) {