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
2025
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
April 2007
----- 2025 -----
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
19 participants
380 discussions
Start a n
N
ew thread
[dgorbachev] 26283: Fix "registry error" bug (see bugzilla report #1998).
by dgorbachev@svn.reactos.org
Author: dgorbachev Date: Sun Apr 8 18:57:34 2007 New Revision: 26283 URL:
http://svn.reactos.org/svn/reactos?rev=26283&view=rev
Log: Fix "registry error" bug (see bugzilla report #1998). Modified: trunk/reactos/ntoskrnl/cm/ntfunc.c Modified: trunk/reactos/ntoskrnl/cm/ntfunc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/ntfunc.c?rev=2…
============================================================================== --- trunk/reactos/ntoskrnl/cm/ntfunc.c (original) +++ trunk/reactos/ntoskrnl/cm/ntfunc.c Sun Apr 8 18:57:34 2007 @@ -120,10 +120,8 @@ Handle = ObMarkHandleAsKernelHandle(Handle); } - if(InterlockedIncrement(&ObjectHeader->HandleCount) == 1) - { - ObReferenceObject(ObjectBody); - } + InterlockedIncrement(&ObjectHeader->HandleCount); + ObReferenceObject(ObjectBody); *HandleReturn = Handle; @@ -578,7 +576,7 @@ } if (ObjectName.Buffer) ObpFreeObjectNameBuffer(&ObjectName); if (FreeRemainingPath) RtlFreeUnicodeString(&RemainingPath); - //if (Object != NULL) ObDereferenceObject(Object); + if (Object != NULL) ObDereferenceObject(Object); return Status; }
17 years, 9 months
1
0
0
0
[greatlrd] 26282: fixing smaller bugs in NtGdiDdWaitForVerticalBlank now it is compatible with windows 2000 in all my test case.
by greatlrd@svn.reactos.org
Author: greatlrd Date: Sun Apr 8 16:05:22 2007 New Revision: 26282 URL:
http://svn.reactos.org/svn/reactos?rev=26282&view=rev
Log: fixing smaller bugs in NtGdiDdWaitForVerticalBlank now it is compatible with windows 2000 in all my test case. Modified: trunk/reactos/subsystems/win32/win32k/ntddraw/dd.c Modified: trunk/reactos/subsystems/win32/win32k/ntddraw/dd.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntddraw/dd.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntddraw/dd.c Sun Apr 8 16:05:22 2007 @@ -386,45 +386,52 @@ PDD_DIRECTDRAW pDirectDraw = NULL; NTSTATUS Status = FALSE; DD_WAITFORVERTICALBLANKDATA WaitForVerticalBlankData; - - DPRINT1("NtGdiDdWaitForVerticalBlank\n"); - - _SEH_TRY - { - ProbeForRead(puWaitForVerticalBlankData, sizeof(DD_WAITFORVERTICALBLANKDATA), 1); - RtlCopyMemory(&WaitForVerticalBlankData,puWaitForVerticalBlankData, sizeof(DD_WAITFORVERTICALBLANKDATA)); - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - - if(NT_SUCCESS(Status)) - { - pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); - - if (pDirectDraw != NULL) - { - if (pDirectDraw->DD.dwFlags & DDHAL_CB32_WAITFORVERTICALBLANK) - { - WaitForVerticalBlankData.ddRVal = DDERR_GENERIC; - WaitForVerticalBlankData.lpDD = &pDirectDraw->Global;; - ddRVal = pDirectDraw->DD.WaitForVerticalBlank(&WaitForVerticalBlankData); - } - _SEH_TRY - { - ProbeForWrite(puWaitForVerticalBlankData, sizeof(DD_WAITFORVERTICALBLANKDATA), 1); - puWaitForVerticalBlankData->ddRVal = WaitForVerticalBlankData.ddRVal; - puWaitForVerticalBlankData->bIsInVB = WaitForVerticalBlankData.bIsInVB; - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - - GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); + LPDDHAL_WAITFORVERTICALBLANKDATA pWaitForVerticalBlankData = (LPDDHAL_WAITFORVERTICALBLANKDATA)puWaitForVerticalBlankData; + + if ((hDirectDrawLocal) && + (puWaitForVerticalBlankData)) + { + RtlZeroMemory(&WaitForVerticalBlankData,sizeof(DD_WAITFORVERTICALBLANKDATA)); + + _SEH_TRY + { + ProbeForRead(pWaitForVerticalBlankData, sizeof(DDHAL_WAITFORVERTICALBLANKDATA), 1); + WaitForVerticalBlankData.dwFlags = pWaitForVerticalBlankData->dwFlags; + WaitForVerticalBlankData.bIsInVB = pWaitForVerticalBlankData->bIsInVB; + WaitForVerticalBlankData.hEvent = pWaitForVerticalBlankData->hEvent; + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + + if(NT_SUCCESS(Status)) + { + pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); + + if (pDirectDraw != NULL) + { + if (pDirectDraw->DD.dwFlags & DDHAL_CB32_WAITFORVERTICALBLANK) + { + WaitForVerticalBlankData.ddRVal = DDERR_GENERIC; + WaitForVerticalBlankData.lpDD = &pDirectDraw->Global;; + ddRVal = pDirectDraw->DD.WaitForVerticalBlank(&WaitForVerticalBlankData); + } + _SEH_TRY + { + ProbeForWrite(pWaitForVerticalBlankData, sizeof(DDHAL_WAITFORVERTICALBLANKDATA), 1); + pWaitForVerticalBlankData->ddRVal = WaitForVerticalBlankData.ddRVal; + pWaitForVerticalBlankData->bIsInVB = WaitForVerticalBlankData.bIsInVB; + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); + } } } return ddRVal;
17 years, 9 months
1
0
0
0
[ekohl] 26281: Add caret blink time setting.
by ekohl@svn.reactos.org
Author: ekohl Date: Sun Apr 8 14:18:24 2007 New Revision: 26281 URL:
http://svn.reactos.org/svn/reactos?rev=26281&view=rev
Log: Add caret blink time setting. Modified: trunk/reactos/dll/cpl/main/keyboard.c Modified: trunk/reactos/dll/cpl/main/keyboard.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/main/keyboard.c?re…
============================================================================== --- trunk/reactos/dll/cpl/main/keyboard.c (original) +++ trunk/reactos/dll/cpl/main/keyboard.c Sun Apr 8 14:18:24 2007 @@ -37,6 +37,7 @@ { INT nKeyboardDelay; DWORD dwKeyboardSpeed; + UINT uCaretBlinkTime; } SPEED_DATA, *PSPEED_DATA; @@ -76,11 +77,17 @@ pSpeedData->dwKeyboardSpeed = 31; } + /* Get the caret blink time */ + pSpeedData->uCaretBlinkTime = GetCaretBlinkTime(); + SendDlgItemMessage(hwndDlg, IDC_SLIDER_REPEAT_DELAY, TBM_SETRANGE, (WPARAM)TRUE, (LPARAM)MAKELONG(0, 3)); SendDlgItemMessage(hwndDlg, IDC_SLIDER_REPEAT_DELAY, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)(3 - pSpeedData->nKeyboardDelay)); SendDlgItemMessage(hwndDlg, IDC_SLIDER_REPEAT_RATE, TBM_SETRANGE, (WPARAM)TRUE, (LPARAM)MAKELONG(0, 31)); SendDlgItemMessage(hwndDlg, IDC_SLIDER_REPEAT_RATE, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)pSpeedData->dwKeyboardSpeed); + + SendDlgItemMessage(hwndDlg, IDC_SLIDER_CURSOR_BLINK, TBM_SETRANGE, (WPARAM)TRUE, (LPARAM)MAKELONG(0, 10)); + SendDlgItemMessage(hwndDlg, IDC_SLIDER_CURSOR_BLINK, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)(12 - (pSpeedData->uCaretBlinkTime / 100))); break; @@ -127,7 +134,27 @@ break; } } - + else if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SLIDER_CURSOR_BLINK)) + { + switch (LOWORD(wParam)) + { + case TB_LINEUP: + case TB_LINEDOWN: + case TB_PAGEUP: + case TB_PAGEDOWN: + case TB_TOP: + case TB_BOTTOM: + case TB_ENDTRACK: + pSpeedData->uCaretBlinkTime = (12 - (UINT)SendDlgItemMessage(hwndDlg, IDC_SLIDER_CURSOR_BLINK, TBM_GETPOS, 0, 0)) * 100; + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + break; + + case TB_THUMBTRACK: + pSpeedData->uCaretBlinkTime = (12 - (UINT)HIWORD(wParam)) * 100; + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + break; + } + } break; case WM_NOTIFY: @@ -137,10 +164,13 @@ switch(lpnm->code) { case PSN_APPLY: + SetCaretBlinkTime(pSpeedData->uCaretBlinkTime); + SystemParametersInfo(SPI_SETKEYBOARDDELAY, pSpeedData->nKeyboardDelay, 0, 0); + SystemParametersInfo(SPI_SETKEYBOARDSPEED, pSpeedData->dwKeyboardSpeed, 0,
17 years, 9 months
1
0
0
0
[ekohl] 26280: - Add missing keyboard speed dialog resources. - Implement keyboard repeat delay and repeat rate settings.
by ekohl@svn.reactos.org
Author: ekohl Date: Sun Apr 8 03:10:58 2007 New Revision: 26280 URL:
http://svn.reactos.org/svn/reactos?rev=26280&view=rev
Log: - Add missing keyboard speed dialog resources. - Implement keyboard repeat delay and repeat rate settings. Modified: trunk/reactos/dll/cpl/main/De.rc trunk/reactos/dll/cpl/main/Es.rc trunk/reactos/dll/cpl/main/Hu.rc trunk/reactos/dll/cpl/main/Ja.rc trunk/reactos/dll/cpl/main/Nl.rc trunk/reactos/dll/cpl/main/keyboard.c Modified: trunk/reactos/dll/cpl/main/De.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/main/De.rc?rev=262…
============================================================================== --- trunk/reactos/dll/cpl/main/De.rc (original) +++ trunk/reactos/dll/cpl/main/De.rc Sun Apr 8 03:10:58 2007 @@ -7,7 +7,23 @@ CAPTION "Geschwindigkeit" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Tastaturgeschwindigkeit",-1,73,74,130,8 + GROUPBOX "Zeichenwiederholung", -1, 5, 5, 230, 130 + ICON -1, IDC_ICON_REPEAT_DELAY, 15, 15, 15, 15 + LTEXT "&Verzögerung:", -1, 40, 15, 50, 10 + LTEXT "Lang", -1, 40, 30, 24, 10 + LTEXT "Kurz", -1, 200, 30, 24, 10 + CONTROL "",IDC_SLIDER_REPEAT_DELAY, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 65, 30, 130, 17 + ICON -1, IDC_ICON_REPEAT_RATE, 15, 70, 15, 15 + LTEXT "&Wiederholrate:", -1, 40, 70, 50, 10 + LTEXT "Niedrig", -1, 40, 85, 24, 10 + LTEXT "Hoch", -1, 200, 85, 24, 10 + CONTROL "",IDC_SLIDER_REPEAT_RATE, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 65, 85, 130, 17 + LTEXT "&Klicken Sie hier, und drücken Sie zum Testen eine Taste:", -1, 15, 105, 180, 10 + EDITTEXT IDC_EDIT_REPEAT_RATE, 15, 115, 200, 15, WS_CHILD | WS_VISIBLE | WS_GROUP + GROUPBOX "&Cursorblinkgeschwindgkeit", -1, 5, 145, 230, 50 + LTEXT "Langsam", -1, 35, 165, 33, 10 + LTEXT "Schnell", -1, 200, 165, 33, 10 + CONTROL "",IDC_SLIDER_CURSOR_BLINK, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 65, 165, 130, 17 END IDD_HARDWARE DIALOGEX 0, 0, 246, 228 Modified: trunk/reactos/dll/cpl/main/Es.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/main/Es.rc?rev=262…
============================================================================== --- trunk/reactos/dll/cpl/main/Es.rc (original) +++ trunk/reactos/dll/cpl/main/Es.rc Sun Apr 8 03:10:58 2007 @@ -5,7 +5,23 @@ CAPTION "Velocidad" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Velocidad del teclado",-1,73,74,90,8 + GROUPBOX "Character repeat", -1, 5, 5, 230, 130 + ICON -1, IDC_ICON_REPEAT_DELAY, 15, 15, 15, 15 + LTEXT "Repeat &delay", -1, 40, 15, 50, 10 + LTEXT "Long", -1, 40, 30, 20, 10 + LTEXT "Short", -1, 200, 30, 20, 10 + CONTROL "",IDC_SLIDER_REPEAT_DELAY, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 65, 30, 130, 17 + ICON -1, IDC_ICON_REPEAT_RATE, 15, 70, 15, 15 + LTEXT "&Repeat rate", -1, 40, 70, 50, 10 + LTEXT "Slow", -1, 40, 85, 20, 10 + LTEXT "Fast", -1, 200, 85, 20, 10 + CONTROL "",IDC_SLIDER_REPEAT_RATE, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 65, 85, 130, 17 + LTEXT "Click here and hold down a key to &test repeat rate:", -1, 15, 105, 150, 10 + EDITTEXT IDC_EDIT_REPEAT_RATE, 15, 115, 200, 15, WS_CHILD | WS_VISIBLE | WS_GROUP + GROUPBOX "Cursor &blink rate:", -1, 5, 145, 230, 50 + LTEXT "None", -1, 40, 165, 30, 10 + LTEXT "Fast", -1, 200, 165, 30, 10 + CONTROL "",IDC_SLIDER_CURSOR_BLINK, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 65, 165, 130, 17 END IDD_HARDWARE DIALOGEX 0, 0, 246, 228 Modified: trunk/reactos/dll/cpl/main/Hu.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/main/Hu.rc?rev=262…
============================================================================== --- trunk/reactos/dll/cpl/main/Hu.rc (original) +++ trunk/reactos/dll/cpl/main/Hu.rc Sun Apr 8 03:10:58 2007 @@ -5,7 +5,23 @@ CAPTION "Érzékenység" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Billentyûzet beállítások",-1,73,74,90,8 + GROUPBOX "Character repeat", -1, 5, 5, 230, 130 + ICON -1, IDC_ICON_REPEAT_DELAY, 15, 15, 15, 15 + LTEXT "Repeat &delay", -1, 40, 15, 50, 10 + LTEXT "Long", -1, 40, 30, 20, 10 + LTEXT "Short", -1, 200, 30, 20, 10 + CONTROL "",IDC_SLIDER_REPEAT_DELAY, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 65, 30, 130, 17 + ICON -1, IDC_ICON_REPEAT_RATE, 15, 70, 15, 15 + LTEXT "&Repeat rate", -1, 40, 70, 50, 10 + LTEXT "Slow", -1, 40, 85, 20, 10 + LTEXT "Fast", -1, 200, 85, 20, 10 + CONTROL "",IDC_SLIDER_REPEAT_RATE, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 65, 85, 130, 17 + LTEXT "Click here and hold down a key to &test repeat rate:", -1, 15, 105, 150, 10 + EDITTEXT IDC_EDIT_REPEAT_RATE, 15, 115, 200, 15, WS_CHILD | WS_VISIBLE | WS_GROUP + GROUPBOX "Cursor &blink rate:", -1, 5, 145, 230, 50 + LTEXT "None", -1, 40, 165, 30, 10 + LTEXT "Fast", -1, 200, 165, 30, 10 + CONTROL "",IDC_SLIDER_CURSOR_BLINK, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 65, 165, 130, 17 END IDD_HARDWARE DIALOGEX 0, 0, 246, 228 Modified: trunk/reactos/dll/cpl/main/Ja.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/main/Ja.rc?rev=262…
============================================================================== --- trunk/reactos/dll/cpl/main/Ja.rc (original) +++ trunk/reactos/dll/cpl/main/Ja.rc Sun Apr 8 03:10:58 2007 @@ -5,7 +5,23 @@ CAPTION "Speed" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Keyboard Speed Page",-1,73,74,90,8 + GROUPBOX "Character repeat", -1, 5, 5, 230, 130 + ICON -1, IDC_ICON_REPEAT_DELAY, 15, 15, 15, 15 + LTEXT "Repeat &delay", -1, 40, 15, 50, 10 + LTEXT "Long", -1, 40, 30, 20, 10 + LTEXT "Short", -1, 200, 30, 20, 10 + CONTROL "",IDC_SLIDER_REPEAT_DELAY, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 65, 30, 130, 17 + ICON -1, IDC_ICON_REPEAT_RATE, 15, 70, 15, 15 + LTEXT "&Repeat rate", -1, 40, 70, 50, 10 + LTEXT "Slow", -1, 40, 85, 20, 10 + LTEXT "Fast", -1, 200, 85, 20, 10 + CONTROL "",IDC_SLIDER_REPEAT_RATE, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 65, 85, 130, 17 + LTEXT "Click here and hold down a key to &test repeat rate:", -1, 15, 105, 150, 10 + EDITTEXT IDC_EDIT_REPEAT_RATE, 15, 115, 200, 15, WS_CHILD | WS_VISIBLE | WS_GROUP + GROUPBOX "Cursor &blink rate:", -1, 5, 145, 230, 50 + LTEXT "None", -1, 40, 165, 30, 10 + LTEXT "Fast", -1, 200, 165, 30, 10 + CONTROL "",IDC_SLIDER_CURSOR_BLINK, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 65, 165, 130, 17 END IDD_HARDWARE DIALOGEX 0, 0, 246, 228 Modified: trunk/reactos/dll/cpl/main/Nl.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/main/Nl.rc?rev=262…
============================================================================== --- trunk/reactos/dll/cpl/main/Nl.rc (original) +++ trunk/reactos/dll/cpl/main/Nl.rc Sun Apr 8 03:10:58 2007 @@ -4,7 +4,23 @@ CAPTION "Speed" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Keyboard Speed Page",-1,73,74,90,8 + GROUPBOX "Character repeat", -1, 5, 5, 230, 130 + ICON -1, IDC_ICON_REPEAT_DELAY, 15, 15, 15, 15 + LTEXT "Repeat &delay", -1, 40, 15, 50, 10 + LTEXT "Long", -1, 40, 30, 20, 10 + LTEXT "Short", -1, 200, 30, 20, 10 + CONTROL "",IDC_SLIDER_REPEAT_DELAY, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 65, 30, 130, 17 + ICON -1, IDC_ICON_REPEAT_RATE, 15, 70, 15, 15 + LTEXT "&Repeat rate", -1, 40, 70, 50, 10 + LTEXT "Slow", -1, 40, 85, 20, 10 + LTEXT "Fast", -1, 200, 85, 20, 10 + CONTROL "",IDC_SLIDER_REPEAT_RATE, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 65, 85, 130, 17 + LTEXT "Click here and hold down a key to &test repeat rate:", -1, 15, 105, 150, 10 + EDITTEXT IDC_EDIT_REPEAT_RATE, 15, 115, 200, 15, WS_CHILD | WS_VISIBLE | WS_GROUP + GROUPBOX "Cursor &blink rate:", -1, 5, 145, 230, 50 + LTEXT "None", -1, 40, 165, 30, 10 + LTEXT "Fast", -1, 200, 165, 30, 10 + CONTROL "",IDC_SLIDER_CURSOR_BLINK, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 65, 165, 130, 17 END IDD_HARDWARE DIALOGEX 0, 0, 246, 228 Modified: trunk/reactos/dll/cpl/main/keyboard.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/main/keyboard.c?re…
============================================================================== --- trunk/reactos/dll/cpl/main/keyboard.c (original) +++ trunk/reactos/dll/cpl/main/keyboard.c Sun Apr 8 03:10:58 2007 @@ -33,20 +33,128 @@ #include "main.h" #include "resource.h" +typedef struct _SPEED_DATA +{ + INT nKeyboardDelay; + DWORD dwKeyboardSpeed; + +} SPEED_DATA, *PSPEED_DATA; + /* Property page dialog callback */ static INT_PTR CALLBACK -KeybSpeedProc(IN HWND hwndDlg, - IN UINT uMsg, - IN WPARAM wParam, - IN LPARAM lParam) -{ - UNREFERENCED_PARAMETER(lParam); - UNREFERENCED_PARAMETER(wParam); - UNREFERENCED_PARAMETER(hwndDlg); - switch(uMsg) +KeyboardSpeedProc(IN HWND hwndDlg, + IN UINT uMsg, + IN WPARAM wParam, + IN LPARAM lParam) +{ + PSPEED_DATA pSpeedData; + + pSpeedData = (PSPEED_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER); + + switch (uMsg) { case WM_INITDIALOG: + pSpeedData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(SPEED_DATA)); + SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSpeedData); + + /* Get current keyboard delay */ + if (!SystemParametersInfo(SPI_GETKEYBOARDDELAY, + sizeof(INT), + &pSpeedData->nKeyboardDelay, + 0)) + { + pSpeedData->nKeyboardDelay = 2; + } + + /* Get current keyboard delay */ + if (!SystemParametersInfo(SPI_GETKEYBOARDSPEED, + sizeof(DWORD), + &pSpeedData->dwKeyboardSpeed, + 0)) + { + pSpeedData->dwKeyboardSpeed = 31; + } + + SendDlgItemMessage(hwndDlg, IDC_SLIDER_REPEAT_DELAY, TBM_SETRANGE, (WPARAM)TRUE, (LPARAM)MAKELONG(0, 3)); + SendDlgItemMessage(hwndDlg, IDC_SLIDER_REPEAT_DELAY, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)(3 - pSpeedData->nKeyboardDelay)); + + SendDlgItemMessage(hwndDlg, IDC_SLIDER_REPEAT_RATE, TBM_SETRANGE, (WPARAM)TRUE, (LPARAM)MAKELONG(0, 31)); + SendDlgItemMessage(hwndDlg, IDC_SLIDER_REPEAT_RATE, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)pSpeedData->dwKeyboardSpeed); + + break; + + case WM_HSCROLL: + if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SLIDER_REPEAT_DELAY)) + { + switch (LOWORD(wParam)) + { + case TB_LINEUP: + case TB_LINEDOWN: + case TB_PAGEUP: + case TB_PAGEDOWN: + case TB_TOP: + case TB_BOTTOM: + case TB_ENDTRACK: + pSpeedData->nKeyboardDelay = 3 - (INT)SendDlgItemMessage(hwndDlg, IDC_SLIDER_REPEAT_DELAY, TBM_GETPOS, 0, 0); + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + break; + + case TB_THUMBTRACK: + pSpeedData->nKeyboardDelay = 3 - (INT)HIWORD(wParam); + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + break; + } + } + else if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SLIDER_REPEAT_RATE)) + { + switch (LOWORD(wParam)) + { + case TB_LINEUP: + case TB_LINEDOWN: + case TB_PAGEUP: + case TB_PAGEDOWN: + case TB_TOP: + case TB_BOTTOM: + case TB_ENDTRACK: + pSpeedData->dwKeyboardSpeed = (DWORD)SendDlgItemMessage(hwndDlg, IDC_SLIDER_REPEAT_RATE, TBM_GETPOS, 0, 0); + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + break; + + case TB_THUMBTRACK: + pSpeedData->dwKeyboardSpeed = (DWORD)HIWORD(wParam); + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + break; + } + } + + break; + + case WM_NOTIFY: + { + LPNMHDR lpnm = (LPNMHDR)lParam; + + switch(lpnm->code) + { + case PSN_APPLY: + SystemParametersInfo(SPI_SETKEYBOARDDELAY, + pSpeedData->nKeyboardDelay, + 0, + 0); + SystemParametersInfo(SPI_SETKEYBOARDSPEED, + pSpeedData->dwKeyboardSpeed, + 0, + SPIF_UPDATEINIFILE | SPIF_SENDCHANGE); + return TRUE; + + default: + break; + } + } + break; + + case WM_DESTROY: + HeapFree(GetProcessHeap(), 0, pSpeedData); break; } @@ -57,9 +165,9 @@ /* Property page dialog callback */ static INT_PTR CALLBACK KeybHardwareProc(IN HWND hwndDlg, - IN UINT uMsg, - IN WPARAM wParam, - IN LPARAM lParam) + IN UINT uMsg, + IN WPARAM wParam, + IN LPARAM lParam) { GUID Guids[1]; Guids[0] = GUID_DEVCLASS_KEYBOARD; @@ -89,32 +197,32 @@ LONG APIENTRY KeyboardApplet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam) { - PROPSHEETPAGE psp[2]; - PROPSHEETHEADER psh; - TCHAR Caption[256]; - - UNREFERENCED_PARAMETER(lParam); - UNREFERENCED_PARAMETER(wParam); - UNREFERENCED_PARAMETER(uMsg); - UNREFERENCED_PARAMETER(hwnd); - - LoadString(hApplet, IDS_CPLNAME_2, Caption, sizeof(Caption) / sizeof(TCHAR)); - - ZeroMemory(&psh, sizeof(PROPSHEETHEADER)); - psh.dwSize = sizeof(PROPSHEETHEADER); - psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE; - psh.hwndParent = NULL; - psh.hInstance = hApplet; - psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON_2)); - psh.pszCaption = Caption; - psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE); - psh.nStartPage = 0; - psh.ppsp = psp; - - InitPropSheetPage(&psp[0], IDD_KEYBSPEED, KeybSpeedProc); - InitPropSheetPage(&psp[1], IDD_HARDWARE, KeybHardwareProc); - - return (LONG)(PropertySheet(&psh) != -1); + PROPSHEETPAGE psp[2]; + PROPSHEETHEADER psh; + TCHAR szCaption[256]; + + UNREFERENCED_PARAMETER(lParam); + UNREFERENCED_PARAMETER(wParam); + UNREFERENCED_PARAMETER(uMsg); + UNREFERENCED_PARAMETER(hwnd); + + LoadString(hApplet, IDS_CPLNAME_2, szCaption, sizeof(szCaption) / sizeof(TCHAR)); + + ZeroMemory(&psh, sizeof(PROPSHEETHEADER)); + psh.dwSize = sizeof(PROPSHEETHEADER); + psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE; + psh.hwndParent = NULL; + psh.hInstance = hApplet; + psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON_2)); + psh.pszCaption = szCaption; + psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE); + psh.nStartPage = 0; + psh.ppsp = psp; + + InitPropSheetPage(&psp[0], IDD_KEYBSPEED, KeyboardSpeedProc); + InitPropSheetPage(&psp[1], IDD_HARDWARE, KeybHardwareProc); + + return (LONG)(PropertySheet(&psh) != -1); } /* EOF */
17 years, 9 months
1
0
0
0
[gedmurphy] 26279: - add hh.exe - not added to build as it useless until we get hhctrl.ocx done.
by gedmurphy@svn.reactos.org
Author: gedmurphy Date: Sat Apr 7 19:24:45 2007 New Revision: 26279 URL:
http://svn.reactos.org/svn/reactos?rev=26279&view=rev
Log: - add hh.exe - not added to build as it useless until we get hhctrl.ocx done. Added: trunk/reactos/base/applications/hh/ trunk/reactos/base/applications/hh/hh.ico (with props) trunk/reactos/base/applications/hh/hh.rbuild trunk/reactos/base/applications/hh/hh.rc trunk/reactos/base/applications/hh/main.c Added: trunk/reactos/base/applications/hh/hh.ico URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/hh/hh.ic…
============================================================================== Binary file - no diff available. Propchange: trunk/reactos/base/applications/hh/hh.ico ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: trunk/reactos/base/applications/hh/hh.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/hh/hh.rb…
============================================================================== --- trunk/reactos/base/applications/hh/hh.rbuild (added) +++ trunk/reactos/base/applications/hh/hh.rbuild Sat Apr 7 19:24:45 2007 @@ -1,0 +1,14 @@ +<?xml version="1.0"?> +<rbuild xmlns:xi="
http://www.w3.org/2001/XInclude
"> + <module name="hh" type="win32gui" installbase="system32" installname="hh.exe" unicode="no"> + <include base="hh">.</include> + <define name="__USE_W32API" /> + <define name="_WIN32_IE">0x0600</define> + <define name="_WIN32_WINNT">0x0501</define> + <library>kernel32</library> + <library>user32</library> + <library>gdi32</library> + <file>main.c</file> + <file>hh.rc</file> + </module> +</rbuild> Added: trunk/reactos/base/applications/hh/hh.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/hh/hh.rc…
============================================================================== --- trunk/reactos/base/applications/hh/hh.rc (added) +++ trunk/reactos/base/applications/hh/hh.rc Sat Apr 7 19:24:45 2007 @@ -1,0 +1,9 @@ +#include <windows.h> + +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS HTML Help Executable\0" +#define REACTOS_STR_INTERNAL_NAME "hh\0" +#define REACTOS_STR_ORIGINAL_FILENAME "hh.exe\0" +#include <reactos/version.rc> + +2 ICON DISCARDABLE hh.ico + Added: trunk/reactos/base/applications/hh/main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/hh/main.…
============================================================================== --- trunk/reactos/base/applications/hh/main.c (added) +++ trunk/reactos/base/applications/hh/main.c Sat Apr 7 19:24:45 2007 @@ -1,0 +1,23 @@ +#include <windows.h> + +typedef int WINAPI DOWINMAIN(HMODULE hMod, LPSTR cmdline); + +int WINAPI +WinMain(HINSTANCE hInst, + HINSTANCE hPrevInst, + LPSTR cmdline, + int cmdshow) +{ + HMODULE hModule; + DOWINMAIN *doWinMain; + int ret = -1; + + hModule = LoadLibraryA("hhctrl.ocx"); + doWinMain = (DOWINMAIN*) GetProcAddress(hModule, "doWinMain"); + + ret = doWinMain(hInst, cmdline); + + FreeLibrary(hModule); + + return ret; +}
17 years, 9 months
1
0
0
0
[greatlrd] 26278: tested NtGdiDdGetScanLine not suppored by vmware drv did use another 3d party driver for the test. fixed some werid loop of pseh, all code are tested in 0.3.1 for I do not have a working vmware drv for the driver. NtGdiDdGetScanLine is working same as windows 2000 now.
by greatlrd@svn.reactos.org
Author: greatlrd Date: Sat Apr 7 19:10:01 2007 New Revision: 26278 URL:
http://svn.reactos.org/svn/reactos?rev=26278&view=rev
Log: tested NtGdiDdGetScanLine not suppored by vmware drv did use another 3d party driver for the test. fixed some werid loop of pseh, all code are tested in 0.3.1 for I do not have a working vmware drv for the driver. NtGdiDdGetScanLine is working same as windows 2000 now. Modified: trunk/reactos/subsystems/win32/win32k/ntddraw/dd.c trunk/reactos/subsystems/win32/win32k/ntddraw/ddraw.c Modified: trunk/reactos/subsystems/win32/win32k/ntddraw/dd.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntddraw/dd.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntddraw/dd.c Sat Apr 7 19:10:01 2007 @@ -453,8 +453,6 @@ { ProbeForRead(puCanCreateSurfaceData, sizeof(DD_CANCREATESURFACEDATA), 1); RtlCopyMemory(&CanCreateSurfaceData,puCanCreateSurfaceData, sizeof(DD_CANCREATESURFACEDATA)); - - /* FIXME can be version 2 of DDSURFACEDESC */ ProbeForRead(puCanCreateSurfaceData->lpDDSurfaceDesc, sizeof(DDSURFACEDESC), 1); RtlCopyMemory(&desc,puCanCreateSurfaceData->lpDDSurfaceDesc, sizeof(DDSURFACEDESC)); } @@ -481,7 +479,6 @@ ProbeForWrite(puCanCreateSurfaceData, sizeof(DD_CANCREATESURFACEDATA), 1); puCanCreateSurfaceData->ddRVal = CanCreateSurfaceData.ddRVal; - /* FIXME can be version 2 of DDSURFACEDESC */ ProbeForWrite(puCanCreateSurfaceData->lpDDSurfaceDesc, sizeof(DDSURFACEDESC), 1); RtlCopyMemory(puCanCreateSurfaceData->lpDDSurfaceDesc,&desc, sizeof(DDSURFACEDESC)); @@ -501,53 +498,55 @@ /************************************************************************/ /* GetScanLine */ -/* status : not implement, was undoc in msdn now it is doc */ +/* status : is now documented in MSDN and I checked the code it works */ +/* like windows 2000 */ /************************************************************************/ DWORD STDCALL NtGdiDdGetScanLine( HANDLE hDirectDrawLocal, PDD_GETSCANLINEDATA puGetScanLineData) { DWORD ddRVal = DDHAL_DRIVER_NOTHANDLED; DD_GETSCANLINEDATA GetScanLineData; - PDD_DIRECTDRAW pDirectDraw; + PDD_DIRECTDRAW pDirectDraw = NULL; NTSTATUS Status = FALSE; - - DPRINT1("NtGdiDdGetScanLine\n"); - - _SEH_TRY - { - ProbeForRead(puGetScanLineData, sizeof(DD_GETSCANLINEDATA), 1); - RtlCopyMemory(&GetScanLineData,puGetScanLineData, sizeof(DD_GETSCANLINEDATA)); - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - if(NT_SUCCESS(Status)) + LPDDHAL_GETSCANLINEDATA ourpuGetScanLineData; + + if (hDirectDrawLocal) { pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW);; - if (pDirectDraw != NULL) - { - if (pDirectDraw->DD.dwFlags & DDHAL_CB32_GETSCANLINE) - { - GetScanLineData.ddRVal = DDERR_GENERIC; - GetScanLineData.lpDD = &pDirectDraw->Global; - ddRVal = pDirectDraw->DD.GetScanLine(&GetScanLineData); - - _SEH_TRY - { - ProbeForWrite(puGetScanLineData, sizeof(DD_GETSCANLINEDATA), 1); - puGetScanLineData->dwScanLine = GetScanLineData.dwScanLine; - puGetScanLineData->ddRVal = GetScanLineData.ddRVal; - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - } - GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); - } + } + + if (pDirectDraw != NULL) + { + DPRINT1("GetScanLine\n"); + if (pDirectDraw->DD.dwFlags & DDHAL_CB32_GETSCANLINE) + { + RtlZeroMemory(&GetScanLineData,sizeof(DD_GETSCANLINEDATA)); + GetScanLineData.ddRVal = DDERR_GENERIC; + GetScanLineData.lpDD = &pDirectDraw->Global; + ddRVal = pDirectDraw->DD.GetScanLine(&GetScanLineData); + + DPRINT1("GetScanLine\n"); + _SEH_TRY + { + ProbeForWrite(puGetScanLineData, sizeof(DD_GETSCANLINEDATA), 1); + ourpuGetScanLineData = (LPDDHAL_GETSCANLINEDATA)puGetScanLineData; + ourpuGetScanLineData->dwScanLine = GetScanLineData.dwScanLine; + ourpuGetScanLineData->ddRVal = GetScanLineData.ddRVal; + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + + if (!NT_SUCCESS(Status)) + { + DPRINT1("GetScanLine\n"); + ddRVal = DDHAL_DRIVER_NOTHANDLED; + } + } + + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); } return ddRVal; Modified: trunk/reactos/subsystems/win32/win32k/ntddraw/ddraw.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntddraw/ddraw.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntddraw/ddraw.c Sat Apr 7 19:10:01 2007 @@ -365,21 +365,74 @@ /* * Get puD3dCallbacks */ - if (puD3dCallbacks != NULL) - { - if (pDirectDraw->Hal.lpD3DHALCallbacks != NULL) - { + if ((puD3dCallbacks) && + (pDirectDraw->Hal.lpD3DHALCallbacks)) + { + _SEH_TRY + { + ProbeForWrite(puD3dCallbacks, sizeof(D3DNTHAL_CALLBACKS), 1); + RtlCopyMemory( puD3dCallbacks, pDirectDraw->Hal.lpD3DHALCallbacks, sizeof( D3DNTHAL_CALLBACKS ) ); + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + if(!NT_SUCCESS(Status)) + { + SetLastNtError(Status); + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); + return FALSE; + } + } + else + { + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); + return FALSE; + } + + /* + * Get lpD3DGlobalDriverData + */ + if ((puD3dDriverData) && + (pDirectDraw->Hal.lpD3DGlobalDriverData != NULL)) + { + /* Get D3dDriverData */ + _SEH_TRY + { + ProbeForWrite(puD3dDriverData, sizeof(D3DNTHAL_GLOBALDRIVERDATA), 1); + RtlCopyMemory( puD3dDriverData, pDirectDraw->Hal.lpD3DGlobalDriverData, sizeof(D3DNTHAL_GLOBALDRIVERDATA)); + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + if(!NT_SUCCESS(Status)) + { + SetLastNtError(Status); + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); + return FALSE; + } + + /* Get TextureFormats */ + pD3dDriverData =pDirectDraw->Hal.lpD3DGlobalDriverData; + if ((puD3dTextureFormats) && + (pD3dDriverData->dwNumTextureFormats>0) && + (pD3dDriverData->lpTextureFormats)) + { + DWORD Size = sizeof(DDSURFACEDESC) * pD3dDriverData->dwNumTextureFormats; _SEH_TRY { - ProbeForWrite(puD3dCallbacks, sizeof(D3DNTHAL_CALLBACKS), 1); - RtlCopyMemory( puD3dCallbacks, pDirectDraw->Hal.lpD3DHALCallbacks, - sizeof( D3DNTHAL_CALLBACKS ) ); + ProbeForWrite(puD3dTextureFormats, Size, 1); + RtlCopyMemory( puD3dTextureFormats, pD3dDriverData->lpTextureFormats, Size); } _SEH_HANDLE { Status = _SEH_GetExceptionCode(); } _SEH_END; + if(!NT_SUCCESS(Status)) { SetLastNtError(Status); @@ -394,43 +447,25 @@ return FALSE; } - /* - * Get lpD3DGlobalDriverData - */ - if (puD3dDriverData != NULL) - { - if (pDirectDraw->Hal.lpD3DGlobalDriverData != NULL) - { - _SEH_TRY - { - /* Get puD3dDriverData */ - ProbeForWrite(puD3dDriverData, sizeof(D3DNTHAL_GLOBALDRIVERDATA), 1); - RtlCopyMemory( puD3dDriverData, pDirectDraw->Hal.lpD3DGlobalDriverData, - sizeof(D3DNTHAL_GLOBALDRIVERDATA)); - - /* Get puD3dTextureFormats */ - pD3dDriverData =pDirectDraw->Hal.lpD3DGlobalDriverData; - if (puD3dTextureFormats != NULL) - { - if ((pD3dDriverData->dwNumTextureFormats) && (pD3dDriverData->lpTextureFormats)) - { - DWORD Size =sizeof(DDSURFACEDESC) * pD3dDriverData->dwNumTextureFormats; - ProbeForWrite(puD3dTextureFormats, Size, 1); - RtlCopyMemory( puD3dTextureFormats, pD3dDriverData->lpTextureFormats, Size); - } - } - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - if(!NT_SUCCESS(Status)) - { - SetLastNtError(Status); - GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); - return FALSE; - } + /*Get D3dBufferCallbacks */ + if ( (puD3dBufferCallbacks) && + (pDirectDraw->Hal.lpD3DBufCallbacks)) + { + _SEH_TRY + { + ProbeForWrite(puD3dBufferCallbacks, sizeof(DD_D3DBUFCALLBACKS), 1); + RtlCopyMemory( puD3dBufferCallbacks, pDirectDraw->Hal.lpD3DBufCallbacks, sizeof(DD_D3DBUFCALLBACKS)); + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + if(!NT_SUCCESS(Status)) + { + SetLastNtError(Status); + GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); + return FALSE; } } else @@ -439,53 +474,17 @@ return FALSE; } - /* - * Get puD3dBufferCallbacks - */ - if (puD3dBufferCallbacks != NULL) - { - if (pDirectDraw->Hal.lpD3DBufCallbacks != NULL) - { - _SEH_TRY - { - ProbeForWrite(puD3dBufferCallbacks, sizeof(DD_D3DBUFCALLBACKS), 1); - RtlCopyMemory( puD3dBufferCallbacks, pDirectDraw->Hal.lpD3DBufCallbacks, - sizeof(DD_D3DBUFCALLBACKS)); - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - if(!NT_SUCCESS(Status)) - { - SetLastNtError(Status); - GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); - return FALSE; - } - } - } - else - { - GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); - return FALSE; - } - + /* Get puNumFourCC and dwNumFourCC */ _SEH_TRY { - /* Waring : - * In Windows 2000 puvmList and puNumHeaps does not export from - * NtGdiDdQueryDirectDrawObject, I did remove the puvmList code - * I wrote. See MSDN and my private note about this matter, - * the private note will be in my book as well when it comes. - */ ProbeForWrite(puNumFourCC, sizeof(DWORD), 1); *puNumFourCC = pDirectDraw->dwNumFourCC; - if ((pDirectDraw->pdwFourCC != NULL) && (puFourCC != NULL)) + if ((pDirectDraw->pdwFourCC) && + (puFourCC)) { ProbeForWrite(puFourCC, sizeof(DWORD) * pDirectDraw->dwNumFourCC, 1); - RtlCopyMemory( puFourCC, pDirectDraw->pdwFourCC, sizeof(DWORD) * pDirectDraw->dwNumFourCC); + RtlCopyMemory( puFourCC, pDirectDraw->pdwFourCC, sizeof(DWORD) * pDirectDraw->dwNumFourCC); } } _SEH_HANDLE @@ -511,6 +510,11 @@ NtGdiDdDeleteDirectDrawObject( HANDLE hDirectDrawLocal) { DPRINT1("NtGdiDdDeleteDirectDrawObject\n"); + if (hDirectDrawLocal == NULL) + { + return FALSE; + } + return GDIOBJ_FreeObj(DdHandleTable, hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); }
17 years, 9 months
1
0
0
0
[gedmurphy] 26277: start to redo tracert
by gedmurphy@svn.reactos.org
Author: gedmurphy Date: Sat Apr 7 19:09:57 2007 New Revision: 26277 URL:
http://svn.reactos.org/svn/reactos?rev=26277&view=rev
Log: start to redo tracert Modified: trunk/reactos/base/applications/network/tracert/tracert.c trunk/reactos/base/applications/network/tracert/tracert.h Modified: trunk/reactos/base/applications/network/tracert/tracert.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
============================================================================== --- trunk/reactos/base/applications/network/tracert/tracert.c (original) +++ trunk/reactos/base/applications/network/tracert/tracert.c Sat Apr 7 19:09:57 2007 @@ -1,690 +1,36 @@ -/* - * ReactOS Win32 Applications - * Copyright (C) 2005 ReactOS Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS traceroute utility - * FILE: apps/utils/net/tracert/tracert.c - * PURPOSE: trace a packets route through a network - * PROGRAMMERS: Ged Murphy (gedmurphy(a)gmail.com) - * REVISIONS: - * GM 03/05/05 Created + /* + * PROJECT: ReactOS trace route utility + * LICENSE: GPL - See COPYING in the top level directory + * FILE: base/applications/network/tracert.c + * PURPOSE: Trace network paths through networks + * COPYRIGHT: Copyright 2006 - 2007 Ged Murphy <gedmurphy(a)reactos.org> * */ - -#include <winsock2.h> -#include <tchar.h> -#include <stdio.h> -#include <stdlib.h> -#include <ws2tcpip.h> -#include <string.h> -#include <time.h> #include "tracert.h" -#define WIN32_LEAN_AND_MEAN - -#ifdef DBG -#undef DBG -#endif - -/* - * globals - */ -SOCKET icmpSock; // socket descriptor -SOCKADDR_IN source, dest; // source and destination address info -ECHO_REPLY_HEADER sendpacket; // ICMP echo packet -IPv4_HEADER recvpacket; // return reveive packet - -BOOL bUsePerformanceCounter; // whether to use the high res performance counter -LARGE_INTEGER TicksPerMs; // number of millisecs in relation to proc freq -LARGE_INTEGER TicksPerUs; // number of microsecs in relation to proc freq -LONGLONG lTimeStart; // send packet, timer start -LONGLONG lTimeEnd; // receive packet, timer end +//#define TRACERT_DBG CHAR cHostname[256]; // target hostname CHAR cDestIP[18]; // target IP -/* - * command line options - */ -BOOL bResolveAddresses = TRUE; // -d MS ping defaults to true. -INT iMaxHops = 30; // -h Max number of hops before trace ends -INT iHostList; // -j @UNIMPLEMENTED@ -INT iTimeOut = 2000; // -w time before packet times out - - -/* - * - * Parse command line parameters and set any options - * - */ -static BOOL ParseCmdline(int argc, char* argv[]) -{ - int i; - - if (argc < 2) - { - Usage(); - return FALSE; - } - - for (i = 1; i < argc; i++) - { - if (argv[i][0] == '-') - { - switch (argv[i][1]) - { - case 'd': bResolveAddresses = FALSE; - break; - case 'h': sscanf(argv[i+1], "%d", &iMaxHops); - break; - case 'j': break; /* @unimplemented@ */ - case 'w': sscanf(argv[i+1], "%d", &iTimeOut); - break; - default: - _tprintf(_T("%s is not a valid option.\n"), argv[i]); - Usage(); - return FALSE; - } - } - else - /* copy target address */ - strncpy(cHostname, argv[i], 255); - } - - return TRUE; -} - - - -/* - * - * Driver function, controls the traceroute program - * - */ -static INT Driver(VOID) -{ - - INT iHopCount = 1; // hop counter. default max is 30 - USHORT iSeqNum = 0; // initialise packet sequence number - INT iTTL = 1; // set initial packet TTL to 1 - BOOL bFoundTarget = FALSE; // Have we reached our destination yet - BOOL bAwaitPacket; // indicates whether we have recieved a good packet - INT iDecRes; // DecodeResponse return value - INT iRecieveReturn; // RecieveReturn return value - INT iNameInfoRet; // getnameinfo return value - INT iPacketSize = PACKET_SIZE; // packet size - WORD wHeaderLen; // header length - PECHO_REPLY_HEADER icmphdr; - - - //temps for getting host name - CHAR cHost[256]; - CHAR cServ[256]; - CHAR *ip; - - /* setup winsock */ - WSADATA wsaData; - - /* check for winsock 2 */ - if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) - { -#ifdef DBG - _tprintf(_T("WSAStartup failed.\n")); -#endif /* DBG */ - exit(1); - } - - /* establish what timing method we can use */ - SetupTimingMethod(); - - /* setup target info */ - ResolveHostname(); - - /* print standard tracing info to screen */ - _tprintf(_T("\nTracing route to %s [%s]\n"), cHostname, cDestIP); - _tprintf(_T("over a maximum of %d hop"), iMaxHops); - iMaxHops > 1 ? _tprintf(_T("s:\n\n")) : _tprintf(_T(":\n\n")); - - /* run until we hit either max hops, or we recieve 3 echo replys */ - while ((iHopCount <= iMaxHops) && (bFoundTarget != TRUE)) - { - INT i; - - _tprintf(_T("%3d "), iHopCount); - /* run 3 pings for each hop */ - for (i=0; i<3; i++) - { - if (Setup(iTTL) != TRUE) - { -#ifdef DBG - _tprintf(_T("error in Setup()\n")); -#endif /* DBG */ - WSACleanup(); - exit(1); - } - PreparePacket(iPacketSize, iSeqNum); - if (SendPacket(iPacketSize) != SOCKET_ERROR) - { - /* loop until we get a good packet */ - bAwaitPacket = TRUE; - while (bAwaitPacket) - { - /* Receive replies until we either get a successful - * read, or a fatal error occurs. */ - if ((iRecieveReturn = ReceivePacket(iPacketSize)) < 0) - { - /* check the sequence number in the packet - * if it's bad, complain and wait for another packet - * , otherwise break */ - wHeaderLen = recvpacket.h_len * 4; - icmphdr = (ECHO_REPLY_HEADER *)((char*)&recvpacket + wHeaderLen); - if (icmphdr->icmpheader.seq != iSeqNum) - { - _tprintf(_T("bad sequence number!\n")); - continue; - } - else - break; - } - - /* if RecievePacket timed out we don't bother decoding */ - if (iRecieveReturn != 1) - { - iDecRes = DecodeResponse(iPacketSize); - - switch (iDecRes) - { - case 0 : bAwaitPacket = FALSE; /* time exceeded */ - break; - case 1 : bAwaitPacket = FALSE; /* echo reply */ - break; - case 2 : bAwaitPacket = FALSE; /* destination unreachable */ - break; -#ifdef DBG - case -1 : - _tprintf(_T("recieved foreign packet\n")); - break; - case -2 : - _tprintf(_T("error in DecodeResponse\n")); - break; - case -3 : - _tprintf(_T("unknown ICMP packet\n")); - break; -#endif /* DBG */ - default : break; - } - } - else - /* packet timed out. Don't wait for it again */ - bAwaitPacket = FALSE; - } - } - - iSeqNum++; - _tprintf(_T(" ")); - } - - if(bResolveAddresses) - { - /* gethostbyaddr() and getnameinfo() are - * unimplemented in ROS at present. - * Alex has advised he will be implementing getnameinfo. - * I've used that for the time being for testing in Windows*/ - - //ip = inet_addr(inet_ntoa(source.sin_addr)); - //host = gethostbyaddr((char *)&ip, 4, 0); - - ip = inet_ntoa(source.sin_addr); - - iNameInfoRet = getnameinfo((SOCKADDR *)&source, - sizeof(SOCKADDR), - cHost, - 256, - cServ, - 256, - NI_NUMERICSERV); - if (iNameInfoRet == 0) - { - /* if IP address resolved to a hostname, - * print the IP address after it */ - if (lstrcmpA(cHost, ip) != 0) - _tprintf(_T("%s [%s]"), cHost, ip); - else - _tprintf(_T("%s"), cHost); - } - else - { - _tprintf(_T("error: %d"), WSAGetLastError()); -#ifdef DBG - _tprintf(_T(" getnameinfo failed: %d"), iNameInfoRet); -#endif /* DBG */ - } - - } - else - _tprintf(_T("%s"), inet_ntoa(source.sin_addr)); - - _tprintf(_T("\n")); - - /* check if we've arrived at the target */ - if (strcmp(cDestIP, inet_ntoa(source.sin_addr)) == 0) - bFoundTarget = TRUE; - else - { - iTTL++; - iHopCount++; - Sleep(500); - } - } - _tprintf(_T("\nTrace complete.\n")); - WSACleanup(); - - return 0; -} - - -/* - * Establish if performance counters are available and - * set up timing figures in relation to processor frequency. - * If performance counters are not available, we'll be using - * gettickcount, so set the figures to 1 - * - */ -static VOID SetupTimingMethod(VOID) -{ - LARGE_INTEGER PerformanceCounterFrequency; - - /* check if performance counters are available */ - bUsePerformanceCounter = QueryPerformanceFrequency(&PerformanceCounterFrequency); - if (bUsePerformanceCounter) - { - /* restrict execution to first processor on SMP systems */ - if (SetThreadAffinityMask(GetCurrentThread(), 1) == 0) - bUsePerformanceCounter = FALSE; - - TicksPerMs.QuadPart = PerformanceCounterFrequency.QuadPart / 1000; - TicksPerUs.QuadPart = PerformanceCounterFrequency.QuadPart / 1000000; - } - - if (!bUsePerformanceCounter) - { - TicksPerMs.QuadPart = 1; - TicksPerUs.QuadPart = 1; - } -} - - -/* - * - * Check for a hostname or dotted deciamal for our target. - * If we have a hostname, resolve to an IP and store it, else - * just store the target IP address. Also set up other key - * SOCKADDR_IN members needed for the connection. - * - */ -static VOID ResolveHostname(VOID) -{ - HOSTENT *hp; - ULONG addr; - - memset(&dest, 0, sizeof(dest)); - - addr = inet_addr(cHostname); - /* if address is not a dotted decimal */ - if (addr == INADDR_NONE) - { - hp = gethostbyname(cHostname); - if (hp != 0) - { - memcpy(&dest.sin_addr, hp->h_addr, hp->h_length); - //dest.sin_addr = *((struct in_addr *)hp->h_addr); - dest.sin_family = hp->h_addrtype; - } - else - { - _tprintf(_T("Unable to resolve target system name %s.\n"), cHostname); - WSACleanup(); - exit(1); - } - } - else - { - dest.sin_addr.s_addr = addr; - dest.sin_family = AF_INET; - } - /* copy destination IP address into a string */ - strcpy(cDestIP, inet_ntoa(dest.sin_addr)); -} - - - -/* - * - * Create our socket which will be used for sending and recieving, - * Socket Type is raw, Protocol is ICMP. Also set the TTL value which will be - * set in the outgoing IP packet. - * - */ -static INT Setup(INT iTTL) -{ - INT iSockRet; - - /* create raw socket */ - icmpSock = WSASocket(AF_INET, SOCK_RAW, IPPROTO_ICMP, 0, 0, 0); - if (icmpSock == INVALID_SOCKET) - { - _tprintf(_T("Could not create socket : %d.\n"), WSAGetLastError()); - if (WSAGetLastError() == WSAEACCES) - { - _tprintf(_T("\n\nYou must be an administrator to run this program!\n\n")); - WSACleanup(); - exit(1); - } - return FALSE; - } - - /* setup for TTL */ - iSockRet = setsockopt(icmpSock, IPPROTO_IP, IP_TTL, (const char *)&iTTL, sizeof(iTTL)); - if (iSockRet == SOCKET_ERROR) - { - _tprintf(_T("TTL setsockopt failed : %d. \n"), WSAGetLastError()); - return FALSE; - } - - return TRUE; -} - - - -/* - * Prepare the ICMP echo request packet for sending. - * Calculate the packet checksum - * - */ -static VOID PreparePacket(INT iPacketSize, USHORT iSeqNum) -{ - /* assemble ICMP echo request packet */ - sendpacket.icmpheader.type = ECHO_REQUEST; - sendpacket.icmpheader.code = 0; - sendpacket.icmpheader.checksum = 0; - sendpacket.icmpheader.id = (USHORT)GetCurrentProcessId(); - sendpacket.icmpheader.seq = iSeqNum; - - /* calculate checksum of packet */ - sendpacket.icmpheader.checksum = CheckSum((PUSHORT)&sendpacket, sizeof(ICMP_HEADER) + iPacketSize); -} - - - -/* - * - * Get the system time and send the ICMP packet to the destination - * address. - * - */ -static INT SendPacket(INT datasize) -{ - INT iSockRet; - INT iPacketSize; - - iPacketSize = sizeof(ECHO_REPLY_HEADER) + datasize; - -#ifdef DBG - _tprintf(_T("\nsending packet of %d bytes\n"), iPacketSize); -#endif /* DBG */ - - /* get time packet was sent */ - lTimeStart = GetTime(); - - iSockRet = sendto(icmpSock, //socket - (char *)&sendpacket, //buffer - iPacketSize, //size of buffer - 0, //flags - (SOCKADDR *)&dest, //destination - sizeof(dest)); //address length - - if (iSockRet == SOCKET_ERROR) - { - if (WSAGetLastError() == WSAEACCES) - { - _tprintf(_T("\n\nYou must be an administrator to run this program!\n\n")); - WSACleanup(); - exit(1); - } - else - { -#ifdef DBG - _tprintf(_T("sendto failed %d\n"), WSAGetLastError()); -#endif /* DBG */ - return FALSE; - } - } -#ifdef DBG - _tprintf(_T("sent %d bytes\n"), iSockRet); -#endif /* DBG */ - - /* return number of bytes sent */ - return iSockRet; -} - - - -/* - * - * Set up a timeout value and put the socket in a select poll. - * Wait until we recieve an IPv4 reply packet in reply to the ICMP - * echo request packet and get the time the packet was recieved. - * If we don't recieve a packet, do some checking to establish why. - * - */ -static INT ReceivePacket(INT datasize) -{ - TIMEVAL timeVal; - FD_SET readFDS; - int iSockRet = 0, iSelRet; - int iFromLen; - int iPacketSize; - - /* allow for a larger recv buffer to store ICMP TTL - * exceed, IP header and orginal ICMP request */ - iPacketSize = MAX_REC_SIZE + datasize; - - iFromLen = sizeof(source); - -#ifdef DBG - _tprintf(_T("receiving packet. Available buffer, %d bytes\n"), iPacketSize); -#endif /* DBG */ - - /* monitor icmpSock for incomming connections */ - FD_ZERO(&readFDS); - FD_SET(icmpSock, &readFDS); - - /* set timeout values */ - timeVal.tv_sec = iTimeOut / 1000; - timeVal.tv_usec = iTimeOut % 1000; - - iSelRet = select(0, &readFDS, NULL, NULL, &timeVal); - - if ((iSelRet != SOCKET_ERROR) && (iSelRet != 0)) - { - iSockRet = recvfrom(icmpSock, //socket - (char *)&recvpacket, //buffer - iPacketSize, //size of buffer - 0, //flags - (SOCKADDR *)&source, //source address - &iFromLen); //pointer to address length - /* get time packet was recieved */ - lTimeEnd = GetTime(); - /* if socket timed out */ - } - else if (iSelRet == 0) - { - _tprintf(_T(" * ")); - return 1; - } - else if (iSelRet == SOCKET_ERROR) - { - _tprintf(_T("select() failed in sendPacket() %d\n"), WSAGetLastError()); - return -1; - } - - - if (iSockRet == SOCKET_ERROR) - { - _tprintf(_T("recvfrom failed: %d\n"), WSAGetLastError()); - return -2; - } -#ifdef DBG - else - _tprintf(_T("reveived %d bytes\n"), iSockRet); -#endif /* DBG */ - - return 0; -} - - - -/* - * - * Cast the IPv4 packet to an echo reply and to a TTL exceed. - * Check the 'type' field to establish what was recieved, and - * ensure the packet is related to the originating process. - * It all is well, print the time taken for the round trip. - * - */ -static INT DecodeResponse(INT iPacketSize) -{ - unsigned short header_len = recvpacket.h_len * 4; - /* cast the recieved packet into an ECHO reply and a TTL Exceed so we can check the ID*/ - ECHO_REPLY_HEADER *IcmpHdr = (ECHO_REPLY_HEADER *)((char*)&recvpacket + header_len); - TTL_EXCEED_HEADER *TTLExceedHdr = (TTL_EXCEED_HEADER *)((char *)&recvpacket + header_len); - - /* Make sure the reply is ok */ - if (iPacketSize < header_len + ICMP_MIN_SIZE) - { - _tprintf(_T("too few bytes from %s\n"), inet_ntoa(dest.sin_addr)); - return -2; - } - - switch (IcmpHdr->icmpheader.type) - { - case TTL_EXCEEDED : - if (TTLExceedHdr->OrigIcmpHeader.id != (USHORT)GetCurrentProcessId()) - { - /* FIXME */ - /* we've picked up a packet not related to this process - * probably from another local program. We ignore it */ -#ifdef DGB - _tprintf(_T("header id, process id %d"), TTLExceedHdr->OrigIcmpHeader.id, GetCurrentProcessId()); -#endif /* DBG */ - //_tprintf(_T("oops "); - return -1; - } - _tprintf(_T("%3Ld ms"), (lTimeEnd - lTimeStart) / TicksPerMs.QuadPart); - return 0; - case ECHO_REPLY : - if (IcmpHdr->icmpheader.id != (USHORT)GetCurrentProcessId()) - { - /* FIXME */ - /* we've picked up a packet not related to this process - * probably from another local program. We ignore it */ -#ifdef DGB - _tprintf(_T("\nPicked up wrong packet. icmpheader.id = %d and process id = %d"), IcmpHdr->icmpheader.id, GetCurrentProcessId()); -#endif /* DBG */ - //_tprintf(_T("oops "); - return -1; - } - _tprintf(_T("%3Ld ms"), (lTimeEnd - lTimeStart) / TicksPerMs.QuadPart); - return 1; - case DEST_UNREACHABLE : - _tprintf(_T(" * ")); - return 2; - default : - /* unknown ICMP packet */ - return -3; - } -} - - -/* - * - * Get the system time using preformance counters if available, - * otherwise fall back to GetTickCount() - * - */ - -static LONGLONG GetTime(VOID) -{ - LARGE_INTEGER Time; - - if (bUsePerformanceCounter) - { - if (QueryPerformanceCounter(&Time) == 0) - { - Time.u.LowPart = (DWORD)GetTickCount(); - Time.u.HighPart = 0; - return (LONGLONG)Time.u.LowPart; - } - } - else - { - Time.u.LowPart = (DWORD)GetTickCount(); - Time.u.HighPart = 0; - return (LONGLONG)Time.u.LowPart; - } - return Time.QuadPart; -} - - -/* - * - * Calculate packet checksum. - * - */ -static WORD CheckSum(PUSHORT data, UINT size) -{ - DWORD dwSum = 0; - - while (size > 1) - { - dwSum += *data++; - size -= sizeof(USHORT); - } - - if (size) - dwSum += *(UCHAR*)data; - - dwSum = (dwSum >> 16) + (dwSum & 0xFFFF); - dwSum += (dwSum >> 16); - - return (USHORT)(~dwSum); -} - - -/* - * - * print program usage to screen - * - */ -static VOID Usage(VOID) +static VOID +DebugPrint(LPTSTR lpString, ...) +{ +#ifdef TRACERT_DBG + va_list args; + va_start(args, lpString); + _vtprintf(lpString, args); + va_end(args); +#else + UNREFERENCED_PARAMETER(lpString); +#endif +} + + +static VOID +Usage(VOID) { _tprintf(_T("\nUsage: tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout] target_name\n\n" "Options:\n" @@ -693,7 +39,6 @@ " -j host-list Loose source route along host-list.\n" " -w timeout Wait timeout milliseconds for each reply.\n\n")); - /* temp notes to stop user questions until getnameinfo/gethostbyaddr and getsockopt are implemented */ _tprintf(_T("NOTES\n-----\n" "- Setting TTL values is not currently supported in ReactOS, so the trace will\n" " jump straight to the destination. This feature will be implemented soon.\n" @@ -703,17 +48,637 @@ } - -/* - * - * Program entry point - * - */ -int main(int argc, char* argv[]) -{ - if (!ParseCmdline(argc, argv)) return -1; - - Driver(); +static BOOL +ParseCmdline(int argc, + LPCTSTR argv[], + PAPPINFO pInfo) +{ + INT i; + + if (argc < 2) + { + Usage(); + return FALSE; + } + else + { + for (i = 1; i < argc; i++) + { + if (argv[i][0] == _T('-')) + { + switch (argv[i][1]) + { + case _T('d'): + pInfo->bResolveAddresses = FALSE; + break; + + case _T('h'): + _stscanf(argv[i+1], _T("%d"), &pInfo->iMaxHops); + break; + + case _T('j'): + _tprintf(_T("-j is not yet implemented.\n")); + break; + + case _T('w'): + _stscanf(argv[i+1], _T("%d"), &pInfo->iTimeOut); + break; + + default: + { + _tprintf(_T("%s is not a valid option.\n"), argv[i]); + Usage(); + return FALSE; + } + } + } + else + /* copy target address */ + _tcsncpy(cHostname, argv[i], 255); + } + } + + return TRUE; +} + + +static WORD +CheckSum(PUSHORT data, + UINT size) +{ + DWORD dwSum = 0; + + while (size > 1) + { + dwSum += *data++; + size -= sizeof(USHORT); + } + + if (size) + dwSum += *(UCHAR*)data; + + dwSum = (dwSum >> 16) + (dwSum & 0xFFFF); + dwSum += (dwSum >> 16); + + return (USHORT)(~dwSum); +} + + +static VOID +SetupTimingMethod(PAPPINFO pInfo) +{ + LARGE_INTEGER PerformanceCounterFrequency; + + /* check if performance counters are available */ + pInfo->bUsePerformanceCounter = QueryPerformanceFrequency(&PerformanceCounterFrequency); + + if (pInfo->bUsePerformanceCounter) + { + /* restrict execution to first processor on SMP systems */ + if (SetThreadAffinityMask(GetCurrentThread(), 1) == 0) + pInfo->bUsePerformanceCounter = FALSE; + + pInfo->TicksPerMs.QuadPart = PerformanceCounterFrequency.QuadPart / 1000; + pInfo->TicksPerUs.QuadPart = PerformanceCounterFrequency.QuadPart / 1000000; + } + else + { + pInfo->TicksPerMs.QuadPart = 1; + pInfo->TicksPerUs.QuadPart = 1; + } +} + + +static BOOL +ResolveHostname(PAPPINFO pInfo) +{ + HOSTENT *hp; + ULONG addr; + + ZeroMemory(&pInfo->dest, sizeof(pInfo->dest)); + + /* if address is not a dotted decimal */ + if ((addr = inet_addr(cHostname))== INADDR_NONE) + { + if ((hp = gethostbyname(cHostname)) != 0) + { + //CopyMemory(&pInfo->dest.sin_addr, hp->h_addr, hp->h_length); + pInfo->dest.sin_addr = *((struct in_addr *)hp->h_addr); + pInfo->dest.sin_family = hp->h_addrtype; + } + else + { + _tprintf(_T("Unable to resolve target system name %s.\n"), cHostname); + return FALSE; + } + } + else + { + pInfo->dest.sin_addr.s_addr = addr; + pInfo->dest.sin_family = AF_INET; + } + + _tcscpy(cDestIP, inet_ntoa(pInfo->dest.sin_addr)); + + return TRUE; +} + + +static LONGLONG +GetTime(PAPPINFO pInfo) +{ + LARGE_INTEGER Time; + + /* Get the system time using preformance counters if available */ + if (pInfo->bUsePerformanceCounter) + { + if (QueryPerformanceCounter(&Time)) + { + return Time.QuadPart; + } + } + + /* otherwise fall back to GetTickCount */ + Time.u.LowPart = (DWORD)GetTickCount(); + Time.u.HighPart = 0; + + return (LONGLONG)Time.u.LowPart; +} + + +static BOOL +SetTTL(SOCKET sock, + INT iTTL) +{ + if (setsockopt(sock, + IPPROTO_IP, + IP_TTL, + (const char *)&iTTL, + sizeof(iTTL)) == SOCKET_ERROR) + { + DebugPrint(_T("TTL setsockopt failed : %d. \n"), WSAGetLastError()); + return FALSE; + } + + return TRUE; +} + + +static BOOL +CreateSocket(PAPPINFO pInfo) +{ + pInfo->icmpSock = WSASocket(AF_INET, + SOCK_RAW, + IPPROTO_ICMP, + 0, + 0, + 0); + + if (pInfo->icmpSock == INVALID_SOCKET) + { + INT err = WSAGetLastError(); + DebugPrint(_T("Could not create socket : %d.\n"), err); + + if (err == WSAEACCES) + { + _tprintf(_T("\n\nYou must have access to raw sockets (admin) to run this program!\n\n")); + } + + return FALSE; + } + + return TRUE; +} + + +static VOID +PreparePacket(PAPPINFO pInfo, + USHORT iSeqNum) +{ + /* assemble ICMP echo request packet */ + pInfo->SendPacket->icmpheader.type = ECHO_REQUEST; + pInfo->SendPacket->icmpheader.code = 0; + pInfo->SendPacket->icmpheader.checksum = 0; + pInfo->SendPacket->icmpheader.id = (USHORT)GetCurrentProcessId(); + pInfo->SendPacket->icmpheader.seq = iSeqNum; + + /* calculate checksum of packet */ + pInfo->SendPacket->icmpheader.checksum = CheckSum((PUSHORT)&pInfo->SendPacket, + sizeof(ICMP_HEADER) + PACKET_SIZE); +} + + +static INT +SendPacket(PAPPINFO pInfo) +{ + INT iSockRet; + + DebugPrint(_T("\nsending packet of %d bytes... "), PACKET_SIZE); + + /* get time packet was sent */ + pInfo->lTimeStart = GetTime(pInfo); + + iSockRet = sendto(pInfo->icmpSock, //socket + (char *)pInfo->SendPacket, //buffer + PACKET_SIZE, //size of buffer + 0, //flags + (SOCKADDR *)&pInfo->dest, //destination + sizeof(pInfo->dest)); //address length + + if (iSockRet == SOCKET_ERROR) + { + if (WSAGetLastError() == WSAEACCES) + { + /* FIXME: Is this correct? */ + _tprintf(_T("\n\nYou must be an administrator to run this program!\n\n")); + WSACleanup(); + HeapFree(GetProcessHeap(), 0, pInfo); + exit(-1); + } + else + { + DebugPrint(_T("sendto failed %d\n"), WSAGetLastError()); + } + } + else + { + DebugPrint(_T("sent %d bytes\n"), iSockRet); + } + + return iSockRet; +} + + +static BOOL +ReceivePacket(PAPPINFO pInfo) +{ + TIMEVAL timeVal; + FD_SET readFDS; + INT iSockRet = 0, iSelRet; + INT iFromLen; + BOOL bRet = FALSE; + + iFromLen = sizeof(pInfo->source); + + DebugPrint(_T("Receiving packet. Available buffer, %d bytes... "), MAX_PING_PACKET_SIZE); + + /* monitor icmpSock for incomming connections */ + FD_ZERO(&readFDS); + FD_SET(pInfo->icmpSock, &readFDS); + + /* set timeout values */ + timeVal.tv_sec = pInfo->iTimeOut / 1000; + timeVal.tv_usec = pInfo->iTimeOut % 1000; + + iSelRet = select(0, + &readFDS, + NULL, + NULL, + &timeVal); + + if (iSelRet == SOCKET_ERROR) + { + DebugPrint(_T("select() failed in sendPacket() %d\n"), WSAGetLastError()); + } + else if (iSelRet == 0) /* if socket timed out */ + { + _tprintf(_T(" * ")); + } + else if ((iSelRet != SOCKET_ERROR) && (iSelRet != 0)) + { + iSockRet = recvfrom(pInfo->icmpSock, // socket + (char *)pInfo->RecvPacket, // buffer + MAX_PING_PACKET_SIZE, // size of buffer + 0, // flags + (SOCKADDR *)&pInfo->source, // source address + &iFromLen); // address length + + if (iSockRet != SOCKET_ERROR) + { + /* get time packet was recieved */ + pInfo->lTimeEnd = GetTime(pInfo); + DebugPrint(_T("reveived %d bytes\n"), iSockRet); + bRet = TRUE; + } + else + { + DebugPrint(_T("recvfrom failed: %d\n"), WSAGetLastError()); + } + } + + return bRet; +} + + +static INT +DecodeResponse(PAPPINFO pInfo) +{ + unsigned short header_len = pInfo->RecvPacket->h_len * 4; + + /* cast the recieved packet into an ECHO reply and a TTL Exceed and check the ID*/ + ECHO_REPLY_HEADER *IcmpHdr = (ECHO_REPLY_HEADER *)((char*)pInfo->RecvPacket + header_len); + TTL_EXCEED_HEADER *TTLExceedHdr = (TTL_EXCEED_HEADER *)((char *)pInfo->RecvPacket + header_len); + + /* Make sure the reply is ok */ + if (PACKET_SIZE < header_len + ICMP_MIN_SIZE) + { + DebugPrint(_T("too few bytes from %s\n"), inet_ntoa(pInfo->dest.sin_addr)); + return -2; + } + + switch (IcmpHdr->icmpheader.type) + { + case TTL_EXCEEDED : + if (TTLExceedHdr->OrigIcmpHeader.id != (USHORT)GetCurrentProcessId()) + { + /* FIXME: our network stack shouldn't allow this... */ + /* we've picked up a packet not related to this process probably from another local program. We ignore it */ + DebugPrint(_T("Rouge packet: header id, process id %d"), TTLExceedHdr->OrigIcmpHeader.id, GetCurrentProcessId()); + return -1; + } + _tprintf(_T("%3Ld ms"), (pInfo->lTimeEnd - pInfo->lTimeStart) / pInfo->TicksPerMs.QuadPart); + return 0; + + case ECHO_REPLY : + if (IcmpHdr->icmpheader.id != (USHORT)GetCurrentProcessId()) + { + /* FIXME: our network stack shouldn't allow this... */ + /* we've picked up a packet not related to this process probably from another local program. We ignore it */ + DebugPrint(_T("Rouge packet: header id %d, process id %d"), IcmpHdr->icmpheader.id, GetCurrentProcessId()); + return -1; + } + _tprintf(_T("%3Ld ms"), (pInfo->lTimeEnd - pInfo->lTimeStart) / pInfo->TicksPerMs.QuadPart); + return 1; + + case DEST_UNREACHABLE : + _tprintf(_T(" * ")); + return 2; + } return 0; } + + +static BOOL +AllocateBuffers(PAPPINFO pInfo) +{ + pInfo->SendPacket = (PECHO_REPLY_HEADER)HeapAlloc(GetProcessHeap(), + 0, + sizeof(ECHO_REPLY_HEADER) + PACKET_SIZE); + if (!pInfo->SendPacket) + return FALSE; + + pInfo->RecvPacket = (PIPv4_HEADER)HeapAlloc(GetProcessHeap(), + 0, + sizeof(IPv4_HEADER) + PACKET_SIZE); + if (!pInfo->RecvPacket) + { + HeapFree(GetProcessHeap(), + 0, + pInfo->SendPacket); + + return FALSE; + } + + return TRUE; +} + + +static INT +Driver(PAPPINFO pInfo) +{ + INT iHopCount = 1; // hop counter. default max is 30 + BOOL bFoundTarget = FALSE; // Have we reached our destination yet + INT iRecieveReturn; // RecieveReturn return value + PECHO_REPLY_HEADER icmphdr; + INT iTTL = 1; + + INT ret = -1; + + //temps for getting host name + CHAR cHost[256]; + CHAR cServ[256]; + CHAR *ip; + + SetupTimingMethod(pInfo); + + if (AllocateBuffers(pInfo) && + ResolveHostname(pInfo) && + CreateSocket(pInfo)) + { + /* print tracing info to screen */ + _tprintf(_T("\nTracing route to %s [%s]\n"), cHostname, cDestIP); + _tprintf(_T("over a maximum of %d hop"), pInfo->iMaxHops); + pInfo->iMaxHops > 1 ? _tprintf(_T("s:\n\n")) : _tprintf(_T(":\n\n")); + + /* run until we hit either max hops, or find the target */ + while ((iHopCount <= pInfo->iMaxHops) && + (bFoundTarget != TRUE)) + { + USHORT iSeqNum = 0; + INT i; + + _tprintf(_T("%3d "), iHopCount); + + /* run 3 pings for each hop */ + for (i = 0; i < 3; i++) + { + if (SetTTL(pInfo->icmpSock, iTTL) != TRUE) + { + DebugPrint(_T("error in Setup()\n")); + return ret; + } + + PreparePacket(pInfo, iSeqNum); + + if (SendPacket(pInfo) != SOCKET_ERROR) + { + BOOL bAwaitPacket = FALSE; // indicates whether we have recieved a good packet + + do + { + /* Receive replies until we get a successful read, or a fatal error */ + if ((iRecieveReturn = ReceivePacket(pInfo)) < 0) + { + /* FIXME: consider moving this into RecievePacket */ + /* check the seq num in the packet, if it's bad wait for another */ + WORD hdrLen = pInfo->RecvPacket->h_len * 4; + icmphdr = (ECHO_REPLY_HEADER *)((char*)&pInfo->RecvPacket + hdrLen); + if (icmphdr->icmpheader.seq != iSeqNum) + { + _tprintf(_T("bad sequence number!\n")); + continue; + } + } + + if (iRecieveReturn) + { + DecodeResponse(pInfo); + } + else + /* packet timed out. Don't wait for it again */ + bAwaitPacket = FALSE; + + } while (bAwaitPacket); + } + + iSeqNum++; + _tprintf(_T(" ")); + } + + if(pInfo->bResolveAddresses) + { + INT iNameInfoRet; // getnameinfo return value + /* gethostbyaddr() and getnameinfo() are + * unimplemented in ROS at present. + * Alex has advised he will be implementing getnameinfo. + * I've used that for the time being for testing in Windows*/ + + //ip = inet_addr(inet_ntoa(source.sin_addr)); + //host = gethostbyaddr((char *)&ip, 4, 0); + + ip = inet_ntoa(pInfo->source.sin_addr); + + iNameInfoRet = getnameinfo((SOCKADDR *)&pInfo->source, + sizeof(SOCKADDR), + cHost, + 256, + cServ, + 256, + NI_NUMERICSERV); + if (iNameInfoRet == 0) + { + /* if IP address resolved to a hostname, + * print the IP address after it */ + if (lstrcmpA(cHost, ip) != 0) + _tprintf(_T("%s [%s]"), cHost, ip); + else + _tprintf(_T("%s"), cHost); + } + else + { + DebugPrint(_T("error: %d"), WSAGetLastError()); + DebugPrint(_T(" getnameinfo failed: %d"), iNameInfoRet); + } + + } + else + _tprintf(_T("%s"), inet_ntoa(pInfo->source.sin_addr)); + + _tprintf(_T("\n")); + + /* check if we've arrived at the target */ + if (strcmp(cDestIP, inet_ntoa(pInfo->source.sin_addr)) == 0) + bFoundTarget = TRUE; + else + { + iTTL++; + iHopCount++; + Sleep(500); + } + } + _tprintf(_T("\nTrace complete.\n")); + ret = 0; + } + + return ret; +} + + +static VOID +Cleanup(PAPPINFO pInfo) +{ + if (pInfo->icmpSock) + closesocket(pInfo->icmpSock); + + WSACleanup(); + + if (pInfo->SendPacket) + HeapFree(GetProcessHeap(), + 0, + pInfo->SendPacket); + + if (pInfo->SendPacket) + HeapFree(GetProcessHeap(), + 0, + pInfo->RecvPacket); +} + + +#if defined(_UNICODE) && defined(__GNUC__) +static +#endif +int _tmain(int argc, LPCTSTR argv[]) +{ + PAPPINFO pInfo; + WSADATA wsaData; + int ret = -1; + + pInfo = (PAPPINFO)HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + sizeof(APPINFO)); + if (pInfo) + { + pInfo->bResolveAddresses = TRUE; + pInfo->iMaxHops = 30; + pInfo->iTimeOut = 1000; + + if (ParseCmdline(argc, argv, pInfo)) + { + if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) + { + DebugPrint(_T("WSAStartup failed.\n")); + } + else + { + ret = Driver(pInfo); + Cleanup(pInfo); + } + } + + HeapFree(GetProcessHeap(), + 0, + pInfo); + } + + return ret; +} + + +#if defined(_UNICODE) && defined(__GNUC__) +/* HACK - MINGW HAS NO OFFICIAL SUPPORT FOR wmain()!!! */ +int main( int argc, char **argv ) +{ + WCHAR **argvW; + int i, j, Ret = 1; + + if ((argvW = malloc(argc * sizeof(WCHAR*)))) + { + /* convert the arguments */ + for (i = 0, j = 0; i < argc; i++) + { + if (!(argvW[i] = malloc((strlen(argv[i]) + 1) * sizeof(WCHAR)))) + { + j++; + } + swprintf(argvW[i], L"%hs", argv[i]); + } + + if (j == 0) + { + /* no error converting the parameters, call wmain() */ + Ret = wmain(argc, (LPCTSTR *)argvW); + } + + /* free the arguments */ + for (i = 0; i < argc; i++) + { + if (argvW[i]) + free(argvW[i]); + } + free(argvW); + } + + return Ret; +} +#endif Modified: trunk/reactos/base/applications/network/tracert/tracert.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
============================================================================== --- trunk/reactos/base/applications/network/tracert/tracert.h (original) +++ trunk/reactos/base/applications/network/tracert/tracert.h Sat Apr 7 19:09:57 2007 @@ -1,24 +1,24 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS traceroute utility - * FILE: apps/utils/net/tracert/tracert.h - * PURPOSE: trace a packets route through a network - * PROGRAMMERS: Ged Murphy (gedmurphy(a)gmail.com) - * REVISIONS: - * GM 03/05/05 Created - */ +#define WIN32_LEAN_AND_MEAN +#include <winsock2.h> +#include <tchar.h> +#include <stdio.h> +#include <stdlib.h> +#include <ws2tcpip.h> +#include <string.h> +#include <time.h> #define ECHO_REPLY 0 #define DEST_UNREACHABLE 3 #define ECHO_REQUEST 8 #define TTL_EXCEEDED 11 +#define MAX_PING_PACKET_SIZE 1024 +#define MAX_PING_DATA_SIZE (MAX_PING_PACKET_SIZE + sizeof(IPv4Header) +#define PACKET_SIZE 32 #define ICMP_MIN_SIZE 8 -#define ICMP_MAX_SIZE 65535 -#define PACKET_SIZE 32 + /* we need this for packets which have the 'dont fragment' - * bit set, as they can get quite large otherwise - * (I've seen some reach 182 bytes */ + * bit set, as they can get quite large otherwise */ #define MAX_REC_SIZE 200 /* pack the structures */ @@ -65,19 +65,24 @@ struct ICMPHeader OrigIcmpHeader; } TTL_EXCEED_HEADER, *PTTL_EXCEED_HEADER; -/* return to normal */ #include <poppack.h> -/* function definitions */ -static BOOL ParseCmdline(int argc, char* argv[]); -static INT Driver(void); -static INT Setup(INT ttl); -static VOID SetupTimingMethod(void); -static VOID ResolveHostname(void); -static VOID PreparePacket(INT packetSize, USHORT seqNum); -static INT SendPacket(INT datasize); -static INT ReceivePacket(INT datasize); -static INT DecodeResponse(INT packetSize); -static LONGLONG GetTime(void); -static WORD CheckSum(PUSHORT data, UINT size); -static VOID Usage(void); +typedef struct _APPINFO +{ + SOCKET icmpSock; // socket descriptor + SOCKADDR_IN source, dest; // source and destination address info + PECHO_REPLY_HEADER SendPacket; // ICMP echo packet + PIPv4_HEADER RecvPacket; // return reveive packet + + BOOL bUsePerformanceCounter; // whether to use the high res performance counter + LARGE_INTEGER TicksPerMs; // number of millisecs in relation to proc freq + LARGE_INTEGER TicksPerUs; // number of microsecs in relation to proc freq + LONGLONG lTimeStart; // send packet, timer start + LONGLONG lTimeEnd; // receive packet, timer end + + BOOL bResolveAddresses; // -d MS ping defaults to true. + INT iMaxHops; // -h Max number of hops before trace ends + INT iHostList; // -j Source route + INT iTimeOut; // -w time before packet times out + +} APPINFO, *PAPPINFO;
17 years, 9 months
1
0
0
0
[fireball] 26276: Please use TABs inside .rbuild files, not spaces.
by fireball@svn.reactos.org
Author: fireball Date: Sat Apr 7 19:09:48 2007 New Revision: 26276 URL:
http://svn.reactos.org/svn/reactos?rev=26276&view=rev
Log: Please use TABs inside .rbuild files, not spaces. Modified: trunk/reactos/base/system/userinit/userinit.rbuild Modified: trunk/reactos/base/system/userinit/userinit.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/userinit/useri…
============================================================================== --- trunk/reactos/base/system/userinit/userinit.rbuild (original) +++ trunk/reactos/base/system/userinit/userinit.rbuild Sat Apr 7 19:09:48 2007 @@ -11,7 +11,7 @@ <library>gdi32</library> <library>advapi32</library> <library>shell32</library> - <library>shlwapi</library> + <library>shlwapi</library> <file>userinit.c</file> <file>userinit.rc</file> </module>
17 years, 9 months
1
0
0
0
[greatlrd] 26275: clean up NtGdiDdQueryDirectDrawObject and NtGdiDdCreateDirectDrawObject They are now working to 100% simulare to windows 2000 in all case. if you do not count the undoc bevhoir of NtGdiDdCreateDirectDrawObject when pvmlist and heapnum got a vaild pointer and heapnum=0
by greatlrd@svn.reactos.org
Author: greatlrd Date: Sat Apr 7 13:30:52 2007 New Revision: 26275 URL:
http://svn.reactos.org/svn/reactos?rev=26275&view=rev
Log: clean up NtGdiDdQueryDirectDrawObject and NtGdiDdCreateDirectDrawObject They are now working to 100% simulare to windows 2000 in all case. if you do not count the undoc bevhoir of NtGdiDdCreateDirectDrawObject when pvmlist and heapnum got a vaild pointer and heapnum=0 Modified: trunk/reactos/subsystems/win32/win32k/ntddraw/ddraw.c Modified: trunk/reactos/subsystems/win32/win32k/ntddraw/ddraw.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntddraw/ddraw.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntddraw/ddraw.c Sat Apr 7 13:30:52 2007 @@ -4,8 +4,12 @@ * PURPOSE: Native DirectDraw implementation * FILE: subsys/win32k/ntddraw/ddraw.c * PROGRAMER: Peter Bajusz (hyp-x(a)stormregion.com) + * PROGRAMER: Magnus olsen (magnus(a)greatlord.com) * REVISION HISTORY: * 25-10-2003 PB Created + from 2003 to year 2007 + * rewrote almost all code Peter did. + * only few line are left from him */ #include <w32k.h> @@ -46,16 +50,6 @@ { return FALSE; } - - //if (pDirectDraw->pvmList != NULL) - //{ - // ExFreePool(pDirectDraw->pvmList); - //} - // - //if (pDirectDraw->pdwFourCC != NULL) - //{ - // ExFreePool(pDirectDraw->pdwFourCC); - //} pDirectDraw->DrvDisableDirectDraw(pDirectDraw->Global.dhpdev); return TRUE; @@ -199,14 +193,18 @@ } +/* NtGdiDdCreateDirectDrawObject is finish and works as it should + * it maybe have some memory leack or handler leack in this code + * if you found any case you maybe think it leacks the handler + * or memory please tell me, before you start fixing the code + * Magnus Olsen + */ HANDLE STDCALL NtGdiDdCreateDirectDrawObject(HDC hdc) { DC *pDC; HANDLE hDirectDraw; PDD_DIRECTDRAW pDirectDraw; - - DPRINT1("NtGdiDdCreateDirectDrawObject\n"); /* Create a hdc if we do not have one */ if (hdc == NULL) @@ -256,7 +254,6 @@ if (intEnableDriver(pDirectDraw) == FALSE) { - /* FIXME delete the pDirectDraw and the handle */ GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); DC_UnlockDc(pDC); return NULL; @@ -264,18 +261,16 @@ GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); DC_UnlockDc(pDC); - DPRINT1("DirectDraw return handler 0x%x\n",hDirectDraw); - return hDirectDraw; } -BOOL STDCALL -NtGdiDdDeleteDirectDrawObject( HANDLE hDirectDrawLocal) -{ - DPRINT1("NtGdiDdDeleteDirectDrawObject\n"); - return GDIOBJ_FreeObj(DdHandleTable, hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); -} - + +/* NtGdiDdCreateDirectDrawObject is finish and works as it should + * it maybe have some memory leack or handler leack in this code + * if you found any case you maybe think it leacks the handler + * or memory please tell me, before you start fixing the code + * Magnus Olsen + */ BOOL STDCALL NtGdiDdQueryDirectDrawObject( @@ -295,13 +290,8 @@ PDD_DIRECTDRAW pDirectDraw; NTSTATUS Status = FALSE; BOOL Ret=FALSE; - - /* FIXME the workaround for 0.3.1 pseh bugs - * we should not need todo if (pHalInfo != NULL) - * so on - */ - - DPRINT1("NtGdiDdQueryDirectDrawObject\n"); + LPD3DNTHAL_GLOBALDRIVERDATA pD3dDriverData; + if (hDirectDrawLocal == NULL) { return FALSE; @@ -309,7 +299,6 @@ pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); - if (!pDirectDraw) { return FALSE; @@ -320,7 +309,6 @@ */ if (pHalInfo != NULL) { - DPRINT1("copy &pDirectDraw->Hal to pHalInfo\n"); _SEH_TRY { ProbeForWrite(pHalInfo, sizeof(DD_HALINFO), 1); @@ -333,7 +321,6 @@ _SEH_END; if(!NT_SUCCESS(Status)) { - DPRINT1("GDIOBJ_UnlockObjByPtr and SetLastNtError\n"); SetLastNtError(Status); GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); return FALSE; @@ -341,18 +328,15 @@ } else { - DPRINT1("GDIOBJ_UnlockObjByPtr\n"); GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); return FALSE; } - /* * Get pCallBackFlags */ if (pCallBackFlags != NULL) { - DPRINT1("copy &CallBackFlags to pCallBackFlags\n"); _SEH_TRY { ProbeForWrite(pCallBackFlags, sizeof(DWORD)*3, 1); @@ -367,7 +351,6 @@ _SEH_END; if(!NT_SUCCESS(Status)) { - DPRINT1("GDIOBJ_UnlockObjByPtr and SetLastNtError\n"); SetLastNtError(Status); GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); return FALSE; @@ -375,7 +358,6 @@ } else { - DPRINT1("GDIOBJ_UnlockObjByPtr\n"); GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); return FALSE; } @@ -385,7 +367,6 @@ */ if (puD3dCallbacks != NULL) { - DPRINT1("copy pDirectDraw->Hal.lpD3DHALCallbacks to puD3dCallbacks\n"); if (pDirectDraw->Hal.lpD3DHALCallbacks != NULL) { _SEH_TRY @@ -401,7 +382,6 @@ _SEH_END; if(!NT_SUCCESS(Status)) { - DPRINT1("GDIOBJ_UnlockObjByPtr and SetLastNtError\n"); SetLastNtError(Status); GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); return FALSE; @@ -410,7 +390,6 @@ } else { - DPRINT1("GDIOBJ_UnlockObjByPtr\n"); GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); return FALSE; } @@ -420,29 +399,25 @@ */ if (puD3dDriverData != NULL) { - DPRINT1("copy pDirectDraw->Hal.lpD3DGlobalDriverData to puD3dDriverData\n"); if (pDirectDraw->Hal.lpD3DGlobalDriverData != NULL) { _SEH_TRY { - LPD3DNTHAL_GLOBALDRIVERDATA MyD3d; - DPRINT1("Found DirectDraw GlobalDriverData for 3D Hal\n"); - MyD3d = (LPD3DNTHAL_GLOBALDRIVERDATA) pDirectDraw->Hal.lpD3DGlobalDriverData; - /* Get puD3dDriverData */ ProbeForWrite(puD3dDriverData, sizeof(D3DNTHAL_GLOBALDRIVERDATA), 1); RtlCopyMemory( puD3dDriverData, pDirectDraw->Hal.lpD3DGlobalDriverData, sizeof(D3DNTHAL_GLOBALDRIVERDATA)); /* Get puD3dTextureFormats */ + pD3dDriverData =pDirectDraw->Hal.lpD3DGlobalDriverData; if (puD3dTextureFormats != NULL) { - ProbeForWrite(puD3dTextureFormats, sizeof(DDSURFACEDESC) * MyD3d->dwNumTextureFormats, 1); - if (( MyD3d->lpTextureFormats != NULL) && ( MyD3d->dwNumTextureFormats != 0)) + if ((pD3dDriverData->dwNumTextureFormats) && (pD3dDriverData->lpTextureFormats)) { - RtlCopyMemory( puD3dTextureFormats, MyD3d->lpTextureFormats, sizeof(DDSURFACEDESC) * MyD3d->dwNumTextureFormats); + DWORD Size =sizeof(DDSURFACEDESC) * pD3dDriverData->dwNumTextureFormats; + ProbeForWrite(puD3dTextureFormats, Size, 1); + RtlCopyMemory( puD3dTextureFormats, pD3dDriverData->lpTextureFormats, Size); } - ProbeForWrite(puD3dDriverData, sizeof(D3DNTHAL_GLOBALDRIVERDATA), 1); } } _SEH_HANDLE @@ -452,7 +427,6 @@ _SEH_END; if(!NT_SUCCESS(Status)) { - DPRINT1("GDIOBJ_UnlockObjByPtr and SetLastNtError\n"); SetLastNtError(Status); GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); return FALSE; @@ -461,7 +435,6 @@ } else { - DPRINT1("GDIOBJ_UnlockObjByPtr\n"); GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); return FALSE; } @@ -471,10 +444,8 @@ */ if (puD3dBufferCallbacks != NULL) { - DPRINT1("copy pDirectDraw->Hal.lpD3DGlobalDriverData to puD3dBufferCallbacks\n"); if (pDirectDraw->Hal.lpD3DBufCallbacks != NULL) { - DPRINT1("Found DirectDraw CallBack for 3D Hal Bufffer \n"); _SEH_TRY { ProbeForWrite(puD3dBufferCallbacks, sizeof(DD_D3DBUFCALLBACKS), 1); @@ -488,7 +459,6 @@ _SEH_END; if(!NT_SUCCESS(Status)) { - DPRINT1("GDIOBJ_UnlockObjByPtr and SetLastNtError\n"); SetLastNtError(Status); GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); return FALSE; @@ -497,22 +467,17 @@ } else { - DPRINT1("GDIOBJ_UnlockObjByPtr\n"); GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); return FALSE; } - /* FIXME puD3dTextureFormats */ - _SEH_TRY { /* Waring : * In Windows 2000 puvmList and puNumHeaps does not export from - * NtGdiDdQueryDirectDrawObject - * FIXME remove alloc code for puvmList and puNumHeaps in GDI32.dll - * so I remove the puvmList code I wrote. See MSDN and my - * private note about this matter, the private note will be in - * my book as well when it comes. + * NtGdiDdQueryDirectDrawObject, I did remove the puvmList code + * I wrote. See MSDN and my private note about this matter, + * the private note will be in my book as well when it comes. */ ProbeForWrite(puNumFourCC, sizeof(DWORD), 1); *puNumFourCC = pDirectDraw->dwNumFourCC; @@ -523,15 +488,13 @@ RtlCopyMemory( puFourCC, pDirectDraw->pdwFourCC, sizeof(DWORD) * pDirectDraw->dwNumFourCC); } } - _SEH_HANDLE + _SEH_HANDLE { Status = _SEH_GetExceptionCode(); } _SEH_END; - GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); - if(!NT_SUCCESS(Status)) { SetLastNtError(Status); @@ -542,6 +505,15 @@ } return Ret; } + + +BOOL STDCALL +NtGdiDdDeleteDirectDrawObject( HANDLE hDirectDrawLocal) +{ + DPRINT1("NtGdiDdDeleteDirectDrawObject\n"); + return GDIOBJ_FreeObj(DdHandleTable, hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); +} + BOOL STDCALL NtGdiDdReenableDirectDrawObject( HANDLE hDirectDrawLocal,
17 years, 9 months
1
0
0
0
[ion] 26274: - NDK updates and compatibility fixes for Vista/WDK/User-Mode/Individual per-file NDK Usage. - Update targets to pentium to take advantage of cmpxhg8b when possible. (ROS won't run on 386/486 anyway). - Fix some compiler problems when building with -O3.
by ion@svn.reactos.org
Author: ion Date: Sat Apr 7 09:33:30 2007 New Revision: 26274 URL:
http://svn.reactos.org/svn/reactos?rev=26274&view=rev
Log: - NDK updates and compatibility fixes for Vista/WDK/User-Mode/Individual per-file NDK Usage. - Update targets to pentium to take advantage of cmpxhg8b when possible. (ROS won't run on 386/486 anyway). - Fix some compiler problems when building with -O3. Modified: trunk/reactos/base/applications/screensavers/cylfrac/cylfrac.c trunk/reactos/config.template.rbuild trunk/reactos/include/ndk/extypes.h trunk/reactos/include/ndk/ketypes.h trunk/reactos/include/ndk/lpctypes.h trunk/reactos/include/ndk/mmtypes.h trunk/reactos/include/ndk/obtypes.h trunk/reactos/include/ndk/psfuncs.h trunk/reactos/include/ndk/pstypes.h trunk/reactos/include/ndk/rtlfuncs.h trunk/reactos/include/ndk/umtypes.h trunk/reactos/subsystems/win32/win32k/objects/region.c Modified: trunk/reactos/base/applications/screensavers/cylfrac/cylfrac.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/screensa…
============================================================================== --- trunk/reactos/base/applications/screensavers/cylfrac/cylfrac.c (original) +++ trunk/reactos/base/applications/screensavers/cylfrac/cylfrac.c Sat Apr 7 09:33:30 2007 @@ -277,7 +277,7 @@ LPSTR lpCmdLine, int iCmdShow) { - HWND hwndParent; + HWND hwndParent = 0; int chOption = 0; MSG Message; Modified: trunk/reactos/config.template.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/config.template.rbuild?rev…
============================================================================== --- trunk/reactos/config.template.rbuild (original) +++ trunk/reactos/config.template.rbuild Sat Apr 7 09:33:30 2007 @@ -32,7 +32,7 @@ See GCC manual for more CPU names and which CPUs GCC can optimize for. --> -<property name="OARCH" value="i486" /> +<property name="OARCH" value="pentium" /> <!-- Modified: trunk/reactos/include/ndk/extypes.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/extypes.h?rev=…
============================================================================== --- trunk/reactos/include/ndk/extypes.h (original) +++ trunk/reactos/include/ndk/extypes.h Sat Apr 7 09:33:30 2007 @@ -31,6 +31,9 @@ #include <ketypes.h> #include <potypes.h> #include <lpctypes.h> +#ifdef NTOS_MODE_USER +#include <obtypes.h> +#endif // // GCC compatibility Modified: trunk/reactos/include/ndk/ketypes.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/ketypes.h?rev=…
============================================================================== --- trunk/reactos/include/ndk/ketypes.h (original) +++ trunk/reactos/include/ndk/ketypes.h Sat Apr 7 09:33:30 2007 @@ -948,7 +948,12 @@ { DISPATCHER_HEADER Header; LIST_ENTRY ProfileListHead; +#if (NTDDI_VERSION >= NTDDI_LONGHORN) + ULONG DirectoryTableBase; + ULONG Unused0; +#else LARGE_INTEGER DirectoryTableBase; +#endif #if defined(_M_IX86) KGDTENTRY LdtDescriptor; KIDTENTRY Int21Descriptor; Modified: trunk/reactos/include/ndk/lpctypes.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/lpctypes.h?rev…
============================================================================== --- trunk/reactos/include/ndk/lpctypes.h (original) +++ trunk/reactos/include/ndk/lpctypes.h Sat Apr 7 09:33:30 2007 @@ -23,7 +23,7 @@ // Dependencies // #include <umtypes.h> -#include <pstypes.h> +//#include <pstypes.h> // // Internal helper macro Modified: trunk/reactos/include/ndk/mmtypes.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/mmtypes.h?rev=…
============================================================================== --- trunk/reactos/include/ndk/mmtypes.h (original) +++ trunk/reactos/include/ndk/mmtypes.h Sat Apr 7 09:33:30 2007 @@ -24,6 +24,7 @@ // #include <umtypes.h> #include <arch/mmtypes.h> +#include <extypes.h> // // Page-Rounding Macros @@ -576,20 +577,42 @@ // typedef struct _MMSUPPORT { +#if (NTDDI_VERSION >= NTDDI_LONGHORN) + LIST_ENTRY WorkingSetExpansionLinks; + USHORT LastTrimpStamp; + USHORT NextPageColor; +#else LARGE_INTEGER LastTrimTime; +#endif MMSUPPORT_FLAGS Flags; ULONG PageFaultCount; ULONG PeakWorkingSetSize; +#if (NTDDI_VERSION >= NTDDI_LONGHORN) + ULONG Spare0; +#else ULONG WorkingSetSize; +#endif ULONG MinimumWorkingSetSize; ULONG MaximumWorkingSetSize; PMMWSL MmWorkingSetList; +#if (NTDDI_VERSION < NTDDI_LONGHORN) LIST_ENTRY WorkingSetExpansionLinks; +#endif ULONG Claim; +#if (NTDDI_VERSION >= NTDDI_LONGHORN) + ULONG Spare; + ULONG WorkingSetPrivateSize; + ULONG WorkingSetSizeOverhead; + ULONG WorkingSetSize; + PKEVENT ExitEvent; + EX_PUSH_LOCK WorkingSetMutex; + PVOID AccessLog; +#else ULONG NextEstimationSlot; ULONG NextAgingSlot; ULONG EstimatedAvailable; ULONG GrowthSinceLastEstimate; +#endif } MMSUPPORT, *PMMSUPPORT; // Modified: trunk/reactos/include/ndk/obtypes.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/obtypes.h?rev=…
============================================================================== --- trunk/reactos/include/ndk/obtypes.h (original) +++ trunk/reactos/include/ndk/obtypes.h Sat Apr 7 09:33:30 2007 @@ -18,6 +18,9 @@ #ifndef _OBTYPES_H #define _OBTYPES_H + +#undef NTDDI_VERSION +#define NTDDI_VERSION NTDDI_WS03SP1 // // Dependencies @@ -26,9 +29,6 @@ #ifndef NTOS_MODE_USER #include <extypes.h> #endif - -#undef NTDDI_VERSION -#define NTDDI_VERSION NTDDI_WS03SP1 #ifdef NTOS_MODE_USER // Modified: trunk/reactos/include/ndk/psfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/psfuncs.h?rev=…
============================================================================== --- trunk/reactos/include/ndk/psfuncs.h (original) +++ trunk/reactos/include/ndk/psfuncs.h Sat Apr 7 09:33:30 2007 @@ -129,6 +129,12 @@ IN PCLIENT_ID Cid, OUT PEPROCESS *Process OPTIONAL, OUT PETHREAD *Thread +); + +BOOLEAN +NTAPI +PsIsProtectedProcess( + IN PEPROCESS Process ); #endif Modified: trunk/reactos/include/ndk/pstypes.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/pstypes.h?rev=…
============================================================================== --- trunk/reactos/include/ndk/pstypes.h (original) +++ trunk/reactos/include/ndk/pstypes.h Sat Apr 7 09:33:30 2007 @@ -234,6 +234,11 @@ #define PSF_SWAP_ALLOWED_BIT 0x2000000 #define PSF_CREATE_FAILED_BIT 0x4000000 #define PSF_DEFAULT_IO_PRIORITY_BIT 0x8000000 + +// +// Vista Process Flags +// +#define PSF2_PROTECTED_BIT 0x800 #ifdef NTOS_MODE_USER // @@ -528,19 +533,6 @@ (NTAPI *PPOST_PROCESS_INIT_ROUTINE)( VOID ); - -#ifdef NTOS_MODE_USER - -// -// ClientID Structure -// -typedef struct _CLIENT_ID -{ - HANDLE UniqueProcess; - HANDLE UniqueThread; -} CLIENT_ID, *PCLIENT_ID; - -#endif // // Descriptor Table Entry Definition @@ -1001,7 +993,6 @@ // // Executive Thread (ETHREAD) // -#include <pshpack4.h> typedef struct _ETHREAD { KTHREAD Tcb; @@ -1200,7 +1191,11 @@ #endif PETHREAD ForkInProgress; ULONG HardwareTrigger; +#if (NTDDI_VERSION >= NTDDI_LONGHORN) + PMM_AVL_TABLE PhysicalVadroot; +#else MM_AVL_TABLE PhysicalVadroot; +#endif PVOID CloneRoot; ULONG NumberOfPrivatePages; ULONG NumberOfLockedPages; @@ -1217,7 +1212,6 @@ PVOID VdmObjects; PVOID DeviceMap; #if (NTDDI_VERSION >= NTDDI_LONGHORN) - ULONG AlpcPagedPoolQuotaCache; PVOID EtwDataSource; PVOID FreeTebHint; #else @@ -1351,7 +1345,6 @@ MM_AVL_TABLE VadRoot; ULONG Cookie; } EPROCESS; -#include <poppack.h> // // Job Token Filter Data Modified: trunk/reactos/include/ndk/rtlfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/rtlfuncs.h?rev…
============================================================================== --- trunk/reactos/include/ndk/rtlfuncs.h (original) +++ trunk/reactos/include/ndk/rtlfuncs.h Sat Apr 7 09:33:30 2007 @@ -2768,7 +2768,17 @@ NTSYSAPI NTSTATUS NTAPI -RtlFormatCurrentUserKeyPath(IN OUT PUNICODE_STRING KeyPath); +RtlCreateRegistryKey( + IN ULONG RelativeTo, + IN PWSTR Path +); + +NTSYSAPI +NTSTATUS +NTAPI +RtlFormatCurrentUserKeyPath( + IN OUT PUNICODE_STRING KeyPath +); NTSYSAPI NTSTATUS Modified: trunk/reactos/include/ndk/umtypes.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/umtypes.h?rev=…
============================================================================== --- trunk/reactos/include/ndk/umtypes.h (original) +++ trunk/reactos/include/ndk/umtypes.h Sat Apr 7 09:33:30 2007 @@ -160,6 +160,15 @@ PVOID SecurityQualityOfService; } OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES; +// +// ClientID Structure +// +typedef struct _CLIENT_ID +{ + HANDLE UniqueProcess; + HANDLE UniqueThread; +} CLIENT_ID, *PCLIENT_ID; + typedef const UNICODE_STRING* PCUNICODE_STRING; typedef STRING ANSI_STRING; typedef PSTRING PANSI_STRING; Modified: trunk/reactos/subsystems/win32/win32k/objects/region.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/region.c (original) +++ trunk/reactos/subsystems/win32/win32k/objects/region.c Sat Apr 7 09:33:30 2007 @@ -2712,7 +2712,7 @@ HRGN STDCALL NtGdiUnionRectWithRgn(HRGN hDest, CONST PRECT UnsafeRect) { - RECT SafeRect; + RECT SafeRect = {0}; PROSRGNDATA Rgn; NTSTATUS Status = STATUS_SUCCESS;
17 years, 9 months
1
0
0
0
← Newer
1
...
30
31
32
33
34
35
36
37
38
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
Results per page:
10
25
50
100
200