|
|
// IDL source for WINSSNAP DLLs //
#ifndef _WINSDB_IDL_ #define _WINSDB_IDL_
import "wtypes.idl";
typedef BYTE * PBYTE; typedef PBYTE HROW; typedef HROW * LPHROW;
// valid states for the database typedef enum _WINSDB_STATE { WINSDB_NORMAL = 0x0001, WINSDB_LOADING = 0x0002, WINSDB_SORTING = 0x0003, WINSDB_FILTERING = 0x0004
} WINSDB_STATE;
// possible sort types for the database typedef enum _WINSDB_SORT_TYPE { WINSDB_SORT_BY_NAME, WINSDB_SORT_BY_IP, WINSDB_SORT_BY_VERSION, WINSDB_SORT_BY_TYPE, WINSDB_SORT_BY_EXPIRATION, WINSDB_SORT_BY_STATE, WINSDB_SORT_BY_STATIC, WINSDB_SORT_BY_OWNER
} WINSDB_SORT_TYPE;
// possilble views for the database typedef enum _WINSDB_VIEW_TYPE { WINSDB_VIEW_ENTIRE_DATABASE, WINSDB_VIEW_FILTERED_DATABASE
} WINSDB_VIEW_TYPE;
typedef enum _WINSDB_SORT_OPTIONS { WINSDB_SORT_DESCENDING = 0x00, WINSDB_SORT_ASCENDING = 0x01
} WINSDB_SORT_OPTIONS;
// possible Filter types for the database typedef enum _WINSDB_FILTER_TYPE { WINSDB_FILTER_BY_TYPE, WINSDB_FILTER_BY_OWNER, WINSDB_FILTER_BY_IPADDR, WINSDB_FILTER_BY_NAME
} WINSDB_FILTER_TYPE;
const ULONG WINS_RECNAME_MAX = 256;
#define MAX_IP_ADDRS 100 const ULONG WINSDB_MAX_NO_IPADDRS = MAX_IP_ADDRS;
// predefined interface IWinsDatabase;
typedef IWinsDatabase * LPWINSDATABASE;
// flags for the dwState field typedef enum _WINSDB_REC_TYPE { WINSDB_REC_ACTIVE = 0x00000001, WINSDB_REC_STATIC = 0x00000002, WINSDB_REC_TOMBSTONE = 0x00000004, WINSDB_REC_RELEASED = 0x00000008, WINSDB_REC_DELETED = 0x00000010, WINSDB_REC_MULT_ADDRS = 0x00000020, WINSDB_REC_UNIQUE = 0x00000040, WINSDB_REC_NORM_GROUP = 0x00000080, WINSDB_REC_SPEC_GROUP = 0x00000100, WINSDB_REC_MULTIHOMED = 0x00000200, WINSDB_REC_INTERNET_GROUP=0x00000400 } WINSDB_REC_TYPE;
// NOTE: the dwType field is broken up as follows: // HIWORD(dwType) = record type defined in WINSINTF_RECTYPE_E // LOBYTE(LOWORD(dwType)) = machine type (ie. 1B, 1C, etc) typedef struct _WinsRecord { char szRecordName [WINS_RECNAME_MAX]; DWORD_PTR dwExpiration; DWORD dwIpAdd[MAX_IP_ADDRS]; // extra space, just in case DWORD dwNoOfAddrs; LARGE_INTEGER liVersion; DWORD dwNameLen; DWORD dwOwner; DWORD dwState; DWORD dwType; } WinsRecord, * LPWINSRECORD;
/*--------------------------------------------------------------------------- IWinsDatabase ---------------------------------------------------------------------------*/ [ object, uuid(7B0C8BBF-3117-11d1-B981-00C04FBF914A), local, pointer_default(unique), ] //---------------------------------------------------------------------------- // Struct: WinsRecord // // Contains information applying to a particular Wins Record //----------------------------------------------------------------------------
interface IWinsDatabase :IUnknown { import "unknwn.idl"; // all these need no parameters HRESULT Init(); HRESULT Start(); HRESULT Stop(); HRESULT Clear(); // SortBy can be by record name, IP Address, Type, Expiration date, // Version HRESULT Sort([in] WINSDB_SORT_TYPE dwSortBy, [in] DWORD dwSortOptions);
// returns the pointer to the first record in the rows // requested for HRESULT GetRows([in] ULONG uNumberOfRows, [in] ULONG uStartPos, [out] LPHROW ppHRow, [out] int * nNumberOfRowsReturned);
// fills in the WinsRecord structure HRESULT GetData([in] HROW hRow, [out] LPWINSRECORD pRecordData);
// fills in the row index in the chunk of memory // finds the specified computer name HRESULT FindRow([in, string] LPCOLESTR pszName, [in] HROW hrowStart, [out] LPHROW hRow); // just places the handle at that point in the DB records HRESULT GetHRow([in] UINT uIndex, [in] LPHROW hRow);
HRESULT GetTotalCount([out] int * pTotalCount); HRESULT GetCurrentCount([out] int * pCurrentCount);
HRESULT GetCurrentScanned([out] int * pCurrentScanned); HRESULT AddRecord([in] const LPWINSRECORD RecordData); HRESULT DeleteRecord([in] HROW hrowRecord);
HRESULT GetCurrentState( [out] WINSDB_STATE * pState);
HRESULT FilterRecords([in] WINSDB_FILTER_TYPE FilterType, [in] DWORD dwParam1, [in] DWORD dwParam2);
HRESULT AddFilter( [in] WINSDB_FILTER_TYPE FilterType, [in] DWORD dwData1, [in] DWORD dwData2, [in] LPCOLESTR strData3);
HRESULT ClearFilter([in] WINSDB_FILTER_TYPE FilterType);
HRESULT Initialize([in, string] LPCOLESTR pszName, [in, string] LPCOLESTR pszIP);
HRESULT GetName([out, string] LPOLESTR pszName, [in] UINT cchMax);
HRESULT GetIP([out, string] LPOLESTR pszIP, [in] UINT cchMax);
HRESULT GetLastError([out] HRESULT * pLastError);
HRESULT SetActiveView([in] WINSDB_VIEW_TYPE ViewType);
HRESULT SetApiInfo([in] DWORD dwOwner, [in] LPCOLESTR strPrefix, [in] BOOL bCache);
HRESULT GetCachingFlag([out] BOOL *pbCache);
HRESULT ReloadSuggested([in] DWORD dwOwner, [in] LPCOLESTR strPrefix, [out] BOOL *pbReload);
};
// a macro to help declare all of the methods cpp_quote("#define DeclareIWinsDatabaseMembers(IPURE) \\") cpp_quote(" STDMETHOD(Init)(THIS) IPURE; \\") cpp_quote(" STDMETHOD(Start)(THIS) IPURE; \\") cpp_quote(" STDMETHOD(Stop)(THIS) IPURE; \\") cpp_quote(" STDMETHOD(Clear)(THIS) IPURE; \\") cpp_quote(" STDMETHOD(GetLastError)(THIS_ HRESULT * pLastError) IPURE; \\") cpp_quote(" STDMETHOD(Sort)(THIS_ WINSDB_SORT_TYPE SortBy, DWORD dwSortOptions) IPURE; \\") cpp_quote(" STDMETHOD(GetRows)(THIS_ ULONG uNumberOfRows,ULONG uStartPos, HROW* ppHRow, int* nNumberOfRowsReturned) IPURE; \\") cpp_quote(" STDMETHOD(GetData)(THIS_ HROW hRow, WinsRecord* ppRecordData) IPURE; \\") cpp_quote(" STDMETHOD(FindRow)(THIS_ LPCOLESTR pszName, HROW hrowStart,HROW* hRow) IPURE; \\") cpp_quote(" STDMETHOD(GetHRow)(THIS_ UINT uIndex,HROW* hRow) IPURE; \\") cpp_quote(" STDMETHOD(GetTotalCount)(THIS_ int* pTotalCount) IPURE; \\") cpp_quote(" STDMETHOD(GetCurrentCount)(THIS_ int* pCurrentCount) IPURE; \\") cpp_quote(" STDMETHOD(GetCurrentScanned)(THIS_ int* pCurrentScanned) IPURE; \\") cpp_quote(" STDMETHOD(AddRecord)(THIS_ const LPWINSRECORD RecordData) IPURE; \\") cpp_quote(" STDMETHOD(DeleteRecord)(THIS_ HROW hrowRecord) IPURE; \\") cpp_quote(" STDMETHOD(GetCurrentState)(THIS_ WINSDB_STATE * pState) IPURE; \\") cpp_quote(" STDMETHOD(FilterRecords)(THIS_ WINSDB_FILTER_TYPE FilterType, DWORD dwParam1, DWORD dwParam2) IPURE; \\") cpp_quote(" STDMETHOD(AddFilter)(THIS_ WINSDB_FILTER_TYPE FilterType, DWORD dwParam1, DWORD dwParam2, LPCOLESTR strParam3) IPURE; \\") cpp_quote(" STDMETHOD(ClearFilter)(THIS_ WINSDB_FILTER_TYPE FilterType) IPURE; \\") cpp_quote(" STDMETHOD(Initialize)(THIS_ LPCOLESTR pszName, LPCOLESTR pszIP) IPURE; \\") cpp_quote(" STDMETHOD(GetName)(THIS_ LPOLESTR pszName, UINT cchMax) IPURE; \\") cpp_quote(" STDMETHOD(GetIP)(THIS_ LPOLESTR pszIP, UINT cchMax) IPURE; \\") cpp_quote(" STDMETHOD(SetActiveView)(THIS_ WINSDB_VIEW_TYPE ViewType) IPURE; \\") cpp_quote(" STDMETHOD(SetApiInfo)(THIS_ DWORD dwOwner, LPCOLESTR strPrefix, BOOL bCache) IPURE; \\") cpp_quote(" STDMETHOD(GetCachingFlag)(THIS_ BOOL *pbCache) IPURE; \\") cpp_quote(" STDMETHOD(ReloadSuggested)(THIS_ DWORD dwOwner, LPCOLESTR strPrefix, BOOL *pbReload) IPURE; \\") cpp_quote("")
#endif // _WINSDB__
|