Fixed HANDLE function prototypes and added some custom typedefs.