winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
May 2020
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
1 participants
743 discussions
Start a n
N
ew thread
Paul Gofman : ntoskrnl.exe: Implement KeSetSystemAffinityThread() function.
by Alexandre Julliard
26 May '20
26 May '20
Module: wine Branch: master Commit: 631227563bf52b2f30a576286b8d8299f2f54ed4 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=631227563bf52b2f30a57628…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Tue May 26 13:05:08 2020 +0300 ntoskrnl.exe: Implement KeSetSystemAffinityThread() function. Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntoskrnl.exe/ntoskrnl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index dc6bbe866c..a0657b52c5 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -2450,9 +2450,9 @@ KPRIORITY WINAPI KeSetPriorityThread( PKTHREAD Thread, KPRIORITY Priority ) /*********************************************************************** * KeSetSystemAffinityThread (NTOSKRNL.EXE.@) */ -VOID WINAPI KeSetSystemAffinityThread(KAFFINITY Affinity) +VOID WINAPI KeSetSystemAffinityThread(KAFFINITY affinity) { - FIXME("(%lx) stub\n", Affinity); + KeSetSystemAffinityThreadEx(affinity); } KAFFINITY WINAPI KeSetSystemAffinityThreadEx(KAFFINITY affinity)
1
0
0
0
Paul Gofman : ntoskrnl.exe: Add KeSetSystemAffinityThreadEx() function.
by Alexandre Julliard
26 May '20
26 May '20
Module: wine Branch: master Commit: c3bc7689b12a9d62841850d65c786c9cd56725a0 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c3bc7689b12a9d62841850d6…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Tue May 26 13:05:07 2020 +0300 ntoskrnl.exe: Add KeSetSystemAffinityThreadEx() function. Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntoskrnl.exe/ntoskrnl.c | 19 +++++++++++++++++++ dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 1 + dlls/ntoskrnl.exe/tests/driver.c | 19 +++++++++++++++++-- include/ddk/wdm.h | 1 + 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index c10c830738..dc6bbe866c 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -2455,6 +2455,25 @@ VOID WINAPI KeSetSystemAffinityThread(KAFFINITY Affinity) FIXME("(%lx) stub\n", Affinity); } +KAFFINITY WINAPI KeSetSystemAffinityThreadEx(KAFFINITY affinity) +{ + DWORD_PTR system_affinity = KeQueryActiveProcessors(); + GROUP_AFFINITY old, new; + + TRACE("affinity %#lx.\n", affinity); + + affinity &= system_affinity; + + NtQueryInformationThread(GetCurrentThread(), ThreadGroupInformation, + &old, sizeof(old), NULL); + + memset(&new, 0, sizeof(new)); + new.Mask = affinity; + + return NtSetInformationThread(GetCurrentThread(), ThreadGroupInformation, &new, sizeof(new)) + ? 0 : old.Mask; +} + /*********************************************************************** * KeRevertToUserAffinityThread (NTOSKRNL.EXE.@) diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index f80709a9a0..01a8e67376 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -634,6 +634,7 @@ @ stdcall KeSetPriorityThread(ptr long) @ stub KeSetProfileIrql @ stdcall KeSetSystemAffinityThread(long) +@ stdcall KeSetSystemAffinityThreadEx(long) @ stdcall KeSetTargetProcessorDpc(ptr long) @ stub KeSetTimeIncrement @ stub KeSetTimer diff --git a/dlls/ntoskrnl.exe/tests/driver.c b/dlls/ntoskrnl.exe/tests/driver.c index 65be4a8d35..c7b3c93f6d 100644 --- a/dlls/ntoskrnl.exe/tests/driver.c +++ b/dlls/ntoskrnl.exe/tests/driver.c @@ -1712,10 +1712,11 @@ static void test_executable_pool(void) static void test_affinity(void) { + KAFFINITY (WINAPI *pKeSetSystemAffinityThreadEx)(KAFFINITY affinity); ULONG (WINAPI *pKeQueryActiveProcessorCountEx)(USHORT); KAFFINITY (WINAPI *pKeQueryActiveProcessors)(void); + KAFFINITY mask, mask_all_cpus; ULONG cpu_count, count; - KAFFINITY mask; pKeQueryActiveProcessorCountEx = get_proc_address("KeQueryActiveProcessorCountEx"); if (!pKeQueryActiveProcessorCountEx) @@ -1727,6 +1728,9 @@ static void test_affinity(void) pKeQueryActiveProcessors = get_proc_address("KeQueryActiveProcessors"); ok(!!pKeQueryActiveProcessors, "KeQueryActiveProcessors is not available.\n"); + pKeSetSystemAffinityThreadEx = get_proc_address("KeSetSystemAffinityThreadEx"); + ok(!!pKeSetSystemAffinityThreadEx, "KeSetSystemAffinityThreadEx is not available.\n"); + count = pKeQueryActiveProcessorCountEx(1); todo_wine ok(!count, "Got unexpected count %u.\n", count); @@ -1736,8 +1740,19 @@ static void test_affinity(void) count = pKeQueryActiveProcessorCountEx(ALL_PROCESSOR_GROUPS); ok(count == cpu_count, "Got unexpected count %u.\n", count); + mask_all_cpus = ~((~0u) << cpu_count); + mask = pKeQueryActiveProcessors(); - ok(mask == ~((~0u) << cpu_count), "Got unexpected mask %#lx.\n", mask); + ok(mask == mask_all_cpus, "Got unexpected mask %#lx.\n", mask); + + mask = pKeSetSystemAffinityThreadEx(0); + ok(!mask, "Got unexpected mask %#lx.\n", mask); + + mask = pKeSetSystemAffinityThreadEx(0x1); + ok(mask == mask_all_cpus, "Got unexpected mask %#lx.\n", mask); + + mask = pKeSetSystemAffinityThreadEx(~(KAFFINITY)0); + ok(mask == 0x1, "Got unexpected mask %#lx.\n", mask); } static NTSTATUS main_test(DEVICE_OBJECT *device, IRP *irp, IO_STACK_LOCATION *stack) diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h index 1f80a5af29..42ff0c72b1 100644 --- a/include/ddk/wdm.h +++ b/include/ddk/wdm.h @@ -1709,6 +1709,7 @@ void WINAPI KeRevertToUserAffinityThread(void); LONG WINAPI KeSetEvent(PRKEVENT,KPRIORITY,BOOLEAN); KPRIORITY WINAPI KeSetPriorityThread(PKTHREAD,KPRIORITY); void WINAPI KeSetSystemAffinityThread(KAFFINITY); +KAFFINITY WINAPI KeSetSystemAffinityThreadEx(KAFFINITY affinity); BOOLEAN WINAPI KeSetTimerEx(KTIMER*,LARGE_INTEGER,LONG,KDPC*); NTSTATUS WINAPI KeWaitForMultipleObjects(ULONG,void*[],WAIT_TYPE,KWAIT_REASON,KPROCESSOR_MODE,BOOLEAN,LARGE_INTEGER*,KWAIT_BLOCK*); NTSTATUS WINAPI KeWaitForSingleObject(void*,KWAIT_REASON,KPROCESSOR_MODE,BOOLEAN,LARGE_INTEGER*);
1
0
0
0
Paul Gofman : ntoskrnl.exe: Fix KeQueryActiveProcessors() function.
by Alexandre Julliard
26 May '20
26 May '20
Module: wine Branch: master Commit: 25f4da665d4b552bc4fa1dc0a3cb0b6debb4940c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=25f4da665d4b552bc4fa1dc0…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Tue May 26 13:05:06 2020 +0300 ntoskrnl.exe: Fix KeQueryActiveProcessors() function. Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntoskrnl.exe/ntoskrnl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index 6d9ae44808..c10c830738 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -2379,10 +2379,10 @@ LONG WINAPI KeInsertQueue(PRKQUEUE Queue, PLIST_ENTRY Entry) */ KAFFINITY WINAPI KeQueryActiveProcessors( void ) { - DWORD_PTR AffinityMask; + DWORD_PTR affinity_mask; - GetProcessAffinityMask( GetCurrentProcess(), &AffinityMask, NULL); - return AffinityMask; + GetProcessAffinityMask( GetCurrentProcess(), NULL, &affinity_mask); + return affinity_mask; } ULONG WINAPI KeQueryActiveProcessorCountEx(USHORT group_number)
1
0
0
0
Alexandre Julliard : kernel32: Remove string.c.
by Alexandre Julliard
26 May '20
26 May '20
Module: wine Branch: master Commit: c7760ce7a247eeb9f15b51d0ec68ca0961efc0b0 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c7760ce7a247eeb9f15b51d0…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue May 26 14:57:31 2020 +0200 kernel32: Remove string.c. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/Makefile.in | 1 - dlls/kernel32/string.c | 113 ---------------------------------------------- dlls/kernel32/virtual.c | 79 ++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+), 114 deletions(-) diff --git a/dlls/kernel32/Makefile.in b/dlls/kernel32/Makefile.in index 28a15f8bbe..7822309de5 100644 --- a/dlls/kernel32/Makefile.in +++ b/dlls/kernel32/Makefile.in @@ -24,7 +24,6 @@ C_SRCS = \ process.c \ profile.c \ resource.c \ - string.c \ sync.c \ tape.c \ term.c \ diff --git a/dlls/kernel32/string.c b/dlls/kernel32/string.c deleted file mode 100644 index 9e1450ca58..0000000000 --- a/dlls/kernel32/string.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Kernel string functions - * - * Copyright 1993 Yngvi Sigurjonsson - * Copyright 1996 Alexandre Julliard - * Copyright 2001 Dmitry Timoshkov for CodeWeavers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "config.h" -#include "wine/port.h" - -#include <ctype.h> -#include <stdarg.h> -#include <string.h> - -#define WINE_NO_INLINE_STRING -#include "windef.h" -#include "winbase.h" -#include "wine/unicode.h" -#include "wine/exception.h" - - -/*********************************************************************** - * lstrcatA (KERNEL32.@) - * lstrcat (KERNEL32.@) - */ -LPSTR WINAPI lstrcatA( LPSTR dst, LPCSTR src ) -{ - __TRY - { - strcat( dst, src ); - } - __EXCEPT_PAGE_FAULT - { - SetLastError( ERROR_INVALID_PARAMETER ); - return NULL; - } - __ENDTRY - return dst; -} - - -/*********************************************************************** - * lstrcatW (KERNEL32.@) - */ -LPWSTR WINAPI lstrcatW( LPWSTR dst, LPCWSTR src ) -{ - __TRY - { - strcatW( dst, src ); - } - __EXCEPT_PAGE_FAULT - { - SetLastError( ERROR_INVALID_PARAMETER ); - return NULL; - } - __ENDTRY - return dst; -} - - -/*********************************************************************** - * lstrcpyA (KERNEL32.@) - * lstrcpy (KERNEL32.@) - */ -LPSTR WINAPI lstrcpyA( LPSTR dst, LPCSTR src ) -{ - __TRY - { - /* this is how Windows does it */ - memmove( dst, src, strlen(src)+1 ); - } - __EXCEPT_PAGE_FAULT - { - SetLastError( ERROR_INVALID_PARAMETER ); - return NULL; - } - __ENDTRY - return dst; -} - - -/*********************************************************************** - * lstrcpyW (KERNEL32.@) - */ -LPWSTR WINAPI lstrcpyW( LPWSTR dst, LPCWSTR src ) -{ - __TRY - { - strcpyW( dst, src ); - } - __EXCEPT_PAGE_FAULT - { - SetLastError( ERROR_INVALID_PARAMETER ); - return NULL; - } - __ENDTRY - return dst; -} diff --git a/dlls/kernel32/virtual.c b/dlls/kernel32/virtual.c index 183a3fe05a..97581a5db1 100644 --- a/dlls/kernel32/virtual.c +++ b/dlls/kernel32/virtual.c @@ -30,6 +30,7 @@ # include <unistd.h> #endif +#define WINE_NO_INLINE_STRING #include "ntstatus.h" #define WIN32_NO_STATUS #define NONAMELESSUNION @@ -40,6 +41,7 @@ #include "winerror.h" #include "psapi.h" #include "wine/exception.h" +#include "wine/unicode.h" #include "wine/debug.h" #include "kernel_private.h" @@ -256,3 +258,80 @@ BOOL WINAPI IsBadStringPtrW( LPCWSTR str, UINT_PTR max ) __ENDTRY return FALSE; } +/*********************************************************************** + * lstrcatA (KERNEL32.@) + * lstrcat (KERNEL32.@) + */ +LPSTR WINAPI lstrcatA( LPSTR dst, LPCSTR src ) +{ + __TRY + { + strcat( dst, src ); + } + __EXCEPT( badptr_handler ) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return NULL; + } + __ENDTRY + return dst; +} + + +/*********************************************************************** + * lstrcatW (KERNEL32.@) + */ +LPWSTR WINAPI lstrcatW( LPWSTR dst, LPCWSTR src ) +{ + __TRY + { + strcatW( dst, src ); + } + __EXCEPT( badptr_handler ) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return NULL; + } + __ENDTRY + return dst; +} + + +/*********************************************************************** + * lstrcpyA (KERNEL32.@) + * lstrcpy (KERNEL32.@) + */ +LPSTR WINAPI lstrcpyA( LPSTR dst, LPCSTR src ) +{ + __TRY + { + /* this is how Windows does it */ + memmove( dst, src, strlen(src)+1 ); + } + __EXCEPT( badptr_handler ) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return NULL; + } + __ENDTRY + return dst; +} + + +/*********************************************************************** + * lstrcpyW (KERNEL32.@) + */ +LPWSTR WINAPI lstrcpyW( LPWSTR dst, LPCWSTR src ) +{ + __TRY + { + strcpyW( dst, src ); + } + __EXCEPT( badptr_handler ) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return NULL; + } + __ENDTRY + return dst; +}
1
0
0
0
Alexandre Julliard : kernel32: Remove time.c.
by Alexandre Julliard
26 May '20
26 May '20
Module: wine Branch: master Commit: f41e205dfcdbadc1f44a358310a692523bb91cab URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f41e205dfcdbadc1f44a3583…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue May 26 14:51:16 2020 +0200 kernel32: Remove time.c. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/Makefile.in | 1 - dlls/kernel32/kernel_private.h | 2 - dlls/kernel32/lcformat.c | 36 ++++++++++- dlls/kernel32/locale.c | 11 ++++ dlls/kernel32/sync.c | 29 +++++++++ dlls/kernel32/time.c | 135 ----------------------------------------- 6 files changed, 75 insertions(+), 139 deletions(-) diff --git a/dlls/kernel32/Makefile.in b/dlls/kernel32/Makefile.in index 801d8dd7fc..28a15f8bbe 100644 --- a/dlls/kernel32/Makefile.in +++ b/dlls/kernel32/Makefile.in @@ -29,7 +29,6 @@ C_SRCS = \ tape.c \ term.c \ thread.c \ - time.c \ toolhelp.c \ version.c \ virtual.c \ diff --git a/dlls/kernel32/kernel_private.h b/dlls/kernel32/kernel_private.h index 7c1d548ff1..bcf2ee9a52 100644 --- a/dlls/kernel32/kernel_private.h +++ b/dlls/kernel32/kernel_private.h @@ -64,8 +64,6 @@ extern void FILE_SetDosError(void) DECLSPEC_HIDDEN; extern WCHAR *FILE_name_AtoW( LPCSTR name, BOOL alloc ) DECLSPEC_HIDDEN; extern DWORD FILE_name_WtoA( LPCWSTR src, INT srclen, LPSTR dest, INT destlen ) DECLSPEC_HIDDEN; -extern BOOL NLS_IsUnicodeOnlyLcid(LCID) DECLSPEC_HIDDEN; - /* computername.c */ extern void COMPUTERNAME_Init(void) DECLSPEC_HIDDEN; diff --git a/dlls/kernel32/lcformat.c b/dlls/kernel32/lcformat.c index 165cb07dd4..91fab3dc45 100644 --- a/dlls/kernel32/lcformat.c +++ b/dlls/kernel32/lcformat.c @@ -320,7 +320,7 @@ static const NLS_FORMAT_NODE *NLS_GetFormats(LCID lcid, DWORD dwFlags) * * Determine if a locale is Unicode only, and thus invalid in ASCII calls. */ -BOOL NLS_IsUnicodeOnlyLcid(LCID lcid) +static BOOL NLS_IsUnicodeOnlyLcid(LCID lcid) { lcid = ConvertDefaultLocale(lcid); @@ -1767,3 +1767,37 @@ int WINAPI GetCurrencyFormatEx(LPCWSTR localename, DWORD flags, LPCWSTR value, return GetCurrencyFormatW( LocaleNameToLCID(localename, 0), flags, value, format, str, len); } + +/********************************************************************* + * GetCalendarInfoA (KERNEL32.@) + */ +int WINAPI GetCalendarInfoA( LCID lcid, CALID id, CALTYPE type, LPSTR data, int size, DWORD *val ) +{ + int ret, sizeW = size; + LPWSTR dataW = NULL; + + if (NLS_IsUnicodeOnlyLcid(lcid)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + if (!size && !(type & CAL_RETURN_NUMBER)) sizeW = GetCalendarInfoW( lcid, id, type, NULL, 0, NULL ); + if (!(dataW = HeapAlloc(GetProcessHeap(), 0, sizeW * sizeof(WCHAR)))) return 0; + + ret = GetCalendarInfoW( lcid, id, type, dataW, sizeW, val ); + if(ret && dataW && data) + ret = WideCharToMultiByte( CP_ACP, 0, dataW, -1, data, size, NULL, NULL ); + else if (type & CAL_RETURN_NUMBER) + ret *= sizeof(WCHAR); + HeapFree( GetProcessHeap(), 0, dataW ); + return ret; +} + +/********************************************************************* + * SetCalendarInfoA (KERNEL32.@) + */ +int WINAPI SetCalendarInfoA( LCID lcid, CALID id, CALTYPE type, LPCSTR data) +{ + FIXME("(%08x,%08x,%08x,%s): stub\n", lcid, id, type, debugstr_a(data)); + return 0; +} diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c index 58389f6697..0ca4f39d26 100644 --- a/dlls/kernel32/locale.c +++ b/dlls/kernel32/locale.c @@ -172,6 +172,17 @@ BOOL WINAPI GetCPInfoExA( UINT codepage, DWORD dwFlags, LPCPINFOEXA cpinfo ) return TRUE; } + +/********************************************************************* + * GetDaylightFlag (KERNEL32.@) + */ +BOOL WINAPI GetDaylightFlag(void) +{ + TIME_ZONE_INFORMATION tzinfo; + return GetTimeZoneInformation( &tzinfo) == TIME_ZONE_ID_DAYLIGHT; +} + + /*********************************************************************** * EnumSystemCodePagesA (KERNEL32.@) */ diff --git a/dlls/kernel32/sync.c b/dlls/kernel32/sync.c index d0301e484d..4032315750 100644 --- a/dlls/kernel32/sync.c +++ b/dlls/kernel32/sync.c @@ -49,6 +49,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(sync); +static const struct _KUSER_SHARED_DATA *user_shared_data = (struct _KUSER_SHARED_DATA *)0x7ffe0000; + + static void get_create_object_attributes( OBJECT_ATTRIBUTES *attr, UNICODE_STRING *nameW, SECURITY_ATTRIBUTES *sa, const WCHAR *name ) { @@ -100,6 +103,32 @@ static HANDLE normalize_handle_if_console(HANDLE handle) return handle; } +/****************************************************************************** + * GetTickCount64 (KERNEL32.@) + */ +ULONGLONG WINAPI DECLSPEC_HOTPATCH GetTickCount64(void) +{ + ULONG high, low; + + do + { + high = user_shared_data->u.TickCount.High1Time; + low = user_shared_data->u.TickCount.LowPart; + } + while (high != user_shared_data->u.TickCount.High2Time); + /* note: we ignore TickCountMultiplier */ + return (ULONGLONG)high << 32 | low; +} + +/*********************************************************************** + * GetTickCount (KERNEL32.@) + */ +DWORD WINAPI DECLSPEC_HOTPATCH GetTickCount(void) +{ + /* note: we ignore TickCountMultiplier */ + return user_shared_data->u.TickCount.LowPart; +} + /*********************************************************************** * RegisterWaitForSingleObject (KERNEL32.@) */ diff --git a/dlls/kernel32/time.c b/dlls/kernel32/time.c deleted file mode 100644 index 94ccbfb2b9..0000000000 --- a/dlls/kernel32/time.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Win32 kernel time functions - * - * Copyright 1995 Martin von Loewis and Cameron Heide - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "config.h" - -#include <string.h> -#ifdef HAVE_UNISTD_H -# include <unistd.h> -#endif -#include <stdarg.h> -#include <stdlib.h> -#include <time.h> -#ifdef HAVE_SYS_TIME_H -# include <sys/time.h> -#endif - -#include "ntstatus.h" -#define WIN32_NO_STATUS -#define NONAMELESSUNION -#include "windef.h" -#include "winbase.h" -#include "winreg.h" -#include "winternl.h" -#include "ddk/wdm.h" -#include "kernel_private.h" -#include "wine/unicode.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(time); - -static const struct _KUSER_SHARED_DATA *user_shared_data = (struct _KUSER_SHARED_DATA *)0x7ffe0000; - - -/********************************************************************* - * GetCalendarInfoA (KERNEL32.@) - * - */ -int WINAPI GetCalendarInfoA(LCID lcid, CALID Calendar, CALTYPE CalType, - LPSTR lpCalData, int cchData, LPDWORD lpValue) -{ - int ret, cchDataW = cchData; - LPWSTR lpCalDataW = NULL; - - if (NLS_IsUnicodeOnlyLcid(lcid)) - { - SetLastError(ERROR_INVALID_PARAMETER); - return 0; - } - - if (!cchData && !(CalType & CAL_RETURN_NUMBER)) - cchDataW = GetCalendarInfoW(lcid, Calendar, CalType, NULL, 0, NULL); - if (!(lpCalDataW = HeapAlloc(GetProcessHeap(), 0, cchDataW*sizeof(WCHAR)))) - return 0; - - ret = GetCalendarInfoW(lcid, Calendar, CalType, lpCalDataW, cchDataW, lpValue); - if(ret && lpCalDataW && lpCalData) - ret = WideCharToMultiByte(CP_ACP, 0, lpCalDataW, -1, lpCalData, cchData, NULL, NULL); - else if (CalType & CAL_RETURN_NUMBER) - ret *= sizeof(WCHAR); - HeapFree(GetProcessHeap(), 0, lpCalDataW); - - return ret; -} - -/********************************************************************* - * SetCalendarInfoA (KERNEL32.@) - * - */ -int WINAPI SetCalendarInfoA(LCID Locale, CALID Calendar, CALTYPE CalType, LPCSTR lpCalData) -{ - FIXME("(%08x,%08x,%08x,%s): stub\n", - Locale, Calendar, CalType, debugstr_a(lpCalData)); - return 0; -} - -/********************************************************************* - * GetDaylightFlag (KERNEL32.@) - * - * Specifies if daylight savings time is in operation. - * - * NOTES - * This function is called from the Win98's control applet timedate.cpl. - * - * RETURNS - * TRUE if daylight savings time is in operation. - * FALSE otherwise. - */ -BOOL WINAPI GetDaylightFlag(void) -{ - TIME_ZONE_INFORMATION tzinfo; - return GetTimeZoneInformation( &tzinfo) == TIME_ZONE_ID_DAYLIGHT; -} - -/****************************************************************************** - * GetTickCount64 (KERNEL32.@) - */ -ULONGLONG WINAPI DECLSPEC_HOTPATCH GetTickCount64(void) -{ - ULONG high, low; - - do - { - high = user_shared_data->u.TickCount.High1Time; - low = user_shared_data->u.TickCount.LowPart; - } - while (high != user_shared_data->u.TickCount.High2Time); - /* note: we ignore TickCountMultiplier */ - return (ULONGLONG)high << 32 | low; -} - -/*********************************************************************** - * GetTickCount (KERNEL32.@) - */ -DWORD WINAPI DECLSPEC_HOTPATCH GetTickCount(void) -{ - /* note: we ignore TickCountMultiplier */ - return user_shared_data->u.TickCount.LowPart; -}
1
0
0
0
Alexandre Julliard : kernel32: Remove environ.c.
by Alexandre Julliard
26 May '20
26 May '20
Module: wine Branch: master Commit: 3c9cf9b65f14baa8e439c82cbff3be937f1f8534 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3c9cf9b65f14baa8e439c82c…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue May 26 14:42:49 2020 +0200 kernel32: Remove environ.c. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/Makefile.in | 1 - dlls/kernel32/environ.c | 115 ----------------------------------------- dlls/kernel32/kernel_main.c | 45 ++++++++++++++-- dlls/kernel32/kernel_private.h | 6 --- dlls/kernel32/process.c | 20 +++++++ 5 files changed, 62 insertions(+), 125 deletions(-) diff --git a/dlls/kernel32/Makefile.in b/dlls/kernel32/Makefile.in index 38c5b55de7..801d8dd7fc 100644 --- a/dlls/kernel32/Makefile.in +++ b/dlls/kernel32/Makefile.in @@ -12,7 +12,6 @@ C_SRCS = \ console.c \ debugger.c \ editline.c \ - environ.c \ file.c \ heap.c \ kernel_main.c \ diff --git a/dlls/kernel32/environ.c b/dlls/kernel32/environ.c deleted file mode 100644 index 2d80600f78..0000000000 --- a/dlls/kernel32/environ.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Process environment management - * - * Copyright 1996, 1998 Alexandre Julliard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "config.h" -#include "wine/port.h" - -#include <stdarg.h> -#include <stdlib.h> -#include <string.h> -#include <assert.h> - -#include "ntstatus.h" -#define WIN32_NO_STATUS -#include "windef.h" -#include "winbase.h" -#include "winerror.h" -#include "wine/library.h" -#include "winternl.h" -#include "wine/unicode.h" -#include "wine/debug.h" - -#include "kernel_private.h" - -WINE_DEFAULT_DEBUG_CHANNEL(environ); - -/* Notes: - * - contrary to Microsoft docs, the environment strings do not appear - * to be sorted on Win95 (although they are on NT); so we don't bother - * to sort them either. - */ - -static STARTUPINFOA startup_infoA; - -/*********************************************************************** - * GetStartupInfoA (KERNEL32.@) - */ -VOID WINAPI GetStartupInfoA( LPSTARTUPINFOA info ) -{ - *info = startup_infoA; -} - -/****************************************************************** - * ENV_CopyStartupInformation (internal) - * - * Creates the STARTUPINFO information from the ntdll information - */ -void ENV_CopyStartupInformation(void) -{ - RTL_USER_PROCESS_PARAMETERS* rupp; - ANSI_STRING ansi; - - RtlAcquirePebLock(); - - rupp = NtCurrentTeb()->Peb->ProcessParameters; - - startup_infoA.cb = sizeof(startup_infoA); - startup_infoA.lpReserved = NULL; - startup_infoA.lpDesktop = RtlUnicodeStringToAnsiString( &ansi, &rupp->Desktop, TRUE ) == STATUS_SUCCESS ? - ansi.Buffer : NULL; - startup_infoA.lpTitle = RtlUnicodeStringToAnsiString( &ansi, &rupp->WindowTitle, TRUE ) == STATUS_SUCCESS ? - ansi.Buffer : NULL; - startup_infoA.dwX = rupp->dwX; - startup_infoA.dwY = rupp->dwY; - startup_infoA.dwXSize = rupp->dwXSize; - startup_infoA.dwYSize = rupp->dwYSize; - startup_infoA.dwXCountChars = rupp->dwXCountChars; - startup_infoA.dwYCountChars = rupp->dwYCountChars; - startup_infoA.dwFillAttribute = rupp->dwFillAttribute; - startup_infoA.dwFlags = rupp->dwFlags; - startup_infoA.wShowWindow = rupp->wShowWindow; - startup_infoA.cbReserved2 = rupp->RuntimeInfo.MaximumLength; - startup_infoA.lpReserved2 = rupp->RuntimeInfo.MaximumLength ? (void*)rupp->RuntimeInfo.Buffer : NULL; - startup_infoA.hStdInput = rupp->hStdInput ? rupp->hStdInput : INVALID_HANDLE_VALUE; - startup_infoA.hStdOutput = rupp->hStdOutput ? rupp->hStdOutput : INVALID_HANDLE_VALUE; - startup_infoA.hStdError = rupp->hStdError ? rupp->hStdError : INVALID_HANDLE_VALUE; - - RtlReleasePebLock(); -} - -/*********************************************************************** - * GetFirmwareEnvironmentVariableA (KERNEL32.@) - */ -DWORD WINAPI GetFirmwareEnvironmentVariableA(LPCSTR name, LPCSTR guid, PVOID buffer, DWORD size) -{ - FIXME("stub: %s %s %p %u\n", debugstr_a(name), debugstr_a(guid), buffer, size); - SetLastError(ERROR_INVALID_FUNCTION); - return 0; -} - -/*********************************************************************** - * GetFirmwareEnvironmentVariableW (KERNEL32.@) - */ -DWORD WINAPI GetFirmwareEnvironmentVariableW(LPCWSTR name, LPCWSTR guid, PVOID buffer, DWORD size) -{ - FIXME("stub: %s %s %p %u\n", debugstr_w(name), debugstr_w(guid), buffer, size); - SetLastError(ERROR_INVALID_FUNCTION); - return 0; -} diff --git a/dlls/kernel32/kernel_main.c b/dlls/kernel32/kernel_main.c index fbc2e8daee..d312f11081 100644 --- a/dlls/kernel32/kernel_main.c +++ b/dlls/kernel32/kernel_main.c @@ -33,7 +33,6 @@ #include "wincon.h" #include "winternl.h" -#include "wine/library.h" #include "kernel_private.h" #include "console_private.h" #include "wine/debug.h" @@ -42,6 +41,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(process); extern int CDECL __wine_set_signal_handler(unsigned, int (*)(unsigned)); +static STARTUPINFOA startup_infoA; + /*********************************************************************** * set_entry_point */ @@ -77,6 +78,45 @@ static void set_entry_point( HMODULE module, const char *name, DWORD rva ) } +/*********************************************************************** + * GetStartupInfoA (KERNEL32.@) + */ +VOID WINAPI GetStartupInfoA( LPSTARTUPINFOA info ) +{ + *info = startup_infoA; +} + +static void copy_startup_info(void) +{ + RTL_USER_PROCESS_PARAMETERS* rupp; + ANSI_STRING ansi; + + RtlAcquirePebLock(); + + rupp = NtCurrentTeb()->Peb->ProcessParameters; + + startup_infoA.cb = sizeof(startup_infoA); + startup_infoA.lpReserved = NULL; + startup_infoA.lpDesktop = !RtlUnicodeStringToAnsiString( &ansi, &rupp->Desktop, TRUE ) ? ansi.Buffer : NULL; + startup_infoA.lpTitle = !RtlUnicodeStringToAnsiString( &ansi, &rupp->WindowTitle, TRUE ) ? ansi.Buffer : NULL; + startup_infoA.dwX = rupp->dwX; + startup_infoA.dwY = rupp->dwY; + startup_infoA.dwXSize = rupp->dwXSize; + startup_infoA.dwYSize = rupp->dwYSize; + startup_infoA.dwXCountChars = rupp->dwXCountChars; + startup_infoA.dwYCountChars = rupp->dwYCountChars; + startup_infoA.dwFillAttribute = rupp->dwFillAttribute; + startup_infoA.dwFlags = rupp->dwFlags; + startup_infoA.wShowWindow = rupp->wShowWindow; + startup_infoA.cbReserved2 = rupp->RuntimeInfo.MaximumLength; + startup_infoA.lpReserved2 = rupp->RuntimeInfo.MaximumLength ? (void*)rupp->RuntimeInfo.Buffer : NULL; + startup_infoA.hStdInput = rupp->hStdInput ? rupp->hStdInput : INVALID_HANDLE_VALUE; + startup_infoA.hStdOutput = rupp->hStdOutput ? rupp->hStdOutput : INVALID_HANDLE_VALUE; + startup_infoA.hStdError = rupp->hStdError ? rupp->hStdError : INVALID_HANDLE_VALUE; + + RtlReleasePebLock(); +} + /*********************************************************************** * KERNEL process initialisation routine */ @@ -94,8 +134,7 @@ static BOOL process_attach( HMODULE module ) CONSOLE_Init(params); - /* copy process information from ntdll */ - ENV_CopyStartupInformation(); + copy_startup_info(); if (!(GetVersion() & 0x80000000)) { diff --git a/dlls/kernel32/kernel_private.h b/dlls/kernel32/kernel_private.h index d845623265..7c1d548ff1 100644 --- a/dlls/kernel32/kernel_private.h +++ b/dlls/kernel32/kernel_private.h @@ -66,13 +66,7 @@ extern DWORD FILE_name_WtoA( LPCWSTR src, INT srclen, LPSTR dest, INT destlen ) extern BOOL NLS_IsUnicodeOnlyLcid(LCID) DECLSPEC_HIDDEN; -/* environ.c */ -extern void ENV_CopyStartupInformation(void) DECLSPEC_HIDDEN; - /* computername.c */ extern void COMPUTERNAME_Init(void) DECLSPEC_HIDDEN; -/* oldconfig.c */ -extern void convert_old_config(void) DECLSPEC_HIDDEN; - #endif diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c index 66fa4ad506..8f506fcf13 100644 --- a/dlls/kernel32/process.c +++ b/dlls/kernel32/process.c @@ -741,6 +741,26 @@ DWORD64 WINAPI GetEnabledXStateFeatures(void) return 0; } +/*********************************************************************** + * GetFirmwareEnvironmentVariableA (KERNEL32.@) + */ +DWORD WINAPI GetFirmwareEnvironmentVariableA(LPCSTR name, LPCSTR guid, PVOID buffer, DWORD size) +{ + FIXME("stub: %s %s %p %u\n", debugstr_a(name), debugstr_a(guid), buffer, size); + SetLastError(ERROR_INVALID_FUNCTION); + return 0; +} + +/*********************************************************************** + * GetFirmwareEnvironmentVariableW (KERNEL32.@) + */ +DWORD WINAPI GetFirmwareEnvironmentVariableW(LPCWSTR name, LPCWSTR guid, PVOID buffer, DWORD size) +{ + FIXME("stub: %s %s %p %u\n", debugstr_w(name), debugstr_w(guid), buffer, size); + SetLastError(ERROR_INVALID_FUNCTION); + return 0; +} + /********************************************************************** * GetNumaNodeProcessorMask (KERNEL32.@) */
1
0
0
0
Alexandre Julliard : kernel32: Remove cpu.c.
by Alexandre Julliard
26 May '20
26 May '20
Module: wine Branch: master Commit: 1b653e020d4ac5bc0a356c643e2f573ae8a6977d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=1b653e020d4ac5bc0a356c64…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue May 26 14:39:36 2020 +0200 kernel32: Remove cpu.c. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/Makefile.in | 1 - dlls/kernel32/cpu.c | 95 ----------------------------------------------- dlls/kernel32/process.c | 46 ++++++++++++++++++++--- 3 files changed, 41 insertions(+), 101 deletions(-) diff --git a/dlls/kernel32/Makefile.in b/dlls/kernel32/Makefile.in index c32cb5e53f..38c5b55de7 100644 --- a/dlls/kernel32/Makefile.in +++ b/dlls/kernel32/Makefile.in @@ -10,7 +10,6 @@ C_SRCS = \ comm.c \ computername.c \ console.c \ - cpu.c \ debugger.c \ editline.c \ environ.c \ diff --git a/dlls/kernel32/cpu.c b/dlls/kernel32/cpu.c deleted file mode 100644 index 63014ea1c9..0000000000 --- a/dlls/kernel32/cpu.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * What processor? - * - * Copyright 1995,1997 Morten Welinder - * Copyright 1997-1998 Marcus Meissner - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "config.h" -#include "wine/port.h" - -#include <stdarg.h> -#include <stdio.h> -#include <stdlib.h> -#ifdef HAVE_SYS_TIME_H -# include <sys/time.h> -#endif - - -#define NONAMELESSUNION -#define NONAMELESSSTRUCT -#include "ntstatus.h" -#define WIN32_NO_STATUS -#include "windef.h" -#include "winbase.h" -#include "winnt.h" -#include "winternl.h" -#include "psapi.h" -#include "ddk/wdm.h" -#include "wine/unicode.h" -#include "kernel_private.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(reg); - -/*********************************************************************** - * GetActiveProcessorGroupCount (KERNEL32.@) - */ -WORD WINAPI GetActiveProcessorGroupCount(void) -{ - FIXME("semi-stub, always returning 1\n"); - return 1; -} - -/*********************************************************************** - * GetActiveProcessorCount (KERNEL32.@) - */ -DWORD WINAPI GetActiveProcessorCount(WORD group) -{ - SYSTEM_INFO si; - DWORD cpus; - - GetSystemInfo( &si ); - cpus = si.dwNumberOfProcessors; - - FIXME("semi-stub, returning %u\n", cpus); - return cpus; -} - -/*********************************************************************** - * GetMaximumProcessorCount (KERNEL32.@) - */ -DWORD WINAPI GetMaximumProcessorCount(WORD group) -{ - SYSTEM_INFO si; - DWORD cpus; - - GetSystemInfo( &si ); - cpus = si.dwNumberOfProcessors; - - FIXME("semi-stub, returning %u\n", cpus); - return cpus; -} - -/*********************************************************************** - * GetEnabledXStateFeatures (KERNEL32.@) - */ -DWORD64 WINAPI GetEnabledXStateFeatures(void) -{ - FIXME("\n"); - return 0; -} diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c index 9adf25ab48..66fa4ad506 100644 --- a/dlls/kernel32/process.c +++ b/dlls/kernel32/process.c @@ -53,7 +53,6 @@ #include "kernel_private.h" #include "psapi.h" #include "wine/exception.h" -#include "wine/library.h" #include "wine/server.h" #include "wine/unicode.h" #include "wine/asm.h" @@ -702,6 +701,46 @@ HRESULT WINAPI RegisterApplicationRecoveryCallback(APPLICATION_RECOVERY_CALLBACK return S_OK; } +/*********************************************************************** + * GetActiveProcessorGroupCount (KERNEL32.@) + */ +WORD WINAPI GetActiveProcessorGroupCount(void) +{ + FIXME("semi-stub, always returning 1\n"); + return 1; +} + +/*********************************************************************** + * GetActiveProcessorCount (KERNEL32.@) + */ +DWORD WINAPI GetActiveProcessorCount(WORD group) +{ + DWORD cpus = system_info.NumberOfProcessors; + + FIXME("semi-stub, returning %u\n", cpus); + return cpus; +} + +/*********************************************************************** + * GetMaximumProcessorCount (KERNEL32.@) + */ +DWORD WINAPI GetMaximumProcessorCount(WORD group) +{ + DWORD cpus = system_info.NumberOfProcessors; + + FIXME("semi-stub, returning %u\n", cpus); + return cpus; +} + +/*********************************************************************** + * GetEnabledXStateFeatures (KERNEL32.@) + */ +DWORD64 WINAPI GetEnabledXStateFeatures(void) +{ + FIXME("\n"); + return 0; +} + /********************************************************************** * GetNumaNodeProcessorMask (KERNEL32.@) */ @@ -737,12 +776,9 @@ BOOL WINAPI GetNumaAvailableMemoryNodeEx(USHORT node, PULONGLONG available_bytes */ BOOL WINAPI GetNumaProcessorNode(UCHAR processor, PUCHAR node) { - SYSTEM_INFO si; - TRACE("(%d, %p)\n", processor, node); - GetSystemInfo( &si ); - if (processor < si.dwNumberOfProcessors) + if (processor < system_info.NumberOfProcessors) { *node = 0; return TRUE;
1
0
0
0
Alexandre Julliard : kernel32: Remove actctx.c.
by Alexandre Julliard
26 May '20
26 May '20
Module: wine Branch: master Commit: 30428c19c184d08c6b8ae39ef758847313822806 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=30428c19c184d08c6b8ae39e…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue May 26 14:38:20 2020 +0200 kernel32: Remove actctx.c. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/Makefile.in | 1 - dlls/kernel32/actctx.c | 142 ---------------------------------------------- dlls/kernel32/process.c | 101 +++++++++++++++++++++++++++++++++ 3 files changed, 101 insertions(+), 143 deletions(-) diff --git a/dlls/kernel32/Makefile.in b/dlls/kernel32/Makefile.in index d9b1ca575c..c32cb5e53f 100644 --- a/dlls/kernel32/Makefile.in +++ b/dlls/kernel32/Makefile.in @@ -6,7 +6,6 @@ EXTRALIBS = $(COREFOUNDATION_LIBS) $(POLL_LIBS) $(RT_LIBS) EXTRADLLFLAGS = -nodefaultlibs -Wb,-F,KERNEL32.dll -Wl,--image-base,0x7b600000 C_SRCS = \ - actctx.c \ atom.c \ comm.c \ computername.c \ diff --git a/dlls/kernel32/actctx.c b/dlls/kernel32/actctx.c deleted file mode 100644 index 794fbe8d0a..0000000000 --- a/dlls/kernel32/actctx.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Activation contexts - * - * Copyright 2004 Jon Griffiths - * Copyright 2007 Eric Pouech - * Copyright 2007 Jacek Caban for CodeWeavers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "config.h" -#include "wine/port.h" - -#include <stdarg.h> -#include "windef.h" -#include "winbase.h" -#include "winerror.h" -#include "winnls.h" -#include "winternl.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(actctx); - -/*********************************************************************** - * CreateActCtxA (KERNEL32.@) - * - * Create an activation context. - */ -HANDLE WINAPI DECLSPEC_HOTPATCH CreateActCtxA(PCACTCTXA pActCtx) -{ - ACTCTXW actw; - SIZE_T len; - HANDLE ret = INVALID_HANDLE_VALUE; - LPWSTR src = NULL, assdir = NULL, resname = NULL, appname = NULL; - - TRACE("%p %08x\n", pActCtx, pActCtx ? pActCtx->dwFlags : 0); - - if (!pActCtx || pActCtx->cbSize != sizeof(*pActCtx)) - { - SetLastError(ERROR_INVALID_PARAMETER); - return INVALID_HANDLE_VALUE; - } - - actw.cbSize = sizeof(actw); - actw.dwFlags = pActCtx->dwFlags; - if (pActCtx->lpSource) - { - len = MultiByteToWideChar(CP_ACP, 0, pActCtx->lpSource, -1, NULL, 0); - src = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); - if (!src) return INVALID_HANDLE_VALUE; - MultiByteToWideChar(CP_ACP, 0, pActCtx->lpSource, -1, src, len); - } - actw.lpSource = src; - - if (actw.dwFlags & ACTCTX_FLAG_PROCESSOR_ARCHITECTURE_VALID) - actw.wProcessorArchitecture = pActCtx->wProcessorArchitecture; - if (actw.dwFlags & ACTCTX_FLAG_LANGID_VALID) - actw.wLangId = pActCtx->wLangId; - if (actw.dwFlags & ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID) - { - len = MultiByteToWideChar(CP_ACP, 0, pActCtx->lpAssemblyDirectory, -1, NULL, 0); - assdir = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); - if (!assdir) goto done; - MultiByteToWideChar(CP_ACP, 0, pActCtx->lpAssemblyDirectory, -1, assdir, len); - actw.lpAssemblyDirectory = assdir; - } - if (actw.dwFlags & ACTCTX_FLAG_RESOURCE_NAME_VALID) - { - if ((ULONG_PTR)pActCtx->lpResourceName >> 16) - { - len = MultiByteToWideChar(CP_ACP, 0, pActCtx->lpResourceName, -1, NULL, 0); - resname = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); - if (!resname) goto done; - MultiByteToWideChar(CP_ACP, 0, pActCtx->lpResourceName, -1, resname, len); - actw.lpResourceName = resname; - } - else actw.lpResourceName = (LPCWSTR)pActCtx->lpResourceName; - } - if (actw.dwFlags & ACTCTX_FLAG_APPLICATION_NAME_VALID) - { - len = MultiByteToWideChar(CP_ACP, 0, pActCtx->lpApplicationName, -1, NULL, 0); - appname = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); - if (!appname) goto done; - MultiByteToWideChar(CP_ACP, 0, pActCtx->lpApplicationName, -1, appname, len); - actw.lpApplicationName = appname; - } - if (actw.dwFlags & ACTCTX_FLAG_HMODULE_VALID) - actw.hModule = pActCtx->hModule; - - ret = CreateActCtxW(&actw); - -done: - HeapFree(GetProcessHeap(), 0, src); - HeapFree(GetProcessHeap(), 0, assdir); - HeapFree(GetProcessHeap(), 0, resname); - HeapFree(GetProcessHeap(), 0, appname); - return ret; -} - -/*********************************************************************** - * FindActCtxSectionStringA (KERNEL32.@) - * - * Find information about a string in an activation context. - */ -BOOL WINAPI FindActCtxSectionStringA(DWORD dwFlags, const GUID* lpExtGuid, - ULONG ulId, LPCSTR lpSearchStr, - PACTCTX_SECTION_KEYED_DATA pInfo) -{ - LPWSTR search_str; - DWORD len; - BOOL ret; - - TRACE("%08x %s %u %s %p\n", dwFlags, debugstr_guid(lpExtGuid), - ulId, debugstr_a(lpSearchStr), pInfo); - - if (!lpSearchStr || !pInfo) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - len = MultiByteToWideChar(CP_ACP, 0, lpSearchStr, -1, NULL, 0); - search_str = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); - MultiByteToWideChar(CP_ACP, 0, lpSearchStr, -1, search_str, len); - - ret = FindActCtxSectionStringW(dwFlags, lpExtGuid, ulId, search_str, pInfo); - - HeapFree(GetProcessHeap(), 0, search_str); - return ret; -} diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c index 1c3ed9938f..9adf25ab48 100644 --- a/dlls/kernel32/process.c +++ b/dlls/kernel32/process.c @@ -515,6 +515,107 @@ HANDLE WINAPI KERNEL32_GetCurrentProcess(void) return (HANDLE)~(ULONG_PTR)0; } + +/*********************************************************************** + * CreateActCtxA (KERNEL32.@) + */ +HANDLE WINAPI DECLSPEC_HOTPATCH CreateActCtxA( const ACTCTXA *actctx ) +{ + ACTCTXW actw; + SIZE_T len; + HANDLE ret = INVALID_HANDLE_VALUE; + LPWSTR src = NULL, assdir = NULL, resname = NULL, appname = NULL; + + TRACE("%p %08x\n", actctx, actctx ? actctx->dwFlags : 0); + + if (!actctx || actctx->cbSize != sizeof(*actctx)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return INVALID_HANDLE_VALUE; + } + + actw.cbSize = sizeof(actw); + actw.dwFlags = actctx->dwFlags; + if (actctx->lpSource) + { + len = MultiByteToWideChar(CP_ACP, 0, actctx->lpSource, -1, NULL, 0); + src = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + if (!src) return INVALID_HANDLE_VALUE; + MultiByteToWideChar(CP_ACP, 0, actctx->lpSource, -1, src, len); + } + actw.lpSource = src; + + if (actw.dwFlags & ACTCTX_FLAG_PROCESSOR_ARCHITECTURE_VALID) + actw.wProcessorArchitecture = actctx->wProcessorArchitecture; + if (actw.dwFlags & ACTCTX_FLAG_LANGID_VALID) + actw.wLangId = actctx->wLangId; + if (actw.dwFlags & ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID) + { + len = MultiByteToWideChar(CP_ACP, 0, actctx->lpAssemblyDirectory, -1, NULL, 0); + assdir = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + if (!assdir) goto done; + MultiByteToWideChar(CP_ACP, 0, actctx->lpAssemblyDirectory, -1, assdir, len); + actw.lpAssemblyDirectory = assdir; + } + if (actw.dwFlags & ACTCTX_FLAG_RESOURCE_NAME_VALID) + { + if ((ULONG_PTR)actctx->lpResourceName >> 16) + { + len = MultiByteToWideChar(CP_ACP, 0, actctx->lpResourceName, -1, NULL, 0); + resname = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + if (!resname) goto done; + MultiByteToWideChar(CP_ACP, 0, actctx->lpResourceName, -1, resname, len); + actw.lpResourceName = resname; + } + else actw.lpResourceName = (LPCWSTR)actctx->lpResourceName; + } + if (actw.dwFlags & ACTCTX_FLAG_APPLICATION_NAME_VALID) + { + len = MultiByteToWideChar(CP_ACP, 0, actctx->lpApplicationName, -1, NULL, 0); + appname = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + if (!appname) goto done; + MultiByteToWideChar(CP_ACP, 0, actctx->lpApplicationName, -1, appname, len); + actw.lpApplicationName = appname; + } + if (actw.dwFlags & ACTCTX_FLAG_HMODULE_VALID) + actw.hModule = actctx->hModule; + + ret = CreateActCtxW(&actw); + +done: + HeapFree(GetProcessHeap(), 0, src); + HeapFree(GetProcessHeap(), 0, assdir); + HeapFree(GetProcessHeap(), 0, resname); + HeapFree(GetProcessHeap(), 0, appname); + return ret; +} + +/*********************************************************************** + * FindActCtxSectionStringA (KERNEL32.@) + */ +BOOL WINAPI FindActCtxSectionStringA( DWORD flags, const GUID *guid, ULONG id, const char *search, + ACTCTX_SECTION_KEYED_DATA *info ) +{ + LPWSTR searchW; + DWORD len; + BOOL ret; + + TRACE("%08x %s %u %s %p\n", flags, debugstr_guid(guid), id, debugstr_a(search), info); + + if (!search || !info) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + len = MultiByteToWideChar(CP_ACP, 0, search, -1, NULL, 0); + searchW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, search, -1, searchW, len); + ret = FindActCtxSectionStringW( flags, guid, id, searchW, info ); + HeapFree(GetProcessHeap(), 0, searchW); + return ret; +} + + /*********************************************************************** * CmdBatNotification (KERNEL32.@) *
1
0
0
0
Alexandre Julliard : kernel32: Reimplement DosDateTimeToFileTime/FileTimeToDosDateTime using ntdll functions.
by Alexandre Julliard
26 May '20
26 May '20
Module: wine Branch: master Commit: b6a38ea676081664a1fe0b318fe56339b255b6ed URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b6a38ea676081664a1fe0b31…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue May 26 14:05:10 2020 +0200 kernel32: Reimplement DosDateTimeToFileTime/FileTimeToDosDateTime using ntdll functions. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- configure | 3 --- configure.ac | 3 --- dlls/kernel32/file.c | 49 +++++++++++++++++++++++++++++++++++++ dlls/kernel32/time.c | 68 ---------------------------------------------------- include/config.h.in | 9 ------- 5 files changed, 49 insertions(+), 83 deletions(-) diff --git a/configure b/configure index a5516fe60e..b652ddbf79 100755 --- a/configure +++ b/configure @@ -7418,7 +7418,6 @@ for ac_header in \ mach/mach.h \ mach/machine.h \ machine/cpu.h \ - machine/limits.h \ machine/sysarch.h \ mntent.h \ ncurses.h \ @@ -7448,7 +7447,6 @@ for ac_header in \ sys/filio.h \ sys/ioctl.h \ sys/ipc.h \ - sys/limits.h \ sys/link.h \ sys/mman.h \ sys/modem.h \ @@ -17984,7 +17982,6 @@ for ac_func in \ sysinfo \ tcdrain \ thr_kill2 \ - timegm \ usleep do : diff --git a/configure.ac b/configure.ac index b43ec73929..c0f60fe694 100644 --- a/configure.ac +++ b/configure.ac @@ -473,7 +473,6 @@ AC_CHECK_HEADERS(\ mach/mach.h \ mach/machine.h \ machine/cpu.h \ - machine/limits.h \ machine/sysarch.h \ mntent.h \ ncurses.h \ @@ -503,7 +502,6 @@ AC_CHECK_HEADERS(\ sys/filio.h \ sys/ioctl.h \ sys/ipc.h \ - sys/limits.h \ sys/link.h \ sys/mman.h \ sys/modem.h \ @@ -2217,7 +2215,6 @@ AC_CHECK_FUNCS(\ sysinfo \ tcdrain \ thr_kill2 \ - timegm \ usleep ) CFLAGS="$ac_save_CFLAGS" diff --git a/dlls/kernel32/file.c b/dlls/kernel32/file.c index 4f25331a89..29dd5791af 100644 --- a/dlls/kernel32/file.c +++ b/dlls/kernel32/file.c @@ -407,6 +407,55 @@ BOOL WINAPI KERNEL32_FlushFileBuffers( HANDLE file ) } +/*********************************************************************** + * DosDateTimeToFileTime (KERNEL32.@) + */ +BOOL WINAPI DosDateTimeToFileTime( WORD fatdate, WORD fattime, FILETIME *ft ) +{ + TIME_FIELDS fields; + LARGE_INTEGER time; + + fields.Year = (fatdate >> 9) + 1980; + fields.Month = ((fatdate >> 5) & 0x0f); + fields.Day = (fatdate & 0x1f); + fields.Hour = (fattime >> 11); + fields.Minute = (fattime >> 5) & 0x3f; + fields.Second = (fattime & 0x1f) * 2; + fields.Milliseconds = 0; + if (!RtlTimeFieldsToTime( &fields, &time )) return FALSE; + ft->dwLowDateTime = time.u.LowPart; + ft->dwHighDateTime = time.u.HighPart; + return TRUE; +} + + +/*********************************************************************** + * FileTimeToDosDateTime (KERNEL32.@) + */ +BOOL WINAPI FileTimeToDosDateTime( const FILETIME *ft, WORD *fatdate, WORD *fattime ) +{ + TIME_FIELDS fields; + LARGE_INTEGER time; + + if (!fatdate || !fattime) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return FALSE; + } + time.u.LowPart = ft->dwLowDateTime; + time.u.HighPart = ft->dwHighDateTime; + RtlTimeToTimeFields( &time, &fields ); + if (fields.Year < 1980) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return FALSE; + } + *fattime = (fields.Hour << 11) + (fields.Minute << 5) + (fields.Second / 2); + *fatdate = ((fields.Year - 1980) << 9) + (fields.Month << 5) + fields.Day; + return TRUE; +} + + /************************************************************************** * Operations on file names * **************************************************************************/ diff --git a/dlls/kernel32/time.c b/dlls/kernel32/time.c index 4b959684c6..94ccbfb2b9 100644 --- a/dlls/kernel32/time.c +++ b/dlls/kernel32/time.c @@ -30,14 +30,6 @@ #ifdef HAVE_SYS_TIME_H # include <sys/time.h> #endif -#ifdef HAVE_SYS_TIMES_H -# include <sys/times.h> -#endif -#ifdef HAVE_SYS_LIMITS_H -#include <sys/limits.h> -#elif defined(HAVE_MACHINE_LIMITS_H) -#include <machine/limits.h> -#endif #include "ntstatus.h" #define WIN32_NO_STATUS @@ -116,66 +108,6 @@ BOOL WINAPI GetDaylightFlag(void) return GetTimeZoneInformation( &tzinfo) == TIME_ZONE_ID_DAYLIGHT; } -/*********************************************************************** - * DosDateTimeToFileTime (KERNEL32.@) - */ -BOOL WINAPI DosDateTimeToFileTime( WORD fatdate, WORD fattime, LPFILETIME ft) -{ - struct tm newtm; -#ifndef HAVE_TIMEGM - struct tm *gtm; - time_t time1, time2; -#endif - - newtm.tm_sec = (fattime & 0x1f) * 2; - newtm.tm_min = (fattime >> 5) & 0x3f; - newtm.tm_hour = (fattime >> 11); - newtm.tm_mday = (fatdate & 0x1f); - newtm.tm_mon = ((fatdate >> 5) & 0x0f) - 1; - newtm.tm_year = (fatdate >> 9) + 80; - newtm.tm_isdst = -1; -#ifdef HAVE_TIMEGM - RtlSecondsSince1970ToTime( timegm(&newtm), (LARGE_INTEGER *)ft ); -#else - time1 = mktime(&newtm); - gtm = gmtime(&time1); - time2 = mktime(gtm); - RtlSecondsSince1970ToTime( 2*time1-time2, (LARGE_INTEGER *)ft ); -#endif - return TRUE; -} - - -/*********************************************************************** - * FileTimeToDosDateTime (KERNEL32.@) - */ -BOOL WINAPI FileTimeToDosDateTime( const FILETIME *ft, LPWORD fatdate, - LPWORD fattime ) -{ - LARGE_INTEGER li; - ULONG t; - time_t unixtime; - struct tm* tm; - - if (!fatdate || !fattime) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - li.u.LowPart = ft->dwLowDateTime; - li.u.HighPart = ft->dwHighDateTime; - if (!RtlTimeToSecondsSince1970( &li, &t )) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - unixtime = t; - tm = gmtime( &unixtime ); - *fattime = (tm->tm_hour << 11) + (tm->tm_min << 5) + (tm->tm_sec / 2); - *fatdate = ((tm->tm_year - 80) << 9) + ((tm->tm_mon + 1) << 5) + tm->tm_mday; - return TRUE; -} - /****************************************************************************** * GetTickCount64 (KERNEL32.@) */ diff --git a/include/config.h.in b/include/config.h.in index 2642487312..720cbd4a5d 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -539,9 +539,6 @@ /* Define to 1 if you have the <machine/cpu.h> header file. */ #undef HAVE_MACHINE_CPU_H -/* Define to 1 if you have the <machine/limits.h> header file. */ -#undef HAVE_MACHINE_LIMITS_H - /* Define to 1 if you have the <machine/sysarch.h> header file. */ #undef HAVE_MACHINE_SYSARCH_H @@ -1021,9 +1018,6 @@ /* Define to 1 if you have the <sys/ipc.h> header file. */ #undef HAVE_SYS_IPC_H -/* Define to 1 if you have the <sys/limits.h> header file. */ -#undef HAVE_SYS_LIMITS_H - /* Define to 1 if you have the <sys/link.h> header file. */ #undef HAVE_SYS_LINK_H @@ -1162,9 +1156,6 @@ /* Define to 1 if you have the <tiffio.h> header file. */ #undef HAVE_TIFFIO_H -/* Define to 1 if you have the `timegm' function. */ -#undef HAVE_TIMEGM - /* Define to 1 if you have the `trunc' function. */ #undef HAVE_TRUNC
1
0
0
0
Alexandre Julliard : kernel32: Reimplement GetProcessVersion() in kernelbase.
by Alexandre Julliard
26 May '20
26 May '20
Module: wine Branch: master Commit: fc173ccca8734f6c6d54fcf56e763d4557e9eb48 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=fc173ccca8734f6c6d54fcf5…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue May 26 13:23:33 2020 +0200 kernel32: Reimplement GetProcessVersion() in kernelbase. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/kernel32.spec | 2 +- dlls/kernel32/process.c | 55 ----------------------------------------- dlls/kernelbase/kernelbase.spec | 2 +- dlls/kernelbase/process.c | 23 +++++++++++++++++ 4 files changed, 25 insertions(+), 57 deletions(-) diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index a095a85e66..1a6fdbab01 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -793,7 +793,7 @@ # @ stub GetProcessorSystemCycleTime @ stdcall -import GetProcessTimes(long ptr ptr ptr ptr) # @ stub GetProcessUserModeExceptionPolicy -@ stdcall GetProcessVersion(long) +@ stdcall -import GetProcessVersion(long) @ stdcall GetProcessWorkingSetSize(long ptr ptr) @ stdcall -import GetProcessWorkingSetSizeEx(long ptr ptr ptr) @ stdcall -import GetProductInfo(long long long long ptr) diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c index f628f96f36..1c3ed9938f 100644 --- a/dlls/kernel32/process.c +++ b/dlls/kernel32/process.c @@ -451,61 +451,6 @@ BOOL WINAPI GetProcessAffinityMask( HANDLE hProcess, PDWORD_PTR process_mask, PD } -/*********************************************************************** - * GetProcessVersion (KERNEL32.@) - */ -DWORD WINAPI GetProcessVersion( DWORD pid ) -{ - HANDLE process; - NTSTATUS status; - PROCESS_BASIC_INFORMATION pbi; - SIZE_T count; - PEB peb; - IMAGE_DOS_HEADER dos; - IMAGE_NT_HEADERS nt; - DWORD ver = 0; - - if (!pid || pid == GetCurrentProcessId()) - { - IMAGE_NT_HEADERS *pnt; - - if ((pnt = RtlImageNtHeader( NtCurrentTeb()->Peb->ImageBaseAddress ))) - return ((pnt->OptionalHeader.MajorSubsystemVersion << 16) | - pnt->OptionalHeader.MinorSubsystemVersion); - return 0; - } - - process = OpenProcess(PROCESS_VM_READ | PROCESS_QUERY_INFORMATION, FALSE, pid); - if (!process) return 0; - - status = NtQueryInformationProcess(process, ProcessBasicInformation, &pbi, sizeof(pbi), NULL); - if (status) goto err; - - status = NtReadVirtualMemory(process, pbi.PebBaseAddress, &peb, sizeof(peb), &count); - if (status || count != sizeof(peb)) goto err; - - memset(&dos, 0, sizeof(dos)); - status = NtReadVirtualMemory(process, peb.ImageBaseAddress, &dos, sizeof(dos), &count); - if (status || count != sizeof(dos)) goto err; - if (dos.e_magic != IMAGE_DOS_SIGNATURE) goto err; - - memset(&nt, 0, sizeof(nt)); - status = NtReadVirtualMemory(process, (char *)peb.ImageBaseAddress + dos.e_lfanew, &nt, sizeof(nt), &count); - if (status || count != sizeof(nt)) goto err; - if (nt.Signature != IMAGE_NT_SIGNATURE) goto err; - - ver = MAKELONG(nt.OptionalHeader.MinorSubsystemVersion, nt.OptionalHeader.MajorSubsystemVersion); - -err: - CloseHandle(process); - - if (status != STATUS_SUCCESS) - SetLastError(RtlNtStatusToDosError(status)); - - return ver; -} - - /*********************************************************************** * SetProcessWorkingSetSize [KERNEL32.@] * Sets the min/max working set sizes for a specified process. diff --git a/dlls/kernelbase/kernelbase.spec b/dlls/kernelbase/kernelbase.spec index d85c36c6e5..986cd851ed 100644 --- a/dlls/kernelbase/kernelbase.spec +++ b/dlls/kernelbase/kernelbase.spec @@ -636,7 +636,7 @@ @ stdcall GetProcessPriorityBoost(long ptr) @ stdcall GetProcessShutdownParameters(ptr ptr) @ stdcall GetProcessTimes(long ptr ptr ptr ptr) -@ stdcall GetProcessVersion(long) kernel32.GetProcessVersion +@ stdcall GetProcessVersion(long) @ stdcall GetProcessWorkingSetSizeEx(long ptr ptr ptr) # @ stub GetProcessorSystemCycleTime @ stdcall GetProductInfo(long long long long ptr) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index 66e115ce69..a3b168543f 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -814,6 +814,29 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetProcessTimes( HANDLE process, FILETIME *create, } +/*********************************************************************** + * GetProcessVersion (kernelbase.@) + */ +DWORD WINAPI DECLSPEC_HOTPATCH GetProcessVersion( DWORD pid ) +{ + SECTION_IMAGE_INFORMATION info; + NTSTATUS status; + HANDLE process; + + if (pid && pid != GetCurrentProcessId()) + { + if (!(process = OpenProcess( PROCESS_QUERY_INFORMATION, FALSE, pid ))) return 0; + status = NtQueryInformationProcess( process, ProcessImageInformation, &info, sizeof(info), NULL ); + CloseHandle( process ); + } + else status = NtQueryInformationProcess( GetCurrentProcess(), ProcessImageInformation, + &info, sizeof(info), NULL ); + + if (!set_ntstatus( status )) return 0; + return MAKELONG( info.SubsystemVersionLow, info.SubsystemVersionHigh ); +} + + /*********************************************************************** * GetProcessWorkingSetSizeEx (kernelbase.@) */
1
0
0
0
← Newer
1
...
13
14
15
16
17
18
19
...
75
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
Results per page:
10
25
50
100
200