Sweden-Number/dlls/ole32/compobj.c

962 lines
25 KiB
C
Raw Normal View History

Release 950403 Sun Apr 2 18:31:12 1995 Alexandre Julliard (julliard@sunsite.unc.edu) * [Configure] [if1632/Imakefile] Removed new build and short names options. * [if1632/*.c] [tools/build.c] Implemented compiled call-back functions for better performance; all the relay code is now done in assembly code generated by the build program. Relay code is no longer dependent on being loaded below 64K. * [loader/resource.c] Fixed memory leak in LoadString(). A fix will also be needed for other resources. * [memory/global.c] Implemented global heap arenas, so we can store informations about global blocks, like lock counts or owner handle. Implemented FarGetOwner() and FarSetOwner(). Implemented global heap TOOLHELP functions. * [memory/selector.c] Bug fix: it was not possible to re-use a free selector. Sun Apr 2 01:34:52 1995 Constantine Sapuntzakis (csapuntz@mit.edu) * [controls/listbox.c] Major work on listbox code - Many bugs fixed (still many bugs) - More messages supported - Code simplified Fri Mar 31 03:27:16 EST 1995 William Magro (wmagro@tc.cornell.edu) * [controls/edit.c] Lots of bug fixes related to diappearing text, lost carets, highlighting, segmentation faults, occurance of random characters, insertion of characters over selection, misplaced caret location, display corruption, end of line behavior, etc. * [controls/widgets.c] EDIT class doesn't want to use CS_PARENTDC flag. Thu Mar 30 20:58:25 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [loader/selector.c] FixupFunctionPrologs() should also handle multiple data modules. (this bug only became visible because MakeProcInstance() was fixed in 950319) * [misc/dosfs.c] Simplified DOS_SimplifyPath. Small fix to DOS_opendir to reuse an entry if an open directory is opened again, to prevent "too many open directories" messages. Thu Mar 30 12:05:05 1995 Martin von Loewis <loewis@informatik.hu-berlin.de> * [if1632/compobj.spec][include/compobj.h][misc/compobj.c] CoDisconnectObject: new stub function * [include/msdos.h] fix DOSVERSION * [loader/ne_image.c] NE_FixupSegment: Be more generous on additive fixups * [if1632/user.spec][misc/network.c] Add more WNet* stubs Wed Mar 29 11:47:22 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [controls/listbox.c] DlgDirList(): send segptr instead of linear pointer in message to static control * [controls/menu.c] Tried to implement ownerdrawn menuitems. Doesn't work. * [if1632/gdi.spec] [include/windows.h] [objects/font.c] Provide a stub for GetRasterizerCaps() * [loader/selector.c] Pass end address instead of length to LocalInit() in CreateSelectors() * [memory/local.c] LocalInit(): If there's already a local heap in the segment, do nothing and return TRUE * [objects/linedda.c] Replaced buggy LineDDA() with a Bresenham algorithm. Should work now. * [windows/cursor.c] LoadCursor()/CreateCursor(): Cleaned up the mess. Needs some more work still. Tue Mar 21 17:54:43 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [if1632/relay.c] [if1632/callback.c] [include/dlls.h] [if1632/winprocs.spec] [if1632/winprocs.c] [include/winprocs.h] [controls/widgets.c] [misc/shell.c] [misc/commdlg.c] [windows/nonclient.c] [misc/message.c] Added a new builtin DLL that provides 16 bit entry points for all the Def*Procs (DefDlgProc, ButtonProc etc.). OWL programs work again. * [misc/shell.c] RegOpenKey()/RegCreateKey() bugs fixed. * [loader/ne_image.c] Skipping the initialization of a DLL when CS == 0 was broken.
1995-04-03 18:55:37 +02:00
/*
* COMPOBJ library
*
* Copyright 1995 Martin von Loewis
* Copyright 1998 Justin Bradford
* Copyright 1999 Francis Beaudet
* Copyright 1999 Sylvain St-Germain
* Copyright 2002 Marcus Meissner
* Copyright 2004 Mike Hearn
* Copyright 2005-2006 Robert Shearman (for CodeWeavers)
*
* 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
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
2005-01-04 21:32:47 +01:00
*
* Note
* 1. COINIT_MULTITHREADED is 0; it is the lack of COINIT_APARTMENTTHREADED
* Therefore do not test against COINIT_MULTITHREADED
*
2005-01-04 21:32:47 +01:00
* TODO list: (items bunched together depend on each other)
*
* - Implement the OXID resolver so we don't need magic endpoint names for
2005-01-04 21:32:47 +01:00
* clients and servers to meet up
*
Release 950403 Sun Apr 2 18:31:12 1995 Alexandre Julliard (julliard@sunsite.unc.edu) * [Configure] [if1632/Imakefile] Removed new build and short names options. * [if1632/*.c] [tools/build.c] Implemented compiled call-back functions for better performance; all the relay code is now done in assembly code generated by the build program. Relay code is no longer dependent on being loaded below 64K. * [loader/resource.c] Fixed memory leak in LoadString(). A fix will also be needed for other resources. * [memory/global.c] Implemented global heap arenas, so we can store informations about global blocks, like lock counts or owner handle. Implemented FarGetOwner() and FarSetOwner(). Implemented global heap TOOLHELP functions. * [memory/selector.c] Bug fix: it was not possible to re-use a free selector. Sun Apr 2 01:34:52 1995 Constantine Sapuntzakis (csapuntz@mit.edu) * [controls/listbox.c] Major work on listbox code - Many bugs fixed (still many bugs) - More messages supported - Code simplified Fri Mar 31 03:27:16 EST 1995 William Magro (wmagro@tc.cornell.edu) * [controls/edit.c] Lots of bug fixes related to diappearing text, lost carets, highlighting, segmentation faults, occurance of random characters, insertion of characters over selection, misplaced caret location, display corruption, end of line behavior, etc. * [controls/widgets.c] EDIT class doesn't want to use CS_PARENTDC flag. Thu Mar 30 20:58:25 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [loader/selector.c] FixupFunctionPrologs() should also handle multiple data modules. (this bug only became visible because MakeProcInstance() was fixed in 950319) * [misc/dosfs.c] Simplified DOS_SimplifyPath. Small fix to DOS_opendir to reuse an entry if an open directory is opened again, to prevent "too many open directories" messages. Thu Mar 30 12:05:05 1995 Martin von Loewis <loewis@informatik.hu-berlin.de> * [if1632/compobj.spec][include/compobj.h][misc/compobj.c] CoDisconnectObject: new stub function * [include/msdos.h] fix DOSVERSION * [loader/ne_image.c] NE_FixupSegment: Be more generous on additive fixups * [if1632/user.spec][misc/network.c] Add more WNet* stubs Wed Mar 29 11:47:22 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [controls/listbox.c] DlgDirList(): send segptr instead of linear pointer in message to static control * [controls/menu.c] Tried to implement ownerdrawn menuitems. Doesn't work. * [if1632/gdi.spec] [include/windows.h] [objects/font.c] Provide a stub for GetRasterizerCaps() * [loader/selector.c] Pass end address instead of length to LocalInit() in CreateSelectors() * [memory/local.c] LocalInit(): If there's already a local heap in the segment, do nothing and return TRUE * [objects/linedda.c] Replaced buggy LineDDA() with a Bresenham algorithm. Should work now. * [windows/cursor.c] LoadCursor()/CreateCursor(): Cleaned up the mess. Needs some more work still. Tue Mar 21 17:54:43 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [if1632/relay.c] [if1632/callback.c] [include/dlls.h] [if1632/winprocs.spec] [if1632/winprocs.c] [include/winprocs.h] [controls/widgets.c] [misc/shell.c] [misc/commdlg.c] [windows/nonclient.c] [misc/message.c] Added a new builtin DLL that provides 16 bit entry points for all the Def*Procs (DefDlgProc, ButtonProc etc.). OWL programs work again. * [misc/shell.c] RegOpenKey()/RegCreateKey() bugs fixed. * [loader/ne_image.c] Skipping the initialization of a DLL when CS == 0 was broken.
1995-04-03 18:55:37 +02:00
*/
#include <stdarg.h>
#include <stdio.h>
Release 970804 Sun Aug 3 14:03:43 1997 Alexandre Julliard <julliard@lrc.epfl.ch> * [documentation/Makefile.in] Create links for files included from wine.texinfo. * [wine.man] Moved to documentation dir. * [if1632/builtin.c] Made SYSTEM.DLL always loaded by default. * [loader/signal.c] [if1632/signal.c] Split signal.c in generic/emulator-specific parts. * [misc/system.c] [if1632/thunk.c] Implemented system timer functions. Fixed InquireSystem parameters. * [msdos/ioports.c] Defined inb/outb functions to avoid including asm/io.h. Use the right instruction for word and dword direct access. * [multimedia/mmsystem.c] Fixed CallTo16 usage. Sat Aug 2 13:05:23 1997 Andreas Mohr <100.30936@germany.net> * [controls/edit.c] When text is inserted into a newly created editline, the caret is placed after the text. Should be placed before the text. Fixed. * [files/file.c] Removed O_TRUNC flag from OF_WRITE mode in _lopen32(). According to doc _lopen() never truncates files. * [if1632/user.spec] [misc/comm.c] Added stub for EnableCommNotification(). * [misc/ver.c] Fixed problem with VerQueryValue*() running over end of name table in rare cases. * [msdos/int21.c] Enhanced ioctlGetDeviceInfo() to correctly return the current drive. * [multimedia/joystick.c] [windows/message.c] Added joystick support !!! Needs Linux >= 2.1.45 or joystick-0.8.0.tar.gz. Fri Aug 1 18:02:09 1997 Morten Welinder <terra@diku.dk> * [if1632/user32.spec] Define DrawAnimatedRects32. * [graphics/painting.c] (DrawAnimatedRects32): Create stub. * [misc/registry.c] Cope with NULL class in RegQueryInfoKey32A. * [if1632/user32.spec] Add GetMenuItemInfo32[AW]. * [controls/menu.c] (InsertMenu32A): Upgrade flags to 8 hex-digits. (MENUEX_ParseResource): First shot at implementation. (LoadMenuIndirect32A): Handle extended menus. (GetMenuItemInfo32[AW]): First shot at implementation. * [include/windows.h] Define MFT_*, MFS_*, MIIM_* macros. Define MENUITEMINFO[AW] structures and pointers. * [Makefile.in] (etags): Add TAGS as target. * [if1632/comctl32.spec] Use Windows 95's ordinals. Add a few missing stubs. Thu Jul 31 14:01:13 1997 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [objects/color.c] Fix for 16 color mode of XFree. * [if1632/kernel32.spec][win32/ordinals.c] Moved/added some ordinal only exported functions from kernel32.dll (mostly thunking preparation stuff). Wed Jul 30 09:16:38 1997 John Harvey <john@division.co.uk> * [graphics/win16drv/init.c] [include/win16drv.h] Escape(SETABORTPROC) returns success to keep pbrush.exe happy. Escape(NEXTBAND) implemented to make HP PCL printer driver work in word. Stub for PATBLT added to start work on printing more than text. Mon Jul 28 13:14:28 1997 Victor Schneider <vischne@ibm.net> * [libtest/expand.c] New Winelib test program. Wed Jul 23 09:37:13 1997 Adrian Harvey <adrian@select.com.au> * [tools/build.c] [tools/build-spec.txt] [if1632/kernel.spec] [if1632/user.spec] Added ability to set filename wine considers the built-in DLLs to be in to something other than name.DLL with new "file" key in .spec files. Made kernel filename KRNL386.EXE (some programs use this name explicitly - ChemOffice install now starts up). Made user filename USER.EXE (just to be tidy). Sun Jul 20 23:51:02 1997 David A. Cuthbert <dacut@henry.ece.cmu.edu> * [controls/menu.c] [misc/tweak.c] [include/tweak.h] Fixed MENU_KeyLeft and MENU_KeyRight to handle multiple-column menus. Misc menu drawing issues for Win95 tweaks fixed. Misc warnings fixed. * [loader/module.c] Spaces are now permitted in file/path names on the command line. If multiple matches can be made, the preferred match is the path/file with fewer spaces. Tue Jul 29 02:21:15 1997 Bruce Milner <Bruce.Milner@genetics.utah.edu> * [misc/compobj.c] Added CLSIDFromString and StringFromCLSID.
1997-08-04 18:34:36 +02:00
#include <string.h>
#include <assert.h>
#define COBJMACROS
#define NONAMELESSUNION
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "winreg.h"
#include "winuser.h"
2009-06-23 15:25:56 +02:00
#define USE_COM_CONTEXT_DEF
#include "objbase.h"
#include "ole2.h"
#include "ole2ver.h"
#include "ctxtcall.h"
#include "dde.h"
#include "servprov.h"
#include "initguid.h"
#include "compobj_private.h"
#include "moniker.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(ole);
/****************************************************************************
* This section defines variables internal to the COM module.
*/
enum comclass_miscfields
{
MiscStatus = 1,
MiscStatusIcon = 2,
MiscStatusContent = 4,
MiscStatusThumbnail = 8,
MiscStatusDocPrint = 16
};
struct comclassredirect_data
{
ULONG size;
ULONG flags;
DWORD model;
GUID clsid;
GUID alias;
GUID clsid2;
GUID tlbid;
ULONG name_len;
ULONG name_offset;
ULONG progid_len;
ULONG progid_offset;
ULONG clrdata_len;
ULONG clrdata_offset;
DWORD miscstatus;
DWORD miscstatuscontent;
DWORD miscstatusthumbnail;
DWORD miscstatusicon;
DWORD miscstatusdocprint;
};
struct ifacepsredirect_data
{
ULONG size;
DWORD mask;
GUID iid;
ULONG nummethods;
GUID tlbid;
GUID base;
ULONG name_len;
ULONG name_offset;
};
struct progidredirect_data
{
ULONG size;
DWORD reserved;
ULONG clsid_offset;
};
enum class_reg_data_origin
{
CLASS_REG_ACTCTX,
CLASS_REG_REGISTRY,
};
struct class_reg_data
{
enum class_reg_data_origin origin;
union
{
struct
{
const WCHAR *module_name;
DWORD threading_model;
HANDLE hactctx;
} actctx;
HKEY hkey;
} u;
};
static inline enum comclass_miscfields dvaspect_to_miscfields(DWORD aspect)
{
switch (aspect)
{
case DVASPECT_CONTENT:
return MiscStatusContent;
case DVASPECT_THUMBNAIL:
return MiscStatusThumbnail;
case DVASPECT_ICON:
return MiscStatusIcon;
case DVASPECT_DOCPRINT:
return MiscStatusDocPrint;
default:
return MiscStatus;
};
}
BOOL actctx_get_miscstatus(const CLSID *clsid, DWORD aspect, DWORD *status)
{
ACTCTX_SECTION_KEYED_DATA data;
data.cbSize = sizeof(data);
if (FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION,
clsid, &data))
{
struct comclassredirect_data *comclass = (struct comclassredirect_data*)data.lpData;
enum comclass_miscfields misc = dvaspect_to_miscfields(aspect);
ULONG miscmask = (comclass->flags >> 8) & 0xff;
if (!(miscmask & misc))
{
if (!(miscmask & MiscStatus))
{
*status = 0;
return TRUE;
}
misc = MiscStatus;
}
switch (misc)
{
case MiscStatus:
*status = comclass->miscstatus;
break;
case MiscStatusIcon:
*status = comclass->miscstatusicon;
break;
case MiscStatusContent:
*status = comclass->miscstatuscontent;
break;
case MiscStatusThumbnail:
*status = comclass->miscstatusthumbnail;
break;
case MiscStatusDocPrint:
*status = comclass->miscstatusdocprint;
break;
default:
;
};
return TRUE;
}
else
return FALSE;
}
/* wrapper for NtCreateKey that creates the key recursively if necessary */
static NTSTATUS create_key( HKEY *retkey, ACCESS_MASK access, OBJECT_ATTRIBUTES *attr )
{
NTSTATUS status = NtCreateKey( (HANDLE *)retkey, access, attr, 0, NULL, 0, NULL );
if (status == STATUS_OBJECT_NAME_NOT_FOUND)
{
HANDLE subkey, root = attr->RootDirectory;
WCHAR *buffer = attr->ObjectName->Buffer;
DWORD attrs, pos = 0, i = 0, len = attr->ObjectName->Length / sizeof(WCHAR);
UNICODE_STRING str;
while (i < len && buffer[i] != '\\') i++;
if (i == len) return status;
attrs = attr->Attributes;
attr->ObjectName = &str;
while (i < len)
{
str.Buffer = buffer + pos;
str.Length = (i - pos) * sizeof(WCHAR);
status = NtCreateKey( &subkey, access, attr, 0, NULL, 0, NULL );
if (attr->RootDirectory != root) NtClose( attr->RootDirectory );
if (status) return status;
attr->RootDirectory = subkey;
while (i < len && buffer[i] == '\\') i++;
pos = i;
while (i < len && buffer[i] != '\\') i++;
}
str.Buffer = buffer + pos;
str.Length = (i - pos) * sizeof(WCHAR);
attr->Attributes = attrs;
status = NtCreateKey( (PHANDLE)retkey, access, attr, 0, NULL, 0, NULL );
if (attr->RootDirectory != root) NtClose( attr->RootDirectory );
}
return status;
}
static HKEY classes_root_hkey;
/* create the special HKEY_CLASSES_ROOT key */
static HKEY create_classes_root_hkey(DWORD access)
{
HKEY hkey, ret = 0;
OBJECT_ATTRIBUTES attr;
UNICODE_STRING name;
attr.Length = sizeof(attr);
attr.RootDirectory = 0;
attr.ObjectName = &name;
attr.Attributes = 0;
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
RtlInitUnicodeString( &name, L"\\Registry\\Machine\\Software\\Classes" );
if (create_key( &hkey, access, &attr )) return 0;
TRACE( "%s -> %p\n", debugstr_w(attr.ObjectName->Buffer), hkey );
if (!(access & KEY_WOW64_64KEY))
{
if (!(ret = InterlockedCompareExchangePointer( (void **)&classes_root_hkey, hkey, 0 )))
ret = hkey;
else
NtClose( hkey ); /* somebody beat us to it */
}
else
ret = hkey;
return ret;
}
/* map the hkey from special root to normal key if necessary */
static inline HKEY get_classes_root_hkey( HKEY hkey, REGSAM access )
{
HKEY ret = hkey;
const BOOL is_win64 = sizeof(void*) > sizeof(int);
const BOOL force_wow32 = is_win64 && (access & KEY_WOW64_32KEY);
if (hkey == HKEY_CLASSES_ROOT &&
((access & KEY_WOW64_64KEY) || !(ret = classes_root_hkey)))
ret = create_classes_root_hkey(MAXIMUM_ALLOWED | (access & KEY_WOW64_64KEY));
if (force_wow32 && ret && ret == classes_root_hkey)
{
access &= ~KEY_WOW64_32KEY;
if (create_classes_key(classes_root_hkey, L"Wow6432Node", access, &hkey))
return 0;
ret = hkey;
}
return ret;
}
LSTATUS create_classes_key( HKEY hkey, const WCHAR *name, REGSAM access, HKEY *retkey )
{
OBJECT_ATTRIBUTES attr;
UNICODE_STRING nameW;
if (!(hkey = get_classes_root_hkey( hkey, access ))) return ERROR_INVALID_HANDLE;
attr.Length = sizeof(attr);
attr.RootDirectory = hkey;
attr.ObjectName = &nameW;
attr.Attributes = 0;
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
RtlInitUnicodeString( &nameW, name );
return RtlNtStatusToDosError( create_key( retkey, access, &attr ) );
}
LSTATUS open_classes_key( HKEY hkey, const WCHAR *name, REGSAM access, HKEY *retkey )
{
OBJECT_ATTRIBUTES attr;
UNICODE_STRING nameW;
if (!(hkey = get_classes_root_hkey( hkey, access ))) return ERROR_INVALID_HANDLE;
attr.Length = sizeof(attr);
attr.RootDirectory = hkey;
attr.ObjectName = &nameW;
attr.Attributes = 0;
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
RtlInitUnicodeString( &nameW, name );
return RtlNtStatusToDosError( NtOpenKey( (HANDLE *)retkey, access, &attr ) );
}
/******************************************************************************
* Implementation of the manual reset event object. (CLSID_ManualResetEvent)
*/
typedef struct ManualResetEvent {
ISynchronize ISynchronize_iface;
ISynchronizeHandle ISynchronizeHandle_iface;
LONG ref;
HANDLE event;
} MREImpl;
static inline MREImpl *impl_from_ISynchronize(ISynchronize *iface)
{
return CONTAINING_RECORD(iface, MREImpl, ISynchronize_iface);
}
static HRESULT WINAPI ISynchronize_fnQueryInterface(ISynchronize *iface, REFIID riid, void **ppv)
{
MREImpl *This = impl_from_ISynchronize(iface);
TRACE("%p (%s, %p)\n", This, debugstr_guid(riid), ppv);
if(IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_ISynchronize)) {
*ppv = &This->ISynchronize_iface;
}else if(IsEqualGUID(riid, &IID_ISynchronizeHandle)) {
*ppv = &This->ISynchronizeHandle_iface;
}else {
ERR("Unknown interface %s requested.\n", debugstr_guid(riid));
*ppv = NULL;
return E_NOINTERFACE;
}
IUnknown_AddRef((IUnknown*)*ppv);
return S_OK;
}
static ULONG WINAPI ISynchronize_fnAddRef(ISynchronize *iface)
{
MREImpl *This = impl_from_ISynchronize(iface);
LONG ref = InterlockedIncrement(&This->ref);
TRACE("%p - ref %d\n", This, ref);
return ref;
}
static ULONG WINAPI ISynchronize_fnRelease(ISynchronize *iface)
{
MREImpl *This = impl_from_ISynchronize(iface);
LONG ref = InterlockedDecrement(&This->ref);
TRACE("%p - ref %d\n", This, ref);
if(!ref)
{
CloseHandle(This->event);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
static HRESULT WINAPI ISynchronize_fnWait(ISynchronize *iface, DWORD dwFlags, DWORD dwMilliseconds)
{
MREImpl *This = impl_from_ISynchronize(iface);
UINT index;
TRACE("%p (%08x, %08x)\n", This, dwFlags, dwMilliseconds);
return CoWaitForMultipleHandles(dwFlags, dwMilliseconds, 1, &This->event, &index);
}
static HRESULT WINAPI ISynchronize_fnSignal(ISynchronize *iface)
{
MREImpl *This = impl_from_ISynchronize(iface);
TRACE("%p\n", This);
SetEvent(This->event);
return S_OK;
}
static HRESULT WINAPI ISynchronize_fnReset(ISynchronize *iface)
{
MREImpl *This = impl_from_ISynchronize(iface);
TRACE("%p\n", This);
ResetEvent(This->event);
return S_OK;
}
static ISynchronizeVtbl vt_ISynchronize = {
ISynchronize_fnQueryInterface,
ISynchronize_fnAddRef,
ISynchronize_fnRelease,
ISynchronize_fnWait,
ISynchronize_fnSignal,
ISynchronize_fnReset
};
static inline MREImpl *impl_from_ISynchronizeHandle(ISynchronizeHandle *iface)
{
return CONTAINING_RECORD(iface, MREImpl, ISynchronizeHandle_iface);
}
static HRESULT WINAPI SynchronizeHandle_QueryInterface(ISynchronizeHandle *iface, REFIID riid, void **ppv)
{
MREImpl *This = impl_from_ISynchronizeHandle(iface);
return ISynchronize_QueryInterface(&This->ISynchronize_iface, riid, ppv);
}
static ULONG WINAPI SynchronizeHandle_AddRef(ISynchronizeHandle *iface)
{
MREImpl *This = impl_from_ISynchronizeHandle(iface);
return ISynchronize_AddRef(&This->ISynchronize_iface);
}
static ULONG WINAPI SynchronizeHandle_Release(ISynchronizeHandle *iface)
{
MREImpl *This = impl_from_ISynchronizeHandle(iface);
return ISynchronize_Release(&This->ISynchronize_iface);
}
static HRESULT WINAPI SynchronizeHandle_GetHandle(ISynchronizeHandle *iface, HANDLE *ph)
{
MREImpl *This = impl_from_ISynchronizeHandle(iface);
*ph = This->event;
return S_OK;
}
static const ISynchronizeHandleVtbl SynchronizeHandleVtbl = {
SynchronizeHandle_QueryInterface,
SynchronizeHandle_AddRef,
SynchronizeHandle_Release,
SynchronizeHandle_GetHandle
};
HRESULT WINAPI ManualResetEvent_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID iid, void **ppv)
{
MREImpl *This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MREImpl));
HRESULT hr;
if (outer)
FIXME("Aggregation not implemented.\n");
This->ref = 1;
This->ISynchronize_iface.lpVtbl = &vt_ISynchronize;
This->ISynchronizeHandle_iface.lpVtbl = &SynchronizeHandleVtbl;
This->event = CreateEventW(NULL, TRUE, FALSE, NULL);
hr = ISynchronize_QueryInterface(&This->ISynchronize_iface, iid, ppv);
ISynchronize_Release(&This->ISynchronize_iface);
return hr;
}
/******************************************************************************
2003-09-11 05:06:25 +02:00
* CoBuildVersion [OLE32.@]
*
* Gets the build version of the DLL.
*
* PARAMS
*
* RETURNS
* Current build version, hiword is majornumber, loword is minornumber
Release 950620 Mon Jun 19 20:29:50 1995 Alexandre Julliard (julliard@sunsite.unc.edu) * [debugger/*.c] Modified debugger to use segmented pointers everywhere. * [if1632/shell.spec] [if1632/sound.spec] [if1632/user.spec] Declared all functions that return only 16-bit as 'pascal16'. * [include/ldt.h] [memory/ldt.c] Export LDT_EntryToBytes (new) and LDT_BytesToEntry for DPMI. Maintain a copy of the selector flags, removing the need to make a system call to retrieve an LDT entry. * [loader/module.c] Fixed bug with module file handle cache. * [loader/ne_resource.c] Fixed file name bug in NE_AccessResource(). * [loader/resource.c] Fixed bug in LoadIcon() that caused wrong colors to be used for the icon mask. * [loader/signal.c] Moved instruction emulation to miscemu/instr.c. * [misc/dos_fs.c] [miscemu/int21.c] Lots of small fixes, thanks to Morten Welinder. * [miscemu/dpmi.c] More complete DPMI emulation. * [miscemu/instr.c] Added support for prefixes in instructions to emulate. * [miscemu/int2f.c] Use register macros instead of destroying the high part of 32-bit registers. * [objects/dc.c] Fixed bug in GetDCState() that failed to clear the new DC. * [rc/sysres.rc] Removed dialogs 11 and 12 that were never used. * [tools/build.c] 'pascal16' generated functions did not save %dx. Removed use of %fs to access the stack. %ds is no longer initialized before calling a 16-bit routine. * [windows/defwnd.c] Accept a NULL pointer as window title. * [windows/mdi.c] MDICascade: skip iconic windows. Implemented CalcChildScroll(). * [windows/utility.c] Fixed MulDiv() for illegal values. * [windows/win.c] Fixed X error in CreateWindowEx() when WM_NCCALCSIZE returned a zero width or height. Sun Jun 18 22:22:30 MET DST 1995 Fons Botman (botman@inter.nl.net) * [controls/edit.c] Fixed "uninitalized" message which -Wall couldnt see to be ok in EDIT_WriteText. * [include/debug.h] Added define for extra checks in API definitions during debugging. * [loader/ne_image.c] Added newline in NE_FixupPrologs to avoid long lines. * [misc/dos_fs.c] Added extra safety check in DOS_ValidDrive. * [misc/exec.c] Fixed definition of ExitWindows. Sun Jun 18 21:16:08 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [controls/edit.c] Some fixes, mostly for memory management, but also for text selection and tab postitions. General cleanup. Notepad.exe now works. * [controls/combo.c] Fix: the hwnd field of the DRAWITEMSTRUCT should always be that of the combo box, not the ComboLBox that belongs to it. * [controls/listbox.c] Handle itemID field correctly throughout. * [memory/local.c] Implemented flag LMEM_ZEROINIT. LocalReAlloc() could trash the heap. Fixed. * [objects/font.c] FONT_MatchFont(): don't get confused by negative widths. Fixed a segfault in EnumFonts(). * [objects/text.c] DrawText(): DT_CALCRECT implies DT_NOCLIP. * [objects/dcvalues.c] MAKELONG was used with bad parameters in DC_GET_X_Y. * [windows/dialog.c] Don't show the dialog if WS_VISIBLE isn't set in the template. * [windows/utility.c] UTILITY_convertArgs(): Never pass an expression containing ++ into a macro... * [windows/win.c] SetParent() should unlink the window before changing the parent. * [windows/message.c] Don't call timer functions via CallWindowProc(), since it checks whether hwnd==0 and does not call the function in that case. * [miscemu/instr.c] Ignore interrupt 0x3D, for VBRUN300.DLL. * [misc/commdlg.c] Don't rely on the itemData field of the DRAWITEMSTRUCT to contain a pointer to the item text. * [if1632/relay.c] Disable OLE and DDEML DLLs by default, since they contain nothing but stubs anyway. SHELL, COMMDLG and WIN87EM are left enabled, although some programs may work better without them. * [multimedia/*.c] [include/multimedia.h] [include/driver.h] Begun cleaning things up a little. Replaced printfs with dprintf_ macros, made functions static where possible, and some other minor changes. Sun Jun 11 23:19:10 1995 Martin von Loewis <martin@informatik.hu-berlin.de> * [debugger/dbg.y][debugger/dbg.l] Removed special handling for FILE_IDENTIFER, because it caused problems with x/<format> statements. * [debugger/info.c] Use SC_ESP instead of SC_EIP for stack dump. * [misc/compobj.c][if1632/compobj.spec] CoBuildVersion, CoInitialize, CoUninitialize: new functions * [misc/ole2.c][if1632/ole2.spec][misc/Imakefile][include/ole2.h] New files ole2.c, ole2.h OleBuildVersion, OleInitialize, OleUninitialize: new functions * [if1632/ole2disp.spec] Added missing ordinals above 109 * [misc/ole2nls.c][if1632/ole2nls.spec][include/winnls.h] New file winnls.h GetLocaleInfoA: new function * [if1632/shell.spec] Added FindEnvironmentString as stub * [misc/olecli.c][if1632/olecli.spec] OleIsDcMeta: New function * [objects/font][misc/gdi.spec] GetKerningPairs: new function * [misc/shell.c] ShellExecute: Implemented support for starting programs * [if1632/user.spec] Inserted missing relay to GetClipCursor Sun Jun 11 20:34:47 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [controls/edit.c] Fix a problem with the local heap. * [include/wintypes.h] Fixed wrong declarations of CATCHBUF and LPCATCHBUF. * [include/mdi.h] [windows/mdi.c] This code still assumed segmented address==linear address. Fixed. * [include/msdos.h] [misc/dos_fs.c] The filemask field of the dosdirent structure could be overrun. Fixed. If you had a file called foobar and a file called foo, trying to FindFile(foo) could accidentally find file foobar instead. Fixed. * [misc/file.c] OpenFile(): Always return the full pathname in ofs->szPathName. This also fixes GetModuleFilename(). Prevent _lclose() from closing stderr or stdout. * [misc/profile.c] Search for .ini files in the path of the current module as well. (Needed by Lotus Organizer.) * [loader/task.c] [loader/ne_image.c] [loader/module.c] [memory/local.c] Local heaps are now initialized by InitTask() for executables. DLLs have to call LocalInit() themselves, LocalInit() has to put the heap at the end of the segment when called with start==0. We no longer allocate the DGROUP with 64k on startup, but grow the local heap in LOCAL_GetBlock() when necessary. * [loader/module.c] LoadLibrary() should call LoadModule() in all cases, even if the DLL is already loaded, to ensure that the reference count is correct. * [loader/ne_image.c] Some changes to function prolog fixup. Does anyone know exactly how this is supposed to work? I am only guessing here. In NE_InitializeDLLs(), initialize the DLLs a module refers to before the module itself. * [loader/task.c] Initialize instance data at the beginning of the DGROUP in InitTask(). * [memory/local.c] Some fixes for moveable blocks. * [memory/selector.c] All the IsBad*Pointer() functions returned exactly the wrong boolean value in all cases! * [objects/bitblt.c] Fixed another null pointer dereference in debugging output. * [objects/font.c] Some more recovery possibilities for FONT_MatchFont() if a specified font does not exist. * [windows/win.c] The dialog code may call CreateWindowEx with an integer in windowName. This happens for static icon controls that expect a resource ID as the window name. CreateWindowEx() used to crash. Fixed. * [windows/class.c] [windows/win.c] Window classes are owned by modules, not instances. Changed RegisterClass(), UnregisterClass(), GetClassInfo() and CreateWindowEx() accordingly. Sat Jun 10 16:10:53 1995 Olaf Flebbe <o.flebbe@science-computing.uni-tuebingen.de> * [miscemu/int21.c] clock.exe was displaying incorrect year. Fri Jun 9 20:36:56 1995 Victor Schneider <tailor@crl.com> * [include/cursor.h] [windows/cursor.c] Implemented CreateCursorIconIndirect().
1995-06-20 21:08:12 +02:00
*/
DWORD WINAPI CoBuildVersion(void)
{
TRACE("Returning version %d, build %d.\n", rmm, rup);
return (rmm<<16)+rup;
Release 980301 Sun Mar 1 10:45:23 1998 Andreas Mohr <100.30936@germany.net> * [loader/ne_image.c] Fixed problem with weird DLLs (NE_FFLAGS_SINGLEDATA && DGROUP = 0). * [msdos/dosmem.c] Export address for __0000H, too. * [msdos/dpmi.c] Changed MemAlloc functions to return less fragmented addresses. Sat Feb 28 18:50:12 1998 Alexandre Julliard <julliard@lrc.epfl.ch> * [scheduler/process.c] [scheduler/sysdeps.c] Don't use %fs register before threading initialization. Sat Feb 28 14:04:56 1998 Kristian Nielsen <kristian.nielsen@risoe.dk> * [configure.in] [include/acconfig.h] Autoconf macro to check for non-reentrant X libraries. * [windows/winpos.c] In SetWindowPos32(), do not cause WM_SIZE messages when the SWP_NOSIZE flag is specified. This fixes the division-by-zero in Borland C++ 4.0 "Open Project" menu item. Sat Feb 28 13:11:26 1998 James Moody <013263m@dragon.acadiau.ca> * [ole/ole2nls.c] Changed "English" values from German to English. * [files/dos_fs.c] Fixed off-by-one month bug. Fri Feb 27 22:12:01 1998 Douglas Ridgway <ridgway@winehq.com> * [windows/win.c] Fix winelib class menu loading bug. * [include/module.h] [loader/module.c] LoadModule32 should be implemented in terms of CreateProcess. * [programs/view/*] Metafile viewer sample program. * [documentation/wine.texinfo] [documentation/Makefile.in] Improvements and additions, HTML target. Fri Feb 27 04:27:48 1998 Dimitrie O. Paun <dimi@cs.toronto.edu> * [*/*] Switched to the new debug messages interface. For more information please refer to documentation/debug-msgs. Because the new scheme introduces a new semantic level, I had to manually do through about 530 dprintf_xxx! The rest of about 2400 where transformed via a script. Because of the large number of changes that I had to do, some may have not come out as nicely as I wanted them. If this is the case, please let me know. There is a lot of work left to do: -- a few hundred printf's to be converted -- about 2300 fprintf's to be converted -- about 600 FIXME's to be transformed The problem is that in the above mentioned cases, a lot of manual intervention is required because a lot of the information is missing. There are also a lot of other things to be done to the interface and so forth. I have now ideas for a at least a month worth of full time work :) I will proceed with many changes in the next few releases, so please do not start modifing things because there will be a hell of a lot of conflicts. If you have ideas that you want to integrate or you want to work on different things, please coordinate with me. Thu Feb 26 13:04:29 1998 David Lee Lambert <lamber45@egr.msu.edu> * [ole/ole2nls.c] [include/windows.h] First try at OLE date- and time-formatting functions. Wed Feb 25 11:20:35 1998 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [files/*.c] Changed dos device handling, added 'CON' devicehandling. * [graphics/ddraw.c] Bug fixes, some additions. * [if1632/builtin.c][loader/module.c][library/winestub.c] Small hack so we don't need a dummy BUILTIN_LoadModule in winestub.c. * [ole/*][relay32/ole32.spec][if1632/storage.spec] storage.dll started. winword loads documents (saving doesn't work yet, dunno why). Several ole additions, some cleanups and bugfixes. IMalloc16 implemented. * [loader/pe_image.c] Added some comments, fixed circular dll references, fixed modref ordering, fixed tls allocation. * [memory/global.c] Added validity checks before every GET_ARENA_PTR. (several functions rely on Global* return values on invalid handles, like IsTask). Implemented GlobalUnlockFree16. * [memory/virtual.c] Replaced dprintf_virtual by fprintf, so we can do 'info map' again in the debugger. Increase read linesize for Linux2.1 cases. * [misc/cpu.c][misc/registry.c] Moved cpu registry initialization to misc/cpu.c. * [multimedia/dsound.c] Enhanced, replaced GETOSPACE bufferingcheck by SETFRAGMENT. * [relay32/crtdll.spec][relay32/ntdll.spec] Replaced some ptr by respective 'str' and 'wstr' arguments for libc functions. * [scheduler/thread.c] Added some sanity checks to stackallocation, tlshandling fixed. * [tools/build.c] Fixed cdecl argumenttype order (was reversed). * [win32/ordinals.c] Implemented KERNEL_449. * [windows/dinput.c] Some fixes, needs much more work. Tomb Raider2 works with keyboard ;) Tue Feb 24 20:46:37 1998 James Juran <jrj120@psu.edu> * [windows/win.c] Fixed USER32 ordinal numbers in documentation. Sat Feb 21 12:30:38 1998 John Richardson <jrichard@zko.dec.com> * [files/file.c] [include/k32obj.h] [memory/virtual.c] [scheduler/critsection.c] [scheduler/event.c] [scheduler/handle.c] [scheduler/k32obj.c] [scheduler/mutex.c] [scheduler/process.c] [scheduler/semaphore.c] [scheduler/thread.c] Added generic k32obj read and write routines for k32objs that support I/O. * [documentation/console] Updated console docs. * [win32/console.c] Make console work like a k32obj that supports I/O. * [include/windows.h] Make WriteFile and ReadFile take HANDLE32 for handle. Sun Feb 15 14:07:07 1998 Dimitrie O. Paun <dimi@mail.cs.toronto.edu> * [controls/menu.c] [misc/ver.c] [multimedia/dsound.c] [multimedia/joystick.c] [windows/dialog.c] Modified some dprintf_xxx's to prepare them for a new dprintf_ scheme. Basically, I changed the dprintf's that outputed a line with many dprintf calls to do just one dprintf call.
1998-03-01 21:05:02 +01:00
}
/******************************************************************************
2003-09-11 05:06:25 +02:00
* CoInitialize [OLE32.@]
*
* Initializes the COM libraries by calling CoInitializeEx with
* COINIT_APARTMENTTHREADED, ie it enters a STA thread.
*
* PARAMS
* lpReserved [I] Pointer to IMalloc interface (obsolete, should be NULL).
*
* RETURNS
* Success: S_OK if not already initialized, S_FALSE otherwise.
* Failure: HRESULT code.
*
* SEE ALSO
* CoInitializeEx
Release 980301 Sun Mar 1 10:45:23 1998 Andreas Mohr <100.30936@germany.net> * [loader/ne_image.c] Fixed problem with weird DLLs (NE_FFLAGS_SINGLEDATA && DGROUP = 0). * [msdos/dosmem.c] Export address for __0000H, too. * [msdos/dpmi.c] Changed MemAlloc functions to return less fragmented addresses. Sat Feb 28 18:50:12 1998 Alexandre Julliard <julliard@lrc.epfl.ch> * [scheduler/process.c] [scheduler/sysdeps.c] Don't use %fs register before threading initialization. Sat Feb 28 14:04:56 1998 Kristian Nielsen <kristian.nielsen@risoe.dk> * [configure.in] [include/acconfig.h] Autoconf macro to check for non-reentrant X libraries. * [windows/winpos.c] In SetWindowPos32(), do not cause WM_SIZE messages when the SWP_NOSIZE flag is specified. This fixes the division-by-zero in Borland C++ 4.0 "Open Project" menu item. Sat Feb 28 13:11:26 1998 James Moody <013263m@dragon.acadiau.ca> * [ole/ole2nls.c] Changed "English" values from German to English. * [files/dos_fs.c] Fixed off-by-one month bug. Fri Feb 27 22:12:01 1998 Douglas Ridgway <ridgway@winehq.com> * [windows/win.c] Fix winelib class menu loading bug. * [include/module.h] [loader/module.c] LoadModule32 should be implemented in terms of CreateProcess. * [programs/view/*] Metafile viewer sample program. * [documentation/wine.texinfo] [documentation/Makefile.in] Improvements and additions, HTML target. Fri Feb 27 04:27:48 1998 Dimitrie O. Paun <dimi@cs.toronto.edu> * [*/*] Switched to the new debug messages interface. For more information please refer to documentation/debug-msgs. Because the new scheme introduces a new semantic level, I had to manually do through about 530 dprintf_xxx! The rest of about 2400 where transformed via a script. Because of the large number of changes that I had to do, some may have not come out as nicely as I wanted them. If this is the case, please let me know. There is a lot of work left to do: -- a few hundred printf's to be converted -- about 2300 fprintf's to be converted -- about 600 FIXME's to be transformed The problem is that in the above mentioned cases, a lot of manual intervention is required because a lot of the information is missing. There are also a lot of other things to be done to the interface and so forth. I have now ideas for a at least a month worth of full time work :) I will proceed with many changes in the next few releases, so please do not start modifing things because there will be a hell of a lot of conflicts. If you have ideas that you want to integrate or you want to work on different things, please coordinate with me. Thu Feb 26 13:04:29 1998 David Lee Lambert <lamber45@egr.msu.edu> * [ole/ole2nls.c] [include/windows.h] First try at OLE date- and time-formatting functions. Wed Feb 25 11:20:35 1998 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [files/*.c] Changed dos device handling, added 'CON' devicehandling. * [graphics/ddraw.c] Bug fixes, some additions. * [if1632/builtin.c][loader/module.c][library/winestub.c] Small hack so we don't need a dummy BUILTIN_LoadModule in winestub.c. * [ole/*][relay32/ole32.spec][if1632/storage.spec] storage.dll started. winword loads documents (saving doesn't work yet, dunno why). Several ole additions, some cleanups and bugfixes. IMalloc16 implemented. * [loader/pe_image.c] Added some comments, fixed circular dll references, fixed modref ordering, fixed tls allocation. * [memory/global.c] Added validity checks before every GET_ARENA_PTR. (several functions rely on Global* return values on invalid handles, like IsTask). Implemented GlobalUnlockFree16. * [memory/virtual.c] Replaced dprintf_virtual by fprintf, so we can do 'info map' again in the debugger. Increase read linesize for Linux2.1 cases. * [misc/cpu.c][misc/registry.c] Moved cpu registry initialization to misc/cpu.c. * [multimedia/dsound.c] Enhanced, replaced GETOSPACE bufferingcheck by SETFRAGMENT. * [relay32/crtdll.spec][relay32/ntdll.spec] Replaced some ptr by respective 'str' and 'wstr' arguments for libc functions. * [scheduler/thread.c] Added some sanity checks to stackallocation, tlshandling fixed. * [tools/build.c] Fixed cdecl argumenttype order (was reversed). * [win32/ordinals.c] Implemented KERNEL_449. * [windows/dinput.c] Some fixes, needs much more work. Tomb Raider2 works with keyboard ;) Tue Feb 24 20:46:37 1998 James Juran <jrj120@psu.edu> * [windows/win.c] Fixed USER32 ordinal numbers in documentation. Sat Feb 21 12:30:38 1998 John Richardson <jrichard@zko.dec.com> * [files/file.c] [include/k32obj.h] [memory/virtual.c] [scheduler/critsection.c] [scheduler/event.c] [scheduler/handle.c] [scheduler/k32obj.c] [scheduler/mutex.c] [scheduler/process.c] [scheduler/semaphore.c] [scheduler/thread.c] Added generic k32obj read and write routines for k32objs that support I/O. * [documentation/console] Updated console docs. * [win32/console.c] Make console work like a k32obj that supports I/O. * [include/windows.h] Make WriteFile and ReadFile take HANDLE32 for handle. Sun Feb 15 14:07:07 1998 Dimitrie O. Paun <dimi@mail.cs.toronto.edu> * [controls/menu.c] [misc/ver.c] [multimedia/dsound.c] [multimedia/joystick.c] [windows/dialog.c] Modified some dprintf_xxx's to prepare them for a new dprintf_ scheme. Basically, I changed the dprintf's that outputed a line with many dprintf calls to do just one dprintf call.
1998-03-01 21:05:02 +01:00
*/
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
{
/*
* Just delegate to the newer method.
*/
return CoInitializeEx(lpReserved, COINIT_APARTMENTTHREADED);
Release 950620 Mon Jun 19 20:29:50 1995 Alexandre Julliard (julliard@sunsite.unc.edu) * [debugger/*.c] Modified debugger to use segmented pointers everywhere. * [if1632/shell.spec] [if1632/sound.spec] [if1632/user.spec] Declared all functions that return only 16-bit as 'pascal16'. * [include/ldt.h] [memory/ldt.c] Export LDT_EntryToBytes (new) and LDT_BytesToEntry for DPMI. Maintain a copy of the selector flags, removing the need to make a system call to retrieve an LDT entry. * [loader/module.c] Fixed bug with module file handle cache. * [loader/ne_resource.c] Fixed file name bug in NE_AccessResource(). * [loader/resource.c] Fixed bug in LoadIcon() that caused wrong colors to be used for the icon mask. * [loader/signal.c] Moved instruction emulation to miscemu/instr.c. * [misc/dos_fs.c] [miscemu/int21.c] Lots of small fixes, thanks to Morten Welinder. * [miscemu/dpmi.c] More complete DPMI emulation. * [miscemu/instr.c] Added support for prefixes in instructions to emulate. * [miscemu/int2f.c] Use register macros instead of destroying the high part of 32-bit registers. * [objects/dc.c] Fixed bug in GetDCState() that failed to clear the new DC. * [rc/sysres.rc] Removed dialogs 11 and 12 that were never used. * [tools/build.c] 'pascal16' generated functions did not save %dx. Removed use of %fs to access the stack. %ds is no longer initialized before calling a 16-bit routine. * [windows/defwnd.c] Accept a NULL pointer as window title. * [windows/mdi.c] MDICascade: skip iconic windows. Implemented CalcChildScroll(). * [windows/utility.c] Fixed MulDiv() for illegal values. * [windows/win.c] Fixed X error in CreateWindowEx() when WM_NCCALCSIZE returned a zero width or height. Sun Jun 18 22:22:30 MET DST 1995 Fons Botman (botman@inter.nl.net) * [controls/edit.c] Fixed "uninitalized" message which -Wall couldnt see to be ok in EDIT_WriteText. * [include/debug.h] Added define for extra checks in API definitions during debugging. * [loader/ne_image.c] Added newline in NE_FixupPrologs to avoid long lines. * [misc/dos_fs.c] Added extra safety check in DOS_ValidDrive. * [misc/exec.c] Fixed definition of ExitWindows. Sun Jun 18 21:16:08 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [controls/edit.c] Some fixes, mostly for memory management, but also for text selection and tab postitions. General cleanup. Notepad.exe now works. * [controls/combo.c] Fix: the hwnd field of the DRAWITEMSTRUCT should always be that of the combo box, not the ComboLBox that belongs to it. * [controls/listbox.c] Handle itemID field correctly throughout. * [memory/local.c] Implemented flag LMEM_ZEROINIT. LocalReAlloc() could trash the heap. Fixed. * [objects/font.c] FONT_MatchFont(): don't get confused by negative widths. Fixed a segfault in EnumFonts(). * [objects/text.c] DrawText(): DT_CALCRECT implies DT_NOCLIP. * [objects/dcvalues.c] MAKELONG was used with bad parameters in DC_GET_X_Y. * [windows/dialog.c] Don't show the dialog if WS_VISIBLE isn't set in the template. * [windows/utility.c] UTILITY_convertArgs(): Never pass an expression containing ++ into a macro... * [windows/win.c] SetParent() should unlink the window before changing the parent. * [windows/message.c] Don't call timer functions via CallWindowProc(), since it checks whether hwnd==0 and does not call the function in that case. * [miscemu/instr.c] Ignore interrupt 0x3D, for VBRUN300.DLL. * [misc/commdlg.c] Don't rely on the itemData field of the DRAWITEMSTRUCT to contain a pointer to the item text. * [if1632/relay.c] Disable OLE and DDEML DLLs by default, since they contain nothing but stubs anyway. SHELL, COMMDLG and WIN87EM are left enabled, although some programs may work better without them. * [multimedia/*.c] [include/multimedia.h] [include/driver.h] Begun cleaning things up a little. Replaced printfs with dprintf_ macros, made functions static where possible, and some other minor changes. Sun Jun 11 23:19:10 1995 Martin von Loewis <martin@informatik.hu-berlin.de> * [debugger/dbg.y][debugger/dbg.l] Removed special handling for FILE_IDENTIFER, because it caused problems with x/<format> statements. * [debugger/info.c] Use SC_ESP instead of SC_EIP for stack dump. * [misc/compobj.c][if1632/compobj.spec] CoBuildVersion, CoInitialize, CoUninitialize: new functions * [misc/ole2.c][if1632/ole2.spec][misc/Imakefile][include/ole2.h] New files ole2.c, ole2.h OleBuildVersion, OleInitialize, OleUninitialize: new functions * [if1632/ole2disp.spec] Added missing ordinals above 109 * [misc/ole2nls.c][if1632/ole2nls.spec][include/winnls.h] New file winnls.h GetLocaleInfoA: new function * [if1632/shell.spec] Added FindEnvironmentString as stub * [misc/olecli.c][if1632/olecli.spec] OleIsDcMeta: New function * [objects/font][misc/gdi.spec] GetKerningPairs: new function * [misc/shell.c] ShellExecute: Implemented support for starting programs * [if1632/user.spec] Inserted missing relay to GetClipCursor Sun Jun 11 20:34:47 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [controls/edit.c] Fix a problem with the local heap. * [include/wintypes.h] Fixed wrong declarations of CATCHBUF and LPCATCHBUF. * [include/mdi.h] [windows/mdi.c] This code still assumed segmented address==linear address. Fixed. * [include/msdos.h] [misc/dos_fs.c] The filemask field of the dosdirent structure could be overrun. Fixed. If you had a file called foobar and a file called foo, trying to FindFile(foo) could accidentally find file foobar instead. Fixed. * [misc/file.c] OpenFile(): Always return the full pathname in ofs->szPathName. This also fixes GetModuleFilename(). Prevent _lclose() from closing stderr or stdout. * [misc/profile.c] Search for .ini files in the path of the current module as well. (Needed by Lotus Organizer.) * [loader/task.c] [loader/ne_image.c] [loader/module.c] [memory/local.c] Local heaps are now initialized by InitTask() for executables. DLLs have to call LocalInit() themselves, LocalInit() has to put the heap at the end of the segment when called with start==0. We no longer allocate the DGROUP with 64k on startup, but grow the local heap in LOCAL_GetBlock() when necessary. * [loader/module.c] LoadLibrary() should call LoadModule() in all cases, even if the DLL is already loaded, to ensure that the reference count is correct. * [loader/ne_image.c] Some changes to function prolog fixup. Does anyone know exactly how this is supposed to work? I am only guessing here. In NE_InitializeDLLs(), initialize the DLLs a module refers to before the module itself. * [loader/task.c] Initialize instance data at the beginning of the DGROUP in InitTask(). * [memory/local.c] Some fixes for moveable blocks. * [memory/selector.c] All the IsBad*Pointer() functions returned exactly the wrong boolean value in all cases! * [objects/bitblt.c] Fixed another null pointer dereference in debugging output. * [objects/font.c] Some more recovery possibilities for FONT_MatchFont() if a specified font does not exist. * [windows/win.c] The dialog code may call CreateWindowEx with an integer in windowName. This happens for static icon controls that expect a resource ID as the window name. CreateWindowEx() used to crash. Fixed. * [windows/class.c] [windows/win.c] Window classes are owned by modules, not instances. Changed RegisterClass(), UnregisterClass(), GetClassInfo() and CreateWindowEx() accordingly. Sat Jun 10 16:10:53 1995 Olaf Flebbe <o.flebbe@science-computing.uni-tuebingen.de> * [miscemu/int21.c] clock.exe was displaying incorrect year. Fri Jun 9 20:36:56 1995 Victor Schneider <tailor@crl.com> * [include/cursor.h] [windows/cursor.c] Implemented CreateCursorIconIndirect().
1995-06-20 21:08:12 +02:00
}
/* open HKCR\\CLSID\\{string form of clsid}\\{keyname} key */
HRESULT COM_OpenKeyForCLSID(REFCLSID clsid, LPCWSTR keyname, REGSAM access, HKEY *subkey)
{
WCHAR path[CHARS_IN_GUID + ARRAY_SIZE(L"CLSID\\") - 1];
LONG res;
HKEY key;
lstrcpyW(path, L"CLSID\\");
StringFromGUID2(clsid, path + lstrlenW(L"CLSID\\"), CHARS_IN_GUID);
res = open_classes_key(HKEY_CLASSES_ROOT, path, keyname ? KEY_READ : access, &key);
if (res == ERROR_FILE_NOT_FOUND)
return REGDB_E_CLASSNOTREG;
else if (res != ERROR_SUCCESS)
return REGDB_E_READREGDB;
if (!keyname)
{
*subkey = key;
return S_OK;
}
res = open_classes_key(key, keyname, access, subkey);
RegCloseKey(key);
if (res == ERROR_FILE_NOT_FOUND)
return REGDB_E_KEYMISSING;
else if (res != ERROR_SUCCESS)
return REGDB_E_READREGDB;
return S_OK;
}
1998-11-01 15:47:53 +01:00
/***********************************************************************
2003-09-11 05:06:25 +02:00
* CoLoadLibrary (OLE32.@)
*
* Loads a library.
*
* PARAMS
* lpszLibName [I] Path to library.
* bAutoFree [I] Whether the library should automatically be freed.
*
* RETURNS
* Success: Handle to loaded library.
* Failure: NULL.
*
* SEE ALSO
* CoFreeLibrary, CoFreeAllLibraries, CoFreeUnusedLibraries
1998-11-01 15:47:53 +01:00
*/
HINSTANCE WINAPI CoLoadLibrary(LPOLESTR lpszLibName, BOOL bAutoFree)
1998-11-01 15:47:53 +01:00
{
TRACE("(%s, %d)\n", debugstr_w(lpszLibName), bAutoFree);
return LoadLibraryExW(lpszLibName, 0, LOAD_WITH_ALTERED_SEARCH_PATH);
}
/***********************************************************************
2003-09-11 05:06:25 +02:00
* CoFreeLibrary [OLE32.@]
*
* Unloads a library from memory.
*
* PARAMS
* hLibrary [I] Handle to library to unload.
*
* RETURNS
* Nothing
*
* SEE ALSO
* CoLoadLibrary, CoFreeAllLibraries, CoFreeUnusedLibraries
*/
void WINAPI CoFreeLibrary(HINSTANCE hLibrary)
{
2004-03-24 00:20:16 +01:00
FreeLibrary(hLibrary);
}
/***********************************************************************
2003-09-11 05:06:25 +02:00
* CoFreeAllLibraries [OLE32.@]
*
* Function for backwards compatibility only. Does nothing.
*
* RETURNS
* Nothing.
*
* SEE ALSO
* CoLoadLibrary, CoFreeLibrary, CoFreeUnusedLibraries
*/
void WINAPI CoFreeAllLibraries(void)
{
2004-03-24 00:20:16 +01:00
/* NOP */
1998-11-01 15:47:53 +01:00
}
/***********************************************************************
2003-09-11 05:06:25 +02:00
* CoGetState [OLE32.@]
*
* Retrieves the thread state object previously stored by CoSetState().
*
* PARAMS
* ppv [I] Address where pointer to object will be stored.
*
* RETURNS
* Success: S_OK.
* Failure: E_OUTOFMEMORY.
*
* NOTES
* Crashes on all invalid ppv addresses, including NULL.
* If the function returns a non-NULL object then the caller must release its
* reference on the object when the object is no longer required.
*
* SEE ALSO
* CoSetState().
*/
HRESULT WINAPI CoGetState(IUnknown ** ppv)
{
struct oletls *info = COM_CurrentInfo();
if (!info) return E_OUTOFMEMORY;
*ppv = NULL;
if (info->state)
{
IUnknown_AddRef(info->state);
*ppv = info->state;
TRACE("apt->state=%p\n", info->state);
}
return S_OK;
}
/***********************************************************************
2003-09-11 05:06:25 +02:00
* CoSetState [OLE32.@]
*
* Sets the thread state object.
*
* PARAMS
* pv [I] Pointer to state object to be stored.
*
* NOTES
* The system keeps a reference on the object while the object stored.
*
* RETURNS
* Success: S_OK.
* Failure: E_OUTOFMEMORY.
*/
HRESULT WINAPI CoSetState(IUnknown * pv)
{
struct oletls *info = COM_CurrentInfo();
if (!info) return E_OUTOFMEMORY;
if (pv) IUnknown_AddRef(pv);
if (info->state)
{
TRACE("-- release %p now\n", info->state);
IUnknown_Release(info->state);
}
info->state = pv;
return S_OK;
}
2000-07-29 13:29:26 +02:00
/******************************************************************************
2003-09-11 05:06:25 +02:00
* CoTreatAsClass [OLE32.@]
*
* Sets the TreatAs value of a class.
*
* PARAMS
* clsidOld [I] Class to set TreatAs value on.
* clsidNew [I] The class the clsidOld should be treated as.
*
* RETURNS
* Success: S_OK.
* Failure: HRESULT code.
*
* SEE ALSO
* CoGetTreatAsClass
*/
HRESULT WINAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew)
{
HKEY hkey = NULL;
WCHAR szClsidNew[CHARS_IN_GUID];
HRESULT res = S_OK;
WCHAR auto_treat_as[CHARS_IN_GUID];
LONG auto_treat_as_size = sizeof(auto_treat_as);
CLSID id;
res = COM_OpenKeyForCLSID(clsidOld, NULL, KEY_READ | KEY_WRITE, &hkey);
if (FAILED(res))
goto done;
if (IsEqualGUID( clsidOld, clsidNew ))
{
if (!RegQueryValueW(hkey, L"AutoTreatAs", auto_treat_as, &auto_treat_as_size) &&
CLSIDFromString(auto_treat_as, &id) == S_OK)
{
if (RegSetValueW(hkey, L"TreatAs", REG_SZ, auto_treat_as, sizeof(auto_treat_as)))
{
res = REGDB_E_WRITEREGDB;
goto done;
}
}
else
{
if (RegDeleteKeyW(hkey, L"TreatAs"))
res = REGDB_E_WRITEREGDB;
goto done;
}
}
else
{
if(IsEqualGUID(clsidNew, &CLSID_NULL)){
RegDeleteKeyW(hkey, L"TreatAs");
}else{
if(!StringFromGUID2(clsidNew, szClsidNew, ARRAY_SIZE(szClsidNew))){
WARN("StringFromGUID2 failed\n");
res = E_FAIL;
goto done;
}
if (RegSetValueW(hkey, L"TreatAs", REG_SZ, szClsidNew, sizeof(szClsidNew)) != ERROR_SUCCESS){
WARN("RegSetValue failed\n");
res = REGDB_E_WRITEREGDB;
goto done;
}
}
}
done:
if (hkey) RegCloseKey(hkey);
return res;
2000-07-29 13:29:26 +02:00
}
2000-08-03 06:16:34 +02:00
/***********************************************************************
* CoIsOle1Class [OLE32.@]
*
* Determines whether the specified class an OLE v1 class.
*
* PARAMS
* clsid [I] Class to test.
*
* RETURNS
* TRUE if the class is an OLE v1 class, or FALSE otherwise.
*/
BOOL WINAPI CoIsOle1Class(REFCLSID clsid)
{
FIXME("%s\n", debugstr_guid(clsid));
return FALSE;
}
2000-08-03 06:16:34 +02:00
/***********************************************************************
2003-09-11 05:06:25 +02:00
* IsEqualGUID [OLE32.@]
2000-08-03 06:16:34 +02:00
*
* Compares two Unique Identifiers.
*
* PARAMS
* rguid1 [I] The first GUID to compare.
* rguid2 [I] The other GUID to compare.
*
2000-08-03 06:16:34 +02:00
* RETURNS
* TRUE if equal
*/
#undef IsEqualGUID
BOOL WINAPI IsEqualGUID(
REFGUID rguid1,
REFGUID rguid2)
2000-08-03 06:16:34 +02:00
{
return !memcmp(rguid1,rguid2,sizeof(GUID));
}
/***********************************************************************
* CoAllowSetForegroundWindow [OLE32.@]
*
*/
HRESULT WINAPI CoAllowSetForegroundWindow(IUnknown *pUnk, void *pvReserved)
{
FIXME("(%p, %p): stub\n", pUnk, pvReserved);
return S_OK;
}
2006-06-28 22:24:38 +02:00
/***********************************************************************
* CoGetObject [OLE32.@]
*
* Gets the object named by converting the name to a moniker and binding to it.
2006-06-28 22:24:38 +02:00
*
* PARAMS
* pszName [I] String representing the object.
* pBindOptions [I] Parameters affecting the binding to the named object.
* riid [I] Interface to bind to on the object.
2006-06-28 22:24:38 +02:00
* ppv [O] On output, the interface riid of the object represented
* by pszName.
*
* RETURNS
* Success: S_OK.
* Failure: HRESULT code.
*
* SEE ALSO
* MkParseDisplayName.
*/
HRESULT WINAPI CoGetObject(LPCWSTR pszName, BIND_OPTS *pBindOptions,
REFIID riid, void **ppv)
{
IBindCtx *pbc;
HRESULT hr;
*ppv = NULL;
hr = CreateBindCtx(0, &pbc);
if (SUCCEEDED(hr))
{
if (pBindOptions)
hr = IBindCtx_SetBindOptions(pbc, pBindOptions);
if (SUCCEEDED(hr))
{
ULONG chEaten;
IMoniker *pmk;
hr = MkParseDisplayName(pbc, pszName, &chEaten, &pmk);
if (SUCCEEDED(hr))
{
hr = IMoniker_BindToObject(pmk, pbc, NULL, riid, ppv);
IMoniker_Release(pmk);
}
}
IBindCtx_Release(pbc);
}
return hr;
}
/* Returns expanded dll path from the registry or activation context. */
static BOOL get_object_dll_path(const struct class_reg_data *regdata, WCHAR *dst, DWORD dstlen)
{
DWORD ret;
if (regdata->origin == CLASS_REG_REGISTRY)
{
DWORD keytype;
WCHAR src[MAX_PATH];
DWORD dwLength = dstlen * sizeof(WCHAR);
if( (ret = RegQueryValueExW(regdata->u.hkey, NULL, NULL, &keytype, (BYTE*)src, &dwLength)) == ERROR_SUCCESS ) {
if (keytype == REG_EXPAND_SZ) {
if (dstlen <= ExpandEnvironmentStringsW(src, dst, dstlen)) ret = ERROR_MORE_DATA;
} else {
const WCHAR *quote_start;
quote_start = wcschr(src, '\"');
if (quote_start) {
const WCHAR *quote_end = wcschr(quote_start + 1, '\"');
if (quote_end) {
memmove(src, quote_start + 1,
(quote_end - quote_start - 1) * sizeof(WCHAR));
src[quote_end - quote_start - 1] = '\0';
}
}
lstrcpynW(dst, src, dstlen);
}
}
return !ret;
}
else
{
ULONG_PTR cookie;
*dst = 0;
ActivateActCtx(regdata->u.actctx.hactctx, &cookie);
ret = SearchPathW(NULL, regdata->u.actctx.module_name, L".dll", dstlen, dst, NULL);
DeactivateActCtx(0, cookie);
return *dst != 0;
}
}
HRESULT Handler_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
{
HKEY hkey;
HRESULT hres;
hres = COM_OpenKeyForCLSID(rclsid, L"InprocHandler32", KEY_READ, &hkey);
if (SUCCEEDED(hres))
{
struct class_reg_data regdata;
WCHAR dllpath[MAX_PATH+1];
regdata.u.hkey = hkey;
regdata.origin = CLASS_REG_REGISTRY;
if (get_object_dll_path(&regdata, dllpath, ARRAY_SIZE(dllpath)))
{
if (!wcsicmp(dllpath, L"ole32.dll"))
{
RegCloseKey(hkey);
return HandlerCF_Create(rclsid, riid, ppv);
}
}
else
WARN("not creating object for inproc handler path %s\n", debugstr_w(dllpath));
RegCloseKey(hkey);
}
return CLASS_E_CLASSNOTAVAILABLE;
}
2008-02-26 11:21:54 +01:00
/***********************************************************************
* DllMain (OLE32.@)
*/
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID reserved)
{
TRACE("%p 0x%x %p\n", hinstDLL, fdwReason, reserved);
switch(fdwReason) {
case DLL_PROCESS_ATTACH:
hProxyDll = hinstDLL;
break;
case DLL_PROCESS_DETACH:
if (reserved) break;
release_std_git();
break;
}
return TRUE;
}
/***********************************************************************
* DllRegisterServer (OLE32.@)
*/
HRESULT WINAPI DllRegisterServer(void)
{
return OLE32_DllRegisterServer();
}
/***********************************************************************
* DllUnregisterServer (OLE32.@)
*/
HRESULT WINAPI DllUnregisterServer(void)
{
return OLE32_DllUnregisterServer();
}