More user fixes.
[reactos.git] / reactos / 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: prop.c,v 1.5 2002/09/17 23:46:23 dwelch Exp $
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 int STDCALL
39 EnumPropsA(HWND hWnd, PROPENUMPROC lpEnumFunc)
40 {
41 return 0;
42 }
43
44 int STDCALL
45 EnumPropsExA(HWND hWnd, PROPENUMPROCEX lpEnumFunc, LPARAM lParam)
46 {
47 return 0;
48 }
49
50 int STDCALL
51 EnumPropsExW(HWND hWnd, PROPENUMPROCEX lpEnumFunc, LPARAM lParam)
52 {
53 return 0;
54 }
55
56 int STDCALL
57 EnumPropsW(HWND hWnd, PROPENUMPROC lpEnumFunc)
58 {
59 return 0;
60 }
61
62 HANDLE STDCALL
63 GetPropA(HWND hWnd, LPCSTR lpString)
64 {
65 PWSTR lpWString;
66 UNICODE_STRING UString;
67 HANDLE Ret;
68 if (HIWORD(lpString))
69 {
70 RtlCreateUnicodeStringFromAsciiz(&UString, (LPSTR)lpString);
71 lpWString = UString.Buffer;
72 if (lpWString == NULL)
73 {
74 return(FALSE);
75 }
76 Ret = GetPropW(hWnd, lpWString);
77 RtlFreeUnicodeString(&UString);
78 }
79 else
80 {
81 Ret = GetPropW(hWnd, (LPWSTR)lpString);
82 }
83 return(Ret);
84 }
85
86 HANDLE STDCALL
87 GetPropW(HWND hWnd, LPCWSTR lpString)
88 {
89 ATOM Atom;
90 if (HIWORD(lpString))
91 {
92 Atom = GlobalFindAtomW(lpString);
93 }
94 else
95 {
96 Atom = LOWORD((DWORD)lpString);
97 }
98 return(NtUserGetProp(hWnd, Atom));
99 }
100
101 HANDLE STDCALL
102 RemovePropA(HWND hWnd, LPCSTR lpString)
103 {
104 PWSTR lpWString;
105 UNICODE_STRING UString;
106 HANDLE Ret;
107
108 if (HIWORD(lpString))
109 {
110 RtlCreateUnicodeStringFromAsciiz(&UString, (LPSTR)lpString);
111 lpWString = UString.Buffer;
112 if (lpWString == NULL)
113 {
114 return(FALSE);
115 }
116 Ret = RemovePropW(hWnd, lpWString);
117 RtlFreeUnicodeString(&UString);
118 }
119 else
120 {
121 Ret = RemovePropW(hWnd, lpWString);
122 }
123 return(Ret);
124 }
125
126 HANDLE STDCALL
127 RemovePropW(HWND hWnd,
128 LPCWSTR lpString)
129 {
130 ATOM Atom;
131 if (HIWORD(lpString))
132 {
133 Atom = GlobalFindAtomW(lpString);
134 }
135 else
136 {
137 Atom = LOWORD((DWORD)lpString);
138 }
139 return(NtUserRemoveProp(hWnd, Atom));
140 }
141
142 WINBOOL STDCALL
143 SetPropA(HWND hWnd, LPCSTR lpString, HANDLE hData)
144 {
145 PWSTR lpWString;
146 UNICODE_STRING UString;
147 BOOL Ret;
148
149 if (HIWORD(lpString))
150 {
151 RtlCreateUnicodeStringFromAsciiz(&UString, (LPSTR)lpString);
152 lpWString = UString.Buffer;
153 if (lpWString == NULL)
154 {
155 return(FALSE);
156 }
157 Ret = SetPropW(hWnd, lpWString, hData);
158 RtlFreeUnicodeString(&UString);
159 }
160 else
161 {
162 Ret = SetPropW(hWnd, (LPWSTR)lpString, hData);
163 }
164 return(Ret);
165 }
166
167 WINBOOL STDCALL
168 SetPropW(HWND hWnd, LPCWSTR lpString, HANDLE hData)
169 {
170 ATOM Atom;
171 if (HIWORD(lpString))
172 {
173 Atom = GlobalFindAtomW(lpString);
174 }
175 else
176 {
177 Atom = LOWORD((DWORD)lpString);
178 }
179
180 return(NtUserSetProp(hWnd, Atom, hData));
181 }