Modify template to use IntPtr to avoid possible Ptr truncation.
IntPtr rather than UIntPtr was used to follow the practice
laid down by:
http://msdn.microsoft.com/en-us/library/ms973190.aspx