Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between PATH_NOT_FOUND and NAME_NOT_FOUND

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.

like image 681
Benjamin Avatar asked Oct 14 '22 06:10

Benjamin


1 Answers

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.

like image 141
Hans Passant Avatar answered Oct 19 '22 12:10

Hans Passant