From dc3828f06c8c77ca9fb683528096f2d412028b12 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 20 Oct 2008 19:14:47 +0200 Subject: Move WMI support code to top-level. --- librpc/ndr/ndr_wmi.c | 60 ++++++++++++++++++++++++++++++++++++++++++++ librpc/ndr/ndr_wmi.h | 3 +++ source4/librpc/config.mk | 4 +-- source4/librpc/ndr/ndr_wmi.c | 60 -------------------------------------------- source4/librpc/ndr/ndr_wmi.h | 3 --- 5 files changed, 64 insertions(+), 66 deletions(-) create mode 100644 librpc/ndr/ndr_wmi.c create mode 100644 librpc/ndr/ndr_wmi.h delete mode 100644 source4/librpc/ndr/ndr_wmi.c delete mode 100644 source4/librpc/ndr/ndr_wmi.h diff --git a/librpc/ndr/ndr_wmi.c b/librpc/ndr/ndr_wmi.c new file mode 100644 index 0000000000..2c122decf4 --- /dev/null +++ b/librpc/ndr/ndr_wmi.c @@ -0,0 +1,60 @@ +/* + Unix SMB/CIFS implementation. + + routines for marshalling/unmarshalling DCOM string arrays + + Copyright (C) Jelmer Vernooij 2004 + + 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. +*/ +//#define NDR_CHECK_DEBUG +#include "includes.h" +#include "librpc/gen_ndr/ndr_dcom.h" +#include "librpc/gen_ndr/ndr_wmi.h" +#include "librpc/ndr/ndr_wmi.h" + +// Just for debugging +int NDR_CHECK_depth = 0; +int NDR_CHECK_shift = 0x18; + +enum ndr_err_code ndr_push_BSTR(struct ndr_push *ndr, int ndr_flags, const struct BSTR *r) +{ + uint32_t len; + uint32_t flags; + enum ndr_err_code status; + len = strlen(r->data); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0x72657355)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, len)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 2*len)); + flags = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NOTERM | LIBNDR_FLAG_STR_SIZE4); + status = ndr_push_string(ndr, NDR_SCALARS, r->data); + ndr->flags = flags; + return status; + } + return NDR_ERR_SUCCESS; +} + +enum ndr_err_code ndr_pull_BSTR(struct ndr_pull *ndr, int ndr_flags, struct BSTR *r) +{ + return NDR_ERR_BAD_SWITCH; +} + +void ndr_print_BSTR(struct ndr_print *ndr, const char *name, const struct BSTR *r) +{ + ndr->print(ndr, "%-25s: BSTR(\"%s\")", name, r->data); +} diff --git a/librpc/ndr/ndr_wmi.h b/librpc/ndr/ndr_wmi.h new file mode 100644 index 0000000000..539b9e882b --- /dev/null +++ b/librpc/ndr/ndr_wmi.h @@ -0,0 +1,3 @@ +typedef const char *CIMSTRING; +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/librpc/config.mk b/source4/librpc/config.mk index 6a0cd00e11..02542cbfea 100644 --- a/source4/librpc/config.mk +++ b/source4/librpc/config.mk @@ -10,8 +10,6 @@ PUBLIC_DEPENDENCIES = LIBSAMBA-ERRORS LIBTALLOC LIBSAMBA-UTIL CHARSET \ LIBNDR_OBJ_FILES = $(addprefix $(ndrsrcdir)/, ndr_string.o) ../librpc/ndr/ndr_basic.o ../librpc/ndr/uuid.o ../librpc/ndr/ndr.o -$(eval $(call proto_header_template,$(ndrsrcdir)/libndr_proto.h,$(LIBNDR_OBJ_FILES:.o=.c))) - PC_FILES += ../librpc/ndr.pc LIBNDR_VERSION = 0.0.1 LIBNDR_SOVERSION = 0 @@ -90,7 +88,7 @@ NDR_DCOM_OBJ_FILES = $(gen_ndrsrcdir)/ndr_dcom.o [SUBSYSTEM::NDR_WMI] PUBLIC_DEPENDENCIES = LIBNDR NDR_SECURITY NDR_DCOM -NDR_WMI_OBJ_FILES = $(gen_ndrsrcdir)/ndr_wmi.o $(ndrsrcdir)/ndr_wmi.o +NDR_WMI_OBJ_FILES = $(gen_ndrsrcdir)/ndr_wmi.o ../librpc/ndr/ndr_wmi.o [SUBSYSTEM::NDR_DSBACKUP] PUBLIC_DEPENDENCIES = LIBNDR diff --git a/source4/librpc/ndr/ndr_wmi.c b/source4/librpc/ndr/ndr_wmi.c deleted file mode 100644 index 2c122decf4..0000000000 --- a/source4/librpc/ndr/ndr_wmi.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - Unix SMB/CIFS implementation. - - routines for marshalling/unmarshalling DCOM string arrays - - Copyright (C) Jelmer Vernooij 2004 - - 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. -*/ -//#define NDR_CHECK_DEBUG -#include "includes.h" -#include "librpc/gen_ndr/ndr_dcom.h" -#include "librpc/gen_ndr/ndr_wmi.h" -#include "librpc/ndr/ndr_wmi.h" - -// Just for debugging -int NDR_CHECK_depth = 0; -int NDR_CHECK_shift = 0x18; - -enum ndr_err_code ndr_push_BSTR(struct ndr_push *ndr, int ndr_flags, const struct BSTR *r) -{ - uint32_t len; - uint32_t flags; - enum ndr_err_code status; - len = strlen(r->data); - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0x72657355)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, len)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 2*len)); - flags = ndr->flags; - ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NOTERM | LIBNDR_FLAG_STR_SIZE4); - status = ndr_push_string(ndr, NDR_SCALARS, r->data); - ndr->flags = flags; - return status; - } - return NDR_ERR_SUCCESS; -} - -enum ndr_err_code ndr_pull_BSTR(struct ndr_pull *ndr, int ndr_flags, struct BSTR *r) -{ - return NDR_ERR_BAD_SWITCH; -} - -void ndr_print_BSTR(struct ndr_print *ndr, const char *name, const struct BSTR *r) -{ - ndr->print(ndr, "%-25s: BSTR(\"%s\")", name, r->data); -} diff --git a/source4/librpc/ndr/ndr_wmi.h b/source4/librpc/ndr/ndr_wmi.h deleted file mode 100644 index 539b9e882b..0000000000 --- a/source4/librpc/ndr/ndr_wmi.h +++ /dev/null @@ -1,3 +0,0 @@ -typedef const char *CIMSTRING; -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); -- cgit