Update DeleteFileAltA.c

This commit is contained in:
vxunderground 2021-06-03 18:25:08 -05:00 committed by GitHub
parent b9d076a7b1
commit 81b33ce649
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,26 @@
BOOL DeleteFileAltA(PWCHAR Path)
/*
DeleteFileAlt function
Summary:
Deletes an existing file using the CreateFile FILE_FLAG_DELETE_ON_CLOSE flag.
Parameters:
- PCHAR Path
Path to file to delete
Return value:
TRUE for success, FALSE for failure. Use GetLastError or GetLastErrorAlt for more information
Remarks:
The code below uses IsPathValid, an existing function from WINAPI-TRICKS, to determine if the file path is valid
Author:
smelly__vx | June 3rd, 2021
*/
BOOL DeleteFileAltA(PCHAR Path)
{
HANDLE hHandle = INVALID_HANDLE_VALUE;
@ -12,8 +34,7 @@ BOOL DeleteFileAltA(PWCHAR Path)
if (hHandle == INVALID_HANDLE_VALUE)
return FALSE;
if (hHandle)
CloseHandle(hHandle);
CloseHandle(hHandle);
return TRUE;
}
}