, AndyC wrote


You have to take two decisions for network shortcuts, assuming we aren't going to delete them when the network drive isn't available.

1) Is the network drive available?

2) Is the target of the shortcut available?

Those are the same step: Does CreateFile("\\networkpath\path\foo") fail with a file not found error code? If yes, then do something different.

It's the same anti-pattern that underlies all the IsBadXXXPtr type functions.

IsBadXXXPtr is a check, not a security check function. It is there to check that your arguments and the integrity of your application are valid, not to protect against malicious threads in your process changing things on the fly - because frankly if there's a malicious thread changing the protection of various bits of memory in your process, you've already long since lost your fight against those hackers.