mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 19:05:52 +00:00
Sync to Wine-20041201
Robert Shearman <rob@codeweavers.com> - Add some function declarations to objbase.h. - Add stubs for server ref counting. - Implement HRESULT marshaling. - Implement OleDuplicateData. Eric Pouech <pouech-eric@wanadoo.fr> - Const correctness fixes. Mike Hearn <mh@codeweavers.com> - Improve OLE function documentation. - Bail out with CO_E_NOTINITIALIZED when apt is null. Dmitry Timoshkov <dmitry@codeweavers.com> - Remove bogus use of nStatCounter and hOleAut32 in CoSetState. - Remove a comment about protecting per thread data by a critical section. Francois Gouget <fgouget@free.fr> - Assorted spelling fixes. Mike Hearn <mh@codeweavers.com> - Trace the OLE error info strings. svn path=/trunk/; revision=11962
This commit is contained in:
parent
8679951253
commit
87ac9421e8
9 changed files with 312 additions and 149 deletions
|
@ -160,7 +160,8 @@ void COMPOBJ_InitProcess( void )
|
|||
* following class is created. The *caller* of CoMarshalInterface (ie the
|
||||
* application) is responsible for pumping the message loop in that thread.
|
||||
* The WM_USER messages which point to the RPCs are then dispatched to
|
||||
* COM_AptWndProc by the user's code.
|
||||
* COM_AptWndProc by the user's code from the apartment in which the interface
|
||||
* was unmarshalled.
|
||||
*/
|
||||
memset(&wclass, 0, sizeof(wclass));
|
||||
wclass.lpfnWndProc = &COM_AptWndProc;
|
||||
|
@ -192,6 +193,8 @@ static void COM_InitMTA(void)
|
|||
This method of generating an OXID is therefore wrong as it doesn't work across
|
||||
a network, but for local RPC only it's OK. We can distinguish between MTAs and
|
||||
STAs because STAs use the thread ID as well, and no thread can have an ID of zero.
|
||||
|
||||
The algorithm Microsoft use is currently unknown.
|
||||
*/
|
||||
MTA.oxid = ((OXID)GetCurrentProcessId() << 32);
|
||||
InitializeCriticalSection(&MTA.cs);
|
||||
|
@ -266,7 +269,7 @@ static void COM_DestroyApartment(APARTMENT *apt)
|
|||
}
|
||||
|
||||
/* The given OXID must be local to this process: you cannot use apartment
|
||||
windows to send RPCs to other processes */
|
||||
windows to send RPCs to other processes. This all needs to move to rpcrt4 */
|
||||
HWND COM_GetApartmentWin(OXID oxid)
|
||||
{
|
||||
APARTMENT *apt;
|
||||
|
@ -377,9 +380,11 @@ DWORD WINAPI CoBuildVersion(void)
|
|||
/******************************************************************************
|
||||
* CoInitialize [OLE32.@]
|
||||
*
|
||||
* Initializes the COM libraries.
|
||||
* Initializes the COM libraries by calling CoInitializeEx with
|
||||
* COINIT_APARTMENTTHREADED, ie it enters a STA thread.
|
||||
*
|
||||
* See CoInitializeEx
|
||||
* SEE ALSO
|
||||
* CoInitializeEx
|
||||
*/
|
||||
HRESULT WINAPI CoInitialize(
|
||||
LPVOID lpReserved /* [in] pointer to win32 malloc interface
|
||||
|
@ -395,14 +400,22 @@ HRESULT WINAPI CoInitialize(
|
|||
/******************************************************************************
|
||||
* CoInitializeEx [OLE32.@]
|
||||
*
|
||||
* Initializes the COM libraries. The behavior used to set the win32 IMalloc
|
||||
* used for memory management is obsolete.
|
||||
* Initializes the COM libraries. The behavior used to set the win32
|
||||
* IMalloc used for memory management is obsolete. If
|
||||
* COINIT_APARTMENTTHREADED is specified this thread enters a new STA
|
||||
* (single threaded apartment), otherwise COINIT_MULTITHREADED should
|
||||
* be specified which indicates that the thread will enter the MTA.
|
||||
*
|
||||
* Currently STA threading is only partly implemented.
|
||||
*
|
||||
* RETURNS
|
||||
* S_OK if successful,
|
||||
* S_FALSE if this function was called already.
|
||||
* RPC_E_CHANGED_MODE if a previous call to CoInitializeEx specified another
|
||||
* threading model.
|
||||
*
|
||||
* SEE ALSO
|
||||
* CoUninitialize
|
||||
*/
|
||||
HRESULT WINAPI CoInitializeEx(
|
||||
LPVOID lpReserved, /* [in] pointer to win32 malloc interface
|
||||
|
@ -427,7 +440,7 @@ HRESULT WINAPI CoInitializeEx(
|
|||
{
|
||||
/* Changing the threading model after it's been set is illegal. If this warning is triggered by Wine
|
||||
code then we are probably using the wrong threading model to implement that API. */
|
||||
WARN("Attempt to change threading model of this apartment from 0x%lx to 0x%lx\n", apt->model, dwCoInit);
|
||||
ERR("Attempt to change threading model of this apartment from 0x%lx to 0x%lx\n", apt->model, dwCoInit);
|
||||
return RPC_E_CHANGED_MODE;
|
||||
}
|
||||
hr = S_FALSE;
|
||||
|
@ -483,9 +496,18 @@ void COM_FlushMessageQueue(void)
|
|||
/***********************************************************************
|
||||
* CoUninitialize [OLE32.@]
|
||||
*
|
||||
* This method will release the COM libraries.
|
||||
* This method will decrement the refcount on the COM libraries,
|
||||
* potentially unloading them. The current thread leaves the apartment
|
||||
* it's currently in. If not in an apartment, the routine does
|
||||
* nothing.
|
||||
*
|
||||
* See the windows documentation for more details.
|
||||
* If COM is to be shut down, any outstanding proxies are
|
||||
* disconnected, all registered class objects are unregistered and the
|
||||
* message queue for the thread is flushed (if native does
|
||||
* this or not is unknown).
|
||||
*
|
||||
* SEE ALSO
|
||||
* CoInitializeEx
|
||||
*/
|
||||
void WINAPI CoUninitialize(void)
|
||||
{
|
||||
|
@ -516,7 +538,7 @@ void WINAPI CoUninitialize(void)
|
|||
|
||||
/* disconnect proxies to release the corresponding stubs.
|
||||
* It is confirmed in "Essential COM" in the sub-chapter on
|
||||
* "Lifecycle Management and Marshaling" that the native version also
|
||||
* "Lifecycle Management and Marshalling" that the native version also
|
||||
* does some kind of proxy cleanup in this function.
|
||||
* FIXME: does it just disconnect or completely destroy the proxies?
|
||||
* FIXME: should this be in the apartment destructor? */
|
||||
|
@ -562,6 +584,11 @@ HRESULT WINAPI CoDisconnectObject( LPUNKNOWN lpUnk, DWORD reserved )
|
|||
/******************************************************************************
|
||||
* CoCreateGuid[OLE32.@]
|
||||
*
|
||||
* Simply forwards to UuidCreate in RPCRT4.
|
||||
*
|
||||
* SEE ALSO
|
||||
* UuidCreate
|
||||
*
|
||||
*/
|
||||
HRESULT WINAPI CoCreateGuid(
|
||||
GUID *pguid /* [out] points to the GUID to initialize */
|
||||
|
@ -572,20 +599,23 @@ HRESULT WINAPI CoCreateGuid(
|
|||
/******************************************************************************
|
||||
* CLSIDFromString [OLE32.@]
|
||||
* IIDFromString [OLE32.@]
|
||||
*
|
||||
* Converts a unique identifier from its string representation into
|
||||
* the GUID struct.
|
||||
*
|
||||
* UNDOCUMENTED
|
||||
* If idstr is not a valid CLSID string then it gets treated as a ProgID
|
||||
* In Windows, if idstr is not a valid CLSID string then it gets
|
||||
* treated as a ProgID. Wine currently doesn't do this. If idstr is
|
||||
* NULL it's treated as an all-zero GUID.
|
||||
*
|
||||
* RETURNS
|
||||
* the converted GUID
|
||||
* S_OK on success
|
||||
* CO_E_CLASSSTRING if idstr is not a valid CLSID
|
||||
*/
|
||||
HRESULT WINAPI __CLSIDFromStringA(
|
||||
LPCSTR idstr, /* [in] string representation of guid */
|
||||
CLSID *id) /* [out] GUID converted from string */
|
||||
{
|
||||
const BYTE *s = (BYTE *) idstr;
|
||||
const BYTE *s = (const BYTE *) idstr;
|
||||
int i;
|
||||
BYTE table[256];
|
||||
|
||||
|
@ -661,15 +691,7 @@ HRESULT WINAPI CLSIDFromString(
|
|||
return ret;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* WINE_StringFromCLSID [Internal]
|
||||
* Converts a GUID into the respective string representation.
|
||||
*
|
||||
* NOTES
|
||||
*
|
||||
* RETURNS
|
||||
* the string representation and HRESULT
|
||||
*/
|
||||
/* Converts a GUID into the respective string representation. */
|
||||
HRESULT WINE_StringFromCLSID(
|
||||
const CLSID *id, /* [in] GUID to be converted */
|
||||
LPSTR idstr /* [out] pointer to buffer to contain converted guid */
|
||||
|
@ -707,20 +729,23 @@ HRESULT WINE_StringFromCLSID(
|
|||
/******************************************************************************
|
||||
* StringFromCLSID [OLE32.@]
|
||||
* StringFromIID [OLE32.@]
|
||||
*
|
||||
* Converts a GUID into the respective string representation.
|
||||
* The target string is allocated using the OLE IMalloc.
|
||||
*
|
||||
* RETURNS
|
||||
* the string representation and HRESULT
|
||||
* S_OK
|
||||
* E_FAIL
|
||||
*/
|
||||
HRESULT WINAPI StringFromCLSID(
|
||||
REFCLSID id, /* [in] the GUID to be converted */
|
||||
REFCLSID id, /* [in] the GUID to be converted */
|
||||
LPOLESTR *idstr /* [out] a pointer to a to-be-allocated pointer pointing to the resulting string */
|
||||
) {
|
||||
char buf[80];
|
||||
HRESULT ret;
|
||||
LPMALLOC mllc;
|
||||
|
||||
if ((ret=CoGetMalloc(0,&mllc)))
|
||||
if ((ret = CoGetMalloc(0,&mllc)))
|
||||
return ret;
|
||||
|
||||
ret=WINE_StringFromCLSID(id,buf);
|
||||
|
@ -736,15 +761,16 @@ HRESULT WINAPI StringFromCLSID(
|
|||
* StringFromGUID2 [COMPOBJ.76]
|
||||
* StringFromGUID2 [OLE32.@]
|
||||
*
|
||||
* Converts a global unique identifier into a string of an API-
|
||||
* specified fixed format. (The usual {.....} stuff.)
|
||||
* Modified version of StringFromCLSID that allows you to specify max
|
||||
* buffer size.
|
||||
*
|
||||
* RETURNS
|
||||
* The (UNICODE) string representation of the GUID in 'str'
|
||||
* The length of the resulting string, 0 if there was any problem.
|
||||
*/
|
||||
INT WINAPI
|
||||
StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
|
||||
INT WINAPI StringFromGUID2(
|
||||
REFGUID id, /* [in] GUID to convert to string */
|
||||
LPOLESTR str, /* [out] Unicode buffer to hold result */
|
||||
INT cmax)
|
||||
{
|
||||
char xguid[80];
|
||||
|
||||
|
@ -754,12 +780,16 @@ StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
|
|||
}
|
||||
|
||||
/******************************************************************************
|
||||
* ProgIDFromCLSID [OLE32.@]
|
||||
* Converts a class id into the respective Program ID. (By using a registry lookup)
|
||||
* RETURNS S_OK on success
|
||||
* riid associated with the progid
|
||||
* ProgIDFromCLSID [OLE32.@]
|
||||
*
|
||||
* Converts a class id into the respective Program ID. (By using a
|
||||
* registry lookup)
|
||||
*
|
||||
* RETURNS
|
||||
* S_OK
|
||||
* E_OUTOFMEMORY
|
||||
* REGDB_E_CLASSNOTREG if the given clsid has no associated ProgID
|
||||
*/
|
||||
|
||||
HRESULT WINAPI ProgIDFromCLSID(
|
||||
REFCLSID clsid, /* [in] class id as found in registry */
|
||||
LPOLESTR *lplpszProgID/* [out] associated Prog ID */
|
||||
|
@ -805,12 +835,6 @@ HRESULT WINAPI ProgIDFromCLSID(
|
|||
return ret;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* CLSIDFromProgID [COMPOBJ.61]
|
||||
* Converts a program id into the respective GUID. (By using a registry lookup)
|
||||
* RETURNS
|
||||
* riid associated with the progid
|
||||
*/
|
||||
HRESULT WINAPI CLSIDFromProgID16(
|
||||
LPCOLESTR16 progid, /* [in] program id as found in registry */
|
||||
LPCLSID riid /* [out] associated CLSID */
|
||||
|
@ -837,13 +861,17 @@ HRESULT WINAPI CLSIDFromProgID16(
|
|||
}
|
||||
|
||||
/******************************************************************************
|
||||
* CLSIDFromProgID [OLE32.@]
|
||||
* Converts a program id into the respective GUID. (By using a registry lookup)
|
||||
* CLSIDFromProgID [COMPOBJ.61]
|
||||
*
|
||||
* Converts a program id into the respective GUID. (By using a
|
||||
* registry lookup)
|
||||
*
|
||||
* RETURNS
|
||||
* riid associated with the progid
|
||||
* S_OK
|
||||
* CO_E_CLASSSTRING if the given ProgID cannot be found
|
||||
*/
|
||||
HRESULT WINAPI CLSIDFromProgID(
|
||||
LPCOLESTR progid, /* [in] program id as found in registry */
|
||||
LPCOLESTR progid, /* [in] Unicode program id as found in registry */
|
||||
LPCLSID riid ) /* [out] associated CLSID */
|
||||
{
|
||||
static const WCHAR clsidW[] = { '\\','C','L','S','I','D',0 };
|
||||
|
@ -875,22 +903,30 @@ HRESULT WINAPI CLSIDFromProgID(
|
|||
/*****************************************************************************
|
||||
* CoGetPSClsid [OLE32.@]
|
||||
*
|
||||
* This function returns the CLSID of the proxy/stub factory that implements IPSFactoryBuffer
|
||||
* for the specified interface.
|
||||
* This function returns the CLSID of the proxy/stub factory that
|
||||
* implements IPSFactoryBuffer for the specified interface.
|
||||
*
|
||||
* The standard marshaller activates the object with the CLSID returned and uses the
|
||||
* CreateProxy and CreateStub methods on its IPSFactoryBuffer interface to construct
|
||||
* the proxies and stubs for a given object.
|
||||
* The standard marshaller activates the object with the CLSID
|
||||
* returned and uses the CreateProxy and CreateStub methods on its
|
||||
* IPSFactoryBuffer interface to construct the proxies and stubs for a
|
||||
* given object.
|
||||
*
|
||||
* CoGetPSClsid determines this CLSID by searching the
|
||||
* HKEY_CLASSES_ROOT\Interface\{string form of riid}\ProxyStubClsid32 in the registry
|
||||
* and any interface id registered by CoRegisterPSClsid within the current process.
|
||||
* HKEY_CLASSES_ROOT\Interface\{string form of riid}\ProxyStubClsid32
|
||||
* in the registry and any interface id registered by
|
||||
* CoRegisterPSClsid within the current process.
|
||||
*
|
||||
* FIXME: We only search the registry, not ids registered with CoRegisterPSClsid.
|
||||
* FIXME: We only search the registry, not ids registered with
|
||||
* CoRegisterPSClsid.
|
||||
*
|
||||
* RETURNS
|
||||
* S_OK
|
||||
* E_OUTOFMEMORY
|
||||
* E_INVALIDARG if no PSFactoryBuffer is associated with the IID, or it could not be parsed
|
||||
*/
|
||||
HRESULT WINAPI CoGetPSClsid(
|
||||
REFIID riid, /* [in] Interface whose proxy/stub CLSID is to be returned */
|
||||
CLSID *pclsid ) /* [out] Where to store returned proxy/stub CLSID */
|
||||
CLSID *pclsid ) /* [out] Where to store returned proxy/stub CLSID */
|
||||
{
|
||||
char *buf, buf2[40];
|
||||
DWORD buf2len;
|
||||
|
@ -1139,29 +1175,40 @@ _LocalServerThread(LPVOID param) {
|
|||
|
||||
/******************************************************************************
|
||||
* CoRegisterClassObject [OLE32.@]
|
||||
*
|
||||
* This method will register the class object for a given class
|
||||
* ID. Servers housed in EXE files use this method instead of
|
||||
* exporting DllGetClassObject to allow other code to connect to their
|
||||
* objects.
|
||||
*
|
||||
* This method will register the class object for a given class ID. Servers housed
|
||||
* in EXE files use this method instead of exporting DllGetClassObject to allow other
|
||||
* code to connect to their objects.
|
||||
* When a class object (an object which implements IClassFactory) is
|
||||
* registered in this way, a new thread is started which listens for
|
||||
* connections on a named pipe specific to the registered CLSID. When
|
||||
* something else connects to it, it writes out the marshalled
|
||||
* IClassFactory interface to the pipe. The code on the other end uses
|
||||
* this buffer to unmarshal the class factory, and can then call
|
||||
* methods on it.
|
||||
*
|
||||
* When a class object (an object which implements IClassFactory) is registered in
|
||||
* this way, a new thread is started which listens for connections on a named pipe
|
||||
* specific to the registered CLSID. When something else connects to it, it writes
|
||||
* out the marshalled IClassFactory interface to the pipe. The code on the other end
|
||||
* uses this buffer to unmarshal the class factory, and can then call methods on it.
|
||||
* In Windows, such objects are registered with the RPC endpoint
|
||||
* mapper, not with a unique named pipe.
|
||||
*
|
||||
* In Windows, such objects are registered with the RPC endpoint mapper, not with
|
||||
* a unique named pipe.
|
||||
* MSDN claims that multiple interface registrations are legal, but we
|
||||
* can't do that with our current implementation.
|
||||
*
|
||||
* See the Windows documentation for more details.
|
||||
* RETURNS
|
||||
* S_OK on success,
|
||||
* E_INVALIDARG if lpdwRegister or pUnk are NULL,
|
||||
* CO_E_OBJISREG if the object is already registered. We should not return this.
|
||||
*
|
||||
* SEE ALSO
|
||||
* CoRevokeClassObject, CoGetClassObject
|
||||
*/
|
||||
HRESULT WINAPI CoRegisterClassObject(
|
||||
REFCLSID rclsid,
|
||||
LPUNKNOWN pUnk,
|
||||
DWORD dwClsContext, /* [in] CLSCTX flags indicating the context in which to run the executable */
|
||||
DWORD flags, /* [in] REGCLS flags indicating how connections are made */
|
||||
LPDWORD lpdwRegister
|
||||
)
|
||||
REFCLSID rclsid, /* [in] CLSID of the object to register */
|
||||
LPUNKNOWN pUnk, /* [in] IUnknown of the object */
|
||||
DWORD dwClsContext, /* [in] CLSCTX flags indicating the context in which to run the executable */
|
||||
DWORD flags, /* [in] REGCLS flags indicating how connections are made */
|
||||
LPDWORD lpdwRegister) /* [out] A unique cookie that can be passed to CoRevokeClassObject */
|
||||
{
|
||||
RegisteredClass* newClass;
|
||||
LPUNKNOWN foundObject;
|
||||
|
@ -1178,9 +1225,6 @@ HRESULT WINAPI CoRegisterClassObject(
|
|||
/*
|
||||
* First, check if the class is already registered.
|
||||
* If it is, this should cause an error.
|
||||
*
|
||||
* MSDN claims that multiple interface registrations are legal, but we can't do that with
|
||||
* our current implementation.
|
||||
*/
|
||||
hr = COM_GetRegisteredClassObject(rclsid, dwClsContext, &foundObject);
|
||||
if (hr == S_OK) {
|
||||
|
@ -1525,9 +1569,11 @@ HRESULT WINAPI CoCreateInstance(
|
|||
REFIID iid,
|
||||
LPVOID *ppv)
|
||||
{
|
||||
HRESULT hres;
|
||||
LPCLASSFACTORY lpclf = 0;
|
||||
HRESULT hres;
|
||||
LPCLASSFACTORY lpclf = 0;
|
||||
|
||||
if (!COM_CurrentApt()) return CO_E_NOTINITIALIZED;
|
||||
|
||||
/*
|
||||
* Sanity check
|
||||
*/
|
||||
|
@ -1962,9 +2008,6 @@ HRESULT WINAPI CoInitializeWOW(DWORD x,DWORD y) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int nStatCounter = 0; /* global */
|
||||
static HMODULE hOleAut32 = 0; /* global */
|
||||
|
||||
/***********************************************************************
|
||||
* CoGetState [OLE32.@]
|
||||
*
|
||||
|
@ -1990,7 +2033,6 @@ HRESULT WINAPI CoGetState(IUnknown ** ppv)
|
|||
/***********************************************************************
|
||||
* CoSetState [OLE32.@]
|
||||
*
|
||||
* NOTES: FIXME: protect this with a crst
|
||||
*/
|
||||
HRESULT WINAPI CoSetState(IUnknown * pv)
|
||||
{
|
||||
|
@ -2002,15 +2044,11 @@ HRESULT WINAPI CoSetState(IUnknown * pv)
|
|||
|
||||
if (pv) {
|
||||
IUnknown_AddRef(pv);
|
||||
nStatCounter++;
|
||||
if (nStatCounter == 1) LoadLibraryA("OLEAUT32.DLL");
|
||||
}
|
||||
|
||||
if (apt->state) {
|
||||
TRACE("-- release %p now\n", apt->state);
|
||||
IUnknown_Release(apt->state);
|
||||
nStatCounter--;
|
||||
if (!nStatCounter) FreeLibrary(hOleAut32);
|
||||
}
|
||||
apt->state = pv;
|
||||
return S_OK;
|
||||
|
@ -2211,3 +2249,21 @@ HRESULT WINAPI CoSuspendClassObjects(void)
|
|||
FIXME("\n");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CoAddRefServerProcess [OLE32.@]
|
||||
*/
|
||||
ULONG WINAPI CoAddRefServerProcess(void)
|
||||
{
|
||||
FIXME("\n");
|
||||
return 2;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CoReleaseServerProcess [OLE32.@]
|
||||
*/
|
||||
ULONG WINAPI CoReleaseServerProcess(void)
|
||||
{
|
||||
FIXME("\n");
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -358,7 +358,7 @@ static HRESULT WINAPI ICreateErrorInfoImpl_SetSource(
|
|||
LPOLESTR szSource)
|
||||
{
|
||||
_ICOM_THIS_From_ICreateErrorInfo(ErrorInfoImpl, iface);
|
||||
TRACE("(%p)\n",This);
|
||||
TRACE("(%p): %s\n",This, debugstr_w(szSource));
|
||||
if (This->bstrSource != NULL)
|
||||
ERRORINFO_SysFreeString(This->bstrSource);
|
||||
This->bstrSource = ERRORINFO_SysAllocString(szSource);
|
||||
|
@ -371,7 +371,7 @@ static HRESULT WINAPI ICreateErrorInfoImpl_SetDescription(
|
|||
LPOLESTR szDescription)
|
||||
{
|
||||
_ICOM_THIS_From_ICreateErrorInfo(ErrorInfoImpl, iface);
|
||||
TRACE("(%p)\n",This);
|
||||
TRACE("(%p): %s\n",This, debugstr_w(szDescription));
|
||||
if (This->bstrDescription != NULL)
|
||||
ERRORINFO_SysFreeString(This->bstrDescription);
|
||||
This->bstrDescription = ERRORINFO_SysAllocString(szDescription);
|
||||
|
|
|
@ -763,3 +763,47 @@ MARSHAL_GetStandardMarshalCF(LPVOID *ppv) {
|
|||
*ppv = &pdfmarshalcfvtbl;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CoMarshalHresult [OLE32.@]
|
||||
*
|
||||
* Marshals an HRESULT value into a stream.
|
||||
*
|
||||
* PARAMS
|
||||
* pStm [I] Stream that hresult will be marshaled into.
|
||||
* hresult [I] HRESULT to be marshaled.
|
||||
*
|
||||
* RETURNS
|
||||
* Success: S_OK
|
||||
* Failure: A COM error code
|
||||
*
|
||||
* SEE
|
||||
* CoUnmarshalHresult().
|
||||
*/
|
||||
HRESULT WINAPI
|
||||
CoMarshalHresult(LPSTREAM pStm, HRESULT hresult)
|
||||
{
|
||||
return IStream_Write(pStm, &hresult, sizeof(hresult), NULL);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* CoUnmarshalHresult [OLE32.@]
|
||||
*
|
||||
* Unmarshals an HRESULT value from a stream.
|
||||
*
|
||||
* PARAMS
|
||||
* pStm [I] Stream that hresult will be unmarshaled from.
|
||||
* phresult [I] Pointer to HRESULT where the value will be unmarshaled to.
|
||||
*
|
||||
* RETURNS
|
||||
* Success: S_OK
|
||||
* Failure: A COM error code
|
||||
*
|
||||
* SEE
|
||||
* CoMarshalHresult().
|
||||
*/
|
||||
HRESULT WINAPI
|
||||
CoUnmarshalHresult(LPSTREAM pStm, HRESULT * phresult)
|
||||
{
|
||||
return IStream_Read(pStm, phresult, sizeof(*phresult), NULL);
|
||||
}
|
||||
|
|
|
@ -195,3 +195,110 @@ HRESULT WINAPI OleCreateFromData(LPDATAOBJECT pSrcDataObject, REFIID riid,
|
|||
|
||||
return DV_E_FORMATETC;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* OleDuplicateData [OLE32.@]
|
||||
*
|
||||
* Duplicates clipboard data.
|
||||
*
|
||||
* PARAMS
|
||||
* hSrc [I] Handle of the source clipboard data.
|
||||
* cfFormat [I] The clipboard format of hSrc.
|
||||
* uiFlags [I] Flags to pass to GlobalAlloc.
|
||||
*
|
||||
* RETURNS
|
||||
* Success: handle to the duplicated data.
|
||||
* Failure: NULL.
|
||||
*/
|
||||
HANDLE WINAPI OleDuplicateData(HANDLE hSrc, CLIPFORMAT cfFormat,
|
||||
UINT uiFlags)
|
||||
{
|
||||
HANDLE hDst = NULL;
|
||||
|
||||
TRACE("(%p,%x,%x)\n", hSrc, cfFormat, uiFlags);
|
||||
|
||||
if (!uiFlags) uiFlags = GMEM_MOVEABLE;
|
||||
|
||||
switch (cfFormat)
|
||||
{
|
||||
case CF_ENHMETAFILE:
|
||||
hDst = CopyEnhMetaFileW(hSrc, NULL);
|
||||
break;
|
||||
case CF_METAFILEPICT:
|
||||
hDst = CopyMetaFileW(hSrc, NULL);
|
||||
break;
|
||||
case CF_PALETTE:
|
||||
{
|
||||
LOGPALETTE * logpalette;
|
||||
UINT nEntries = GetPaletteEntries(hSrc, 0, 0, NULL);
|
||||
if (!nEntries) return NULL;
|
||||
logpalette = HeapAlloc(GetProcessHeap(), 0,
|
||||
FIELD_OFFSET(LOGPALETTE, palPalEntry[nEntries]));
|
||||
if (!logpalette) return NULL;
|
||||
if (!GetPaletteEntries(hSrc, 0, nEntries, logpalette->palPalEntry))
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, logpalette);
|
||||
return NULL;
|
||||
}
|
||||
logpalette->palVersion = 0x300;
|
||||
logpalette->palNumEntries = (WORD)nEntries;
|
||||
|
||||
hDst = CreatePalette(logpalette);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, logpalette);
|
||||
break;
|
||||
}
|
||||
case CF_BITMAP:
|
||||
{
|
||||
LONG size;
|
||||
BITMAP bm;
|
||||
if (!GetObjectW(hSrc, sizeof(bm), &bm))
|
||||
return NULL;
|
||||
size = GetBitmapBits(hSrc, 0, NULL);
|
||||
if (!size) return NULL;
|
||||
bm.bmBits = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
if (!bm.bmBits) return NULL;
|
||||
if (!GetBitmapBits(hSrc, size, bm.bmBits))
|
||||
return NULL;
|
||||
hDst = CreateBitmapIndirect(&bm);
|
||||
HeapFree(GetProcessHeap(), 0, bm.bmBits);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
SIZE_T size = GlobalSize(hSrc);
|
||||
LPVOID pvSrc = NULL;
|
||||
LPVOID pvDst = NULL;
|
||||
|
||||
/* allocate space for object */
|
||||
if (!size) return NULL;
|
||||
hDst = GlobalAlloc(uiFlags, size);
|
||||
if (!hDst) return NULL;
|
||||
|
||||
/* lock pointers */
|
||||
pvSrc = GlobalLock(hSrc);
|
||||
if (!pvSrc)
|
||||
{
|
||||
GlobalFree(hDst);
|
||||
return NULL;
|
||||
}
|
||||
pvDst = GlobalLock(hDst);
|
||||
if (!pvDst)
|
||||
{
|
||||
GlobalUnlock(hSrc);
|
||||
GlobalFree(hDst);
|
||||
return NULL;
|
||||
}
|
||||
/* copy data */
|
||||
memcpy(pvDst, pvSrc, size);
|
||||
|
||||
/* cleanup */
|
||||
GlobalUnlock(hDst);
|
||||
GlobalUnlock(hSrc);
|
||||
}
|
||||
}
|
||||
|
||||
TRACE("returning %p\n", hDst);
|
||||
return hDst;
|
||||
}
|
||||
|
|
|
@ -43,18 +43,6 @@ HRESULT WINAPI OleCreateLinkToFile(LPCOLESTR lpszFileName, REFIID riid,
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* OleDuplicateData [OLE32.@]
|
||||
*/
|
||||
HANDLE WINAPI OleDuplicateData(HANDLE hSrc, CLIPFORMAT cfFormat,
|
||||
UINT uiFlags)
|
||||
{
|
||||
FIXME("(%p,%x,%x), stub!\n", hSrc, cfFormat, uiFlags);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* SetConvertStg [OLE32.@]
|
||||
*/
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
@ stub CLIPFORMAT_UserUnmarshal
|
||||
@ stdcall CLSIDFromProgID(wstr ptr)
|
||||
@ stdcall CLSIDFromString(wstr ptr)
|
||||
@ stub CoAddRefServerProcess
|
||||
@ stdcall CoAddRefServerProcess()
|
||||
@ stdcall CoBuildVersion()
|
||||
@ stub CoCopyProxy #@ stdcall (ptr ptr) return 0,ERR_NOTIMPLEMENTED
|
||||
@ stdcall CoCreateFreeThreadedMarshaler(ptr ptr)
|
||||
|
@ -44,7 +44,7 @@
|
|||
@ stdcall CoIsOle1Class (ptr)
|
||||
@ stdcall CoLoadLibrary(wstr long)
|
||||
@ stdcall CoLockObjectExternal(ptr long long)
|
||||
@ stub CoMarshalHresult #@ stdcall (ptr ptr) return 0,ERR_NOTIMPLEMENTED
|
||||
@ stdcall CoMarshalHresult(ptr long)
|
||||
@ stdcall CoMarshalInterThreadInterfaceInStream(ptr ptr ptr)
|
||||
@ stdcall CoMarshalInterface(ptr ptr ptr long ptr long)
|
||||
@ stub CoQueryAuthenticationServices
|
||||
|
@ -58,7 +58,7 @@
|
|||
@ stub CoRegisterPSClsid #@ stdcall (ptr ptr) return 0,ERR_NOTIMPLEMENTED
|
||||
@ stub CoRegisterSurrogate
|
||||
@ stdcall CoReleaseMarshalData(ptr)
|
||||
@ stub CoReleaseServerProcess #@ stdcall () return 0,ERR_NOTIMPLEMENTED
|
||||
@ stdcall CoReleaseServerProcess()
|
||||
@ stdcall CoResumeClassObjects()
|
||||
@ stub CoRevertToSelf #@ stdcall () return 0,ERR_NOTIMPLEMENTED
|
||||
@ stdcall CoRevokeClassObject(long)
|
||||
|
@ -73,7 +73,7 @@
|
|||
@ stdcall CoTreatAsClass(ptr ptr)
|
||||
@ stdcall CoUninitialize()
|
||||
@ stub CoUnloadingWOW
|
||||
@ stub CoUnmarshalHresult #@ stdcall (ptr ptr) return 0,ERR_NOTIMPLEMENTED
|
||||
@ stdcall CoUnmarshalHresult(ptr ptr)
|
||||
@ stdcall CoUnmarshalInterface(ptr ptr ptr)
|
||||
@ stdcall CreateAntiMoniker(ptr)
|
||||
@ stdcall CreateBindCtx(long ptr)
|
||||
|
|
|
@ -1125,7 +1125,7 @@ HRESULT WINAPI IStream16_fnWrite(
|
|||
ULONG *byteswritten=pcbWrite,xxwritten;
|
||||
int oldsize,newsize,i,curoffset=0,lastblocknr,blocknr,cc;
|
||||
HANDLE hf = This->hf;
|
||||
LPBYTE pbv = (LPBYTE)pv;
|
||||
const BYTE* pbv = (const BYTE*)pv;
|
||||
|
||||
if (!pcbWrite) byteswritten=&xxwritten;
|
||||
*byteswritten = 0;
|
||||
|
|
|
@ -144,8 +144,8 @@ static void updatePropertyChain(
|
|||
StgProperty newProperty);
|
||||
|
||||
static LONG propertyNameCmp(
|
||||
OLECHAR *newProperty,
|
||||
OLECHAR *currentProperty);
|
||||
const OLECHAR *newProperty,
|
||||
const OLECHAR *currentProperty);
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -1158,7 +1158,7 @@ HRESULT WINAPI StorageImpl_CreateStorage(
|
|||
*/
|
||||
hr = IStorage_OpenStorage(
|
||||
iface,
|
||||
(OLECHAR*)pwcsName,
|
||||
(const OLECHAR*)pwcsName,
|
||||
0,
|
||||
grfMode,
|
||||
0,
|
||||
|
@ -1284,8 +1284,8 @@ static ULONG getFreeProperty(
|
|||
* 0 when newPrpoerty == currentProperty
|
||||
*/
|
||||
static LONG propertyNameCmp(
|
||||
OLECHAR *newProperty,
|
||||
OLECHAR *currentProperty)
|
||||
const OLECHAR *newProperty,
|
||||
const OLECHAR *currentProperty)
|
||||
{
|
||||
LONG diff = lstrlenW(newProperty) - lstrlenW(currentProperty);
|
||||
|
||||
|
@ -3962,8 +3962,8 @@ ULONG IEnumSTATSTGImpl_FindProperty(
|
|||
currentProperty);
|
||||
|
||||
if ( propertyNameCmp(
|
||||
(OLECHAR*)currentProperty->name,
|
||||
(OLECHAR*)lpszPropName) == 0)
|
||||
(const OLECHAR*)currentProperty->name,
|
||||
(const OLECHAR*)lpszPropName) == 0)
|
||||
return currentSearchNode;
|
||||
|
||||
/*
|
||||
|
@ -4348,7 +4348,7 @@ BOOL BlockChainStream_WriteAt(BlockChainStream* This,
|
|||
ULONG offsetInBlock = offset.u.LowPart % This->parentStorage->bigBlockSize;
|
||||
ULONG bytesToWrite;
|
||||
ULONG blockIndex;
|
||||
BYTE* bufferWalker;
|
||||
const BYTE* bufferWalker;
|
||||
BYTE* bigBlockBuffer;
|
||||
|
||||
/*
|
||||
|
@ -4385,7 +4385,7 @@ BOOL BlockChainStream_WriteAt(BlockChainStream* This,
|
|||
* This is OK since we don't intend to modify that buffer.
|
||||
*/
|
||||
*bytesWritten = 0;
|
||||
bufferWalker = (BYTE*)buffer;
|
||||
bufferWalker = (const BYTE*)buffer;
|
||||
|
||||
while ( (size > 0) && (blockIndex != BLOCK_END_OF_CHAIN) )
|
||||
{
|
||||
|
@ -5095,7 +5095,7 @@ BOOL SmallBlockChainStream_WriteAt(
|
|||
ULONG bytesToWriteInBuffer;
|
||||
ULONG blockIndex;
|
||||
ULONG bytesWrittenFromBigBlockFile;
|
||||
BYTE* bufferWalker;
|
||||
const BYTE* bufferWalker;
|
||||
|
||||
/*
|
||||
* This should never happen on a small block file.
|
||||
|
@ -5121,7 +5121,7 @@ BOOL SmallBlockChainStream_WriteAt(
|
|||
* This is OK since we don't intend to modify that buffer.
|
||||
*/
|
||||
*bytesWritten = 0;
|
||||
bufferWalker = (BYTE*)buffer;
|
||||
bufferWalker = (const BYTE*)buffer;
|
||||
while ( (size > 0) && (blockIndex != BLOCK_END_OF_CHAIN) )
|
||||
{
|
||||
/*
|
||||
|
|
|
@ -1,26 +1,10 @@
|
|||
Index: Makefile.in
|
||||
===================================================================
|
||||
RCS file: /home/wine/wine/dlls/ole32/Makefile.in,v
|
||||
retrieving revision 1.39
|
||||
diff -u -r1.39 Makefile.in
|
||||
--- Makefile.in 21 Sep 2004 00:35:03 -0000 1.39
|
||||
+++ Makefile.in 20 Oct 2004 09:21:24 -0000
|
||||
@@ -53,7 +53,7 @@
|
||||
ole2thk.spec \
|
||||
storage.spec
|
||||
|
||||
-RC_SRCS = ole32res.rc version.rc
|
||||
+RC_SRCS = ole32res.rc
|
||||
RC_BINSRC = ole32res.rc
|
||||
RC_BINARIES = \
|
||||
drag_copy.cur \
|
||||
Index: ifs.h
|
||||
===================================================================
|
||||
RCS file: /home/wine/wine/dlls/ole32/ifs.h,v
|
||||
retrieving revision 1.13
|
||||
diff -u -r1.13 ifs.h
|
||||
--- ifs.h 5 Oct 2004 04:16:21 -0000 1.13
|
||||
+++ ifs.h 20 Oct 2004 09:21:25 -0000
|
||||
+++ ifs.h 6 Dec 2004 10:15:06 -0000
|
||||
@@ -33,8 +33,7 @@
|
||||
* IMalloc16 interface
|
||||
*/
|
||||
|
@ -66,29 +50,13 @@ diff -u -r1.13 ifs.h
|
|||
|
||||
#define INTERFACE IStorage16
|
||||
DECLARE_INTERFACE_(IStorage16,IUnknown)
|
||||
Index: ole32res.rc
|
||||
===================================================================
|
||||
RCS file: /home/wine/wine/dlls/ole32/ole32res.rc,v
|
||||
retrieving revision 1.5
|
||||
diff -u -r1.5 ole32res.rc
|
||||
--- ole32res.rc 3 Oct 2003 05:01:34 -0000 1.5
|
||||
+++ ole32res.rc 20 Oct 2004 09:21:25 -0000
|
||||
@@ -23,6 +23,8 @@
|
||||
#include "winuser.h"
|
||||
#include "winnls.h"
|
||||
|
||||
+#include "version.rc"
|
||||
+
|
||||
/*
|
||||
* Everything that does not depend on language,
|
||||
* like textless bitmaps etc, go into the
|
||||
Index: oleproxy.c
|
||||
===================================================================
|
||||
RCS file: /home/wine/wine/dlls/ole32/oleproxy.c,v
|
||||
retrieving revision 1.23
|
||||
diff -u -r1.23 oleproxy.c
|
||||
--- oleproxy.c 7 Oct 2004 03:06:49 -0000 1.23
|
||||
+++ oleproxy.c 20 Oct 2004 09:21:25 -0000
|
||||
+++ oleproxy.c 6 Dec 2004 10:15:06 -0000
|
||||
@@ -38,6 +38,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue