Added patch to implement GetSystemTimes.

This commit is contained in:
Erich E. Hoover 2014-07-27 12:54:01 -06:00
parent 1be929fbf9
commit c8a6c04975
6 changed files with 261 additions and 1 deletions

View File

@ -28,6 +28,7 @@ Wine-compholio contains fixes for the following Wine bugs:
* Return correct IMediaSeeking stream positions in quartz ([Wine Bug #23174](http://bugs.winehq.org/show_bug.cgi?id=23174 "Fallout 3: Diologue and Video/sound issues"))
* SHCreateSessionKey not implemented ([Wine Bug #35630](http://bugs.winehq.org/show_bug.cgi?id=35630 "SHCreateSessionKey is unimplemented"))
* Support for AllocateAndGetTcpExTableFromStack ([Wine Bug #34372](http://bugs.winehq.org/show_bug.cgi?id=34372 "Add missing function AllocateAndGetTcpExTableFromStack() to iphlpapi.dll"))
* Support for GetSystemTimes ([Wine Bug #19813](http://bugs.winehq.org/show_bug.cgi?id=19813 "Voddler needs GetSystemTimes to run"))
* Support for Junction Points ([Wine Bug #12401](http://bugs.winehq.org/show_bug.cgi?id=12401 "Support junction points, i.e. DeviceIoCtl(FSCTL_SET_REPARSE_POINT/FSCTL_GET_REPARSE_POINT)"))
* Support for PulseAudio backend for audio ([Wine Bug #10495](http://bugs.winehq.org/show_bug.cgi?id=10495 "Wine should support PulseAudio"))
* Support for TransmitFile ([Wine Bug #5048](http://bugs.winehq.org/show_bug.cgi?id=5048 "Multiple applications and games need support for ws2_32 SIO_GET_EXTENSION_FUNCTION_POINTER TransmitFile (WSAID_TRANSMITFILE)"))

3
debian/changelog vendored
View File

@ -1,11 +1,12 @@
wine-compholio (1.7.24) UNRELEASED; urgency=low
* Added patch to implement inet_pton.
* Added patch to implement GetSystemTimes.
* Added patch to implement SHCreateSessionKey.
* Added patch with stubs for [Get|Set]SystemFileCacheSize.
* Added patch to implement AllocateAndGetTcpExTableFromStack.
* Added patch to fix ConnectNamedPort return value in overlapped mode.
* Added patch to store IOCS data in a property instead of GWLP_USERDATA.
-- Erich E. Hoover <erich.e.hoover@gmail.com> Sun, 27 Jul 2014 09:41:44 -0600
-- Erich E. Hoover <erich.e.hoover@gmail.com> Sun, 27 Jul 2014 12:53:18 -0600
wine-compholio (1.7.23) unstable; urgency=low
* Rewrite of patch system to simplify maintaining large patchsets.

View File

@ -10,6 +10,7 @@ PATCHLIST := Miscellaneous.ok \
atl-IOCS_Property.ok \
fonts-Missing_Fonts.ok \
iphlpapi-TCP_Table.ok \
kernel32-GetSystemTimes.ok \
kernel32-GetVolumePathName.ok \
kernel32-Named_Pipe.ok \
kernel32-SystemFileCacheSize.ok \
@ -152,6 +153,25 @@ iphlpapi-TCP_Table.ok:
echo '+ { "iphlpapi-TCP_Table", "Erich E. Hoover", "Implement AllocateAndGetTcpExTableFromStack." },'; \
) > iphlpapi-TCP_Table.ok
# Patchset kernel32-GetSystemTimes
# |
# | Included patches:
# | * Implement GetSystemTimes. [by Louis Lenders / Erich E. Hoover]
# |
# | This patchset fixes the following Wine bugs:
# | * [#19813] Voddler needs GetSystemTimes to run
# |
# | Modified files:
# | * dlls/kernel32/tests/time.c, dlls/kernel32/time.c
# |
.INTERMEDIATE: kernel32-GetSystemTimes.ok
kernel32-GetSystemTimes.ok:
$(PATCH) < kernel32-GetSystemTimes/0001-kernel32-Add-tests-for-GetSystemTimes.patch
$(PATCH) < kernel32-GetSystemTimes/0002-kernel32-Implement-GetSystemTimes.patch
@( \
echo '+ { "kernel32-GetSystemTimes", "Louis Lenders / Erich E. Hoover", "Implement GetSystemTimes." },'; \
) > kernel32-GetSystemTimes.ok
# Patchset kernel32-GetVolumePathName
# |
# | Included patches:

View File

@ -0,0 +1,124 @@
From 6edf355e54ae3ab2c8506d718209bf876e671ea0 Mon Sep 17 00:00:00 2001
From: Louis Lenders <xerox_xerox2000@yahoo.co.uk>
Date: Sun, 27 Jul 2014 11:42:28 -0600
Subject: kernel32: Add tests for GetSystemTimes.
---
dlls/kernel32/tests/time.c | 78 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 78 insertions(+)
diff --git a/dlls/kernel32/tests/time.c b/dlls/kernel32/tests/time.c
index 55d4be9..57263bb 100644
--- a/dlls/kernel32/tests/time.c
+++ b/dlls/kernel32/tests/time.c
@@ -22,9 +22,11 @@
#include "wine/test.h"
#include "winbase.h"
#include "winnls.h"
+#include "winternl.h"
static BOOL (WINAPI *pTzSpecificLocalTimeToSystemTime)(LPTIME_ZONE_INFORMATION, LPSYSTEMTIME, LPSYSTEMTIME);
static BOOL (WINAPI *pSystemTimeToTzSpecificLocalTime)(LPTIME_ZONE_INFORMATION, LPSYSTEMTIME, LPSYSTEMTIME);
+static BOOL (WINAPI *pGetSystemTimes)(LPFILETIME, LPFILETIME, LPFILETIME);
static int (WINAPI *pGetCalendarInfoA)(LCID,CALID,CALTYPE,LPSTR,int,LPDWORD);
static int (WINAPI *pGetCalendarInfoW)(LCID,CALID,CALTYPE,LPWSTR,int,LPDWORD);
@@ -732,12 +734,87 @@ static void test_GetCalendarInfo(void)
ok( ret == ret2, "got %d, expected %d\n", ret, ret2 );
}
+static void test_GetSystemTimes(void)
+{
+
+ FILETIME idletime, kerneltime, usertime;
+ int i;
+ ULARGE_INTEGER ul1, ul2, ul3;
+ SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION *sppi;
+ SYSTEM_BASIC_INFORMATION sbi;
+ ULONG ReturnLength;
+ double total_usertime = 0.0, total_kerneltime = 0.0, total_idletime = 0.0;
+ NTSTATUS STATUS;
+
+ if (!pGetSystemTimes)
+ {
+ win_skip("GetSystemTimes not available\n");
+ return;
+ }
+
+ todo_wine ok( pGetSystemTimes(NULL, NULL, NULL), "GetSystemTimes failed unexpectedly\n" );
+
+ memset( &idletime, 0x0, sizeof(idletime) );
+ memset( &kerneltime, 0x0, sizeof(kerneltime) );
+ memset( &usertime, 0x0, sizeof(usertime) );
+ todo_wine ok( pGetSystemTimes(&idletime, &kerneltime , &usertime),
+ "GetSystemTimes failed unexpectedly\n" );
+
+ ul1.LowPart = idletime.dwLowDateTime;
+ ul1.HighPart = idletime.dwHighDateTime;
+
+ trace( "IdleTime: %llu seconds\n",ul1.QuadPart/10000000);
+
+ ul2.LowPart = kerneltime.dwLowDateTime;
+ ul2.HighPart = kerneltime.dwHighDateTime;
+
+ trace( "KernelTime: %llu seconds\n", ul2.QuadPart/10000000 );
+
+ ul3.LowPart = usertime.dwLowDateTime;
+ ul3.HighPart = usertime.dwHighDateTime;
+
+ trace( "UserTime: %llu seconds\n", ul3.QuadPart/10000000 );
+
+
+ ok( !NtQuerySystemInformation(SystemBasicInformation, &sbi, sizeof(sbi), &ReturnLength),
+ "NtQuerySystemInformation failed\n" );
+ ok( sizeof(sbi) == ReturnLength, "Inconsistent length %d\n", ReturnLength );
+
+ /* Check if we have some return values */
+ trace( "Number of Processors : %d\n", sbi.NumberOfProcessors );
+ ok( sbi.NumberOfProcessors > 0, "Expected more than 0 processors, got %d\n",
+ sbi.NumberOfProcessors );
+
+ sppi = HeapAlloc( GetProcessHeap(), 0,
+ sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) * sbi.NumberOfProcessors);
+
+ ok( !NtQuerySystemInformation(SystemProcessorPerformanceInformation, sppi,
+ sizeof(*sppi), &ReturnLength),
+ "NtQuerySystemInformation failed\n" );
+
+ for (i=0 ; i<sbi.NumberOfProcessors;i++)
+ {
+ total_usertime += (double)(sppi[i].UserTime.QuadPart)/10000000.0;
+ total_kerneltime += (double)(sppi[i].KernelTime.QuadPart)/10000000.0;
+ total_idletime += (double)(sppi[i].IdleTime.QuadPart)/10000000.0;
+ }
+
+ trace( "total_idletime %f total_kerneltime %f total_usertime %f \n", total_idletime,
+ total_kerneltime, total_usertime );
+
+ todo_wine ok( (total_idletime - (double)ul1.QuadPart/10000000.0) < 1.0, "test idletime failed\n" );
+ todo_wine ok( (total_kerneltime - (double)ul2.QuadPart/10000000.0) < 1.0, "test kerneltime failed\n" );
+ todo_wine ok( (total_usertime - (double)ul3.QuadPart/10000000.0) < 1.0, "test usertime failed\n" );
+
+ HeapFree(GetProcessHeap(), 0, sppi);
+}
START_TEST(time)
{
HMODULE hKernel = GetModuleHandleA("kernel32");
pTzSpecificLocalTimeToSystemTime = (void *)GetProcAddress(hKernel, "TzSpecificLocalTimeToSystemTime");
pSystemTimeToTzSpecificLocalTime = (void *)GetProcAddress( hKernel, "SystemTimeToTzSpecificLocalTime");
+ pGetSystemTimes = (void *)GetProcAddress( hKernel, "GetSystemTimes");
pGetCalendarInfoA = (void *)GetProcAddress(hKernel, "GetCalendarInfoA");
pGetCalendarInfoW = (void *)GetProcAddress(hKernel, "GetCalendarInfoW");
@@ -747,6 +824,7 @@ START_TEST(time)
test_FileTimeToSystemTime();
test_FileTimeToLocalFileTime();
test_TzSpecificLocalTimeToSystemTime();
+ test_GetSystemTimes();
test_FileTimeToDosDateTime();
test_GetCalendarInfo();
}
--
1.7.9.5

View File

@ -0,0 +1,110 @@
From fb4aa7b1a04af6d37bd5f18dc8efa3d2ce7bb17c Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Sun, 27 Jul 2014 12:38:29 -0600
Subject: kernel32: Implement GetSystemTimes.
---
dlls/kernel32/tests/time.c | 12 +++++------
dlls/kernel32/time.c | 51 ++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 55 insertions(+), 8 deletions(-)
diff --git a/dlls/kernel32/tests/time.c b/dlls/kernel32/tests/time.c
index 57263bb..2b464ec 100644
--- a/dlls/kernel32/tests/time.c
+++ b/dlls/kernel32/tests/time.c
@@ -752,13 +752,13 @@ static void test_GetSystemTimes(void)
return;
}
- todo_wine ok( pGetSystemTimes(NULL, NULL, NULL), "GetSystemTimes failed unexpectedly\n" );
+ ok( pGetSystemTimes(NULL, NULL, NULL), "GetSystemTimes failed unexpectedly\n" );
memset( &idletime, 0x0, sizeof(idletime) );
memset( &kerneltime, 0x0, sizeof(kerneltime) );
memset( &usertime, 0x0, sizeof(usertime) );
- todo_wine ok( pGetSystemTimes(&idletime, &kerneltime , &usertime),
- "GetSystemTimes failed unexpectedly\n" );
+ ok( pGetSystemTimes(&idletime, &kerneltime , &usertime),
+ "GetSystemTimes failed unexpectedly\n" );
ul1.LowPart = idletime.dwLowDateTime;
ul1.HighPart = idletime.dwHighDateTime;
@@ -802,9 +802,9 @@ static void test_GetSystemTimes(void)
trace( "total_idletime %f total_kerneltime %f total_usertime %f \n", total_idletime,
total_kerneltime, total_usertime );
- todo_wine ok( (total_idletime - (double)ul1.QuadPart/10000000.0) < 1.0, "test idletime failed\n" );
- todo_wine ok( (total_kerneltime - (double)ul2.QuadPart/10000000.0) < 1.0, "test kerneltime failed\n" );
- todo_wine ok( (total_usertime - (double)ul3.QuadPart/10000000.0) < 1.0, "test usertime failed\n" );
+ ok( (total_idletime - (double)ul1.QuadPart/10000000.0) < 1.0, "test idletime failed\n" );
+ ok( (total_kerneltime - (double)ul2.QuadPart/10000000.0) < 1.0, "test kerneltime failed\n" );
+ ok( (total_usertime - (double)ul3.QuadPart/10000000.0) < 1.0, "test usertime failed\n" );
HeapFree(GetProcessHeap(), 0, sppi);
}
diff --git a/dlls/kernel32/time.c b/dlls/kernel32/time.c
index 21ac120..2d552b6 100644
--- a/dlls/kernel32/time.c
+++ b/dlls/kernel32/time.c
@@ -1090,9 +1090,56 @@ BOOL WINAPI FileTimeToDosDateTime( const FILETIME *ft, LPWORD fatdate,
*/
BOOL WINAPI GetSystemTimes(LPFILETIME lpIdleTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime)
{
- FIXME("(%p,%p,%p): Stub!\n", lpIdleTime, lpKernelTime, lpUserTime);
+ LARGE_INTEGER idle_time, kernel_time, user_time;
+ SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION *sppi;
+ SYSTEM_BASIC_INFORMATION sbi;
+ NTSTATUS status;
+ ULONG ret_size;
+ int i;
+
+ TRACE("(%p,%p,%p): Stub!\n", lpIdleTime, lpKernelTime, lpUserTime);
+
+
+ status = NtQuerySystemInformation( SystemBasicInformation, &sbi, sizeof(sbi), &ret_size );
+ if (status != STATUS_SUCCESS) return FALSE;
+
+ sppi = HeapAlloc( GetProcessHeap(), 0,
+ sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) * sbi.NumberOfProcessors);
- return FALSE;
+
+ status = NtQuerySystemInformation(SystemProcessorPerformanceInformation, sppi, sizeof(*sppi),
+ &ret_size);
+ if (status != STATUS_SUCCESS)
+ {
+ HeapFree( GetProcessHeap(), 0, sppi );
+ return FALSE;
+ }
+ idle_time.QuadPart = 0;
+ kernel_time.QuadPart = 0;
+ user_time.QuadPart = 0;
+ for (i = 0; i < sbi.NumberOfProcessors; i++)
+ {
+ idle_time.QuadPart += sppi[i].IdleTime.QuadPart;
+ kernel_time.QuadPart += sppi[i].KernelTime.QuadPart;
+ user_time.QuadPart += sppi[i].UserTime.QuadPart;
+ }
+ if (lpIdleTime)
+ {
+ lpIdleTime->dwLowDateTime += idle_time.u.LowPart;
+ lpIdleTime->dwHighDateTime += idle_time.u.HighPart;
+ }
+ if (lpKernelTime)
+ {
+ lpKernelTime->dwLowDateTime += kernel_time.u.LowPart;
+ lpKernelTime->dwHighDateTime += kernel_time.u.HighPart;
+ }
+ if (lpUserTime)
+ {
+ lpUserTime->dwLowDateTime += user_time.u.LowPart;
+ lpUserTime->dwHighDateTime += user_time.u.HighPart;
+ }
+ HeapFree( GetProcessHeap(), 0, sppi );
+ return TRUE;
}
/***********************************************************************
--
1.7.9.5

View File

@ -0,0 +1,4 @@
Author: Louis Lenders / Erich E. Hoover
Subject: Implement GetSystemTimes.
Revision: 1
Fixes: [19813] Support for GetSystemTimes