Fix the case of product and company names.
[wine] / memory / local.c
1 /*
2  * Local heap functions
3  *
4  * Copyright 1995 Alexandre Julliard
5  * Copyright 1996 Huw Davies
6  *
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.
11  *
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.
16  *
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
20  */
21
22 /*
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.
27  */
28
29 #include "config.h"
30
31 #include <stdarg.h>
32 #include <stdlib.h>
33 #include <string.h>
34 #include "windef.h"
35 #include "winbase.h"
36
37
38 /***********************************************************************
39  *           LocalAlloc   (KERNEL32.@)
40  * RETURNS
41  *      Handle: Success
42  *      NULL: Failure
43  */
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 );
49 }
50
51
52 /***********************************************************************
53  *           LocalCompact   (KERNEL32.@)
54  */
55 SIZE_T WINAPI LocalCompact( UINT minfree )
56 {
57     return 0;  /* LocalCompact does nothing in Win32 */
58 }
59
60
61 /***********************************************************************
62  *           LocalFlags   (KERNEL32.@)
63  * RETURNS
64  *      Value specifying allocation flags and lock count.
65  *      LMEM_INVALID_HANDLE: Failure
66  */
67 UINT WINAPI LocalFlags(
68               HLOCAL handle /* [in] Handle of memory object */
69 ) {
70     return GlobalFlags( (HGLOBAL)handle );
71 }
72
73
74 /***********************************************************************
75  *           LocalFree   (KERNEL32.@)
76  * RETURNS
77  *      NULL: Success
78  *      Handle: Failure
79  */
80 HLOCAL WINAPI LocalFree(
81                 HLOCAL handle /* [in] Handle of memory object */
82 ) {
83     return (HLOCAL)GlobalFree( (HGLOBAL)handle );
84 }
85
86
87 /***********************************************************************
88  *           LocalHandle   (KERNEL32.@)
89  * RETURNS
90  *      Handle: Success
91  *      NULL: Failure
92  */
93 HLOCAL WINAPI LocalHandle(
94                 LPCVOID ptr /* [in] Address of local memory object */
95 ) {
96     return (HLOCAL)GlobalHandle( ptr );
97 }
98
99
100 /***********************************************************************
101  *           LocalLock   (KERNEL32.@)
102  * Locks a local memory object and returns pointer to the first byte
103  * of the memory block.
104  *
105  * RETURNS
106  *      Pointer: Success
107  *      NULL: Failure
108  */
109 LPVOID WINAPI LocalLock(
110               HLOCAL handle /* [in] Address of local memory object */
111 ) {
112     return GlobalLock( (HGLOBAL)handle );
113 }
114
115
116 /***********************************************************************
117  *           LocalReAlloc   (KERNEL32.@)
118  * RETURNS
119  *      Handle: Success
120  *      NULL: Failure
121  */
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 */
126 ) {
127     return (HLOCAL)GlobalReAlloc( (HGLOBAL)handle, size, flags );
128 }
129
130
131 /***********************************************************************
132  *           LocalShrink   (KERNEL32.@)
133  */
134 SIZE_T WINAPI LocalShrink( HGLOBAL handle, UINT newsize )
135 {
136     return 0;  /* LocalShrink does nothing in Win32 */
137 }
138
139
140 /***********************************************************************
141  *           LocalSize   (KERNEL32.@)
142  * RETURNS
143  *      Size: Success
144  *      0: Failure
145  */
146 SIZE_T WINAPI LocalSize(
147               HLOCAL handle /* [in] Handle of memory object */
148 ) {
149     return GlobalSize( (HGLOBAL)handle );
150 }
151
152
153 /***********************************************************************
154  *           LocalUnlock   (KERNEL32.@)
155  * RETURNS
156  *      TRUE: Object is still locked
157  *      FALSE: Object is unlocked
158  */
159 BOOL WINAPI LocalUnlock(
160               HLOCAL handle /* [in] Handle of memory object */
161 ) {
162     return GlobalUnlock( (HGLOBAL)handle );
163 }