Adding support for paths longer than MAX_PATH

Also, used .net SafeHandle instead of my own