ReactOS 0.4.15-dev-7693-gd0e2924
prop.c File Reference
#include <user32.h>
Include dependency graph for prop.c:

Go to the source code of this file.

Macros

#define ATOM_BUFFER_SIZE   256
 

Functions

HANDLE FASTCALL IntGetProp (HWND hWnd, ATOM Atom, BOOLEAN SystemProp)
 
HANDLE FASTCALL UserGetProp (HWND hWnd, ATOM Atom, BOOLEAN SystemProp)
 
int WINAPI EnumPropsA (HWND hWnd, PROPENUMPROCA lpEnumFunc)
 
int WINAPI EnumPropsExA (HWND hWnd, PROPENUMPROCEXA lpEnumFunc, LPARAM lParam)
 
int WINAPI EnumPropsExW (HWND hWnd, PROPENUMPROCEXW lpEnumFunc, LPARAM lParam)
 
int WINAPI EnumPropsW (HWND hWnd, PROPENUMPROCW lpEnumFunc)
 
HANDLE WINAPI GetPropA (HWND hWnd, LPCSTR lpString)
 
HANDLE WINAPI GetPropW (HWND hWnd, LPCWSTR lpString)
 
HANDLE WINAPI RemovePropA (HWND hWnd, LPCSTR lpString)
 
HANDLE WINAPI RemovePropW (HWND hWnd, LPCWSTR lpString)
 
BOOL WINAPI SetPropA (HWND hWnd, LPCSTR lpString, HANDLE hData)
 
BOOL WINAPI SetPropW (HWND hWnd, LPCWSTR lpString, HANDLE hData)
 

Macro Definition Documentation

◆ ATOM_BUFFER_SIZE

#define ATOM_BUFFER_SIZE   256

Definition at line 32 of file prop.c.

Function Documentation

◆ EnumPropsA()

int WINAPI EnumPropsA ( HWND  hWnd,
PROPENUMPROCA  lpEnumFunc 
)

Definition at line 79 of file prop.c.

80{
81 PPROPLISTITEM pli, i;
84 int ret = -1;
85
86 if(!lpEnumFunc)
87 {
89 return ret;
90 }
91
93 if(!NT_SUCCESS(Status))
94 {
97 else
99 return ret;
100 }
101
102 if(Count > 0)
103 {
105 if (pli == NULL)
106 {
108 return -1;
109 }
110
112 if(!NT_SUCCESS(Status))
113 {
114 RtlFreeHeap(GetProcessHeap(), 0, pli);
117 else
119 return ret;
120 }
121
122 i = pli;
123 for(; Count > 0; Count--, i++)
124 {
125 char str[ATOM_BUFFER_SIZE];
126
128 continue;
129
130 ret = lpEnumFunc(hWnd, str, i->Data);
131 if(!ret)
132 break;
133 }
134
135 RtlFreeHeap(GetProcessHeap(), 0, pli);
136 }
137
138 return ret;
139}
HWND hWnd
Definition: settings.c:17
LONG NTSTATUS
Definition: precomp.h:26
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define GetProcessHeap()
Definition: compat.h:736
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
UINT WINAPI GlobalGetAtomNameA(ATOM nAtom, LPSTR lpBuffer, int nSize)
Definition: atom.c:484
unsigned long DWORD
Definition: ntddk_ex.h:95
Status
Definition: gdiplustypes.h:25
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
NTSTATUS NTAPI NtUserBuildPropList(HWND hWnd, LPVOID Buffer, DWORD BufferSize, DWORD *Count)
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
int Count
Definition: noreturn.cpp:7
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:245
const WCHAR * str
int ret
#define ATOM_BUFFER_SIZE
Definition: prop.c:32
#define ERROR_INVALID_WINDOW_HANDLE
Definition: winerror.h:881

◆ EnumPropsExA()

int WINAPI EnumPropsExA ( HWND  hWnd,
PROPENUMPROCEXA  lpEnumFunc,
LPARAM  lParam 
)

Definition at line 146 of file prop.c.

147{
148 PPROPLISTITEM pli, i;
150 DWORD Count;
151 int ret = -1;
152
153 if(!lpEnumFunc)
154 {
156 return ret;
157 }
158
160 if(!NT_SUCCESS(Status))
161 {
164 else
166 return ret;
167 }
168
169 if(Count > 0)
170 {
172 if (pli == NULL)
173 {
175 return -1;
176 }
177
179 if(!NT_SUCCESS(Status))
180 {
181 RtlFreeHeap(GetProcessHeap(), 0, pli);
184 else
186 return ret;
187 }
188
189 i = pli;
190 for(; Count > 0; Count--, i++)
191 {
192 char str[ATOM_BUFFER_SIZE];
193
195 continue;
196
197 ret = lpEnumFunc(hWnd, str, i->Data, lParam);
198 if(!ret)
199 break;
200 }
201
202 RtlFreeHeap(GetProcessHeap(), 0, pli);
203 }
204
205 return ret;
206}
LPARAM lParam
Definition: combotst.c:139

◆ EnumPropsExW()

int WINAPI EnumPropsExW ( HWND  hWnd,
PROPENUMPROCEXW  lpEnumFunc,
LPARAM  lParam 
)

Definition at line 213 of file prop.c.

214{
215 PPROPLISTITEM pli, i;
217 DWORD Count;
218 int ret = -1;
219
220 if(!lpEnumFunc)
221 {
223 return ret;
224 }
225
227 if(!NT_SUCCESS(Status))
228 {
231 else
233 return ret;
234 }
235
236 if(Count > 0)
237 {
239 if (pli == NULL)
240 {
242 return -1;
243 }
244
246 if(!NT_SUCCESS(Status))
247 {
248 RtlFreeHeap(GetProcessHeap(), 0, pli);
251 else
253 return ret;
254 }
255
256 i = pli;
257 for(; Count > 0; Count--, i++)
258 {
260
262 continue;
263
264 ret = lpEnumFunc(hWnd, str, i->Data, lParam);
265 if(!ret)
266 break;
267 }
268
269 RtlFreeHeap(GetProcessHeap(), 0, pli);
270 }
271
272 return ret;
273}
UINT WINAPI GlobalGetAtomNameW(ATOM nAtom, LPWSTR lpBuffer, int nSize)
Definition: atom.c:496
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ EnumPropsW()

int WINAPI EnumPropsW ( HWND  hWnd,
PROPENUMPROCW  lpEnumFunc 
)

Definition at line 280 of file prop.c.

281{
282 PPROPLISTITEM pli, i;
284 DWORD Count;
285 int ret = -1;
286
287 if(!lpEnumFunc)
288 {
290 return ret;
291 }
292
294 if(!NT_SUCCESS(Status))
295 {
298 else
300 return ret;
301 }
302
303 if(Count > 0)
304 {
306 if (pli == NULL)
307 {
309 return -1;
310 }
311
313 if(!NT_SUCCESS(Status))
314 {
315 RtlFreeHeap(GetProcessHeap(), 0, pli);
318 else
320 return ret;
321 }
322
323 i = pli;
324 for(; Count > 0; Count--, i++)
325 {
327
329 continue;
330
331 ret = lpEnumFunc(hWnd, str, i->Data);
332 if(!ret)
333 break;
334 }
335
336 RtlFreeHeap(GetProcessHeap(), 0, pli);
337 }
338
339 return ret;
340}

◆ GetPropA()

HANDLE WINAPI GetPropA ( HWND  hWnd,
LPCSTR  lpString 
)

Definition at line 347 of file prop.c.

348{
349 PWSTR lpWString;
350 UNICODE_STRING UString;
351 HANDLE Ret;
352 if (HIWORD(lpString))
353 {
354 RtlCreateUnicodeStringFromAsciiz(&UString, (LPSTR)lpString);
355 lpWString = UString.Buffer;
356 if (lpWString == NULL)
357 {
358 return(FALSE);
359 }
360 Ret = GetPropW(hWnd, lpWString);
361 RtlFreeUnicodeString(&UString);
362 }
363 else
364 {
365 Ret = GetPropW(hWnd, (LPWSTR)lpString);
366 }
367 return(Ret);
368}
#define FALSE
Definition: types.h:117
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
uint16_t * PWSTR
Definition: typedefs.h:56
#define HIWORD(l)
Definition: typedefs.h:247
HANDLE WINAPI GetPropW(HWND hWnd, LPCWSTR lpString)
Definition: prop.c:375
char * LPSTR
Definition: xmlstorage.h:182
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ GetPropW()

HANDLE WINAPI GetPropW ( HWND  hWnd,
LPCWSTR  lpString 
)

Definition at line 375 of file prop.c.

376{
377 ATOM Atom;
378 HANDLE Data = NULL;
379 PPROPERTY Prop;
380 if (HIWORD(lpString))
381 {
382 Atom = GlobalFindAtomW(lpString);
383 }
384 else
385 {
386 Atom = LOWORD((DWORD_PTR)lpString);
387 }
388 Prop = IntGetProp(hWnd, Atom, FALSE);
389 if (Prop != NULL) Data = Prop->Data;
390 return Data;
391}
_Out_ RTL_ATOM * Atom
Definition: class.h:54
WORD ATOM
Definition: dimm.idl:113
ATOM WINAPI GlobalFindAtomW(LPCWSTR lpString)
Definition: atom.c:474
#define LOWORD(l)
Definition: pedump.c:82
HANDLE Data
Definition: ntuser.h:1101
uint32_t DWORD_PTR
Definition: typedefs.h:65
PPROPERTY FASTCALL IntGetProp(_In_ PWND Window, _In_ ATOM Atom, _In_ BOOLEAN SystemProp)
Definition: prop.c:16

Referenced by GetPropA().

◆ IntGetProp()

HANDLE FASTCALL IntGetProp ( HWND  hWnd,
ATOM  Atom,
BOOLEAN  SystemProp 
)

Definition at line 38 of file prop.c.

39{
40 PLIST_ENTRY ListEntry, temp;
42 PWND pWnd;
43 int i;
44 WORD SystemFlag = SystemProp ? PROPERTY_FLAG_SYSTEM : 0;
45
46 pWnd = ValidateHwnd(hWnd);
47 if (!pWnd) return NULL;
48
49 ListEntry = SharedPtrToUser(pWnd->PropListHead.Flink);
50 for (i = 0; i < pWnd->PropListItems; i++ )
51 {
52 Property = CONTAINING_RECORD(ListEntry, PROPERTY, PropListEntry);
53 if (Property->Atom == Atom &&
54 (Property->fs & PROPERTY_FLAG_SYSTEM) == SystemFlag)
55 {
56 return(Property);
57 }
58 temp = ListEntry->Flink;
59 ListEntry = SharedPtrToUser(temp);
60 }
61 return NULL;
62}
#define ValidateHwnd(hwnd)
Definition: precomp.h:85
unsigned short WORD
Definition: ntddk_ex.h:93
#define PROPERTY_FLAG_SYSTEM
Definition: ntuser.h:1096
_In_ ATOM _In_ HANDLE _In_ BOOLEAN SystemProp
Definition: prop.h:24
static calc_node_t temp
Definition: rpn_ieee.c:38
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
Definition: ntuser.h:694
ULONG PropListItems
Definition: ntuser.h:724
LIST_ENTRY PropListHead
Definition: ntuser.h:723
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
static __inline PVOID SharedPtrToUser(PVOID Ptr)
Definition: user_x.h:4

◆ RemovePropA()

HANDLE WINAPI RemovePropA ( HWND  hWnd,
LPCSTR  lpString 
)

Definition at line 398 of file prop.c.

399{
400 PWSTR lpWString;
401 UNICODE_STRING UString;
402 HANDLE Ret;
403
404 if (HIWORD(lpString))
405 {
406 RtlCreateUnicodeStringFromAsciiz(&UString, (LPSTR)lpString);
407 lpWString = UString.Buffer;
408 if (lpWString == NULL)
409 {
410 return(FALSE);
411 }
412 Ret = RemovePropW(hWnd, lpWString);
413 RtlFreeUnicodeString(&UString);
414 }
415 else
416 {
417 Ret = RemovePropW(hWnd, (LPCWSTR)lpString);
418 }
419 return(Ret);
420}
HANDLE WINAPI RemovePropW(HWND hWnd, LPCWSTR lpString)
Definition: prop.c:427
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

◆ RemovePropW()

HANDLE WINAPI RemovePropW ( HWND  hWnd,
LPCWSTR  lpString 
)

Definition at line 427 of file prop.c.

429{
430 ATOM Atom;
431 if (HIWORD(lpString))
432 {
433 Atom = GlobalFindAtomW(lpString);
434 }
435 else
436 {
437 Atom = LOWORD((DWORD_PTR)lpString);
438 }
439 return(NtUserRemoveProp(hWnd, Atom));
440}
HANDLE NTAPI NtUserRemoveProp(HWND hWnd, ATOM Atom)

Referenced by RemovePropA().

◆ SetPropA()

BOOL WINAPI SetPropA ( HWND  hWnd,
LPCSTR  lpString,
HANDLE  hData 
)

Definition at line 447 of file prop.c.

448{
449 PWSTR lpWString;
450 UNICODE_STRING UString;
451 BOOL Ret;
452
453 if (HIWORD(lpString))
454 {
455 RtlCreateUnicodeStringFromAsciiz(&UString, (LPSTR)lpString);
456 lpWString = UString.Buffer;
457 if (lpWString == NULL)
458 {
459 return(FALSE);
460 }
461 Ret = SetPropW(hWnd, lpWString, hData);
462 RtlFreeUnicodeString(&UString);
463 }
464 else
465 {
466 Ret = SetPropW(hWnd, (LPWSTR)lpString, hData);
467 }
468 return(Ret);
469}
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI SetPropW(HWND hWnd, LPCWSTR lpString, HANDLE hData)
Definition: prop.c:476

◆ SetPropW()

BOOL WINAPI SetPropW ( HWND  hWnd,
LPCWSTR  lpString,
HANDLE  hData 
)

Definition at line 476 of file prop.c.

477{
478 ATOM Atom;
479 if (HIWORD(lpString))
480 {
481 Atom = GlobalAddAtomW(lpString);
482 }
483 else
484 {
485 Atom = LOWORD((DWORD_PTR)lpString);
486 }
487
488 return(NtUserSetProp(hWnd, Atom, hData));
489}
ATOM WINAPI GlobalAddAtomW(LPCWSTR lpString)
Definition: atom.c:444
BOOL NTAPI NtUserSetProp(HWND hWnd, ATOM Atom, HANDLE Data)

Referenced by SetPropA().

◆ UserGetProp()

HANDLE FASTCALL UserGetProp ( HWND  hWnd,
ATOM  Atom,
BOOLEAN  SystemProp 
)

Definition at line 66 of file prop.c.

67{
68 PPROPERTY Prop;
70 return Prop ? Prop->Data : NULL;
71}