Fixed some handle type mismatches and added a few casts in prevision
of void* handles.

28 files changed