Changeset 7926 for trunk/src/ole32/ifs.c


Ignore:
Timestamp:
Feb 15, 2002, 6:18:52 PM (24 years ago)
Author:
sandervl
Message:

Wine 20020215 resync

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/ole32/ifs.c

    r6711 r7926  
    55 */
    66
     7#include "config.h"
     8
    79#include <ctype.h>
    810#include <stdlib.h>
    911#include <string.h>
    1012#include <assert.h>
     13
     14#include "ole2.h"
     15#include "windef.h"
    1116#include "winerror.h"
    12 #include "heap.h"
     17
     18#include "wine/obj_base.h"
    1319#include "wine/winbase16.h"
    14 #include "wine/obj_base.h"
     20#include "ifs.h"
     21
    1522#include "debugtools.h"
    16 
    17 #include "ole.h"
    18 #include "ifs.h"
    1923
    2024DEFAULT_DEBUG_CHANNEL(relay);
     
    139143        ICOM_THIS(IMalloc16Impl,iface);
    140144        TRACE("(%p)->Alloc(%ld)\n",This,cb);
    141         return MapLS( HeapAlloc( GetProcessHeap(), HEAP_WINE_SEGPTR, cb ) );
     145        return MapLS( HeapAlloc( GetProcessHeap(), 0, cb ) );
    142146}
    143147
     
    145149 * IMalloc16_Realloc [COMPOBJ.504]
    146150 */
    147 SEGPTR WINAPI IMalloc16_fnRealloc(IMalloc16* iface,SEGPTR pv,DWORD cb) {
    148         ICOM_THIS(IMalloc16Impl,iface);
    149         TRACE("(%p)->Realloc(%08lx,%ld)\n",This,pv,cb);
    150         return MapLS( HeapReAlloc( GetProcessHeap(), HEAP_WINE_SEGPTR, MapSL(pv), cb ) );
     151SEGPTR WINAPI IMalloc16_fnRealloc(IMalloc16* iface,SEGPTR pv,DWORD cb)
     152{
     153    SEGPTR ret;
     154    ICOM_THIS(IMalloc16Impl,iface);
     155    TRACE("(%p)->Realloc(%08lx,%ld)\n",This,pv,cb);
     156    ret = MapLS( HeapReAlloc( GetProcessHeap(), 0, MapSL(pv), cb ) );
     157    UnMapLS(pv);
     158    return ret;
    151159}
    152160
     
    154162 * IMalloc16_Free [COMPOBJ.505]
    155163 */
    156 VOID WINAPI IMalloc16_fnFree(IMalloc16* iface,SEGPTR pv) {
    157         ICOM_THIS(IMalloc16Impl,iface);
    158         TRACE("(%p)->Free(%08lx)\n",This,pv);
    159         HeapFree( GetProcessHeap(), HEAP_WINE_SEGPTR, MapSL(pv) );
     164VOID WINAPI IMalloc16_fnFree(IMalloc16* iface,SEGPTR pv)
     165{
     166    void *ptr = MapSL(pv);
     167    ICOM_THIS(IMalloc16Impl,iface);
     168    TRACE("(%p)->Free(%08lx)\n",This,pv);
     169    UnMapLS(pv);
     170    HeapFree( GetProcessHeap(), 0, ptr );
    160171}
    161172
     
    167178        ICOM_CTHIS(IMalloc16Impl,iface);
    168179        TRACE("(%p)->GetSize(%08lx)\n",This,pv);
    169         return HeapSize( GetProcessHeap(), HEAP_WINE_SEGPTR, MapSL(pv) );
     180        return HeapSize( GetProcessHeap(), 0, MapSL(pv) );
    170181}
    171182
     
    188199}
    189200
    190 static ICOM_VTABLE(IMalloc16)* msegvt16 = NULL;
    191 
    192201/******************************************************************************
    193202 * IMalloc16_Constructor [VTABLE]
    194203 */
    195204LPMALLOC16
    196 IMalloc16_Constructor() {
    197         IMalloc16Impl*  This;
    198         HMODULE16       hcomp = GetModuleHandle16("COMPOBJ");
    199 
    200         This = (IMalloc16Impl*)SEGPTR_NEW(IMalloc16Impl);
    201         if (!msegvt16) {
    202             msegvt16 = SEGPTR_NEW(ICOM_VTABLE(IMalloc16));
    203 
    204 #define VTENT(x) msegvt16->x = (void*)GetProcAddress16(hcomp,"IMalloc16_"#x);assert(msegvt16->x)
    205             VTENT(QueryInterface);
    206             VTENT(AddRef);
    207             VTENT(Release);
    208             VTENT(Alloc);
    209             VTENT(Realloc);
    210             VTENT(Free);
    211             VTENT(GetSize);
    212             VTENT(DidAlloc);
    213             VTENT(HeapMinimize);
     205IMalloc16_Constructor()
     206{
     207    static ICOM_VTABLE(IMalloc16) vt16;
     208    static SEGPTR msegvt16;
     209    IMalloc16Impl* This;
     210    HMODULE16 hcomp = GetModuleHandle16("COMPOBJ");
     211
     212    This = HeapAlloc( GetProcessHeap(), 0, sizeof(IMalloc16Impl) );
     213    if (!msegvt16)
     214    {
     215#define VTENT(x) vt16.x = (void*)GetProcAddress16(hcomp,"IMalloc16_"#x);assert(vt16.x)
     216        VTENT(QueryInterface);
     217        VTENT(AddRef);
     218        VTENT(Release);
     219        VTENT(Alloc);
     220        VTENT(Realloc);
     221        VTENT(Free);
     222        VTENT(GetSize);
     223        VTENT(DidAlloc);
     224        VTENT(HeapMinimize);
    214225#undef VTENT
    215         }
    216         ICOM_VTBL(This) = (ICOM_VTABLE(IMalloc16)*)SEGPTR_GET(msegvt16);
    217         This->ref = 1;
    218         return (LPMALLOC16)SEGPTR_GET(This);
     226        msegvt16 = MapLS( &vt16 );
     227    }
     228    ICOM_VTBL(This) = (ICOM_VTABLE(IMalloc16)*)msegvt16;
     229    This->ref = 1;
     230    return (LPMALLOC16)MapLS( This );
    219231}
    220232#endif
Note: See TracChangeset for help on using the changeset viewer.