Fixed HANDLE data types in function declarations and added some custom typedefs.