d692fda0dcecaa7791b4cc631231c33adfc84a7b
[reactos.git] / lib / user32 / windows / prop.c
1 /*
2  *  ReactOS kernel
3  *  Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
4  *
5  *  This program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2 of the License, or
8  *  (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with this program; if not, write to the Free Software
17  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19 /* $Id$
20  *
21  * PROJECT:         ReactOS user32.dll
22  * FILE:            lib/user32/windows/input.c
23  * PURPOSE:         Input
24  * PROGRAMMER:      Casper S. Hornstrup (chorns@users.sourceforge.net)
25  * UPDATE HISTORY:
26  *      09-05-2001  CSH  Created
27  */
28
29 /* INCLUDES ******************************************************************/
30
31 #include <windows.h>
32 #include <user32.h>
33 #include <debug.h>
34
35
36 /* FUNCTIONS *****************************************************************/
37
38 /*
39  * @unimplemented
40  */
41 int STDCALL
42 EnumPropsA(HWND hWnd, PROPENUMPROCA lpEnumFunc)
43 {
44   UNIMPLEMENTED;
45   return 0;
46 }
47
48
49 /*
50  * @unimplemented
51  */
52 int STDCALL
53 EnumPropsExA(HWND hWnd, PROPENUMPROCEXA lpEnumFunc, LPARAM lParam)
54 {
55   UNIMPLEMENTED;
56   return 0;
57 }
58
59
60 /*
61  * @unimplemented
62  */
63 int STDCALL
64 EnumPropsExW(HWND hWnd, PROPENUMPROCEXW lpEnumFunc, LPARAM lParam)
65 {
66   UNIMPLEMENTED;
67   return 0;
68 }
69
70
71 /*
72  * @unimplemented
73  */
74 int STDCALL
75 EnumPropsW(HWND hWnd, PROPENUMPROCW lpEnumFunc)
76 {
77   UNIMPLEMENTED;
78   return 0;
79 }
80
81
82 /*
83  * @implemented
84  */
85 HANDLE STDCALL
86 GetPropA(HWND hWnd, LPCSTR lpString)
87 {
88   PWSTR lpWString;
89   UNICODE_STRING UString;
90   HANDLE Ret;
91   if (HIWORD(lpString))
92     {
93       RtlCreateUnicodeStringFromAsciiz(&UString, (LPSTR)lpString);
94       lpWString = UString.Buffer;
95       if (lpWString == NULL)
96         {
97           return(FALSE);
98         }
99       Ret = GetPropW(hWnd, lpWString);
100       RtlFreeUnicodeString(&UString);
101     }
102   else
103     {
104       Ret = GetPropW(hWnd, (LPWSTR)lpString);
105     }  
106   return(Ret);
107 }
108
109
110 /*
111  * @implemented
112  */
113 HANDLE STDCALL
114 GetPropW(HWND hWnd, LPCWSTR lpString)
115 {
116   ATOM Atom;
117   if (HIWORD(lpString))
118     {
119       Atom = GlobalFindAtomW(lpString);
120     }
121   else
122     {
123       Atom = LOWORD((DWORD)lpString);
124     }
125   return(NtUserGetProp(hWnd, Atom));
126 }
127
128
129 /*
130  * @implemented
131  */
132 HANDLE STDCALL
133 RemovePropA(HWND hWnd, LPCSTR lpString)
134 {
135   PWSTR lpWString;
136   UNICODE_STRING UString;
137   HANDLE Ret;
138
139   if (HIWORD(lpString))
140     {
141       RtlCreateUnicodeStringFromAsciiz(&UString, (LPSTR)lpString);
142       lpWString = UString.Buffer;
143       if (lpWString == NULL)
144         {
145           return(FALSE);
146         }
147       Ret = RemovePropW(hWnd, lpWString);
148       RtlFreeUnicodeString(&UString);
149     }
150   else
151     {
152       Ret = RemovePropW(hWnd, (LPCWSTR)lpString);
153     }
154   return(Ret);
155 }
156
157
158 /*
159  * @implemented
160  */
161 HANDLE STDCALL
162 RemovePropW(HWND hWnd,
163             LPCWSTR lpString)
164 {
165   ATOM Atom;
166   if (HIWORD(lpString))
167     {
168       Atom = GlobalFindAtomW(lpString);
169     }
170   else
171     {
172       Atom = LOWORD((DWORD)lpString);
173     }
174   return(NtUserRemoveProp(hWnd, Atom));
175 }
176
177
178 /*
179  * @implemented
180  */
181 WINBOOL STDCALL
182 SetPropA(HWND hWnd, LPCSTR lpString, HANDLE hData)
183 {
184   PWSTR lpWString;
185   UNICODE_STRING UString;
186   BOOL Ret;
187   
188   if (HIWORD(lpString))
189     {
190       RtlCreateUnicodeStringFromAsciiz(&UString, (LPSTR)lpString);
191       lpWString = UString.Buffer;
192       if (lpWString == NULL)
193         {
194           return(FALSE);
195         }
196       Ret = SetPropW(hWnd, lpWString, hData);
197       RtlFreeUnicodeString(&UString);
198     }
199   else
200     {
201       Ret = SetPropW(hWnd, (LPWSTR)lpString, hData);
202     }
203   return(Ret);
204 }
205
206
207 /*
208  * @implemented
209  */
210 WINBOOL STDCALL
211 SetPropW(HWND hWnd, LPCWSTR lpString, HANDLE hData)
212 {
213   ATOM Atom;
214   if (HIWORD(lpString))
215     {
216       Atom = GlobalFindAtomW(lpString);
217     }
218   else
219     {
220       Atom = LOWORD((DWORD)lpString);
221     }
222   
223   return(NtUserSetProp(hWnd, Atom, hData));
224 }