views:

73

answers:

1

I previously asked, How to determine the target of a symbolic link or Reparse Point? ...and got an answer that suggested the use of the Win32 function GetFinalPathNameByHandle, a function first available on Vista.

What happens if I build the .NET Assembly and then attempt to run it on WinXP, or WS2003, which does not have the GetFinalPathNameByHandle function? Is there a runtime exception, and if so, which one? Is there a way for me to handle that case in the app code?

+7  A: 

You'll get an EntryPointNotFoundException when you call the method.

If the entire DLL file doesn't exist, you'll get a DllNotFoundException instead.

SLaks
And those exceptions are normal, catchable?
Cheeso
Yes. What makes you think they wouldn't be?
Paul Baker
Using LoadLibrary, GetProcAddress, FreeLibrary can avoid the exception. Not sure if that make sense if you can't support the functionality anyway.
Hans Passant