diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-02-21 20:51:26 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:10:50 -0500 |
commit | 9c6ad1f762a07082156673dc1bc67e171fe96251 (patch) | |
tree | 186caeea86b10aac6dd1216788a374fb8a7e18eb /source4/lib/com/classes | |
parent | 4d10f2a86a4d44960b0c5590da988483c672cfba (diff) | |
download | samba-9c6ad1f762a07082156673dc1bc67e171fe96251.tar.gz samba-9c6ad1f762a07082156673dc1bc67e171fe96251.tar.bz2 samba-9c6ad1f762a07082156673dc1bc67e171fe96251.zip |
r5492: Update example coclass, autogenerate some parts.
(This used to be commit 3c31cbaac0cd916e6af49bfd2260bc3b1a75b677)
Diffstat (limited to 'source4/lib/com/classes')
-rw-r--r-- | source4/lib/com/classes/simple.c | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/source4/lib/com/classes/simple.c b/source4/lib/com/classes/simple.c index 2c72d56f94..a6134d4c36 100644 --- a/source4/lib/com/classes/simple.c +++ b/source4/lib/com/classes/simple.c @@ -22,57 +22,51 @@ #include "lib/com/com.h" #include "librpc/gen_ndr/com_dcom.h" +extern const struct IClassFactory_vtable simple_classobject_vtable; +extern const struct IStream_vtable simple_IStream_vtable; -static WERROR simple_QueryInterface (struct IUnknown *d, TALLOC_CTX *mem_ctx, struct GUID *iid, struct IUnknown **iun) +static WERROR simple_IUnknown_QueryInterface (struct IUnknown *d, TALLOC_CTX *mem_ctx, struct GUID *iid, struct IUnknown **iun) { *iun = d; return WERR_OK; } -static uint32_t simple_AddRef (struct IUnknown *d, TALLOC_CTX *mem_ctx) +static uint32_t simple_IUnknown_AddRef (struct IUnknown *d, TALLOC_CTX *mem_ctx) { return 1; } -static uint32_t simple_Release (struct IUnknown *d, TALLOC_CTX *mem_ctx) +static uint32_t simple_IUnknown_Release (struct IUnknown *d, TALLOC_CTX *mem_ctx) { return 1; } -static WERROR simple_Read (struct IStream *d, TALLOC_CTX *mem_ctx, uint8_t *pv, uint32_t num_requested, uint32_t *num_readx, uint32_t num_read) +static WERROR simple_IStream_Read (struct IStream *d, TALLOC_CTX *mem_ctx, uint8_t *pv, uint32_t num_requested, uint32_t *num_readx, uint32_t num_read) { printf("%d bytes are being read\n", num_read); return WERR_OK; } -static WERROR simple_Write (struct IStream *d, TALLOC_CTX *mem_ctx, uint8_t *data, uint32_t num_requested, uint32_t num_written) +static WERROR simple_IStream_Write (struct IStream *d, TALLOC_CTX *mem_ctx, uint8_t *data, uint32_t num_requested, uint32_t num_written) { printf("%d bytes are being written\n", num_requested); return WERR_OK; } -static struct IStream_vtable simple_istream_vtable = { - simple_QueryInterface, - simple_AddRef, - simple_Release, - simple_Read, - simple_Write -}; - -static WERROR simpleclass_QueryInterface (struct IUnknown *d, TALLOC_CTX *mem_ctx, struct GUID *iid, struct IUnknown **iun) +static WERROR simpleclass_IUnknown_QueryInterface (struct IUnknown *d, TALLOC_CTX *mem_ctx, struct GUID *iid, struct IUnknown **iun) { /* FIXME: Return WERR_IFACE_NOT_SUPPORTED if IID != IID_IUNKNOWN and IID != IID_CLASSFACTORY */ *iun = d; return WERR_OK; } -static WERROR simpleclass_CreateInstance (struct IClassFactory *d, TALLOC_CTX *mem_ctx, struct IUnknown *iunk, struct GUID *iid, struct IUnknown **ppv) +static WERROR simpleclass_IClassFactory_CreateInstance (struct IClassFactory *d, TALLOC_CTX *mem_ctx, struct IUnknown *iunk, struct GUID *iid, struct IUnknown **ppv) { struct IStream *ret; /* FIXME: Check whether IID == ISTREAM_IID */ ret = talloc(mem_ctx, struct IStream); ret->ctx = NULL; - ret->vtable = &simple_istream_vtable; + ret->vtable = &simple_IStream_vtable; ret->object_data = NULL; *ppv = ret; @@ -80,27 +74,35 @@ static WERROR simpleclass_CreateInstance (struct IClassFactory *d, TALLOC_CTX *m return WERR_OK; } -static uint32_t simpleclass_AddRef (struct IUnknown *d, TALLOC_CTX *mem_ctx) +static uint32_t simpleclass_IUnknown_AddRef (struct IUnknown *d, TALLOC_CTX *mem_ctx) { return 1; } -static uint32_t simpleclass_Release (struct IUnknown *d, TALLOC_CTX *mem_ctx) +static uint32_t simpleclass_IUnknown_Release (struct IUnknown *d, TALLOC_CTX *mem_ctx) { return 1; } /* Everything below this line should be autogenerated later on */ -static struct IClassFactory_vtable simple_classobject_vtable = { - simpleclass_QueryInterface, - simpleclass_AddRef, - simpleclass_Release, - simpleclass_CreateInstance, +const struct IClassFactory_vtable simple_classobject_vtable = { + simpleclass_IUnknown_QueryInterface, + simpleclass_IUnknown_AddRef, + simpleclass_IUnknown_Release, + simpleclass_IClassFactory_CreateInstance, NULL, NULL, NULL }; +const struct IStream_vtable simple_IStream_vtable = { + simple_IUnknown_QueryInterface, + simple_IUnknown_AddRef, + simple_IUnknown_Release, + simple_IStream_Read, + simple_IStream_Write +}; + NTSTATUS com_simple_init(void) { struct GUID clsid; @@ -110,7 +112,7 @@ NTSTATUS com_simple_init(void) class_object->object_data = NULL; class_object->vtable = (struct IUnknown_vtable *)&simple_classobject_vtable; - GUID_from_string("5e9ddec7-5767-11cf-beab-00aa006c3606", &clsid); + GUID_from_string(CLSID_SIMPLE, &clsid); - return com_register_running_class(&clsid, "Samba.Simple", class_object); + return com_register_running_class(&clsid, PROGID_SIMPLE, class_object); } |