views:

38

answers:

1

In Win32 layer, we often meet ERROR_PATH_NOT_FOUND, ERROR_NAME_NOT_FOUND.

When does WinAPI(eg CreateFileW, RemoveDirectoryW) return these values? And What's the difference?

If I write a file system driver, when do I set STATUS_OBJECT_PATH_NOT_FOUND or STATUS_OBJECT_NAME_NOT_FOUND?

How do you determine?

I'm so confused. Is there anyone who can explain clearly?
Or are there any documents explain this? I couldn't find them.

Thanks in advance.

+2  A: 

ERROR_NAME_NOT_FOUND is not a standard Win32 API error code. Typical errors returned by file related APIs that take a file name are ERROR_FILE_NOT_FOUND and ERROR_PATH_NOT_FOUND. The best way to figure out what error code to return is use a WDK sample as a guide. The cdfs sample's create.c source code file for example. It returns STATUS_OBJECT_PATH_NOT_FOUND if it cannot locate a directory, STATUS_OBJECT_NAME_NOT_FOUND if it cannot locate a file.

Hans Passant
fast! clear! Thanks Hans. -ERROR_NAME_NOT_FOUND was my mistake :)
Benjamin