summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-02-21 20:51:26 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:10:50 -0500
commit9c6ad1f762a07082156673dc1bc67e171fe96251 (patch)
tree186caeea86b10aac6dd1216788a374fb8a7e18eb /source4
parent4d10f2a86a4d44960b0c5590da988483c672cfba (diff)
downloadsamba-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')
-rw-r--r--source4/build/pidl/com_header.pm8
-rw-r--r--source4/lib/com/classes/simple.c52
-rw-r--r--source4/librpc/idl/dcom.idl18
3 files changed, 48 insertions, 30 deletions
diff --git a/source4/build/pidl/com_header.pm b/source4/build/pidl/com_header.pm
index b0523c935a..18df78f90d 100644
--- a/source4/build/pidl/com_header.pm
+++ b/source4/build/pidl/com_header.pm
@@ -106,7 +106,13 @@ sub ParseInterface($)
sub ParseCoClass($)
{
my $c = shift;
- return "#define CLSID_$c->{NAME} $c->{PROPERTIES}->{uuid}\n\n";
+ my $res = "";
+ $res .= "#define CLSID_" . uc($c->{NAME}) . " $c->{PROPERTIES}->{uuid}\n";
+ if (util::has_property($c, "progid")) {
+ $res .= "#define PROGID_" . uc($c->{NAME}) . " $c->{PROPERTIES}->{progid}\n";
+ }
+ $res .= "\n";
+ return $res;
}
sub Parse($)
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);
}
diff --git a/source4/librpc/idl/dcom.idl b/source4/librpc/idl/dcom.idl
index b4ce03e5aa..7c3f181f0e 100644
--- a/source4/librpc/idl/dcom.idl
+++ b/source4/librpc/idl/dcom.idl
@@ -274,11 +274,11 @@ object,
}
[
-uuid(DB7C21F8-FE33-4C11-AEA5-CEB56F076FBB),
- helpstring("CoffeeMachine Class")
-] coclass CoffeeMachine
+ uuid("db7c21f8-fe33-4c11-aea5-ceb56f076fbb"),
+ helpstring("coffeemachine class")
+] coclass coffeemachine
{
- interface ICoffeeMachine;
+ interface icoffeemachine;
}
[
@@ -301,3 +301,13 @@ interface IStream : IUnknown
[in] uint32 num_requested,
[out] uint32 num_written);
}
+
+[
+ uuid("5e9ddec7-5767-11cf-beab-00aa006c3606"),
+ progid("Samba.Simple"),
+ helpstring("simple class"),
+ internal
+] coclass simple
+{
+ interface IStream;
+}