Make kernel32 function setup more compact.

This change makes the kernel32 function setup more compact so as to make it
easier to maintain and less error prone.