Fixed typo.
[wine/multimedia.git] / memory / local.c
blob5615e080f51efcb7dd8c37d924807ad8edef41b6
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 <stdlib.h>
32 #include <string.h>
33 #include "winbase.h"
36 /***********************************************************************
37 * LocalAlloc (KERNEL32.@)
38 * RETURNS
39 * Handle: Success
40 * NULL: Failure
42 HLOCAL WINAPI LocalAlloc(
43 UINT flags, /* [in] Allocation attributes */
44 SIZE_T size /* [in] Number of bytes to allocate */
45 ) {
46 return (HLOCAL)GlobalAlloc( flags, size );
50 /***********************************************************************
51 * LocalCompact (KERNEL32.@)
53 SIZE_T WINAPI LocalCompact( UINT minfree )
55 return 0; /* LocalCompact does nothing in Win32 */
59 /***********************************************************************
60 * LocalFlags (KERNEL32.@)
61 * RETURNS
62 * Value specifying allocation flags and lock count.
63 * LMEM_INVALID_HANDLE: Failure
65 UINT WINAPI LocalFlags(
66 HLOCAL handle /* [in] Handle of memory object */
67 ) {
68 return GlobalFlags( (HGLOBAL)handle );
72 /***********************************************************************
73 * LocalFree (KERNEL32.@)
74 * RETURNS
75 * NULL: Success
76 * Handle: Failure
78 HLOCAL WINAPI LocalFree(
79 HLOCAL handle /* [in] Handle of memory object */
80 ) {
81 return (HLOCAL)GlobalFree( (HGLOBAL)handle );
85 /***********************************************************************
86 * LocalHandle (KERNEL32.@)
87 * RETURNS
88 * Handle: Success
89 * NULL: Failure
91 HLOCAL WINAPI LocalHandle(
92 LPCVOID ptr /* [in] Address of local memory object */
93 ) {
94 return (HLOCAL)GlobalHandle( ptr );
98 /***********************************************************************
99 * LocalLock (KERNEL32.@)
100 * Locks a local memory object and returns pointer to the first byte
101 * of the memory block.
103 * RETURNS
104 * Pointer: Success
105 * NULL: Failure
107 LPVOID WINAPI LocalLock(
108 HLOCAL handle /* [in] Address of local memory object */
110 return GlobalLock( (HGLOBAL)handle );
114 /***********************************************************************
115 * LocalReAlloc (KERNEL32.@)
116 * RETURNS
117 * Handle: Success
118 * NULL: Failure
120 HLOCAL WINAPI LocalReAlloc(
121 HLOCAL handle, /* [in] Handle of memory object */
122 SIZE_T size, /* [in] New size of block */
123 UINT flags /* [in] How to reallocate object */
125 return (HLOCAL)GlobalReAlloc( (HGLOBAL)handle, size, flags );
129 /***********************************************************************
130 * LocalShrink (KERNEL32.@)
132 SIZE_T WINAPI LocalShrink( HGLOBAL handle, UINT newsize )
134 return 0; /* LocalShrink does nothing in Win32 */
138 /***********************************************************************
139 * LocalSize (KERNEL32.@)
140 * RETURNS
141 * Size: Success
142 * 0: Failure
144 SIZE_T WINAPI LocalSize(
145 HLOCAL handle /* [in] Handle of memory object */
147 return GlobalSize( (HGLOBAL)handle );
151 /***********************************************************************
152 * LocalUnlock (KERNEL32.@)
153 * RETURNS
154 * TRUE: Object is still locked
155 * FALSE: Object is unlocked
157 BOOL WINAPI LocalUnlock(
158 HLOCAL handle /* [in] Handle of memory object */
160 return GlobalUnlock( (HGLOBAL)handle );