Thursday, June 12, 2008

SHFileOperation / Vista and oh boy ...

Yesterday I reported problems using SHFileOperation on Vista in a multi threading application. I experienced problems overwriting files when running Vista. The problems didn't occur running XP or Windows 2003 server.

For starters: it has nothing to do with multi threading applications - that was a false assessment on my part. I should stop working so late :-(

Comments from other programmers made me look again and create a small program that demonstrated the problem. I could not reproduce it using the small demo. So what gives?

It turned out the problems were cause by the specification of the file paths. The program I'm working on synchronizes folders, having the source on the web or on a local file system.

It turned out I was feeding paths using a '/' as a folder delimiter instead of a '\'. XP and Windows 2003 don't have a problem with that, Vista does...

In this case, changing the forward slashes to backslashes solved the problem. Still, kind of weird, but a smaller problem than SHFileOperation not being thread safe.

Bye,
Bart

1 comment:

Anonymous said...

That's why SHFileOperation was replaced with IFileOperation in windows Vista.