2003-03-11 01:45:38 +00:00
|
|
|
/*
|
|
|
|
* Implementation of the StdGlobalInterfaceTable object
|
|
|
|
*
|
|
|
|
* The GlobalInterfaceTable (GIT) object is used to marshal interfaces between
|
|
|
|
* threading apartments (contexts). When you want to pass an interface but not
|
|
|
|
* as a parameter, it wouldn't get marshalled automatically, so you can use this
|
|
|
|
* object to insert the interface into a table, and you get back a cookie.
|
|
|
|
* Then when it's retrieved, it'll be unmarshalled into the right apartment.
|
|
|
|
*
|
2003-03-20 01:31:16 +00:00
|
|
|
* Copyright 2003 Mike Hearn <mike@theoretic.com>
|
2003-03-11 01:45:38 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 12:49:52 +00:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2003-03-11 01:45:38 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <stdlib.h>
|
2003-09-05 23:08:26 +00:00
|
|
|
#include <stdarg.h>
|
2003-03-11 01:45:38 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2004-10-07 03:06:48 +00:00
|
|
|
#define COBJMACROS
|
|
|
|
#define NONAMELESSUNION
|
|
|
|
#define NONAMELESSSTRUCT
|
|
|
|
|
2003-03-11 01:45:38 +00:00
|
|
|
#include "windef.h"
|
2003-09-05 23:08:26 +00:00
|
|
|
#include "winbase.h"
|
2003-09-09 19:39:31 +00:00
|
|
|
#include "winuser.h"
|
2003-03-11 01:45:38 +00:00
|
|
|
#include "objbase.h"
|
|
|
|
#include "ole2.h"
|
|
|
|
#include "winerror.h"
|
2003-09-05 23:08:26 +00:00
|
|
|
#include "winreg.h"
|
2003-03-11 01:45:38 +00:00
|
|
|
#include "winternl.h"
|
|
|
|
|
|
|
|
#include "compobj_private.h"
|
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* StdGlobalInterfaceTable definition
|
|
|
|
*
|
|
|
|
* This class implements IGlobalInterfaceTable and is a process-wide singleton
|
|
|
|
* used for marshalling interfaces between threading apartments using cookies.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Each entry in the linked list of GIT entries */
|
|
|
|
typedef struct StdGITEntry
|
|
|
|
{
|
|
|
|
DWORD cookie;
|
2003-07-22 01:01:25 +00:00
|
|
|
IID iid; /* IID of the interface */
|
2003-03-11 01:45:38 +00:00
|
|
|
IStream* stream; /* Holds the marshalled interface */
|
|
|
|
|
|
|
|
struct StdGITEntry* next;
|
|
|
|
struct StdGITEntry* prev;
|
|
|
|
} StdGITEntry;
|
|
|
|
|
|
|
|
/* Class data */
|
|
|
|
typedef struct StdGlobalInterfaceTableImpl
|
|
|
|
{
|
2005-06-06 19:50:35 +00:00
|
|
|
const IGlobalInterfaceTableVtbl *lpVtbl;
|
2003-03-11 01:45:38 +00:00
|
|
|
|
|
|
|
ULONG ref;
|
|
|
|
struct StdGITEntry* firstEntry;
|
|
|
|
struct StdGITEntry* lastEntry;
|
|
|
|
ULONG nextCookie;
|
|
|
|
|
|
|
|
} StdGlobalInterfaceTableImpl;
|
|
|
|
|
2003-06-17 03:57:18 +00:00
|
|
|
void* StdGlobalInterfaceTableInstance;
|
|
|
|
|
2003-08-23 00:45:49 +00:00
|
|
|
static CRITICAL_SECTION git_section;
|
|
|
|
static CRITICAL_SECTION_DEBUG critsect_debug =
|
|
|
|
{
|
|
|
|
0, 0, &git_section,
|
|
|
|
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
|
2005-09-09 10:19:44 +00:00
|
|
|
0, 0, { (DWORD_PTR)(__FILE__ ": global interface table") }
|
2003-08-23 00:45:49 +00:00
|
|
|
};
|
|
|
|
static CRITICAL_SECTION git_section = { &critsect_debug, -1, 0, 0, 0, 0 };
|
|
|
|
|
|
|
|
|
2003-03-11 01:45:38 +00:00
|
|
|
/** This destroys it again. It should revoke all the held interfaces first **/
|
2006-08-02 11:31:26 +00:00
|
|
|
static void StdGlobalInterfaceTable_Destroy(void* self)
|
|
|
|
{
|
2003-03-11 01:45:38 +00:00
|
|
|
TRACE("(%p)\n", self);
|
|
|
|
FIXME("Revoke held interfaces here\n");
|
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, self);
|
2003-07-22 01:01:25 +00:00
|
|
|
StdGlobalInterfaceTableInstance = NULL;
|
2003-03-11 01:45:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/***
|
|
|
|
* A helper function to traverse the list and find the entry that matches the cookie.
|
|
|
|
* Returns NULL if not found
|
|
|
|
*/
|
2005-05-13 17:45:50 +00:00
|
|
|
static StdGITEntry*
|
|
|
|
StdGlobalInterfaceTable_FindEntry(IGlobalInterfaceTable* iface, DWORD cookie)
|
|
|
|
{
|
2003-03-11 01:45:38 +00:00
|
|
|
StdGlobalInterfaceTableImpl* const self = (StdGlobalInterfaceTableImpl*) iface;
|
|
|
|
StdGITEntry* e;
|
|
|
|
|
|
|
|
TRACE("iface=%p, cookie=0x%x\n", iface, (UINT)cookie);
|
2003-08-23 00:45:49 +00:00
|
|
|
|
|
|
|
EnterCriticalSection(&git_section);
|
2003-03-11 01:45:38 +00:00
|
|
|
e = self->firstEntry;
|
|
|
|
while (e != NULL) {
|
2003-08-23 00:45:49 +00:00
|
|
|
if (e->cookie == cookie) {
|
|
|
|
LeaveCriticalSection(&git_section);
|
|
|
|
return e;
|
|
|
|
}
|
2003-03-11 01:45:38 +00:00
|
|
|
e = e->next;
|
|
|
|
}
|
2003-08-23 00:45:49 +00:00
|
|
|
LeaveCriticalSection(&git_section);
|
|
|
|
|
2003-06-17 03:57:18 +00:00
|
|
|
TRACE("Entry not found\n");
|
2003-03-11 01:45:38 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***
|
|
|
|
* Here's the boring boilerplate stuff for IUnknown
|
|
|
|
*/
|
|
|
|
|
2005-05-13 17:45:50 +00:00
|
|
|
static HRESULT WINAPI
|
|
|
|
StdGlobalInterfaceTable_QueryInterface(IGlobalInterfaceTable* iface,
|
|
|
|
REFIID riid, void** ppvObject)
|
|
|
|
{
|
2003-03-11 01:45:38 +00:00
|
|
|
/* Make sure silly coders can't crash us */
|
|
|
|
if (ppvObject == 0) return E_INVALIDARG;
|
|
|
|
|
|
|
|
*ppvObject = 0; /* assume we don't have the interface */
|
|
|
|
|
|
|
|
/* Do we implement that interface? */
|
2005-05-13 17:45:50 +00:00
|
|
|
if (IsEqualIID(&IID_IUnknown, riid) ||
|
|
|
|
IsEqualIID(&IID_IGlobalInterfaceTable, riid))
|
|
|
|
*ppvObject = iface;
|
|
|
|
else
|
|
|
|
return E_NOINTERFACE;
|
2003-03-11 01:45:38 +00:00
|
|
|
|
|
|
|
/* Now inc the refcount */
|
2005-05-13 17:45:50 +00:00
|
|
|
IGlobalInterfaceTable_AddRef(iface);
|
2003-03-11 01:45:38 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2005-05-13 17:45:50 +00:00
|
|
|
static ULONG WINAPI
|
|
|
|
StdGlobalInterfaceTable_AddRef(IGlobalInterfaceTable* iface)
|
|
|
|
{
|
2003-03-11 01:45:38 +00:00
|
|
|
StdGlobalInterfaceTableImpl* const self = (StdGlobalInterfaceTableImpl*) iface;
|
|
|
|
|
2003-08-23 00:45:49 +00:00
|
|
|
/* InterlockedIncrement(&self->ref); */
|
2003-03-11 01:45:38 +00:00
|
|
|
return self->ref;
|
|
|
|
}
|
|
|
|
|
2005-05-13 17:45:50 +00:00
|
|
|
static ULONG WINAPI
|
|
|
|
StdGlobalInterfaceTable_Release(IGlobalInterfaceTable* iface)
|
|
|
|
{
|
2003-03-11 01:45:38 +00:00
|
|
|
StdGlobalInterfaceTableImpl* const self = (StdGlobalInterfaceTableImpl*) iface;
|
|
|
|
|
2003-08-23 00:45:49 +00:00
|
|
|
/* InterlockedDecrement(&self->ref); */
|
2003-03-11 01:45:38 +00:00
|
|
|
if (self->ref == 0) {
|
|
|
|
/* Hey ho, it's time to go, so long again 'till next weeks show! */
|
|
|
|
StdGlobalInterfaceTable_Destroy(self);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return self->ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***
|
|
|
|
* Now implement the actual IGlobalInterfaceTable interface
|
|
|
|
*/
|
|
|
|
|
2005-05-13 17:45:50 +00:00
|
|
|
static HRESULT WINAPI
|
|
|
|
StdGlobalInterfaceTable_RegisterInterfaceInGlobal(
|
|
|
|
IGlobalInterfaceTable* iface, IUnknown* pUnk,
|
|
|
|
REFIID riid, DWORD* pdwCookie)
|
|
|
|
{
|
2003-03-11 01:45:38 +00:00
|
|
|
StdGlobalInterfaceTableImpl* const self = (StdGlobalInterfaceTableImpl*) iface;
|
|
|
|
IStream* stream = NULL;
|
|
|
|
HRESULT hres;
|
|
|
|
StdGITEntry* entry;
|
2005-05-13 17:45:50 +00:00
|
|
|
LARGE_INTEGER zero;
|
2003-03-11 01:45:38 +00:00
|
|
|
|
2003-06-17 03:57:18 +00:00
|
|
|
TRACE("iface=%p, pUnk=%p, riid=%s, pdwCookie=0x%p\n", iface, pUnk, debugstr_guid(riid), pdwCookie);
|
2003-03-11 01:45:38 +00:00
|
|
|
|
|
|
|
if (pUnk == NULL) return E_INVALIDARG;
|
|
|
|
|
|
|
|
/* marshal the interface */
|
2003-07-22 01:01:25 +00:00
|
|
|
TRACE("About to marshal the interface\n");
|
2005-02-15 15:47:44 +00:00
|
|
|
|
|
|
|
hres = CreateStreamOnHGlobal(0, TRUE, &stream);
|
2003-03-11 01:45:38 +00:00
|
|
|
if (hres) return hres;
|
2005-02-15 15:47:44 +00:00
|
|
|
hres = CoMarshalInterface(stream, riid, pUnk, MSHCTX_INPROC, NULL, MSHLFLAGS_TABLESTRONG);
|
|
|
|
if (hres)
|
|
|
|
{
|
|
|
|
IStream_Release(stream);
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
2005-05-13 17:45:50 +00:00
|
|
|
zero.QuadPart = 0;
|
2005-02-15 15:47:44 +00:00
|
|
|
IStream_Seek(stream, zero, SEEK_SET, NULL);
|
|
|
|
|
2003-03-11 01:45:38 +00:00
|
|
|
entry = HeapAlloc(GetProcessHeap(), 0, sizeof(StdGITEntry));
|
|
|
|
if (entry == NULL) return E_OUTOFMEMORY;
|
2003-08-23 00:45:49 +00:00
|
|
|
|
|
|
|
EnterCriticalSection(&git_section);
|
2003-03-11 01:45:38 +00:00
|
|
|
|
|
|
|
entry->iid = *riid;
|
|
|
|
entry->stream = stream;
|
|
|
|
entry->cookie = self->nextCookie;
|
|
|
|
self->nextCookie++; /* inc the cookie count */
|
|
|
|
|
|
|
|
/* insert the new entry at the end of the list */
|
|
|
|
entry->next = NULL;
|
|
|
|
entry->prev = self->lastEntry;
|
|
|
|
if (entry->prev) entry->prev->next = entry;
|
|
|
|
else self->firstEntry = entry;
|
|
|
|
self->lastEntry = entry;
|
|
|
|
|
|
|
|
/* and return the cookie */
|
|
|
|
*pdwCookie = entry->cookie;
|
2003-08-23 00:45:49 +00:00
|
|
|
|
|
|
|
LeaveCriticalSection(&git_section);
|
|
|
|
|
2006-10-15 10:28:08 +00:00
|
|
|
TRACE("Cookie is 0x%x\n", entry->cookie);
|
2003-03-11 01:45:38 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2005-05-13 17:45:50 +00:00
|
|
|
static HRESULT WINAPI
|
|
|
|
StdGlobalInterfaceTable_RevokeInterfaceFromGlobal(
|
|
|
|
IGlobalInterfaceTable* iface, DWORD dwCookie)
|
|
|
|
{
|
2003-03-11 01:45:38 +00:00
|
|
|
StdGlobalInterfaceTableImpl* const self = (StdGlobalInterfaceTableImpl*) iface;
|
|
|
|
StdGITEntry* entry;
|
2005-02-15 15:47:44 +00:00
|
|
|
HRESULT hr;
|
2003-03-11 01:45:38 +00:00
|
|
|
|
|
|
|
TRACE("iface=%p, dwCookie=0x%x\n", iface, (UINT)dwCookie);
|
|
|
|
|
|
|
|
entry = StdGlobalInterfaceTable_FindEntry(iface, dwCookie);
|
|
|
|
if (entry == NULL) {
|
|
|
|
TRACE("Entry not found\n");
|
|
|
|
return E_INVALIDARG; /* not found */
|
|
|
|
}
|
2003-08-23 00:45:49 +00:00
|
|
|
|
|
|
|
/* Free the stream */
|
2005-02-15 15:47:44 +00:00
|
|
|
hr = CoReleaseMarshalData(entry->stream);
|
|
|
|
if (hr != S_OK)
|
|
|
|
{
|
2006-10-15 10:28:08 +00:00
|
|
|
WARN("Failed to release marshal data, hr = 0x%08x\n", hr);
|
2005-02-15 15:47:44 +00:00
|
|
|
return hr;
|
|
|
|
}
|
2003-08-23 00:45:49 +00:00
|
|
|
IStream_Release(entry->stream);
|
|
|
|
|
2003-03-11 01:45:38 +00:00
|
|
|
/* chop entry out of the list, and free the memory */
|
2003-08-23 00:45:49 +00:00
|
|
|
EnterCriticalSection(&git_section);
|
2003-03-11 01:45:38 +00:00
|
|
|
if (entry->prev) entry->prev->next = entry->next;
|
|
|
|
else self->firstEntry = entry->next;
|
|
|
|
if (entry->next) entry->next->prev = entry->prev;
|
|
|
|
else self->lastEntry = entry->prev;
|
2003-08-23 00:45:49 +00:00
|
|
|
LeaveCriticalSection(&git_section);
|
|
|
|
|
2003-03-11 01:45:38 +00:00
|
|
|
HeapFree(GetProcessHeap(), 0, entry);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2005-05-13 17:45:50 +00:00
|
|
|
static HRESULT WINAPI
|
|
|
|
StdGlobalInterfaceTable_GetInterfaceFromGlobal(
|
|
|
|
IGlobalInterfaceTable* iface, DWORD dwCookie,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
2003-03-11 01:45:38 +00:00
|
|
|
StdGITEntry* entry;
|
|
|
|
HRESULT hres;
|
2003-08-23 00:45:49 +00:00
|
|
|
LARGE_INTEGER move;
|
|
|
|
LPUNKNOWN lpUnk;
|
|
|
|
|
2006-10-15 10:28:08 +00:00
|
|
|
TRACE("dwCookie=0x%x, riid=%s, ppv=%p\n", dwCookie, debugstr_guid(riid), ppv);
|
2003-03-11 01:45:38 +00:00
|
|
|
|
|
|
|
entry = StdGlobalInterfaceTable_FindEntry(iface, dwCookie);
|
|
|
|
if (entry == NULL) return E_INVALIDARG;
|
2003-08-23 00:45:49 +00:00
|
|
|
|
2003-07-22 01:01:25 +00:00
|
|
|
if (!IsEqualIID(&entry->iid, riid)) {
|
|
|
|
WARN("entry->iid (%s) != riid\n", debugstr_guid(&entry->iid));
|
|
|
|
return E_INVALIDARG;
|
|
|
|
}
|
|
|
|
TRACE("entry=%p\n", entry);
|
|
|
|
|
2003-03-11 01:45:38 +00:00
|
|
|
/* unmarshal the interface */
|
2003-08-23 00:45:49 +00:00
|
|
|
hres = CoUnmarshalInterface(entry->stream, riid, ppv);
|
2003-03-11 01:45:38 +00:00
|
|
|
|
2003-08-23 00:45:49 +00:00
|
|
|
/* rewind stream, in case it's used again */
|
2004-01-23 01:51:33 +00:00
|
|
|
move.u.LowPart = 0;
|
|
|
|
move.u.HighPart = 0;
|
2003-08-23 00:45:49 +00:00
|
|
|
IStream_Seek(entry->stream, move, STREAM_SEEK_SET, NULL);
|
|
|
|
|
2006-06-14 12:20:14 +00:00
|
|
|
if (hres) {
|
|
|
|
WARN("Failed to unmarshal stream\n");
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
2003-08-23 00:45:49 +00:00
|
|
|
/* addref it */
|
|
|
|
lpUnk = *ppv;
|
|
|
|
IUnknown_AddRef(lpUnk);
|
|
|
|
TRACE("ppv=%p\n", *ppv);
|
2003-03-11 01:45:38 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
2003-06-17 03:57:18 +00:00
|
|
|
|
|
|
|
/* Classfactory definition - despite what MSDN says, some programs need this */
|
|
|
|
|
2005-05-13 17:45:50 +00:00
|
|
|
static HRESULT WINAPI
|
|
|
|
GITCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid, LPVOID *ppv)
|
|
|
|
{
|
2003-06-17 03:57:18 +00:00
|
|
|
*ppv = NULL;
|
2005-05-13 17:45:50 +00:00
|
|
|
if (IsEqualIID(riid,&IID_IUnknown) ||
|
|
|
|
IsEqualIID(riid,&IID_IGlobalInterfaceTable))
|
|
|
|
{
|
2003-06-17 03:57:18 +00:00
|
|
|
*ppv = (LPVOID)iface;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
2005-05-13 17:45:50 +00:00
|
|
|
static ULONG WINAPI GITCF_AddRef(LPCLASSFACTORY iface)
|
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI GITCF_Release(LPCLASSFACTORY iface)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
GITCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pUnk,
|
|
|
|
REFIID riid, LPVOID *ppv)
|
|
|
|
{
|
2003-06-17 03:57:18 +00:00
|
|
|
if (IsEqualIID(riid,&IID_IGlobalInterfaceTable)) {
|
|
|
|
if (StdGlobalInterfaceTableInstance == NULL)
|
|
|
|
StdGlobalInterfaceTableInstance = StdGlobalInterfaceTable_Construct();
|
|
|
|
return IGlobalInterfaceTable_QueryInterface( (IGlobalInterfaceTable*) StdGlobalInterfaceTableInstance, riid, ppv);
|
|
|
|
}
|
|
|
|
|
|
|
|
FIXME("(%s), not supported.\n",debugstr_guid(riid));
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
2005-05-13 17:45:50 +00:00
|
|
|
static HRESULT WINAPI GITCF_LockServer(LPCLASSFACTORY iface, BOOL fLock)
|
|
|
|
{
|
2003-06-17 03:57:18 +00:00
|
|
|
FIXME("(%d), stub!\n",fLock);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2005-06-06 19:50:35 +00:00
|
|
|
static const IClassFactoryVtbl GITClassFactoryVtbl = {
|
2003-06-17 03:57:18 +00:00
|
|
|
GITCF_QueryInterface,
|
|
|
|
GITCF_AddRef,
|
|
|
|
GITCF_Release,
|
|
|
|
GITCF_CreateInstance,
|
|
|
|
GITCF_LockServer
|
|
|
|
};
|
2005-05-13 17:45:50 +00:00
|
|
|
|
2005-06-06 19:50:35 +00:00
|
|
|
static const IClassFactoryVtbl *PGITClassFactoryVtbl = &GITClassFactoryVtbl;
|
2003-06-17 03:57:18 +00:00
|
|
|
|
2005-05-13 17:45:50 +00:00
|
|
|
HRESULT StdGlobalInterfaceTable_GetFactory(LPVOID *ppv)
|
|
|
|
{
|
2003-06-17 03:57:18 +00:00
|
|
|
*ppv = &PGITClassFactoryVtbl;
|
|
|
|
TRACE("Returning GIT classfactory\n");
|
|
|
|
return S_OK;
|
|
|
|
}
|
2005-05-13 17:45:50 +00:00
|
|
|
|
|
|
|
/* Virtual function table */
|
2005-06-06 19:50:35 +00:00
|
|
|
static const IGlobalInterfaceTableVtbl StdGlobalInterfaceTableImpl_Vtbl =
|
2005-05-13 17:45:50 +00:00
|
|
|
{
|
|
|
|
StdGlobalInterfaceTable_QueryInterface,
|
|
|
|
StdGlobalInterfaceTable_AddRef,
|
|
|
|
StdGlobalInterfaceTable_Release,
|
|
|
|
StdGlobalInterfaceTable_RegisterInterfaceInGlobal,
|
|
|
|
StdGlobalInterfaceTable_RevokeInterfaceFromGlobal,
|
|
|
|
StdGlobalInterfaceTable_GetInterfaceFromGlobal
|
|
|
|
};
|
|
|
|
|
|
|
|
/** This function constructs the GIT. It should only be called once **/
|
2006-08-28 13:18:15 +00:00
|
|
|
void* StdGlobalInterfaceTable_Construct(void)
|
2005-05-13 17:45:50 +00:00
|
|
|
{
|
|
|
|
StdGlobalInterfaceTableImpl* newGIT;
|
|
|
|
|
|
|
|
newGIT = HeapAlloc(GetProcessHeap(), 0, sizeof(StdGlobalInterfaceTableImpl));
|
|
|
|
if (newGIT == 0) return newGIT;
|
|
|
|
|
|
|
|
newGIT->lpVtbl = &StdGlobalInterfaceTableImpl_Vtbl;
|
|
|
|
newGIT->ref = 1; /* Initialise the reference count */
|
|
|
|
newGIT->firstEntry = NULL; /* we start with an empty table */
|
|
|
|
newGIT->lastEntry = NULL;
|
|
|
|
newGIT->nextCookie = 0xf100; /* that's where windows starts, so that's where we start */
|
|
|
|
TRACE("Created the GIT at %p\n", newGIT);
|
|
|
|
|
|
|
|
return (void*)newGIT;
|
|
|
|
}
|