replace the VHD/diskpart disk image pipeline with a directory-based vvfat root, we'll see when it breaks, fix /O2, add an all_tests, generalize the fat32 driver into a fat 16+32 driver, change policy on volume drivers, collapse KCPU's fields into a single atomic KE_CPU_STATE state machine, move scheduler ticking to per-CPU LAPIC timers, gate verbose SMP topology logging behind selftest diagnostics and add SMP pool-checkpoint validation around AP admission, add checked intrusive list helpers behind a new KE_DEBUG_LIST_CHECKS flag, add ObInitializeObjectHeader/ObTryReferenceObject, add waitable display clock objects and a SYS_OPEN_DISPLAY_CLOCK syscall for vsync-style waits, refactor kernel input into a per-queue KE_INPUT_CONTEXT with its own key/mouse ring buffers and DPC-driven key repeat, add KeInputQueuePeekEvent/ReadEvent/WaitKey and a SYS_QUERY_GLOBAL_INPUT_STATE syscall, split the kernel pool allocator out of mm_virt, new video files!
This commit is contained in:
1 parent
485a6bbfe7
commit
8b254f84f4
74 files changed
+4488
-2503
No files matched your search
@@ -94,12 +94,56 @@ static void cmd_write(const char* args) {
|
||||
print("File written successfully.\n");
|
||||
}
|
||||
|
||||
typedef struct SHELL_WIN32_DIR_ENTRY {
|
||||
char Name[MAX_PATH];
|
||||
DWORD Attributes;
|
||||
} SHELL_WIN32_DIR_ENTRY;
|
||||
|
||||
// Returns an ASCII lower-case value for case-insensitive directory sorting.
|
||||
static char shellAsciiLower(char c) {
|
||||
if (c >= 'A' && c <= 'Z')
|
||||
return (char)(c - 'A' + 'a');
|
||||
return c;
|
||||
}
|
||||
|
||||
// Compares two names using case-insensitive order with a stable case tie-breaker.
|
||||
static int shellCompareNames(const char* a, const char* b) {
|
||||
size_t i = 0;
|
||||
if (!a) a = "";
|
||||
if (!b) b = "";
|
||||
|
||||
for (;;) {
|
||||
char ca = shellAsciiLower(a[i]);
|
||||
char cb = shellAsciiLower(b[i]);
|
||||
if (ca != cb)
|
||||
return (ca < cb) ? -1 : 1;
|
||||
if (ca == '\0')
|
||||
break;
|
||||
i++;
|
||||
}
|
||||
|
||||
return strcmp(a, b);
|
||||
}
|
||||
|
||||
// Sorts directory entries alphabetically.
|
||||
static void shellSortDirEntries(SHELL_WIN32_DIR_ENTRY* entries, size_t count) {
|
||||
for (size_t i = 1; i < count; i++) {
|
||||
SHELL_WIN32_DIR_ENTRY current = entries[i];
|
||||
size_t j = i;
|
||||
while (j > 0 && shellCompareNames(current.Name, entries[j - 1].Name) < 0) {
|
||||
entries[j] = entries[j - 1];
|
||||
j--;
|
||||
}
|
||||
entries[j] = current;
|
||||
}
|
||||
}
|
||||
|
||||
// Implements the cmd dir operation.
|
||||
static void cmd_dir(const char* path) {
|
||||
WIN32_FIND_DATAA fd;
|
||||
char search_path[MAX_PATH];
|
||||
const char* target = (path && *path != '\0') ? path : ".";
|
||||
|
||||
|
||||
size_t len = strlen(target);
|
||||
if (len + 3 > MAX_PATH) { print("dir: path too long\n"); return; }
|
||||
strcpy(search_path, target);
|
||||
@@ -107,11 +151,46 @@ static void cmd_dir(const char* path) {
|
||||
|
||||
HANDLE hFind = FindFirstFileA(search_path, &fd);
|
||||
if (hFind == INVALID_HANDLE_VALUE) { print("dir: failed to read directory\n"); return; }
|
||||
|
||||
void* heap = GetProcessHeap();
|
||||
SHELL_WIN32_DIR_ENTRY* entries = NULL;
|
||||
size_t count = 0;
|
||||
size_t capacity = 0;
|
||||
|
||||
do {
|
||||
print(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ? "<DIR> " : " ");
|
||||
print(fd.cFileName); print("\n");
|
||||
if (count == capacity) {
|
||||
size_t nextCapacity = capacity ? capacity * 2u : 64u;
|
||||
size_t bytes = nextCapacity * sizeof(SHELL_WIN32_DIR_ENTRY);
|
||||
SHELL_WIN32_DIR_ENTRY* next;
|
||||
if (entries)
|
||||
next = (SHELL_WIN32_DIR_ENTRY*)HeapReAlloc(heap, 0, entries, bytes);
|
||||
else
|
||||
next = (SHELL_WIN32_DIR_ENTRY*)HeapAlloc(heap, 0, bytes);
|
||||
if (!next) {
|
||||
print("dir: out of memory\n");
|
||||
if (entries) HeapFree(heap, 0, entries);
|
||||
FindClose(hFind);
|
||||
return;
|
||||
}
|
||||
entries = next;
|
||||
capacity = nextCapacity;
|
||||
}
|
||||
|
||||
strncpy(entries[count].Name, fd.cFileName, MAX_PATH - 1);
|
||||
entries[count].Name[MAX_PATH - 1] = '\0';
|
||||
entries[count].Attributes = fd.dwFileAttributes;
|
||||
count++;
|
||||
} while (FindNextFileA(hFind, &fd));
|
||||
FindClose(hFind);
|
||||
|
||||
shellSortDirEntries(entries, count);
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
print(entries[i].Attributes & FILE_ATTRIBUTE_DIRECTORY ? "<DIR> " : " ");
|
||||
print(entries[i].Name);
|
||||
print("\n");
|
||||
}
|
||||
if (entries)
|
||||
HeapFree(heap, 0, entries);
|
||||
}
|
||||
|
||||
// Implements the cmd type operation.
|
||||
|
||||
Reference in new issue
Block a user