svn commit: samba r5492 - in branches/SAMBA_4_0/source: build/pidl lib/com/classes librpc/idl

jelmer at samba.org jelmer at samba.org
Mon Feb 21 20:51:26 GMT 2005


Author: jelmer
Date: 2005-02-21 20:51:26 +0000 (Mon, 21 Feb 2005)
New Revision: 5492

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=5492

Log:
Update example coclass, autogenerate some parts.

Modified:
   branches/SAMBA_4_0/source/build/pidl/com_header.pm
   branches/SAMBA_4_0/source/lib/com/classes/simple.c
   branches/SAMBA_4_0/source/librpc/idl/dcom.idl


Changeset:
Modified: branches/SAMBA_4_0/source/build/pidl/com_header.pm
===================================================================
--- branches/SAMBA_4_0/source/build/pidl/com_header.pm	2005-02-21 15:08:57 UTC (rev 5491)
+++ branches/SAMBA_4_0/source/build/pidl/com_header.pm	2005-02-21 20:51:26 UTC (rev 5492)
@@ -106,7 +106,13 @@
 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($)

Modified: branches/SAMBA_4_0/source/lib/com/classes/simple.c
===================================================================
--- branches/SAMBA_4_0/source/lib/com/classes/simple.c	2005-02-21 15:08:57 UTC (rev 5491)
+++ branches/SAMBA_4_0/source/lib/com/classes/simple.c	2005-02-21 20:51:26 UTC (rev 5492)
@@ -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 @@
 	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 @@
 	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);
 }

Modified: branches/SAMBA_4_0/source/librpc/idl/dcom.idl
===================================================================
--- branches/SAMBA_4_0/source/librpc/idl/dcom.idl	2005-02-21 15:08:57 UTC (rev 5491)
+++ branches/SAMBA_4_0/source/librpc/idl/dcom.idl	2005-02-21 20:51:26 UTC (rev 5492)
@@ -274,11 +274,11 @@
 }
 
 [
-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 @@
 				 [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;
+}



More information about the samba-cvs mailing list