BOOL InitHandles() { // Try and get some memory from the OS for my lovely table HandleTableTotalSize = HandleTableByteSize; ElementsInHandleTable = HandleTableSize; HandlesInUse = 0; HandlesTable = (HandleTableElement*) HandlesMemory.Init( HandleTableTotalSize, TRUE, MEMORYBLOCK_RELOCHEAP); // check to see if we got the ram needed if (HandlesTable==NULL) return FALSE; // init all the elements in the table to a non-existent handle for (UINT32 n=0; n<ElementsInHandleTable; n++) { // Set the Address to Bad HandlesTable[n].Address = PBYTE(BAD_MHANDLE); // if we are using unique IDs, set it to zero #ifdef USE_UNIQUE_IDS HandlesTable[n].UniqueID = 0; #endif } // All worked return TRUE; }