ReactOS.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
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
List overview
Download
Ros-diffs
May 2017
----- 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
ros-diffs@reactos.org
17 participants
288 discussions
Start a n
N
ew thread
[hbelusca] 74494: [NTOS]: Code formatting + free the memory in the reverse order from how it was allocated.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Mon May 8 00:51:44 2017 New Revision: 74494 URL:
http://svn.reactos.org/svn/reactos?rev=74494&view=rev
Log: [NTOS]: Code formatting + free the memory in the reverse order from how it was allocated. Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.…
============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] Mon May 8 00:51:44 2017 @@ -878,7 +878,7 @@ &ValueName, 0, REG_DWORD, - (PVOID)&DeviceNode->CapabilityFlags, + &DeviceNode->CapabilityFlags, sizeof(ULONG)); /* Set 'UINumber' value */ @@ -1077,6 +1077,7 @@ if (!NT_SUCCESS(Status)) { DPRINT1("PnpRootCreateDevice() failed with status 0x%08X\n", Status); + ExFreePool(FullServiceName.Buffer); ExFreePoolWithTag(Node, TAG_IO_DEVNODE); return Status; } @@ -1086,8 +1087,8 @@ if (!NT_SUCCESS(Status)) { ZwClose(InstanceHandle); + ExFreePool(FullServiceName.Buffer); ExFreePoolWithTag(Node, TAG_IO_DEVNODE); - ExFreePool(FullServiceName.Buffer); return Status; } @@ -1095,8 +1096,8 @@ if (!Node->ServiceName.Buffer) { ZwClose(InstanceHandle); + ExFreePool(FullServiceName.Buffer); ExFreePoolWithTag(Node, TAG_IO_DEVNODE); - ExFreePool(FullServiceName.Buffer); return Status; } @@ -1738,7 +1739,7 @@ &ValueName, 0, REG_SZ, - (PVOID)KeyValue.Buffer, + KeyValue.Buffer, ((ULONG)wcslen(KeyValue.Buffer) + 1) * sizeof(WCHAR)); cleanup: @@ -1859,11 +1860,11 @@ RtlInitUnicodeString(&ValueName, L"CompatibleIDs"); Status = ZwSetValueKey(InstanceKey, - &ValueName, - 0, - REG_MULTI_SZ, - (PVOID)IoStatusBlock.Information, - (TotalLength + 1) * sizeof(WCHAR)); + &ValueName, + 0, + REG_MULTI_SZ, + (PVOID)IoStatusBlock.Information, + (TotalLength + 1) * sizeof(WCHAR)); if (!NT_SUCCESS(Status)) { DPRINT1("ZwSetValueKey() failed (Status %lx) or no Compatible ID returned\n", Status);
7 years, 7 months
1
0
0
0
[hbelusca] 74493: [NTOS]: Capture the counted BaseDllName unicode string into a local NULL-terminated buffer before calling wcsrchr on it (actually I think it would be better to create & use a simi...
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sun May 7 18:15:12 2017 New Revision: 74493 URL:
http://svn.reactos.org/svn/reactos?rev=74493&view=rev
Log: [NTOS]: Capture the counted BaseDllName unicode string into a local NULL-terminated buffer before calling wcsrchr on it (actually I think it would be better to create & use a similar function that takes counted strings in input). Also use 'L' prefix for wide characters and UNICODE_NULL for string terminator. Patch by Lesan Ilie. CORE-13208 #resolve Modified: trunk/reactos/ntoskrnl/io/iomgr/driver.c Modified: trunk/reactos/ntoskrnl/io/iomgr/driver.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/driver.c…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] Sun May 7 18:15:12 2017 @@ -884,7 +884,7 @@ PDEVICE_NODE DeviceNode; PDRIVER_OBJECT DriverObject; NTSTATUS Status; - PWCHAR FileNameWithoutPath; + PWCHAR Buffer, FileNameWithoutPath; PWSTR FileExtension; PUNICODE_STRING ModuleName = &BootLdrEntry->BaseDllName; PLDR_DATA_TABLE_ENTRY LdrEntry; @@ -898,13 +898,19 @@ IopDisplayLoadingMessage(ModuleName); InbvIndicateProgress(); + Buffer = ExAllocatePool(PagedPool, ModuleName->Length + sizeof(UNICODE_NULL)); + ASSERT(Buffer); + + RtlCopyMemory(Buffer, ModuleName->Buffer, ModuleName->Length); + Buffer[ModuleName->Length / sizeof(WCHAR)] = UNICODE_NULL; + /* * Generate filename without path (not needed by freeldr) */ - FileNameWithoutPath = wcsrchr(ModuleName->Buffer, L'\\'); + FileNameWithoutPath = wcsrchr(Buffer, L'\\'); if (FileNameWithoutPath == NULL) { - FileNameWithoutPath = ModuleName->Buffer; + FileNameWithoutPath = Buffer; } else { @@ -915,6 +921,7 @@ * Strip the file extension from ServiceName */ Success = RtlCreateUnicodeString(&ServiceName, FileNameWithoutPath); + ExFreePool(Buffer); if (!Success) { return STATUS_INSUFFICIENT_RESOURCES; @@ -924,7 +931,7 @@ if (FileExtension != NULL) { ServiceName.Length -= (USHORT)wcslen(FileExtension) * sizeof(WCHAR); - FileExtension[0] = 0; + FileExtension[0] = UNICODE_NULL; } /*
7 years, 7 months
1
0
0
0
[hbelusca] 74492: [NTOS]: Code formatting changes only.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sun May 7 18:12:18 2017 New Revision: 74492 URL:
http://svn.reactos.org/svn/reactos?rev=74492&view=rev
Log: [NTOS]: Code formatting changes only. Modified: trunk/reactos/ntoskrnl/io/iomgr/driver.c Modified: trunk/reactos/ntoskrnl/io/iomgr/driver.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/driver.c…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] Sun May 7 18:12:18 2017 @@ -885,7 +885,7 @@ PDRIVER_OBJECT DriverObject; NTSTATUS Status; PWCHAR FileNameWithoutPath; - LPWSTR FileExtension; + PWSTR FileExtension; PUNICODE_STRING ModuleName = &BootLdrEntry->BaseDllName; PLDR_DATA_TABLE_ENTRY LdrEntry; PLIST_ENTRY NextEntry; @@ -920,7 +920,7 @@ return STATUS_INSUFFICIENT_RESOURCES; } - FileExtension = wcsrchr(ServiceName.Buffer, '.'); + FileExtension = wcsrchr(ServiceName.Buffer, L'.'); if (FileExtension != NULL) { ServiceName.Length -= (USHORT)wcslen(FileExtension) * sizeof(WCHAR); @@ -939,7 +939,7 @@ if (!NT_SUCCESS(Status)) { DPRINT1("Driver '%wZ' load failed, status (%x)\n", ModuleName, Status); - return(Status); + return Status; } /* Lookup the new Ldr entry in PsLoadedModuleList */ @@ -951,7 +951,7 @@ InLoadOrderLinks); if (RtlEqualUnicodeString(ModuleName, &LdrEntry->BaseDllName, TRUE)) { - break; + break; } NextEntry = NextEntry->Flink; @@ -1251,7 +1251,7 @@ PDEVICE_OBJECT DeviceObject; PEXTENDED_DEVOBJ_EXTENSION DeviceExtension; NTSTATUS Status; - LPWSTR Start; + PWSTR Start; BOOLEAN SafeToUnload = TRUE; DPRINT("IopUnloadDriver('%wZ', %u)\n", DriverServiceName, UnloadPnpDrivers); @@ -1261,7 +1261,6 @@ /* * Get the service name from the registry key name */ - Start = wcsrchr(DriverServiceName->Buffer, L'\\'); if (Start == NULL) Start = DriverServiceName->Buffer; @@ -1273,14 +1272,13 @@ /* * Construct the driver object name */ - ObjectName.Length = ((USHORT)wcslen(Start) + 8) * sizeof(WCHAR); ObjectName.MaximumLength = ObjectName.Length + sizeof(WCHAR); ObjectName.Buffer = ExAllocatePool(PagedPool, ObjectName.MaximumLength); if (!ObjectName.Buffer) return STATUS_INSUFFICIENT_RESOURCES; wcscpy(ObjectName.Buffer, DRIVER_ROOT_NAME); memcpy(ObjectName.Buffer + 8, Start, ObjectName.Length - 8 * sizeof(WCHAR)); - ObjectName.Buffer[ObjectName.Length/sizeof(WCHAR)] = 0; + ObjectName.Buffer[ObjectName.Length/sizeof(WCHAR)] = UNICODE_NULL; /* * Find the driver object @@ -1301,9 +1299,7 @@ return Status; } - /* - * Free the buffer for driver object name - */ + /* Free the buffer for driver object name */ ExFreePool(ObjectName.Buffer); /* Check that driver is not already unloading */ @@ -1350,9 +1346,7 @@ return Status; } - /* - * Free the service path - */ + /* Free the service path */ ExFreePool(ImagePath.Buffer); /*
7 years, 7 months
1
0
0
0
[hbelusca] 74491: [NTOS]: Fix a potential memory leak. - If one of the ZwSetValueKey function fails, 'Node->ServiceName.Buffer' is leaked. - Also use 'L' prefix for wide characters. Patch by Lesan ...
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sun May 7 17:50:18 2017 New Revision: 74491 URL:
http://svn.reactos.org/svn/reactos?rev=74491&view=rev
Log: [NTOS]: Fix a potential memory leak. - If one of the ZwSetValueKey function fails, 'Node->ServiceName.Buffer' is leaked. - Also use 'L' prefix for wide characters. Patch by Lesan Ilie, thanks! - Use "P(C)WSTR" instead of win32 "LP(C)WSTR" string pointer types (by me). CORE-13207 #resolve Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.…
============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] Sun May 7 17:50:18 2017 @@ -1144,6 +1144,7 @@ if (!NT_SUCCESS(Status)) { + ExFreePool(Node->ServiceName.Buffer); ExFreePoolWithTag(Node, TAG_IO_DEVNODE); return Status; } @@ -1437,7 +1438,7 @@ HANDLE hParent = NULL, hKey; OBJECT_ATTRIBUTES ObjectAttributes; UNICODE_STRING KeyName; - LPCWSTR Current, Last; + PCWSTR Current, Last; USHORT Length; NTSTATUS Status; @@ -1462,7 +1463,7 @@ /* Go up to the end of the string */ while (Current <= Last) { - if (Current != Last && *Current != '\\') + if (Current != Last && *Current != L'\\') { /* Not the end of the string and not a separator */ Current++; @@ -1510,7 +1511,7 @@ /* Start with this new parent key */ hParent = hKey; Current++; - KeyName.Buffer = (LPWSTR)Current; + KeyName.Buffer = (PWSTR)Current; } return STATUS_UNSUCCESSFUL; @@ -4258,7 +4259,7 @@ static WCHAR EnumKeyName[] = L"Enum\\"; static WCHAR DeviceParametersKeyName[] = L"Device Parameters"; ULONG KeyNameLength; - LPWSTR KeyNameBuffer; + PWSTR KeyNameBuffer; UNICODE_STRING KeyName; ULONG DriverKeyLength; OBJECT_ATTRIBUTES ObjectAttributes;
7 years, 7 months
1
0
0
0
[tfaber] 74490: [NTDLL] - Implement user-mode version of RtlWalkFrameChain (mostly as a copy of the kernel version). Now RtlCaptureStackBackTrace actually, you know, captures stack back-traces.
by tfaber@svn.reactos.org
Author: tfaber Date: Sat May 6 17:51:26 2017 New Revision: 74490 URL:
http://svn.reactos.org/svn/reactos?rev=74490&view=rev
Log: [NTDLL] - Implement user-mode version of RtlWalkFrameChain (mostly as a copy of the kernel version). Now RtlCaptureStackBackTrace actually, you know, captures stack back-traces. Modified: trunk/reactos/dll/ntdll/rtl/libsupp.c trunk/reactos/ntoskrnl/rtl/libsupp.c Modified: trunk/reactos/dll/ntdll/rtl/libsupp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/rtl/libsupp.c?re…
============================================================================== --- trunk/reactos/dll/ntdll/rtl/libsupp.c [iso-8859-1] (original) +++ trunk/reactos/dll/ntdll/rtl/libsupp.c [iso-8859-1] Sat May 6 17:51:26 2017 @@ -20,22 +20,6 @@ /* FUNCTIONS ***************************************************************/ -#ifndef _M_AMD64 -// FIXME: Why "Not implemented"??? -/* - * @implemented - */ -ULONG -NTAPI -RtlWalkFrameChain(OUT PVOID *Callers, - IN ULONG Count, - IN ULONG Flags) -{ - /* Not implemented for user-mode */ - return 0; -} -#endif - BOOLEAN NTAPI RtlpCheckForActiveDebugger(VOID) @@ -233,6 +217,113 @@ *StackEnd = (ULONG_PTR)NtCurrentTeb()->NtTib.StackBase; return TRUE; } + +#ifndef _M_AMD64 +/* + * @implemented + */ +ULONG +NTAPI +RtlWalkFrameChain(OUT PVOID *Callers, + IN ULONG Count, + IN ULONG Flags) +{ + ULONG_PTR Stack, NewStack, StackBegin, StackEnd = 0; + ULONG Eip; + BOOLEAN Result, StopSearch = FALSE; + ULONG i = 0; + + /* Get current EBP */ +#if defined(_M_IX86) +#if defined __GNUC__ + __asm__("mov %%ebp, %0" : "=r" (Stack) : ); +#elif defined(_MSC_VER) + __asm mov Stack, ebp +#endif +#elif defined(_M_MIPS) + __asm__("move $sp, %0" : "=r" (Stack) : ); +#elif defined(_M_PPC) + __asm__("mr %0,1" : "=r" (Stack) : ); +#elif defined(_M_ARM) + __asm__("mov sp, %0" : "=r"(Stack) : ); +#else +#error Unknown architecture +#endif + + /* Set it as the stack begin limit as well */ + StackBegin = (ULONG_PTR)Stack; + + /* Check if we're called for non-logging mode */ + if (!Flags) + { + /* Get the actual safe limits */ + Result = RtlpCaptureStackLimits((ULONG_PTR)Stack, + &StackBegin, + &StackEnd); + if (!Result) return 0; + } + + /* Use a SEH block for maximum protection */ + _SEH2_TRY + { + /* Loop the frames */ + for (i = 0; i < Count; i++) + { + /* + * Leave if we're past the stack, + * if we're before the stack, + * or if we've reached ourselves. + */ + if ((Stack >= StackEnd) || + (!i ? (Stack < StackBegin) : (Stack <= StackBegin)) || + ((StackEnd - Stack) < (2 * sizeof(ULONG_PTR)))) + { + /* We're done or hit a bad address */ + break; + } + + /* Get new stack and EIP */ + NewStack = *(PULONG_PTR)Stack; + Eip = *(PULONG_PTR)(Stack + sizeof(ULONG_PTR)); + + /* Check if the new pointer is above the oldone and past the end */ + if (!((Stack < NewStack) && (NewStack < StackEnd))) + { + /* Stop searching after this entry */ + StopSearch = TRUE; + } + + /* Also make sure that the EIP isn't a stack address */ + if ((StackBegin < Eip) && (Eip < StackEnd)) break; + + /* FIXME: Check that EIP is inside a loaded module */ + + /* Save this frame */ + Callers[i] = (PVOID)Eip; + + /* Check if we should continue */ + if (StopSearch) + { + /* Return the next index */ + i++; + break; + } + + /* Move to the next stack */ + Stack = NewStack; + } + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + /* No index */ + i = 0; + } + _SEH2_END; + + /* Return frames parsed */ + return i; +} +#endif #ifdef _AMD64_ VOID Modified: trunk/reactos/ntoskrnl/rtl/libsupp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/rtl/libsupp.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/rtl/libsupp.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/rtl/libsupp.c [iso-8859-1] Sat May 6 17:51:26 2017 @@ -406,7 +406,7 @@ &StackBegin, &StackEnd); if (!Result) return 0; - } + } /* Use a SEH block for maximum protection */ _SEH2_TRY
7 years, 7 months
1
0
0
0
[tfaber] 74489: [KMTESTS:RTL] - Add a test for RtlWalkFrameChain and RtlCaptureStackBackTrace
by tfaber@svn.reactos.org
Author: tfaber Date: Sat May 6 15:29:56 2017 New Revision: 74489 URL:
http://svn.reactos.org/svn/reactos?rev=74489&view=rev
Log: [KMTESTS:RTL] - Add a test for RtlWalkFrameChain and RtlCaptureStackBackTrace Added: trunk/rostests/kmtests/rtl/RtlStack.c (with props) Modified: trunk/rostests/kmtests/CMakeLists.txt trunk/rostests/kmtests/kmtest/testlist.c trunk/rostests/kmtests/kmtest_drv/testlist.c Modified: trunk/rostests/kmtests/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/CMakeLists.txt?re…
============================================================================== --- trunk/rostests/kmtests/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/kmtests/CMakeLists.txt [iso-8859-1] Sat May 6 15:29:56 2017 @@ -20,6 +20,7 @@ rtl/RtlMemory.c rtl/RtlRegistry.c rtl/RtlSplayTree.c + rtl/RtlStack.c rtl/RtlUnicodeString.c) # Modified: trunk/rostests/kmtests/kmtest/testlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/kmtest/testlist.c…
============================================================================== --- trunk/rostests/kmtests/kmtest/testlist.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/kmtest/testlist.c [iso-8859-1] Sat May 6 15:29:56 2017 @@ -21,6 +21,7 @@ KMT_TESTFUNC Test_RtlMemory; KMT_TESTFUNC Test_RtlRegistry; KMT_TESTFUNC Test_RtlSplayTree; +KMT_TESTFUNC Test_RtlStack; KMT_TESTFUNC Test_RtlUnicodeString; KMT_TESTFUNC Test_TcpIpIoctl; KMT_TESTFUNC Test_TcpIpTdi; @@ -43,6 +44,7 @@ { "RtlMemory", Test_RtlMemory }, { "RtlRegistry", Test_RtlRegistry }, { "RtlSplayTree", Test_RtlSplayTree }, + { "RtlStack", Test_RtlStack }, { "RtlUnicodeString", Test_RtlUnicodeString }, { "TcpIpTdi", Test_TcpIpTdi }, { "TcpIpConnect", Test_TcpIpConnect }, Modified: trunk/rostests/kmtests/kmtest_drv/testlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/kmtest_drv/testli…
============================================================================== --- trunk/rostests/kmtests/kmtest_drv/testlist.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/kmtest_drv/testlist.c [iso-8859-1] Sat May 6 15:29:56 2017 @@ -70,6 +70,7 @@ KMT_TESTFUNC Test_RtlMemory; KMT_TESTFUNC Test_RtlRegistry; KMT_TESTFUNC Test_RtlSplayTree; +KMT_TESTFUNC Test_RtlStack; KMT_TESTFUNC Test_RtlUnicodeString; KMT_TESTFUNC Test_ZwAllocateVirtualMemory; KMT_TESTFUNC Test_ZwCreateSection; @@ -139,6 +140,7 @@ { "RtlMemoryKM", Test_RtlMemory }, { "RtlRegistryKM", Test_RtlRegistry }, { "RtlSplayTreeKM", Test_RtlSplayTree }, + { "RtlStackKM", Test_RtlStack }, { "RtlUnicodeStringKM", Test_RtlUnicodeString }, { "SeInheritance", Test_SeInheritance }, { "SeQueryInfoToken", Test_SeQueryInfoToken }, Added: trunk/rostests/kmtests/rtl/RtlStack.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/rtl/RtlStack.c?re…
============================================================================== --- trunk/rostests/kmtests/rtl/RtlStack.c (added) +++ trunk/rostests/kmtests/rtl/RtlStack.c [iso-8859-1] Sat May 6 15:29:56 2017 @@ -0,0 +1,136 @@ +/* + * PROJECT: ReactOS kernel-mode tests + * LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory + * PURPOSE: Kernel-Mode Test Suite Runtime library stack trace test + * PROGRAMMER: Thomas Faber <thomas.faber(a)reactos.org> + */ + +#define KMT_EMULATE_KERNEL +#include <kmt_test.h> + +static PVOID ReturnAddresses[4]; + +static +VOID +TestStackWalk3(VOID); + +DECLSPEC_NOINLINE +static +VOID +TestStackWalk4(VOID) +{ + PVOID Frames[5]; + ULONG Ret; + ULONG Hash; + ULONG ExpectedHash; + ULONG i; + const ULONG FunctionSizeGuess = 0x1000; + + ReturnAddresses[3] = _ReturnAddress(); + + Ret = RtlWalkFrameChain(NULL, 5, 0); + ok_eq_ulong(Ret, 0); + + RtlFillMemory(Frames, sizeof(Frames), 0x55); + Ret = RtlWalkFrameChain(Frames, 0, 0); + ok_eq_ulong(Ret, 0); + ok_eq_pointer(Frames[0], (PVOID)(ULONG_PTR)0x5555555555555555); + + RtlFillMemory(Frames, sizeof(Frames), 0x55); + Ret = RtlWalkFrameChain(Frames, 5, 0); + ok_eq_ulong(Ret, 5); + ok((ULONG_PTR)Frames[0] > (ULONG_PTR)TestStackWalk4, "Frame is %p, function is %p\n", Frames[0], TestStackWalk4); + ok((ULONG_PTR)Frames[0] < (ULONG_PTR)TestStackWalk4 + FunctionSizeGuess, "Frame is %p, function is %p\n", Frames[0], TestStackWalk4); + ok_eq_pointer(Frames[1], ReturnAddresses[3]); + ok_eq_pointer(Frames[2], ReturnAddresses[2]); + ok_eq_pointer(Frames[3], ReturnAddresses[1]); + ok_eq_pointer(Frames[4], ReturnAddresses[0]); + + RtlFillMemory(Frames, sizeof(Frames), 0x55); + Ret = RtlWalkFrameChain(Frames, 4, 0); + ok_eq_ulong(Ret, 4); + ok((ULONG_PTR)Frames[0] > (ULONG_PTR)TestStackWalk4, "Frame is %p, function is %p\n", Frames[0], TestStackWalk4); + ok((ULONG_PTR)Frames[0] < (ULONG_PTR)TestStackWalk4 + FunctionSizeGuess, "Frame is %p, function is %p\n", Frames[0], TestStackWalk4); + ok_eq_pointer(Frames[1], ReturnAddresses[3]); + ok_eq_pointer(Frames[2], ReturnAddresses[2]); + ok_eq_pointer(Frames[3], ReturnAddresses[1]); + ok_eq_pointer(Frames[4], (PVOID)(ULONG_PTR)0x5555555555555555); + + KmtStartSeh() + RtlCaptureStackBackTrace(0, 5, NULL, NULL); + KmtEndSeh(STATUS_ACCESS_VIOLATION); + + RtlFillMemory(Frames, sizeof(Frames), 0x55); + Hash = 0x55555555; + Ret = RtlCaptureStackBackTrace(0, 0, Frames, &Hash); + ok_eq_ulong(Ret, 0); + ok_eq_hex(Hash, 0x55555555); + ok_eq_pointer(Frames[0], (PVOID)(ULONG_PTR)0x5555555555555555); + + RtlFillMemory(Frames, sizeof(Frames), 0x55); + Hash = 0x55555555; + Ret = RtlCaptureStackBackTrace(0, 1, Frames, NULL); + ok_eq_ulong(Ret, 1); + ok((ULONG_PTR)Frames[0] > (ULONG_PTR)TestStackWalk4, "Frame is %p, function is %p\n", Frames[0], TestStackWalk4); + ok((ULONG_PTR)Frames[0] < (ULONG_PTR)TestStackWalk4 + FunctionSizeGuess, "Frame is %p, function is %p\n", Frames[0], TestStackWalk4); + ok_eq_pointer(Frames[1], (PVOID)(ULONG_PTR)0x5555555555555555); + + RtlFillMemory(Frames, sizeof(Frames), 0x55); + Ret = RtlCaptureStackBackTrace(0, 5, Frames, &Hash); + ok_eq_ulong(Ret, 5); + ExpectedHash = 0; + for (i = 0; i < 5; i++) + ExpectedHash += (ULONG)(ULONG_PTR)Frames[i]; + ok_eq_hex(Hash, ExpectedHash); + ok((ULONG_PTR)Frames[0] > (ULONG_PTR)TestStackWalk4, "Frame is %p, function is %p\n", Frames[0], TestStackWalk4); + ok((ULONG_PTR)Frames[0] < (ULONG_PTR)TestStackWalk4 + FunctionSizeGuess, "Frame is %p, function is %p\n", Frames[0], TestStackWalk4); + ok_eq_pointer(Frames[1], ReturnAddresses[3]); + ok_eq_pointer(Frames[2], ReturnAddresses[2]); + ok_eq_pointer(Frames[3], ReturnAddresses[1]); + ok_eq_pointer(Frames[4], ReturnAddresses[0]); + + RtlFillMemory(Frames, sizeof(Frames), 0x55); + Ret = RtlCaptureStackBackTrace(1, 4, Frames, &Hash); + ok_eq_ulong(Ret, 4); + ExpectedHash = 0; + for (i = 0; i < 4; i++) + ExpectedHash += (ULONG)(ULONG_PTR)Frames[i]; + ok_eq_hex(Hash, ExpectedHash); + ok_eq_pointer(Frames[0], ReturnAddresses[3]); + ok_eq_pointer(Frames[1], ReturnAddresses[2]); + ok_eq_pointer(Frames[2], ReturnAddresses[1]); + ok_eq_pointer(Frames[3], ReturnAddresses[0]); + ok_eq_pointer(Frames[4], (PVOID)(ULONG_PTR)0x5555555555555555); +} + +DECLSPEC_NOINLINE +static +VOID +TestStackWalk3(VOID) +{ + ReturnAddresses[2] = _ReturnAddress(); + TestStackWalk4(); +} + +DECLSPEC_NOINLINE +static +VOID +TestStackWalk2(VOID) +{ + ReturnAddresses[1] = _ReturnAddress(); + TestStackWalk3(); +} + +DECLSPEC_NOINLINE +static +VOID +TestStackWalk1(VOID) +{ + ReturnAddresses[0] = _ReturnAddress(); + TestStackWalk2(); +} + +START_TEST(RtlStack) +{ + TestStackWalk1(); +} Propchange: trunk/rostests/kmtests/rtl/RtlStack.c ------------------------------------------------------------------------------ svn:eol-style = native
7 years, 7 months
1
0
0
0
[ekohl] 74488: [INTL] - Get rid of the individual getter funtions. Use GetSelectedComboBoxIndex for all CBS_DROPDOWNLIST comboboxes and GetSelectedComboBoxText for all CBS_DROPDOWN comboboxes. - Ch...
by ekohl@svn.reactos.org
Author: ekohl Date: Sat May 6 14:41:50 2017 New Revision: 74488 URL:
http://svn.reactos.org/svn/reactos?rev=74488&view=rev
Log: [INTL] - Get rid of the individual getter funtions. Use GetSelectedComboBoxIndex for all CBS_DROPDOWNLIST comboboxes and GetSelectedComboBoxText for all CBS_DROPDOWN comboboxes. - Check the relevant settings only! - Rename SetXxxSettings to GetXxxSettings because it is a getter function. - Handle the bogus WM_COMMAND/EN_CHANGE message that is sent when the IDC_SECONDYEAR_EDIT edit control is initialized. Controls should NEVER send notifications when they are modified programmatically! :-/ Modified: trunk/reactos/dll/cpl/intl/currency.c trunk/reactos/dll/cpl/intl/date.c trunk/reactos/dll/cpl/intl/intl.h trunk/reactos/dll/cpl/intl/misc.c trunk/reactos/dll/cpl/intl/numbers.c trunk/reactos/dll/cpl/intl/time.c Modified: trunk/reactos/dll/cpl/intl/currency.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/currency.c?re…
============================================================================== --- trunk/reactos/dll/cpl/intl/currency.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/intl/currency.c [iso-8859-1] Sat May 6 14:41:50 2017 @@ -261,145 +261,80 @@ } -/* Set number of digits in field */ -static BOOL -SetCurrencyDigNum(HWND hwndDlg, PINT pnCurrGrouping) -{ - INT nCurrSel; - - /* Get setted number of digits in field */ - nCurrSel = SendDlgItemMessageW(hwndDlg, IDC_CURRENCYGRPNUM, - CB_GETCURSEL, - (WPARAM)0, - (LPARAM)0); - if (nCurrSel == CB_ERR) - return FALSE; - - *pnCurrGrouping = nCurrSel; - - return TRUE; -} - -/* Set currency field separator */ -static BOOL -SetCurrencyFieldSep(HWND hwndDlg, PWSTR pszCurrThousandSep) -{ - /* Get setted currency field separator */ - SendDlgItemMessageW(hwndDlg, IDC_CURRENCYGRPSEP, - WM_GETTEXT, - (WPARAM)MAX_CURRTHOUSANDSEP, - (LPARAM)pszCurrThousandSep); - - return TRUE; -} - -/* Set number of fractional symbols */ -static BOOL -SetCurrencyFracSymNum(HWND hwndDlg, PINT pnCurrDigits) -{ - INT nCurrSel; - - /* Get setted number of fractional symbols */ - nCurrSel = SendDlgItemMessageW(hwndDlg, IDC_CURRENCYDECNUM, - CB_GETCURSEL, - (WPARAM)0, - (LPARAM)0); - if (nCurrSel == CB_ERR) - return FALSE; - - *pnCurrDigits = nCurrSel; - - return TRUE; -} - -/* Set currency separator */ -static BOOL -SetCurrencySep(HWND hwndDlg, PWSTR pszCurrDecimalSep) -{ - /* Get setted currency decimal separator */ - SendDlgItemMessageW(hwndDlg, IDC_CURRENCYDECSEP, - WM_GETTEXT, - (WPARAM)MAX_CURRDECIMALSEP, - (LPARAM)pszCurrDecimalSep); - - return TRUE; -} - -/* Set negative currency sum format */ -static BOOL -SetNegCurrencySumFmt(HWND hwndDlg, PINT pnCurrNegFormat) -{ - INT nCurrSel; - - /* Get setted currency unit */ - nCurrSel = SendDlgItemMessageW(hwndDlg, IDC_CURRENCYNEGVALUE, - CB_GETCURSEL, - (WPARAM)0, - (LPARAM)0); - if (nCurrSel == CB_ERR) - return FALSE; - - *pnCurrNegFormat = nCurrSel; - - return TRUE; -} - -/* Set positive currency sum format */ -static BOOL -SetPosCurrencySumFmt(HWND hwndDlg, PINT pnCurrPosFormat) -{ - INT nCurrSel; - - /* Get setted currency unit */ - nCurrSel = SendDlgItemMessageW(hwndDlg, IDC_CURRENCYPOSVALUE, - CB_GETCURSEL, - (WPARAM)0, - (LPARAM)0); - if (nCurrSel == CB_ERR) - return FALSE; - - *pnCurrPosFormat = nCurrSel; - - return TRUE; -} - -/* Set currency symbol */ -static BOOL -SetCurrencySymbol(HWND hwndDlg, PWSTR pszCurrSymbol) -{ - /* Get setted currency unit */ - SendDlgItemMessageW(hwndDlg, IDC_CURRENCYSYMBOL, - WM_GETTEXT, - (WPARAM)MAX_CURRSYMBOL, - (LPARAM)pszCurrSymbol); - - return TRUE; -} - - -static BOOL -SetCurrencySetting(HWND hwndDlg, PGLOBALDATA pGlobalData) +static +BOOL +GetCurrencySetting( + HWND hwndDlg, + PGLOBALDATA pGlobalData) { WCHAR szCurrSymbol[MAX_CURRSYMBOL]; WCHAR szCurrDecimalSep[MAX_CURRDECIMALSEP]; WCHAR szCurrThousandSep[MAX_CURRTHOUSANDSEP]; - INT nCurrGrouping; INT nCurrPosFormat; INT nCurrNegFormat; INT nCurrDigits; - - if (!SetCurrencySymbol(hwndDlg, szCurrSymbol) || - !SetCurrencyDigNum(hwndDlg, &nCurrGrouping) || - !SetPosCurrencySumFmt(hwndDlg, &nCurrPosFormat) || - !SetNegCurrencySumFmt(hwndDlg, &nCurrNegFormat) || - !SetCurrencySep(hwndDlg, szCurrDecimalSep) || - !SetCurrencyFracSymNum(hwndDlg, &nCurrDigits) || - !SetCurrencyFieldSep(hwndDlg, szCurrThousandSep)) - { + INT nCurrGrouping; + + /* Currency symbol */ + GetSelectedComboBoxText(hwndDlg, + IDC_CURRENCYSYMBOL, + szCurrSymbol, + MAX_SAMPLES_STR_SIZE); + + if (szCurrSymbol[0] == L'\0') + { + /* TODO: Show error message */ + return FALSE; } - /* store to global data */ + /* Positive Amount */ + GetSelectedComboBoxIndex(hwndDlg, + IDC_CURRENCYPOSVALUE, + &nCurrPosFormat); + + /* Negative Amount */ + GetSelectedComboBoxIndex(hwndDlg, + IDC_CURRENCYNEGVALUE, + &nCurrNegFormat); + + /* Decimal separator */ + GetSelectedComboBoxText(hwndDlg, + IDC_CURRENCYDECSEP, + szCurrDecimalSep, + MAX_SAMPLES_STR_SIZE); + + if (szCurrDecimalSep[0] == L'\0') + { + /* TODO: Show error message */ + + return FALSE; + } + + /* Number of fractional digits */ + GetSelectedComboBoxIndex(hwndDlg, + IDC_CURRENCYDECNUM, + &nCurrDigits); + + /* Grouping symbol */ + GetSelectedComboBoxText(hwndDlg, + IDC_CURRENCYGRPSEP, + szCurrThousandSep, + MAX_SAMPLES_STR_SIZE); + + if (szCurrThousandSep[0] == L'\0') + { + /* TODO: Show error message */ + + return FALSE; + } + + /* Digit grouping */ + GetSelectedComboBoxIndex(hwndDlg, + IDC_CURRENCYGRPNUM, + &nCurrGrouping); + + /* Store settings in global data */ wcscpy(pGlobalData->szCurrSymbol, szCurrSymbol); pGlobalData->nCurrGrouping = nCurrGrouping; wcscpy(pGlobalData->szCurrDecimalSep, szCurrDecimalSep); @@ -448,7 +383,8 @@ case IDC_CURRENCYDECNUM: case IDC_CURRENCYGRPSEP: case IDC_CURRENCYGRPNUM: - if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE) + if (HIWORD(wParam) == CBN_SELCHANGE || + HIWORD(wParam) == CBN_EDITCHANGE) { /* Enable the Apply button */ PropSheet_Changed(GetParent(hwndDlg), hwndDlg); @@ -459,7 +395,7 @@ case WM_NOTIFY: if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY) { - if (SetCurrencySetting(hwndDlg, pGlobalData)) + if (GetCurrencySetting(hwndDlg, pGlobalData)) { pGlobalData->bUserLocaleChanged = TRUE; UpdateExamples(hwndDlg, pGlobalData); Modified: trunk/reactos/dll/cpl/intl/date.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/date.c?rev=74…
============================================================================== --- trunk/reactos/dll/cpl/intl/date.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/intl/date.c [iso-8859-1] Sat May 6 14:41:50 2017 @@ -162,7 +162,6 @@ PrintErrorMsgBox(IDS_ERROR_SYMBOL_FORMAT_SHORT); return FALSE; } - } if (OpenApostFlg || nFmtStrSize == 0) @@ -221,7 +220,6 @@ PrintErrorMsgBox(IDS_ERROR_SYMBOL_FORMAT_LONG); return FALSE; } - } if (OpenApostFlg || nFmtStrSize == 0) @@ -515,24 +513,28 @@ WM_SETTEXT, 0, (LPARAM)OutBuffer); } -static BOOL -SetDateSetting(HWND hwndDlg, PGLOBALDATA pGlobalData) -{ - WCHAR szLongDateFmt[MAX_SAMPLES_STR_SIZE]; - WCHAR szShortDateFmt[MAX_SAMPLES_STR_SIZE]; - WCHAR szShortDateSep[MAX_SAMPLES_STR_SIZE]; - - if (!SetLongDateFormat(hwndDlg, szLongDateFmt) || - !SetShortDateFormat(hwndDlg, szShortDateFmt) || - !SetShortDateSep(hwndDlg, szShortDateSep)) + +static +BOOL +GetDateSetting( + HWND hwndDlg, + PGLOBALDATA pGlobalData) +{ + WCHAR szLongDateFormat[MAX_SAMPLES_STR_SIZE]; + WCHAR szShortDateFormat[MAX_SAMPLES_STR_SIZE]; + WCHAR szDateSeparator[MAX_SAMPLES_STR_SIZE]; + + if (!SetLongDateFormat(hwndDlg, szLongDateFormat) || + !SetShortDateFormat(hwndDlg, szShortDateFormat) || + !SetShortDateSep(hwndDlg, szDateSeparator)) { return FALSE; } - /* store to global data */ - wcscpy(pGlobalData->szLongDateFormat, szLongDateFmt); - wcscpy(pGlobalData->szShortDateFormat, szShortDateFmt); - wcscpy(pGlobalData->szDateSep, szShortDateSep); + /* Store settings in global data */ + wcscpy(pGlobalData->szLongDateFormat, szLongDateFormat); + wcscpy(pGlobalData->szShortDateFormat, szShortDateFormat); + wcscpy(pGlobalData->szDateSep, szDateSeparator); return TRUE; } @@ -560,22 +562,22 @@ InitLongDateCB(hwndDlg, pGlobalData); InitShortDateSepSamples(hwndDlg, pGlobalData); /* TODO: Add other calendar types */ + pGlobalData->bEnableYearNotification = TRUE; break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_SECONDYEAR_EDIT: - if (HIWORD(wParam) == EN_CHANGE) + if (HIWORD(wParam) == EN_CHANGE && + pGlobalData != NULL && + pGlobalData->bEnableYearNotification == TRUE) { SetMinDate(hwndDlg); + + /* Enable the Apply button */ + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); } - break; - - case IDC_SCR_MAX_YEAR: - /* Set "Apply" button enabled */ - /* FIXME */ - //PropSheet_Changed(GetParent(hwndDlg), hwndDlg); break; case IDC_CALTYPE_COMBO: @@ -583,7 +585,8 @@ case IDC_SHRTDATEFMT_COMBO: case IDC_LONGDATEFMT_COMBO: case IDC_SHRTDATESEP_COMBO: - if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE) + if (HIWORD(wParam) == CBN_SELCHANGE || + HIWORD(wParam) == CBN_EDITCHANGE) { /* Enable the Apply button */ PropSheet_Changed(GetParent(hwndDlg), hwndDlg); @@ -595,7 +598,7 @@ case WM_NOTIFY: if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY) { - if (SetDateSetting(hwndDlg, pGlobalData)) + if (GetDateSetting(hwndDlg, pGlobalData)) { pGlobalData->bUserLocaleChanged = TRUE; SetMaxDate(hwndDlg, pGlobalData->UserLCID); Modified: trunk/reactos/dll/cpl/intl/intl.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/intl.h?rev=74…
============================================================================== --- trunk/reactos/dll/cpl/intl/intl.h [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/intl/intl.h [iso-8859-1] Sat May 6 14:41:50 2017 @@ -61,13 +61,15 @@ typedef struct _GLOBALDATA { + /* General */ + WCHAR szNumPositiveSign[MAX_NUMPOSITIVESIGN]; + WCHAR szNumNativeDigits[MAX_NUMNATIVEDIGITS]; + /* Number */ WCHAR szNumDecimalSep[MAX_NUMDECIMALSEP]; WCHAR szNumThousandSep[MAX_NUMTHOUSANDSEP]; WCHAR szNumNegativeSign[MAX_NUMNEGATIVESIGN]; - WCHAR szNumPositiveSign[MAX_NUMPOSITIVESIGN]; WCHAR szNumListSep[MAX_NUMLISTSEP]; - WCHAR szNumNativeDigits[MAX_NUMNATIVEDIGITS]; INT nNumNegFormat; INT nNumDigits; INT nNumLeadingZero; @@ -101,6 +103,7 @@ INT nFirstWeekOfYear; INT nDate; INT nCalendarType; + BOOL bEnableYearNotification; /* Other */ WCHAR szMiscCountry[MAX_MISCCOUNTRY]; @@ -191,6 +194,19 @@ PWSTR ReplaceSubStr(PCWSTR szSourceStr, PCWSTR szStrToReplace, PCWSTR szTempl); +VOID +GetSelectedComboBoxText( + HWND hwndDlg, + INT nIdDlgItem, + PWSTR Buffer, + UINT uSize); + +VOID +GetSelectedComboBoxIndex( + HWND hwndDlg, + INT nIdDlgItem, + PINT pValue); + /* kblayouts.c */ VOID AddNewKbLayoutsByLcid(LCID Lcid); Modified: trunk/reactos/dll/cpl/intl/misc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/misc.c?rev=74…
============================================================================== --- trunk/reactos/dll/cpl/intl/misc.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/intl/misc.c [iso-8859-1] Sat May 6 14:41:50 2017 @@ -171,4 +171,61 @@ return szDestStr; } + +VOID +GetSelectedComboBoxText( + HWND hwndDlg, + INT nIdDlgItem, + PWSTR Buffer, + UINT uSize) +{ + HWND hChildWnd; + PWSTR tmp; + INT nIndex; + UINT uReqSize; + + /* Get handle to time format control */ + hChildWnd = GetDlgItem(hwndDlg, nIdDlgItem); + if (hChildWnd == NULL) + return; + + /* Get index to selected time format */ + nIndex = SendMessageW(hChildWnd, CB_GETCURSEL, 0, 0); + if (nIndex == CB_ERR) + { + /* No selection? Get content of the edit control */ + SendMessageW(hChildWnd, WM_GETTEXT, uSize, (LPARAM)Buffer); + } + else + { + /* Get requested size, including the null terminator; + * it shouldn't be required because the previous CB_LIMITTEXT, + * but it would be better to check it anyways */ + uReqSize = SendMessageW(hChildWnd, CB_GETLBTEXTLEN, (WPARAM)nIndex, 0) + 1; + + /* Allocate enough space to be more safe */ + tmp = (PWSTR)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, uReqSize * sizeof(WCHAR)); + if (tmp != NULL) + { + /* Get selected time format text */ + SendMessageW(hChildWnd, CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)tmp); + + /* Finally, copy the result into the output */ + wcsncpy(Buffer, tmp, uSize); + + HeapFree(GetProcessHeap(), 0, tmp); + } + } +} + + +VOID +GetSelectedComboBoxIndex( + HWND hwndDlg, + INT nIdDlgItem, + PINT pValue) +{ + *pValue = SendDlgItemMessageW(hwndDlg, nIdDlgItem, CB_GETCURSEL, 0, 0); +} + /* EOF */ Modified: trunk/reactos/dll/cpl/intl/numbers.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/numbers.c?rev…
============================================================================== --- trunk/reactos/dll/cpl/intl/numbers.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/intl/numbers.c [iso-8859-1] Sat May 6 14:41:50 2017 @@ -469,195 +469,105 @@ (LPARAM)OutBuffer); } -/* Set num decimal separator */ -static BOOL -SetNumDecimalSep(HWND hwndDlg, - PWSTR pszNumDecimalSep) -{ - /* Get setted decimal separator */ - SendDlgItemMessageW(hwndDlg, IDC_NUMBERDSYMBOL, - WM_GETTEXT, - (WPARAM)MAX_NUMDECIMALSEP, - (LPARAM)pszNumDecimalSep); - - return TRUE; -} - -/* Set number of fractional symbols */ -static BOOL -SetFracSymNum(HWND hwndDlg, - PINT pnNumDigits) -{ - INT nCurrSel; - - /* Get setted number of fractional symbols */ - nCurrSel = SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNDIGDEC, - CB_GETCURSEL, - (WPARAM)0, - (LPARAM)0); - if (nCurrSel == CB_ERR) - return FALSE; - - *pnNumDigits = nCurrSel; - - return TRUE; -} - -/* Set field separator */ -static BOOL -SetNumFieldSep(HWND hwndDlg, - PWSTR pszNumThousandSep) -{ - /* Get thousand separator */ - SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDIGITGRSYM, - WM_GETTEXT, - (WPARAM)MAX_NUMTHOUSANDSEP, - (LPARAM)pszNumThousandSep); - - return TRUE; -} - -/* Set number of digits in field */ -static BOOL -SetFieldDigNum(HWND hwndDlg, - PINT pnNumGrouping) -{ - INT nCurrSel; - - /* Get setted negative sum format */ - nCurrSel = SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDGROUPING, - CB_GETCURSEL, - (WPARAM)0, - (LPARAM)0); - if (nCurrSel == CB_ERR) - return FALSE; - - *pnNumGrouping = nCurrSel; - - return TRUE; -} - -/* Set negative sign */ -static BOOL -SetNumNegSign(HWND hwndDlg, - PWSTR pszNumNegativeSign) -{ - /* Get setted negative sign */ - SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNSIGNSYM, - WM_GETTEXT, - (WPARAM)MAX_NUMNEGATIVESIGN, - (LPARAM)pszNumNegativeSign); - - return TRUE; -} - -/* Set negative sum format */ -static BOOL -SetNegSumFmt(HWND hwndDlg, - PINT pnNumNegFormat) -{ - INT nCurrSel; - - /* Get setted negative sum format */ - nCurrSel = SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNNUMFORMAT, - CB_GETCURSEL, - (WPARAM)0, - (LPARAM)0); - if (nCurrSel == CB_ERR) - return FALSE; - - *pnNumNegFormat = nCurrSel; - - return TRUE; -} - -/* Set leading zero */ -static BOOL -SetNumLeadZero(HWND hwndDlg, - PINT pnNumLeadingZero) -{ - INT nCurrSel; - - /* Get setted leading zero format */ - nCurrSel = SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDISPLEADZER, - CB_GETCURSEL, - (WPARAM)0, - (LPARAM)0); - if (nCurrSel == CB_ERR) - return FALSE; - - *pnNumLeadingZero = nCurrSel; - - return TRUE; -} - -/* Set elements list separator */ -static BOOL -SetNumListSep(HWND hwndDlg, - PWSTR pszNumListSep) -{ - /* Get setted list separator */ - SendDlgItemMessageW(hwndDlg, IDC_NUMBERSLSEP, - WM_GETTEXT, - (WPARAM)MAX_NUMLISTSEP, - (LPARAM)pszNumListSep); - - return TRUE; -} - -/* Set units system */ -static BOOL -SetNumUnitsSys(HWND hwndDlg, - PINT pnNumMeasure) -{ - INT nCurrSel; - - /* Get setted units system */ - nCurrSel = SendDlgItemMessageW(hwndDlg, IDC_NUMBERSMEASSYS, - CB_GETCURSEL, - (WPARAM)0, - (LPARAM)0); - if (nCurrSel == CB_ERR) - return FALSE; - - *pnNumMeasure = nCurrSel; - - return TRUE; -} - -static BOOL -SetNumberSetting(HWND hwndDlg, PGLOBALDATA pGlobalData) + +static +BOOL +GetNumberSetting( + HWND hwndDlg, + PGLOBALDATA pGlobalData) { WCHAR szNumDecimalSep[MAX_NUMDECIMALSEP]; WCHAR szNumThousandSep[MAX_NUMTHOUSANDSEP]; WCHAR szNumNegativeSign[MAX_NUMNEGATIVESIGN]; WCHAR szNumListSep[MAX_NUMLISTSEP]; - WCHAR szNumNativeDigits[MAX_NUMNATIVEDIGITS]; - int nNumGrouping; - int nNumDigits; - int nNumNegFormat; - int nNumLeadingZero; - int nNumMeasure; - - if (!SetNumDecimalSep(hwndDlg, szNumDecimalSep) || - !SetNumFieldSep(hwndDlg, szNumThousandSep) || - !SetNumNegSign(hwndDlg, szNumNegativeSign) || - !SetNumListSep(hwndDlg, szNumListSep) || - !SetFieldDigNum(hwndDlg, &nNumGrouping) || - !SetFracSymNum(hwndDlg, &nNumDigits) || - !SetNegSumFmt(hwndDlg, &nNumNegFormat) || - !SetNumLeadZero(hwndDlg, &nNumLeadingZero) || - !SetNumUnitsSys(hwndDlg, &nNumMeasure)) - { + INT nNumDigits; + INT nNumGrouping; + INT nNumNegFormat; + INT nNumLeadingZero; + INT nNumMeasure; + + /* Decimal symbol */ + GetSelectedComboBoxText(hwndDlg, + IDC_NUMBERDSYMBOL, + szNumDecimalSep, + MAX_NUMDECIMALSEP); + + if (szNumDecimalSep[0] == L'\0') + { + /* TODO: Show error message */ + return FALSE; } - /* store to global data */ + /* Number of digits after decimal */ + GetSelectedComboBoxIndex(hwndDlg, + IDC_NUMBERSNDIGDEC, + &nNumDigits); + + /* Digit grouping symbol */ + GetSelectedComboBoxText(hwndDlg, + IDC_NUMBERSDIGITGRSYM, + szNumThousandSep, + MAX_NUMTHOUSANDSEP); + + if (szNumThousandSep[0] == L'\0') + { + /* TODO: Show error message */ + + return FALSE; + } + + /* Digit grouping */ + GetSelectedComboBoxIndex(hwndDlg, + IDC_NUMBERSDGROUPING, + &nNumGrouping); + + /* Negative sign symbol */ + GetSelectedComboBoxText(hwndDlg, + IDC_NUMBERSNSIGNSYM, + szNumNegativeSign, + MAX_NUMNEGATIVESIGN); + + if (szNumNegativeSign[0] == L'\0') + { + /* TODO: Show error message */ + + return FALSE; + } + + /* Negative number format */ + GetSelectedComboBoxIndex(hwndDlg, + IDC_NUMBERSNNUMFORMAT, + &nNumNegFormat); + + /* Display leading zeros */ + GetSelectedComboBoxIndex(hwndDlg, + IDC_NUMBERSDISPLEADZER, + &nNumLeadingZero); + + /* List separator */ + GetSelectedComboBoxText(hwndDlg, + IDC_NUMBERSLSEP, + szNumListSep, + MAX_NUMLISTSEP); + + if (szNumListSep[0] == L'\0') + { + /* TODO: Show error message */ + + return FALSE; + } + + /* Measurement system */ + GetSelectedComboBoxIndex(hwndDlg, + IDC_NUMBERSMEASSYS, + &nNumMeasure); + + /* Store settings in global data */ wcscpy(pGlobalData->szNumDecimalSep, szNumDecimalSep); wcscpy(pGlobalData->szNumThousandSep, szNumThousandSep); wcscpy(pGlobalData->szNumNegativeSign, szNumNegativeSign); wcscpy(pGlobalData->szNumListSep, szNumListSep); - wcscpy(pGlobalData->szNumNativeDigits, szNumNativeDigits); pGlobalData->nNumGrouping = nNumGrouping; pGlobalData->nNumDigits = nNumDigits; pGlobalData->nNumNegFormat = nNumNegFormat; @@ -717,10 +627,9 @@ break; case WM_NOTIFY: - /* If push apply button */ if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY) { - if (SetNumberSetting(hwndDlg, pGlobalData)) + if (GetNumberSetting(hwndDlg, pGlobalData)) { pGlobalData->bUserLocaleChanged = TRUE; UpdateNumSamples(hwndDlg, pGlobalData); Modified: trunk/reactos/dll/cpl/intl/time.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/time.c?rev=74…
============================================================================== --- trunk/reactos/dll/cpl/intl/time.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/intl/time.c [iso-8859-1] Sat May 6 14:41:50 2017 @@ -51,47 +51,6 @@ } -static VOID -GetSelectedComboEntry(HWND hwndDlg, DWORD dwIdc, WCHAR *Buffer, UINT uSize) -{ - HWND hChildWnd; - PWSTR tmp; - INT nIndex; - UINT uReqSize; - - /* Get handle to time format control */ - hChildWnd = GetDlgItem(hwndDlg, dwIdc); - - /* Get index to selected time format */ - nIndex = SendMessageW(hChildWnd, CB_GETCURSEL, 0, 0); - if (nIndex == CB_ERR) - { - /* No selection? Get content of the edit control */ - SendMessageW(hChildWnd, WM_GETTEXT, uSize, (LPARAM)Buffer); - } - else - { - /* Get requested size, including the null terminator; - * it shouldn't be required because the previous CB_LIMITTEXT, - * but it would be better to check it anyways */ - uReqSize = SendMessageW(hChildWnd, CB_GETLBTEXTLEN, (WPARAM)nIndex, 0) + 1; - - /* Allocate enough space to be more safe */ - tmp = (PWSTR)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, uReqSize * sizeof(WCHAR)); - if (tmp != NULL) - { - /* Get selected time format text */ - SendMessageW(hChildWnd, CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)tmp); - - /* Finally, copy the result into the output */ - wcsncpy(Buffer, tmp, uSize); - - HeapFree(GetProcessHeap(), 0, tmp); - } - } -} - - static VOID InitTimeFormatCB( @@ -195,31 +154,59 @@ 0); } -static BOOL -SetTimeSetting(HWND hwndDlg, PGLOBALDATA pGlobalData) + +static +BOOL +GetTimeSetting( + HWND hwndDlg, + PGLOBALDATA pGlobalData) { WCHAR szTimeFormat[MAX_TIMEFORMAT]; WCHAR szTimeSep[MAX_TIMEFORMAT]; WCHAR szTimeAM[MAX_TIMEFORMAT]; WCHAR szTimePM[MAX_TIMEFORMAT]; - /* Get selected/typed time format text */ - GetSelectedComboEntry(hwndDlg, IDC_TIMEFORMAT, szTimeFormat, MAX_TIMEFORMAT); - - /* Get selected/typed time separator text */ - GetSelectedComboEntry(hwndDlg, IDC_TIMESEPARATOR, szTimeSep, MAX_TIMESEPARATOR); - - /* Get selected/typed AM symbol text */ - GetSelectedComboEntry(hwndDlg, IDC_TIMEAMSYMBOL, szTimeAM, MAX_TIMEAMSYMBOL); - - /* Get selected/typed PM symbol text */ - GetSelectedComboEntry(hwndDlg, IDC_TIMEPMSYMBOL, szTimePM, MAX_TIMEPMSYMBOL); - - /* verify values */ - if (szTimeFormat[0] == L'\0' || szTimeSep[0] == L'\0') + /* Time format */ + GetSelectedComboBoxText(hwndDlg, + IDC_TIMEFORMAT, + szTimeFormat, + MAX_TIMEFORMAT); + + /* Check the time format */ + if (szTimeFormat[0] == L'\0') + { + /* TODO: Show error message */ + return FALSE; - - /* store to global data */ + } + + /* Time separator */ + GetSelectedComboBoxText(hwndDlg, + IDC_TIMESEPARATOR, + szTimeSep, + MAX_TIMESEPARATOR); + + /* Check the time separator */ + if (szTimeSep[0] == L'\0') + { + /* TODO: Show error message */ + + return FALSE; + } + + /* AM symbol */ + GetSelectedComboBoxText(hwndDlg, + IDC_TIMEAMSYMBOL, + szTimeAM, + MAX_TIMEAMSYMBOL); + + /* PM symbol */ + GetSelectedComboBoxText(hwndDlg, + IDC_TIMEPMSYMBOL, + szTimePM, + MAX_TIMEPMSYMBOL); + + /* Store settings in global data */ wcscpy(pGlobalData->szTimeFormat, szTimeFormat); wcscpy(pGlobalData->szTimeSep, szTimeSep); wcscpy(pGlobalData->szTimeAM, szTimeAM); @@ -281,7 +268,7 @@ case WM_NOTIFY: if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY) { - if (SetTimeSetting(hwndDlg, pGlobalData)) + if (GetTimeSetting(hwndDlg, pGlobalData)) { pGlobalData->bUserLocaleChanged = TRUE; UpdateTimeSample(hwndDlg, pGlobalData);
7 years, 7 months
1
0
0
0
[ekohl] 74487: [INTL] Changed locale options doesn't reload correctly before next reboot. - Added SetNumberSetting, SetCurrencySetting, SetDateSetting and SetTimeSetting functions to get and check ...
by ekohl@svn.reactos.org
Author: ekohl Date: Sat May 6 13:43:03 2017 New Revision: 74487 URL:
http://svn.reactos.org/svn/reactos?rev=74487&view=rev
Log: [INTL] Changed locale options doesn't reload correctly before next reboot. - Added SetNumberSetting, SetCurrencySetting, SetDateSetting and SetTimeSetting functions to get and check values. - Don't directly change pGlobalData. - Post WM_WININICHANGE after all changes have been applied. Based on a patch by Katayama Hirofumi MZ. CORE-10170 Modified: trunk/reactos/dll/cpl/intl/currency.c trunk/reactos/dll/cpl/intl/date.c trunk/reactos/dll/cpl/intl/generalp.c trunk/reactos/dll/cpl/intl/numbers.c trunk/reactos/dll/cpl/intl/time.c Modified: trunk/reactos/dll/cpl/intl/currency.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/currency.c?re…
============================================================================== --- trunk/reactos/dll/cpl/intl/currency.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/intl/currency.c [iso-8859-1] Sat May 6 13:43:03 2017 @@ -20,7 +20,8 @@ * PROJECT: ReactOS International Control Panel * FILE: dll/cpl/intl/currency.c * PURPOSE: Currency property page - * PROGRAMMER: Eric Kohl + * PROGRAMMERS: Eric Kohl + * Katayama Hirofumi MZ (katayama.hirofumi.mz(a)gmail.com) */ #include "intl.h" @@ -262,7 +263,7 @@ /* Set number of digits in field */ static BOOL -SetCurrencyDigNum(HWND hwndDlg, PGLOBALDATA pGlobalData) +SetCurrencyDigNum(HWND hwndDlg, PINT pnCurrGrouping) { INT nCurrSel; @@ -271,30 +272,30 @@ CB_GETCURSEL, (WPARAM)0, (LPARAM)0); - - /* Save number of digits in field */ - if (nCurrSel != CB_ERR) - pGlobalData->nCurrGrouping = nCurrSel; + if (nCurrSel == CB_ERR) + return FALSE; + + *pnCurrGrouping = nCurrSel; return TRUE; } /* Set currency field separator */ static BOOL -SetCurrencyFieldSep(HWND hwndDlg, PGLOBALDATA pGlobalData) +SetCurrencyFieldSep(HWND hwndDlg, PWSTR pszCurrThousandSep) { /* Get setted currency field separator */ SendDlgItemMessageW(hwndDlg, IDC_CURRENCYGRPSEP, WM_GETTEXT, - (WPARAM)MAX_SAMPLES_STR_SIZE, - (LPARAM)pGlobalData->szCurrThousandSep); + (WPARAM)MAX_CURRTHOUSANDSEP, + (LPARAM)pszCurrThousandSep); return TRUE; } /* Set number of fractional symbols */ static BOOL -SetCurrencyFracSymNum(HWND hwndDlg, PGLOBALDATA pGlobalData) +SetCurrencyFracSymNum(HWND hwndDlg, PINT pnCurrDigits) { INT nCurrSel; @@ -306,27 +307,27 @@ if (nCurrSel == CB_ERR) return FALSE; - pGlobalData->nCurrDigits = nCurrSel; + *pnCurrDigits = nCurrSel; return TRUE; } /* Set currency separator */ static BOOL -SetCurrencySep(HWND hwndDlg, PGLOBALDATA pGlobalData) +SetCurrencySep(HWND hwndDlg, PWSTR pszCurrDecimalSep) { /* Get setted currency decimal separator */ SendDlgItemMessageW(hwndDlg, IDC_CURRENCYDECSEP, WM_GETTEXT, - (WPARAM)MAX_SAMPLES_STR_SIZE, - (LPARAM)pGlobalData->szCurrDecimalSep); + (WPARAM)MAX_CURRDECIMALSEP, + (LPARAM)pszCurrDecimalSep); return TRUE; } /* Set negative currency sum format */ static BOOL -SetNegCurrencySumFmt(HWND hwndDlg, PGLOBALDATA pGlobalData) +SetNegCurrencySumFmt(HWND hwndDlg, PINT pnCurrNegFormat) { INT nCurrSel; @@ -338,14 +339,14 @@ if (nCurrSel == CB_ERR) return FALSE; - pGlobalData->nCurrNegFormat = nCurrSel; + *pnCurrNegFormat = nCurrSel; return TRUE; } /* Set positive currency sum format */ static BOOL -SetPosCurrencySumFmt(HWND hwndDlg, PGLOBALDATA pGlobalData) +SetPosCurrencySumFmt(HWND hwndDlg, PINT pnCurrPosFormat) { INT nCurrSel; @@ -357,20 +358,55 @@ if (nCurrSel == CB_ERR) return FALSE; - pGlobalData->nCurrPosFormat = nCurrSel; + *pnCurrPosFormat = nCurrSel; return TRUE; } /* Set currency symbol */ static BOOL -SetCurrencySymbol(HWND hwndDlg, PGLOBALDATA pGlobalData) +SetCurrencySymbol(HWND hwndDlg, PWSTR pszCurrSymbol) { /* Get setted currency unit */ SendDlgItemMessageW(hwndDlg, IDC_CURRENCYSYMBOL, WM_GETTEXT, - (WPARAM)MAX_SAMPLES_STR_SIZE, - (LPARAM)(PCWSTR)pGlobalData->szCurrSymbol); + (WPARAM)MAX_CURRSYMBOL, + (LPARAM)pszCurrSymbol); + + return TRUE; +} + + +static BOOL +SetCurrencySetting(HWND hwndDlg, PGLOBALDATA pGlobalData) +{ + WCHAR szCurrSymbol[MAX_CURRSYMBOL]; + WCHAR szCurrDecimalSep[MAX_CURRDECIMALSEP]; + WCHAR szCurrThousandSep[MAX_CURRTHOUSANDSEP]; + INT nCurrGrouping; + INT nCurrPosFormat; + INT nCurrNegFormat; + INT nCurrDigits; + + if (!SetCurrencySymbol(hwndDlg, szCurrSymbol) || + !SetCurrencyDigNum(hwndDlg, &nCurrGrouping) || + !SetPosCurrencySumFmt(hwndDlg, &nCurrPosFormat) || + !SetNegCurrencySumFmt(hwndDlg, &nCurrNegFormat) || + !SetCurrencySep(hwndDlg, szCurrDecimalSep) || + !SetCurrencyFracSymNum(hwndDlg, &nCurrDigits) || + !SetCurrencyFieldSep(hwndDlg, szCurrThousandSep)) + { + return FALSE; + } + + /* store to global data */ + wcscpy(pGlobalData->szCurrSymbol, szCurrSymbol); + pGlobalData->nCurrGrouping = nCurrGrouping; + wcscpy(pGlobalData->szCurrDecimalSep, szCurrDecimalSep); + wcscpy(pGlobalData->szCurrThousandSep, szCurrThousandSep); + pGlobalData->nCurrPosFormat = nCurrPosFormat; + pGlobalData->nCurrNegFormat = nCurrNegFormat; + pGlobalData->nCurrDigits = nCurrDigits; return TRUE; } @@ -414,7 +450,7 @@ case IDC_CURRENCYGRPNUM: if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE) { - /* Set "Apply" button enabled */ + /* Enable the Apply button */ PropSheet_Changed(GetParent(hwndDlg), hwndDlg); } } @@ -423,30 +459,11 @@ case WM_NOTIFY: if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY) { - if (!SetCurrencySymbol(hwndDlg, pGlobalData)) - break; - - if (!SetCurrencyDigNum(hwndDlg, pGlobalData)) - break; - - if (!SetPosCurrencySumFmt(hwndDlg, pGlobalData)) - break; - - if (!SetNegCurrencySumFmt(hwndDlg, pGlobalData)) - break; - - if (!SetCurrencySep(hwndDlg, pGlobalData)) - break; - - if (!SetCurrencyFracSymNum(hwndDlg, pGlobalData)) - break; - - if (!SetCurrencyFieldSep(hwndDlg, pGlobalData)) - break; - - pGlobalData->bUserLocaleChanged = TRUE; - - UpdateExamples(hwndDlg, pGlobalData); + if (SetCurrencySetting(hwndDlg, pGlobalData)) + { + pGlobalData->bUserLocaleChanged = TRUE; + UpdateExamples(hwndDlg, pGlobalData); + } } break; } Modified: trunk/reactos/dll/cpl/intl/date.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/date.c?rev=74…
============================================================================== --- trunk/reactos/dll/cpl/intl/date.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/intl/date.c [iso-8859-1] Sat May 6 13:43:03 2017 @@ -20,7 +20,8 @@ * PROJECT: ReactOS International Control Panel * FILE: dll/cpl/intl/date.c * PURPOSE: Date property page - * PROGRAMMER: Eric Kohl + * PROGRAMMERS: Eric Kohl + * Katayama Hirofumi MZ (katayama.hirofumi.mz(a)gmail.com) */ #include "intl.h" @@ -86,9 +87,8 @@ /* Setted up short date separator to registry */ static BOOL -SetShortDateSep(HWND hwndDlg, PGLOBALDATA pGlobalData) -{ - WCHAR szShortDateSep[MAX_SAMPLES_STR_SIZE]; +SetShortDateSep(HWND hwndDlg, PWSTR pszShortDateSep) +{ INT nSepStrSize; INT nSepCount; @@ -96,32 +96,34 @@ SendDlgItemMessageW(hwndDlg, IDC_SHRTDATESEP_COMBO, WM_GETTEXT, (WPARAM)MAX_SAMPLES_STR_SIZE, - (LPARAM)szShortDateSep); + (LPARAM)pszShortDateSep); /* Get separator string size */ - nSepStrSize = wcslen(szShortDateSep); + nSepStrSize = wcslen(pszShortDateSep); /* Check date components */ for (nSepCount = 0; nSepCount < nSepStrSize; nSepCount++) { - if (iswalnum(szShortDateSep[nSepCount]) || (szShortDateSep[nSepCount] == L'\'')) + if (iswalnum(pszShortDateSep[nSepCount]) || (pszShortDateSep[nSepCount] == L'\'')) { PrintErrorMsgBox(IDS_ERROR_SYMBOL_SEPARATE); return FALSE; } } - /* Save date separator */ - wcscpy(pGlobalData->szDateSep, szShortDateSep); + if (nSepStrSize == 0) + { + PrintErrorMsgBox(IDS_ERROR_SYMBOL_SEPARATE); + return FALSE; + } return TRUE; } /* Setted up short date format to registry */ static BOOL -SetShortDateFormat(HWND hwndDlg, PGLOBALDATA pGlobalData) -{ - WCHAR szShortDateFmt[MAX_SAMPLES_STR_SIZE]; +SetShortDateFormat(HWND hwndDlg, PWSTR pszShortDateFmt) +{ WCHAR szShortDateSep[MAX_SAMPLES_STR_SIZE]; WCHAR szFoundDateSep[MAX_SAMPLES_STR_SIZE]; PWSTR pszResultStr; @@ -134,7 +136,7 @@ SendDlgItemMessageW(hwndDlg, IDC_SHRTDATEFMT_COMBO, WM_GETTEXT, (WPARAM)MAX_SAMPLES_STR_SIZE, - (LPARAM)szShortDateFmt); + (LPARAM)pszShortDateFmt); /* Get separator */ SendDlgItemMessageW(hwndDlg, IDC_SHRTDATESEP_COMBO, @@ -143,18 +145,18 @@ (LPARAM)szShortDateSep); /* Get format-string size */ - nFmtStrSize = wcslen(szShortDateFmt); + nFmtStrSize = wcslen(pszShortDateFmt); /* Check date components */ for (nDateCompCount = 0; nDateCompCount < nFmtStrSize; nDateCompCount++) { - if (szShortDateFmt[nDateCompCount] == L'\'') + if (pszShortDateFmt[nDateCompCount] == L'\'') { OpenApostFlg = !OpenApostFlg; } - if (iswalnum(szShortDateFmt[nDateCompCount]) && - !isDateCompAl(szShortDateFmt[nDateCompCount]) && + if (iswalnum(pszShortDateFmt[nDateCompCount]) && + !isDateCompAl(pszShortDateFmt[nDateCompCount]) && !OpenApostFlg) { PrintErrorMsgBox(IDS_ERROR_SYMBOL_FORMAT_SHORT); @@ -163,38 +165,34 @@ } - if (OpenApostFlg) + if (OpenApostFlg || nFmtStrSize == 0) { PrintErrorMsgBox(IDS_ERROR_SYMBOL_FORMAT_SHORT); return FALSE; } - pszFoundSep = FindDateSep(szShortDateFmt); + pszFoundSep = FindDateSep(pszShortDateFmt); if (pszFoundSep != NULL) { /* Substring replacement of separator */ wcscpy(szFoundDateSep, pszFoundSep); - pszResultStr = ReplaceSubStr(szShortDateFmt, szShortDateSep, szFoundDateSep); + pszResultStr = ReplaceSubStr(pszShortDateFmt, szShortDateSep, szFoundDateSep); if (pszResultStr != NULL) { - wcscpy(szShortDateFmt, pszResultStr); + wcscpy(pszShortDateFmt, pszResultStr); HeapFree(GetProcessHeap(), 0, pszResultStr); } HeapFree(GetProcessHeap(), 0, pszFoundSep); } - /* Save short date format */ - wcscpy(pGlobalData->szShortDateFormat, szShortDateFmt); - return TRUE; } /* Setted up long date format to registry */ static BOOL -SetLongDateFormat(HWND hwndDlg, PGLOBALDATA pGlobalData) -{ - WCHAR szLongDateFmt[MAX_SAMPLES_STR_SIZE]; +SetLongDateFormat(HWND hwndDlg, PWSTR pszLongDateFmt) +{ BOOL OpenApostFlg = FALSE; INT nFmtStrSize; INT nDateCompCount; @@ -203,21 +201,21 @@ SendDlgItemMessageW(hwndDlg, IDC_LONGDATEFMT_COMBO, WM_GETTEXT, (WPARAM)MAX_SAMPLES_STR_SIZE, - (LPARAM)szLongDateFmt); + (LPARAM)pszLongDateFmt); /* Get format string size */ - nFmtStrSize = wcslen(szLongDateFmt); + nFmtStrSize = wcslen(pszLongDateFmt); /* Check date components */ for (nDateCompCount = 0; nDateCompCount < nFmtStrSize; nDateCompCount++) { - if (szLongDateFmt[nDateCompCount] == L'\'') + if (pszLongDateFmt[nDateCompCount] == L'\'') { OpenApostFlg = !OpenApostFlg; } - if (iswalnum(szLongDateFmt[nDateCompCount]) && - !isDateCompAl(szLongDateFmt[nDateCompCount]) && + if (iswalnum(pszLongDateFmt[nDateCompCount]) && + !isDateCompAl(pszLongDateFmt[nDateCompCount]) && !OpenApostFlg) { PrintErrorMsgBox(IDS_ERROR_SYMBOL_FORMAT_LONG); @@ -226,14 +224,11 @@ } - if (OpenApostFlg) + if (OpenApostFlg || nFmtStrSize == 0) { PrintErrorMsgBox(IDS_ERROR_SYMBOL_FORMAT_LONG); return FALSE; } - - /* Save long date format */ - wcscpy(pGlobalData->szLongDateFormat, szLongDateFmt); return TRUE; } @@ -520,6 +515,28 @@ WM_SETTEXT, 0, (LPARAM)OutBuffer); } +static BOOL +SetDateSetting(HWND hwndDlg, PGLOBALDATA pGlobalData) +{ + WCHAR szLongDateFmt[MAX_SAMPLES_STR_SIZE]; + WCHAR szShortDateFmt[MAX_SAMPLES_STR_SIZE]; + WCHAR szShortDateSep[MAX_SAMPLES_STR_SIZE]; + + if (!SetLongDateFormat(hwndDlg, szLongDateFmt) || + !SetShortDateFormat(hwndDlg, szShortDateFmt) || + !SetShortDateSep(hwndDlg, szShortDateSep)) + { + return FALSE; + } + + /* store to global data */ + wcscpy(pGlobalData->szLongDateFormat, szLongDateFmt); + wcscpy(pGlobalData->szShortDateFormat, szShortDateFmt); + wcscpy(pGlobalData->szDateSep, szShortDateSep); + + return TRUE; +} + /* Property page dialog callback */ INT_PTR CALLBACK DatePageProc(HWND hwndDlg, @@ -568,7 +585,7 @@ case IDC_SHRTDATESEP_COMBO: if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE) { - /* Set "Apply" button enabled */ + /* Enable the Apply button */ PropSheet_Changed(GetParent(hwndDlg), hwndDlg); } break; @@ -578,20 +595,12 @@ case WM_NOTIFY: if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY) { - if (!SetLongDateFormat(hwndDlg, pGlobalData)) - break; - - if (!SetShortDateFormat(hwndDlg, pGlobalData)) - break; - - if (!SetShortDateSep(hwndDlg, pGlobalData)) - break; - - pGlobalData->bUserLocaleChanged = TRUE; - - SetMaxDate(hwndDlg, pGlobalData->UserLCID); - InitShortDateCB(hwndDlg, pGlobalData); - UpdateDateLocaleSamples(hwndDlg, pGlobalData); + if (SetDateSetting(hwndDlg, pGlobalData)) + { + pGlobalData->bUserLocaleChanged = TRUE; + SetMaxDate(hwndDlg, pGlobalData->UserLCID); + UpdateDateLocaleSamples(hwndDlg, pGlobalData); + } } break; } Modified: trunk/reactos/dll/cpl/intl/generalp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/generalp.c?re…
============================================================================== --- trunk/reactos/dll/cpl/intl/generalp.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/intl/generalp.c [iso-8859-1] Sat May 6 13:43:03 2017 @@ -1494,6 +1494,9 @@ } AddNewKbLayoutsByLcid(pGlobalData->UserLCID); + + /* Post WM_WININICHANGE messages to system */ + PostMessageW(HWND_BROADCAST, WM_WININICHANGE, 0, (LPARAM)L"intl"); } break; } Modified: trunk/reactos/dll/cpl/intl/numbers.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/numbers.c?rev…
============================================================================== --- trunk/reactos/dll/cpl/intl/numbers.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/intl/numbers.c [iso-8859-1] Sat May 6 13:43:03 2017 @@ -20,7 +20,8 @@ * PROJECT: ReactOS International Control Panel * FILE: dll/cpl/intl/numbers.c * PURPOSE: Numbers property page - * PROGRAMMER: Eric Kohl + * PROGRAMMERS: Eric Kohl + * Katayama Hirofumi MZ (katayama.hirofumi.mz(a)gmail.com) */ #include "intl.h" @@ -471,13 +472,13 @@ /* Set num decimal separator */ static BOOL SetNumDecimalSep(HWND hwndDlg, - PGLOBALDATA pGlobalData) + PWSTR pszNumDecimalSep) { /* Get setted decimal separator */ SendDlgItemMessageW(hwndDlg, IDC_NUMBERDSYMBOL, WM_GETTEXT, (WPARAM)MAX_NUMDECIMALSEP, - (LPARAM)pGlobalData->szNumDecimalSep); + (LPARAM)pszNumDecimalSep); return TRUE; } @@ -485,7 +486,7 @@ /* Set number of fractional symbols */ static BOOL SetFracSymNum(HWND hwndDlg, - PGLOBALDATA pGlobalData) + PINT pnNumDigits) { INT nCurrSel; @@ -497,7 +498,7 @@ if (nCurrSel == CB_ERR) return FALSE; - pGlobalData->nNumDigits = nCurrSel; + *pnNumDigits = nCurrSel; return TRUE; } @@ -505,13 +506,13 @@ /* Set field separator */ static BOOL SetNumFieldSep(HWND hwndDlg, - PGLOBALDATA pGlobalData) + PWSTR pszNumThousandSep) { /* Get thousand separator */ SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDIGITGRSYM, WM_GETTEXT, (WPARAM)MAX_NUMTHOUSANDSEP, - (LPARAM)pGlobalData->szNumThousandSep); + (LPARAM)pszNumThousandSep); return TRUE; } @@ -519,7 +520,7 @@ /* Set number of digits in field */ static BOOL SetFieldDigNum(HWND hwndDlg, - PGLOBALDATA pGlobalData) + PINT pnNumGrouping) { INT nCurrSel; @@ -531,7 +532,7 @@ if (nCurrSel == CB_ERR) return FALSE; - pGlobalData->nNumGrouping = nCurrSel; + *pnNumGrouping = nCurrSel; return TRUE; } @@ -539,13 +540,13 @@ /* Set negative sign */ static BOOL SetNumNegSign(HWND hwndDlg, - PGLOBALDATA pGlobalData) + PWSTR pszNumNegativeSign) { /* Get setted negative sign */ SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNSIGNSYM, WM_GETTEXT, (WPARAM)MAX_NUMNEGATIVESIGN, - (LPARAM)pGlobalData->szNumNegativeSign); + (LPARAM)pszNumNegativeSign); return TRUE; } @@ -553,7 +554,7 @@ /* Set negative sum format */ static BOOL SetNegSumFmt(HWND hwndDlg, - PGLOBALDATA pGlobalData) + PINT pnNumNegFormat) { INT nCurrSel; @@ -565,7 +566,7 @@ if (nCurrSel == CB_ERR) return FALSE; - pGlobalData->nNumNegFormat = nCurrSel; + *pnNumNegFormat = nCurrSel; return TRUE; } @@ -573,7 +574,7 @@ /* Set leading zero */ static BOOL SetNumLeadZero(HWND hwndDlg, - PGLOBALDATA pGlobalData) + PINT pnNumLeadingZero) { INT nCurrSel; @@ -585,7 +586,7 @@ if (nCurrSel == CB_ERR) return FALSE; - pGlobalData->nNumLeadingZero = nCurrSel; + *pnNumLeadingZero = nCurrSel; return TRUE; } @@ -593,13 +594,13 @@ /* Set elements list separator */ static BOOL SetNumListSep(HWND hwndDlg, - PGLOBALDATA pGlobalData) + PWSTR pszNumListSep) { /* Get setted list separator */ SendDlgItemMessageW(hwndDlg, IDC_NUMBERSLSEP, WM_GETTEXT, (WPARAM)MAX_NUMLISTSEP, - (LPARAM)pGlobalData->szNumListSep); + (LPARAM)pszNumListSep); return TRUE; } @@ -607,7 +608,7 @@ /* Set units system */ static BOOL SetNumUnitsSys(HWND hwndDlg, - PGLOBALDATA pGlobalData) + PINT pnNumMeasure) { INT nCurrSel; @@ -619,7 +620,49 @@ if (nCurrSel == CB_ERR) return FALSE; - pGlobalData->nNumMeasure = nCurrSel; + *pnNumMeasure = nCurrSel; + + return TRUE; +} + +static BOOL +SetNumberSetting(HWND hwndDlg, PGLOBALDATA pGlobalData) +{ + WCHAR szNumDecimalSep[MAX_NUMDECIMALSEP]; + WCHAR szNumThousandSep[MAX_NUMTHOUSANDSEP]; + WCHAR szNumNegativeSign[MAX_NUMNEGATIVESIGN]; + WCHAR szNumListSep[MAX_NUMLISTSEP]; + WCHAR szNumNativeDigits[MAX_NUMNATIVEDIGITS]; + int nNumGrouping; + int nNumDigits; + int nNumNegFormat; + int nNumLeadingZero; + int nNumMeasure; + + if (!SetNumDecimalSep(hwndDlg, szNumDecimalSep) || + !SetNumFieldSep(hwndDlg, szNumThousandSep) || + !SetNumNegSign(hwndDlg, szNumNegativeSign) || + !SetNumListSep(hwndDlg, szNumListSep) || + !SetFieldDigNum(hwndDlg, &nNumGrouping) || + !SetFracSymNum(hwndDlg, &nNumDigits) || + !SetNegSumFmt(hwndDlg, &nNumNegFormat) || + !SetNumLeadZero(hwndDlg, &nNumLeadingZero) || + !SetNumUnitsSys(hwndDlg, &nNumMeasure)) + { + return FALSE; + } + + /* store to global data */ + wcscpy(pGlobalData->szNumDecimalSep, szNumDecimalSep); + wcscpy(pGlobalData->szNumThousandSep, szNumThousandSep); + wcscpy(pGlobalData->szNumNegativeSign, szNumNegativeSign); + wcscpy(pGlobalData->szNumListSep, szNumListSep); + wcscpy(pGlobalData->szNumNativeDigits, szNumNativeDigits); + pGlobalData->nNumGrouping = nNumGrouping; + pGlobalData->nNumDigits = nNumDigits; + pGlobalData->nNumNegFormat = nNumNegFormat; + pGlobalData->nNumLeadingZero = nNumLeadingZero; + pGlobalData->nNumMeasure = nNumMeasure; return TRUE; } @@ -667,7 +710,7 @@ case IDC_NUMBERSMEASSYS: if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE) { - /* Set "Apply" button enabled */ + /* Enable the Apply button */ PropSheet_Changed(GetParent(hwndDlg), hwndDlg); } } @@ -677,36 +720,11 @@ /* If push apply button */ if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY) { - if (!SetNumDecimalSep(hwndDlg, pGlobalData)) - break; - - if (!SetFracSymNum(hwndDlg, pGlobalData)) - break; - - if (!SetNumFieldSep(hwndDlg, pGlobalData)) - break; - - if (!SetFieldDigNum(hwndDlg, pGlobalData)) - break; - - if (!SetNumNegSign(hwndDlg, pGlobalData)) - break; - - if (!SetNegSumFmt(hwndDlg, pGlobalData)) - break; - - if (!SetNumLeadZero(hwndDlg, pGlobalData)) - break; - - if (!SetNumListSep(hwndDlg, pGlobalData)) - break; - - if (!SetNumUnitsSys(hwndDlg, pGlobalData)) - break; - - pGlobalData->bUserLocaleChanged = TRUE; - - UpdateNumSamples(hwndDlg, pGlobalData); + if (SetNumberSetting(hwndDlg, pGlobalData)) + { + pGlobalData->bUserLocaleChanged = TRUE; + UpdateNumSamples(hwndDlg, pGlobalData); + } } break; } Modified: trunk/reactos/dll/cpl/intl/time.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/time.c?rev=74…
============================================================================== --- trunk/reactos/dll/cpl/intl/time.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/intl/time.c [iso-8859-1] Sat May 6 13:43:03 2017 @@ -20,7 +20,8 @@ * PROJECT: ReactOS International Control Panel * FILE: dll/cpl/intl/time.c * PURPOSE: Time property page - * PROGRAMMER: Eric Kohl + * PROGRAMMERS: Eric Kohl + * Katayama Hirofumi MZ (katayama.hirofumi.mz(a)gmail.com) */ #include "intl.h" @@ -194,6 +195,38 @@ 0); } +static BOOL +SetTimeSetting(HWND hwndDlg, PGLOBALDATA pGlobalData) +{ + WCHAR szTimeFormat[MAX_TIMEFORMAT]; + WCHAR szTimeSep[MAX_TIMEFORMAT]; + WCHAR szTimeAM[MAX_TIMEFORMAT]; + WCHAR szTimePM[MAX_TIMEFORMAT]; + + /* Get selected/typed time format text */ + GetSelectedComboEntry(hwndDlg, IDC_TIMEFORMAT, szTimeFormat, MAX_TIMEFORMAT); + + /* Get selected/typed time separator text */ + GetSelectedComboEntry(hwndDlg, IDC_TIMESEPARATOR, szTimeSep, MAX_TIMESEPARATOR); + + /* Get selected/typed AM symbol text */ + GetSelectedComboEntry(hwndDlg, IDC_TIMEAMSYMBOL, szTimeAM, MAX_TIMEAMSYMBOL); + + /* Get selected/typed PM symbol text */ + GetSelectedComboEntry(hwndDlg, IDC_TIMEPMSYMBOL, szTimePM, MAX_TIMEPMSYMBOL); + + /* verify values */ + if (szTimeFormat[0] == L'\0' || szTimeSep[0] == L'\0') + return FALSE; + + /* store to global data */ + wcscpy(pGlobalData->szTimeFormat, szTimeFormat); + wcscpy(pGlobalData->szTimeSep, szTimeSep); + wcscpy(pGlobalData->szTimeAM, szTimeAM); + wcscpy(pGlobalData->szTimePM, szTimePM); + + return TRUE; +} /* Property page dialog callback */ INT_PTR CALLBACK @@ -238,6 +271,7 @@ if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE) { + /* Enable the Apply button */ PropSheet_Changed(GetParent(hwndDlg), hwndDlg); } break; @@ -247,30 +281,11 @@ case WM_NOTIFY: if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY) { - /* Get selected/typed time format text */ - GetSelectedComboEntry(hwndDlg, IDC_TIMEFORMAT, - pGlobalData->szTimeFormat, - MAX_TIMEFORMAT); - - /* Get selected/typed time separator text */ - GetSelectedComboEntry(hwndDlg, IDC_TIMESEPARATOR, - pGlobalData->szTimeSep, - MAX_TIMESEPARATOR); - - /* Get selected/typed AM symbol text */ - GetSelectedComboEntry(hwndDlg, IDC_TIMEAMSYMBOL, - pGlobalData->szTimeAM, - MAX_TIMEAMSYMBOL); - - /* Get selected/typed PM symbol text */ - GetSelectedComboEntry(hwndDlg, IDC_TIMEPMSYMBOL, - pGlobalData->szTimePM, - MAX_TIMEPMSYMBOL); - - pGlobalData->bUserLocaleChanged = TRUE; - - /* Update the time format sample */ - UpdateTimeSample(hwndDlg, pGlobalData); + if (SetTimeSetting(hwndDlg, pGlobalData)) + { + pGlobalData->bUserLocaleChanged = TRUE; + UpdateTimeSample(hwndDlg, pGlobalData); + } } break; }
7 years, 7 months
1
0
0
0
[tfaber] 74486: [WIN32K:NTGDI] - Avoid using floating point operations in kernel mode. CORE-10893
by tfaber@svn.reactos.org
Author: tfaber Date: Sat May 6 12:18:21 2017 New Revision: 74486 URL:
http://svn.reactos.org/svn/reactos?rev=74486&view=rev
Log: [WIN32K:NTGDI] - Avoid using floating point operations in kernel mode. CORE-10893 Modified: trunk/reactos/win32ss/gdi/ntgdi/brush.h trunk/reactos/win32ss/gdi/ntgdi/pen.c trunk/reactos/win32ss/gdi/ntgdi/stockobj.c Modified: trunk/reactos/win32ss/gdi/ntgdi/brush.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/brush.h?…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/brush.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/brush.h [iso-8859-1] Sat May 6 12:18:21 2017 @@ -33,7 +33,7 @@ /* The following members are for PENs only */ LONG lWidth; - FLOAT eWidth; + FLOATOBJ eWidth; ULONG ulPenStyle; DWORD *pStyle; ULONG dwStyleCount; Modified: trunk/reactos/win32ss/gdi/ntgdi/pen.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/pen.c?re…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/pen.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/pen.c [iso-8859-1] Sat May 6 12:18:21 2017 @@ -122,7 +122,7 @@ dwWidth = 1; pbrushPen->lWidth = dwWidth; - pbrushPen->eWidth = (FLOAT)pbrushPen->lWidth; + FLOATOBJ_SetLong(&pbrushPen->eWidth, pbrushPen->lWidth); pbrushPen->ulPenStyle = dwPenStyle; pbrushPen->BrushAttr.lbColor = ulColor; pbrushPen->iBrushStyle = ulBrushStyle; Modified: trunk/reactos/win32ss/gdi/ntgdi/stockobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/stockobj…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/stockobj.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/stockobj.c [iso-8859-1] Sat May 6 12:18:21 2017 @@ -116,7 +116,7 @@ pbrushPen->iHatch = 0; pbrushPen->lWidth = abs(dwWidth); - pbrushPen->eWidth = (FLOAT)pbrushPen->lWidth; + FLOATOBJ_SetLong(&pbrushPen->eWidth, pbrushPen->lWidth); pbrushPen->ulPenStyle = dwPenStyle; pbrushPen->BrushAttr.lbColor = ulColor; pbrushPen->iBrushStyle = ulBrushStyle;
7 years, 7 months
1
0
0
0
[tfaber] 74485: [MMSYS] - Simplify code by using windowsx.h. Patch by Katayama Hirofumi MZ. CORE-12903
by tfaber@svn.reactos.org
Author: tfaber Date: Sat May 6 10:14:29 2017 New Revision: 74485 URL:
http://svn.reactos.org/svn/reactos?rev=74485&view=rev
Log: [MMSYS] - Simplify code by using windowsx.h. Patch by Katayama Hirofumi MZ. CORE-12903 Modified: trunk/reactos/dll/cpl/mmsys/sounds.c Modified: trunk/reactos/dll/cpl/mmsys/sounds.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/mmsys/sounds.c?rev…
============================================================================== --- trunk/reactos/dll/cpl/mmsys/sounds.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/mmsys/sounds.c [iso-8859-1] Sat May 6 10:14:29 2017 @@ -6,11 +6,13 @@ * Johannes Anderwald <janderwald(a)reactos.com> * Dmitry Chapyshev <dmitry(a)reactos.org> * Victor Martinez Calvo <victor.martinez(a)reactos.org> + * Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> */ #include "mmsys.h" #include <commdlg.h> +#include <windowsx.h> #include <strsafe.h> #include <debug.h> @@ -335,7 +337,7 @@ return FALSE; /* Try to add the new profile */ - lResult = SendDlgItemMessage(hwndDlg, IDC_SOUND_SCHEME, CB_ADDSTRING, (WPARAM)0, (LPARAM)szValue); + lResult = ComboBox_AddString(GetDlgItem(hwndDlg, IDC_SOUND_SCHEME), szValue); if (lResult == CB_ERR) return FALSE; @@ -344,7 +346,7 @@ if (pScheme == NULL) { /* We failed to allocate the buffer, no need to keep a dangling string in the combobox */ - SendDlgItemMessage(hwndDlg, IDC_SOUND_SCHEME, CB_DELETESTRING, (WPARAM)lResult, (LPARAM)0); + ComboBox_DeleteString(GetDlgItem(hwndDlg, IDC_SOUND_SCHEME), lResult); return FALSE; } @@ -352,11 +354,13 @@ StringCchCopy(pScheme->szName, MAX_PATH, szSubKey); /* Associate the value with the item in the combobox */ - SendDlgItemMessage(hwndDlg, IDC_SOUND_SCHEME, CB_SETITEMDATA, (WPARAM)lResult, (LPARAM)pScheme); + ComboBox_SetItemData(GetDlgItem(hwndDlg, IDC_SOUND_SCHEME), lResult, pScheme); /* Optionally, select the profile */ if (SetDefault) - SendDlgItemMessage(hwndDlg, IDC_SOUND_SCHEME, CB_SETCURSEL, (WPARAM)lResult, (LPARAM)0); + { + ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_SOUND_SCHEME), lResult); + } return TRUE; } @@ -427,7 +431,7 @@ LRESULT lCount, lIndex, lResult; PSOUND_SCHEME_CONTEXT pScheme; - lCount = SendDlgItemMessage(hwndDlg, IDC_SOUND_SCHEME, CB_GETCOUNT, (WPARAM)0, (LPARAM)0); + lCount = ComboBox_GetCount(GetDlgItem(hwndDlg, IDC_SOUND_SCHEME)); if (lCount == CB_ERR) { return NULL; @@ -435,7 +439,7 @@ for(lIndex = 0; lIndex < lCount; lIndex++) { - lResult = SendDlgItemMessage(hwndDlg, IDC_SOUND_SCHEME, CB_GETITEMDATA, (WPARAM)lIndex, (LPARAM)0); + lResult = ComboBox_GetItemData(GetDlgItem(hwndDlg, IDC_SOUND_SCHEME), lIndex); if (lResult == CB_ERR) { continue; @@ -740,6 +744,7 @@ BOOL LoadSoundFiles(HWND hwndDlg) { + TCHAR szList[256]; WCHAR szPath[MAX_PATH]; WCHAR * ptr; WIN32_FIND_DATAW FileData; @@ -748,10 +753,10 @@ UINT length; /* Add no sound listview item */ - if (LoadString(hApplet, IDS_NO_SOUND, szPath, _countof(szPath))) - { - szPath[_countof(szPath)-1] = L'\0'; - SendDlgItemMessageW(hwndDlg, IDC_SOUND_LIST, CB_ADDSTRING, (WPARAM)0, (LPARAM)szPath); + if (LoadString(hApplet, IDS_NO_SOUND, szList, _countof(szList))) + { + szList[_countof(szList) - 1] = TEXT('\0'); + ComboBox_AddString(GetDlgItem(hwndDlg, IDC_SOUND_LIST), szList); } /* Load sound files */ @@ -1014,13 +1019,13 @@ case IDC_PLAY_SOUND: { LRESULT lIndex; - lIndex = SendDlgItemMessage(hwndDlg, IDC_SOUND_LIST, CB_GETCURSEL, (WPARAM)0, (LPARAM)0); + lIndex = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_SOUND_LIST)); if (lIndex == CB_ERR) { break; } - lIndex = SendDlgItemMessage(hwndDlg, IDC_SOUND_LIST, CB_GETITEMDATA, (WPARAM)lIndex, (LPARAM)0); + lIndex = ComboBox_GetItemData(GetDlgItem(hwndDlg, IDC_SOUND_LIST), lIndex); if (lIndex != CB_ERR) { PlaySound((TCHAR*)lIndex, NULL, SND_FILENAME); @@ -1054,7 +1059,7 @@ { break; } - lIndex = SendDlgItemMessage(hwndDlg, IDC_SOUND_LIST, CB_GETCURSEL, (WPARAM)0, (LPARAM)0); + lIndex = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_SOUND_LIST)); if (lIndex == CB_ERR) { break; @@ -1067,7 +1072,7 @@ LRESULT lResult; pLabelContext = (PLABEL_CONTEXT)item.lParam; - lResult = SendDlgItemMessage(hwndDlg, IDC_SOUND_LIST, CB_GETITEMDATA, (WPARAM)lIndex, (LPARAM)0); + lResult = ComboBox_GetItemData(GetDlgItem(hwndDlg, IDC_SOUND_LIST), lIndex); if (lResult == CB_ERR || lResult == 0) { if (lIndex != pLabelContext->szValue[0]) @@ -1140,22 +1145,22 @@ EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSE_SOUND), TRUE); if (_tcslen(pLabelContext->szValue) == 0) { - lIndex = SendDlgItemMessage(hwndDlg, IDC_SOUND_LIST, CB_SETCURSEL, (WPARAM)0, (LPARAM)0); + lIndex = ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_SOUND_LIST), 0); EnableWindow(GetDlgItem(hwndDlg, IDC_PLAY_SOUND), FALSE); break; } EnableWindow(GetDlgItem(hwndDlg, IDC_PLAY_SOUND), TRUE); - lCount = SendDlgItemMessage(hwndDlg, IDC_SOUND_LIST, CB_GETCOUNT, (WPARAM)0, (LPARAM)0); + lCount = ComboBox_GetCount(GetDlgItem(hwndDlg, IDC_SOUND_LIST)); for (lIndex = 0; lIndex < lCount; lIndex++) { - lResult = SendDlgItemMessage(hwndDlg, IDC_SOUND_LIST, CB_GETITEMDATA, (WPARAM)lIndex, (LPARAM)0); + lResult = ComboBox_GetItemData(GetDlgItem(hwndDlg, IDC_SOUND_LIST), lIndex); if (lResult == CB_ERR || lResult == 0) continue; if (!_tcscmp((TCHAR*)lResult, pLabelContext->szValue)) { - SendDlgItemMessage(hwndDlg, IDC_SOUND_LIST, CB_SETCURSEL, (WPARAM)lIndex, (LPARAM)0); + ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_SOUND_LIST), lIndex); return FALSE; } } @@ -1168,11 +1173,11 @@ { ptr = pLabelContext->szValue; } - lIndex = SendDlgItemMessage(hwndDlg, IDC_SOUND_LIST, CB_ADDSTRING, (WPARAM)0, (LPARAM)ptr); + lIndex = ComboBox_AddString(GetDlgItem(hwndDlg, IDC_SOUND_LIST), ptr); if (lIndex != CB_ERR) { - SendDlgItemMessage(hwndDlg, IDC_SOUND_LIST, CB_SETITEMDATA, (WPARAM)lIndex, (LPARAM)_tcsdup(pLabelContext->szValue)); - SendDlgItemMessage(hwndDlg, IDC_SOUND_LIST, CB_SETCURSEL, (WPARAM)lIndex, (LPARAM)0); + ComboBox_SetItemData(GetDlgItem(hwndDlg, IDC_SOUND_LIST), lIndex, _tcsdup(pLabelContext->szValue)); + ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_SOUND_LIST), lIndex); } } break;
7 years, 7 months
1
0
0
0
← Newer
1
...
21
22
23
24
25
26
27
28
29
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
Results per page:
10
25
50
100
200