caf219345a57e01c0ffd0bbc03e4218a6d6944fc
[reactos.git] / reactos / include / win32k / userobj.h
1 /* $Id: userobj.h,v 1.1 2001/07/06 00:05:05 rex Exp $
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * PURPOSE: USER Object manager interface definition
6 * FILE: include/win32k/userobj.h
7 * PROGRAMER: Rex Jolliff (rex@lvcablemodem.com)
8 *
9 */
10
11 #ifndef __WIN32K_USEROBJ_H
12 #define __WIN32K_USEROBJ_H
13
14 #include <ddk/ntddk.h>
15
16 #define UO_CLASS_MAGIC 0x5141
17 #define UO_WINDOW_MAGIC 0x5142
18 #define UO_MAGIC_DONTCARE 0xffff
19
20 #define USER_OBJECT_TAG (ULONG)(('W'<<0) + ('3'<<8) + ('2'<<16) + ('U'<<24))
21
22 typedef struct tag_USER_OBJECT_HEADER
23 {
24 WORD magic;
25 DWORD referenceCount;
26 LIST_ENTRY listEntry;
27 FAST_MUTEX mutex;
28 } USER_OBJECT_HEADER, *PUSER_OBJECT_HEADER;
29
30 typedef PVOID PUSER_OBJECT;
31 typedef HANDLE HUSEROBJ;
32
33 #define UserObjectHeaderToBody(header) ((PUSER_OBJECT)(((PCHAR)header)+sizeof(USER_OBJECT_HEADER)))
34 #define UserObjectBodyToHeader(body) ((PUSER_OBJECT_HEADER)(((PCHAR)body)-sizeof(USER_OBJECT_HEADER)))
35 #define UserObjectHeaderToHandle(header) ((HUSEROBJ)header)
36 #define UserObjectHandleToHeader(handle) ((HUSEROBJ)handle)
37
38 PUSER_OBJECT USEROBJ_AllocObject (WORD size, WORD magic);
39 BOOL USEROBJ_FreeObject (PUSER_OBJECT object, WORD magic);
40 HUSEROBJ USEROBJ_PtrToHandle (PUSER_OBJECT object, WORD magic);
41 PUSER_OBJECT USEROBJ_HandleToPtr (HUSEROBJ object, WORD magic);
42 BOOL USEROBJ_LockObject (HUSEROBJ Obj);
43 BOOL USEROBJ_UnlockObject (HUSEROBJ Obj);
44
45 #endif
46