*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
+#include "ntstatus.h"
+#define WIN32_NO_STATUS
#include "windef.h"
-#include "winbase.h"
-#include "winreg.h"
#include "winternl.h"
#include "wine/debug.h"
#include "ntdll_misc.h"
*/
void WINAPI RtlInitializeHandleTable(ULONG MaxHandleCount, ULONG HandleSize, RTL_HANDLE_TABLE * HandleTable)
{
- TRACE("(%lu, %lu, %p)\n", MaxHandleCount, HandleSize, HandleTable);
+ TRACE("(%u, %u, %p)\n", MaxHandleCount, HandleSize, HandleTable);
memset(HandleTable, 0, sizeof(*HandleTable));
HandleTable->MaxHandleCount = MaxHandleCount;
*/
NTSTATUS WINAPI RtlDestroyHandleTable(RTL_HANDLE_TABLE * HandleTable)
{
- ULONG Size = 0;
+ SIZE_T Size = 0;
TRACE("(%p)\n", HandleTable);
if (!HandleTable->FirstHandle)
{
PVOID FirstHandleAddr = NULL;
- ULONG MaxSize = HandleTable->MaxHandleCount * HandleTable->HandleSize;
+ SIZE_T MaxSize = HandleTable->MaxHandleCount * HandleTable->HandleSize;
/* reserve memory for the handles, but don't commit it yet because we
* probably won't use most of it and it will use up physical memory */
}
if (!HandleTable->NextFree)
{
- ULONG CommitSize = 4096; /* one page */
- ULONG Offset;
+ SIZE_T Offset, CommitSize = 4096; /* one page */
RTL_HANDLE * FreeHandle = NULL;
PVOID NextAvailAddr = HandleTable->ReservedMemory;
* Success: Pointer to allocated handle.
* Failure: NULL.
*
+ * NOTES
+ * A valid handle must have the bit set as indicated in the code below
+ * otherwise subsequent RtlIsValidHandle() calls will fail.
+ *
+ * static inline void RtlpMakeHandleAllocated(RTL_HANDLE * Handle)
+ * {
+ * ULONG_PTR *AllocatedBit = (ULONG_PTR *)(&Handle->Next);
+ * *AllocatedBit = *AllocatedBit | 1;
+ * }
+ *
* SEE
* RtlFreeHandle().
*/
{
RTL_HANDLE * Handle;
- TRACE("(%p, %lu, %p)\n", HandleTable, Index, ValidHandle);
+ TRACE("(%p, %u, %p)\n", HandleTable, Index, ValidHandle);
Handle = (RTL_HANDLE *)
((char *)HandleTable->FirstHandle + Index * HandleTable->HandleSize);