Home |
RTTarget-32 Programming Manual Running Win32 Programs without Win32 Running a Program on the Target Win32 Handles Win32 Date and Time Management Win32 Thread Local Storage (TLS) Win32 API Function Cross Reference Alternate Heap Manager RTTHeap Compiling and Linking with On Time RTOS-32 |
Win32 HandlesRTTarget-32's Win32 emulation includes functions to manage Win32 handles. Various Win32 functions can allocate handles (e.g., CreateFile or CreateHeap). CloseHandle is normally used to close handles and objects associated with a handle. Handles are indirect references to an object. Several different handles can refer to a single object (for example, when a handle was duplicated with function DuplicateHandle). RTTarget-32's handle manager maintains tables to keep track of the different handles in use. However, these tables have a fixed size and thus limit the number of handles that can be open at any one time. You can adjust the number of available handles by including the following lines in the module which links library Rtt32.lib: #include <Rttarget.h> #define MAXHANDLES 64 #define MAXOBJECTS 64 #define MAXTYPES 32 RTW32Handle RTHandleTable[MAXHANDLES] = {{0}}; int RTHandleCount = MAXHANDLES; RTW32Object RTObjectTable[MAXOBJECTS] = {{0}}; int RTObjectCount = MAXOBJECTS; RTW32Types RTTypeTable[MAXTYPES] = {{0}}; int RTTypeCount = MAXTYPES; Constants MAXHANDLES, MAXOBJECTS, and MAXTYPES define the sizes of RTTarget-32's handle manager. The default values are given above. MAXHANDLES defines the maximum number of handles that can be open at any one time. Please consider that several predefined handles are opened automatically (e.g., for stdin and stdout). MAXOBJECTS defines how many objects can be referenced by handles. MAXTYPES specifies how many different object types (e.g., console file, RAM files, threads, events, etc.) will be supported. Function RTHandleInfo can be used to analyze the handle requirements of an application at run time and to adjust the tables' sizes appropriately.
|