📄 objectserver.h
字号:
// =====================================================
// Object Server
//
// Design and Implementation by Floris van den Berg
//
// Copyright (c) 2002 Pylon
// =====================================================
#ifndef OBJECTSERVER_H
#define OBJECTSERVER_H
#define DLL_CALLCONV __stdcall
#ifdef OBJECTSERVER_EXPORTS
#define SERVER_API __declspec(dllexport)
#else
#define SERVER_API __declspec(dllimport)
#endif
#ifndef _WINDOWS_
#include <windows.h>
#endif
#ifndef _OBJBASE_H_
#include <objbase.h>
#endif
// ========================================================
// Forward references
// ========================================================
struct ObjectInfo;
struct IObject;
// ========================================================
// Function pointers to discover and create methods
// ========================================================
typedef HRESULT (DLL_CALLCONV *ObjectDiscoverProc)(int count, ObjectInfo *info);
typedef HRESULT (DLL_CALLCONV *ObjectCreateProc)(void **iif);
// ========================================================
// Information block for each object
// ========================================================
#pragma pack(push, 1)
struct ObjectInfo {
GUID family;
GUID guid;
ObjectCreateProc create;
void *extra;
};
#pragma pack(pop)
// ========================================================
// Base component GUIDs
// ========================================================
static const GUID GUID_OBJECT =
{ 0xed735269, 0xe3d5, 0x48f7, { 0x92, 0xe8, 0x32, 0x45, 0x3a, 0x15, 0x4d, 0x41 } };
static const GUID GUID_SERVICEMANAGER =
{ 0x167002d3, 0x3aac, 0x49f9, { 0x9b, 0xad, 0x84, 0x2a, 0xfc, 0xec, 0x7f, 0x5d } };
// ========================================================
// Service (finds and instantiates objects in some
// platform specific way. This needs to be reimplemented
// per supported OS.
// ========================================================
struct IService : public IUnknown {
virtual HRESULT DLL_CALLCONV CreateInstance(GUID family, GUID guid, void **object) = 0;
virtual bool DLL_CALLCONV ObjectExists(GUID family, GUID guid) = 0;
};
// ========================================================
// Service Manager (finds and instantiates objects)
// ========================================================
struct IServiceManager : public IUnknown {
virtual HRESULT DLL_CALLCONV AddService(IService *service) = 0;
virtual HRESULT DLL_CALLCONV RemoveService(IService *service) = 0;
virtual HRESULT DLL_CALLCONV CreateInstance(GUID family, GUID guid, void **object) = 0;
virtual bool DLL_CALLCONV ObjectExists(GUID family, GUID guid) = 0;
};
// ========================================================
// Service Manager Instantiator
// ========================================================
extern "C" {
// ----------------------------------------------------------
// Purpose: Instantiates the service manager
// Usage : The service manager is the object that you use
// to find (discover) other components and to
// instantiate them.
// Notes : None
// ----------------------------------------------------------
SERVER_API HRESULT DLL_CALLCONV GetServiceManager(void **iif);
// ----------------------------------------------------------
// Purpose: Converts a GUID to a string
// Usage : None
// Notes : None
// ----------------------------------------------------------
SERVER_API int DLL_CALLCONV EpStringFromGuid(char *result, CLSID clsid);
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -