Fixes AsShared texture returning 0 on 64bits

IntPtr is a platform dependent type so casting it to uint (32bits)
will loose precision on 64bit platforms making the pointer invalid
sometimes.

This fixes the problem by making the pins ulong (64bits) and not
casting to 32bits in any place, but all plugins or patches using
AsSharedTexture should be changed to 64bits / ulong too.