mirror of https://github.com/tongzx/nt5src
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
127 lines
2.1 KiB
127 lines
2.1 KiB
/*++ BUILD Version: 0000 // Increment this if a change has global effects
|
|
|
|
Copyright (c) 1998 Microsoft Corporation
|
|
|
|
Module Name:
|
|
|
|
handle.h
|
|
|
|
Abstract:
|
|
|
|
Public definitions for handle table library
|
|
|
|
Author:
|
|
|
|
Dan Knudson (DanKn) 15-Sep-1998
|
|
|
|
Revision History:
|
|
|
|
--*/
|
|
|
|
|
|
typedef VOID (CALLBACK * FREECONTEXTCALLBACK)(LPVOID, LPVOID);
|
|
|
|
|
|
typedef struct _MYCONTEXT
|
|
{
|
|
LPVOID C;
|
|
|
|
LPVOID C2;
|
|
|
|
} MYCONTEXT, *PMYCONTEXT;
|
|
|
|
|
|
typedef struct _HANDLETABLEENTRY
|
|
{
|
|
// NOTE: ListEntry must be 1st field in structure so that we don't
|
|
// have to use CONTAINING_RECORD macro
|
|
|
|
union
|
|
{
|
|
LIST_ENTRY ListEntry;
|
|
MYCONTEXT Context;
|
|
};
|
|
|
|
DWORD Handle;
|
|
|
|
union
|
|
{
|
|
DWORD ReferenceCount;
|
|
DWORD Instance;
|
|
};
|
|
|
|
} HANDLETABLEENTRY, *PHANDLETABLEENTRY;
|
|
|
|
|
|
typedef struct _HANDLETABLEHEADER
|
|
{
|
|
HANDLE Heap;
|
|
PHANDLETABLEENTRY Table;
|
|
DWORD NumEntries;
|
|
DWORD HandleBase;
|
|
|
|
LIST_ENTRY FreeList;
|
|
|
|
FREECONTEXTCALLBACK FreeContextCallback;
|
|
|
|
CRITICAL_SECTION Lock;
|
|
|
|
} HANDLETABLEHEADER, *PHANDLETABLEHEADER;
|
|
|
|
|
|
HANDLE
|
|
CreateHandleTable(
|
|
HANDLE Heap,
|
|
FREECONTEXTCALLBACK FreeContextCallback,
|
|
DWORD MinHandleValue,
|
|
DWORD MaxHandleValue
|
|
);
|
|
|
|
VOID
|
|
DeleteHandleTable(
|
|
HANDLE HandleTable
|
|
);
|
|
|
|
DWORD
|
|
NewObject(
|
|
HANDLE HandleTable,
|
|
LPVOID Context,
|
|
LPVOID Context2
|
|
);
|
|
|
|
DWORD
|
|
NewObjectEx(
|
|
HANDLE HandleTable,
|
|
LPVOID Context,
|
|
LPVOID Context2,
|
|
DWORD ModBase,
|
|
DWORD Remainder
|
|
);
|
|
|
|
LPVOID
|
|
ReferenceObject(
|
|
HANDLE HandleTable,
|
|
DWORD Handle,
|
|
DWORD Key
|
|
);
|
|
|
|
LPVOID
|
|
ReferenceObjectEx(
|
|
HANDLE HandleTable,
|
|
DWORD Handle,
|
|
DWORD Key,
|
|
LPVOID *Context2
|
|
);
|
|
|
|
VOID
|
|
DereferenceObject(
|
|
HANDLE HandleTable,
|
|
DWORD Handle,
|
|
DWORD DereferenceCount
|
|
);
|
|
|
|
void
|
|
ReleaseAllHandles(
|
|
HANDLE HandleTable,
|
|
PVOID Context2
|
|
);
|