NtCreateFile - Return error while trying to create directory with non-directory flag

This commit is contained in:
Gliniak 2020-08-02 17:09:32 +02:00
parent b3103c6327
commit 90d1772c4a
2 changed files with 6 additions and 0 deletions

View File

@ -105,6 +105,11 @@ dword_result_t NtCreateFile(lpdword_t handle_out, dword_t desired_access,
return X_STATUS_OBJECT_NAME_INVALID;
}
if (target_path.back() == '\\' &&
create_options & CreateOptions::FILE_NON_DIRECTORY_FILE) {
return X_STATUS_FILE_IS_A_DIRECTORY;
}
if (object_attrs->root_directory != 0xFFFFFFFD && // ObDosDevices
object_attrs->root_directory != 0) {
auto root_file = kernel_state()->object_table()->LookupObject<XFile>(

View File

@ -64,6 +64,7 @@ typedef uint32_t X_STATUS;
#define X_STATUS_PROCEDURE_NOT_FOUND ((X_STATUS)0xC000007AL)
#define X_STATUS_INSUFFICIENT_RESOURCES ((X_STATUS)0xC000009AL)
#define X_STATUS_MEMORY_NOT_ALLOCATED ((X_STATUS)0xC00000A0L)
#define X_STATUS_FILE_IS_A_DIRECTORY ((X_STATUS)0xC00000BAL)
#define X_STATUS_NOT_SUPPORTED ((X_STATUS)0xC00000BBL)
#define X_STATUS_INVALID_PARAMETER_1 ((X_STATUS)0xC00000EFL)
#define X_STATUS_INVALID_PARAMETER_2 ((X_STATUS)0xC00000F0L)