kernel32-GetSystemTimes: Fix some issues in the patchset.

This commit is contained in:
Sebastian Lackner 2014-09-09 16:14:39 +02:00
parent 797ead4b3c
commit 774f0634ba
5 changed files with 45 additions and 40 deletions

1
debian/changelog vendored
View File

@ -1,4 +1,5 @@
wine-compholio (1.7.27) UNRELEASED; urgency=low
* Fixed some issues in the patches for GetSystemTimes.
* Removed patch to use assembly wrapper for TLS callbacks (accepted upstream).
-- Erich E. Hoover <erich.e.hoover@gmail.com> Mon, 08 Sep 2014 21:14:36 +0200

View File

@ -365,7 +365,7 @@ kernel32-GetFinalPathNameByHandle.ok:
# Patchset kernel32-GetSystemTimes
# |
# | Included patches:
# | * Implement GetSystemTimes. [by Louis Lenders / Erich E. Hoover]
# | * Implement GetSystemTimes. [rev 2, by Louis Lenders / Erich E. Hoover]
# |
# | This patchset fixes the following Wine bugs:
# | * [#19813] Support for GetSystemTimes
@ -378,7 +378,7 @@ kernel32-GetSystemTimes.ok:
$(call APPLY_FILE,kernel32-GetSystemTimes/0001-kernel32-Add-tests-for-GetSystemTimes.patch)
$(call APPLY_FILE,kernel32-GetSystemTimes/0002-kernel32-Implement-GetSystemTimes.patch)
@( \
echo '+ { "kernel32-GetSystemTimes", "Louis Lenders / Erich E. Hoover", "Implement GetSystemTimes." },'; \
echo '+ { "kernel32-GetSystemTimes", "Louis Lenders / Erich E. Hoover", "Implement GetSystemTimes. [rev 2]" },'; \
) > kernel32-GetSystemTimes.ok
# Patchset kernel32-GetVolumePathName

View File

@ -1,14 +1,14 @@
From 289599c8372b08c97561d6703ac45c0b9ad395d2 Mon Sep 17 00:00:00 2001
From 15dc0e88f4fcd63c876d9037204074ed7506dd51 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 | 77 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 77 insertions(+)
dlls/kernel32/tests/time.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 76 insertions(+)
diff --git a/dlls/kernel32/tests/time.c b/dlls/kernel32/tests/time.c
index 55d4be9..6f5c03d 100644
index 55d4be9..c524343 100644
--- a/dlls/kernel32/tests/time.c
+++ b/dlls/kernel32/tests/time.c
@@ -22,9 +22,11 @@
@ -23,7 +23,7 @@ index 55d4be9..6f5c03d 100644
static int (WINAPI *pGetCalendarInfoA)(LCID,CALID,CALTYPE,LPSTR,int,LPDWORD);
static int (WINAPI *pGetCalendarInfoW)(LCID,CALID,CALTYPE,LPWSTR,int,LPDWORD);
@@ -732,12 +734,86 @@ static void test_GetCalendarInfo(void)
@@ -732,12 +734,85 @@ static void test_GetCalendarInfo(void)
ok( ret == ret2, "got %d, expected %d\n", ret, ret2 );
}
@ -46,9 +46,9 @@ index 55d4be9..6f5c03d 100644
+
+ 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) );
+ memset( &idletime, 0x11, sizeof(idletime) );
+ memset( &kerneltime, 0x11, sizeof(kerneltime) );
+ memset( &usertime, 0x11, sizeof(usertime) );
+ todo_wine ok( pGetSystemTimes(&idletime, &kerneltime , &usertime),
+ "GetSystemTimes failed unexpectedly\n" );
+
@ -67,7 +67,6 @@ index 55d4be9..6f5c03d 100644
+
+ trace( "UserTime: %f seconds\n", (double)ul3.QuadPart/10000000.0 );
+
+
+ ok( !NtQuerySystemInformation(SystemBasicInformation, &sbi, sizeof(sbi), &ReturnLength),
+ "NtQuerySystemInformation failed\n" );
+ ok( sizeof(sbi) == ReturnLength, "Inconsistent length %d\n", ReturnLength );
@ -80,11 +79,11 @@ index 55d4be9..6f5c03d 100644
+ sppi = HeapAlloc( GetProcessHeap(), 0,
+ sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) * sbi.NumberOfProcessors);
+
+ ok( !NtQuerySystemInformation(SystemProcessorPerformanceInformation, sppi,
+ sizeof(*sppi), &ReturnLength),
+ "NtQuerySystemInformation failed\n" );
+ ok( !NtQuerySystemInformation( SystemProcessorPerformanceInformation, sppi,
+ sizeof(*sppi), &ReturnLength),
+ "NtQuerySystemInformation failed\n" );
+
+ for (i=0 ; i<sbi.NumberOfProcessors;i++)
+ 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;
@ -110,7 +109,7 @@ index 55d4be9..6f5c03d 100644
pGetCalendarInfoA = (void *)GetProcAddress(hKernel, "GetCalendarInfoA");
pGetCalendarInfoW = (void *)GetProcAddress(hKernel, "GetCalendarInfoW");
@@ -747,6 +823,7 @@ START_TEST(time)
@@ -747,6 +822,7 @@ START_TEST(time)
test_FileTimeToSystemTime();
test_FileTimeToLocalFileTime();
test_TzSpecificLocalTimeToSystemTime();
@ -119,5 +118,5 @@ index 55d4be9..6f5c03d 100644
test_GetCalendarInfo();
}
--
1.7.9.5
2.1.0

View File

@ -1,15 +1,15 @@
From c7d23fced92e26c724cdeb389f827c436294b05d Mon Sep 17 00:00:00 2001
From 7bfcc7c62a34a77b6cf613fb37aaef72af644cf1 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(-)
dlls/kernel32/tests/time.c | 12 +++++-----
dlls/kernel32/time.c | 56 ++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 60 insertions(+), 8 deletions(-)
diff --git a/dlls/kernel32/tests/time.c b/dlls/kernel32/tests/time.c
index 6f5c03d..d3d3939 100644
index c524343..63ab35a 100644
--- a/dlls/kernel32/tests/time.c
+++ b/dlls/kernel32/tests/time.c
@@ -751,13 +751,13 @@ static void test_GetSystemTimes(void)
@ -19,9 +19,9 @@ index 6f5c03d..d3d3939 100644
- 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) );
memset( &idletime, 0x11, sizeof(idletime) );
memset( &kerneltime, 0x11, sizeof(kerneltime) );
memset( &usertime, 0x11, sizeof(usertime) );
- todo_wine ok( pGetSystemTimes(&idletime, &kerneltime , &usertime),
- "GetSystemTimes failed unexpectedly\n" );
+ ok( pGetSystemTimes(&idletime, &kerneltime , &usertime),
@ -29,7 +29,7 @@ index 6f5c03d..d3d3939 100644
ul1.LowPart = idletime.dwLowDateTime;
ul1.HighPart = idletime.dwHighDateTime;
@@ -801,9 +801,9 @@ static void test_GetSystemTimes(void)
@@ -800,9 +800,9 @@ static void test_GetSystemTimes(void)
trace( "total_idletime %f total_kerneltime %f total_usertime %f \n", total_idletime,
total_kerneltime, total_usertime );
@ -43,10 +43,10 @@ index 6f5c03d..d3d3939 100644
HeapFree(GetProcessHeap(), 0, sppi);
}
diff --git a/dlls/kernel32/time.c b/dlls/kernel32/time.c
index 21ac120..0100dd0 100644
index 21ac120..96753d9 100644
--- a/dlls/kernel32/time.c
+++ b/dlls/kernel32/time.c
@@ -1090,9 +1090,56 @@ BOOL WINAPI FileTimeToDosDateTime( const FILETIME *ft, LPWORD fatdate,
@@ -1090,9 +1090,61 @@ BOOL WINAPI FileTimeToDosDateTime( const FILETIME *ft, LPWORD fatdate,
*/
BOOL WINAPI GetSystemTimes(LPFILETIME lpIdleTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime)
{
@ -60,14 +60,17 @@ index 21ac120..0100dd0 100644
+
+ TRACE("(%p,%p,%p)\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;
+ sppi = HeapAlloc( GetProcessHeap(), 0,
+ sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) * sbi.NumberOfProcessors);
+ if (!sppi)
+ {
+ SetLastError( ERROR_OUTOFMEMORY );
+ return FALSE;
+ }
+
+ status = NtQuerySystemInformation(SystemProcessorPerformanceInformation, sppi, sizeof(*sppi),
+ &ret_size);
@ -85,26 +88,28 @@ index 21ac120..0100dd0 100644
+ 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;
+ 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;
+ 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;
+ lpUserTime->dwLowDateTime = user_time.u.LowPart;
+ lpUserTime->dwHighDateTime = user_time.u.HighPart;
+ }
+
+ HeapFree( GetProcessHeap(), 0, sppi );
+ return TRUE;
}
/***********************************************************************
--
1.7.9.5
2.1.0

View File

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