#include "wtypes.idl" [ uuid(7a98c250-6808-11cf-b73b-00aa00b677a7), version(1.0) ] interface Tests { typedef struct _FakeString { byte ch; byte ch2; } FakeString; typedef [ptr] FakeString *FakeStringPtr ; /* can't be bothered to look up how to do a case((char)1) so am converting switch_type to short instead, and all uses of it too */ typedef [switch_type(short)] union NonEncapsulated { [case(1)] char ch; [case(2)] short s; [case(4)] long l; [case(5)] FakeString str; } NonEncapsulated; typedef union switch(short key) { case 1: char ch; case 2: short s; case 4: long l; case 5: FakeString str; } Encapsulated; /* _not_ defined in /opt/dce/include/wtypes.idl: */ /*typedef WCHAR WCHAR ; */ /* already defined in the version of wtypes.idl in /opt/dce/include/wtypes.idl: typedef [ptr, string] WCHAR * LPWSTR;*/ #define MAGIC_CHAR 0x54 #define MAGIC_SHORT 0x5784 #define MAGIC_LONG 0x13578658 #define MAGIC_DOUBLE 3.1415926535897932384626433832795 #define MAGIC_CSTRING "Hello World!\n" /* base types */ void CharIn([in] char ch); void ByteIn([in] byte b); void SmallIn([in] small sm); void USmallIn([in] unsigned small sm); void WCharIn([in] WCHAR wch); void ShortIn([in] short sh); void UShortIn([in] unsigned short ush); void FloatIn([in] float f); void HyperIn([in] hyper h); void DoubleIn([in] double d); void ErrorStatusTIn([in] error_status_t err); // void Int3264([in] __int3264 i); // void UInt3264([in] unsigned __int3264 i); /* pointers */ void UniquePointerIn([in, unique] unsigned char *pUnique); void UniquePointerOut([in, out, unique] unsigned char *pUnique); void FullPointerIn([in, ptr] unsigned char * pFull); void FullPointerIn2([in, ptr] FakeStringPtr * pFull); void FullPointerOut([in, out, ptr] unsigned char * pFull); /* misc */ /* oops void RangedIn([in, range(0, 100)] unsigned long l); */ char CharRet(); short ShortRet(); long LongRet(); FakeString StructRet(); float FloatRet(); double DoubleRet(); /* oops long __stdcall Stdcall([in] long l1, [in, out] long * pLong); */ /* arrays */ void SmFixedArrayIn([in] unsigned char Array[10]); void SmFixedArrayOut([out] unsigned char Array[10]); void LgFixedArrayIn([in] unsigned char Array[65538]); void LgFixedArrayOut([out] unsigned char Array[65538]); void SmVaryingArrayIn([in] long size, [in, length_is(size)] unsigned char Array[10]); void SmVaryingArrayOut([in] long size, [out, length_is(size)] unsigned char Array[10]); void LgVaryingArrayIn([in] long size, [in, length_is(size)] unsigned char Array[65538]); void LgVaryingArrayOut([in] long size, [out, length_is(size)] unsigned char Array[65538]); void ConformantArrayIn([in] long size, [in, size_is(size)] unsigned char Array[]); void ConformantArrayOut([in] long size, [out, size_is(size)] unsigned char Array[]); void ConformantVaryingArrayIn([in] long size1, [in] long size2, [in, size_is(size1), length_is(size2)] unsigned char Array[]); void ConformantVaryingArrayOut([in] long size1, [in] long size2, [out, size_is(size1), length_is(size2)] unsigned char Array[]); void ComplexArrayIn([in] long size, [in, size_is(size)] char ComplexArray[][10]); #if 0 void DivTwoConformanceArrayIn([in] long size, [in, length_is(size/2)] unsigned char Array[10]); void MultTwoConformanceArrayIn([in] long size, [in, length_is(size*2)] unsigned char Array[10]); void AddOneConformanceArrayIn([in] long size, [in, length_is(size+1)] unsigned char Array[10]); void SubOneConformanceArrayIn([in] long size, [in, length_is(size-1)] unsigned char Array[10]); void CallbackConformanceArrayIn([in] long size, [in, length_is(size*2+1)] unsigned char Array[10]); #endif /* strings */ void NonconformantString([in, string] char szString[10]); void ConformantString([in, string] char * pszString); #if 1 void NonconformantStructStr([in, string] FakeString szString[10]); void ConformantStructStr([in, string] FakeString * szString); void ConformantStructStrSized([in] unsigned long l, [in, string,size_is(l)] FakeString * pszString); #endif void ConformantWideString([in, string] WCHAR * pszString); /* structures */ typedef [ptr] long * pLong_t; typedef [ref] long * pLong_tr; typedef struct PointerStruct { pLong_t pLong; } TPointerStruct; typedef struct ConformantStruct { long size; [size_is(size)] char array[]; } TConformantStruct; typedef struct ConformantPStruct { pLong_tr size; [size_is(*size)] char array[]; } TConformantPStruct; typedef struct ConformantVStruct { long len; [length_is(len)] char array[10]; } TConformantVStruct ; typedef struct HardStruct { short type; [switch_is(type)] union NonEncapsulated u; } THardStruct ; typedef struct ComplexStruct { long size; [size_is(size)] char ComplexArray[][10]; } TComplexStruct ; void SimpleStructIn([in] FakeString * s); void SimpleStructOut([out] FakeString * s); void SimplePointerStructIn([in] struct PointerStruct * s); void SimplePointerStructOut([out] struct PointerStruct * s); void ConformantStructIn([in] struct ConformantStruct * s); void ConformantStructOut([in, out] struct ConformantStruct * s); void ConformantPointerStructIn([in] struct ConformantPStruct * s); void ConformantPointerStructOut([in, out] struct ConformantPStruct * s); void ConformantVaryingStructIn([in] struct ConformantVStruct * s); void ConformantVaryingStructOut([out] struct ConformantVStruct * s); /* these two should generate hard structs which are more efficient than the complex * structs MIDL actually generates */ void HardStructIn([in] struct HardStruct * s); void HardStructOut([out] struct HardStruct * s); void ComplexStructIn([in] struct ComplexStruct * s); void ComplexStructOut([in] struct ComplexStruct * s); /* unions */ void EncapsulatedUnionIn([in] Encapsulated * u); void EncapsulatedUnionOut([out] Encapsulated * u); void NonEncapsulatedUnionIn([in] short type, [in, switch_is(type)] union NonEncapsulated * u); void NonEncapsulatedUnionOut([in,out,ref] short *type, [out, switch_is(*type)] union NonEncapsulated * u); /* transmit_as */ #if 0 /* need to write to/from/free routines */ typedef [transmit_as(long)] char XMITAS; typedef long REPAS; void TransmitAsIn([in] XMITAS s); void TransmitAsOut([out] XMITAS * s); void RepresentAsIn([in] REPAS s); void RepresentAsOut([out] REPAS *s); void RangeIn([in, range(0, 100)] long l); void ByteCount([in] long cbBuffer, [out] struct PointerStruct * s); #endif error_status_t ErrorStatusT([out] error_status_t * funcstatus); }