On TlsFree, clear the released TLS index in all threads.
[wine/multimedia.git] / memory / local.c
blobcf190474341b54d5c9951c69d74eb3217b5f9781
1 /*
2 * Local heap functions
4 * Copyright 1995 Alexandre Julliard
5 * Copyright 1996 Huw Davies
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 * Note:
24 * All local heap functions need the current DS as first parameter
25 * when called from the emulation library, so they take one more
26 * parameter than usual.
29 #include "config.h"
31 #include <stdarg.h>
32 #include <stdlib.h>
33 #include <string.h>
34 #include "windef.h"
35 #include "winbase.h"
38 /***********************************************************************
39 * LocalAlloc (KERNEL32.@)
40 * RETURNS
41 * Handle: Success
42 * NULL: Failure
44 HLOCAL WINAPI LocalAlloc(
45 UINT flags, /* [in] Allocation attributes */
46 SIZE_T size /* [in] Number of bytes to allocate */
47 ) {
48 return (HLOCAL)GlobalAlloc( flags, size );
52 /***********************************************************************
53 * LocalCompact (KERNEL32.@)
55 SIZE_T WINAPI LocalCompact( UINT minfree )
57 return 0; /* LocalCompact does nothing in Win32 */
61 /***********************************************************************
62 * LocalFlags (KERNEL32.@)
63 * RETURNS
64 * Value specifying allocation flags and lock count.
65 * LMEM_INVALID_HANDLE: Failure
67 UINT WINAPI LocalFlags(
68 HLOCAL handle /* [in] Handle of memory object */
69 ) {
70 return GlobalFlags( (HGLOBAL)handle );
74 /***********************************************************************
75 * LocalFree (KERNEL32.@)
76 * RETURNS
77 * NULL: Success
78 * Handle: Failure
80 HLOCAL WINAPI LocalFree(
81 HLOCAL handle /* [in] Handle of memory object */
82 ) {
83 return (HLOCAL)GlobalFree( (HGLOBAL)handle );
87 /***********************************************************************
88 * LocalHandle (KERNEL32.@)
89 * RETURNS
90 * Handle: Success
91 * NULL: Failure
93 HLOCAL WINAPI LocalHandle(
94 LPCVOID ptr /* [in] Address of local memory object */
95 ) {
96 return (HLOCAL)GlobalHandle( ptr );
100 /***********************************************************************
101 * LocalLock (KERNEL32.@)
102 * Locks a local memory object and returns pointer to the first byte
103 * of the memory block.
105 * RETURNS
106 * Pointer: Success
107 * NULL: Failure
109 LPVOID WINAPI LocalLock(
110 HLOCAL handle /* [in] Address of local memory object */
112 return GlobalLock( (HGLOBAL)handle );
116 /***********************************************************************
117 * LocalReAlloc (KERNEL32.@)
118 * RETURNS
119 * Handle: Success
120 * NULL: Failure
122 HLOCAL WINAPI LocalReAlloc(
123 HLOCAL handle, /* [in] Handle of memory object */
124 SIZE_T size, /* [in] New size of block */
125 UINT flags /* [in] How to reallocate object */
127 return (HLOCAL)GlobalReAlloc( (HGLOBAL)handle, size, flags );
131 /***********************************************************************
132 * LocalShrink (KERNEL32.@)
134 SIZE_T WINAPI LocalShrink( HGLOBAL handle, UINT newsize )
136 return 0; /* LocalShrink does nothing in Win32 */
140 /***********************************************************************
141 * LocalSize (KERNEL32.@)
142 * RETURNS
143 * Size: Success
144 * 0: Failure
146 SIZE_T WINAPI LocalSize(
147 HLOCAL handle /* [in] Handle of memory object */
149 return GlobalSize( (HGLOBAL)handle );
153 /***********************************************************************
154 * LocalUnlock (KERNEL32.@)
155 * RETURNS
156 * TRUE: Object is still locked
157 * FALSE: Object is unlocked
159 BOOL WINAPI LocalUnlock(
160 HLOCAL handle /* [in] Handle of memory object */
162 return GlobalUnlock( (HGLOBAL)handle );