Release 960225
[wine.git] / include / handle32.h
blob08ab132d8b09ed6f52d9b0d5cd690f889f2e326a
1 #ifndef __WINE_HANDLE32_H
2 #define __WINE_HANDLE32_H
4 #include <malloc.h>
5 #include "wintypes.h"
7 /* The _*_OBJECT structures contain information needed about each
8 * particular type of handle. This information is a combination of
9 * equivalent UNIX-style handles/descriptors and general information
10 * that the Win32 API might request.
12 * The KERNEL_OBJECT structure must be the first member of any specific
13 * kernel object type's structure.
16 typedef struct {
17 unsigned long magic;
18 } KERNEL_OBJECT, *HANDLE32;
20 typedef struct {
21 KERNEL_OBJECT common;
22 unsigned long thread_id;
23 unsigned long process_id;
24 } THREAD_OBJECT;
26 typedef struct {
27 KERNEL_OBJECT common;
28 unsigned long process_id;
29 unsigned long main_thread_id;
30 } PROCESS_OBJECT;
32 /* The FILE object includes things like disk files, pipes, and
33 * character devices (com ports, consoles, ...).
35 typedef struct {
36 KERNEL_OBJECT common;
37 int fd; /* UNIX fd */
38 int type; /* FILE_TYPE_* */
39 unsigned long misc_flags; /* special flags */
40 unsigned long access_flags; /* UNIX access flags */
41 unsigned long create_flags; /* UNIX creation flags */
42 } FILE_OBJECT;
44 typedef struct {
45 KERNEL_OBJECT common;
46 FILE_OBJECT *file_obj;
47 int prot;
48 unsigned long size;
49 } FILEMAP_OBJECT;
51 typedef struct {
52 KERNEL_OBJECT common;
53 } SEMAPHORE_OBJECT;
55 typedef struct {
56 KERNEL_OBJECT common;
57 } EVENT_OBJECT;
59 /* Should this even be here?
61 typedef struct {
62 KERNEL_OBJECT common;
63 } REGKEY_OBJECT;
65 typedef struct _VRANGE_OBJECT{
66 KERNEL_OBJECT common;
67 DWORD start;
68 DWORD size;
69 struct _VRANGE_OBJECT *next;
70 } VRANGE_OBJECT;
72 struct _HEAPITEM_OBJECT;
73 typedef struct{
74 KERNEL_OBJECT common;
75 LPVOID start;
76 DWORD size;
77 DWORD maximum;
78 DWORD flags;
79 struct _HEAPITEM_OBJECT *first,*last;
80 } HEAP_OBJECT;
82 typedef struct _HEAPITEM_OBJECT{
83 KERNEL_OBJECT common;
84 HEAP_OBJECT *heap;
85 DWORD size; /* size including header */
86 struct _HEAPITEM_OBJECT *next,*prev;
87 } HEAPITEM_OBJECT;
90 /* Object number definitions. These numbers are used to
91 * validate the kernel object by comparison against the
92 * object's 'magic' value.
94 #define KERNEL_OBJECT_UNUSED 2404554046UL
95 #define KERNEL_OBJECT_THREAD (KERNEL_OBJECT_UNUSED + 1)
96 #define KERNEL_OBJECT_PROCESS (KERNEL_OBJECT_UNUSED + 2)
97 #define KERNEL_OBJECT_FILE (KERNEL_OBJECT_UNUSED + 3)
98 #define KERNEL_OBJECT_SEMAPHORE (KERNEL_OBJECT_UNUSED + 4)
99 #define KERNEL_OBJECT_EVENT (KERNEL_OBJECT_UNUSED + 5)
100 #define KERNEL_OBJECT_REGKEY (KERNEL_OBJECT_UNUSED + 6)
101 #define KERNEL_OBJECT_FILEMAP (KERNEL_OBJECT_UNUSED + 7)
102 #define KERNEL_OBJECT_VRANGE (KERNEL_OBJECT_UNUSED + 8)
103 #define KERNEL_OBJECT_HEAP (KERNEL_OBJECT_UNUSED + 9)
104 #define KERNEL_OBJECT_HEAPITEM (KERNEL_OBJECT_UNUSED + 10)
106 /* Define the invalid handle value
108 #define INVALID_HANDLE_VALUE ((HANDLE32)-1)
110 /* Functions for checking kernel objects.
112 int ValidateKernelObject(KERNEL_OBJECT *ptr);
114 /* For now, CreateKernelObject and ReleaseKernelObject will
115 * simply map to malloc() and free().
117 #define CreateKernelObject(size) (malloc(size))
118 #define ReleaseKernelObject(ptr) (free(ptr))
120 /* Prototypes for the Close*Handle functions
122 int CloseFileHandle(FILE_OBJECT *hFile);
124 #endif /* __WINE_HANDLE32_H */