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
June 2010
----- 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
24 participants
407 discussions
Start a n
N
ew thread
[tkreuzer] 47552: [ReactOS-amd64.rbuild] The old explorer won't compile for amd64 without massive hacking, so remove it from the build.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Jun 3 22:57:25 2010 New Revision: 47552 URL:
http://svn.reactos.org/svn/reactos?rev=47552&view=rev
Log: [ReactOS-amd64.rbuild] The old explorer won't compile for amd64 without massive hacking, so remove it from the build. Modified: trunk/reactos/ReactOS-amd64.rbuild Modified: trunk/reactos/ReactOS-amd64.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ReactOS-amd64.rbuild?rev=4…
============================================================================== --- trunk/reactos/ReactOS-amd64.rbuild [iso-8859-1] (original) +++ trunk/reactos/ReactOS-amd64.rbuild [iso-8859-1] Thu Jun 3 22:57:25 2010 @@ -49,7 +49,26 @@ <if property="USERMODE" value="1"> <directory name="base"> - <xi:include href="base/base.rbuild" /> + <directory name="applications"> + <xi:include href="base/applications/applications.rbuild" /> + </directory> + <directory name="services"> + <xi:include href="base/services/services.rbuild" /> + </directory> + <directory name="setup"> + <xi:include href="base/setup/setup.rbuild" /> + </directory> + <directory name="shell"> + <directory name="cmd"> + <xi:include href="base/shell/cmd/cmd.rbuild" /> + </directory> + <directory name="explorer-new"> + <xi:include href="base/shell/explorer-new/explorer.rbuild" /> + </directory> + </directory> + <directory name="system"> + <xi:include href="base/system/system.rbuild" /> + </directory> </directory> <directory name="dll"> <xi:include href="dll/dll.rbuild" />
14 years, 6 months
1
0
0
0
[tkreuzer] 47551: [ROSTESTS] Fix 64 bit build of some modules (Samuel Serapion, modified by me)
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Jun 3 22:08:26 2010 New Revision: 47551 URL:
http://svn.reactos.org/svn/reactos?rev=47551&view=rev
Log: [ROSTESTS] Fix 64 bit build of some modules (Samuel Serapion, modified by me) Modified: trunk/rostests/ (props changed) trunk/rostests/drivers/kmtest/ntos_io.c trunk/rostests/drivers/kmtest/ntos_ob.c trunk/rostests/drivers/kmtest/reghelper.c trunk/rostests/dxtest/ddraw/helper.cpp trunk/rostests/tests/bench/bench-thread.c trunk/rostests/tests/button2/buttontst2.c trunk/rostests/tests/capclock/capclock.c trunk/rostests/tests/combotst/combotst.c trunk/rostests/tests/edit/edittest.c trunk/rostests/tests/global_mem/global_mem.c trunk/rostests/tests/isotest/isotest.c trunk/rostests/tests/map_dup_inherit/map_dup_inherit.c trunk/rostests/tests/mdi/mdi.c trunk/rostests/tests/miditest/miditest.c trunk/rostests/tests/multithrdwin/multithrdwin.c trunk/rostests/tests/p_dup_handle/p_dup_handle.c trunk/rostests/win32/user32/kbdlayout/kbdlayout.c Propchange: trunk/rostests/ ------------------------------------------------------------------------------ svn:mergeinfo = /branches/ros-amd64-bringup/rostests:44459,44462 Modified: trunk/rostests/drivers/kmtest/ntos_io.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/drivers/kmtest/ntos_io.c?…
============================================================================== --- trunk/rostests/drivers/kmtest/ntos_io.c [iso-8859-1] (original) +++ trunk/rostests/drivers/kmtest/ntos_io.c [iso-8859-1] Thu Jun 3 22:08:26 2010 @@ -46,7 +46,7 @@ ok(Mdl == NULL, "IoAllocateMdl should fail allocation of 2Gb or more, but got Mdl=0x%X", - (UINT32)Mdl); + (UINT_PTR)Mdl); if (Mdl) IoFreeMdl(Mdl); @@ -57,10 +57,10 @@ ok(Mdl != NULL, "Mdl allocation failed"); // Check fields of the allocated struct ok(Mdl->Next == NULL, "Mdl->Next should be NULL, but is 0x%X", - (UINT32)Mdl->Next); + (UINT_PTR)Mdl->Next); ok(Mdl->ByteCount == MdlSize, "Mdl->ByteCount should be equal to MdlSize, but is 0x%X", - (UINT32)Mdl->ByteCount); + (UINT_PTR)Mdl->ByteCount); // TODO: Check other fields of MDL struct IoFreeMdl(Mdl); @@ -70,7 +70,7 @@ Mdl = IoAllocateMdl(VirtualAddress, MdlSize, FALSE, FALSE, Irp); ok(Mdl != NULL, "Mdl allocation failed"); ok(Irp->MdlAddress == Mdl, "Irp->MdlAddress should be 0x%X, but is 0x%X", - (UINT32)Mdl, (UINT32)Irp->MdlAddress); + (UINT_PTR)Mdl, (UINT_PTR)Irp->MdlAddress); IoFreeMdl(Mdl); Modified: trunk/rostests/drivers/kmtest/ntos_ob.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/drivers/kmtest/ntos_ob.c?…
============================================================================== --- trunk/rostests/drivers/kmtest/ntos_ob.c [iso-8859-1] (original) +++ trunk/rostests/drivers/kmtest/ntos_ob.c [iso-8859-1] Thu Jun 3 22:08:26 2010 @@ -324,7 +324,7 @@ "Object insertion should have failed, but got 0x%lX", Status); ok(ObBody[0] == ObBody1[1], "Object bodies doesn't match, 0x%p != 0x%p", ObBody[0], ObBody1[1]); - ok(ObHandle2[0] != NULL, "Bad handle returned 0x%lX", (ULONG)ObHandle2[0]); + ok(ObHandle2[0] != NULL, "Bad handle returned 0x%lX", (ULONG_PTR)ObHandle2[0]); DPRINT1("%d %d %d %d %d %d %d\n", DumpCount, OpenCount, // deletecount+1 CloseCount, DeleteCount, ParseCount, OkayToCloseCount, QueryNameCount); Modified: trunk/rostests/drivers/kmtest/reghelper.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/drivers/kmtest/reghelper.…
============================================================================== --- trunk/rostests/drivers/kmtest/reghelper.c [iso-8859-1] (original) +++ trunk/rostests/drivers/kmtest/reghelper.c [iso-8859-1] Thu Jun 3 22:08:26 2010 @@ -75,7 +75,7 @@ /* Remove the current driver name from the string */ /* FIXME: Dont use hard coded driver name, determine it from the string returned from the above Query */ Length = (wcslen((PWCHAR)ValuePartialInfo->Data) * 2) - (wcslen(L"kmtest.sys") * 2); - RtlZeroMemory((PVOID)((ULONG)ValuePartialInfo->Data + Length), + RtlZeroMemory((PVOID)((ULONG_PTR)ValuePartialInfo->Data + Length), wcslen(L"drvtests.sys") * 2); ZwClose(ServiceKey); Modified: trunk/rostests/dxtest/ddraw/helper.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dxtest/ddraw/helper.cpp?r…
============================================================================== --- trunk/rostests/dxtest/ddraw/helper.cpp [iso-8859-1] (original) +++ trunk/rostests/dxtest/ddraw/helper.cpp [iso-8859-1] Thu Jun 3 22:08:26 2010 @@ -1,6 +1,6 @@ #include "ddrawtest.h" -LONG WINAPI BasicWindowProc (HWND hwnd, UINT message, UINT wParam, LONG lParam) +LRESULT WINAPI BasicWindowProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { Modified: trunk/rostests/tests/bench/bench-thread.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/tests/bench/bench-thread.…
============================================================================== --- trunk/rostests/tests/bench/bench-thread.c [iso-8859-1] (original) +++ trunk/rostests/tests/bench/bench-thread.c [iso-8859-1] Thu Jun 3 22:08:26 2010 @@ -7,7 +7,7 @@ DWORD WINAPI thread_main1(LPVOID param) { - printf("Thread 1 running (Counter %lu)\n", (DWORD)param); + printf("Thread 1 running (Counter %lu)\n", PtrToUlong(param)); SleepEx(INFINITE, TRUE); return 0; } @@ -16,7 +16,7 @@ DWORD WINAPI thread_main2(LPVOID param) { - printf("Thread 2 running (Counter %lu)\n", (DWORD)param); + printf("Thread 2 running (Counter %lu)\n", PtrToUlong(param)); Sleep(INFINITE); return 0; } @@ -34,7 +34,7 @@ CreateThread(NULL, 0, thread_main1, - (LPVOID)i, + (LPVOID)(ULONG_PTR)i, 0, &id); Modified: trunk/rostests/tests/button2/buttontst2.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/tests/button2/buttontst2.…
============================================================================== --- trunk/rostests/tests/button2/buttontst2.c [iso-8859-1] (original) +++ trunk/rostests/tests/button2/buttontst2.c [iso-8859-1] Thu Jun 3 22:08:26 2010 @@ -58,109 +58,109 @@ hbtn[0] = CreateWindow( "BUTTON","BS_DEFPUSHBUTTON",WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, - 10, 10, 200, 40, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); + 10, 10, 200, 40, hWnd, NULL, (HINSTANCE) GetWindowLongPtr(hWnd, GWL_HINSTANCE),NULL); hbtn[1] = CreateWindow( "BUTTON","BS_3STATE",WS_VISIBLE | WS_CHILD | BS_3STATE, - 10, 60, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); + 10, 60, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLongPtr(hWnd, GWL_HINSTANCE),NULL); hbtn[2] = CreateWindow( "BUTTON","BS_AUTO3STATE",WS_VISIBLE | WS_CHILD | BS_AUTO3STATE, - 10, 90, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); + 10, 90, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLongPtr(hWnd, GWL_HINSTANCE),NULL); hbtn[3] = CreateWindow( "BUTTON","BS_AUTOCHECKBOX",WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX, - 10, 120, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); + 10, 120, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLongPtr(hWnd, GWL_HINSTANCE),NULL); hbtn[4] = CreateWindow( "BUTTON","BS_AUTORADIOBUTTON",WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON, - 10, 150, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); + 10, 150, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLongPtr(hWnd, GWL_HINSTANCE),NULL); hbtn[5] = CreateWindow( "BUTTON","BS_CHECKBOX",WS_VISIBLE | WS_CHILD | BS_CHECKBOX, - 10, 180, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); + 10, 180, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLongPtr(hWnd, GWL_HINSTANCE),NULL); hbtn[6] = CreateWindow( "BUTTON","BS_GROUPBOX",WS_VISIBLE | WS_CHILD | BS_GROUPBOX, - 10, 210, 200, 80, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); + 10, 210, 200, 80, hWnd, NULL, (HINSTANCE) GetWindowLongPtr(hWnd, GWL_HINSTANCE),NULL); hbtn[7] = CreateWindow( "BUTTON","BS_PUSHBUTTON",WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON, - 20, 230, 180, 30, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); + 20, 230, 180, 30, hWnd, NULL, (HINSTANCE) GetWindowLongPtr(hWnd, GWL_HINSTANCE),NULL); hbtn[8] = CreateWindow( "BUTTON","BS_RADIOBUTTON",WS_VISIBLE | WS_CHILD | BS_RADIOBUTTON, - 10, 300, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); + 10, 300, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLongPtr(hWnd, GWL_HINSTANCE),NULL); hbtn[9] = CreateWindow( "BUTTON","BS_AUTORADIOBUTTON",WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON, - 220, 160, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); + 220, 160, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLongPtr(hWnd, GWL_HINSTANCE),NULL); hbtn[10] = CreateWindow( "BUTTON","BS_DEFPUSHBUTTON|BS_BOTTOM",WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON | BS_BOTTOM, - 220, 10, 250, 40, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); + 220, 10, 250, 40, hWnd, NULL, (HINSTANCE) GetWindowLongPtr(hWnd, GWL_HINSTANCE),NULL); hbtn[11] = CreateWindow( "BUTTON","BS_DEFPUSHBUTTON|BS_LEFT",WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON | BS_LEFT, - 480, 10, 250, 40, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); + 480, 10, 250, 40, hWnd, NULL, (HINSTANCE) GetWindowLongPtr(hWnd, GWL_HINSTANCE),NULL); hbtn[12] = CreateWindow( "BUTTON","BS_DEFPUSHBUTTON|BS_RIGHT|BS_MULTILINE",WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON | BS_RIGHT |BS_MULTILINE, - 740, 10, 150, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); + 740, 10, 150, 60, hWnd, NULL, (HINSTANCE) GetWindowLongPtr(hWnd, GWL_HINSTANCE),NULL); hbtn[13] = CreateWindow( "BUTTON","BS_AUTORADIOBUTTON|BS_TOP",WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON | BS_TOP, - 220, 60, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); + 220, 60, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLongPtr(hWnd, GWL_HINSTANCE),NULL); // Other Combinations hbtn[14] = CreateWindow( "BUTTON","BS_AUTORADIOBUTTON|BS_BOTTOM|BS_MULTILINE",WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON | BS_BOTTOM | BS_MULTILINE, - 480, 60, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); + 480, 60, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLongPtr(hWnd, GWL_HINSTANCE),NULL); hbtn[15] = CreateWindow( "BUTTON","BS_AUTORADIOBUTTON|BS_LEFT",WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON | BS_LEFT, - 740, 80, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); + 740, 80, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLongPtr(hWnd, GWL_HINSTANCE),NULL); hbtn[16] = CreateWindow( "BUTTON","BS_AUTORADIOBUTTON|BS_RIGHT|BS_TOP",WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON | BS_RIGHT | BS_TOP, - 220, 130, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); + 220, 130, 200, 20, hWnd, NULL, (HINSTANCE) GetWindowLongPtr(hWnd, GWL_HINSTANCE),NULL); hbtn[17] = CreateWindow( "BUTTON","BS_AUTORADIOBUTTON|BS_TOP|BS_MULTILINE",WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON | BS_TOP| BS_MULTILINE, - 480, 130, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); + 480, 130, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLongPtr(hWnd, GWL_HINSTANCE),NULL); hbtn[18] = CreateWindow( "BUTTON","BS_AUTOCHECKBOX|BS_BOTTOM|BS_MULTILINE",WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX | BS_BOTTOM | BS_MULTILINE, - 740, 130, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); + 740, 130, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLongPtr(hWnd, GWL_HINSTANCE),NULL); hbtn[19] = CreateWindow( "BUTTON","BS_AUTOCHECKBOX|BS_TOP|BS_MULTILINE",WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE, - 480, 190, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); + 480, 190, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLongPtr(hWnd, GWL_HINSTANCE),NULL); hbtn[20] = CreateWindow( "BUTTON","BS_AUTOCHECKBOX|BS_LEFT|BS_MULTILINE",WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX | BS_LEFT | BS_MULTILINE, - 220, 230, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); + 220, 230, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLongPtr(hWnd, GWL_HINSTANCE),NULL); hbtn[21] = CreateWindow( "BUTTON","BS_AUTOCHECKBOX|BS_RIGHT|BS_MULTILINE",WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX | BS_RIGHT | BS_MULTILINE, - 480, 240, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); + 480, 240, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLongPtr(hWnd, GWL_HINSTANCE),NULL); hbtn[22] = CreateWindow( "BUTTON","BS_GROUPBOX|BS_TOP",WS_VISIBLE | WS_CHILD | BS_GROUPBOX | BS_TOP, - 10, 340, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); + 10, 340, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLongPtr(hWnd, GWL_HINSTANCE),NULL); hbtn[23] = CreateWindow( "BUTTON","BS_GROUPBOX|BS_BOTTOM",WS_VISIBLE | WS_CHILD | BS_GROUPBOX | BS_BOTTOM, - 10, 410, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); + 10, 410, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLongPtr(hWnd, GWL_HINSTANCE),NULL); hbtn[24] = CreateWindow( "BUTTON","BS_GROUPBOXBOX|BS_LEFT",WS_VISIBLE | WS_CHILD | BS_GROUPBOX | BS_LEFT, - 520, 340, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); + 520, 340, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLongPtr(hWnd, GWL_HINSTANCE),NULL); hbtn[25] = CreateWindow( "BUTTON","BS_GROUPBOX|BS_RIGHT|BS_BOTTOM",WS_VISIBLE | WS_CHILD | BS_GROUPBOX | BS_BOTTOM | BS_RIGHT, - 300, 340, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE),NULL); + 300, 340, 200, 60, hWnd, NULL, (HINSTANCE) GetWindowLongPtr(hWnd, GWL_HINSTANCE),NULL); while(GetMessage(&msg, NULL, 0, 0)) { Modified: trunk/rostests/tests/capclock/capclock.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/tests/capclock/capclock.c…
============================================================================== --- trunk/rostests/tests/capclock/capclock.c [iso-8859-1] (original) +++ trunk/rostests/tests/capclock/capclock.c [iso-8859-1] Thu Jun 3 22:08:26 2010 @@ -11,8 +11,8 @@ UINT Timer = 1; -static BOOL CALLBACK DialogFunc(HWND,UINT,WPARAM,LPARAM); -static VOID CALLBACK TimerProc(HWND,UINT,UINT,DWORD); +static INT_PTR CALLBACK DialogFunc(HWND,UINT,WPARAM,LPARAM); +static VOID CALLBACK TimerProc(HWND,UINT,UINT_PTR,DWORD); INT WINAPI WinMain (HINSTANCE hinst, HINSTANCE hinstPrev, LPSTR lpCmdLine, INT nCmdShow) @@ -50,7 +50,7 @@ } return FALSE; } -static VOID CALLBACK TimerProc (HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime) +static VOID CALLBACK TimerProc (HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) { CHAR text [20]; SYSTEMTIME lt; Modified: trunk/rostests/tests/combotst/combotst.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/tests/combotst/combotst.c…
============================================================================== --- trunk/rostests/tests/combotst/combotst.c [iso-8859-1] (original) +++ trunk/rostests/tests/combotst/combotst.c [iso-8859-1] Thu Jun 3 22:08:26 2010 @@ -282,7 +282,7 @@ xSize, /* nWidth */ 20, /* nHeight */ g_hwnd, - (HMENU) id, + UlongToHandle(id), g_hInst, NULL ); @@ -302,7 +302,7 @@ xSize, /* nWidth */ 20, /* nHeight */ g_hwnd, - (HMENU) id, + LongToHandle(id), g_hInst, NULL ); Modified: trunk/rostests/tests/edit/edittest.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/tests/edit/edittest.c?rev…
============================================================================== --- trunk/rostests/tests/edit/edittest.c [iso-8859-1] (original) +++ trunk/rostests/tests/edit/edittest.c [iso-8859-1] Thu Jun 3 22:08:26 2010 @@ -277,7 +277,7 @@ xSize, /* nWidth */ 20, /* nHeight */ g_hwnd, - (HMENU) id, + UlongToHandle(id), g_hInst, NULL ); @@ -297,7 +297,7 @@ xSize, // nWidth 20, // nHeight g_hwnd, - (HMENU) id, + (HMENU)(ULONG_PTR) id, g_hInst, NULL ); Modified: trunk/rostests/tests/global_mem/global_mem.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/tests/global_mem/global_m…
============================================================================== --- trunk/rostests/tests/global_mem/global_mem.c [iso-8859-1] (original) +++ trunk/rostests/tests/global_mem/global_mem.c [iso-8859-1] Thu Jun 3 22:08:26 2010 @@ -143,6 +143,13 @@ { char buffer[32]; sprintf(buffer, "0x%lX",dw); + OUTPUT_Line(buffer); +} + +void OUTPUT_Handle(HANDLE h) +{ + char buffer[32]; + sprintf(buffer, "0x%p", h); OUTPUT_Line(buffer); } @@ -412,9 +419,9 @@ else { OUTPUT_Line("Alloced Handle: "); - OUTPUT_HexDword((DWORD)hMem); + OUTPUT_Handle(hMem); OUTPUT_Line("ReAlloced Handle: "); - OUTPUT_HexDword((DWORD)hReAlloced); + OUTPUT_Handle(hReAlloced); if (hMem == hReAlloced) { OUTPUT_Line("GlobalReAlloc returned the same pointer. The documentation states that this is wrong, but Windows NT works this way."); @@ -455,9 +462,9 @@ else { OUTPUT_Line("Alloced Handle: "); - OUTPUT_HexDword((DWORD)hMem); + OUTPUT_Handle(hMem); OUTPUT_Line("ReAlloced Handle: "); - OUTPUT_HexDword((DWORD)hReAlloced); + OUTPUT_Handle(hReAlloced); if (hMem != hReAlloced) { OUTPUT_Line("GlobalReAlloc returned a different."); @@ -516,9 +523,9 @@ else { OUTPUT_Line("Alloced Handle: "); - OUTPUT_HexDword((DWORD)hMem); + OUTPUT_Handle(hMem); OUTPUT_Line("ReAlloced Handle: "); - OUTPUT_HexDword((DWORD)hReAlloced); + OUTPUT_Handle(hReAlloced); pMem = GlobalLock(hReAlloced); hMem = hReAlloced; @@ -559,9 +566,9 @@ else { OUTPUT_Line("Alloced Handle: "); - OUTPUT_HexDword((DWORD)hMem); + OUTPUT_Handle(hMem); OUTPUT_Line("ReAlloced Handle: "); - OUTPUT_HexDword((DWORD)hReAlloced); + OUTPUT_Handle(hReAlloced); if (hMem != hReAlloced) { OUTPUT_Line("GlobalReAlloc returned a different block."); @@ -638,7 +645,7 @@ OUTPUT_Result(result); OUTPUT_Line("Pointer from handle: "); - OUTPUT_HexDword((DWORD)GlobalLock(hMem)); + OUTPUT_Handle(GlobalLock(hMem)); OUTPUT_Line("Testing after a lock"); OUTPUT_Line("Testing for a lock of 1"); @@ -679,7 +686,7 @@ if (0 != hMem) { OUTPUT_Line("Allocation handle: "); - OUTPUT_HexDword((DWORD)hMem); + OUTPUT_Handle(hMem); OUTPUT_Line("Testing for a discarded flag"); uFlags = GlobalFlags(hMem); if (0 != (uFlags & GMEM_DISCARDED)) /*discarded*/ @@ -720,7 +727,7 @@ { OUTPUT_Line("Allocation handle: "); - OUTPUT_HexDword((DWORD)hMem); + OUTPUT_Handle(hMem); OUTPUT_Line("Testing initial allocation"); OUTPUT_Line("Testing for non-discarded and lock of 0"); @@ -737,7 +744,7 @@ OUTPUT_Result(result); OUTPUT_Line("Pointer from handle: "); - OUTPUT_HexDword((DWORD)GlobalLock(hMem)); + OUTPUT_Handle(GlobalLock(hMem)); OUTPUT_Line("Testing after a lock"); OUTPUT_Line("Testing for non-discarded and lock of 0"); uFlags = GlobalFlags(hMem); @@ -796,7 +803,7 @@ { OUTPUT_Line("Allocation handle: "); - OUTPUT_HexDword((DWORD)hMem); + OUTPUT_Handle(hMem); hTest = GlobalHandle(hMem); if (hMem == hTest) @@ -806,7 +813,7 @@ else { OUTPUT_Line("GlobalHandle returned:"); - OUTPUT_HexDword((DWORD)hTest); + OUTPUT_Handle(hTest); subtest = TEST_CombineStatus(subtest, FAILED); } @@ -830,7 +837,7 @@ { OUTPUT_Line("Allocation handle: "); - OUTPUT_HexDword((DWORD)hMem); + OUTPUT_Handle(hMem); pMem = GlobalLock(hMem); hTest = GlobalHandle(pMem); if (hMem == hTest) @@ -840,7 +847,7 @@ else { OUTPUT_Line("GlobalHandle returned:"); - OUTPUT_HexDword((DWORD)hTest); + OUTPUT_Handle(hTest); subtest = TEST_CombineStatus(subtest, FAILED); } @@ -979,7 +986,7 @@ if (0 != hMem) { OUTPUT_Line("Allocation handle: "); - OUTPUT_HexDword((DWORD)hMem); + OUTPUT_Handle(hMem); hTest = GlobalDiscard(hMem); if (0 == hTest) Modified: trunk/rostests/tests/isotest/isotest.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/tests/isotest/isotest.c?r…
============================================================================== --- trunk/rostests/tests/isotest/isotest.c [iso-8859-1] (original) +++ trunk/rostests/tests/isotest/isotest.c [iso-8859-1] Thu Jun 3 22:08:26 2010 @@ -21,7 +21,7 @@ while (offset < (size & ~15)) { - ptr = (unsigned char*)((ULONG)buffer + offset); + ptr = (unsigned char*)((ULONG_PTR)buffer + offset); printf("%08lx %02hx %02hx %02hx %02hx %02hx %02hx %02hx %02hx-%02hx %02hx %02hx %02hx %02hx %02hx %02hx %02hx", offset, ptr[0], @@ -62,7 +62,7 @@ offset += 16; } - ptr = (unsigned char*)((ULONG)buffer + offset); + ptr = (unsigned char*)((ULONG_PTR)buffer + offset); if (offset < size) { printf("%08lx ", offset); Modified: trunk/rostests/tests/map_dup_inherit/map_dup_inherit.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/tests/map_dup_inherit/map…
============================================================================== --- trunk/rostests/tests/map_dup_inherit/map_dup_inherit.c [iso-8859-1] (original) +++ trunk/rostests/tests/map_dup_inherit/map_dup_inherit.c [iso-8859-1] Thu Jun 3 22:08:26 2010 @@ -17,7 +17,7 @@ if( argc == 2 ) { #ifdef WIN64 - file_map = (void *)atoi64(argv[1]); + file_map = (void *)_atoi64(argv[1]); #else file_map = (void *)UlongToPtr(atoi(argv[1])); #endif Modified: trunk/rostests/tests/mdi/mdi.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/tests/mdi/mdi.c?rev=47551…
============================================================================== --- trunk/rostests/tests/mdi/mdi.c [iso-8859-1] (original) +++ trunk/rostests/tests/mdi/mdi.c [iso-8859-1] Thu Jun 3 22:08:26 2010 @@ -160,7 +160,7 @@ mcs.y = mcs.cy = CW_USEDEFAULT; mcs.style = MDIS_ALLCHILDSTYLES; - hChild = (HWND)SendMessage(hMDIClient, WM_MDICREATE, 0, (LONG)&mcs); + hChild = (HWND)SendMessage(hMDIClient, WM_MDICREATE, 0, (LPARAM)&mcs); if(!hChild) { MessageBox(hMDIClient, "MDI Child creation failed.", "Oh Oh...", Modified: trunk/rostests/tests/miditest/miditest.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/tests/miditest/miditest.c…
============================================================================== --- trunk/rostests/tests/miditest/miditest.c [iso-8859-1] (original) +++ trunk/rostests/tests/miditest/miditest.c [iso-8859-1] Thu Jun 3 22:08:26 2010 @@ -36,7 +36,7 @@ printf("Opening MIDI output #0\n"); Result = midiOutOpen(&Handle, 0, 0, 0, CALLBACK_NULL); - printf("Result == %d Handle == %d\n", Result, (int)Handle); + printf("Result == %d Handle == %p\n", Result, Handle); // play something: midiOutShortMsg(Handle, 0x007f3090); Modified: trunk/rostests/tests/multithrdwin/multithrdwin.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/tests/multithrdwin/multit…
============================================================================== --- trunk/rostests/tests/multithrdwin/multithrdwin.c [iso-8859-1] (original) +++ trunk/rostests/tests/multithrdwin/multithrdwin.c [iso-8859-1] Thu Jun 3 22:08:26 2010 @@ -157,7 +157,7 @@ HDC hDC; RECT Client; HBRUSH Brush; - DWORD Ret; + DWORD_PTR Ret; static COLORREF Colors[] = { Modified: trunk/rostests/tests/p_dup_handle/p_dup_handle.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/tests/p_dup_handle/p_dup_…
============================================================================== --- trunk/rostests/tests/p_dup_handle/p_dup_handle.c [iso-8859-1] (original) +++ trunk/rostests/tests/p_dup_handle/p_dup_handle.c [iso-8859-1] Thu Jun 3 22:08:26 2010 @@ -15,7 +15,7 @@ fprintf( stderr, "%lu: Starting\n", GetCurrentProcessId() ); if( argc == 2 ) { - h_process = (HANDLE)atoi(argv[1]); + h_process = (HANDLE)(ULONG_PTR)atoi(argv[1]); } else { if( !DuplicateHandle( GetCurrentProcess(), GetCurrentProcess(), @@ -38,7 +38,7 @@ memset( &si, 0, sizeof( si ) ); memset( &pi, 0, sizeof( pi ) ); - sprintf( cmdline, "%s %lu", argv[0], (DWORD)h_process ); + sprintf( cmdline, "%s %p", argv[0], h_process ); if( !CreateProcess(NULL, cmdline, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi ) ) { fprintf( stderr, "%lu: Could not create child process.\n", Modified: trunk/rostests/win32/user32/kbdlayout/kbdlayout.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/win32/user32/kbdlayout/kb…
============================================================================== --- trunk/rostests/win32/user32/kbdlayout/kbdlayout.c [iso-8859-1] (original) +++ trunk/rostests/win32/user32/kbdlayout/kbdlayout.c [iso-8859-1] Thu Jun 3 22:08:26 2010 @@ -122,7 +122,7 @@ LRESULT CALLBACK WndSubclassProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - WND_DATA *data = (WND_DATA*)GetWindowLong(hwnd, GWL_USERDATA); + WND_DATA *data = (WND_DATA*)GetWindowLongPtr(hwnd, GWL_USERDATA); if(uMsg == WM_INPUTLANGCHANGE) { @@ -143,9 +143,9 @@ void SubclassWnd(HWND hWnd, WCHAR* Name) { WND_DATA *data = HeapAlloc(GetProcessHeap(), 0, sizeof(WND_DATA)); - data->OrigProc = (WNDPROC)SetWindowLong( hWnd, GWL_WNDPROC, (LONG)WndSubclassProc); + data->OrigProc = (WNDPROC)SetWindowLongPtr( hWnd, GWL_WNDPROC, (LONG_PTR)WndSubclassProc); wcsncpy(data->WndName, Name, 25); - SetWindowLong(hWnd, GWL_USERDATA, (LONG)data); + SetWindowLongPtr(hWnd, GWL_USERDATA, (LONG_PTR)data); return; }
14 years, 6 months
1
0
0
0
[tkreuzer] 47550: [W32KNAPI] Add few more tests for NtGdiCreateBitmap
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Jun 3 21:39:28 2010 New Revision: 47550 URL:
http://svn.reactos.org/svn/reactos?rev=47550&view=rev
Log: [W32KNAPI] Add few more tests for NtGdiCreateBitmap Modified: trunk/rostests/apitests/w32knapi/ntgdi/NtGdiCreateBitmap.c Modified: trunk/rostests/apitests/w32knapi/ntgdi/NtGdiCreateBitmap.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/w32knapi/ntgdi/N…
============================================================================== --- trunk/rostests/apitests/w32knapi/ntgdi/NtGdiCreateBitmap.c [iso-8859-1] (original) +++ trunk/rostests/apitests/w32knapi/ntgdi/NtGdiCreateBitmap.c [iso-8859-1] Thu Jun 3 21:39:28 2010 @@ -36,15 +36,30 @@ TEST(NtGdiCreateBitmap(1, -2, 1, 1, NULL) == NULL); TEST(GetLastError() == ERROR_INVALID_PARAMETER); - /* Test negative cy */ + /* Test negative cy and valid bits */ SetLastError(ERROR_SUCCESS); TEST(NtGdiCreateBitmap(1, -2, 1, 1, BitmapData) == NULL); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test negative cy and invalid bits */ + SetLastError(ERROR_SUCCESS); + TEST(NtGdiCreateBitmap(1, -2, 1, 1, (BYTE*)0x80001234) == NULL); TEST(GetLastError() == ERROR_SUCCESS); /* Test huge size */ SetLastError(ERROR_SUCCESS); TEST(NtGdiCreateBitmap(100000, 100000, 1, 1, NULL) == NULL); TEST(GetLastError() == ERROR_NOT_ENOUGH_MEMORY); + + /* Test huge size and valid bits */ + SetLastError(ERROR_SUCCESS); + TEST(NtGdiCreateBitmap(1000, 1000, 1, 1, BitmapData) == NULL); + TEST(GetLastError() == ERROR_SUCCESS); + + /* Test huge size and invalid bits */ + SetLastError(ERROR_SUCCESS); + TEST(NtGdiCreateBitmap(100000, 100000, 1, 1, (BYTE*)0x80001234) == NULL); + TEST(GetLastError() == ERROR_SUCCESS); /* Test cPlanes == 0 */ SetLastError(ERROR_SUCCESS);
14 years, 6 months
1
0
0
0
[tkreuzer] 47549: [GDI32API] add IsHandleValid and use it SelectObject test
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Jun 3 21:35:05 2010 New Revision: 47549 URL:
http://svn.reactos.org/svn/reactos?rev=47549&view=rev
Log: [GDI32API] add IsHandleValid and use it SelectObject test Modified: trunk/rostests/apitests/gdi32api/gdi32api.c trunk/rostests/apitests/gdi32api/gdi32api.h trunk/rostests/apitests/gdi32api/tests/SelectObject.c Modified: trunk/rostests/apitests/gdi32api/gdi32api.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/gdi32ap…
============================================================================== --- trunk/rostests/apitests/gdi32api/gdi32api.c [iso-8859-1] (original) +++ trunk/rostests/apitests/gdi32api/gdi32api.c [iso-8859-1] Thu Jun 3 21:35:05 2010 @@ -18,6 +18,22 @@ return pPeb->GdiSharedHandleTable; } +BOOL +IsHandleValid(HGDIOBJ hobj) +{ + USHORT Index = (ULONG_PTR)hobj; + PGDI_TABLE_ENTRY pentry = &GdiHandleTable[Index]; + + if (pentry->KernelData == NULL || + pentry->KernelData < (PVOID)0x80000000 || + (USHORT)pentry->FullUnique != (USHORT)((ULONG_PTR)hobj >> 16)) + { + return FALSE; + } + + return TRUE; +} + int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, Modified: trunk/rostests/apitests/gdi32api/gdi32api.h URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/gdi32ap…
============================================================================== --- trunk/rostests/apitests/gdi32api/gdi32api.h [iso-8859-1] (original) +++ trunk/rostests/apitests/gdi32api/gdi32api.h [iso-8859-1] Thu Jun 3 21:35:05 2010 @@ -20,6 +20,7 @@ extern HINSTANCE g_hInstance; extern PGDI_TABLE_ENTRY GdiHandleTable; +BOOL IsHandleValid(HGDIOBJ hobj); #endif /* _GDITEST_H */ Modified: trunk/rostests/apitests/gdi32api/tests/SelectObject.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/tests/S…
============================================================================== --- trunk/rostests/apitests/gdi32api/tests/SelectObject.c [iso-8859-1] (original) +++ trunk/rostests/apitests/gdi32api/tests/SelectObject.c [iso-8859-1] Thu Jun 3 21:35:05 2010 @@ -82,6 +82,8 @@ DeleteObject(hOldObj); RTEST((UINT_PTR)SelectObject(hDC, hNewObj) == SIMPLEREGION); // ??? Why this? DeleteObject(hNewObj); + TEST(IsHandleValid(hNewObj) == TRUE); + RTEST(GetLastError() == ERROR_SUCCESS); /* Test BITMAP */
14 years, 6 months
1
0
0
0
[gschneider] 47548: [DESK] - Rearrange screensaver wait codes around the MsgWaitForMultipleObjects function - Fixes screensaver configuration windows blocking the control panel - Refs: http://blogs.msdn.com/b/oldnewthing/archive/2005/02/17/375307.aspx and http://codereflect.com/2008/09/19/when-and-how-should-we-use-msgwaitformultipleobjects/ See issue #4213 for more details.
by gschneider@svn.reactos.org
Author: gschneider Date: Thu Jun 3 20:47:37 2010 New Revision: 47548 URL:
http://svn.reactos.org/svn/reactos?rev=47548&view=rev
Log: [DESK] - Rearrange screensaver wait codes around the MsgWaitForMultipleObjects function - Fixes screensaver configuration windows blocking the control panel - Refs:
http://blogs.msdn.com/b/oldnewthing/archive/2005/02/17/375307.aspx
and
http://codereflect.com/2008/09/19/when-and-how-should-we-use-msgwaitformult…
See issue #4213 for more details. Modified: trunk/reactos/dll/cpl/desk/screensaver.c Modified: trunk/reactos/dll/cpl/desk/screensaver.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/screensaver.c…
============================================================================== --- trunk/reactos/dll/cpl/desk/screensaver.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/desk/screensaver.c [iso-8859-1] Thu Jun 3 20:47:37 2010 @@ -147,33 +147,32 @@ WaitForSettingsDialog(HWND hwndDlg, HANDLE hProcess) { + DWORD dwResult; + MSG msg; + while (TRUE) { - DWORD Ret; - MSG msg; - - while (PeekMessage(&msg, - NULL, - 0, - 0, - PM_REMOVE)) - { - if (msg.message == WM_QUIT) - return FALSE; - - if (IsDialogMessage(hwndDlg, &msg)) + dwResult = MsgWaitForMultipleObjects(1, + &hProcess, + FALSE, + INFINITE, + QS_ALLINPUT); + if (dwResult == WAIT_OBJECT_0 + 1) + { + if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { - TranslateMessage(&msg); - DispatchMessage(&msg); + if (msg.message == WM_QUIT) + { + return FALSE; + } + if (IsDialogMessage(hwndDlg, &msg)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } } } - - Ret = MsgWaitForMultipleObjects(1, - &hProcess, - FALSE, - INFINITE, - QS_ALLINPUT); - if (Ret == (WAIT_OBJECT_0)) + else { return TRUE; }
14 years, 6 months
1
0
0
0
[tkreuzer] 47547: [COMCTRL32] Sync listview.c with wine 1.2 rc2
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Jun 3 19:56:15 2010 New Revision: 47547 URL:
http://svn.reactos.org/svn/reactos?rev=47547&view=rev
Log: [COMCTRL32] Sync listview.c with wine 1.2 rc2 Modified: trunk/reactos/dll/win32/comctl32/listview.c Modified: trunk/reactos/dll/win32/comctl32/listview.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/listvie…
============================================================================== --- trunk/reactos/dll/win32/comctl32/listview.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/listview.c [iso-8859-1] Thu Jun 3 19:56:15 2010 @@ -7,6 +7,7 @@ * Copyright 2001 CodeWeavers Inc. * Copyright 2002 Dimitrie O. Paun * Copyright 2009 Nikolay Sivov + * Copyright 2009 Owen Rudge for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -73,7 +74,6 @@ * * States * -- LVIS_ACTIVATING (not currently supported by comctl32.dll version 6.0) - * -- LVIS_CUT * -- LVIS_DROPHILITED * -- LVIS_OVERLAYMASK * @@ -98,9 +98,7 @@ * -- LVN_BEGINSCROLL, LVN_ENDSCROLL * -- LVN_GETINFOTIP * -- LVN_HOTTRACK - * -- LVN_MARQUEEBEGIN * -- LVN_SETDISPINFO - * -- NM_HOVER * -- LVN_BEGINRDRAG * * Messages: @@ -170,9 +168,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(listview); -/* make sure you set this to 0 for production use! */ -#define DEBUG_RANGES 1 - typedef struct tagCOLUMN_INFO { RECT rcHeader; /* tracks the header's rectangle */ @@ -237,81 +232,120 @@ typedef struct tagLISTVIEW_INFO { + /* control window */ HWND hwndSelf; - HBRUSH hBkBrush; - COLORREF clrBk; - COLORREF clrText; - COLORREF clrTextBk; - HIMAGELIST himlNormal; - HIMAGELIST himlSmall; - HIMAGELIST himlState; - BOOL bLButtonDown; - BOOL bRButtonDown; - BOOL bDragging; - POINT ptClickPos; /* point where the user clicked */ - BOOL bNoItemMetrics; /* flags if item metrics are not yet computed */ - INT nItemHeight; - INT nItemWidth; - RANGES selectionRanges; - INT nSelectionMark; - INT nHotItem; - SHORT notifyFormat; - HWND hwndNotify; RECT rcList; /* This rectangle is really the window * client rectangle possibly reduced by the * horizontal scroll bar and/or header - see * LISTVIEW_UpdateSize. This rectangle offset * by the LISTVIEW_GetOrigin value is in * client coordinates */ - SIZE iconSize; - SIZE iconSpacing; - SIZE iconStateSize; + + /* notification window */ + SHORT notifyFormat; + HWND hwndNotify; + BOOL bDoChangeNotify; /* send change notification messages? */ UINT uCallbackMask; - HWND hwndHeader; - HCURSOR hHotCursor; - HFONT hDefaultFont; - HFONT hFont; - INT ntmHeight; /* Some cached metrics of the font used */ - INT ntmMaxCharWidth; /* by the listview to draw items */ - INT nEllipsisWidth; - BOOL bRedraw; /* Turns on/off repaints & invalidations */ - BOOL bAutoarrange; /* Autoarrange flag when NOT in LVS_AUTOARRANGE */ - BOOL bFocus; - BOOL bDoChangeNotify; /* send change notification messages? */ - INT nFocusedItem; - RECT rcFocus; - DWORD dwStyle; /* the cached window GWL_STYLE */ - DWORD dwLvExStyle; /* extended listview style */ - DWORD uView; /* current view available through LVM_[G,S]ETVIEW */ + + /* tooltips */ + HWND hwndToolTip; + + /* items */ INT nItemCount; /* the number of items in the list */ HDPA hdpaItems; /* array ITEM_INFO pointers */ HDPA hdpaItemIds; /* array of ITEM_ID pointers */ HDPA hdpaPosX; /* maintains the (X, Y) coordinates of the */ HDPA hdpaPosY; /* items in LVS_ICON, and LVS_SMALLICON modes */ + RANGES selectionRanges; + INT nSelectionMark; /* item to start next multiselection from */ + INT nHotItem; + BOOL bAutoarrange; /* Autoarrange flag when NOT in LVS_AUTOARRANGE */ + + /* columns */ HDPA hdpaColumns; /* array of COLUMN_INFO pointers */ BOOL colRectsDirty; /* trigger column rectangles requery from header */ - POINT currIconPos; /* this is the position next icon will be placed */ - PFNLVCOMPARE pfnCompare; + + /* item metrics */ + BOOL bNoItemMetrics; /* flags if item metrics are not yet computed */ + INT nItemHeight; + INT nItemWidth; + + /* sorting */ + PFNLVCOMPARE pfnCompare; /* sorting callback pointer */ LPARAM lParamSort; + + /* style */ + DWORD dwStyle; /* the cached window GWL_STYLE */ + DWORD dwLvExStyle; /* extended listview style */ + DWORD uView; /* current view available through LVM_[G,S]ETVIEW */ + + /* edit item */ HWND hwndEdit; WNDPROC EditWndProc; INT nEditLabelItem; - INT nLButtonDownItem; /* tracks item to reset multiselection on WM_LBUTTONUP */ + DELAYED_ITEM_EDIT itemEdit; /* Pointer to this structure will be the timer ID */ + + /* icons */ + HIMAGELIST himlNormal; + HIMAGELIST himlSmall; + HIMAGELIST himlState; + SIZE iconSize; + SIZE iconSpacing; + SIZE iconStateSize; + POINT currIconPos; /* this is the position next icon will be placed */ + + /* header */ + HWND hwndHeader; + INT xTrackLine; /* The x coefficient of the track line or -1 if none */ + + /* marquee selection */ + BOOL bMarqueeSelect; /* marquee selection/highlight underway */ + BOOL bScrolling; + RECT marqueeRect; /* absolute coordinates of marquee selection */ + RECT marqueeDrawRect; /* relative coordinates for drawing marquee */ + POINT marqueeOrigin; /* absolute coordinates of marquee click origin */ + + /* focus drawing */ + BOOL bFocus; /* control has focus */ + INT nFocusedItem; + RECT rcFocus; /* focus bounds */ + + /* colors */ + HBRUSH hBkBrush; + COLORREF clrBk; + COLORREF clrText; + COLORREF clrTextBk; + + /* font */ + HFONT hDefaultFont; + HFONT hFont; + INT ntmHeight; /* Some cached metrics of the font used */ + INT ntmMaxCharWidth; /* by the listview to draw items */ + INT nEllipsisWidth; + + /* mouse operation */ + BOOL bLButtonDown; + BOOL bRButtonDown; + BOOL bDragging; + POINT ptClickPos; /* point where the user clicked */ + INT nLButtonDownItem; /* tracks item to reset multiselection on WM_LBUTTONUP */ DWORD dwHoverTime; - HWND hwndToolTip; - - DWORD cditemmode; /* Keep the custom draw flags for an item/row */ - + HCURSOR hHotCursor; + + /* keyboard operation */ DWORD lastKeyPressTimestamp; WPARAM charCode; INT nSearchParamLength; WCHAR szSearchParam[ MAX_PATH ]; - BOOL bIsDrawing; - INT nMeasureItemHeight; - INT xTrackLine; /* The x coefficient of the track line or -1 if none */ - DELAYED_ITEM_EDIT itemEdit; /* Pointer to this structure will be the timer ID */ - - DWORD iVersion; /* CCM_[G,S]ETVERSION */ + + /* painting */ + DWORD cditemmode; /* Keep the custom draw flags for an item/row */ + BOOL bIsDrawing; /* Drawing in progress */ + INT nMeasureItemHeight; /* WM_MEASUREITEM result */ + BOOL bRedraw; /* WM_SETREDRAW switch */ + + /* misc */ + DWORD iVersion; /* CCM_[G,S]ETVERSION */ } LISTVIEW_INFO; /* @@ -414,7 +448,6 @@ static void LISTVIEW_GetItemOrigin(const LISTVIEW_INFO *, INT, LPPOINT); static BOOL LISTVIEW_GetItemPosition(const LISTVIEW_INFO *, INT, LPPOINT); static BOOL LISTVIEW_GetItemRect(const LISTVIEW_INFO *, INT, LPRECT); -static INT LISTVIEW_GetLabelWidth(const LISTVIEW_INFO *, INT); static void LISTVIEW_GetOrigin(const LISTVIEW_INFO *, LPPOINT); static BOOL LISTVIEW_GetViewRect(const LISTVIEW_INFO *, LPRECT); static void LISTVIEW_UpdateSize(LISTVIEW_INFO *); @@ -426,10 +459,10 @@ static LRESULT LISTVIEW_VScroll(LISTVIEW_INFO *, INT, INT, HWND); static LRESULT LISTVIEW_HScroll(LISTVIEW_INFO *, INT, INT, HWND); static BOOL LISTVIEW_EnsureVisible(LISTVIEW_INFO *, INT, BOOL); -static HWND CreateEditLabelT(LISTVIEW_INFO *, LPCWSTR, DWORD, BOOL); static HIMAGELIST LISTVIEW_SetImageList(LISTVIEW_INFO *, INT, HIMAGELIST); static INT LISTVIEW_HitTest(const LISTVIEW_INFO *, LPLVHITTESTINFO, BOOL, BOOL); static BOOL LISTVIEW_EndEditLabelT(LISTVIEW_INFO *, BOOL, BOOL); +static BOOL LISTVIEW_Scroll(LISTVIEW_INFO *, INT, INT); /******** Text handling functions *************************************/ @@ -716,25 +749,37 @@ { switch (unicodeNotificationCode) { + case LVN_BEGINLABELEDITA: case LVN_BEGINLABELEDITW: return LVN_BEGINLABELEDITA; + case LVN_ENDLABELEDITA: case LVN_ENDLABELEDITW: return LVN_ENDLABELEDITA; + case LVN_GETDISPINFOA: case LVN_GETDISPINFOW: return LVN_GETDISPINFOA; + case LVN_SETDISPINFOA: case LVN_SETDISPINFOW: return LVN_SETDISPINFOA; + case LVN_ODFINDITEMA: case LVN_ODFINDITEMW: return LVN_ODFINDITEMA; + case LVN_GETINFOTIPA: case LVN_GETINFOTIPW: return LVN_GETINFOTIPA; /* header forwards */ + case HDN_TRACKA: case HDN_TRACKW: return HDN_TRACKA; + case HDN_ENDTRACKA: case HDN_ENDTRACKW: return HDN_ENDTRACKA; case HDN_BEGINDRAG: return HDN_BEGINDRAG; case HDN_ENDDRAG: return HDN_ENDDRAG; + case HDN_ITEMCHANGINGA: case HDN_ITEMCHANGINGW: return HDN_ITEMCHANGINGA; + case HDN_ITEMCHANGEDA: case HDN_ITEMCHANGEDW: return HDN_ITEMCHANGEDA; + case HDN_ITEMCLICKA: case HDN_ITEMCLICKW: return HDN_ITEMCLICKA; + case HDN_DIVIDERDBLCLICKA: case HDN_DIVIDERDBLCLICKW: return HDN_DIVIDERDBLCLICKA; - } - ERR("unknown notification %x\n", unicodeNotificationCode); - assert(FALSE); - return 0; + default: break; + } + FIXME("unknown notification %x\n", unicodeNotificationCode); + return unicodeNotificationCode; } /* forwards header notifications to listview parent */ @@ -748,12 +793,12 @@ /* on unicode format exit earlier */ if (infoPtr->notifyFormat == NFR_UNICODE) - return SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, - (WPARAM)lpnmh->hdr.idFrom, (LPARAM)lpnmh); + return SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, lpnmh->hdr.idFrom, + (LPARAM)lpnmh); /* header always supplies unicode notifications, all we have to do is to convert strings to ANSI */ - nmhA = *(NMHEADERA*)lpnmh; + nmhA = *(const NMHEADERA*)lpnmh; if (lpnmh->pitem) { hditema = *(HDITEMA*)lpnmh->pitem; @@ -778,8 +823,8 @@ } nmhA.hdr.code = get_ansi_notification(lpnmh->hdr.code); - ret = SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, - (WPARAM)nmhA.hdr.idFrom, (LPARAM)&nmhA); + ret = SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, nmhA.hdr.idFrom, + (LPARAM)&nmhA); /* cleanup */ Free(text); @@ -1266,20 +1311,17 @@ } /*** - * Creates an iterator over the items which intersect lprc. - */ -static BOOL iterator_frameditems(ITERATOR* i, const LISTVIEW_INFO* infoPtr, const RECT *lprc) -{ - RECT frame = *lprc, rcItem, rcTemp; - POINT Origin; + * Creates an iterator over the items which intersect frame. + * Uses absolute coordinates rather than compensating for the current offset. + */ +static BOOL iterator_frameditems_absolute(ITERATOR* i, const LISTVIEW_INFO* infoPtr, const RECT *frame) +{ + RECT rcItem, rcTemp; /* in case we fail, we want to return an empty iterator */ if (!iterator_empty(i)) return FALSE; - LISTVIEW_GetOrigin(infoPtr, &Origin); - - TRACE("(lprc=%s)\n", wine_dbgstr_rect(lprc)); - OffsetRect(&frame, -Origin.x, -Origin.y); + TRACE("(frame=%s)\n", wine_dbgstr_rect(frame)); if (infoPtr->uView == LV_VIEW_ICON || infoPtr->uView == LV_VIEW_SMALLICON) { @@ -1288,7 +1330,7 @@ if (infoPtr->uView == LV_VIEW_ICON && infoPtr->nFocusedItem != -1) { LISTVIEW_GetItemBox(infoPtr, infoPtr->nFocusedItem, &rcItem); - if (IntersectRect(&rcTemp, &rcItem, lprc)) + if (IntersectRect(&rcTemp, &rcItem, frame)) i->nSpecial = infoPtr->nFocusedItem; } if (!(iterator_rangesitems(i, ranges_create(50)))) return FALSE; @@ -1300,7 +1342,7 @@ rcItem.top = (LONG_PTR)DPA_GetPtr(infoPtr->hdpaPosY, nItem); rcItem.right = rcItem.left + infoPtr->nItemWidth; rcItem.bottom = rcItem.top + infoPtr->nItemHeight; - if (IntersectRect(&rcTemp, &rcItem, &frame)) + if (IntersectRect(&rcTemp, &rcItem, frame)) ranges_additem(i->ranges, nItem); } return TRUE; @@ -1309,11 +1351,11 @@ { RANGE range; - if (frame.left >= infoPtr->nItemWidth) return TRUE; - if (frame.top >= infoPtr->nItemHeight * infoPtr->nItemCount) return TRUE; + if (frame->left >= infoPtr->nItemWidth) return TRUE; + if (frame->top >= infoPtr->nItemHeight * infoPtr->nItemCount) return TRUE; - range.lower = max(frame.top / infoPtr->nItemHeight, 0); - range.upper = min((frame.bottom - 1) / infoPtr->nItemHeight, infoPtr->nItemCount - 1) + 1; + range.lower = max(frame->top / infoPtr->nItemHeight, 0); + range.upper = min((frame->bottom - 1) / infoPtr->nItemHeight, infoPtr->nItemCount - 1) + 1; if (range.upper <= range.lower) return TRUE; if (!iterator_rangeitems(i, range)) return FALSE; TRACE(" report=%s\n", debugrange(&i->range)); @@ -1321,8 +1363,8 @@ else { INT nPerCol = max((infoPtr->rcList.bottom - infoPtr->rcList.top) / infoPtr->nItemHeight, 1); - INT nFirstRow = max(frame.top / infoPtr->nItemHeight, 0); - INT nLastRow = min((frame.bottom - 1) / infoPtr->nItemHeight, nPerCol - 1); + INT nFirstRow = max(frame->top / infoPtr->nItemHeight, 0); + INT nLastRow = min((frame->bottom - 1) / infoPtr->nItemHeight, nPerCol - 1); INT nFirstCol; INT nLastCol; INT lower; @@ -1331,13 +1373,13 @@ if (infoPtr->nItemWidth) { - nFirstCol = max(frame.left / infoPtr->nItemWidth, 0); - nLastCol = min((frame.right - 1) / infoPtr->nItemWidth, (infoPtr->nItemCount + nPerCol - 1) / nPerCol); + nFirstCol = max(frame->left / infoPtr->nItemWidth, 0); + nLastCol = min((frame->right - 1) / infoPtr->nItemWidth, (infoPtr->nItemCount + nPerCol - 1) / nPerCol); } else { - nFirstCol = max(frame.left, 0); - nLastCol = min(frame.right - 1, (infoPtr->nItemCount + nPerCol - 1) / nPerCol); + nFirstCol = max(frame->left, 0); + nLastCol = min(frame->right - 1, (infoPtr->nItemCount + nPerCol - 1) / nPerCol); } lower = nFirstCol * nPerCol + nFirstRow; @@ -1360,6 +1402,22 @@ } return TRUE; +} + +/*** + * Creates an iterator over the items which intersect lprc. + */ +static BOOL iterator_frameditems(ITERATOR* i, const LISTVIEW_INFO* infoPtr, const RECT *lprc) +{ + RECT frame = *lprc; + POINT Origin; + + TRACE("(lprc=%s)\n", wine_dbgstr_rect(lprc)); + + LISTVIEW_GetOrigin(infoPtr, &Origin); + OffsetRect(&frame, -Origin.x, -Origin.y); + + return iterator_frameditems_absolute(i, infoPtr, &frame); } /*** @@ -1525,7 +1583,7 @@ SendMessageW(infoPtr->hwndHeader, HDM_SETUNICODEFORMAT, TRUE, 0); /* set header font */ - SendMessageW(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)infoPtr->hFont, (LPARAM)TRUE); + SendMessageW(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)infoPtr->hFont, TRUE); LISTVIEW_UpdateSize(infoPtr); @@ -1535,6 +1593,13 @@ static inline void LISTVIEW_GetHeaderRect(const LISTVIEW_INFO *infoPtr, INT nSubItem, LPRECT lprc) { *lprc = LISTVIEW_GetColumnInfo(infoPtr, nSubItem)->rcHeader; +} + +static inline BOOL LISTVIEW_IsHeaderEnabled(const LISTVIEW_INFO *infoPtr) +{ + return (infoPtr->uView == LV_VIEW_DETAILS || + infoPtr->dwLvExStyle & LVS_EX_HEADERINALLVIEWS) && + !(infoPtr->dwStyle & LVS_NOCOLUMNHEADER); } static inline BOOL LISTVIEW_GetItemW(const LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem) @@ -1683,14 +1748,15 @@ */ static INT LISTVIEW_ProcessLetterKeys(LISTVIEW_INFO *infoPtr, WPARAM charCode, LPARAM keyData) { + WCHAR buffer[MAX_PATH]; + INT endidx, startidx; + DWORD prevTime; + LVITEMW item; INT nItem; - INT endidx,idx; - LVITEMW item; - WCHAR buffer[MAX_PATH]; - DWORD lastKeyPressTimestamp = infoPtr->lastKeyPressTimestamp; + INT diff; /* simple parameter checking */ - if (!charCode || !keyData) return 0; + if (!charCode || !keyData || infoPtr->nItemCount == 0) return 0; /* only allow the valid WM_CHARs through */ if (!isalnumW(charCode) && @@ -1705,86 +1771,95 @@ charCode != '<' && charCode != ',' && charCode != '~') return 0; - /* if there's one item or less, there is no where to go */ - if (infoPtr->nItemCount <= 1) return 0; - /* update the search parameters */ + prevTime = infoPtr->lastKeyPressTimestamp; infoPtr->lastKeyPressTimestamp = GetTickCount(); - if (infoPtr->lastKeyPressTimestamp - lastKeyPressTimestamp < KEY_DELAY) { - if (infoPtr->nSearchParamLength < MAX_PATH-1) - infoPtr->szSearchParam[infoPtr->nSearchParamLength++]=charCode; + diff = infoPtr->lastKeyPressTimestamp - prevTime; + + if (diff >= 0 && diff < KEY_DELAY) + { + if (infoPtr->nSearchParamLength < MAX_PATH - 1) + infoPtr->szSearchParam[infoPtr->nSearchParamLength++] = charCode; + if (infoPtr->charCode != charCode) infoPtr->charCode = charCode = 0; - } else { - infoPtr->charCode=charCode; - infoPtr->szSearchParam[0]=charCode; - infoPtr->nSearchParamLength=1; - /* Redundant with the 1 char string */ - charCode=0; + } + else + { + infoPtr->charCode = charCode; + infoPtr->szSearchParam[0] = charCode; + infoPtr->nSearchParamLength = 1; + /* redundant with the 1 char string */ + charCode = 0; } /* and search from the current position */ - nItem=-1; - if (infoPtr->nFocusedItem >= 0) { - endidx=infoPtr->nFocusedItem; - idx=endidx; - /* if looking for single character match, - * then we must always move forward - */ - if (infoPtr->nSearchParamLength == 1) - idx++; - } else { - endidx=infoPtr->nItemCount; - idx=0; - } - - /* Let application handle this for virtual listview */ + nItem = -1; + endidx = infoPtr->nItemCount; + + /* should start from next after focused item, so next item that matches + will be selected, if there isn't any and focused matches it will be selected + on second search stage from beginning of the list */ + if (infoPtr->nFocusedItem >= 0 && infoPtr->nItemCount > 1) + startidx = infoPtr->nFocusedItem + 1; + else + startidx = 0; + + /* let application handle this for virtual listview */ if (infoPtr->dwStyle & LVS_OWNERDATA) { NMLVFINDITEMW nmlv; - LVFINDINFOW lvfi; - - ZeroMemory(&lvfi, sizeof(lvfi)); - lvfi.flags = (LVFI_WRAP | LVFI_PARTIAL); - infoPtr->szSearchParam[infoPtr->nSearchParamLength] = '\0'; - lvfi.psz = infoPtr->szSearchParam; - nmlv.iStart = idx; - nmlv.lvfi = lvfi; + + memset(&nmlv.lvfi, 0, sizeof(nmlv.lvfi)); + nmlv.lvfi.flags = (LVFI_WRAP | LVFI_PARTIAL); + nmlv.lvfi.psz = infoPtr->szSearchParam; + nmlv.iStart = startidx; + + infoPtr->szSearchParam[infoPtr->nSearchParamLength] = 0; nItem = notify_hdr(infoPtr, LVN_ODFINDITEMW, (LPNMHDR)&nmlv.hdr); - - if (nItem != -1) - LISTVIEW_KeySelection(infoPtr, nItem, FALSE); - - return 0; - } - - do { - if (idx == infoPtr->nItemCount) { - if (endidx == infoPtr->nItemCount || endidx == 0) + } + else + { + INT i = startidx; + + /* first search in [startidx, endidx), on failure continue in [0, startidx) */ + while (1) + { + /* start from first item if not found with >= startidx */ + if (i == infoPtr->nItemCount && startidx > 0) + { + endidx = startidx; + startidx = 0; + } + + for (i = startidx; i < endidx; i++) + { + /* retrieve text */ + item.mask = LVIF_TEXT; + item.iItem = i; + item.iSubItem = 0; + item.pszText = buffer; + item.cchTextMax = MAX_PATH; + if (!LISTVIEW_GetItemW(infoPtr, &item)) return 0; + + if (lstrncmpiW(item.pszText, infoPtr->szSearchParam, infoPtr->nSearchParamLength) == 0) + { + nItem = i; + break; + } + else if (nItem == -1 && lstrncmpiW(item.pszText, infoPtr->szSearchParam, 1) == 0) + { + /* this would work but we must keep looking for a longer match */ + nItem = i; + } + } + + /* found something or second search completed with any result */ + if (nItem != -1 || endidx != infoPtr->nItemCount) break; - idx=0; - } - - /* get item */ - item.mask = LVIF_TEXT; - item.iItem = idx; - item.iSubItem = 0; - item.pszText = buffer; - item.cchTextMax = MAX_PATH; - if (!LISTVIEW_GetItemW(infoPtr, &item)) return 0; - - /* check for a match */ - if (lstrncmpiW(item.pszText,infoPtr->szSearchParam,infoPtr->nSearchParamLength) == 0) { - nItem=idx; - break; - } else if ( (charCode != 0) && (nItem == -1) && (nItem != infoPtr->nFocusedItem) && - (lstrncmpiW(item.pszText,infoPtr->szSearchParam,1) == 0) ) { - /* This would work but we must keep looking for a longer match */ - nItem=idx; - } - idx++; - } while (idx != endidx); + }; + } if (nItem != -1) LISTVIEW_KeySelection(infoPtr, nItem, FALSE); @@ -1874,7 +1949,23 @@ if (LISTVIEW_GetViewRect(infoPtr, &rcView)) horzInfo.nMax = rcView.right - rcView.left; } - + + if (LISTVIEW_IsHeaderEnabled(infoPtr)) + { + if (DPA_GetPtrCount(infoPtr->hdpaColumns)) + { + RECT rcHeader; + INT index; + + index = SendMessageW(infoPtr->hwndHeader, HDM_ORDERTOINDEX, + DPA_GetPtrCount(infoPtr->hdpaColumns) - 1, 0); + + LISTVIEW_GetHeaderRect(infoPtr, index, &rcHeader); + horzInfo.nMax = rcHeader.right; + TRACE("horzInfo.nMax=%d\n", horzInfo.nMax); + } + } + horzInfo.fMask = SIF_RANGE | SIF_PAGE; horzInfo.nMax = max(horzInfo.nMax - 1, 0); dx = GetScrollPos(infoPtr->hwndSelf, SB_HORZ); @@ -1924,7 +2015,7 @@ } /* Update the Header Control */ - if (infoPtr->uView == LV_VIEW_DETAILS) + if (infoPtr->hwndHeader) { horzInfo.fMask = SIF_POS; GetScrollInfo(infoPtr->hwndSelf, SB_HORZ, &horzInfo); @@ -2733,15 +2824,27 @@ } else /* LV_VIEW_SMALLICON, or LV_VIEW_LIST */ { + WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' }; + LVITEMW lvItem; INT i; - + + lvItem.mask = LVIF_TEXT; + lvItem.iSubItem = 0; + for (i = 0; i < infoPtr->nItemCount; i++) - nItemWidth = max(LISTVIEW_GetLabelWidth(infoPtr, i), nItemWidth); + { + lvItem.iItem = i; + lvItem.pszText = szDispText; + lvItem.cchTextMax = DISP_TEXT_SIZE; + if (LISTVIEW_GetItemW(infoPtr, &lvItem)) + nItemWidth = max(LISTVIEW_GetStringWidthT(infoPtr, lvItem.pszText, TRUE), + nItemWidth); + } if (infoPtr->himlSmall) nItemWidth += infoPtr->iconSize.cx; if (infoPtr->himlState) nItemWidth += infoPtr->iconStateSize.cx; - nItemWidth = max(DEFAULT_COLUMN_WIDTH, nItemWidth + WIDTH_PADDING); + nItemWidth = max(DEFAULT_COLUMN_WIDTH, nItemWidth + WIDTH_PADDING); } return nItemWidth; @@ -2862,11 +2965,7 @@ return cmp; } -#if DEBUG_RANGES -#define ranges_check(ranges, desc) ranges_assert(ranges, desc, __FUNCTION__, __LINE__) -#else -#define ranges_check(ranges, desc) do { } while(0) -#endif +#define ranges_check(ranges, desc) if (TRACE_ON(listview)) ranges_assert(ranges, desc, __FUNCTION__, __LINE__) static void ranges_assert(RANGES ranges, LPCSTR desc, const char *func, int line) { @@ -3091,28 +3190,30 @@ TRACE("(%s)\n", debugrange(&range)); ranges_check(ranges, "before del"); - + /* we don't use DPAS_SORTED here, since we need * * to find the first overlapping range */ index = DPA_Search(ranges->hdpa, &range, 0, ranges_cmp, 0, 0); - while(index != -1) + while(index != -1) { chkrgn = DPA_GetPtr(ranges->hdpa, index); - - TRACE("Matches range %s @%d\n", debugrange(chkrgn), index); + + TRACE("Matches range %s @%d\n", debugrange(chkrgn), index); /* case 1: Same range */ if ( (chkrgn->upper == range.upper) && (chkrgn->lower == range.lower) ) { DPA_DeletePtr(ranges->hdpa, index); + Free(chkrgn); break; } /* case 2: engulf */ else if ( (chkrgn->upper <= range.upper) && - (chkrgn->lower >= range.lower) ) + (chkrgn->lower >= range.lower) ) { DPA_DeletePtr(ranges->hdpa, index); + Free(chkrgn); } /* case 3: overlap upper */ else if ( (chkrgn->upper <= range.upper) && @@ -3536,7 +3637,7 @@ return LISTVIEW_GetItemT(infoPtr, lpLVItem, TRUE); } -static inline BOOL LISTVIEW_isHotTracking(const LISTVIEW_INFO *infoPtr) +static inline BOOL LISTVIEW_IsHotTracking(const LISTVIEW_INFO *infoPtr) { return ((infoPtr->dwLvExStyle & LVS_EX_TRACKSELECT) || (infoPtr->dwLvExStyle & LVS_EX_ONECLICKACTIVATE) || @@ -3561,9 +3662,13 @@ * over the item for a certain period of time. * */ -static LRESULT LISTVIEW_MouseHover(LISTVIEW_INFO *infoPtr, WORD fwKeys, INT x, INT y) -{ - if (LISTVIEW_isHotTracking(infoPtr)) +static LRESULT LISTVIEW_MouseHover(LISTVIEW_INFO *infoPtr, INT x, INT y) +{ + NMHDR hdr; + + if (notify_hdr(infoPtr, NM_HOVER, &hdr)) return 0; + + if (LISTVIEW_IsHotTracking(infoPtr)) { LVITEMW item; POINT pt; @@ -3573,9 +3678,202 @@ if (LISTVIEW_GetItemAtPt(infoPtr, &item, pt)) LISTVIEW_SetSelection(infoPtr, item.iItem); + + SetFocus(infoPtr->hwndSelf); } return 0; +} + +#define SCROLL_LEFT 0x1 +#define SCROLL_RIGHT 0x2 +#define SCROLL_UP 0x4 +#define SCROLL_DOWN 0x8 + +/*** + * DESCRIPTION: + * Utility routine to draw and highlight items within a marquee selection rectangle. + * + * PARAMETER(S): + * [I] infoPtr : valid pointer to the listview structure + * [I] coords_orig : original co-ordinates of the cursor + * [I] coords_offs : offsetted coordinates of the cursor + * [I] offset : offset amount + * [I] scroll : Bitmask of which directions we should scroll, if at all + * + * RETURN: + * None. + */ +static void LISTVIEW_MarqueeHighlight(LISTVIEW_INFO *infoPtr, LPPOINT coords_orig, LPPOINT coords_offs, LPPOINT offset, INT scroll) +{ + BOOL controlDown = FALSE; + LVITEMW item; + ITERATOR i; + RECT rect; + + if (coords_offs->x > infoPtr->marqueeOrigin.x) + { + rect.left = infoPtr->marqueeOrigin.x; + rect.right = coords_offs->x; + } + else + { + rect.left = coords_offs->x; + rect.right = infoPtr->marqueeOrigin.x; + } + + if (coords_offs->y > infoPtr->marqueeOrigin.y) + { + rect.top = infoPtr->marqueeOrigin.y; + rect.bottom = coords_offs->y; + } + else + { + rect.top = coords_offs->y; + rect.bottom = infoPtr->marqueeOrigin.y; + } + + /* Cancel out the old marquee rectangle and draw the new one */ + LISTVIEW_InvalidateRect(infoPtr, &infoPtr->marqueeDrawRect); + + /* Scroll by the appropriate distance if applicable - speed up scrolling as + the cursor is further away */ + + if ((scroll & SCROLL_LEFT) && (coords_orig->x <= 0)) + LISTVIEW_Scroll(infoPtr, coords_orig->x, 0); + + if ((scroll & SCROLL_RIGHT) && (coords_orig->x >= infoPtr->rcList.right)) + LISTVIEW_Scroll(infoPtr, (coords_orig->x - infoPtr->rcList.right), 0); + + if ((scroll & SCROLL_UP) && (coords_orig->y <= 0)) + LISTVIEW_Scroll(infoPtr, 0, coords_orig->y); + + if ((scroll & SCROLL_DOWN) && (coords_orig->y >= infoPtr->rcList.bottom)) + LISTVIEW_Scroll(infoPtr, 0, (coords_orig->y - infoPtr->rcList.bottom)); + + /* Invert the items in the old marquee rectangle */ + iterator_frameditems_absolute(&i, infoPtr, &infoPtr->marqueeRect); + + while (iterator_next(&i)) + { + if (i.nItem > -1) + { + if (LISTVIEW_GetItemState(infoPtr, i.nItem, LVIS_SELECTED) == LVIS_SELECTED) + item.state = 0; + else + item.state = LVIS_SELECTED; + + item.stateMask = LVIS_SELECTED; + + LISTVIEW_SetItemState(infoPtr, i.nItem, &item); + } + } + + iterator_destroy(&i); + + CopyRect(&infoPtr->marqueeRect, &rect); + + CopyRect(&infoPtr->marqueeDrawRect, &rect); + OffsetRect(&infoPtr->marqueeDrawRect, offset->x, offset->y); + + /* Iterate over the items within our marquee rectangle */ + iterator_frameditems_absolute(&i, infoPtr, &infoPtr->marqueeRect); + + if (GetKeyState(VK_CONTROL) & 0x8000) + controlDown = TRUE; + + while (iterator_next(&i)) + { + if (i.nItem > -1) + { + /* If CTRL is pressed, invert. If not, always select the item. */ + if ((controlDown) && (LISTVIEW_GetItemState(infoPtr, i.nItem, LVIS_SELECTED))) + item.state = 0; + else + item.state = LVIS_SELECTED; + + item.stateMask = LVIS_SELECTED; + + LISTVIEW_SetItemState(infoPtr, i.nItem, &item); + } + } + + iterator_destroy(&i); + LISTVIEW_InvalidateRect(infoPtr, &rect); +} + +/*** + * DESCRIPTION: + * Called when we are in a marquee selection that involves scrolling the listview (ie, + * the cursor is outside the bounds of the client area). This is a TIMERPROC. + * + * PARAMETER(S): + * [I] hwnd : Handle to the listview + * [I] uMsg : WM_TIMER (ignored) + * [I] idEvent : The timer ID interpreted as a pointer to a LISTVIEW_INFO struct + * [I] dwTimer : The elapsed time (ignored) + * + * RETURN: + * None. + */ +static VOID CALLBACK LISTVIEW_ScrollTimer(HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) +{ + LISTVIEW_INFO *infoPtr; + SCROLLINFO scrollInfo; + POINT coords_orig; + POINT coords_offs; + POINT offset; + INT scroll = 0; + + infoPtr = (LISTVIEW_INFO *) idEvent; + + if (!infoPtr) + return; + + /* Get the current cursor position and convert to client coordinates */ + GetCursorPos(&coords_orig); + ScreenToClient(hWnd, &coords_orig); + + /* Ensure coordinates are within client bounds */ + coords_offs.x = max(min(coords_orig.x, infoPtr->rcList.right), 0); + coords_offs.y = max(min(coords_orig.y, infoPtr->rcList.bottom), 0); + + /* Get offset */ + LISTVIEW_GetOrigin(infoPtr, &offset); + + /* Offset coordinates by the appropriate amount */ + coords_offs.x -= offset.x; + coords_offs.y -= offset.y; + + scrollInfo.cbSize = sizeof(SCROLLINFO); + scrollInfo.fMask = SIF_ALL; + + /* Work out in which directions we can scroll */ + if (GetScrollInfo(infoPtr->hwndSelf, SB_VERT, &scrollInfo)) + { + if (scrollInfo.nPos != scrollInfo.nMin) + scroll |= SCROLL_UP; + + if (((scrollInfo.nPage + scrollInfo.nPos) - 1) != scrollInfo.nMax) + scroll |= SCROLL_DOWN; + } + + if (GetScrollInfo(infoPtr->hwndSelf, SB_HORZ, &scrollInfo)) + { + if (scrollInfo.nPos != scrollInfo.nMin) + scroll |= SCROLL_LEFT; + + if (((scrollInfo.nPage + scrollInfo.nPos) - 1) != scrollInfo.nMax) + scroll |= SCROLL_RIGHT; + } + + if (((coords_orig.x <= 0) && (scroll & SCROLL_LEFT)) || + ((coords_orig.y <= 0) && (scroll & SCROLL_UP)) || + ((coords_orig.x >= infoPtr->rcList.right) && (scroll & SCROLL_RIGHT)) || + ((coords_orig.y >= infoPtr->rcList.bottom) && (scroll & SCROLL_DOWN))) + { + LISTVIEW_MarqueeHighlight(infoPtr, &coords_orig, &coords_offs, &offset, scroll); + } } /*** @@ -3592,8 +3890,6 @@ */ static LRESULT LISTVIEW_MouseMove(LISTVIEW_INFO *infoPtr, WORD fwKeys, INT x, INT y) { - TRACKMOUSEEVENT trackinfo; - if (!(fwKeys & MK_LBUTTON)) infoPtr->bLButtonDown = FALSE; @@ -3604,6 +3900,48 @@ LVHITTESTINFO lvHitTestInfo; WORD wDragWidth = GetSystemMetrics(SM_CXDRAG); WORD wDragHeight= GetSystemMetrics(SM_CYDRAG); + + if (infoPtr->bMarqueeSelect) + { + POINT coords_orig; + POINT coords_offs; + POINT offset; + + coords_orig.x = x; + coords_orig.y = y; + + /* Get offset */ + LISTVIEW_GetOrigin(infoPtr, &offset); + + /* Ensure coordinates are within client bounds */ + coords_offs.x = max(min(x, infoPtr->rcList.right), 0); + coords_offs.y = max(min(y, infoPtr->rcList.bottom), 0); + + /* Offset coordinates by the appropriate amount */ + coords_offs.x -= offset.x; + coords_offs.y -= offset.y; + + /* Enable the timer if we're going outside our bounds, in case the user doesn't + move the mouse again */ + + if ((x <= 0) || (y <= 0) || (x >= infoPtr->rcList.right) || + (y >= infoPtr->rcList.bottom)) + { + if (!infoPtr->bScrolling) + { + infoPtr->bScrolling = TRUE; + SetTimer(infoPtr->hwndSelf, (UINT_PTR) infoPtr, 1, LISTVIEW_ScrollTimer); + } + } + else + { + infoPtr->bScrolling = FALSE; + KillTimer(infoPtr->hwndSelf, (UINT_PTR) infoPtr); + } + + LISTVIEW_MarqueeHighlight(infoPtr, &coords_orig, &coords_offs, &offset, 0); + return 0; + } rect.left = infoPtr->ptClickPos.x - wDragWidth; rect.right = infoPtr->ptClickPos.x + wDragWidth; @@ -3640,17 +3978,42 @@ if (!infoPtr->bDragging) { - NMLISTVIEW nmlv; - lvHitTestInfo.pt = infoPtr->ptClickPos; LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, TRUE); - ZeroMemory(&nmlv, sizeof(nmlv)); - nmlv.iItem = lvHitTestInfo.iItem; - nmlv.ptAction = infoPtr->ptClickPos; - - notify_listview(infoPtr, LVN_BEGINDRAG, &nmlv); - infoPtr->bDragging = TRUE; + /* If the click is outside the range of an item, begin a + highlight. If not, begin an item drag. */ + if (lvHitTestInfo.iItem == -1) + { + NMHDR hdr; + + /* If we're allowing multiple selections, send notification. + If return value is non-zero, cancel. */ + if (!(infoPtr->dwStyle & LVS_SINGLESEL) && (notify_hdr(infoPtr, LVN_MARQUEEBEGIN, &hdr) == 0)) + { + /* Store the absolute coordinates of the click */ + POINT offset; + LISTVIEW_GetOrigin(infoPtr, &offset); + + infoPtr->marqueeOrigin.x = infoPtr->ptClickPos.x - offset.x; + infoPtr->marqueeOrigin.y = infoPtr->ptClickPos.y - offset.y; + + /* Begin selection and capture mouse */ + infoPtr->bMarqueeSelect = TRUE; + SetCapture(infoPtr->hwndSelf); + } + } + else + { + NMLISTVIEW nmlv; + + ZeroMemory(&nmlv, sizeof(nmlv)); + nmlv.iItem = lvHitTestInfo.iItem; + nmlv.ptAction = infoPtr->ptClickPos; + + notify_listview(infoPtr, LVN_BEGINDRAG, &nmlv); + infoPtr->bDragging = TRUE; + } } return 0; @@ -3658,18 +4021,19 @@ } /* see if we are supposed to be tracking mouse hovering */ - if (LISTVIEW_isHotTracking(infoPtr)) { - /* fill in the trackinfo struct */ + if (LISTVIEW_IsHotTracking(infoPtr)) { + TRACKMOUSEEVENT trackinfo; + trackinfo.cbSize = sizeof(TRACKMOUSEEVENT); trackinfo.dwFlags = TME_QUERY; - trackinfo.hwndTrack = infoPtr->hwndSelf; - trackinfo.dwHoverTime = infoPtr->dwHoverTime; /* see if we are already tracking this hwnd */ _TrackMouseEvent(&trackinfo); - if(!(trackinfo.dwFlags & TME_HOVER)) { - trackinfo.dwFlags = TME_HOVER; + if(!(trackinfo.dwFlags & TME_HOVER) || trackinfo.hwndTrack != infoPtr->hwndSelf) { + trackinfo.dwFlags = TME_HOVER; + trackinfo.dwHoverTime = infoPtr->dwHoverTime; + trackinfo.hwndTrack = infoPtr->hwndSelf; /* call TRACKMOUSEEVENT so we receive WM_MOUSEHOVER messages */ _TrackMouseEvent(&trackinfo); @@ -3914,12 +4278,11 @@ *bChanged = TRUE; } - if (lpLVItem->mask & LVIF_IMAGE) - if (lpSubItem->hdr.iImage != lpLVItem->iImage) - { - lpSubItem->hdr.iImage = lpLVItem->iImage; - *bChanged = TRUE; - } + if ((lpLVItem->mask & LVIF_IMAGE) && (lpSubItem->hdr.iImage != lpLVItem->iImage)) + { + lpSubItem->hdr.iImage = lpLVItem->iImage; + *bChanged = TRUE; + } if ((lpLVItem->mask & LVIF_TEXT) && textcmpWT(lpSubItem->hdr.pszText, lpLVItem->pszText, isW)) { @@ -4089,7 +4452,7 @@ lvItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; if (nSubItem == 0) lvItem.mask |= LVIF_STATE; if (infoPtr->uView == LV_VIEW_DETAILS) lvItem.mask |= LVIF_INDENT; - lvItem.stateMask = LVIS_SELECTED | LVIS_FOCUSED | LVIS_STATEIMAGEMASK; + lvItem.stateMask = LVIS_SELECTED | LVIS_FOCUSED | LVIS_STATEIMAGEMASK | LVIS_CUT; lvItem.iItem = nItem; lvItem.iSubItem = nSubItem; lvItem.state = 0; @@ -4192,14 +4555,23 @@ } } - /* small icons */ + /* item icons */ himl = (infoPtr->uView == LV_VIEW_ICON ? infoPtr->himlNormal : infoPtr->himlSmall); if (himl && lvItem.iImage >= 0 && !IsRectEmpty(&rcIcon)) { + UINT style; + TRACE("iImage=%d\n", lvItem.iImage); + + if (lvItem.state & (LVIS_SELECTED | LVIS_CUT) && infoPtr->bFocus) + style = ILD_SELECTED; + else + style = ILD_NORMAL; + ImageList_DrawEx(himl, lvItem.iImage, hdc, rcIcon.left, rcIcon.top, - rcIcon.right - rcIcon.left, rcIcon.bottom - rcIcon.top, infoPtr->clrBk, CLR_DEFAULT, - (lvItem.state & LVIS_SELECTED) && (infoPtr->bFocus) ? ILD_SELECTED : ILD_NORMAL); + rcIcon.right - rcIcon.left, rcIcon.bottom - rcIcon.top, infoPtr->clrBk, + lvItem.state & LVIS_CUT ? RGB(255, 255, 255) : CLR_DEFAULT, + style); } /* Don't bother painting item being edited */ @@ -4643,6 +5015,10 @@ if ((infoPtr->uView == LV_VIEW_DETAILS) && infoPtr->dwLvExStyle & LVS_EX_GRIDLINES) LISTVIEW_RefreshReportGrid(infoPtr, hdc); + /* Draw marquee rectangle if appropriate */ + if (infoPtr->bMarqueeSelect) + DrawFocusRect(hdc, &infoPtr->marqueeDrawRect); + if (cdmode & CDRF_NOTIFYPOSTPAINT) notify_postpaint(infoPtr, &nmlvcd); @@ -4744,10 +5120,46 @@ dwViewRect = MAKELONG(wWidth, wHeight); } + else if (infoPtr->uView == LV_VIEW_ICON) + { + UINT rows,cols; + UINT nItemWidth; + UINT nItemHeight; + + nItemWidth = infoPtr->iconSpacing.cx; + nItemHeight = infoPtr->iconSpacing.cy; + + if (nItemCount == -1) + nItemCount = infoPtr->nItemCount; + + if (wWidth == 0xffff) + wWidth = infoPtr->rcList.right - infoPtr->rcList.left; + + if (wWidth < nItemWidth) + wWidth = nItemWidth; + + cols = wWidth / nItemWidth; + if (cols > nItemCount) + cols = nItemCount; + if (cols < 1) + cols = 1; + + if (nItemCount) + { + rows = nItemCount / cols; + if (nItemCount % cols) + rows++; + } + else + rows = 0; + + wHeight = (nItemHeight * rows)+2; + wWidth = (nItemWidth * cols)+2; + + dwViewRect = MAKELONG(wWidth, wHeight); + } else if (infoPtr->uView == LV_VIEW_SMALLICON) FIXME("uView == LV_VIEW_SMALLICON: not implemented\n"); - else if (infoPtr->uView == LV_VIEW_ICON) - FIXME("uView == LV_VIEW_ICON: not implemented\n"); return dwViewRect; } @@ -4764,11 +5176,14 @@ */ static LRESULT LISTVIEW_CancelEditLabel(LISTVIEW_INFO *infoPtr) { - /* handle value will be lost after LISTVIEW_EndEditLabelT */ - HWND edit = infoPtr->hwndEdit; - - LISTVIEW_EndEditLabelT(infoPtr, TRUE, IsWindowUnicode(infoPtr->hwndEdit)); - SendMessageW(edit, WM_CLOSE, 0, 0); + if (infoPtr->hwndEdit) + { + /* handle value will be lost after LISTVIEW_EndEditLabelT */ + HWND edit = infoPtr->hwndEdit; + + LISTVIEW_EndEditLabelT(infoPtr, TRUE, IsWindowUnicode(infoPtr->hwndEdit)); + SendMessageW(edit, WM_CLOSE, 0, 0); + } return TRUE; } @@ -4795,7 +5210,7 @@ HIMAGELIST dragList = 0; TRACE("iItem=%d Count=%d\n", iItem, infoPtr->nItemCount); - if (iItem < 0 || iItem >= infoPtr->nItemCount) + if (iItem < 0 || iItem >= infoPtr->nItemCount || !lppt) return 0; rcItem.left = LVIR_BOUNDS; @@ -4855,6 +5270,8 @@ HDPA hdpaSubItems = NULL; BOOL bSuppress; ITEMHDR *hdrItem; + ITEM_INFO *lpItem; + ITEM_ID *lpID; INT i, j; TRACE("()\n"); @@ -4876,13 +5293,20 @@ { if (!(infoPtr->dwStyle & LVS_OWNERDATA)) { - /* send LVN_DELETEITEM notification, if not suppressed - and if it is not a virtual listview */ - if (!bSuppress) notify_deleteitem(infoPtr, i); - hdpaSubItems = DPA_GetPtr(infoPtr->hdpaItems, i); + /* send LVN_DELETEITEM notification, if not suppressed + and if it is not a virtual listview */ + if (!bSuppress) notify_deleteitem(infoPtr, i); + hdpaSubItems = DPA_GetPtr(infoPtr->hdpaItems, i); + lpItem = DPA_GetPtr(hdpaSubItems, 0); + /* free id struct */ + j = DPA_GetPtrIndex(infoPtr->hdpaItemIds, lpItem->id); + lpID = DPA_GetPtr(infoPtr->hdpaItemIds, j); + DPA_DeletePtr(infoPtr->hdpaItemIds, j); + Free(lpID); + /* both item and subitem start with ITEMHDR header */ for (j = 0; j < DPA_GetPtrCount(hdpaSubItems); j++) { - hdrItem = DPA_GetPtr(hdpaSubItems, j); + hdrItem = DPA_GetPtr(hdpaSubItems, j); if (is_textW(hdrItem->pszText)) Free(hdrItem->pszText); Free(hdrItem); } @@ -5212,6 +5636,7 @@ static BOOL LISTVIEW_EndEditLabelT(LISTVIEW_INFO *infoPtr, BOOL storeText, BOOL isW) { HWND hwndSelf = infoPtr->hwndSelf; + WCHAR szDispText[DISP_TEXT_SIZE] = { 0 }; NMLVDISPINFOW dispInfo; INT editedItem = infoPtr->nEditLabelItem; BOOL bSame; @@ -5242,7 +5667,9 @@ dispInfo.item.iItem = editedItem; dispInfo.item.iSubItem = 0; dispInfo.item.stateMask = ~0; - if (!LISTVIEW_GetItemW(infoPtr, &dispInfo.item)) + dispInfo.item.pszText = szDispText; + dispInfo.item.cchTextMax = DISP_TEXT_SIZE; + if (!LISTVIEW_GetItemT(infoPtr, &dispInfo.item, isW)) { res = FALSE; goto cleanup; @@ -5256,29 +5683,29 @@ bSame = (lstrcmpW(dispInfo.item.pszText, tmp) == 0); textfreeT(tmp, FALSE); } + + /* add the text from the edit in */ + dispInfo.item.mask |= LVIF_TEXT; + dispInfo.item.pszText = bSame ? NULL : pszText; + dispInfo.item.cchTextMax = bSame ? 0 : textlenT(pszText, isW); + + /* Do we need to update the Item Text */ + if (!notify_dispinfoT(infoPtr, LVN_ENDLABELEDITW, &dispInfo, isW)) + { + res = FALSE; + goto cleanup; + } + if (!IsWindow(hwndSelf)) + { + res = FALSE; + goto cleanup; + } + if (!pszText) return TRUE; if (bSame) { res = TRUE; goto cleanup; } - - /* add the text from the edit in */ - dispInfo.item.mask |= LVIF_TEXT; - dispInfo.item.pszText = pszText; - dispInfo.item.cchTextMax = textlenT(pszText, isW); - - /* Do we need to update the Item Text */ - if (!notify_dispinfoT(infoPtr, LVN_ENDLABELEDITW, &dispInfo, isW)) - { - res = FALSE; - goto cleanup; - } - if (!IsWindow(hwndSelf)) - { - res = FALSE; - goto cleanup; - } - if (!pszText) return TRUE; if (!(infoPtr->dwStyle & LVS_OWNERDATA)) { @@ -5304,6 +5731,133 @@ Free(pszText); return res; +} + +/*** + * DESCRIPTION: + * Subclassed edit control windproc function + * + * PARAMETER(S): + * [I] hwnd : the edit window handle + * [I] uMsg : the message that is to be processed + * [I] wParam : first message parameter + * [I] lParam : second message parameter + * [I] isW : TRUE if input is Unicode + * + * RETURN: + * Zero. + */ +static LRESULT EditLblWndProcT(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL isW) +{ + LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongPtrW(GetParent(hwnd), 0); + BOOL save = TRUE; + + TRACE("(hwnd=%p, uMsg=%x, wParam=%lx, lParam=%lx, isW=%d)\n", + hwnd, uMsg, wParam, lParam, isW); + + switch (uMsg) + { + case WM_GETDLGCODE: + return DLGC_WANTARROWS | DLGC_WANTALLKEYS; + + case WM_DESTROY: + { + WNDPROC editProc = infoPtr->EditWndProc; + infoPtr->EditWndProc = 0; + SetWindowLongPtrW(hwnd, GWLP_WNDPROC, (DWORD_PTR)editProc); + return CallWindowProcT(editProc, hwnd, uMsg, wParam, lParam, isW); + } + + case WM_KEYDOWN: + if (VK_ESCAPE == (INT)wParam) + { + save = FALSE; + break; + } + else if (VK_RETURN == (INT)wParam) + break; + + default: + return CallWindowProcT(infoPtr->EditWndProc, hwnd, uMsg, wParam, lParam, isW); + } + + /* kill the edit */ + if (infoPtr->hwndEdit) + LISTVIEW_EndEditLabelT(infoPtr, save, isW); + + SendMessageW(hwnd, WM_CLOSE, 0, 0); + return 0; +} + +/*** + * DESCRIPTION: + * Subclassed edit control Unicode windproc function + * + * PARAMETER(S): + * [I] hwnd : the edit window handle + * [I] uMsg : the message that is to be processed + * [I] wParam : first message parameter + * [I] lParam : second message parameter + * + * RETURN: + */ +static LRESULT CALLBACK EditLblWndProcW(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + return EditLblWndProcT(hwnd, uMsg, wParam, lParam, TRUE); +} + +/*** + * DESCRIPTION: + * Subclassed edit control ANSI windproc function + * + * PARAMETER(S): + * [I] hwnd : the edit window handle + * [I] uMsg : the message that is to be processed + * [I] wParam : first message parameter + * [I] lParam : second message parameter + * + * RETURN: + */ +static LRESULT CALLBACK EditLblWndProcA(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + return EditLblWndProcT(hwnd, uMsg, wParam, lParam, FALSE); +} + +/*** + * DESCRIPTION: + * Creates a subclassed edit control + * + * PARAMETER(S): + * [I] infoPtr : valid pointer to the listview structure + * [I] text : initial text for the edit + * [I] style : the window style + * [I] isW : TRUE if input is Unicode + * + * RETURN: + */ +static HWND CreateEditLabelT(LISTVIEW_INFO *infoPtr, LPCWSTR text, BOOL isW) +{ + static const DWORD style = WS_CHILDWINDOW|WS_CLIPSIBLINGS|ES_LEFT|ES_AUTOHSCROLL|WS_BORDER|WS_VISIBLE; + HINSTANCE hinst = (HINSTANCE)GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_HINSTANCE); + HWND hedit; + + TRACE("(%p, text=%s, isW=%d)\n", infoPtr, debugtext_t(text, isW), isW); + + /* Window will be resized and positioned after LVN_BEGINLABELEDIT */ + if (isW) + hedit = CreateWindowW(WC_EDITW, text, style, 0, 0, 0, 0, infoPtr->hwndSelf, 0, hinst, 0); + else + hedit = CreateWindowA(WC_EDITA, (LPCSTR)text, style, 0, 0, 0, 0, infoPtr->hwndSelf, 0, hinst, 0); + + if (!hedit) return 0; + + infoPtr->EditWndProc = (WNDPROC) + (isW ? SetWindowLongPtrW(hedit, GWLP_WNDPROC, (DWORD_PTR)EditLblWndProcW) : + SetWindowLongPtrA(hedit, GWLP_WNDPROC, (DWORD_PTR)EditLblWndProcA) ); + + SendMessageW(hedit, WM_SETFONT, (WPARAM)infoPtr->hFont, FALSE); + + return hedit; } /*** @@ -5361,7 +5915,7 @@ dispInfo.item.cchTextMax = DISP_TEXT_SIZE; if (!LISTVIEW_GetItemT(infoPtr, &dispInfo.item, isW)) return 0; - infoPtr->hwndEdit = CreateEditLabelT(infoPtr, dispInfo.item.pszText, WS_VISIBLE, isW); + infoPtr->hwndEdit = CreateEditLabelT(infoPtr, dispInfo.item.pszText, isW); if (!infoPtr->hwndEdit) return 0; if (notify_dispinfoT(infoPtr, LVN_BEGINLABELEDITW, &dispInfo, isW)) @@ -5525,7 +6079,8 @@ if (!lpFindInfo || nItem < 0) return -1; lvItem.mask = 0; - if (lpFindInfo->flags & (LVFI_STRING | LVFI_PARTIAL)) + if (lpFindInfo->flags & (LVFI_STRING | LVFI_PARTIAL) || + lpFindInfo->flags & LVFI_SUBSTRING) { lvItem.mask |= LVIF_TEXT; lvItem.pszText = szDispText; @@ -5586,12 +6141,13 @@ else continue; } - + if (lvItem.mask & LVIF_TEXT) { - if (lpFindInfo->flags & LVFI_PARTIAL) + if (lpFindInfo->flags & (LVFI_PARTIAL | LVFI_SUBSTRING)) { - if (strstrW(lvItem.pszText, lpFindInfo->psz) == NULL) continue; + WCHAR *p = strstrW(lvItem.pszText, lpFindInfo->psz); + if (!p || p != lvItem.pszText) continue; } else { @@ -5600,7 +6156,7 @@ } if (!bNearest) return nItem; - + /* This is very inefficient. To do a good job here, * we need a sorted array of (x,y) item positions */ LISTVIEW_GetItemOrigin(infoPtr, nItem, &Position); @@ -5645,7 +6201,8 @@ static INT LISTVIEW_FindItemA(const LISTVIEW_INFO *infoPtr, INT nStart, const LVFINDINFOA *lpFindInfo) { - BOOL hasText = lpFindInfo->flags & (LVFI_STRING | LVFI_PARTIAL); + BOOL hasText = lpFindInfo->flags & (LVFI_STRING | LVFI_PARTIAL) || + lpFindInfo->flags & LVFI_SUBSTRING; LVFINDINFOW fiw; INT res; LPWSTR strW = NULL; @@ -5842,8 +6399,13 @@ switch (nImageList) { case LVSIL_NORMAL: return infoPtr->himlNormal; - case LVSIL_SMALL: return infoPtr->himlSmall; - case LVSIL_STATE: return infoPtr->himlState; + case LVSIL_SMALL: return infoPtr->himlSmall; + case LVSIL_STATE: return infoPtr->himlState; + case LVSIL_GROUPHEADER: + FIXME("LVSIL_GROUPHEADER not supported\n"); + break; + default: + WARN("got unknown imagelist index - %d\n", nImageList); } return NULL; } @@ -6000,7 +6562,7 @@ if (isubitem) { - SUBITEM_INFO *lpSubItem = LISTVIEW_GetSubItemPtr(hdpaSubItems, isubitem); + SUBITEM_INFO *lpSubItem = LISTVIEW_GetSubItemPtr(hdpaSubItems, isubitem); pItemHdr = lpSubItem ? &lpSubItem->hdr : &callbackHdr; if (!lpSubItem) { @@ -6384,7 +6946,7 @@ */ static BOOL LISTVIEW_GetSubItemRect(const LISTVIEW_INFO *infoPtr, INT nItem, LPRECT lprc) { - POINT Position; + POINT Position, Origin; LVITEMW lvItem; INT nColumn; @@ -6392,7 +6954,7 @@ nColumn = lprc->top; - TRACE("(nItem=%d, nSubItem=%d)\n", nItem, lprc->top); + TRACE("(nItem=%d, nSubItem=%d, type=%d)\n", nItem, lprc->top, lprc->left); /* On WinNT, a subitem of '0' calls LISTVIEW_GetItemRect */ if (lprc->top == 0) return LISTVIEW_GetItemRect(infoPtr, nItem, lprc); @@ -6418,6 +6980,7 @@ } if (!LISTVIEW_GetItemPosition(infoPtr, nItem, &Position)) return FALSE; + LISTVIEW_GetOrigin(infoPtr, &Origin); if (nColumn < 0 || nColumn >= DPA_GetPtrCount(infoPtr->hdpaColumns)) return FALSE; @@ -6425,7 +6988,6 @@ lvItem.iItem = nItem; lvItem.iSubItem = nColumn; - if (lvItem.mask && !LISTVIEW_GetItemW(infoPtr, &lvItem)) return FALSE; switch(lprc->left) { case LVIR_ICON: @@ -6442,37 +7004,10 @@ return FALSE; } - OffsetRect(lprc, 0, Position.y); + OffsetRect(lprc, Origin.x, Position.y); + TRACE("return rect %s\n", wine_dbgstr_rect(lprc)); + return TRUE; -} - - -/*** - * DESCRIPTION: - * Retrieves the width of a label. - * - * PARAMETER(S): - * [I] infoPtr : valid pointer to the listview structure - * - * RETURN: - * SUCCESS : string width (in pixels) - * FAILURE : zero - */ -static INT LISTVIEW_GetLabelWidth(const LISTVIEW_INFO *infoPtr, INT nItem) -{ - WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' }; - LVITEMW lvItem; - - TRACE("(nItem=%d)\n", nItem); - - lvItem.mask = LVIF_TEXT; - lvItem.iItem = nItem; - lvItem.iSubItem = 0; - lvItem.pszText = szDispText; - lvItem.cchTextMax = DISP_TEXT_SIZE; - if (!LISTVIEW_GetItemW(infoPtr, &lvItem)) return 0; - - return LISTVIEW_GetStringWidthT(infoPtr, lvItem.pszText, TRUE); } /*** @@ -6918,6 +7453,14 @@ } } TRACE("lpht->iSubItem=%d\n", lpht->iSubItem); + + /* if we're outside horizontal columns bounds there's nothing to test further */ + if (lpht->iSubItem == -1) + { + lpht->iItem = -1; + lpht->flags = LVHT_NOWHERE; + return -1; + } } TRACE("lpht->flags=0x%x\n", lpht->flags); @@ -7067,9 +7610,9 @@ while (i < infoPtr->nItemCount) { hItem = DPA_GetPtr( infoPtr->hdpaItems, i); - item_s = (ITEM_INFO*)DPA_GetPtr(hItem, 0); - - cmpv = textcmpWT(item_s->hdr.pszText, lpLVItem->pszText, TRUE); + item_s = DPA_GetPtr(hItem, 0); + + cmpv = textcmpWT(item_s->hdr.pszText, lpLVItem->pszText, isW); if (infoPtr->dwStyle & LVS_SORTDESCENDING) cmpv *= -1; if (cmpv >= 0) break; @@ -7451,7 +7994,7 @@ /* insert item in header control */ nNewColumn = SendMessageW(infoPtr->hwndHeader, isW ? HDM_INSERTITEMW : HDM_INSERTITEMA, - (WPARAM)nColumn, (LPARAM)&hdi); + nColumn, (LPARAM)&hdi); if (nNewColumn == -1) return -1; if (nNewColumn != nColumn) ERR("nColumn=%d, nNewColumn=%d\n", nColumn, nNewColumn); @@ -7470,7 +8013,14 @@ SUBITEM_INFO *lpSubItem; HDPA hdpaSubItems; INT nItem, i; - + LVITEMW item; + BOOL changed; + + item.iSubItem = nNewColumn; + item.mask = LVIF_TEXT | LVIF_IMAGE; + item.iImage = I_IMAGECALLBACK; + item.pszText = LPSTR_TEXTCALLBACKW; + for (nItem = 0; nItem < infoPtr->nItemCount; nItem++) { hdpaSubItems = DPA_GetPtr(infoPtr->hdpaItems, nItem); @@ -7480,6 +8030,10 @@ if (lpSubItem->iSubItem >= nNewColumn) lpSubItem->iSubItem++; } + + /* add new subitem for each item */ + item.iItem = nItem; + set_sub_item(infoPtr, &item, isW, &changed); } } @@ -7534,7 +8088,7 @@ column_fill_hditem(infoPtr, &hdi, nColumn, lpColumn, isW); /* set header item attributes */ - bResult = SendMessageW(infoPtr->hwndHeader, isW ? HDM_SETITEMW : HDM_SETITEMA, (WPARAM)nColumn, (LPARAM)&hdi); + bResult = SendMessageW(infoPtr->hwndHeader, isW ? HDM_SETITEMW : HDM_SETITEMA, nColumn, (LPARAM)&hdi); if (!bResult) return FALSE; if (lpColumn->mask & LVCF_FMT) @@ -7774,10 +8328,18 @@ LISTVIEW_SetItemState(infoPtr, -1, &item); himl = LISTVIEW_CreateCheckBoxIL(infoPtr); + if(!(infoPtr->dwStyle & LVS_SHAREIMAGELISTS)) + ImageList_Destroy(infoPtr->himlState); } - LISTVIEW_SetImageList(infoPtr, LVSIL_STATE, himl); - } - + himl = LISTVIEW_SetImageList(infoPtr, LVSIL_STATE, himl); + /* checkbox list replaces prevous custom list or... */ + if(((infoPtr->dwLvExStyle & LVS_EX_CHECKBOXES) && + !(infoPtr->dwStyle & LVS_SHAREIMAGELISTS)) || + /* ...previous was checkbox list */ + (dwOldExStyle & LVS_EX_CHECKBOXES)) + ImageList_Destroy(himl); + } + if((infoPtr->dwLvExStyle ^ dwOldExStyle) & LVS_EX_HEADERDRAGDROP) { DWORD dwStyle; @@ -7803,6 +8365,16 @@ { if (infoPtr->dwLvExStyle & LVS_EX_TRANSPARENTBKGND) LISTVIEW_SetBkColor(infoPtr, CLR_NONE); + } + + if((infoPtr->dwLvExStyle ^ dwOldExStyle) & LVS_EX_HEADERINALLVIEWS) + { + if (infoPtr->dwLvExStyle & LVS_EX_HEADERINALLVIEWS) + LISTVIEW_CreateHeader(infoPtr); + else + ShowWindow(infoPtr->hwndHeader, SW_HIDE); + LISTVIEW_UpdateSize(infoPtr); + LISTVIEW_UpdateScroll(infoPtr); } LISTVIEW_InvalidateList(infoPtr); @@ -8105,34 +8677,35 @@ * SUCCESS : TRUE * FAILURE : FALSE */ -static BOOL LISTVIEW_SetItemPosition(LISTVIEW_INFO *infoPtr, INT nItem, POINT pt) -{ - POINT Origin; - - TRACE("(nItem=%d, &pt=%s\n", nItem, wine_dbgstr_point(&pt)); - - if (nItem < 0 || nItem >= infoPtr->nItemCount || +static BOOL LISTVIEW_SetItemPosition(LISTVIEW_INFO *infoPtr, INT nItem, POINT *pt) +{ + POINT Origin, Pt; + + TRACE("(nItem=%d, pt=%s\n", nItem, wine_dbgstr_point(pt)); + + if (!pt || nItem < 0 || nItem >= infoPtr->nItemCount || !(infoPtr->uView == LV_VIEW_ICON || infoPtr->uView == LV_VIEW_SMALLICON)) return FALSE; + Pt = *pt; LISTVIEW_GetOrigin(infoPtr, &Origin); /* This point value seems to be an undocumented feature. * The best guess is that it means either at the origin, * or at true beginning of the list. I will assume the origin. */ - if ((pt.x == -1) && (pt.y == -1)) - pt = Origin; + if ((Pt.x == -1) && (Pt.y == -1)) + Pt = Origin; if (infoPtr->uView == LV_VIEW_ICON) { - pt.x -= (infoPtr->nItemWidth - infoPtr->iconSize.cx) / 2; - pt.y -= ICON_TOP_PADDING; - } - pt.x -= Origin.x; - pt.y -= Origin.y; + Pt.x -= (infoPtr->nItemWidth - infoPtr->iconSize.cx) / 2; + Pt.y -= ICON_TOP_PADDING; + } + Pt.x -= Origin.x; + Pt.y -= Origin.y; infoPtr->bAutoarrange = FALSE; - return LISTVIEW_MoveIconTo(infoPtr, nItem, &pt, FALSE); + return LISTVIEW_MoveIconTo(infoPtr, nItem, &Pt, FALSE); } /*** @@ -8671,7 +9244,7 @@ infoPtr->iconSpacing.cy = GetSystemMetrics(SM_CYICONSPACING); infoPtr->nEditLabelItem = -1; infoPtr->nLButtonDownItem = -1; - infoPtr->dwHoverTime = -1; /* default system hover time */ + infoPtr->dwHoverTime = HOVER_DEFAULT; /* default system hover time */ infoPtr->nMeasureItemHeight = 0; infoPtr->xTrackLine = -1; /* no track line */ infoPtr->itemEdit.fEnabled = FALSE; @@ -8728,7 +9301,7 @@ map_style_view(infoPtr); infoPtr->notifyFormat = SendMessageW(infoPtr->hwndNotify, WM_NOTIFYFORMAT, - (WPARAM)infoPtr->hwndSelf, (LPARAM)NF_QUERY); + (WPARAM)infoPtr->hwndSelf, NF_QUERY); /* on error defaulting to ANSI notifications */ if (infoPtr->notifyFormat == 0) infoPtr->notifyFormat = NFR_ANSI; @@ -8772,10 +9345,14 @@ * Success: 0 * Failure: -1 */ -static LRESULT LISTVIEW_Destroy(const LISTVIEW_INFO *infoPtr) +static LRESULT LISTVIEW_Destroy(LISTVIEW_INFO *infoPtr) { HTHEME theme = GetWindowTheme(infoPtr->hwndSelf); CloseThemeData(theme); + + /* delete all items */ + LISTVIEW_DeleteAllItems(infoPtr, TRUE); + return 0; } @@ -8791,7 +9368,7 @@ * SUCCESS : TRUE * FAILURE : FALSE */ -static BOOL LISTVIEW_Enable(const LISTVIEW_INFO *infoPtr, BOOL bEnable) +static BOOL LISTVIEW_Enable(const LISTVIEW_INFO *infoPtr) { if (infoPtr->dwStyle & LVS_OWNERDRAWFIXED) InvalidateRect(infoPtr->hwndSelf, NULL, TRUE); @@ -9045,36 +9622,31 @@ scrollInfo.fMask = SIF_POS; scrollInfo.nPos = nNewScrollPos; nNewScrollPos = SetScrollInfo(infoPtr->hwndSelf, SB_HORZ, &scrollInfo, TRUE); - + /* carry on only if it really changed */ if (nNewScrollPos == nOldScrollPos) return 0; - - if (infoPtr->uView == LV_VIEW_DETAILS) - LISTVIEW_UpdateHeaderSize(infoPtr, nNewScrollPos); - + + if (infoPtr->hwndHeader) LISTVIEW_UpdateHeaderSize(infoPtr, nNewScrollPos); + /* now adjust to client coordinates */ nScrollDiff = nOldScrollPos - nNewScrollPos; if (infoPtr->uView == LV_VIEW_LIST) nScrollDiff *= infoPtr->nItemWidth; - + /* and scroll the window */ scroll_list(infoPtr, nScrollDiff, 0); - return 0; + return 0; } static LRESULT LISTVIEW_MouseWheel(LISTVIEW_INFO *infoPtr, INT wheelDelta) { INT gcWheelDelta = 0; INT pulScrollLines = 3; - SCROLLINFO scrollInfo; TRACE("(wheelDelta=%d)\n", wheelDelta); SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &pulScrollLines, 0); gcWheelDelta -= wheelDelta; - - scrollInfo.cbSize = sizeof(SCROLLINFO); - scrollInfo.fMask = SIF_POS; switch(infoPtr->uView) { @@ -9233,7 +9805,21 @@ /* if we have a focus rectangle, get rid of it */ LISTVIEW_ShowFocusRect(infoPtr, FALSE); - + + /* if have a marquee selection, stop it */ + if (infoPtr->bMarqueeSelect) + { + /* Remove the marquee rectangle and release our mouse capture */ + LISTVIEW_InvalidateRect(infoPtr, &infoPtr->marqueeRect); + ReleaseCapture(); + + SetRect(&infoPtr->marqueeRect, 0, 0, 0, 0); + + infoPtr->bMarqueeSelect = FALSE; + infoPtr->bScrolling = FALSE; + KillTimer(infoPtr->hwndSelf, (UINT_PTR) infoPtr); + } + /* set window focus flag */ infoPtr->bFocus = FALSE; @@ -9312,6 +9898,8 @@ infoPtr->bLButtonDown = TRUE; infoPtr->ptClickPos = pt; infoPtr->bDragging = FALSE; + infoPtr->bMarqueeSelect = FALSE; + infoPtr->bScrolling = FALSE; lvHitTestInfo.pt.x = x; lvHitTestInfo.pt.y = y; @@ -9389,6 +9977,9 @@ } else { + if (!infoPtr->bFocus) + SetFocus(infoPtr->hwndSelf); + /* remove all selections */ if (!(wKey & MK_CONTROL) && !(wKey & MK_SHIFT)) LISTVIEW_DeselectAll(infoPtr); @@ -9433,9 +10024,23 @@ LISTVIEW_SetSelection(infoPtr, infoPtr->nLButtonDownItem); infoPtr->nLButtonDownItem = -1; - if (infoPtr->bDragging) - { + if (infoPtr->bDragging || infoPtr->bMarqueeSelect) + { + /* Remove the marquee rectangle and release our mouse capture */ + if (infoPtr->bMarqueeSelect) + { + LISTVIEW_InvalidateRect(infoPtr, &infoPtr->marqueeDrawRect); + ReleaseCapture(); + } + + SetRect(&infoPtr->marqueeRect, 0, 0, 0, 0); + SetRect(&infoPtr->marqueeDrawRect, 0, 0, 0, 0); + infoPtr->bDragging = FALSE; + infoPtr->bMarqueeSelect = FALSE; + infoPtr->bScrolling = FALSE; + + KillTimer(infoPtr->hwndSelf, (UINT_PTR) infoPtr); return 0; } @@ -9471,28 +10076,27 @@ */ static LRESULT LISTVIEW_NCDestroy(LISTVIEW_INFO *infoPtr) { + INT i; + TRACE("()\n"); - - /* delete all items */ - LISTVIEW_DeleteAllItems(infoPtr, TRUE); /* destroy data structure */ DPA_Destroy(infoPtr->hdpaItems); DPA_Destroy(infoPtr->hdpaItemIds); DPA_Destroy(infoPtr->hdpaPosX); DPA_Destroy(infoPtr->hdpaPosY); + /* columns */ + for (i = 0; i < DPA_GetPtrCount(infoPtr->hdpaColumns); i++) + Free(DPA_GetPtr(infoPtr->hdpaColumns, i)); DPA_Destroy(infoPtr->hdpaColumns); ranges_destroy(infoPtr->selectionRanges); /* destroy image lists */ if (!(infoPtr->dwStyle & LVS_SHAREIMAGELISTS)) { - if (infoPtr->himlNormal) - ImageList_Destroy(infoPtr->himlNormal); - if (infoPtr->himlSmall) - ImageList_Destroy(infoPtr->himlSmall); - if (infoPtr->himlState) - ImageList_Destroy(infoPtr->himlState); + ImageList_Destroy(infoPtr->himlNormal); + ImageList_Destroy(infoPtr->himlSmall); + ImageList_Destroy(infoPtr->himlState); } /* destroy font, bkgnd brush */ @@ -9675,6 +10279,9 @@ case HDN_DIVIDERDBLCLICKW: case HDN_DIVIDERDBLCLICKA: + /* FIXME: for LVS_EX_HEADERINALLVIEWS and not LV_VIEW_DETAILS + we should use LVSCW_AUTOSIZE_USEHEADER, helper rework or + split needed for that */ LISTVIEW_SetColumnWidth(infoPtr, lpnmh->iItem, LVSCW_AUTOSIZE); notify_forward_header(infoPtr, lpnmh); break; @@ -9704,7 +10311,8 @@ int cxEdge = GetSystemMetrics (SM_CXEDGE), cyEdge = GetSystemMetrics (SM_CYEDGE); - if (!theme) return FALSE; + if (!theme) + return DefWindowProcW (infoPtr->hwndSelf, WM_NCPAINT, (WPARAM)region, 0); GetWindowRect(infoPtr->hwndSelf, &r); @@ -9725,7 +10333,7 @@ /* Call default proc to get the scrollbars etc. painted */ DefWindowProcW (infoPtr->hwndSelf, WM_NCPAINT, (WPARAM)cliprgn, 0); - return TRUE; + return FALSE; } /*** @@ -9975,20 +10583,24 @@ * TRUE if cursor is set * FALSE otherwise */ -static BOOL LISTVIEW_SetCursor(const LISTVIEW_INFO *infoPtr, HWND hwnd, UINT nHittest, UINT wMouseMsg) +static BOOL LISTVIEW_SetCursor(const LISTVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam) { LVHITTESTINFO lvHitTestInfo; - if(!(LISTVIEW_isHotTracking(infoPtr))) return FALSE; - - if(!infoPtr->hHotCursor) return FALSE; + if (!LISTVIEW_IsHotTracking(infoPtr)) goto forward; + + if (!infoPtr->hHotCursor) goto forward; GetCursorPos(&lvHitTestInfo.pt); - if (LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, FALSE, FALSE) < 0) return FALSE; + if (LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, FALSE, FALSE) < 0) goto forward; SetCursor(infoPtr->hHotCursor); return TRUE; + +forward: + + return DefWindowProcW(infoPtr->hwndSelf, WM_SETCURSOR, wParam, lParam); } /*** @@ -10161,7 +10773,9 @@ infoPtr->rcList.bottom -= GetSystemMetrics(SM_CYHSCROLL); infoPtr->rcList.bottom = max (infoPtr->rcList.bottom - 2, 0); } - else if (infoPtr->uView == LV_VIEW_DETAILS) + + /* if control created invisible header isn't created */ + if (infoPtr->hwndHeader) { HDLAYOUT hl; WINDOWPOS wp; @@ -10169,15 +10783,24 @@ hl.prc = &infoPtr->rcList; hl.pwpos = ℘ SendMessageW( infoPtr->hwndHeader, HDM_LAYOUT, 0, (LPARAM)&hl ); - TRACE(" wp.flags=0x%08x, wp=%d,%d (%dx%d)\n", wp.flags, wp.x, wp.y, wp.cx, wp.cy); - SetWindowPos(wp.hwnd, wp.hwndInsertAfter, wp.x, wp.y, wp.cx, wp.cy, - wp.flags | ((infoPtr->dwStyle & LVS_NOCOLUMNHEADER) - ? SWP_HIDEWINDOW : SWP_SHOWWINDOW)); - TRACE(" after SWP wp=%d,%d (%dx%d)\n", wp.x, wp.y, wp.cx, wp.cy); + TRACE(" wp.flags=0x%08x, wp=%d,%d (%dx%d)\n", wp.flags, wp.x, wp.y, wp.cx, wp.cy); + + if (LISTVIEW_IsHeaderEnabled(infoPtr)) + wp.flags |= SWP_SHOWWINDOW; + else + { + wp.flags |= SWP_HIDEWINDOW; + wp.cy = 0; + } + + SetWindowPos(wp.hwnd, wp.hwndInsertAfter, wp.x, wp.y, wp.cx, wp.cy, wp.flags); + TRACE(" after SWP wp=%d,%d (%dx%d)\n", wp.x, wp.y, wp.cx, wp.cy); infoPtr->rcList.top = max(wp.cy, 0); - infoPtr->rcList.top += (infoPtr->dwLvExStyle & LVS_EX_GRIDLINES) ? 2 : 0; - } + } + /* extra padding for grid */ + if (infoPtr->uView == LV_VIEW_DETAILS && infoPtr->dwLvExStyle & LVS_EX_GRIDLINES) + infoPtr->rcList.top += 2; TRACE(" rcList=%s\n", wine_dbgstr_rect(&infoPtr->rcList)); } @@ -10258,7 +10881,7 @@ LISTVIEW_UpdateItemSize(infoPtr); } - if (uNewView == LVS_REPORT) + if (uNewView == LVS_REPORT || infoPtr->dwLvExStyle & LVS_EX_HEADERINALLVIEWS) { if ((lpss->styleOld ^ lpss->styleNew) & LVS_NOCOLUMNHEADER) { @@ -10300,14 +10923,13 @@ * Processes WM_STYLECHANGING messages. * * PARAMETER(S): - * [I] infoPtr : valid pointer to the listview structure * [I] wStyleType : window style type (normal or extended) * [I0] lpss : window style information * * RETURN: * Zero */ -static INT LISTVIEW_StyleChanging(LISTVIEW_INFO *infoPtr, WPARAM wStyleType, +static INT LISTVIEW_StyleChanging(WPARAM wStyleType, STYLESTRUCT *lpss) { TRACE("(styletype=%lx, styleOld=0x%08x, styleNew=0x%08x)\n", @@ -10337,7 +10959,7 @@ * RETURN: * Zero */ -static LRESULT LISTVIEW_ShowWindow(LISTVIEW_INFO *infoPtr, BOOL bShown, INT iStatus) +static LRESULT LISTVIEW_ShowWindow(LISTVIEW_INFO *infoPtr, WPARAM bShown, LPARAM iStatus) { /* header delayed creation */ if ((infoPtr->uView == LV_VIEW_DETAILS) && bShown) @@ -10348,7 +10970,7 @@ ShowWindow(infoPtr->hwndHeader, SW_SHOWNORMAL); } - return 0; + return DefWindowProcW(infoPtr->hwndSelf, WM_SHOWWINDOW, bShown, iStatus); } /*** @@ -10402,7 +11024,7 @@ { LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongPtrW(hwnd, 0); - TRACE("(uMsg=%x wParam=%lx lParam=%lx)\n", uMsg, wParam, lParam); + TRACE("(hwnd=%p uMsg=%x wParam=%lx lParam=%lx)\n", hwnd, uMsg, wParam, lParam); if (!infoPtr && (uMsg != WM_NCCREATE)) return DefWindowProcW(hwnd, uMsg, wParam, lParam); @@ -10430,12 +11052,10 @@ case LVM_DELETEITEM: return LISTVIEW_DeleteItem(infoPtr, (INT)wParam); + case LVM_EDITLABELA: case LVM_EDITLABELW: - return (LRESULT)LISTVIEW_EditLabelT(infoPtr, (INT)wParam, TRUE); - - case LVM_EDITLABELA: - return (LRESULT)LISTVIEW_EditLabelT(infoPtr, (INT)wParam, FALSE); - + return (LRESULT)LISTVIEW_EditLabelT(infoPtr, (INT)wParam, + uMsg == LVM_EDITLABELW); /* case LVM_ENABLEGROUPVIEW: */ case LVM_ENSUREVISIBLE: @@ -10456,10 +11076,9 @@ return infoPtr->uCallbackMask; case LVM_GETCOLUMNA: - return LISTVIEW_GetColumnT(infoPtr, (INT)wParam, (LPLVCOLUMNW)lParam, FALSE); - case LVM_GETCOLUMNW: - return LISTVIEW_GetColumnT(infoPtr, (INT)wParam, (LPLVCOLUMNW)lParam, TRUE); + return LISTVIEW_GetColumnT(infoPtr, (INT)wParam, (LPLVCOLUMNW)lParam, + uMsg == LVM_GETCOLUMNW); case LVM_GETCOLUMNORDERARRAY: return LISTVIEW_GetColumnOrderArray(infoPtr, (INT)wParam, (LPINT)lParam); @@ -10507,10 +11126,8 @@ return FALSE; case LVM_GETITEMA: - return LISTVIEW_GetItemExtT(infoPtr, (LPLVITEMW)lParam, FALSE); - case LVM_GETITEMW: - return LISTVIEW_GetItemExtT(infoPtr, (LPLVITEMW)lParam, TRUE); + return LISTVIEW_GetItemExtT(infoPtr, (LPLVITEMW)lParam, uMsg == LVM_GETITEMW); case LVM_GETITEMCOUNT: return infoPtr->nItemCount; @@ -10528,10 +11145,9 @@ return LISTVIEW_GetItemState(infoPtr, (INT)wParam, (UINT)lParam); case LVM_GETITEMTEXTA: - return LISTVIEW_GetItemTextT(infoPtr, (INT)wParam, (LPLVITEMW)lParam, FALSE); - case LVM_GETITEMTEXTW: - return LISTVIEW_GetItemTextT(infoPtr, (INT)wParam, (LPLVITEMW)lParam, TRUE); + return LISTVIEW_GetItemTextT(infoPtr, (INT)wParam, (LPLVITEMW)lParam, + uMsg == LVM_GETITEMTEXTW); case LVM_GETNEXTITEM: return LISTVIEW_GetNextItem(infoPtr, (INT)wParam, LOWORD(lParam)); @@ -10558,10 +11174,9 @@ return infoPtr->nSelectionMark; case LVM_GETSTRINGWIDTHA: - return LISTVIEW_GetStringWidthT(infoPtr, (LPCWSTR)lParam, FALSE); - case LVM_GETSTRINGWIDTHW: - return LISTVIEW_GetStringWidthT(infoPtr, (LPCWSTR)lParam, TRUE); + return LISTVIEW_GetStringWidthT(infoPtr, (LPCWSTR)lParam, + uMsg == LVM_GETSTRINGWIDTHW); case LVM_GETSUBITEMRECT: return LISTVIEW_GetSubItemRect(infoPtr, (UINT)wParam, (LPRECT)lParam); @@ -10603,20 +11218,17 @@ return LISTVIEW_HitTest(infoPtr, (LPLVHITTESTINFO)lParam, FALSE, TRUE); case LVM_INSERTCOLUMNA: - return LISTVIEW_InsertColumnT(infoPtr, (INT)wParam, (LPLVCOLUMNW)lParam, FALSE); - case LVM_INSERTCOLUMNW: - return LISTVIEW_InsertColumnT(infoPtr, (INT)wParam, (LPLVCOLUMNW)lParam, TRUE); + return LISTVIEW_InsertColumnT(infoPtr, (INT)wParam, (LPLVCOLUMNW)lParam, + uMsg == LVM_INSERTCOLUMNW); /* case LVM_INSERTGROUP: */ /* case LVM_INSERTGROUPSORTED: */ case LVM_INSERTITEMA: - return LISTVIEW_InsertItemT(infoPtr, (LPLVITEMW)lParam, FALSE); - case LVM_INSERTITEMW: - return LISTVIEW_InsertItemT(infoPtr, (LPLVITEMW)lParam, TRUE); + return LISTVIEW_InsertItemT(infoPtr, (LPLVITEMW)lParam, uMsg == LVM_INSERTITEMW); /* case LVM_INSERTMARKHITTEST: */ @@ -10655,10 +11267,9 @@ return TRUE; case LVM_SETCOLUMNA: - return LISTVIEW_SetColumnT(infoPtr, (INT)wParam, (LPLVCOLUMNW)lParam, FALSE); - case LVM_SETCOLUMNW: - return LISTVIEW_SetColumnT(infoPtr, (INT)wParam, (LPLVCOLUMNW)lParam, TRUE); + return LISTVIEW_SetColumnT(infoPtr, (INT)wParam, (LPLVCOLUMNW)lParam, + uMsg == LVM_SETCOLUMNW); case LVM_SETCOLUMNORDERARRAY: return LISTVIEW_SetColumnOrderArray(infoPtr, (INT)wParam, (LPINT)lParam); @@ -10680,7 +11291,7 @@ return LISTVIEW_SetHotItem(infoPtr, (INT)wParam); case LVM_SETHOVERTIME: - return LISTVIEW_SetHoverTime(infoPtr, (DWORD)wParam); + return LISTVIEW_SetHoverTime(infoPtr, (DWORD)lParam); case LVM_SETICONSPACING: return LISTVIEW_SetIconSpacing(infoPtr, (short)LOWORD(lParam), (short)HIWORD(lParam)); @@ -10709,22 +11320,20 @@ POINT pt; pt.x = (short)LOWORD(lParam); pt.y = (short)HIWORD(lParam); - return LISTVIEW_SetItemPosition(infoPtr, (INT)wParam, pt); + return LISTVIEW_SetItemPosition(infoPtr, (INT)wParam, &pt); } case LVM_SETITEMPOSITION32: - if (lParam == 0) return FALSE; - return LISTVIEW_SetItemPosition(infoPtr, (INT)wParam, *((POINT*)lParam)); + return LISTVIEW_SetItemPosition(infoPtr, (INT)wParam, (POINT*)lParam); case LVM_SETITEMSTATE: if (lParam == 0) return FALSE; return LISTVIEW_SetItemState(infoPtr, (INT)wParam, (LPLVITEMW)lParam); case LVM_SETITEMTEXTA: - return LISTVIEW_SetItemTextT(infoPtr, (INT)wParam, (LPLVITEMW)lParam, FALSE); - case LVM_SETITEMTEXTW: - return LISTVIEW_SetItemTextT(infoPtr, (INT)wParam, (LPLVITEMW)lParam, TRUE); + return LISTVIEW_SetItemTextT(infoPtr, (INT)wParam, (LPLVITEMW)lParam, + uMsg == LVM_SETITEMTEXTW); /* case LVM_SETOUTLINECOLOR: */ @@ -10759,11 +11368,9 @@ /* case LVM_SORTGROUPS: */ case LVM_SORTITEMS: - return LISTVIEW_SortItems(infoPtr, (PFNLVCOMPARE)lParam, (LPARAM)wParam, FALSE); - case LVM_SORTITEMSEX: - return LISTVIEW_SortItems(infoPtr, (PFNLVCOMPARE)lParam, (LPARAM)wParam, TRUE); - + return LISTVIEW_SortItems(infoPtr, (PFNLVCOMPARE)lParam, wParam, + uMsg == LVM_SORTITEMSEX); case LVM_SUBITEMHITTEST: return LISTVIEW_HitTest(infoPtr, (LPLVHITTESTINFO)lParam, TRUE, FALSE); @@ -10792,7 +11399,7 @@ return LISTVIEW_Destroy(infoPtr); case WM_ENABLE: - return LISTVIEW_Enable(infoPtr, (BOOL)wParam); + return LISTVIEW_Enable(infoPtr); case WM_ERASEBKGND: return LISTVIEW_EraseBkgnd(infoPtr, (HDC)wParam); @@ -10825,15 +11432,13 @@ return LISTVIEW_MouseMove (infoPtr, (WORD)wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam)); case WM_MOUSEHOVER: - return LISTVIEW_MouseHover(infoPtr, (WORD)wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam)); + return LISTVIEW_MouseHover(infoPtr, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam)); case WM_NCDESTROY: return LISTVIEW_NCDestroy(infoPtr); case WM_NCPAINT: - if (LISTVIEW_NCPaint(infoPtr, (HRGN)wParam)) - return 0; - goto fwd_msg; + return LISTVIEW_NCPaint(infoPtr, (HRGN)wParam); case WM_NOTIFY: if (lParam && ((LPNMHDR)lParam)->hwndFrom == infoPtr->hwndHeader) @@ -10859,9 +11464,7 @@ return LISTVIEW_RButtonUp(infoPtr, (WORD)wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam)); case WM_SETCURSOR: - if(LISTVIEW_SetCursor(infoPtr, (HWND)wParam, LOWORD(lParam), HIWORD(lParam))) - return TRUE; - goto fwd_msg; + return LISTVIEW_SetCursor(infoPtr, wParam, lParam); case WM_SETFOCUS: return LISTVIEW_SetFocus(infoPtr, (HWND)wParam); @@ -10873,8 +11476,7 @@ return LISTVIEW_SetRedraw(infoPtr, (BOOL)wParam); case WM_SHOWWINDOW: - LISTVIEW_ShowWindow(infoPtr, (BOOL)wParam, (INT)lParam); - return DefWindowProcW(hwnd, uMsg, wParam, lParam); + return LISTVIEW_ShowWindow(infoPtr, wParam, lParam); case WM_SIZE: return LISTVIEW_Size(infoPtr, (short)LOWORD(lParam), (short)HIWORD(lParam)); @@ -10883,7 +11485,7 @@ return LISTVIEW_StyleChanged(infoPtr, wParam, (LPSTYLESTRUCT)lParam); case WM_STYLECHANGING: - return LISTVIEW_StyleChanging(infoPtr, wParam, (LPSTYLESTRUCT)lParam); + return LISTVIEW_StyleChanging(wParam, (LPSTYLESTRUCT)lParam); case WM_SYSCOLORCHANGE: COMCTL32_RefreshSysColors(); @@ -10923,8 +11525,6 @@ if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); - fwd_msg: - /* call default window procedure */ return DefWindowProcW(hwnd, uMsg, wParam, lParam); } @@ -10984,6 +11584,11 @@ */ static LRESULT LISTVIEW_Command(LISTVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam) { + + TRACE("(%p %x %x %lx)\n", infoPtr, HIWORD(wParam), LOWORD(wParam), lParam); + + if (!infoPtr->hwndEdit) return 0; + switch (HIWORD(wParam)) { case EN_UPDATE: @@ -11003,7 +11608,7 @@ /* Select font to get the right dimension of the string */ hFont = (HFONT)SendMessageW(infoPtr->hwndEdit, WM_GETFONT, 0, 0); - if(hFont != 0) + if (hFont) { hOldFont = SelectObject(hdc, hFont); } @@ -11016,16 +11621,10 @@ GetTextMetricsW(hdc, &textMetric); sz.cx += (textMetric.tmMaxCharWidth * 2); - SetWindowPos ( - infoPtr->hwndEdit, - HWND_TOP, - 0, - 0, - sz.cx, - rect.bottom - rect.top, - SWP_DRAWFRAME|SWP_NOMOVE); + SetWindowPos(infoPtr->hwndEdit, NULL, 0, 0, sz.cx, + rect.bottom - rect.top, SWP_DRAWFRAME | SWP_NOMOVE | SWP_NOZORDER); } - if(hFont != 0) + if (hFont) SelectObject(hdc, hOldFont); ReleaseDC(infoPtr->hwndEdit, hdc); @@ -11035,6 +11634,7 @@ case EN_KILLFOCUS: { LISTVIEW_CancelEditLabel(infoPtr); + break; } default: @@ -11043,133 +11643,3 @@ return 0; } - - -/*** - * DESCRIPTION: - * Subclassed edit control windproc function - * - * PARAMETER(S): - * [I] hwnd : the edit window handle - * [I] uMsg : the message that is to be processed - * [I] wParam : first message parameter - * [I] lParam : second message parameter - * [I] isW : TRUE if input is Unicode - * - * RETURN: - * Zero. - */ -static LRESULT EditLblWndProcT(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL isW) -{ - LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongPtrW(GetParent(hwnd), 0); - BOOL save = TRUE; - - TRACE("(hwnd=%p, uMsg=%x, wParam=%lx, lParam=%lx, isW=%d)\n", - hwnd, uMsg, wParam, lParam, isW); - - switch (uMsg) - { - case WM_GETDLGCODE: - return DLGC_WANTARROWS | DLGC_WANTALLKEYS; - - case WM_DESTROY: - { - WNDPROC editProc = infoPtr->EditWndProc; - infoPtr->EditWndProc = 0; - SetWindowLongPtrW(hwnd, GWLP_WNDPROC, (DWORD_PTR)editProc); - return CallWindowProcT(editProc, hwnd, uMsg, wParam, lParam, isW); - } - - case WM_KEYDOWN: - if (VK_ESCAPE == (INT)wParam) - { - save = FALSE; - break; - } - else if (VK_RETURN == (INT)wParam) - break; - - default: - return CallWindowProcT(infoPtr->EditWndProc, hwnd, uMsg, wParam, lParam, isW); - } - - /* kill the edit */ - if (infoPtr->hwndEdit) - LISTVIEW_EndEditLabelT(infoPtr, save, isW); - - SendMessageW(hwnd, WM_CLOSE, 0, 0); - return 0; -} - -/*** - * DESCRIPTION: - * Subclassed edit control Unicode windproc function - * - * PARAMETER(S): - * [I] hwnd : the edit window handle - * [I] uMsg : the message that is to be processed - * [I] wParam : first message parameter - * [I] lParam : second message parameter - * - * RETURN: - */ -static LRESULT CALLBACK EditLblWndProcW(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - return EditLblWndProcT(hwnd, uMsg, wParam, lParam, TRUE); -} - -/*** - * DESCRIPTION: - * Subclassed edit control ANSI windproc function - * - * PARAMETER(S): - * [I] hwnd : the edit window handle - * [I] uMsg : the message that is to be processed - * [I] wParam : first message parameter - * [I] lParam : second message parameter - * - * RETURN: - */ -static LRESULT CALLBACK EditLblWndProcA(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - return EditLblWndProcT(hwnd, uMsg, wParam, lParam, FALSE); -} - -/*** - * DESCRIPTION: - * Creates a subclassed edit control - * - * PARAMETER(S): - * [I] infoPtr : valid pointer to the listview structure - * [I] text : initial text for the edit - * [I] style : the window style - * [I] isW : TRUE if input is Unicode - * - * RETURN: - */ -static HWND CreateEditLabelT(LISTVIEW_INFO *infoPtr, LPCWSTR text, DWORD style, BOOL isW) -{ - WCHAR editName[5] = { 'E', 'd', 'i', 't', '\0' }; - HWND hedit; - HINSTANCE hinst = (HINSTANCE)GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_HINSTANCE); - - TRACE("(text=%s, ..., isW=%d)\n", debugtext_t(text, isW), isW); - - style |= WS_CHILDWINDOW|WS_CLIPSIBLINGS|ES_LEFT|ES_AUTOHSCROLL|WS_BORDER; - - /* Window will be resized and positioned after LVN_BEGINLABELEDIT */ - if (isW) - hedit = CreateWindowW(editName, text, style, 0, 0, 0, 0, infoPtr->hwndSelf, 0, hinst, 0); - else - hedit = CreateWindowA("Edit", (LPCSTR)text, style, 0, 0, 0, 0, infoPtr->hwndSelf, 0, hinst, 0); - - if (!hedit) return 0; - - infoPtr->EditWndProc = (WNDPROC) - (isW ? SetWindowLongPtrW(hedit, GWLP_WNDPROC, (DWORD_PTR)EditLblWndProcW) : - SetWindowLongPtrA(hedit, GWLP_WNDPROC, (DWORD_PTR)EditLblWndProcA) ); - - SendMessageW(hedit, WM_SETFONT, (WPARAM)infoPtr->hFont, FALSE); - - return hedit; -}
14 years, 6 months
1
0
0
0
[tkreuzer] 47546: [PSDK] add LVSIL_GROUPHEADER definition to commctrl.h
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Jun 3 19:52:23 2010 New Revision: 47546 URL:
http://svn.reactos.org/svn/reactos?rev=47546&view=rev
Log: [PSDK] add LVSIL_GROUPHEADER definition to commctrl.h Modified: trunk/reactos/include/psdk/commctrl.h Modified: trunk/reactos/include/psdk/commctrl.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/commctrl.h?re…
============================================================================== --- trunk/reactos/include/psdk/commctrl.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/commctrl.h [iso-8859-1] Thu Jun 3 19:52:23 2010 @@ -2240,6 +2240,7 @@ #define LVSIL_NORMAL 0 #define LVSIL_SMALL 1 #define LVSIL_STATE 2 +#define LVSIL_GROUPHEADER 3 #define LVM_SETIMAGELIST (LVM_FIRST+3) #define ListView_SetImageList(hwnd,himl,iImageList) (HIMAGELIST)SNDMSG((hwnd),LVM_SETIMAGELIST,(WPARAM)(iImageList),(LPARAM)(HIMAGELIST)(himl))
14 years, 6 months
1
0
0
0
[tkreuzer] 47545: [BROWSEUI] merge r44391 from amd64 branch fix 64bit build
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Jun 3 19:44:52 2010 New Revision: 47545 URL:
http://svn.reactos.org/svn/reactos?rev=47545&view=rev
Log: [BROWSEUI] merge r44391 from amd64 branch fix 64bit build Modified: trunk/reactos/dll/win32/browseui/shellbrowser.cpp Modified: trunk/reactos/dll/win32/browseui/shellbrowser.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/shellbr…
============================================================================== --- trunk/reactos/dll/win32/browseui/shellbrowser.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/shellbrowser.cpp [iso-8859-1] Thu Jun 3 19:44:52 2010 @@ -282,7 +282,7 @@ LRESULT CToolbarProxy::OnAddBitmap(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) { - LRESULT result; + long int result; HRESULT hResult; result = 0;
14 years, 6 months
1
0
0
0
[gadamopoulos] 47544: [user32] - Remove a reactos only export (PrivateCsrssInitialized) - Don't call NtUserGetClassLong - Move implementation of AnyPopup to user mode - Fix a small bug in GetParent and in IsChild [csrss] - Don't call PrivateCsrssInitialized [win32k] - Call CsrInit in NtUserInitialize so we can remove PrivateCsrssInitialized - Romove a reactos only syscall (NtUserGetClassLong) - Remove UserGetClassLongPtr, UserGetWindow, UserGetWindowLong, IntGetOwner. Instead access objects dire
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Thu Jun 3 18:12:43 2010 New Revision: 47544 URL:
http://svn.reactos.org/svn/reactos?rev=47544&view=rev
Log: [user32] - Remove a reactos only export (PrivateCsrssInitialized) - Don't call NtUserGetClassLong - Move implementation of AnyPopup to user mode - Fix a small bug in GetParent and in IsChild [csrss] - Don't call PrivateCsrssInitialized [win32k] - Call CsrInit in NtUserInitialize so we can remove PrivateCsrssInitialized - Romove a reactos only syscall (NtUserGetClassLong) - Remove UserGetClassLongPtr, UserGetWindow, UserGetWindowLong, IntGetOwner. Instead access objects directly - In WINDOW_OBJECT store pointer to the ownder window instead of a handle Modified: trunk/reactos/dll/win32/user32/include/user32p.h trunk/reactos/dll/win32/user32/misc/misc.c trunk/reactos/dll/win32/user32/user32.pspec trunk/reactos/dll/win32/user32/windows/class.c trunk/reactos/dll/win32/user32/windows/window.c trunk/reactos/include/reactos/win32k/ntuser.h trunk/reactos/subsystems/win32/csrss/win32csr/dllmain.c trunk/reactos/subsystems/win32/win32k/include/class.h trunk/reactos/subsystems/win32/win32k/include/userfuncs.h trunk/reactos/subsystems/win32/win32k/include/window.h trunk/reactos/subsystems/win32/win32k/ntuser/callproc.c trunk/reactos/subsystems/win32/win32k/ntuser/class.c trunk/reactos/subsystems/win32/win32k/ntuser/defwnd.c trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c trunk/reactos/subsystems/win32/win32k/ntuser/focus.c trunk/reactos/subsystems/win32/win32k/ntuser/ntuser.c trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c trunk/reactos/subsystems/win32/win32k/ntuser/window.c trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c trunk/reactos/subsystems/win32/win32k/w32ksvc.db Modified: trunk/reactos/dll/win32/user32/include/user32p.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/include/u…
============================================================================== --- trunk/reactos/dll/win32/user32/include/user32p.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/include/user32p.h [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -33,9 +33,6 @@ #define NtUserMsqClearWakeMask() \ NtUserCallNoParam(NOPARAM_ROUTINE_MSQCLEARWAKEMASK) -#define NtUserAnyPopup() \ - (BOOL)NtUserCallNoParam(NOPARAM_ROUTINE_ANYPOPUP) - #define NtUserValidateRgn(hWnd, hRgn) \ (BOOL)NtUserCallTwoParam((DWORD_PTR)hWnd, (DWORD_PTR)hRgn, TWOPARAM_ROUTINE_VALIDATERGN) Modified: trunk/reactos/dll/win32/user32/misc/misc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/misc…
============================================================================== --- trunk/reactos/dll/win32/user32/misc/misc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/misc/misc.c [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -43,13 +43,6 @@ PrivateCsrssManualGuiCheck(LONG Check) { NtUserCallOneParam(Check, ONEPARAM_ROUTINE_CSRSS_GUICHECK); -} - -VOID -WINAPI -PrivateCsrssInitialized(VOID) -{ - NtUserCallNoParam(NOPARAM_ROUTINE_CSRSS_INITIALIZED); } Modified: trunk/reactos/dll/win32/user32/user32.pspec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/user32.ps…
============================================================================== --- trunk/reactos/dll/win32/user32/user32.pspec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/user32.pspec [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -750,7 +750,6 @@ ; ROS specific exports @ stdcall PrivateCsrssManualGuiCheck(long) -@ stdcall PrivateCsrssInitialized() ; Functions exported by Win Vista @ stdcall SetProcessDPIAware() Modified: trunk/reactos/dll/win32/user32/windows/class.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/c…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/class.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/class.c [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -423,21 +423,14 @@ } else { - /* This is a race condition! Call win32k to make sure we're getting - the correct result */ - Wnd = NULL; /* Make sure we call NtUserGetClassLong */ - WARN("Invalid class for hwnd 0x%p!\n", hWnd); } } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { - Wnd = NULL; /* Make sure we call NtUserGetClassLong */ + Ret = 0; } _SEH2_END; - - if (Wnd == NULL) - Ret = NtUserGetClassLong(hWnd, nIndex, TRUE); return Ret; } @@ -534,21 +527,13 @@ } else { - /* This is a race condition! Call win32k to make sure we're getting - the correct result */ - Wnd = NULL; /* Make sure we call NtUserGetClassLong */ - WARN("Invalid class for hwnd 0x%p!\n", hWnd); } } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { - Wnd = NULL; /* Make sure we call NtUserGetClassLong */ } _SEH2_END; - - if (Wnd == NULL) - Ret = NtUserGetClassLong(hWnd, nIndex, FALSE); return Ret; } @@ -617,18 +602,28 @@ WORD WINAPI GetClassWord( - HWND hWnd, - int nIndex) -/* - * NOTE: Obsoleted in 32-bit windows - */ -{ - TRACE("%p %x\n", hWnd, nIndex); - - if ((nIndex < 0) && (nIndex != GCW_ATOM)) + HWND hwnd, + int offset) +{ + PWND Wnd; + PCLS class; + WORD retvalue = 0; + + if (offset < 0) return GetClassLongA( hwnd, offset ); + + Wnd = ValidateHwnd(hwnd); + if (!Wnd) return 0; - return (WORD) NtUserGetClassLong ( hWnd, nIndex, TRUE ); + class = DesktopPtrToUser(Wnd->pcls); + if (class == NULL) return 0; + + if (offset <= class->cbclsExtra - sizeof(WORD)) + memcpy( &retvalue, (char *)(class + 1) + offset, sizeof(retvalue) ); + else + SetLastError( ERROR_INVALID_INDEX ); + + return retvalue; } Modified: trunk/reactos/dll/win32/user32/windows/window.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/w…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/window.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/window.c [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -1030,15 +1030,15 @@ _SEH2_TRY { WndParent = NULL; - if (Wnd->style & WS_CHILD) + if (Wnd->style & WS_POPUP) + { + if (Wnd->spwndOwner != NULL) + WndParent = DesktopPtrToUser(Wnd->spwndOwner); + } + else if (Wnd->style & WS_CHILD) { if (Wnd->spwndParent != NULL) WndParent = DesktopPtrToUser(Wnd->spwndParent); - } - else if (Wnd->style & WS_POPUP) - { - if (Wnd->spwndOwner != NULL) - WndParent = DesktopPtrToUser(Wnd->spwndOwner); } if (WndParent != NULL) @@ -1464,7 +1464,7 @@ IsChild(HWND hWndParent, HWND hWnd) { - PWND WndParent, Wnd; + PWND WndParent, DesktopWnd, Wnd; BOOL Ret = FALSE; WndParent = ValidateHwnd(hWndParent); @@ -1474,6 +1474,10 @@ if (!Wnd) return FALSE; + DesktopWnd = GetThreadDesktopWnd(); + if (!DesktopWnd) + return FALSE; + _SEH2_TRY { while (Wnd != NULL) @@ -1481,6 +1485,10 @@ if (Wnd->spwndParent != NULL) { Wnd = DesktopPtrToUser(Wnd->spwndParent); + + if(Wnd == DesktopWnd) + Wnd = NULL; + if (Wnd == WndParent) { Ret = TRUE; @@ -2062,7 +2070,18 @@ BOOL WINAPI AnyPopup(VOID) { - return NtUserAnyPopup(); + int i; + BOOL retvalue; + HWND *list = WIN_ListChildren( GetDesktopWindow() ); + + if (!list) return FALSE; + for (i = 0; list[i]; i++) + { + if (IsWindowVisible( list[i] ) && GetWindow( list[i], GW_OWNER )) break; + } + retvalue = (list[i] != 0); + HeapFree( GetProcessHeap(), 0, list ); + return retvalue; } /* Modified: trunk/reactos/include/reactos/win32k/ntuser.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntu…
============================================================================== --- trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -3135,7 +3135,6 @@ #define NOPARAM_ROUTINE_GETMESSAGEEXTRAINFO 0xffff0005 #define NOPARAM_ROUTINE_ANYPOPUP 0xffff0006 -#define NOPARAM_ROUTINE_CSRSS_INITIALIZED 0xffff0007 #define ONEPARAM_ROUTINE_CSRSS_GUICHECK 0xffff0008 #define ONEPARAM_ROUTINE_SWITCHCARETSHOWING 0xfffe0008 #define ONEPARAM_ROUTINE_ISWINDOWINDESTROY 0xfffe000c Modified: trunk/reactos/subsystems/win32/csrss/win32csr/dllmain.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/win…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/win32csr/dllmain.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/csrss/win32csr/dllmain.c [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -13,7 +13,6 @@ /* Not defined in any header file */ extern VOID WINAPI PrivateCsrssManualGuiCheck(LONG Check); -extern VOID WINAPI PrivateCsrssInitialized(); extern VOID WINAPI InitializeAppSwitchHook(); /* GLOBALS *******************************************************************/ @@ -111,8 +110,6 @@ static BOOL WINAPI Win32CsrInitComplete(void) { - PrivateCsrssInitialized(); - return TRUE; } Modified: trunk/reactos/subsystems/win32/win32k/include/class.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/class.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/class.h [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -65,11 +65,6 @@ IN HINSTANCE hInstance, OUT PCLSMENUNAME pClassMenuName); -ULONG_PTR -UserGetClassLongPtr(IN PCLS Class, - IN INT Index, - IN BOOL Ansi); - RTL_ATOM IntGetClassAtom(IN PUNICODE_STRING ClassName, IN HINSTANCE hInstance OPTIONAL, Modified: trunk/reactos/subsystems/win32/win32k/include/userfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/userfuncs.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/userfuncs.h [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -122,14 +122,10 @@ HWND FASTCALL UserGetShellWindow(VOID); -HWND FASTCALL UserGetWindow(HWND hWnd, UINT Relationship); - HDC FASTCALL UserGetDCEx(PWINDOW_OBJECT Window OPTIONAL, HANDLE ClipRegion, ULONG Flags); BOOLEAN FASTCALL co_UserDestroyWindow(PWINDOW_OBJECT Wnd); - -LONG FASTCALL UserGetWindowLong(HWND hWnd, DWORD Index, BOOL Ansi); PWINDOW_OBJECT FASTCALL UserGetAncestor(PWINDOW_OBJECT Wnd, UINT Type); Modified: trunk/reactos/subsystems/win32/win32k/include/window.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/window.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/window.h [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -37,11 +37,8 @@ struct _WINDOW_OBJECT* spwndChild; struct _WINDOW_OBJECT* spwndNext; struct _WINDOW_OBJECT* spwndPrev; - /* Handle to the parent window. */ struct _WINDOW_OBJECT* spwndParent; - /* Handle to the owner window. */ - HWND hOwner; // Use spwndOwner - + struct _WINDOW_OBJECT* spwndOwner; /* Scrollbar info */ PSBINFOEX pSBInfo; // convert to PSBINFO @@ -125,10 +122,6 @@ PWINDOW_OBJECT FASTCALL IntGetParent(PWINDOW_OBJECT Wnd); -PWINDOW_OBJECT FASTCALL -IntGetOwner(PWINDOW_OBJECT Wnd); - - INT FASTCALL IntGetWindowRgn(PWINDOW_OBJECT Window, HRGN hRgn); @@ -140,9 +133,6 @@ VOID FASTCALL IntGetWindowBorderMeasures(PWINDOW_OBJECT WindowObject, UINT *cx, UINT *cy); - -BOOL FASTCALL -IntAnyPopup(VOID); BOOL FASTCALL IntIsWindowInDestroy(PWINDOW_OBJECT Window); Modified: trunk/reactos/subsystems/win32/win32k/ntuser/callproc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/callproc.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/callproc.c [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -185,9 +185,7 @@ Example: If pWnd is created from Ansi and lpfnXxyz is assumed to be Ansi, caller will ask for Unicode Proc return Proc or CallProcData handle. - - This function should replaced NtUserGetClassLong and NtUserGetWindowLong. - */ +*/ ULONG_PTR APIENTRY NtUserGetCPD( Modified: trunk/reactos/subsystems/win32/win32k/ntuser/class.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/class.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/class.c [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -1515,96 +1515,6 @@ return Ret; } -ULONG_PTR -UserGetClassLongPtr(IN PCLS Class, - IN INT Index, - IN BOOL Ansi) -{ - ULONG_PTR Ret = 0; - - if (Index >= 0) - { - PULONG_PTR Data; - - TRACE("GetClassLong(%d)\n", Index); - if (Index + sizeof(ULONG_PTR) < Index || - Index + sizeof(ULONG_PTR) > Class->cbclsExtra) - { - SetLastWin32Error(ERROR_INVALID_PARAMETER); - return 0; - } - - Data = (PULONG_PTR)((ULONG_PTR)(Class + 1) + Index); - - /* FIXME - Data might be a unaligned pointer! Might be a problem on - certain architectures, maybe using RtlCopyMemory is a - better choice for those architectures! */ - - TRACE("Result: %x\n", Ret); - return *Data; - } - - switch (Index) - { - case GCL_CBWNDEXTRA: - Ret = (ULONG_PTR)Class->cbwndExtra; - break; - - case GCL_CBCLSEXTRA: - Ret = (ULONG_PTR)Class->cbclsExtra; - break; - - case GCLP_HBRBACKGROUND: - Ret = (ULONG_PTR)Class->hbrBackground; - break; - - case GCLP_HCURSOR: - /* FIXME - get handle from pointer to CURSOR object */ - Ret = (ULONG_PTR)Class->hCursor; - break; - - case GCLP_HICON: - /* FIXME - get handle from pointer to ICON object */ - Ret = (ULONG_PTR)Class->hIcon; - break; - - case GCLP_HICONSM: - /* FIXME - get handle from pointer to ICON object */ - Ret = (ULONG_PTR)Class->hIconSm; - break; - - case GCLP_HMODULE: - Ret = (ULONG_PTR)Class->hModule; - break; - - case GCLP_MENUNAME: - /* NOTE: Returns pointer in kernel heap! */ - if (Ansi) - Ret = (ULONG_PTR)Class->lpszClientAnsiMenuName; - else - Ret = (ULONG_PTR)Class->lpszClientUnicodeMenuName; - break; - - case GCL_STYLE: - Ret = (ULONG_PTR)Class->style; - break; - - case GCLP_WNDPROC: - Ret = (ULONG_PTR)IntGetClassWndProc(Class, Ansi); - break; - - case GCW_ATOM: - Ret = (ULONG_PTR)Class->atomClassName; - break; - - default: - SetLastWin32Error(ERROR_INVALID_INDEX); - break; - } - - return Ret; -} - static BOOL IntSetClassMenuName(IN PCLS Class, IN PUNICODE_STRING MenuName) @@ -2191,45 +2101,6 @@ } ULONG_PTR APIENTRY -NtUserGetClassLong(IN HWND hWnd, - IN INT Offset, - IN BOOL Ansi) -{ - PWINDOW_OBJECT Window; - ULONG_PTR Ret = 0; - - if (Offset != GCLP_WNDPROC) - { - UserEnterShared(); - } - else - { - UserEnterExclusive(); - } - - Window = UserGetWindowObject(hWnd); - if (Window != NULL) - { - Ret = UserGetClassLongPtr(Window->Wnd->pcls, - Offset, - Ansi); - - if ( Ret != 0 && - Offset == GCLP_MENUNAME && - Window->Wnd->pcls->MenuNameIsString) - { - Ret = (ULONG_PTR)UserHeapAddressToUser((PVOID)Ret); - } - } - - UserLeave(); - - return Ret; -} - - - -ULONG_PTR APIENTRY NtUserSetClassLong(HWND hWnd, INT Offset, ULONG_PTR dwNewLong, Modified: trunk/reactos/subsystems/win32/win32k/ntuser/defwnd.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/defwnd.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/defwnd.c [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -129,7 +129,7 @@ { if ((Wnd->style & WS_VISIBLE) && wParam) break; if (!(Wnd->style & WS_VISIBLE) && !wParam) break; - if (!Window->hOwner) break; + if (!Window->spwndOwner) break; if (LOWORD(lParam)) { if (wParam) Modified: trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -1423,7 +1423,7 @@ RETURN(FALSE); } - DesktopBrush = (HBRUSH)UserGetClassLongPtr(WndDesktop->Wnd->pcls, GCL_HBRBACKGROUND, FALSE); + DesktopBrush = (HBRUSH)WndDesktop->Wnd->pcls->hbrBackground; /* Modified: trunk/reactos/subsystems/win32/win32k/ntuser/focus.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/focus.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/focus.c [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -51,12 +51,14 @@ VOID FASTCALL co_IntSendDeactivateMessages(HWND hWndPrev, HWND hWnd) { - if (hWndPrev) + PWINDOW_OBJECT WndPrev ; + + if (hWndPrev && (WndPrev = UserGetWindowObject(hWndPrev))) { co_IntSendMessageNoWait(hWndPrev, WM_NCACTIVATE, FALSE, 0); co_IntSendMessageNoWait(hWndPrev, WM_ACTIVATE, - MAKEWPARAM(WA_INACTIVE, UserGetWindowLong(hWndPrev, GWL_STYLE, FALSE) & WS_MINIMIZE), - (LPARAM)hWnd); + MAKEWPARAM(WA_INACTIVE, WndPrev->Wnd->style & WS_MINIMIZE), + (LPARAM)hWnd); } } @@ -83,11 +85,11 @@ 0); } - if (UserGetWindow(hWnd, GW_HWNDPREV) != NULL) + if (Window->spwndPrev != NULL) co_WinPosSetWindowPos(Window, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOSENDCHANGING); - if (!IntGetOwner(Window) && !IntGetParent(Window)) + if (!Window->spwndOwner && !IntGetParent(Window)) { co_IntShellHookNotify(HSHELL_WINDOWACTIVATED, (LPARAM) hWnd); } @@ -153,7 +155,7 @@ /* FIXME: WA_CLICKACTIVE */ co_IntSendMessageNoWait(hWnd, WM_ACTIVATE, MAKEWPARAM(MouseActivate ? WA_CLICKACTIVE : WA_ACTIVE, - UserGetWindowLong(hWnd, GWL_STYLE, FALSE) & WS_MINIMIZE), + Window->Wnd->style & WS_MINIMIZE), (LPARAM)hWndPrev); } } @@ -184,7 +186,7 @@ for(Child = Root->spwndChild; Child; Child = Child->spwndNext) { - OwnerWnd = UserGetWindowObject(Child->hOwner); + OwnerWnd = Child->spwndOwner; if(!OwnerWnd) continue; Modified: trunk/reactos/subsystems/win32/win32k/ntuser/ntuser.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/ntuser.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/ntuser.c [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -124,6 +124,8 @@ NtUserUpdatePerUserSystemParameters(0, TRUE); + CsrInit(); + return STATUS_SUCCESS; } Modified: trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -108,14 +108,6 @@ case NOPARAM_ROUTINE_GETMESSAGEEXTRAINFO: Result = (DWORD_PTR)MsqGetMessageExtraInfo(); - break; - - case NOPARAM_ROUTINE_ANYPOPUP: - Result = (DWORD_PTR)IntAnyPopup(); - break; - - case NOPARAM_ROUTINE_CSRSS_INITIALIZED: - Result = (DWORD_PTR)CsrInit(); break; case NOPARAM_ROUTINE_MSQCLEARWAKEMASK: @@ -525,7 +517,7 @@ SWP_NOZORDER| SWP_NOACTIVATE| SWP_FRAMECHANGED ); - if (!IntGetOwner(Window) && !IntGetParent(Window)) + if (!Window->spwndOwner && !IntGetParent(Window)) { co_IntShellHookNotify(HSHELL_REDRAW, (LPARAM) hWnd); } Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -96,6 +96,8 @@ ASSERT(Window->head.cLockObj >= 0); Window->head.cLockObj++; + + ASSERT(Window->Wnd); } return Window; } @@ -130,6 +132,9 @@ } ASSERT(Window->head.cLockObj >= 0); + + ASSERT(Window->Wnd); + return Window; } @@ -163,20 +168,12 @@ -/* - Caller must NOT dereference retval! - But if caller want the returned value to persist spanning a co_ call, - it must reference the value (because the owner is not garanteed to - exist just because the owned window exist)! -*/ PWINDOW_OBJECT FASTCALL IntGetParent(PWINDOW_OBJECT Wnd) { - if (!Wnd->Wnd) return NULL; - if (Wnd->Wnd->style & WS_POPUP) { - return UserGetWindowObject(Wnd->hOwner); + return Wnd->spwndOwner; } else if (Wnd->Wnd->style & WS_CHILD) { @@ -185,20 +182,6 @@ return NULL; } - - -/* - Caller must NOT dereference retval! - But if caller want the returned value to persist spanning a co_ call, - it must reference the value (because the owner is not garanteed to - exist just because the owned window exist)! -*/ -PWINDOW_OBJECT FASTCALL -IntGetOwner(PWINDOW_OBJECT Wnd) -{ - return UserGetWindowObject(Wnd->hOwner); -} - /* @@ -265,7 +248,7 @@ // USER_REFERENCE_ENTRY Ref; // UserRefObjectCo(Window, &Ref); - if (!IntGetOwner(Window) && !IntGetParent(Window)) + if (!Window->spwndOwner && !IntGetParent(Window)) { co_IntShellHookNotify(HSHELL_WINDOWDESTROYED, (LPARAM) hWnd); } @@ -1091,26 +1074,19 @@ if(!Wnd) return NULL; - WndOldOwner = IntGetWindowObject(Wnd->hOwner); - if (WndOldOwner) - { - ret = WndOldOwner->hSelf; - UserDereferenceObject(WndOldOwner); + WndOldOwner = Wnd->spwndOwner; + + ret = WndOldOwner ? WndOldOwner->hSelf : 0; + + if((WndNewOwner = UserGetWindowObject(hWndNewOwner))) + { + Wnd->spwndOwner= WndNewOwner; + Wnd->Wnd->spwndOwner = WndNewOwner->Wnd; } else { - ret = 0; - } - - if((WndNewOwner = UserGetWindowObject(hWndNewOwner))) - { - Wnd->hOwner = hWndNewOwner; - Wnd->Wnd->spwndOwner = WndNewOwner->Wnd; - } - else - { - Wnd->hOwner = NULL; - Wnd->Wnd->spwndOwner = NULL; + Wnd->spwndOwner = NULL; + Wnd->Wnd->spwndOwner = NULL; } UserDereferenceObject(Wnd); @@ -1277,31 +1253,6 @@ WndParent->spwndChild = Wnd->spwndNext; Wnd->spwndPrev = Wnd->spwndNext = Wnd->spwndParent = NULL; -} - -BOOL FASTCALL -IntAnyPopup(VOID) -{ - PWINDOW_OBJECT Window, Child; - - if(!(Window = UserGetWindowObject(IntGetDesktopWindow()))) - { - return FALSE; - } - - for(Child = Window->spwndChild; Child; Child = Child->spwndNext) - { - if(Child->hOwner && Child->Wnd->style & WS_VISIBLE) - { - /* - * The desktop has a popup window if one of them has - * an owner window and is visible - */ - return TRUE; - } - } - - return FALSE; } BOOL FASTCALL @@ -1511,7 +1462,7 @@ Window = CONTAINING_RECORD(Current, WINDOW_OBJECT, ThreadListEntry); ASSERT(Window); - if(bChildren || Window->hOwner != NULL) + if(bChildren || Window->spwndOwner != NULL) { if(dwCount < *pBufSize && pWnd) { @@ -1737,7 +1688,7 @@ Window->pti = pti; Window->hSelf = hWnd; Window->spwndParent = ParentWindow; - Window->hOwner = OwnerWindow ? OwnerWindow->hSelf : NULL; + Window->spwndOwner = OwnerWindow; Wnd->head.h = hWnd; Wnd->head.pti = pti; @@ -2560,7 +2511,7 @@ Child = UserGetWindowObject(*ChildHandle); if (Child == NULL) continue; - if (Child->hOwner != Window->hSelf) + if (Child->spwndOwner != Window) { continue; } @@ -2576,9 +2527,9 @@ continue; } - if (Child->hOwner != NULL) + if (Child->spwndOwner != NULL) { - Child->hOwner = NULL; + Child->spwndOwner = NULL; Child->Wnd->spwndOwner = NULL; } @@ -3041,9 +2992,6 @@ break; } - //temp hack -// UserDereferenceObject(Parent); - WndAncestor = Parent; } break; @@ -3374,7 +3322,7 @@ NtUserSetShellWindowEx(HWND hwndShell, HWND hwndListView) { PWINSTATION_OBJECT WinStaObject; - PWINDOW_OBJECT WndShell; + PWINDOW_OBJECT WndShell, WndListView; DECLARE_RETURN(BOOL); USER_REFERENCE_ENTRY Ref; NTSTATUS Status; @@ -3384,6 +3332,11 @@ UserEnterExclusive(); if (!(WndShell = UserGetWindowObject(hwndShell))) + { + RETURN(FALSE); + } + + if(!(WndListView = UserGetWindowObject(hwndListView))) { RETURN(FALSE); } @@ -3421,14 +3374,14 @@ co_WinPosSetWindowPos(hwndListView, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE); #endif - if (UserGetWindowLong(hwndListView, GWL_EXSTYLE, FALSE) & WS_EX_TOPMOST) + if (WndListView->Wnd->ExStyle & WS_EX_TOPMOST) { ObDereferenceObject(WinStaObject); RETURN( FALSE); } } - if (UserGetWindowLong(hwndShell, GWL_EXSTYLE, FALSE) & WS_EX_TOPMOST) + if (WndShell->Wnd->ExStyle & WS_EX_TOPMOST) { ObDereferenceObject(WinStaObject); RETURN( FALSE); @@ -3553,162 +3506,6 @@ END_CLEANUP; } -HWND FASTCALL -UserGetWindow(HWND hWnd, UINT Relationship) -{ - PWINDOW_OBJECT Parent, Window; - HWND hWndResult = NULL; - - if (!(Window = UserGetWindowObject(hWnd))) - return NULL; - - switch (Relationship) - { - case GW_HWNDFIRST: - if((Parent = Window->spwndParent)) - { - if (Parent->spwndChild) - hWndResult = Parent->spwndChild->hSelf; - } - break; - - case GW_HWNDLAST: - if((Parent = Window->spwndParent)) - { - if (Parent->spwndChild) - { - Window = Parent->spwndChild; - if(Window) - { - while(Window->spwndNext) - Window = Window->spwndNext; - } - hWndResult = Window->hSelf; - } - } - break; - - case GW_HWNDNEXT: - if (Window->spwndNext) - hWndResult = Window->spwndNext->hSelf; - break; - - case GW_HWNDPREV: - if (Window->spwndPrev) - hWndResult = Window->spwndPrev->hSelf; - break; - - case GW_OWNER: - if((Parent = UserGetWindowObject(Window->hOwner))) - { - hWndResult = Parent->hSelf; - } - break; - case GW_CHILD: - if (Window->spwndChild) - hWndResult = Window->spwndChild->hSelf; - break; - } - - return hWndResult; -} - -/* - * NtUserGetWindowLong - * - * The NtUserGetWindowLong function retrieves information about the specified - * window. The function also retrieves the 32-bit (long) value at the - * specified offset into the extra window memory. - * - * Status - * @implemented - */ - -LONG FASTCALL -UserGetWindowLong(HWND hWnd, DWORD Index, BOOL Ansi) -{ - PWINDOW_OBJECT Window, Parent; - PWND Wnd; - LONG Result = 0; - - DPRINT("NtUserGetWindowLong(%x,%d,%d)\n", hWnd, (INT)Index, Ansi); - - if (!(Window = UserGetWindowObject(hWnd)) || !Window->Wnd) - { - return 0; - } - - Wnd = Window->Wnd; - - /* - * WndProc is only available to the owner process - */ - if (GWL_WNDPROC == Index - && Window->pti->pEThread->ThreadsProcess != PsGetCurrentProcess()) - { - SetLastWin32Error(ERROR_ACCESS_DENIED); - return 0; - } - - if ((INT)Index >= 0) - { - if ((Index + sizeof(LONG)) > Window->Wnd->cbwndExtra) - { - SetLastWin32Error(ERROR_INVALID_PARAMETER); - return 0; - } - Result = *((LONG *)((PCHAR)(Window->Wnd + 1) + Index)); - } - else - { - switch (Index) - { - case GWL_EXSTYLE: - Result = Wnd->ExStyle; - break; - - case GWL_STYLE: - Result = Wnd->style; - break; - - case GWL_WNDPROC: - Result = (LONG)IntGetWindowProc(Wnd, Ansi); - break; - - case GWL_HINSTANCE: - Result = (LONG) Wnd->hModule; - break; - - case GWL_HWNDPARENT: - Parent = Window->spwndParent; - if(Parent) - { - if (Parent && Parent->hSelf == IntGetDesktopWindow()) - Result = (LONG) UserGetWindow(Window->hSelf, GW_OWNER); - else - Result = (LONG) Parent->hSelf; - } - break; - - case GWL_ID: - Result = (LONG) Wnd->IDMenu; - break; - - case GWL_USERDATA: - Result = Wnd->dwUserData; - break; - - default: - DPRINT1("NtUserGetWindowLong(): Unsupported index %d\n", Index); - SetLastWin32Error(ERROR_INVALID_PARAMETER); - Result = 0; - break; - } - } - - return Result; -} - LONG FASTCALL co_UserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi) { @@ -4807,7 +4604,7 @@ // In User32, these are called after: NotifyWinEvent EVENT_OBJECT_NAMECHANGE than // RepaintButton, StaticRepaint, NtUserCallHwndLock HWNDLOCK_ROUTINE_REDRAWFRAMEANDHOOK, etc. /* Send shell notifications */ - if (!IntGetOwner(Window) && !IntGetParent(Window)) + if (!Window->spwndOwner && !IntGetParent(Window)) { co_IntShellHookNotify(HSHELL_REDRAW, (LPARAM) hWnd); } @@ -4908,11 +4705,10 @@ count++; while (--count >= 0) { - if (UserGetWindow( win_array[count], GW_OWNER ) != OwnerWnd->hSelf) - continue; if (!(pWnd = UserGetWindowObject( win_array[count] ))) continue; - // if (pWnd == WND_OTHER_PROCESS) continue; + if (pWnd->spwndOwner != OwnerWnd) + continue; if (fShow) { Modified: trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -151,7 +151,7 @@ } /* If this is popup window, try to activate the owner first. */ - if ((Wnd->style & WS_POPUP) && (WndTo = IntGetOwner(Window))) + if ((Wnd->style & WS_POPUP) && (WndTo = Window->spwndOwner)) { WndTo = UserGetAncestor( WndTo, GA_ROOT ); if (can_activate_window(WndTo)) goto done; @@ -741,10 +741,14 @@ WinPosDoOwnedPopups(HWND hWnd, HWND hWndInsertAfter) { HWND *List = NULL; - HWND Owner = UserGetWindow(hWnd, GW_OWNER); - LONG Style = UserGetWindowLong(hWnd, GWL_STYLE, FALSE); - PWINDOW_OBJECT DesktopWindow, ChildObject; + HWND Owner; + LONG Style; + PWINDOW_OBJECT Window ,DesktopWindow, ChildObject; int i; + + Window = UserGetWindowObject(hWnd); + Owner = Window->spwndOwner ? Window->spwndOwner->hSelf : NULL; + Style = Window->Wnd->style; if ((Style & WS_POPUP) && Owner) { @@ -804,8 +808,7 @@ if (!(Wnd = UserGetWindowObject(List[i]))) continue; - if ((Wnd->Wnd->style & WS_POPUP) && - UserGetWindow(List[i], GW_OWNER) == hWnd) + if (Wnd->Wnd->style & WS_POPUP && Wnd->spwndOwner == Window) { USER_REFERENCE_ENTRY Ref; UserRefObjectCo(Wnd, &Ref); @@ -958,7 +961,7 @@ * itself. */ if ((WinPos->hwnd == WinPos->hwndInsertAfter) || - (WinPos->hwnd == UserGetWindow(WinPos->hwndInsertAfter, GW_HWNDNEXT))) + (WinPos->hwnd == InsAfterWnd->spwndNext->hSelf)) { WinPos->flags |= SWP_NOZORDER; } Modified: trunk/reactos/subsystems/win32/win32k/w32ksvc.db URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/w3…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/w32ksvc.db [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/w32ksvc.db [iso-8859-1] Thu Jun 3 18:12:43 2010 @@ -684,7 +684,6 @@ # NtUserBuildMenuItemList 4 NtUserCreateCursorIconHandle 2 -NtUserGetClassLong 3 NtUserGetMenuDefaultItem 3 NtUserGetLastInputInfo 1 NtUserGetMinMaxInfo 3
14 years, 6 months
1
0
0
0
[tkreuzer] 47543: [DDK] Make RtlLargeIntegerDivide FORCEINLINE instead of __inline to avoid multiple definitions
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Jun 3 17:57:52 2010 New Revision: 47543 URL:
http://svn.reactos.org/svn/reactos?rev=47543&view=rev
Log: [DDK] Make RtlLargeIntegerDivide FORCEINLINE instead of __inline to avoid multiple definitions Modified: trunk/reactos/include/ddk/ntddk.h Modified: trunk/reactos/include/ddk/ntddk.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/ntddk.h?rev=47…
============================================================================== --- trunk/reactos/include/ddk/ntddk.h [iso-8859-1] (original) +++ trunk/reactos/include/ddk/ntddk.h [iso-8859-1] Thu Jun 3 17:57:52 2010 @@ -2772,7 +2772,7 @@ #if defined(_AMD64_) || defined(_IA64_) //DECLSPEC_DEPRECATED_DDK_WINXP -__inline +FORCEINLINE LARGE_INTEGER NTAPI_INLINE RtlLargeIntegerDivide(
14 years, 6 months
1
0
0
0
← Newer
1
...
34
35
36
37
38
39
40
41
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
Results per page:
10
25
50
100
200