add ntfs.sys standalone driver target, change default usb vhd layout formatting to ntfs, implement Fat32CreateDir for directory creation support in the fat32 file system driver, add a dedicated HAL serial output endpoint for COM1 writes in hal_serial.c and subscribe serial to HAL text streams, introduce waitable kernel timers with KeTimerCreate, KeTimerSet, and KeTimerCancel alongside spinlock-protected global timer list initialization and scheduler tick tracking, implement SyscallWriteFileAsync system call for asynchronous non-blocking file writes, refactor NetSocketConnect and NetSocketSendTo to use generic SYS_SOCKET_ADDRESS_K structures instead of being hardcoded to IPv4, update gethostbyname and DNS name resolution to support IPv6 parsing via ResolveNameFamily, update tcpserve.exe with -4 and -6 command-line flags to accept and display IPv6 addresses, append size and version headers to all kernel telemetry and statistics structures including SYS_PMM_STATS, SYS_CPU_STATS, and SYS_SCHEDULER_STATS, update winmm timeGetTime to look up high-resolution hardware frequencies via SysGetTickFrequency, integrate 14 native smoke test applications.
This commit is contained in:
1 parent
2c4a68a75f
commit
ed3d065abd
156 files changed
+10509
-2643
No files matched your search
@@ -49,40 +49,82 @@ static void print_ipv4(const uint8_t ip[4]) {
|
||||
print_u64(ip[2]); print("."); print_u64(ip[3]);
|
||||
}
|
||||
|
||||
// Prints ipv6.
|
||||
static void print_ipv6(const uint8_t ip[16]) {
|
||||
static const char hex[] = "0123456789abcdef";
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
uint16_t word = ((uint16_t)ip[i * 2] << 8) | ip[i * 2 + 1];
|
||||
int started = 0;
|
||||
for (int shift = 12; shift >= 0; shift -= 4) {
|
||||
unsigned nibble = (word >> shift) & 0xfu;
|
||||
if (nibble || started || shift == 0) {
|
||||
char c = hex[nibble];
|
||||
print_char(c);
|
||||
started = 1;
|
||||
}
|
||||
}
|
||||
if (i != 7)
|
||||
print(":");
|
||||
}
|
||||
}
|
||||
|
||||
// Runs the requested operation.
|
||||
int main(void) {
|
||||
char familyText[16];
|
||||
char name[256];
|
||||
uint32_t family = 0;
|
||||
const char* cmd = SysGetPeb()->CommandLine.Data;
|
||||
cmd = next_token(cmd, name, sizeof(name)); // program path
|
||||
cmd = next_token(cmd, name, sizeof(name));
|
||||
(void)cmd;
|
||||
|
||||
familyText[0] = 0;
|
||||
name[0] = 0;
|
||||
if (cmd)
|
||||
(void)next_token(cmd, name, sizeof(name));
|
||||
if (cmd) {
|
||||
const char* rest = next_token(cmd, familyText, sizeof(familyText));
|
||||
if (strcmp(familyText, "-4") == 0) {
|
||||
family = SYS_AF_INET;
|
||||
if (rest)
|
||||
(void)next_token(rest, name, sizeof(name));
|
||||
} else if (strcmp(familyText, "-6") == 0) {
|
||||
family = SYS_AF_INET6;
|
||||
if (rest)
|
||||
(void)next_token(rest, name, sizeof(name));
|
||||
} else {
|
||||
strcpy(name, familyText);
|
||||
}
|
||||
}
|
||||
if (!name[0]) {
|
||||
print("usage: resolve.exe hostname\n");
|
||||
print("usage: resolve.exe [-4|-6] hostname\n");
|
||||
SysExitProcess(1);
|
||||
}
|
||||
|
||||
SYS_SOCKET_ADDRESS_IPV4 addr;
|
||||
SYS_SOCKET_ADDRESS addr;
|
||||
size_t addrSize = sizeof(addr);
|
||||
SYS_RESOLVE_HOST_REQUEST req;
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.Name = SysSvFromCstr(name);
|
||||
req.Family = SYS_AF_INET;
|
||||
req.Family = family ? family : SYS_AF_INET6;
|
||||
req.AddressOut = &addr;
|
||||
req.AddressSizeInOut = &addrSize;
|
||||
|
||||
uint32_t st = SysResolveHost(&req);
|
||||
if (st != SYS_STATUS_SUCCESS) {
|
||||
if (st != STATUS_SUCCESS && family == 0) {
|
||||
req.Family = SYS_AF_INET;
|
||||
addrSize = sizeof(addr);
|
||||
st = SysResolveHost(&req);
|
||||
}
|
||||
if (st != STATUS_SUCCESS) {
|
||||
print("resolve: SysResolveHost failed "); print_u64(st); print("\n");
|
||||
SysExitProcess(1);
|
||||
}
|
||||
|
||||
print(name);
|
||||
print(" -> ");
|
||||
print_ipv4(addr.Address);
|
||||
if (addr.Family == SYS_AF_INET6)
|
||||
print_ipv6(addr.Address);
|
||||
else
|
||||
print_ipv4(addr.Address);
|
||||
print("\n");
|
||||
SysExitProcess(0);
|
||||
return 0;
|
||||
|
||||
Reference in new issue
Block a user