2 * Local heap declarations
4 * Copyright 1995 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef __WINE_LOCAL_H
22 #define __WINE_LOCAL_H
25 #include <wine/windef16.h>
26 #include <wine/winbase16.h>
30 #define CURRENT_DS (((STACK16FRAME*)MapSL((SEGPTR)NtCurrentTeb()->WOW32Reserved))->ds)
32 /* These function are equivalent to the Local* API functions, */
33 /* excepted that they need DS as the first parameter. This */
34 /* allows managing several heaps from the emulation library. */
35 static inline HLOCAL16 LOCAL_Alloc( HANDLE16 ds, UINT16 flags, WORD size )
37 HANDLE16 oldDS = CURRENT_DS;
41 ret = LocalAlloc16 (flags, size);
46 static inline HLOCAL16 LOCAL_ReAlloc( HANDLE16 ds, HLOCAL16 handle, WORD size, UINT16 flags )
48 HANDLE16 oldDS = CURRENT_DS;
52 ret = LocalReAlloc16 (handle, size, flags);
57 static inline HLOCAL16 LOCAL_Free( HANDLE16 ds, HLOCAL16 handle )
59 HANDLE16 oldDS = CURRENT_DS;
63 ret = LocalFree16 (handle);
67 static inline HLOCAL16 LOCAL_Handle( HANDLE16 ds, WORD addr )
69 HANDLE16 oldDS = CURRENT_DS;
73 ret = LocalHandle16 (addr);
78 static inline UINT16 LOCAL_Size( HANDLE16 ds, HLOCAL16 handle )
80 HANDLE16 oldDS = CURRENT_DS;
84 ret = LocalSize16 (handle);
89 static inline UINT16 LOCAL_Flags( HANDLE16 ds, HLOCAL16 handle )
91 HANDLE16 oldDS = CURRENT_DS;
95 ret = LocalFlags16 (handle);
101 static inline UINT16 LOCAL_HeapSize( HANDLE16 ds )
103 HANDLE16 oldDS = CURRENT_DS;
107 ret = LocalHeapSize16 ();
112 static inline UINT16 LOCAL_CountFree( HANDLE16 ds )
114 HANDLE16 oldDS = CURRENT_DS;
118 ret = LocalCountFree16 ();
123 static inline void *LOCAL_Lock( HANDLE16 ds, HLOCAL16 handle )
125 HANDLE16 oldDS = CURRENT_DS;
129 ret = LocalLock16 (handle);
135 static inline BOOL16 LOCAL_Unlock( HANDLE16 ds, HLOCAL16 handle )
137 HANDLE16 oldDS = CURRENT_DS;
141 ret = LocalUnlock16 (handle);
146 static inline WORD LOCAL_Compact( HANDLE16 ds, UINT16 minfree )
148 HANDLE16 oldDS = CURRENT_DS;
152 ret = LocalCompact16 (minfree);
158 #endif /* __WINE_LOCAL_H */