The MASM Forum

General => The Campus => Topic started by: Magnum on January 28, 2014, 03:15:03 AM

Title: DeleteFile and SHFileOperation
Post by: Magnum on January 28, 2014, 03:15:03 AM
I am curious as to why there are different error messages when a file does not exist.

If an application attempts to delete a file that does not exist, the DeleteFile function fails with ERROR_FILE_NOT_FOUND

While SHFileOperation returns

ERROR_INVALID_HANDLE

    6 (0x6)

    The handle is invalid.
Title: Re: DeleteFile and SHFileOperation
Post by: jj2007 on January 28, 2014, 05:11:08 AM
Do not use GetLastError with the return values of this function. (http://msdn.microsoft.com/en-us/library/windows/desktop/bb762164%28v=vs.85%29.aspx)
Title: Re: DeleteFile and SHFileOperation
Post by: Magnum on January 28, 2014, 06:04:34 AM
Thanks Jochen.

Andy