Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .claude/settings.local.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
"Bash(openspec instructions:*)",
"Bash(./build/bin/runTests.exe --gtest_filter=\"KernelPerf*\")",
"Bash(powershell -Command \"Start-Process cmake -ArgumentList ''--build'',''build'',''--target'',''install_WinKernelLite'',''--config'',''Debug'' -Verb RunAs -Wait\")",
"Bash(openspec list:*)"
"Bash(openspec list:*)",
"Bash(grep -r \"#include\" /c/projects/winkernellite/include/*.h)",
"Bash(grep -r \"^#ifndef\\\\|^#define\" /c/projects/winkernellite/include/*.h)",
"Bash(grep:*)",
"Bash(./build/bin/runTests.exe)"
]
}
}
80 changes: 0 additions & 80 deletions include/File.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,84 +145,4 @@ NTSTATUS ZwCreateFile(
}
#endif

// Implementation of user mode file functions

inline NTSTATUS ZwCreateFile(
OUT PHANDLE FileHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes,
OUT PIO_STATUS_BLOCK IoStatusBlock,
IN PLARGE_INTEGER AllocationSize OPTIONAL,
IN ULONG FileAttributes,
IN ULONG ShareAccess,
IN ULONG CreateDisposition,
IN ULONG CreateOptions,
IN PVOID EaBuffer OPTIONAL,
IN ULONG EaLength
)
{
// Validate parameters
if (!FileHandle || !ObjectAttributes || !ObjectAttributes->ObjectName || !IoStatusBlock) {
return STATUS_INVALID_PARAMETER;
}

// These parameters are not used in this implementation
UNREFERENCED_PARAMETER(AllocationSize);
UNREFERENCED_PARAMETER(EaBuffer);
UNREFERENCED_PARAMETER(EaLength);

// Convert NT CreateDisposition to Win32 CreateDisposition
DWORD dwCreationDisposition;
switch (CreateDisposition) {
case FILE_SUPERSEDE:
case FILE_OVERWRITE_IF:
dwCreationDisposition = CREATE_ALWAYS;
break;
case FILE_CREATE:
dwCreationDisposition = CREATE_NEW;
break;
case FILE_OPEN:
dwCreationDisposition = OPEN_EXISTING;
break;
case FILE_OPEN_IF:
dwCreationDisposition = OPEN_ALWAYS;
break;
case FILE_OVERWRITE:
dwCreationDisposition = TRUNCATE_EXISTING;
break;
default:
return STATUS_INVALID_PARAMETER;
}

// Create file with CreateFileW
*FileHandle = CreateFileW(
ObjectAttributes->ObjectName->Buffer,
DesiredAccess,
ShareAccess,
NULL, // Security attributes not supported
dwCreationDisposition,
FileAttributes | (CreateOptions & 0x00FFFFFF), // Convert relevant options
NULL // Template file not supported
);

if (*FileHandle == INVALID_HANDLE_VALUE) {
DWORD error = GetLastError();
IoStatusBlock->Status = STATUS_UNSUCCESSFUL;

if (error == ERROR_FILE_NOT_FOUND) {
return STATUS_OBJECT_NAME_NOT_FOUND;
} else if (error == ERROR_ACCESS_DENIED) {
return STATUS_ACCESS_DENIED;
} else {
return STATUS_UNSUCCESSFUL;
}
}

IoStatusBlock->Status = STATUS_SUCCESS;
IoStatusBlock->Information = FILE_OPENED; // Simplified - real implementation would have more accurate information
return STATUS_SUCCESS;
}



#endif // WINKERNEL_FILE_H
Loading
Loading