https://git.reactos.org/?p=reactos.git;a=commitdiff;h=73c06d09ff19cd8df6f1d7d5731622e89c169090
commit 73c06d09ff19cd8df6f1d7d5731622e89c169090 Author: Pierre Schweitzer <pie...@reactos.org> AuthorDate: Wed Nov 28 08:26:55 2018 +0100 Commit: Pierre Schweitzer <pie...@reactos.org> CommitDate: Wed Nov 28 08:28:37 2018 +0100 [IPHLPAPI_APITEST] CurrPorts seems to confirm that timestamp is really a timestamp --- drivers/network/tcpip/tcpip/ninfo.c | 4 +-- .../iphlpapi/AllocateAndGetTcpExTable2FromStack.c | 29 +++++++--------------- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/drivers/network/tcpip/tcpip/ninfo.c b/drivers/network/tcpip/tcpip/ninfo.c index 3df5204d42..8ad01fb413 100644 --- a/drivers/network/tcpip/tcpip/ninfo.c +++ b/drivers/network/tcpip/tcpip/ninfo.c @@ -204,7 +204,7 @@ TDI_STATUS InfoTdiQueryGetConnectionTcpTable(PADDRESS_FILE AddrFile, } TcpRow.dwOwningPid = (DWORD)AddrFile->ProcessId; - TcpRow.liCreateTimestamp = AddrFile->CreationTime; /* FIXME: to check */ + TcpRow.liCreateTimestamp = AddrFile->CreationTime; if (AddrFile->Listener != NULL) { @@ -291,7 +291,7 @@ TDI_STATUS InfoTdiQueryGetConnectionUdpTable(PADDRESS_FILE AddrFile, UdpRow.dwLocalAddr = AddrFile->Address.Address.IPv4Address; UdpRow.dwLocalPort = AddrFile->Port; UdpRow.dwOwningPid = (DWORD)AddrFile->ProcessId; - UdpRow.liCreateTimestamp = AddrFile->CreationTime; /* FIXME: to check */ + UdpRow.liCreateTimestamp = AddrFile->CreationTime; UdpRow.dwFlags = 0; /* FIXME */ if (Class == TcpUdpClassOwner) { diff --git a/modules/rostests/apitests/iphlpapi/AllocateAndGetTcpExTable2FromStack.c b/modules/rostests/apitests/iphlpapi/AllocateAndGetTcpExTable2FromStack.c index 002d7d1909..1f49664fc1 100644 --- a/modules/rostests/apitests/iphlpapi/AllocateAndGetTcpExTable2FromStack.c +++ b/modules/rostests/apitests/iphlpapi/AllocateAndGetTcpExTable2FromStack.c @@ -24,7 +24,8 @@ START_TEST(AllocateAndGetTcpExTable2FromStack) DWORD i; BOOLEAN Found; HINSTANCE hIpHlpApi; - SYSTEMTIME Creation; + FILETIME Creation; + LARGE_INTEGER CreationTime; DWORD Pid = GetCurrentProcessId(); hIpHlpApi = GetModuleHandleW(L"iphlpapi.dll"); @@ -47,7 +48,9 @@ START_TEST(AllocateAndGetTcpExTable2FromStack) return; } - GetSystemTime(&Creation); + GetSystemTimeAsFileTime(&Creation); + CreationTime.LowPart = Creation.dwLowDateTime; + CreationTime.HighPart = Creation.dwHighDateTime; sock = socket(AF_INET, SOCK_STREAM, 0); if (sock == INVALID_SOCKET) @@ -258,17 +261,10 @@ START_TEST(AllocateAndGetTcpExTable2FromStack) } else { - SYSTEMTIME SockTime; - ok(TcpTableOwnerMod->table[i].dwOwningPid == Pid, "Invalid owner\n"); - CopyMemory(&SockTime, &TcpTableOwnerMod->table[i].liCreateTimestamp, sizeof(SYSTEMTIME)); - ok(Creation.wYear == SockTime.wYear, "Invalid year\n"); - ok(Creation.wMonth == SockTime.wMonth, "Invalid month\n"); - ok(Creation.wDayOfWeek == SockTime.wDayOfWeek, "Invalid day of week\n"); - ok(Creation.wDay == SockTime.wDay, "Invalid day\n"); - ok(Creation.wHour == SockTime.wHour, "Invalid hour\n"); - ok(Creation.wMinute == SockTime.wMinute, "Invalid minute\n"); + ok(TcpTableOwnerMod->table[i].liCreateTimestamp.QuadPart >= CreationTime.QuadPart, "Invalid time\n"); + ok(TcpTableOwnerMod->table[i].liCreateTimestamp.QuadPart <= CreationTime.QuadPart + 60000000000LL, "Invalid time\n"); } HeapFree(GetProcessHeap(), 0, TcpTableOwnerMod); @@ -324,17 +320,10 @@ START_TEST(AllocateAndGetTcpExTable2FromStack) } else { - SYSTEMTIME SockTime; - ok(TcpTableOwnerMod->table[i].dwOwningPid == Pid, "Invalid owner\n"); - CopyMemory(&SockTime, &TcpTableOwnerMod->table[i].liCreateTimestamp, sizeof(SYSTEMTIME)); - ok(Creation.wYear == SockTime.wYear, "Invalid year\n"); - ok(Creation.wMonth == SockTime.wMonth, "Invalid month\n"); - ok(Creation.wDayOfWeek == SockTime.wDayOfWeek, "Invalid day of week\n"); - ok(Creation.wDay == SockTime.wDay, "Invalid day\n"); - ok(Creation.wHour == SockTime.wHour, "Invalid hour\n"); - ok(Creation.wMinute == SockTime.wMinute, "Invalid minute\n"); + ok(TcpTableOwnerMod->table[i].liCreateTimestamp.QuadPart >= CreationTime.QuadPart, "Invalid time\n"); + ok(TcpTableOwnerMod->table[i].liCreateTimestamp.QuadPart <= CreationTime.QuadPart + 60000000000LL, "Invalid time\n"); } HeapFree(GetProcessHeap(), 0, TcpTableOwnerMod);