// ISSUE-2000/10/25-FrankYe Default to unique pointers
// Probably should default pointer to unique, then won't
// need so much redefinition of data structures to have
// unique embedded pointers
[
    uuid(3faf4738-3a21-4307-b46c-fdda9bb8c0d5),
    version(1.0),
    endpoint("ncalrpc:[AudioSrv]")]
interface AudioSrv
{
        import "wtypes.idl";
        
        typedef __int3264 RHANDLE;

	typedef [string, unique] wchar_t * UNIQUE_PWSTR;

	typedef struct {
		unsigned long  Data1;
		unsigned short Data2;
		unsigned short Data3;
		byte           Data4[ 8 ];
	} RPC_GUID;

	typedef RPC_GUID RPC_CLSID;

	typedef struct _DILIST {
		int Count;
		[size_is(Count)] UNIQUE_PWSTR DeviceInterface[];
	} DILIST;

	typedef [unique] DILIST *UNIQUE_PDILIST;
	
	typedef struct _GFX {
		unsigned int Id;
		UNIQUE_PWSTR GfxFactoryDi;
		RPC_CLSID Clsid;
		unsigned int Type;
		unsigned int Order;
	} GFX, *PGFX;

	typedef struct _PGFXLIST {
		int Count;
		[size_is(Count)] GFX Gfx[];
	} GFXLIST;

	typedef [unique] GFXLIST *UNIQUE_PGFXLIST;

        long s_gfxCreateZoneFactoriesList([out] UNIQUE_PDILIST *ppDiList);

	long s_gfxCreateGfxFactoriesList([in, string] wchar_t *pZoneDi,
                                         [out] UNIQUE_PDILIST *ppDiList);

	long s_gfxCreateGfxList([in, string] wchar_t *pZoneDi,
	                        [out] UNIQUE_PGFXLIST *ppGfxList);

	long s_gfxRemoveGfx([in] unsigned long Id);

	long s_gfxAddGfx([in, string] wchar_t *ZoneFactoryDi,
	                 [in, string] wchar_t *GfxFactoryDi,
			 [in] unsigned long Type,
			 [in] unsigned long Order,
			 [out] unsigned long *pNewId);

	long s_gfxModifyGfx([in] unsigned long Id,
	                    [in] unsigned long Order);

	// TODO learn how to pass HANDLE as OUT param
	long s_gfxOpenGfx([in] unsigned long dwProcessId,
	                  [in] unsigned long dwGfxId,
                          [out] RHANDLE *pFileHandle);
                          
	void s_gfxLogon([in] handle_t hBinding,
	                [in] unsigned long dwProcessId);

	void s_gfxLogoff(void);

        typedef [context_handle] void * HANDLE_SESSIONNOTIFICATION;
        typedef [ref] HANDLE_SESSIONNOTIFICATION *PHANDLE_SESSIONNOTIFICATION;

        long s_winmmRegisterSessionNotificationEvent([in] unsigned long dwProcessId,
                                                     [in] RHANDLE hEvent,
                                                     [out] PHANDLE_SESSIONNOTIFICATION phSessionNotification);
                                                 
        long s_winmmUnregisterSessionNotification([in, out] PHANDLE_SESSIONNOTIFICATION phSessionNotification);
        
        long s_winmmSessionConnectState([in] unsigned long dwProcessId, [out] int *ConnectState);
        
        long s_wdmDriverOpenDrvRegKey([in] DWORD dwProcessId, [in] LPCTSTR DeviceInterface, [in] ULONG samDesired, [out] RHANDLE *phkey);

        void s_winmmAdvisePreferredDeviceChange(void);

        long s_winmmGetPnpInfo([out] long *pcbPnpInfo, [out, size_is(,*pcbPnpInfo)] BYTE **PnpInfo);
}

