ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
August 2006
----- 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
447 discussions
Start a n
N
ew thread
[pborobia] 23810: user32.dll part: * Clipboard implemtation in win32k and user32 * Added a clipboard system for each Window Station * GetLastInputInfo implementation * GetLayout in win32k Stubs * Shell32 changes to cut/copy & paste link/paste * Implemented ALT+PrintScreen to clipboard
by pborobia@svn.reactos.org
Author: pborobia Date: Wed Aug 30 23:35:22 2006 New Revision: 23810 URL:
http://svn.reactos.org/svn/reactos?rev=23810&view=rev
Log: user32.dll part: * Clipboard implemtation in win32k and user32 * Added a clipboard system for each Window Station * GetLastInputInfo implementation * GetLayout in win32k Stubs * Shell32 changes to cut/copy & paste link/paste * Implemented ALT+PrintScreen to clipboard Modified: trunk/reactos/dll/win32/user32/include/user32p.h trunk/reactos/dll/win32/user32/windows/clipboard.c trunk/reactos/dll/win32/user32/windows/defwnd.c trunk/reactos/dll/win32/user32/windows/input.c Modified: trunk/reactos/dll/win32/user32/include/user32p.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/include/u…
============================================================================== --- trunk/reactos/dll/win32/user32/include/user32p.h (original) +++ trunk/reactos/dll/win32/user32/include/user32p.h Wed Aug 30 23:35:22 2006 @@ -75,10 +75,10 @@ #define NtUserSetCaretBlinkTime(uMSeconds) \ (BOOL)NtUserCallOneParam((DWORD)uMSeconds, ONEPARAM_ROUTINE_SETCARETBLINKTIME) - +/* #define NtUserEnumClipboardFormats(format) \ (UINT)NtUserCallOneParam(format, ONEPARAM_ROUTINE_ENUMCLIPBOARDFORMATS) - +*/ #define NtUserWindowFromDC(hDC) \ (HWND)NtUserCallOneParam((DWORD)hDC, ONEPARAM_ROUTINE_WINDOWFROMDC) Modified: trunk/reactos/dll/win32/user32/windows/clipboard.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/c…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/clipboard.c (original) +++ trunk/reactos/dll/win32/user32/windows/clipboard.c Wed Aug 30 23:35:22 2006 @@ -1,37 +1,25 @@ -/* - * ReactOS kernel - * Copyright (C) 1998, 1999, 2000, 2001 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. - */ /* $Id$ * * PROJECT: ReactOS user32.dll * FILE: lib/user32/windows/clipboard.c * PURPOSE: Input * PROGRAMMER: Casper S. Hornstrup (chorns(a)users.sourceforge.net) + * Pablo Borobia <pborobia(a)gmail.com> * UPDATE HISTORY: * 09-05-2001 CSH Created + * */ /* INCLUDES ******************************************************************/ #include <user32.h> +#define DEBUG + #include <wine/debug.h> +#define QUERY_SIZE 0 + /* FUNCTIONS *****************************************************************/ /* @@ -40,7 +28,8 @@ BOOL STDCALL OpenClipboard(HWND hWndNewOwner) { - return NtUserOpenClipboard(hWndNewOwner, 0); + BOOL ret = NtUserOpenClipboard(hWndNewOwner, 0); + return ret; } /* @@ -49,7 +38,9 @@ BOOL STDCALL CloseClipboard(VOID) { - return NtUserCloseClipboard(); + BOOL ret; + ret = NtUserCloseClipboard(); + return ret; } /* @@ -58,7 +49,8 @@ INT STDCALL CountClipboardFormats(VOID) { - return NtUserCountClipboardFormats(); + INT ret = NtUserCountClipboardFormats(); + return ret; } /* @@ -67,7 +59,7 @@ BOOL STDCALL EmptyClipboard(VOID) { - return NtUserEmptyClipboard(); + return NtUserEmptyClipboard(); } /* @@ -76,7 +68,8 @@ UINT STDCALL EnumClipboardFormats(UINT format) { - return NtUserEnumClipboardFormats(format); + UINT ret = NtUserEnumClipboardFormats(format); + return ret; } /* @@ -85,7 +78,31 @@ HANDLE STDCALL GetClipboardData(UINT uFormat) { - return NtUserGetClipboardData(uFormat, 0); + HGLOBAL hGlobal = NULL; + PVOID pGlobal = NULL; + DWORD size = 0; + + /* dealing with bitmap object */ + if (uFormat != CF_BITMAP) + { + size = (DWORD)NtUserGetClipboardData(uFormat, QUERY_SIZE); + + if (size) + { + hGlobal = GlobalAlloc(GMEM_DDESHARE | GMEM_MOVEABLE, size); + pGlobal = GlobalLock(hGlobal); + + size = (DWORD)NtUserGetClipboardData(uFormat, (DWORD)pGlobal); + + GlobalUnlock(hGlobal); + } + } + else + { + hGlobal = NtUserGetClipboardData(CF_BITMAP, !QUERY_SIZE); + } + + return hGlobal; } /* @@ -94,28 +111,32 @@ INT STDCALL GetClipboardFormatNameA(UINT format, LPSTR lpszFormatName, int cchMaxCount) { - LPWSTR lpBuffer; - UNICODE_STRING FormatName; - INT Length; - - lpBuffer = HEAP_alloc(cchMaxCount * sizeof(WCHAR)); - if (!lpBuffer) - { - SetLastError(ERROR_OUTOFMEMORY); - return 0; - } + LPWSTR lpBuffer; + UNICODE_STRING FormatName; + INT Length; + ANSI_STRING ClassName; + + ClassName.MaximumLength = cchMaxCount; + ClassName.Buffer = lpszFormatName; + + lpBuffer = HEAP_alloc(cchMaxCount * sizeof(WCHAR)); + + if (!lpBuffer) + { + SetLastError(ERROR_OUTOFMEMORY); + return 0; + } FormatName.Length = 0; FormatName.MaximumLength = cchMaxCount * sizeof(WCHAR); FormatName.Buffer = lpBuffer; + /* we need a UNICODE string */ Length = NtUserGetClipboardFormatName(format, &FormatName, cchMaxCount); - DPRINT("GetClipboardFormatNameA(%x): %S\n", format, lpBuffer); - HEAP_strcpyWtoA(lpszFormatName, lpBuffer, Length); - HEAP_free(lpBuffer); - DPRINT("GetClipboardFormatNameA(%x): returning %s\n", format, lpszFormatName); - - return Length; + + HEAP_strcpyWtoA(lpszFormatName, FormatName.Buffer, Length); + + return strlen(lpszFormatName); } /* @@ -124,15 +145,15 @@ INT STDCALL GetClipboardFormatNameW(UINT format, LPWSTR lpszFormatName, INT cchMaxCount) { - UNICODE_STRING FormatName; - ULONG Ret; - - FormatName.Length = 0; - FormatName.MaximumLength = cchMaxCount * sizeof(WCHAR); - FormatName.Buffer = (PWSTR)lpszFormatName; - Ret = NtUserGetClipboardFormatName(format, &FormatName, cchMaxCount); - DPRINT("GetClipboardFormatNameW(%x): returning %S\n", format, lpszFormatName); - return Ret; + UNICODE_STRING FormatName; + ULONG Ret; + + FormatName.Length = 0; + FormatName.MaximumLength = cchMaxCount * sizeof(WCHAR); + FormatName.Buffer = (PWSTR)lpszFormatName; + Ret = NtUserGetClipboardFormatName(format, &FormatName, cchMaxCount); + return Ret; + } /* @@ -177,7 +198,8 @@ INT STDCALL GetPriorityClipboardFormat(UINT *paFormatPriorityList, INT cFormats) { - return NtUserGetPriorityClipboardFormat(paFormatPriorityList, cFormats); + INT ret = NtUserGetPriorityClipboardFormat(paFormatPriorityList, cFormats); + return ret; } /* @@ -186,18 +208,42 @@ BOOL STDCALL IsClipboardFormatAvailable(UINT format) { - return NtUserIsClipboardFormatAvailable(format); -} - -/* - * @implemented - */ + BOOL ret = NtUserIsClipboardFormatAvailable(format); + return ret; +} + +/* + * @implemented + */ + + UINT STDCALL RegisterClipboardFormatA(LPCSTR lpszFormat) { - ULONG Ret = RegisterWindowMessageA(lpszFormat); - DPRINT("RegisterClipboardFormatA(%s) - %x\n", lpszFormat, Ret); - return Ret; + UINT ret = 0; + UNICODE_STRING usFormat = {0}; + + if (lpszFormat == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + /* check for "" */ + if (*lpszFormat == 0) //NULL + { + SetLastError(ERROR_INVALID_NAME); + return 0; + } + + ret = RtlCreateUnicodeStringFromAsciiz(&usFormat, lpszFormat); + if (ret) + { + ret = NtUserRegisterClipboardFormat(&usFormat); //(LPCWSTR) + RtlFreeUnicodeString(&usFormat); + } + + return ret; } /* @@ -206,9 +252,48 @@ UINT STDCALL RegisterClipboardFormatW(LPCWSTR lpszFormat) { - ULONG Ret = RegisterWindowMessageW(lpszFormat); - DPRINT("RegisterClipboardFormatW(%S) - %x\n", lpszFormat, Ret); - return Ret; + UINT ret = 0; + UNICODE_STRING usFormat = {0}; + + if (lpszFormat == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + /* check for "" */ + if (*lpszFormat == 0) //NULL + { + SetLastError(ERROR_INVALID_NAME); + return 0; + } + + RtlInitUnicodeString(&usFormat, lpszFormat); + ret = NtUserRegisterClipboardFormat(&usFormat); + RtlFreeUnicodeString(&usFormat); + + return ret; +} + +HGLOBAL renderLocale (DWORD Locale) +{ + DWORD* pLocale; + HGLOBAL hGlobal; + + hGlobal = GlobalAlloc(GMEM_DDESHARE | GMEM_MOVEABLE, sizeof(DWORD)); + + if(!hGlobal) + { + return hGlobal; + } + + pLocale = (DWORD*)GlobalLock(hGlobal); + + *pLocale = Locale; + + GlobalUnlock(hGlobal); + + return hGlobal; } /* @@ -217,7 +302,41 @@ HANDLE STDCALL SetClipboardData(UINT uFormat, HANDLE hMem) { - return NtUserSetClipboardData(uFormat, hMem, 0); + DWORD size; + LPVOID pMem; + HANDLE ret = NULL; + + if (hMem == NULL) + { + return NtUserSetClipboardData(uFormat, 0, 0); + } + + if (uFormat == CF_BITMAP) + { + /*FIXME: check if hMem is GDI handle + GlobalLock(hMem) fails && GetObject(hMem, 0, NULL) > 0 + */ + return NtUserSetClipboardData(uFormat, hMem, 0); + } + + size = GlobalSize(hMem); + pMem = GlobalLock(hMem); + + if ((pMem) && (size)) + { + DPRINT1("[1]"); + size = GlobalSize(hMem); + ret = NtUserSetClipboardData(uFormat, pMem, size); + //sholud i unlock hMmem? + GlobalUnlock(hMem); + } + else + { + DPRINT1("SetClipboardData fail\n"); + } + + return ret; + } /* @@ -237,3 +356,35 @@ { return NtUserChangeClipboardChain(hWndRemove, hWndNewNext); } + +/* + * @unimplemented + */ +BOOL STDCALL +AddClipboardFormatListener(HWND hwnd) +{ + UNIMPLEMENTED; + return FALSE; +} +/* + * @unimplemented + */ +BOOL STDCALL +RemoveClipboardFormatListener(HWND hwnd) +{ + UNIMPLEMENTED; + return FALSE; +} + +/* + * @unimplemented + */ +BOOL STDCALL +GetUpdatedClipboardFormats( + PUINT lpuiFormats, + UINT cFormats, + PUINT pcFormatsOut) +{ + UNIMPLEMENTED; + return FALSE; +} Modified: trunk/reactos/dll/win32/user32/windows/defwnd.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/d…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/defwnd.c (original) +++ trunk/reactos/dll/win32/user32/windows/defwnd.c Wed Aug 30 23:35:22 2006 @@ -984,7 +984,31 @@ VOID FASTCALL DefWndScreenshot(HWND hWnd) { - + RECT rect; + + OpenClipboard(hWnd); + EmptyClipboard(); + + HDC hdc = GetWindowDC(hWnd); + GetWindowRect(hWnd, &rect); + INT w = rect.right - rect.left; + INT h = rect.bottom - rect.top; + + HBITMAP hbitmap = CreateCompatibleBitmap(hdc, w, h); + HDC hdc2 = CreateCompatibleDC(hdc); + SelectObject(hdc2, hbitmap); + + BitBlt(hdc2, 0, 0, w, h, + hdc, 0, 0, + SRCCOPY); + + SetClipboardData(CF_BITMAP, hbitmap); + + ReleaseDC(hWnd, hdc); + ReleaseDC(hWnd, hdc2); + + CloseClipboard(); + } LRESULT STDCALL @@ -1354,6 +1378,10 @@ iF10Key = 1; else if( wParam == VK_ESCAPE && (GetKeyState(VK_SHIFT) & 0x8000)) SendMessageW( hWnd, WM_SYSCOMMAND, SC_KEYMENU, ' ' ); + else if (wParam == VK_SNAPSHOT) + { + DefWndScreenshot(GetDesktopWindow()); + } break; } Modified: trunk/reactos/dll/win32/user32/windows/input.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/i…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/input.c (original) +++ trunk/reactos/dll/win32/user32/windows/input.c Wed Aug 30 23:35:22 2006 @@ -290,13 +290,12 @@ /* - * @unimplemented + * @implemented */ BOOL STDCALL GetLastInputInfo(PLASTINPUTINFO plii) { - UNIMPLEMENTED; - return FALSE; + return NtUserGetLastInputInfo(plii); }
18 years, 3 months
1
0
0
0
[ion] 23809: - It should now be safe to remove the V86 ESP0 hack, since V86 mode works fine (tested on VMWare/QEmu).
by ion@svn.reactos.org
Author: ion Date: Wed Aug 30 23:29:16 2006 New Revision: 23809 URL:
http://svn.reactos.org/svn/reactos?rev=23809&view=rev
Log: - It should now be safe to remove the V86 ESP0 hack, since V86 mode works fine (tested on VMWare/QEmu). Modified: trunk/reactos/ntoskrnl/include/internal/ke.h trunk/reactos/ntoskrnl/ke/bug.c trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S trunk/reactos/ntoskrnl/ke/i386/thread.c Modified: trunk/reactos/ntoskrnl/include/internal/ke.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/ke.h (original) +++ trunk/reactos/ntoskrnl/include/internal/ke.h Wed Aug 30 23:29:16 2006 @@ -48,6 +48,13 @@ PKINTERRUPT_ROUTINE ChainedDispatch; PKINTERRUPT_ROUTINE *FlatDispatch; } DISPATCH_INFO, *PDISPATCH_INFO; + +typedef PCHAR +(NTAPI *PKE_BUGCHECK_UNICODE_TO_ANSI)( + IN PUNICODE_STRING Unicode, + IN PCHAR Ansi, + IN ULONG Length +); struct _KIRQ_TRAPFRAME; struct _KPCR; @@ -76,6 +83,7 @@ extern ULONG KeI386EFlagsOrMaskV86; extern BOOLEAN KeI386VirtualIntExtensions; extern KIDTENTRY KiIdt[]; +extern FAST_MUTEX KernelAddressSpaceLock; /* MACROS *************************************************************************/ Modified: trunk/reactos/ntoskrnl/ke/bug.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/bug.c?rev=2380…
============================================================================== --- trunk/reactos/ntoskrnl/ke/bug.c (original) +++ trunk/reactos/ntoskrnl/ke/bug.c Wed Aug 30 23:29:16 2006 @@ -24,12 +24,10 @@ VOID ); -extern FAST_MUTEX KernelAddressSpaceLock; - /* GLOBALS *******************************************************************/ -LIST_ENTRY BugcheckCallbackListHead = {NULL,NULL}; -LIST_ENTRY BugcheckReasonCallbackListHead = {NULL,NULL}; +LIST_ENTRY BugcheckCallbackListHead; +LIST_ENTRY BugcheckReasonCallbackListHead; ULONG KeBugCheckActive, KeBugCheckOwner; LONG KeBugCheckOwnerRecursionCount; PRTL_MESSAGE_RESOURCE_DATA KiBugCodeMessages; @@ -37,13 +35,6 @@ ULONG KiHardwareTrigger; PUNICODE_STRING KiBugCheckDriver; ULONG_PTR KiBugCheckData[5]; - -typedef PCHAR -(NTAPI *PKE_BUGCHECK_UNICODE_TO_ANSI)( - IN PUNICODE_STRING Unicode, - IN PCHAR Ansi, - IN ULONG Length -); /* PRIVATE FUNCTIONS *********************************************************/ Modified: trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/ctxswitch…
============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S (original) +++ trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S Wed Aug 30 23:29:16 2006 @@ -299,11 +299,6 @@ /* Save the Exception list */ push [ebx+KPCR_EXCEPTION_LIST] -#if WE_DO_NOT_SPEAK_ABOUT_THE_V86_HACK // V86 HACK - mov ecx, [ebx+KPCR_TSS] - push [ecx+KTSS_ESP0] -#endif - /* DPC shouldn't be active */ cmp byte ptr [ebx+KPCR_PRCB_DPC_ROUTINE_ACTIVE], 0 jnz BugCheckDpc @@ -398,11 +393,6 @@ inc dword ptr [esi+KTHREAD_CONTEXT_SWITCHES] //inc dword ptr [esi+KPRC_PRCB_CONTEXT_SWITCHES] -#if WE_DO_NOT_SPEAK_ABOUT_THE_V86_HACK - mov ebp, [ebx+KPCR_TSS] - pop [ebp+KTSS_ESP0] -#endif - /* Restore exception list */ pop [ebx+KPCR_EXCEPTION_LIST] Modified: trunk/reactos/ntoskrnl/ke/i386/thread.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/thread.c?…
============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/thread.c (original) +++ trunk/reactos/ntoskrnl/ke/i386/thread.c Wed Aug 30 23:29:16 2006 @@ -14,9 +14,6 @@ typedef struct _KSHARED_CTXSWITCH_FRAME { -#if WE_DO_NOT_SPEAK_ABOUT_THE_V86_HACK // V86 HACK - ULONG_PTR Esp0; -#endif PVOID ExceptionList; KIRQL WaitIrql; PVOID RetEip; @@ -236,11 +233,6 @@ CtxSwitchFrame->RetEip = KiThreadStartup; CtxSwitchFrame->WaitIrql = APC_LEVEL; CtxSwitchFrame->ExceptionList = (PVOID)0xFFFFFFFF; -#if WE_DO_NOT_SPEAK_ABOUT_THE_V86_HACK // V86 HACK - CtxSwitchFrame->Esp0 = (ULONG_PTR)Thread->InitialStack - - sizeof(FX_SAVE_AREA) - - 0x10; -#endif /* Save back the new value of the kernel stack. */ DPRINT("Final Kernel Stack: %x \n", CtxSwitchFrame);
18 years, 3 months
1
0
0
0
[hpoussin] 23808: Update MSI to current Wine version. Autosync will be put in place very soon for this dll.
by hpoussin@svn.reactos.org
Author: hpoussin Date: Wed Aug 30 23:24:26 2006 New Revision: 23808 URL:
http://svn.reactos.org/svn/reactos?rev=23808&view=rev
Log: Update MSI to current Wine version. Autosync will be put in place very soon for this dll. Added: trunk/reactos/dll/win32/msi/alter.c Removed: trunk/reactos/dll/win32/msi/Makefile.in Modified: trunk/reactos/dll/win32/msi/action.c trunk/reactos/dll/win32/msi/action.h trunk/reactos/dll/win32/msi/classes.c trunk/reactos/dll/win32/msi/cond.y trunk/reactos/dll/win32/msi/database.c trunk/reactos/dll/win32/msi/dialog.c trunk/reactos/dll/win32/msi/events.c trunk/reactos/dll/win32/msi/files.c trunk/reactos/dll/win32/msi/handle.c trunk/reactos/dll/win32/msi/helpers.c trunk/reactos/dll/win32/msi/install.c trunk/reactos/dll/win32/msi/join.c (contents, props changed) trunk/reactos/dll/win32/msi/msi.c trunk/reactos/dll/win32/msi/msi.rbuild trunk/reactos/dll/win32/msi/msi.spec trunk/reactos/dll/win32/msi/msi_Bg.rc trunk/reactos/dll/win32/msi/msi_De.rc trunk/reactos/dll/win32/msi/msi_En.rc trunk/reactos/dll/win32/msi/msi_Eo.rc (contents, props changed) trunk/reactos/dll/win32/msi/msi_Es.rc trunk/reactos/dll/win32/msi/msi_Fi.rc trunk/reactos/dll/win32/msi/msi_Fr.rc trunk/reactos/dll/win32/msi/msi_Hu.rc (contents, props changed) trunk/reactos/dll/win32/msi/msi_It.rc (contents, props changed) trunk/reactos/dll/win32/msi/msi_Ko.rc trunk/reactos/dll/win32/msi/msi_Nl.rc trunk/reactos/dll/win32/msi/msi_No.rc trunk/reactos/dll/win32/msi/msi_Pt.rc trunk/reactos/dll/win32/msi/msi_Ru.rc trunk/reactos/dll/win32/msi/msi_Tr.rc (contents, props changed) trunk/reactos/dll/win32/msi/msi_main.c trunk/reactos/dll/win32/msi/msipriv.h trunk/reactos/dll/win32/msi/msiquery.c trunk/reactos/dll/win32/msi/package.c trunk/reactos/dll/win32/msi/preview.c trunk/reactos/dll/win32/msi/query.h trunk/reactos/dll/win32/msi/record.c trunk/reactos/dll/win32/msi/registry.c trunk/reactos/dll/win32/msi/regsvr.c trunk/reactos/dll/win32/msi/source.c trunk/reactos/dll/win32/msi/sql.y trunk/reactos/dll/win32/msi/string.c trunk/reactos/dll/win32/msi/suminfo.c trunk/reactos/dll/win32/msi/table.c trunk/reactos/dll/win32/msi/tokenize.c trunk/reactos/include/psdk/msiquery.h [This mail would be too long, it was shortened to contain the URLs only.] Removed: trunk/reactos/dll/win32/msi/Makefile.in URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/Makefile.in?…
Modified: trunk/reactos/dll/win32/msi/action.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/action.c?rev…
Modified: trunk/reactos/dll/win32/msi/action.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/action.h?rev…
Added: trunk/reactos/dll/win32/msi/alter.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/alter.c?rev=…
Modified: trunk/reactos/dll/win32/msi/classes.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/classes.c?re…
Modified: trunk/reactos/dll/win32/msi/cond.y URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/cond.y?rev=2…
Modified: trunk/reactos/dll/win32/msi/database.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/database.c?r…
Modified: trunk/reactos/dll/win32/msi/dialog.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/dialog.c?rev…
Modified: trunk/reactos/dll/win32/msi/events.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/events.c?rev…
Modified: trunk/reactos/dll/win32/msi/files.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/files.c?rev=…
Modified: trunk/reactos/dll/win32/msi/handle.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/handle.c?rev…
Modified: trunk/reactos/dll/win32/msi/helpers.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/helpers.c?re…
Modified: trunk/reactos/dll/win32/msi/install.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/install.c?re…
Modified: trunk/reactos/dll/win32/msi/join.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/join.c?rev=2…
Modified: trunk/reactos/dll/win32/msi/msi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/msi.c?rev=23…
Modified: trunk/reactos/dll/win32/msi/msi.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/msi.rbuild?r…
Modified: trunk/reactos/dll/win32/msi/msi.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/msi.spec?rev…
Modified: trunk/reactos/dll/win32/msi/msi_Bg.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/msi_Bg.rc?re…
Modified: trunk/reactos/dll/win32/msi/msi_De.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/msi_De.rc?re…
Modified: trunk/reactos/dll/win32/msi/msi_En.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/msi_En.rc?re…
Modified: trunk/reactos/dll/win32/msi/msi_Eo.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/msi_Eo.rc?re…
Modified: trunk/reactos/dll/win32/msi/msi_Es.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/msi_Es.rc?re…
Modified: trunk/reactos/dll/win32/msi/msi_Fi.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/msi_Fi.rc?re…
Modified: trunk/reactos/dll/win32/msi/msi_Fr.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/msi_Fr.rc?re…
Modified: trunk/reactos/dll/win32/msi/msi_Hu.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/msi_Hu.rc?re…
Modified: trunk/reactos/dll/win32/msi/msi_It.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/msi_It.rc?re…
Modified: trunk/reactos/dll/win32/msi/msi_Ko.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/msi_Ko.rc?re…
Modified: trunk/reactos/dll/win32/msi/msi_Nl.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/msi_Nl.rc?re…
Modified: trunk/reactos/dll/win32/msi/msi_No.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/msi_No.rc?re…
Modified: trunk/reactos/dll/win32/msi/msi_Pt.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/msi_Pt.rc?re…
Modified: trunk/reactos/dll/win32/msi/msi_Ru.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/msi_Ru.rc?re…
Modified: trunk/reactos/dll/win32/msi/msi_Tr.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/msi_Tr.rc?re…
Modified: trunk/reactos/dll/win32/msi/msi_main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/msi_main.c?r…
Modified: trunk/reactos/dll/win32/msi/msipriv.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/msipriv.h?re…
Modified: trunk/reactos/dll/win32/msi/msiquery.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/msiquery.c?r…
Modified: trunk/reactos/dll/win32/msi/package.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/package.c?re…
Modified: trunk/reactos/dll/win32/msi/preview.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/preview.c?re…
Modified: trunk/reactos/dll/win32/msi/query.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/query.h?rev=…
Modified: trunk/reactos/dll/win32/msi/record.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/record.c?rev…
Modified: trunk/reactos/dll/win32/msi/registry.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/registry.c?r…
Modified: trunk/reactos/dll/win32/msi/regsvr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/regsvr.c?rev…
Modified: trunk/reactos/dll/win32/msi/source.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/source.c?rev…
Modified: trunk/reactos/dll/win32/msi/sql.y URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/sql.y?rev=23…
Modified: trunk/reactos/dll/win32/msi/string.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/string.c?rev…
Modified: trunk/reactos/dll/win32/msi/suminfo.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/suminfo.c?re…
Modified: trunk/reactos/dll/win32/msi/table.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/table.c?rev=…
Modified: trunk/reactos/dll/win32/msi/tokenize.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/tokenize.c?r…
Modified: trunk/reactos/include/psdk/msiquery.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/msiquery.h?re…
18 years, 3 months
1
0
0
0
[gedmurphy] 23807: [WINESYNC] update comctl32 to Wine_0.9.20
by gedmurphy@svn.reactos.org
Author: gedmurphy Date: Wed Aug 30 23:18:49 2006 New Revision: 23807 URL:
http://svn.reactos.org/svn/reactos?rev=23807&view=rev
Log: [WINESYNC] update comctl32 to Wine_0.9.20 Modified: trunk/reactos/dll/win32/comctl32/imagelist.c trunk/reactos/dll/win32/comctl32/propsheet.c trunk/reactos/dll/win32/comctl32/toolbar.c Modified: trunk/reactos/dll/win32/comctl32/imagelist.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/imageli…
============================================================================== --- trunk/reactos/dll/win32/comctl32/imagelist.c (original) +++ trunk/reactos/dll/win32/comctl32/imagelist.c Wed Aug 30 23:18:49 2006 @@ -2158,6 +2158,7 @@ { HDC hdcImage; BITMAP bmp; + HBITMAP hOldBitmap; TRACE("%p %d %p %p\n", himl, i, hbmImage, hbmMask); @@ -2175,29 +2176,34 @@ GetObjectA (hbmImage, sizeof(BITMAP), (LPVOID)&bmp); /* Replace Image */ - SelectObject (hdcImage, hbmImage); + hOldBitmap = SelectObject (hdcImage, hbmImage); StretchBlt (himl->hdcImage, i * himl->cx, 0, himl->cx, himl->cy, hdcImage, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY); if (himl->hbmMask) { - /* Replace Mask */ - SelectObject (hdcImage, hbmMask); + HDC hdcTemp; + HBITMAP hOldBitmapTemp; + + hdcTemp = CreateCompatibleDC(0); + hOldBitmapTemp = SelectObject(hdcTemp, hbmMask); StretchBlt (himl->hdcMask, i * himl->cx, 0, himl->cx, himl->cy, - hdcImage, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY); - + hdcTemp, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY); + SelectObject(hdcTemp, hOldBitmapTemp); + DeleteDC(hdcTemp); /* Remove the background from the image */ - StretchBlt (himl->hdcImage, - i*himl->cx, 0, himl->cx, himl->cy, - hdcImage, - 0, 0, bmp.bmWidth, bmp.bmHeight, + BitBlt (himl->hdcImage, + i*himl->cx, 0, bmp.bmWidth, bmp.bmHeight, + himl->hdcMask, + i*himl->cx, 0, 0x220326); /* NOTSRCAND */ } + SelectObject (hdcImage, hOldBitmap); DeleteDC (hdcImage); return TRUE; Modified: trunk/reactos/dll/win32/comctl32/propsheet.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/propshe…
============================================================================== --- trunk/reactos/dll/win32/comctl32/propsheet.c (original) +++ trunk/reactos/dll/win32/comctl32/propsheet.c Wed Aug 30 23:18:49 2006 @@ -2079,6 +2079,21 @@ continue; } } + + /* Invalidate the header area */ + if ( (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) && + (psInfo->ppshheader.dwFlags & PSH_HEADER) ) + { + HWND hwndLineHeader = GetDlgItem(hwndDlg, IDC_SUNKEN_LINEHEADER); + RECT r; + + GetClientRect(hwndLineHeader, &r); + MapWindowPoints(hwndLineHeader, hwndDlg, (LPPOINT) &r, 2); + SetRect(&r, 0, 0, r.right + 1, r.top - 1); + + InvalidateRect(hwndDlg, &r, TRUE); + } + /* * Display the new page. */ @@ -3254,15 +3269,16 @@ } else { + int margin; hbr = GetSysColorBrush(COLOR_WINDOW); FillRect(hdc, &rzone, hbr); /* Draw the header bitmap. It's always centered like a * common 49 x 49 bitmap. */ - BitBlt(hdc, rzone.right - 49 - ((rzone.bottom - 49) / 2), - (rzone.bottom - 49) / 2, - bm.bmWidth, bm.bmHeight, - hdcSrc, 0, 0, SRCCOPY); + margin = (rzone.bottom - 49) / 2; + BitBlt(hdc, rzone.right - 49 - margin, margin, + min(bm.bmWidth, 49), min(bm.bmHeight, 49), + hdcSrc, 0, 0, SRCCOPY); /* NOTE: Native COMCTL32 draws a white stripe over the bitmap * if its height is smaller than 49 pixels. Because the reason @@ -3276,22 +3292,14 @@ if (ppshpage->dwFlags & PSP_USEHEADERTITLE) { SetRect(&r, 20, 10, 0, 0); if (HIWORD(ppshpage->pszHeaderTitle)) - { - if (psInfo->unicode) - DrawTextW(hdc, (LPWSTR)ppshpage->pszHeaderTitle, - -1, &r, DT_LEFT | DT_SINGLELINE | DT_NOCLIP); - else - DrawTextA(hdc, (LPCSTR)ppshpage->pszHeaderTitle, - -1, &r, DT_LEFT | DT_SINGLELINE | DT_NOCLIP); - } + DrawTextW(hdc, ppshpage->pszHeaderTitle, -1, &r, DT_LEFT | DT_SINGLELINE | DT_NOCLIP); else { nLength = LoadStringW(ppshpage->hInstance, (UINT_PTR)ppshpage->pszHeaderTitle, szBuffer, 256); if (nLength != 0) { - DrawTextW(hdc, szBuffer, nLength, - &r, DT_LEFT | DT_SINGLELINE | DT_NOCLIP); + DrawTextW(hdc, szBuffer, nLength, &r, DT_LEFT | DT_SINGLELINE | DT_NOCLIP); } } } @@ -3300,22 +3308,14 @@ SelectObject(hdc, psInfo->hFont); SetRect(&r, 40, 25, rzone.right - 69, rzone.bottom); if (HIWORD(ppshpage->pszHeaderTitle)) - { - if (psInfo->unicode) - DrawTextW(hdc, (LPWSTR)ppshpage->pszHeaderSubTitle, - -1, &r, DT_LEFT | DT_SINGLELINE); - else - DrawTextA(hdc, (LPCSTR)ppshpage->pszHeaderSubTitle, - -1, &r, DT_LEFT | DT_SINGLELINE); - } + DrawTextW(hdc, ppshpage->pszHeaderSubTitle, -1, &r, DT_LEFT | DT_WORDBREAK); else { nLength = LoadStringW(ppshpage->hInstance, (UINT_PTR)ppshpage->pszHeaderSubTitle, szBuffer, 256); if (nLength != 0) { - DrawTextW(hdc, szBuffer, nLength, - &r, DT_LEFT | DT_SINGLELINE); + DrawTextW(hdc, szBuffer, nLength, &r, DT_LEFT | DT_WORDBREAK); } } } @@ -3348,6 +3348,8 @@ GetObjectW(psInfo->ppshheader.u4.hbmWatermark, sizeof(BITMAP), (LPVOID)&bm); hbmp = SelectObject(hdcSrc, psInfo->ppshheader.u4.hbmWatermark); + /* The watermark is truncated to a width of 164 pixels */ + r.right = min(r.right, 164); BitBlt(hdc, 0, offsety, min(bm.bmWidth, r.right), min(bm.bmHeight, r.bottom), hdcSrc, 0, 0, SRCCOPY); Modified: trunk/reactos/dll/win32/comctl32/toolbar.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/toolbar…
============================================================================== --- trunk/reactos/dll/win32/comctl32/toolbar.c (original) +++ trunk/reactos/dll/win32/comctl32/toolbar.c Wed Aug 30 23:18:49 2006 @@ -696,8 +696,9 @@ draw_masked = TRUE; } } - else if ((tbcd->nmcd.uItemState & CDIS_HOT) - && ((infoPtr->dwStyle & TBSTYLE_FLAT) || GetWindowTheme (infoPtr->hwndSelf))) + else if (tbcd->nmcd.uItemState & CDIS_CHECKED || + ((tbcd->nmcd.uItemState & CDIS_HOT) + && ((infoPtr->dwStyle & TBSTYLE_FLAT) || GetWindowTheme (infoPtr->hwndSelf)))) { /* if hot, attempt to draw with hot image list, if fails, use default image list */ @@ -2688,48 +2689,48 @@ switch (lpAddBmp->nID) { case IDB_STD_SMALL_COLOR: - hbmLoad = LoadBitmapW (COMCTL32_hModule, - MAKEINTRESOURCEW(IDB_STD_SMALL)); + hbmLoad = CreateMappedBitmap (COMCTL32_hModule, + IDB_STD_SMALL, 0, NULL, 0); nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace); DeleteObject (hbmLoad); break; case IDB_STD_LARGE_COLOR: - hbmLoad = LoadBitmapW (COMCTL32_hModule, - MAKEINTRESOURCEW(IDB_STD_LARGE)); + hbmLoad = CreateMappedBitmap (COMCTL32_hModule, + IDB_STD_LARGE, 0, NULL, 0); nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace); DeleteObject (hbmLoad); break; case IDB_VIEW_SMALL_COLOR: - hbmLoad = LoadBitmapW (COMCTL32_hModule, - MAKEINTRESOURCEW(IDB_VIEW_SMALL)); + hbmLoad = CreateMappedBitmap (COMCTL32_hModule, + IDB_VIEW_SMALL, 0, NULL, 0); nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace); DeleteObject (hbmLoad); break; case IDB_VIEW_LARGE_COLOR: - hbmLoad = LoadBitmapW (COMCTL32_hModule, - MAKEINTRESOURCEW(IDB_VIEW_LARGE)); + hbmLoad = CreateMappedBitmap (COMCTL32_hModule, + IDB_VIEW_LARGE, 0, NULL, 0); nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace); DeleteObject (hbmLoad); break; case IDB_HIST_SMALL_COLOR: - hbmLoad = LoadBitmapW (COMCTL32_hModule, - MAKEINTRESOURCEW(IDB_HIST_SMALL)); + hbmLoad = CreateMappedBitmap (COMCTL32_hModule, + IDB_HIST_SMALL, 0, NULL, 0); nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace); DeleteObject (hbmLoad); break; case IDB_HIST_LARGE_COLOR: - hbmLoad = LoadBitmapW (COMCTL32_hModule, - MAKEINTRESOURCEW(IDB_HIST_LARGE)); + hbmLoad = CreateMappedBitmap (COMCTL32_hModule, + IDB_HIST_LARGE, 0, NULL, 0); nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace); DeleteObject (hbmLoad); @@ -2743,7 +2744,7 @@ } else { - hbmLoad = LoadBitmapW (lpAddBmp->hInst, (LPWSTR)lpAddBmp->nID); + hbmLoad = CreateMappedBitmap(lpAddBmp->hInst, lpAddBmp->nID, 0, NULL, 0); nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace); DeleteObject (hbmLoad); }
18 years, 3 months
1
0
0
0
[weiden] 23806: Implement Slim Reader/Writer (SRW) locks: - Implement AcquireSRWLockExclusive(), AcquireSRWLockShared(), InitializeSRWLock(), ReleaseSRWLockExclusive(), ReleaseSRWLockShared() - NOTE: Some versions of GCC have a code generation bug with specially aligned structures on the stack. If compiled with such a compiler, the code might trigger special assertions. Pushlocks are also affected by this compiler bug. - NOTE: The algorithms are most likely not the same as in Windows. Applicatio
by weiden@svn.reactos.org
Author: weiden Date: Wed Aug 30 23:02:42 2006 New Revision: 23806 URL:
http://svn.reactos.org/svn/reactos?rev=23806&view=rev
Log: Implement Slim Reader/Writer (SRW) locks: - Implement AcquireSRWLockExclusive(), AcquireSRWLockShared(), InitializeSRWLock(), ReleaseSRWLockExclusive(), ReleaseSRWLockShared() - NOTE: Some versions of GCC have a code generation bug with specially aligned structures on the stack. If compiled with such a compiler, the code might trigger special assertions. Pushlocks are also affected by this compiler bug. - NOTE: The algorithms are most likely not the same as in Windows. Applications are supposed to treat the lock variables as opaque data, therefore it shouldn't matter. Added: trunk/reactos/lib/rtl/srw.c (with props) Modified: trunk/reactos/dll/ntdll/def/ntdll.def trunk/reactos/dll/win32/kernel32/kernel32.def trunk/reactos/include/psdk/winbase.h trunk/reactos/include/psdk/winnt.h trunk/reactos/lib/rtl/rtl.rbuild Modified: trunk/reactos/dll/ntdll/def/ntdll.def URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/def/ntdll.def?re…
============================================================================== --- trunk/reactos/dll/ntdll/def/ntdll.def (original) +++ trunk/reactos/dll/ntdll/def/ntdll.def Wed Aug 30 23:02:42 2006 @@ -295,6 +295,8 @@ RtlAcquirePebLock@0 RtlAcquireResourceExclusive@8 RtlAcquireResourceShared@8 +RtlAcquireSRWLockExclusive@4 +RtlAcquireSRWLockShared@4 RtlAddAccessAllowedAce@16 RtlAddAccessAllowedAceEx@20 RtlAddAccessAllowedObjectAce@28 @@ -513,6 +515,7 @@ RtlInitializeResource@4 ;RtlInitializeRXact RtlInitializeSid@12 +RtlInitializeSRWLock@4 RtlInsertElementGenericTable@16 RtlInsertElementGenericTableAvl@16 RtlInsertElementGenericTableFull@24 @@ -612,6 +615,8 @@ RtlReleasePebLock@0 RtlReleaseRelativeName@4 RtlReleaseResource@4 +RtlReleaseSRWLockExclusive@4 +RtlReleaseSRWLockShared@4 ;RtlRemoteCall RtlRemoveVectoredExceptionHandler@4 RtlResetRtlTranslations@4 Modified: trunk/reactos/dll/win32/kernel32/kernel32.def URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/kernel3…
============================================================================== --- trunk/reactos/dll/win32/kernel32/kernel32.def (original) +++ trunk/reactos/dll/win32/kernel32/kernel32.def Wed Aug 30 23:02:42 2006 @@ -30,6 +30,8 @@ ; LIBRARY KERNEL32.DLL EXPORTS +AcquireSRWLockExclusive(a)4=NTDLL.RtlAcquireSRWLockExclusive +AcquireSRWLockShared(a)4=NTDLL.RtlAcquireSRWLockShared ActivateActCtx@8 AddAtomA@4 AddAtomW@4 @@ -587,6 +589,7 @@ InitializeCriticalSection@4 InitializeCriticalSectionAndSpinCount@8 InitializeSListHead(a)4=NTDLL.RtlInitializeSListHead +InitializeSRWLock(a)4=NTDLL.RtlInitializeSRWLock InterlockedCompareExchange@12 InterlockedDecrement@4 InterlockedExchange@8 @@ -749,6 +752,8 @@ ReleaseActCtx@4 ReleaseMutex@4 ReleaseSemaphore@12 +ReleaseSRWLockExclusive(a)4=NTDLL.RtlReleaseSRWLockExclusive +ReleaseSRWLockShared(a)4=NTDLL.RtlReleaseSRWLockShared RemoveDirectoryA@4 RemoveDirectoryW@4 ;RemoveLocalAlternateComputerNameA Modified: trunk/reactos/include/psdk/winbase.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winbase.h?rev…
============================================================================== --- trunk/reactos/include/psdk/winbase.h (original) +++ trunk/reactos/include/psdk/winbase.h Wed Aug 30 23:02:42 2006 @@ -540,6 +540,9 @@ #define CREATE_EVENT_INITIAL_SET 0x2 #define CREATE_MUTEX_INITIAL_OWNER 0x1 #define CREATE_WAITABLE_TIMER_MANUAL_RESET 0x1 +#define SRWLOCK_INIT RTL_SRWLOCK_INIT +#define CONDITION_VARIABLE_INIT RTL_CONDITION_VARIABLE_INIT +#define CONDITION_VARIABLE_LOCKMODE_SHARED RTL_CONDITION_VARIABLE_LOCKMODE_SHARED #endif #ifndef RC_INVOKED @@ -1053,6 +1056,9 @@ DWORD MemberLevel; DWORD Flags; } JOB_SET_ARRAY, *PJOB_SET_ARRAY; +#if (_WIN32_WINNT >= 0x0600) +typedef RTL_SRWLOCK SRWLOCK, *PSRWLOCK; +#endif typedef DWORD(WINAPI *LPPROGRESS_ROUTINE)(LARGE_INTEGER,LARGE_INTEGER,LARGE_INTEGER,LARGE_INTEGER,DWORD,DWORD,HANDLE,HANDLE,LPVOID); typedef void(WINAPI *LPFIBER_START_ROUTINE)(PVOID); typedef VOID (WINAPI *PFLS_CALLBACK_FUNCTION)(PVOID); @@ -1093,6 +1099,10 @@ BOOL WINAPI AccessCheck(PSECURITY_DESCRIPTOR,HANDLE,DWORD,PGENERIC_MAPPING,PPRIVILEGE_SET,PDWORD,PDWORD,PBOOL); BOOL WINAPI AccessCheckAndAuditAlarmA(LPCSTR,LPVOID,LPSTR,LPSTR,PSECURITY_DESCRIPTOR,DWORD,PGENERIC_MAPPING,BOOL,PDWORD,PBOOL,PBOOL); BOOL WINAPI AccessCheckAndAuditAlarmW(LPCWSTR,LPVOID,LPWSTR,LPWSTR,PSECURITY_DESCRIPTOR,DWORD,PGENERIC_MAPPING,BOOL,PDWORD,PBOOL,PBOOL); +#if (_WIN32_WINNT >= 0x0600) +VOID WINAPI AcquireSRWLockExclusive(PSRWLOCK); +VOID WINAPI AcquireSRWLockShared(PSRWLOCK); +#endif #if (_WIN32_WINNT >= 0x0501) BOOL WINAPI ActivateActCtx(HANDLE,ULONG_PTR*); #endif @@ -1659,6 +1669,9 @@ BOOL WINAPI InitializeSid (PSID,PSID_IDENTIFIER_AUTHORITY,BYTE); #if !defined(__WINDDK_H) && _WIN32_WINNT >= 0x0501 VOID WINAPI InitializeSListHead(PSLIST_HEADER); +#endif +#if (_WIN32_WINNT >= 0x0600) +VOID WINAPI InitializeSRWLock(PSRWLOCK); #endif #ifndef __INTERLOCKED_DECLARED #define __INTERLOCKED_DECLARED @@ -1842,6 +1855,10 @@ #endif BOOL WINAPI ReleaseMutex(HANDLE); BOOL WINAPI ReleaseSemaphore(HANDLE,LONG,LPLONG); +#if (_WIN32_WINNT >= 0x0600) +VOID WINAPI ReleaseSRWLockExclusive(PSRWLOCK); +VOID WINAPI ReleaseSRWLockShared(PSRWLOCK); +#endif BOOL WINAPI RemoveDirectoryA(LPCSTR); BOOL WINAPI RemoveDirectoryW(LPCWSTR); #if (_WIN32_WINNT >= 0x0500) Modified: trunk/reactos/include/psdk/winnt.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winnt.h?rev=2…
============================================================================== --- trunk/reactos/include/psdk/winnt.h (original) +++ trunk/reactos/include/psdk/winnt.h Wed Aug 30 23:02:42 2006 @@ -2626,6 +2626,19 @@ } RTL_CRITICAL_SECTION,*PRTL_CRITICAL_SECTION; #endif +#define RTL_SRWLOCK_INIT {0} +typedef struct _RTL_SRWLOCK +{ + PVOID Ptr; +} RTL_SRWLOCK, *PRTL_SRWLOCK; + +#define RTL_CONDITION_VARIABLE_INIT {0} +#define RTL_CONDITION_VARIABLE_LOCKMODE_SHARED 0x1 +typedef struct _RTL_CONDITION_VARIABLE +{ + PVOID Ptr; +} RTL_CONDITION_VARIABLE, *PRTL_CONDITION_VARIABLE; + typedef LONG (NTAPI *PVECTORED_EXCEPTION_HANDLER)( struct _EXCEPTION_POINTERS *ExceptionInfo Modified: trunk/reactos/lib/rtl/rtl.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/rtl.rbuild?rev=238…
============================================================================== --- trunk/reactos/lib/rtl/rtl.rbuild (original) +++ trunk/reactos/lib/rtl/rtl.rbuild Wed Aug 30 23:02:42 2006 @@ -84,6 +84,7 @@ <file>security.c</file> <file>sid.c</file> <file>sprintf.c</file> + <file>srw.c</file> <file>swprintf.c</file> <file>splaytree.c</file> <file>thread.c</file> Added: trunk/reactos/lib/rtl/srw.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/srw.c?rev=23806&vi…
============================================================================== --- trunk/reactos/lib/rtl/srw.c (added) +++ trunk/reactos/lib/rtl/srw.c Wed Aug 30 23:02:42 2006 @@ -1,0 +1,832 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Slim Reader/Writer (SRW) Routines + * PROGRAMMER: Thomas Weidenmueller <w3seek(a)reactos.com> + * + * NOTES: The algorithms used in this implementation + * may be different from Vista's implementation. + * Since applications should treat the RTL_SRWLOCK + * structure as opaque data, it should not matter. + * The algorithms are probably not as optimized. + */ + +/* INCLUDES *****************************************************************/ + +#include <rtl.h> + +#define NDEBUG +#include <debug.h> + +/* FIXME *********************************************************************/ + +/* FIXME: Interlocked functions that need to be made into a public header */ +FORCEINLINE +LONG +InterlockedAnd(IN OUT volatile LONG *Target, + IN LONG Set) +{ + LONG i; + LONG j; + + j = *Target; + do { + i = j; + j = InterlockedCompareExchange((PLONG)Target, + i & Set, + i); + + } while (i != j); + + return j; +} + +FORCEINLINE +LONG +InterlockedOr(IN OUT volatile LONG *Target, + IN LONG Set) +{ + LONG i; + LONG j; + + j = *Target; + do { + i = j; + j = InterlockedCompareExchange((PLONG)Target, + i | Set, + i); + + } while (i != j); + + return j; +} + +/* FUNCTIONS *****************************************************************/ + +#ifdef _WIN64 +#define InterlockedBitTestAndSetPointer(ptr,val) InterlockedBitTestAndSet64((PLONGLONG)ptr,(LONGLONG)val) +#define InterlockedAddPointer(ptr,val) InterlockedAdd64((PLONGLONG)ptr,(LONGLONG)val) +#define InterlockedAndPointer(ptr,val) InterlockedAnd64((PLONGLONG)ptr,(LONGLONG)val) +#define InterlockedOrPointer(ptr,val) InterlockedOr64((PLONGLONG)ptr,(LONGLONG)val) +#else +#define InterlockedBitTestAndSetPointer(ptr,val) InterlockedBitTestAndSet((PLONG)ptr,(LONG)val) +#define InterlockedAddPointer(ptr,val) InterlockedAdd((PLONG)ptr,(LONG)val) +#define InterlockedAndPointer(ptr,val) InterlockedAnd((PLONG)ptr,(LONG)val) +#define InterlockedOrPointer(ptr,val) InterlockedOr((PLONG)ptr,(LONG)val) +#endif + +#define RTL_SRWLOCK_OWNED_BIT 0 +#define RTL_SRWLOCK_CONTENDED_BIT 1 +#define RTL_SRWLOCK_SHARED_BIT 2 +#define RTL_SRWLOCK_CONTENTION_LOCK_BIT 3 +#define RTL_SRWLOCK_OWNED (1 << RTL_SRWLOCK_OWNED_BIT) +#define RTL_SRWLOCK_CONTENDED (1 << RTL_SRWLOCK_CONTENDED_BIT) +#define RTL_SRWLOCK_SHARED (1 << RTL_SRWLOCK_SHARED_BIT) +#define RTL_SRWLOCK_CONTENTION_LOCK (1 << RTL_SRWLOCK_CONTENTION_LOCK_BIT) +#define RTL_SRWLOCK_MASK (RTL_SRWLOCK_OWNED | RTL_SRWLOCK_CONTENDED | \ + RTL_SRWLOCK_SHARED | RTL_SRWLOCK_CONTENTION_LOCK) +#define RTL_SRWLOCK_BITS 4 + +#if defined(__GNUC__) +/* This macro will cause the code to assert if compiled with a buggy + version of GCC that doesn't align the wait blocks properly on the stack! */ +#define ASSERT_SRW_WAITBLOCK(ptr) \ + ASSERT(((ULONG_PTR)ptr & ((1 << RTL_SRWLOCK_BITS) - 1)) == 0) +#else +#define ASSERT_SRW_WAITBLOCK(ptr) +#endif + +typedef struct _RTLP_SRWLOCK_SHARED_WAKE +{ + LONG Wake; + volatile struct _RTLP_SRWLOCK_SHARED_WAKE *Next; +} volatile RTLP_SRWLOCK_SHARED_WAKE, *PRTLP_SRWLOCK_SHARED_WAKE; + +typedef struct _RTLP_SRWLOCK_WAITBLOCK +{ + /* SharedCount is the number of shared acquirers. */ + LONG SharedCount; + + /* Last points to the last wait block in the chain. The value + is only valid when read from the first wait block. */ + volatile struct _RTLP_SRWLOCK_WAITBLOCK *Last; + + /* Next points to the next wait block in the chain. */ + volatile struct _RTLP_SRWLOCK_WAITBLOCK *Next; + + union + { + /* Wake is only valid for exclusive wait blocks */ + LONG Wake; + /* The wake chain is only valid for shared wait blocks */ + struct + { + PRTLP_SRWLOCK_SHARED_WAKE SharedWakeChain; + PRTLP_SRWLOCK_SHARED_WAKE LastSharedWake; + }; + }; + + BOOLEAN Exclusive; +} volatile RTLP_SRWLOCK_WAITBLOCK, *PRTLP_SRWLOCK_WAITBLOCK; + + +static VOID +NTAPI +RtlpReleaseWaitBlockLockExclusive(IN OUT PRTL_SRWLOCK SRWLock, + IN PRTLP_SRWLOCK_WAITBLOCK FirstWaitBlock) +{ + PRTLP_SRWLOCK_WAITBLOCK Next; + LONG_PTR NewValue; + + /* NOTE: We're currently in an exclusive lock in contended mode. */ + + Next = FirstWaitBlock->Next; + if (Next != NULL) + { + /* There's more blocks chained, we need to update the pointers + in the next wait block and update the wait block pointer. */ + NewValue = (LONG_PTR)Next | RTL_SRWLOCK_OWNED | RTL_SRWLOCK_CONTENDED; + if (!FirstWaitBlock->Exclusive) + { + /* The next wait block has to be an exclusive lock! */ + ASSERT(Next->Exclusive); + + /* Save the shared count */ + Next->SharedCount = FirstWaitBlock->SharedCount; + + NewValue |= RTL_SRWLOCK_SHARED; + } + + Next->Last = FirstWaitBlock->Last; + } + else + { + /* Convert the lock to a simple lock. */ + if (FirstWaitBlock->Exclusive) + NewValue = RTL_SRWLOCK_OWNED; + else + { + ASSERT(FirstWaitBlock->SharedCount > 0); + + NewValue = ((LONG_PTR)FirstWaitBlock->SharedCount << RTL_SRWLOCK_BITS) | + RTL_SRWLOCK_SHARED | RTL_SRWLOCK_OWNED; + } + } + + (void)InterlockedExchangePointer(&SRWLock->Ptr, + (PVOID)NewValue); + + if (FirstWaitBlock->Exclusive) + { + (void)InterlockedOr(&FirstWaitBlock->Wake, + TRUE); + } + else + { + PRTLP_SRWLOCK_SHARED_WAKE WakeChain, Next; + + /* If we were the first one to acquire the shared + lock, we now need to wake all others... */ + WakeChain = FirstWaitBlock->SharedWakeChain; + do + { + Next = WakeChain->Next; + + (void)InterlockedOr((PLONG)&WakeChain->Wake, + TRUE); + + WakeChain = Next; + } while (WakeChain != NULL); + } +} + + +static VOID +NTAPI +RtlpReleaseWaitBlockLockLastShared(IN OUT PRTL_SRWLOCK SRWLock, + IN PRTLP_SRWLOCK_WAITBLOCK FirstWaitBlock) +{ + PRTLP_SRWLOCK_WAITBLOCK Next; + LONG_PTR NewValue; + + /* NOTE: We're currently in a shared lock in contended mode. */ + + /* The next acquirer to be unwaited *must* be an exclusive lock! */ + ASSERT(FirstWaitBlock->Exclusive); + + Next = FirstWaitBlock->Next; + if (Next != NULL) + { + /* There's more blocks chained, we need to update the pointers + in the next wait block and update the wait block pointer. */ + NewValue = (LONG_PTR)Next | RTL_SRWLOCK_OWNED | RTL_SRWLOCK_CONTENDED; + + Next->Last = FirstWaitBlock->Last; + } + else + { + /* Convert the lock to a simple exclusive lock. */ + NewValue = RTL_SRWLOCK_OWNED; + } + + (void)InterlockedExchangePointer(&SRWLock->Ptr, + (PVOID)NewValue); + + (void)InterlockedOr(&FirstWaitBlock->Wake, + TRUE); +} + + +static VOID +NTAPI +RtlpReleaseWaitBlockLock(IN OUT PRTL_SRWLOCK SRWLock) +{ + InterlockedAndPointer(&SRWLock->Ptr, + ~RTL_SRWLOCK_CONTENTION_LOCK); +} + + +static PRTLP_SRWLOCK_WAITBLOCK +NTAPI +RtlpAcquireWaitBlockLock(IN OUT PRTL_SRWLOCK SRWLock) +{ + LONG_PTR PrevValue; + PRTLP_SRWLOCK_WAITBLOCK WaitBlock; + + while (1) + { + PrevValue = InterlockedOrPointer(&SRWLock->Ptr, + RTL_SRWLOCK_CONTENTION_LOCK); + + if (!(PrevValue & RTL_SRWLOCK_CONTENTION_LOCK)) + break; + + YieldProcessor(); + } + + if (!(PrevValue & RTL_SRWLOCK_CONTENDED) || + (PrevValue & ~RTL_SRWLOCK_MASK) == 0) + { + /* Too bad, looks like the wait block was removed in the + meanwhile, unlock again */ + RtlpReleaseWaitBlockLock(SRWLock); + return NULL; + } + + WaitBlock = (PRTLP_SRWLOCK_WAITBLOCK)(PrevValue & ~RTL_SRWLOCK_MASK); + + ASSERT_SRW_WAITBLOCK(WaitBlock); + return WaitBlock; +} + + +static VOID +NTAPI +RtlpAcquireSRWLockExclusiveWait(IN OUT PRTL_SRWLOCK SRWLock, + IN PRTLP_SRWLOCK_WAITBLOCK WaitBlock) +{ + LONG_PTR CurrentValue; + + while (1) + { + CurrentValue = *(volatile LONG_PTR *)&SRWLock->Ptr; + if (!(CurrentValue & RTL_SRWLOCK_SHARED)) + { + if (CurrentValue & RTL_SRWLOCK_CONTENDED) + { + if (WaitBlock->Wake != 0) + { + /* Our wait block became the first one + in the chain, we own the lock now! */ + break; + } + } + else + { + /* The last wait block was removed and/or we're + finally a simple exclusive lock. This means we + don't need to wait anymore, we acquired the lock! */ + break; + } + } + + YieldProcessor(); + } +} + + +static VOID +NTAPI +RtlpAcquireSRWLockSharedWait(IN OUT PRTL_SRWLOCK SRWLock, + IN OUT PRTLP_SRWLOCK_WAITBLOCK FirstWait OPTIONAL, + IN OUT PRTLP_SRWLOCK_SHARED_WAKE WakeChain) +{ + if (FirstWait != NULL) + { + while (WakeChain->Wake == 0) + { + YieldProcessor(); + } + } + else + { + LONG_PTR CurrentValue; + + while (1) + { + CurrentValue = *(volatile LONG_PTR *)&SRWLock->Ptr; + if (CurrentValue & RTL_SRWLOCK_SHARED) + { + /* The RTL_SRWLOCK_OWNED bit always needs to be set when + RTL_SRWLOCK_SHARED is set! */ + ASSERT(CurrentValue & RTL_SRWLOCK_OWNED); + + if (CurrentValue & RTL_SRWLOCK_CONTENDED) + { + if (WakeChain->Wake != 0) + { + /* Our wait block became the first one + in the chain, we own the lock now! */ + break; + } + } + else + { + /* The last wait block was removed and/or we're + finally a simple shared lock. This means we + don't need to wait anymore, we acquired the lock! */ + break; + } + } + + YieldProcessor(); + } + } +} + + +VOID +NTAPI +RtlInitializeSRWLock(OUT PRTL_SRWLOCK SRWLock) +{ + SRWLock->Ptr = NULL; +} + + +VOID +NTAPI +RtlAcquireSRWLockShared(IN OUT PRTL_SRWLOCK SRWLock) +{ + __ALIGNED(16) RTLP_SRWLOCK_WAITBLOCK StackWaitBlock; + RTLP_SRWLOCK_SHARED_WAKE SharedWake; + LONG_PTR CurrentValue, NewValue; + PRTLP_SRWLOCK_WAITBLOCK First, Shared, FirstWait; + + while (1) + { + CurrentValue = *(volatile LONG_PTR *)&SRWLock->Ptr; + + if (CurrentValue & RTL_SRWLOCK_SHARED) + { + /* NOTE: It is possible that the RTL_SRWLOCK_OWNED bit is set! */ + + if (CurrentValue & RTL_SRWLOCK_CONTENDED) + { + /* There's other waiters already, lock the wait blocks and + increment the shared count */ + First = RtlpAcquireWaitBlockLock(SRWLock); + if (First != NULL) + { + FirstWait = NULL; + + if (First->Exclusive) + { + /* We need to setup a new wait block! Although + we're currently in a shared lock and we're acquiring + a shared lock, there are exclusive locks queued. We need + to wait until those are released. */ + Shared = First->Last; + + if (Shared->Exclusive) + { + StackWaitBlock.Exclusive = FALSE; + StackWaitBlock.SharedCount = 1; + StackWaitBlock.Next = NULL; + StackWaitBlock.Last = &StackWaitBlock; + StackWaitBlock.SharedWakeChain = &SharedWake; + + Shared->Next = &StackWaitBlock; + First->Last = &StackWaitBlock; + + Shared = &StackWaitBlock; + FirstWait = &StackWaitBlock; + } + else + { + Shared->LastSharedWake->Next = &SharedWake; + Shared->SharedCount++; + } + } + else + { + Shared = First; + Shared->LastSharedWake->Next = &SharedWake; + Shared->SharedCount++; + } + + SharedWake.Next = NULL; + SharedWake.Wake = 0; + + Shared->LastSharedWake = &SharedWake; + + ASSERT_SRW_WAITBLOCK(Shared); + + RtlpReleaseWaitBlockLock(SRWLock); + + RtlpAcquireSRWLockSharedWait(SRWLock, + FirstWait, + &SharedWake); + + /* Successfully incremented the shared count, we acquired the lock */ + break; + } + } + else + { + /* This is a fastest path, just increment the number of + current shared locks */ + + /* Since the RTL_SRWLOCK_SHARED bit is set, the RTL_SRWLOCK_OWNED bit also has + to be set! */ + + ASSERT(CurrentValue & RTL_SRWLOCK_OWNED); + + NewValue = (CurrentValue >> RTL_SRWLOCK_BITS) + 1; + NewValue = (NewValue << RTL_SRWLOCK_BITS) | (CurrentValue & RTL_SRWLOCK_MASK); + + if (InterlockedCompareExchangePointer(&SRWLock->Ptr, + (PVOID)NewValue, + (PVOID)CurrentValue) == (PVOID)CurrentValue) + { + /* Successfully incremented the shared count, we acquired the lock */ + break; + } + } + } + else + { + if (CurrentValue & RTL_SRWLOCK_OWNED) + { + /* The resource is currently acquired exclusively */ + if (CurrentValue & RTL_SRWLOCK_CONTENDED) + { + SharedWake.Next = NULL; + SharedWake.Wake = 0; + + /* There's other waiters already, lock the wait blocks and + increment the shared count. If the last block in the chain + is an exclusive lock, add another block. */ + + StackWaitBlock.Exclusive = FALSE; + StackWaitBlock.SharedCount = 0; + StackWaitBlock.Next = NULL; + StackWaitBlock.Last = &StackWaitBlock; + StackWaitBlock.SharedWakeChain = &SharedWake; + + First = RtlpAcquireWaitBlockLock(SRWLock); + if (First != NULL) + { + Shared = First->Last; + if (Shared->Exclusive) + { + Shared->Next = &StackWaitBlock; + First->Last = &StackWaitBlock; + + Shared = &StackWaitBlock; + FirstWait = &StackWaitBlock; + } + else + { + FirstWait = NULL; + Shared->LastSharedWake->Next = &SharedWake; + } + + ASSERT_SRW_WAITBLOCK(Shared); + + Shared->SharedCount++; + Shared->LastSharedWake = &SharedWake; + + RtlpReleaseWaitBlockLock(SRWLock); + + RtlpAcquireSRWLockSharedWait(SRWLock, + FirstWait, + &SharedWake); + + /* Successfully incremented the shared count, we acquired the lock */ + break; + } + } + else + { + SharedWake.Next = NULL; + SharedWake.Wake = 0; + + /* We need to setup the first wait block. Currently an exclusive lock is + held, change the lock to contended mode. */ + StackWaitBlock.Exclusive = FALSE; + StackWaitBlock.SharedCount = 1; + StackWaitBlock.Next = NULL; + StackWaitBlock.Last = &StackWaitBlock; + StackWaitBlock.SharedWakeChain = &SharedWake; + StackWaitBlock.LastSharedWake = &SharedWake; + + ASSERT_SRW_WAITBLOCK(&StackWaitBlock); + + NewValue = (ULONG_PTR)&StackWaitBlock | RTL_SRWLOCK_OWNED | RTL_SRWLOCK_CONTENDED; + if (InterlockedCompareExchangePointer(&SRWLock->Ptr, + (PVOID)NewValue, + (PVOID)CurrentValue) == (PVOID)CurrentValue) + { + RtlpAcquireSRWLockSharedWait(SRWLock, + &StackWaitBlock, + &SharedWake); + + /* Successfully set the shared count, we acquired the lock */ + break; + } + } + } + else + { + /* This is a fast path, we can simply try to set the shared count to 1 */ + NewValue = (1 << RTL_SRWLOCK_BITS) | RTL_SRWLOCK_SHARED | RTL_SRWLOCK_OWNED; + + /* The RTL_SRWLOCK_CONTENDED bit should never be set if neither the + RTL_SRWLOCK_SHARED nor the RTL_SRWLOCK_OWNED bit is set */ + ASSERT(!(CurrentValue & RTL_SRWLOCK_CONTENDED)); + + if (InterlockedCompareExchangePointer(&SRWLock->Ptr, + (PVOID)NewValue, + (PVOID)CurrentValue) == (PVOID)CurrentValue) + { + /* Successfully set the shared count, we acquired the lock */ + break; + } + } + } + + YieldProcessor(); + } +} + + +VOID +NTAPI +RtlReleaseSRWLockShared(IN OUT PRTL_SRWLOCK SRWLock) +{ + LONG_PTR CurrentValue, NewValue; + PRTLP_SRWLOCK_WAITBLOCK WaitBlock; + BOOLEAN LastShared; + + while (1) + { + CurrentValue = *(volatile LONG_PTR *)&SRWLock->Ptr; + + if (CurrentValue & RTL_SRWLOCK_SHARED) + { + if (CurrentValue & RTL_SRWLOCK_CONTENDED) + { + /* There's a wait block, we need to wake a pending + exclusive acquirer if this is the last shared release */ + WaitBlock = RtlpAcquireWaitBlockLock(SRWLock); + if (WaitBlock != NULL) + { + LastShared = (--WaitBlock->SharedCount == 0); + + if (LastShared) + RtlpReleaseWaitBlockLockLastShared(SRWLock, + WaitBlock); + else + RtlpReleaseWaitBlockLock(SRWLock); + + /* We released the lock */ + break; + } + } + else + { + /* This is a fast path, we can simply decrement the shared + count and store the pointer */ + NewValue = CurrentValue >> RTL_SRWLOCK_BITS; + + if (--NewValue != 0) + { + NewValue = (NewValue << RTL_SRWLOCK_BITS) | RTL_SRWLOCK_SHARED | RTL_SRWLOCK_OWNED; + } + + if (InterlockedCompareExchangePointer(&SRWLock->Ptr, + (PVOID)NewValue, + (PVOID)CurrentValue) == (PVOID)CurrentValue) + { + /* Successfully released the lock */ + break; + } + } + } + else + { + /* The RTL_SRWLOCK_SHARED bit has to be present now, + even in the contended case! */ + RtlRaiseStatus(STATUS_RESOURCE_NOT_OWNED); + } + + YieldProcessor(); + } +} + + +VOID +NTAPI +RtlAcquireSRWLockExclusive(IN OUT PRTL_SRWLOCK SRWLock) +{ + __ALIGNED(16) RTLP_SRWLOCK_WAITBLOCK StackWaitBlock; + PRTLP_SRWLOCK_WAITBLOCK First, Last; + + if (InterlockedBitTestAndSetPointer(&SRWLock->Ptr, + RTL_SRWLOCK_OWNED_BIT)) + { + LONG_PTR CurrentValue, NewValue; + + while (1) + { + CurrentValue = *(volatile LONG_PTR *)&SRWLock->Ptr; + + if (CurrentValue & RTL_SRWLOCK_SHARED) + { + /* A shared lock is being held right now. We need to add a wait block! */ + + if (CurrentValue & RTL_SRWLOCK_CONTENDED) + { + goto AddWaitBlock; + } + else + { + /* There are no wait blocks so far, we need to add ourselves as the first + wait block. We need to keep the shared count! */ + StackWaitBlock.Exclusive = TRUE; + StackWaitBlock.SharedCount = CurrentValue >> RTL_SRWLOCK_BITS; + StackWaitBlock.Next = NULL; + StackWaitBlock.Last = &StackWaitBlock; + StackWaitBlock.Wake = 0; + + ASSERT_SRW_WAITBLOCK(&StackWaitBlock); + + NewValue = (ULONG_PTR)&StackWaitBlock | RTL_SRWLOCK_SHARED | RTL_SRWLOCK_CONTENDED | RTL_SRWLOCK_OWNED; + + if (InterlockedCompareExchangePointer(&SRWLock->Ptr, + (PVOID)NewValue, + (PVOID)CurrentValue) == (PVOID)CurrentValue) + { + RtlpAcquireSRWLockExclusiveWait(SRWLock, + &StackWaitBlock); + + /* Successfully acquired the exclusive lock */ + break; + } + } + } + else + { + if (CurrentValue & RTL_SRWLOCK_OWNED) + { + /* An exclusive lock is being held right now. We need to add a wait block! */ + + if (CurrentValue & RTL_SRWLOCK_CONTENDED) + { +AddWaitBlock: + StackWaitBlock.Exclusive = TRUE; + StackWaitBlock.SharedCount = 0; + StackWaitBlock.Next = NULL; + StackWaitBlock.Last = &StackWaitBlock; + StackWaitBlock.Wake = 0; + + ASSERT_SRW_WAITBLOCK(&StackWaitBlock); + + First = RtlpAcquireWaitBlockLock(SRWLock); + if (First != NULL) + { + Last = First->Last; + Last->Next = &StackWaitBlock; + First->Last = &StackWaitBlock; + + RtlpReleaseWaitBlockLock(SRWLock); + + RtlpAcquireSRWLockExclusiveWait(SRWLock, + &StackWaitBlock); + + /* Successfully acquired the exclusive lock */ + break; + } + } + else + { + /* There are no wait blocks so far, we need to add ourselves as the first + wait block. We need to keep the shared count! */ + StackWaitBlock.Exclusive = TRUE; + StackWaitBlock.SharedCount = 0; + StackWaitBlock.Next = NULL; + StackWaitBlock.Last = &StackWaitBlock; + StackWaitBlock.Wake = 0; + + ASSERT_SRW_WAITBLOCK(&StackWaitBlock); + + NewValue = (ULONG_PTR)&StackWaitBlock | RTL_SRWLOCK_OWNED | RTL_SRWLOCK_CONTENDED; + if (InterlockedCompareExchangePointer(&SRWLock->Ptr, + (PVOID)NewValue, + (PVOID)CurrentValue) == (PVOID)CurrentValue) + { + RtlpAcquireSRWLockExclusiveWait(SRWLock, + &StackWaitBlock); + + /* Successfully acquired the exclusive lock */ + break; + } + } + } + else + { + if (!InterlockedBitTestAndSetPointer(&SRWLock->Ptr, + RTL_SRWLOCK_OWNED_BIT)) + { + /* We managed to get hold of a simple exclusive lock! */ + break; + } + } + } + + YieldProcessor(); + } + } +} + + +VOID +NTAPI +RtlReleaseSRWLockExclusive(IN OUT PRTL_SRWLOCK SRWLock) +{ + LONG_PTR CurrentValue, NewValue; + PRTLP_SRWLOCK_WAITBLOCK WaitBlock; + + while (1) + { + CurrentValue = *(volatile LONG_PTR *)&SRWLock->Ptr; + + if (!(CurrentValue & RTL_SRWLOCK_OWNED)) + { + RtlRaiseStatus(STATUS_RESOURCE_NOT_OWNED); + } + + if (!(CurrentValue & RTL_SRWLOCK_SHARED)) + { + if (CurrentValue & RTL_SRWLOCK_CONTENDED) + { + /* There's a wait block, we need to wake the next pending + acquirer (exclusive or shared) */ + WaitBlock = RtlpAcquireWaitBlockLock(SRWLock); + if (WaitBlock != NULL) + { + RtlpReleaseWaitBlockLockExclusive(SRWLock, + WaitBlock); + + /* We released the lock */ + break; + } + } + else + { + /* This is a fast path, we can simply clear the RTL_SRWLOCK_OWNED + bit. All other bits should be 0 now because this is a simple + exclusive lock and no one is waiting. */ + + ASSERT(!(CurrentValue & ~RTL_SRWLOCK_OWNED)); + + NewValue = 0; + if (InterlockedCompareExchangePointer(&SRWLock->Ptr, + (PVOID)NewValue, + (PVOID)CurrentValue) == (PVOID)CurrentValue) + { + /* We released the lock */ + break; + } + } + } + else + { + /* The RTL_SRWLOCK_SHARED bit must not be present now, + not even in the contended case! */ + RtlRaiseStatus(STATUS_RESOURCE_NOT_OWNED); + } + + YieldProcessor(); + } +} Propchange: trunk/reactos/lib/rtl/srw.c ------------------------------------------------------------------------------ svn:eol-style = native
18 years, 3 months
1
0
0
0
[hpoussin] 23805: Fix MsiGetFeatureStateA/W and MsiGetComponentStateA/W prototypes
by hpoussin@svn.reactos.org
Author: hpoussin Date: Wed Aug 30 22:08:21 2006 New Revision: 23805 URL:
http://svn.reactos.org/svn/reactos?rev=23805&view=rev
Log: Fix MsiGetFeatureStateA/W and MsiGetComponentStateA/W prototypes Modified: trunk/reactos/dll/win32/msi/install.c trunk/reactos/dll/win32/msi/msipriv.h trunk/reactos/include/psdk/msiquery.h Modified: trunk/reactos/dll/win32/msi/install.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/install.c?re…
============================================================================== --- trunk/reactos/dll/win32/msi/install.c (original) +++ trunk/reactos/dll/win32/msi/install.c Wed Aug 30 22:08:21 2006 @@ -580,7 +580,7 @@ /*********************************************************************** * MsiGetFeatureStateA (MSI.@) */ -UINT WINAPI MsiGetFeatureStateA(MSIHANDLE hInstall, LPSTR szFeature, +UINT WINAPI MsiGetFeatureStateA(MSIHANDLE hInstall, LPCSTR szFeature, INSTALLSTATE *piInstalled, INSTALLSTATE *piAction) { LPWSTR szwFeature = NULL; @@ -595,7 +595,7 @@ return rc; } -UINT MSI_GetFeatureStateW(MSIPACKAGE *package, LPWSTR szFeature, +UINT MSI_GetFeatureStateW(MSIPACKAGE *package, LPCWSTR szFeature, INSTALLSTATE *piInstalled, INSTALLSTATE *piAction) { MSIFEATURE *feature; @@ -618,7 +618,7 @@ /*********************************************************************** * MsiGetFeatureStateW (MSI.@) */ -UINT WINAPI MsiGetFeatureStateW(MSIHANDLE hInstall, LPWSTR szFeature, +UINT WINAPI MsiGetFeatureStateW(MSIHANDLE hInstall, LPCWSTR szFeature, INSTALLSTATE *piInstalled, INSTALLSTATE *piAction) { MSIPACKAGE* package; @@ -653,7 +653,7 @@ /*********************************************************************** * MsiGetComponentStateA (MSI.@) */ -UINT WINAPI MsiGetComponentStateA(MSIHANDLE hInstall, LPSTR szComponent, +UINT WINAPI MsiGetComponentStateA(MSIHANDLE hInstall, LPCSTR szComponent, INSTALLSTATE *piInstalled, INSTALLSTATE *piAction) { LPWSTR szwComponent= NULL; @@ -684,7 +684,7 @@ return ERROR_SUCCESS; } -UINT MSI_GetComponentStateW(MSIPACKAGE *package, LPWSTR szComponent, +UINT MSI_GetComponentStateW(MSIPACKAGE *package, LPCWSTR szComponent, INSTALLSTATE *piInstalled, INSTALLSTATE *piAction) { MSICOMPONENT *comp; @@ -727,7 +727,7 @@ /*********************************************************************** * MsiGetComponentStateW (MSI.@) */ -UINT WINAPI MsiGetComponentStateW(MSIHANDLE hInstall, LPWSTR szComponent, +UINT WINAPI MsiGetComponentStateW(MSIHANDLE hInstall, LPCWSTR szComponent, INSTALLSTATE *piInstalled, INSTALLSTATE *piAction) { MSIPACKAGE* package; Modified: trunk/reactos/dll/win32/msi/msipriv.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/msipriv.h?re…
============================================================================== --- trunk/reactos/dll/win32/msi/msipriv.h (original) +++ trunk/reactos/dll/win32/msi/msipriv.h Wed Aug 30 22:08:21 2006 @@ -393,8 +393,8 @@ extern UINT MSI_GetPropertyW( MSIPACKAGE *, LPCWSTR, LPWSTR, DWORD * ); extern UINT MSI_GetPropertyA(MSIPACKAGE *, LPCSTR, LPSTR, DWORD* ); extern MSICONDITION MSI_EvaluateConditionW( MSIPACKAGE *, LPCWSTR ); -extern UINT MSI_GetComponentStateW( MSIPACKAGE *, LPWSTR, INSTALLSTATE *, INSTALLSTATE * ); -extern UINT MSI_GetFeatureStateW( MSIPACKAGE *, LPWSTR, INSTALLSTATE *, INSTALLSTATE * ); +extern UINT MSI_GetComponentStateW( MSIPACKAGE *, LPCWSTR, INSTALLSTATE *, INSTALLSTATE * ); +extern UINT MSI_GetFeatureStateW( MSIPACKAGE *, LPCWSTR, INSTALLSTATE *, INSTALLSTATE * ); extern UINT WINAPI MSI_SetFeatureStateW(MSIPACKAGE*, LPCWSTR, INSTALLSTATE ); /* for deformating */ Modified: trunk/reactos/include/psdk/msiquery.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/msiquery.h?re…
============================================================================== --- trunk/reactos/include/psdk/msiquery.h (original) +++ trunk/reactos/include/psdk/msiquery.h Wed Aug 30 22:08:21 2006 @@ -189,14 +189,14 @@ UINT WINAPI MsiDatabaseCommit(MSIHANDLE); /* install state */ -UINT WINAPI MsiGetFeatureStateA(MSIHANDLE,LPSTR,INSTALLSTATE*,INSTALLSTATE*); -UINT WINAPI MsiGetFeatureStateW(MSIHANDLE,LPWSTR,INSTALLSTATE*,INSTALLSTATE*); +UINT WINAPI MsiGetFeatureStateA(MSIHANDLE,LPCSTR,INSTALLSTATE*,INSTALLSTATE*); +UINT WINAPI MsiGetFeatureStateW(MSIHANDLE,LPCWSTR,INSTALLSTATE*,INSTALLSTATE*); #define MsiGetFeatureState WINELIB_NAME_AW(MsiGetFeatureState) UINT WINAPI MsiSetComponentStateA(MSIHANDLE,LPCSTR,INSTALLSTATE); UINT WINAPI MsiSetComponentStateW(MSIHANDLE,LPCWSTR,INSTALLSTATE); #define MsiSetComponentState WINELIB_NAME_AW(MsiSetComponentState) -UINT WINAPI MsiGetComponentStateA(MSIHANDLE,LPSTR,INSTALLSTATE*,INSTALLSTATE*); -UINT WINAPI MsiGetComponentStateW(MSIHANDLE,LPWSTR,INSTALLSTATE*,INSTALLSTATE*); +UINT WINAPI MsiGetComponentStateA(MSIHANDLE,LPCSTR,INSTALLSTATE*,INSTALLSTATE*); +UINT WINAPI MsiGetComponentStateW(MSIHANDLE,LPCWSTR,INSTALLSTATE*,INSTALLSTATE*); #define MsiGetComponentState WINELIB_NAME_AW(MsiGetComponentState) MSICONDITION WINAPI MsiEvaluateConditionA(MSIHANDLE,LPCSTR);
18 years, 3 months
1
0
0
0
[greatlrd] 23804: Kill inline asm code compete in RtlUlongByteSwap for it doing swap wrong. we go back using the C version. Thanks Fireball
by greatlrd@svn.reactos.org
Author: greatlrd Date: Wed Aug 30 21:51:36 2006 New Revision: 23804 URL:
http://svn.reactos.org/svn/reactos?rev=23804&view=rev
Log: Kill inline asm code compete in RtlUlongByteSwap for it doing swap wrong. we go back using the C version. Thanks Fireball Modified: trunk/reactos/lib/rtl/mem.c Modified: trunk/reactos/lib/rtl/mem.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/mem.c?rev=23804&r1…
============================================================================== --- trunk/reactos/lib/rtl/mem.c (original) +++ trunk/reactos/lib/rtl/mem.c Wed Aug 30 21:51:36 2006 @@ -208,14 +208,7 @@ IN ULONG Source ) { -#if defined(__i386__) && defined(__GNUC__) - ULONG ret; -__asm__("bswap %0" : "=r" (ret) : "0" (Source) ); - return ret; -#else - return ((ULONG)RtlUshortByteSwap((USHORT)Source) << 16) | RtlUshortByteSwap((USHORT)(Source >> 16)); -#endif }
18 years, 3 months
1
0
0
0
[ion] 23803: - Fix KeRaiseUserException (can't use "return" from SEH_HANDLE).
by ion@svn.reactos.org
Author: ion Date: Wed Aug 30 21:01:58 2006 New Revision: 23803 URL:
http://svn.reactos.org/svn/reactos?rev=23803&view=rev
Log: - Fix KeRaiseUserException (can't use "return" from SEH_HANDLE). Modified: trunk/reactos/ntoskrnl/ke/i386/exp.c Modified: trunk/reactos/ntoskrnl/ke/i386/exp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/exp.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/exp.c (original) +++ trunk/reactos/ntoskrnl/ke/i386/exp.c Wed Aug 30 21:01:58 2006 @@ -812,27 +812,32 @@ NTAPI KeRaiseUserException(IN NTSTATUS ExceptionCode) { + NTSTATUS Status = STATUS_SUCCESS; ULONG OldEip; - PKTHREAD Thread = KeGetCurrentThread(); + PTEB Teb = KeGetCurrentThread()->Teb; + PKTRAP_FRAME TrapFrame = KeGetCurrentThread()->TrapFrame; /* Make sure we can access the TEB */ _SEH_TRY { - Thread->Teb->ExceptionCode = ExceptionCode; + /* Set the exception code */ + Teb->ExceptionCode = ExceptionCode; } _SEH_HANDLE { - return(ExceptionCode); + /* Save exception code */ + Status = ExceptionCode; } _SEH_END; + if (!NT_SUCCESS(Status)) return Status; /* Get the old EIP */ - OldEip = Thread->TrapFrame->Eip; + OldEip = TrapFrame->Eip; /* Change it to the user-mode dispatcher */ - Thread->TrapFrame->Eip = (ULONG_PTR)KeRaiseUserExceptionDispatcher; + TrapFrame->Eip = (ULONG_PTR)KeRaiseUserExceptionDispatcher; /* Return the old EIP */ - return((NTSTATUS)OldEip); -} - + return (NTSTATUS)OldEip; +} +
18 years, 3 months
1
0
0
0
[ion] 23802: - Some fixes to KiDispatchException: Add support for forwarding exception back to user-mode, protect against V86 or invalid-stack faults, handle stack overflow exception while handling usermode exception (Thanks KJK for the SEH_FILTER help). Decrement EIP by one when hitting an INT3, to get the correct address. - Remove two associated kernel fun entries.
by ion@svn.reactos.org
Author: ion Date: Wed Aug 30 20:58:12 2006 New Revision: 23802 URL:
http://svn.reactos.org/svn/reactos?rev=23802&view=rev
Log: - Some fixes to KiDispatchException: Add support for forwarding exception back to user-mode, protect against V86 or invalid-stack faults, handle stack overflow exception while handling usermode exception (Thanks KJK for the SEH_FILTER help). Decrement EIP by one when hitting an INT3, to get the correct address. - Remove two associated kernel fun entries. Modified: trunk/reactos/ntoskrnl/KrnlFun.c trunk/reactos/ntoskrnl/dbgk/debug.c trunk/reactos/ntoskrnl/include/internal/dbgk.h trunk/reactos/ntoskrnl/include/internal/ke.h trunk/reactos/ntoskrnl/ke/i386/exp.c Modified: trunk/reactos/ntoskrnl/KrnlFun.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/KrnlFun.c?rev=238…
============================================================================== --- trunk/reactos/ntoskrnl/KrnlFun.c (original) +++ trunk/reactos/ntoskrnl/KrnlFun.c Wed Aug 30 20:58:12 2006 @@ -25,9 +25,7 @@ // - Use Object Type Mutex/Lock. // // Ke: -// - Add PSEH handler when an exception occurs in an exception (KiCopyExceptionRecord). // - Get rid of KiRosPrintAddress and use KiDumpParameterImages instead. -// - Forward exceptions to user-mode debugger. // - Sanitize some context fields during conversions. // - Implement stack fault and segment fault handlers. // - Implement kernel-mode GPF handler, possibly fixing below: Modified: trunk/reactos/ntoskrnl/dbgk/debug.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/dbgk/debug.c?rev=…
============================================================================== --- trunk/reactos/ntoskrnl/dbgk/debug.c (original) +++ trunk/reactos/ntoskrnl/dbgk/debug.c Wed Aug 30 20:58:12 2006 @@ -24,6 +24,17 @@ { /* FIXME: Implement */ } + +BOOLEAN +NTAPI +DbgkForwardException(IN PEXCEPTION_RECORD ExceptionRecord, + IN BOOLEAN DebugPort, + IN BOOLEAN SecondChance) +{ + /* FIXME: Implement */ + return FALSE; +} + NTSTATUS NTAPI Modified: trunk/reactos/ntoskrnl/include/internal/dbgk.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/dbgk.h (original) +++ trunk/reactos/ntoskrnl/include/internal/dbgk.h Wed Aug 30 20:58:12 2006 @@ -20,6 +20,14 @@ IN PEPROCESS Parent ); +BOOLEAN +NTAPI +DbgkForwardException( + IN PEXCEPTION_RECORD ExceptionRecord, + IN BOOLEAN DebugPort, + IN BOOLEAN SecondChance +); + extern POBJECT_TYPE DbgkDebugObjectType; #endif Modified: trunk/reactos/ntoskrnl/include/internal/ke.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/ke.h (original) +++ trunk/reactos/ntoskrnl/include/internal/ke.h Wed Aug 30 20:58:12 2006 @@ -691,13 +691,6 @@ ULONG FrameCount ); -ULONG -STDCALL -KeRosGetStackFrames( - PULONG Frames, - ULONG FrameCount -); - VOID NTAPI KiSetSystemTime(PLARGE_INTEGER NewSystemTime); Modified: trunk/reactos/ntoskrnl/ke/i386/exp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/exp.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/exp.c (original) +++ trunk/reactos/ntoskrnl/ke/i386/exp.c Wed Aug 30 20:58:12 2006 @@ -15,6 +15,22 @@ #include <debug.h> /* FUNCTIONS *****************************************************************/ + +_SEH_DEFINE_LOCALS(KiCopyInfo) +{ + volatile EXCEPTION_RECORD SehExceptRecord; +}; + +_SEH_FILTER(KiCopyInformation) +{ + _SEH_ACCESS_LOCALS(KiCopyInfo); + + /* Copy the exception records and return to the handler */ + RtlMoveMemory((PVOID)&_SEH_VAR(SehExceptRecord), + _SEH_GetExceptionPointers()->ExceptionRecord, + sizeof(EXCEPTION_RECORD)); + return EXCEPTION_EXECUTE_HANDLER; +} VOID INIT_FUNCTION @@ -588,7 +604,8 @@ KD_CONTINUE_TYPE Action; ULONG_PTR Stack, NewStack; ULONG Size; - BOOLEAN UserDispatch = FALSE; + EXCEPTION_RECORD LocalExceptRecord; + _SEH_DECLARE_LOCALS(KiCopyInfo); /* Increase number of Exception Dispatches */ KeGetCurrentPrcb()->KeExceptionDispatchCount++; @@ -596,16 +613,32 @@ /* Set the context flags */ Context.ContextFlags = CONTEXT_FULL | CONTEXT_DEBUG_REGISTERS; - /* Check if User Mode */ - if (PreviousMode == UserMode) + /* Check if User Mode or if the debugger isenabled */ + if ((PreviousMode == UserMode) || (KdDebuggerEnabled)) { /* Add the FPU Flag */ Context.ContextFlags |= CONTEXT_FLOATING_POINT; - if (KeI386FxsrPresent) Context.ContextFlags |= CONTEXT_EXTENDED_REGISTERS; + + /* Check for NPX Support */ + if (KeI386FxsrPresent) + { + /* Save those too */ + Context.ContextFlags |= CONTEXT_EXTENDED_REGISTERS; + } } /* Get a Context */ KeTrapFrameToContext(TrapFrame, ExceptionFrame, &Context); + + /* Fix up EIP */ + if (ExceptionRecord->ExceptionCode == STATUS_BREAKPOINT) + { + /* Decrement EIP by one */ + Context.Eip--; + } + + ASSERT(!((PreviousMode == KernelMode) && + (Context.EFlags & EFLAGS_V86_MASK))); /* Handle kernel-mode first, it's simpler */ if (PreviousMode == KernelMode) @@ -625,11 +658,7 @@ if (Action == kdContinue) goto Handled; /* If the Debugger couldn't handle it, dispatch the exception */ - if (RtlDispatchException(ExceptionRecord, &Context)) - { - /* It was handled by an exception handler, continue */ - goto Handled; - } + if (RtlDispatchException(ExceptionRecord, &Context)) goto Handled; } /* This is a second-chance exception, only for the debugger */ @@ -644,12 +673,11 @@ if (Action == kdContinue) goto Handled; /* Third strike; you're out */ - KEBUGCHECKWITHTF(KMODE_EXCEPTION_NOT_HANDLED, - ExceptionRecord->ExceptionCode, - (ULONG_PTR)ExceptionRecord->ExceptionAddress, - ExceptionRecord->ExceptionInformation[0], - ExceptionRecord->ExceptionInformation[1], - TrapFrame); + KeBugCheckEx(KMODE_EXCEPTION_NOT_HANDLED, + ExceptionRecord->ExceptionCode, + (ULONG_PTR)ExceptionRecord->ExceptionAddress, + ExceptionRecord->ExceptionInformation[0], + ExceptionRecord->ExceptionInformation[1]); } else { @@ -668,27 +696,39 @@ if (Action == kdContinue) goto Handled; /* FIXME: Forward exception to user mode debugger */ + if (DbgkForwardException(ExceptionRecord, TRUE, FALSE)) goto Exit; /* Set up the user-stack */ +DispatchToUser: _SEH_TRY { + /* Make sure we have a valid SS and that this isn't V86 mode */ + if ((TrapFrame->HardwareSegSs != (KGDT_R3_DATA | RPL_MASK)) || + (TrapFrame->EFlags & EFLAGS_V86_MASK)) + { + /* Raise an exception instead */ + LocalExceptRecord.ExceptionCode = STATUS_ACCESS_VIOLATION; + LocalExceptRecord.ExceptionFlags = 0; + LocalExceptRecord.NumberParameters = 0; + RtlRaiseException(&LocalExceptRecord); + } + /* Align context size and get stack pointer */ Size = (sizeof(CONTEXT) + 3) & ~3; Stack = (Context.Esp & ~3) - Size; - DPRINT("Stack: %lx\n", Stack); /* Probe stack and copy Context */ ProbeForWrite((PVOID)Stack, Size, sizeof(ULONG)); RtlCopyMemory((PVOID)Stack, &Context, sizeof(CONTEXT)); /* Align exception record size and get stack pointer */ - Size = (sizeof(EXCEPTION_RECORD) - - (EXCEPTION_MAXIMUM_PARAMETERS - ExceptionRecord->NumberParameters) * - sizeof(ULONG) + 3) & ~3; + Size = (sizeof(EXCEPTION_RECORD) - + (EXCEPTION_MAXIMUM_PARAMETERS - + ExceptionRecord->NumberParameters) * + sizeof(ULONG) + 3) & ~3; NewStack = Stack - Size; - DPRINT("NewStack: %lx\n", NewStack); - - /* Probe stack and copy exception record. Don't forget to add the two params */ + + /* Probe stack and copy exception record */ ProbeForWrite((PVOID)(NewStack - 2 * sizeof(ULONG_PTR)), Size + 2 * sizeof(ULONG_PTR), sizeof(ULONG)); @@ -699,34 +739,59 @@ *(PULONG_PTR)(NewStack - 2 * sizeof(ULONG_PTR)) = NewStack; /* Set new Stack Pointer */ + KiSsToTrapFrame(TrapFrame, KGDT_R3_DATA); KiEspToTrapFrame(TrapFrame, NewStack - 2 * sizeof(ULONG_PTR)); + + /* Force correct segments */ + TrapFrame->SegCs = KGDT_R3_CODE | RPL_MASK; + TrapFrame->SegDs = KGDT_R3_DATA | RPL_MASK; + TrapFrame->SegEs = KGDT_R3_DATA | RPL_MASK; + TrapFrame->SegFs = KGDT_R3_TEB | RPL_MASK; + TrapFrame->SegGs = 0; /* Set EIP to the User-mode Dispathcer */ TrapFrame->Eip = (ULONG)KeUserExceptionDispatcher; - UserDispatch = TRUE; _SEH_LEAVE; } - _SEH_HANDLE - { - /* Do second-chance */ + _SEH_EXCEPT(KiCopyInformation) + { + /* Check if we got a stack overflow and raise that instead */ + if (_SEH_VAR(SehExceptRecord).ExceptionCode == + STATUS_STACK_OVERFLOW) + { + /* Copy the exception address and record */ + _SEH_VAR(SehExceptRecord).ExceptionAddress = + ExceptionRecord->ExceptionAddress; + RtlMoveMemory(ExceptionRecord, + (PVOID)&_SEH_VAR(SehExceptRecord), + sizeof(EXCEPTION_RECORD)); + + /* Do the exception again */ + goto DispatchToUser; + } } _SEH_END; } - /* If we dispatch to user, return now */ - if (UserDispatch) return; - - /* FIXME: Forward the exception to the debugger for 2nd chance */ - - /* 3rd strike, kill the thread */ - DPRINT1("Unhandled UserMode exception, terminating thread\n"); - ZwTerminateThread(NtCurrentThread(), ExceptionRecord->ExceptionCode); - KEBUGCHECKWITHTF(KMODE_EXCEPTION_NOT_HANDLED, - ExceptionRecord->ExceptionCode, - (ULONG_PTR)ExceptionRecord->ExceptionAddress, - ExceptionRecord->ExceptionInformation[0], - ExceptionRecord->ExceptionInformation[1], - TrapFrame); + /* Try second chance */ + if (DbgkForwardException(ExceptionRecord, TRUE, FALSE)) + { + /* Handled, get out */ + goto Exit; + } + else if (DbgkForwardException(ExceptionRecord, FALSE, TRUE)) + { + /* Handled, get out */ + goto Exit; + } + + /* 3rd strike, kill the process */ + ZwTerminateProcess(NtCurrentProcess(), ExceptionRecord->ExceptionCode); + KeBugCheckEx(KMODE_EXCEPTION_NOT_HANDLED, + ExceptionRecord->ExceptionCode, + (ULONG_PTR)ExceptionRecord->ExceptionAddress, + ExceptionRecord->ExceptionInformation[0], + ExceptionRecord->ExceptionInformation[1]); } Handled: @@ -736,6 +801,7 @@ TrapFrame, Context.ContextFlags, PreviousMode); +Exit: return; }
18 years, 3 months
1
0
0
0
[ekohl] 23801: - fix indentation and remove trailing whitespace - StartServiceA/W: terminate argument buffer with a double zero.
by ekohl@svn.reactos.org
Author: ekohl Date: Wed Aug 30 14:53:37 2006 New Revision: 23801 URL:
http://svn.reactos.org/svn/reactos?rev=23801&view=rev
Log: - fix indentation and remove trailing whitespace - StartServiceA/W: terminate argument buffer with a double zero. Modified: trunk/reactos/dll/win32/advapi32/service/scm.c Modified: trunk/reactos/dll/win32/advapi32/service/scm.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/service…
============================================================================== --- trunk/reactos/dll/win32/advapi32/service/scm.c (original) +++ trunk/reactos/dll/win32/advapi32/service/scm.c Wed Aug 30 14:53:37 2006 @@ -442,8 +442,7 @@ if (!lpServiceNameW) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - - goto cleanup; + goto cleanup; } MultiByteToWideChar(CP_ACP, 0, lpServiceName, -1, lpServiceNameW, len); } @@ -455,8 +454,7 @@ if (!lpDisplayNameW) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - - goto cleanup; + goto cleanup; } MultiByteToWideChar(CP_ACP, 0, lpDisplayName, -1, lpDisplayNameW, len); } @@ -468,8 +466,7 @@ if (!lpBinaryPathNameW) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - - goto cleanup; + goto cleanup; } MultiByteToWideChar(CP_ACP, 0, lpDisplayName, -1, lpBinaryPathNameW, len); } @@ -481,8 +478,7 @@ if (!lpLoadOrderGroupW) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - - goto cleanup; + goto cleanup; } MultiByteToWideChar(CP_ACP, 0, lpLoadOrderGroup, -1, lpLoadOrderGroupW, len); } @@ -502,8 +498,7 @@ if (!lpDependenciesW) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - - goto cleanup; + goto cleanup; } MultiByteToWideChar(CP_ACP, 0, lpDependencies, -1, lpDependenciesW, dwDependenciesLength); } @@ -515,8 +510,7 @@ if (!lpServiceStartNameW) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - - goto cleanup; + goto cleanup; } MultiByteToWideChar(CP_ACP, 0, lpServiceStartName, -1, lpServiceStartNameW, len); } @@ -528,8 +522,7 @@ if (!lpPasswordW) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - - goto cleanup; + goto cleanup; } MultiByteToWideChar(CP_ACP, 0, lpPassword, -1, lpPasswordW, len); } @@ -549,34 +542,26 @@ lpPasswordW); cleanup: - if (lpServiceNameW !=NULL) - { - HeapFree(GetProcessHeap(), 0, lpServiceNameW); - } + if (lpServiceNameW !=NULL) + HeapFree(GetProcessHeap(), 0, lpServiceNameW); + if (lpDisplayNameW != NULL) - { - HeapFree(GetProcessHeap(), 0, lpDisplayNameW); - } - if (lpBinaryPathNameW != NULL) - { - HeapFree(GetProcessHeap(), 0, lpBinaryPathNameW); - } - if (lpLoadOrderGroupW != NULL) - { - HeapFree(GetProcessHeap(), 0, lpLoadOrderGroupW); - } - if (lpDependenciesW != NULL) - { - HeapFree(GetProcessHeap(), 0, lpDependenciesW); - } - if (lpServiceStartNameW != NULL) - { - HeapFree(GetProcessHeap(), 0, lpServiceStartNameW); - } - if (lpPasswordW != NULL) - { - HeapFree(GetProcessHeap(), 0, lpPasswordW); - } + HeapFree(GetProcessHeap(), 0, lpDisplayNameW); + + if (lpBinaryPathNameW != NULL) + HeapFree(GetProcessHeap(), 0, lpBinaryPathNameW); + + if (lpLoadOrderGroupW != NULL) + HeapFree(GetProcessHeap(), 0, lpLoadOrderGroupW); + + if (lpDependenciesW != NULL) + HeapFree(GetProcessHeap(), 0, lpDependenciesW); + + if (lpServiceStartNameW != NULL) + HeapFree(GetProcessHeap(), 0, lpServiceStartNameW); + + if (lpPasswordW != NULL) + HeapFree(GetProcessHeap(), 0, lpPasswordW); return RetVal; } @@ -1982,6 +1967,7 @@ { dwBufSize += (strlen(lpServiceArgVectors[i]) + 1); } + dwBufSize++; DPRINT1("dwBufSize: %lu\n", dwBufSize); lpBuffer = HeapAlloc(GetProcessHeap(), 0, dwBufSize); @@ -1997,6 +1983,7 @@ strcpy(lpStr, lpServiceArgVectors[i]); lpStr += (strlen(lpServiceArgVectors[i]) + 1); } + *lpStr = 0; dwError = ScmrStartServiceA(BindingHandle, (unsigned int)hService, @@ -2038,6 +2025,7 @@ { dwBufSize += ((wcslen(lpServiceArgVectors[i]) + 1) * sizeof(WCHAR)); } + dwBufSize += sizeof(WCHAR); DPRINT1("dwBufSize: %lu\n", dwBufSize); lpBuffer = HeapAlloc(GetProcessHeap(), 0, dwBufSize); @@ -2053,6 +2041,7 @@ wcscpy(lpStr, lpServiceArgVectors[i]); lpStr += (wcslen(lpServiceArgVectors[i]) + 1); } + *lpStr = 0; dwError = ScmrStartServiceW(BindingHandle, (unsigned int)hService,
18 years, 3 months
1
0
0
0
← Newer
1
2
3
4
5
6
7
8
...
45
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Results per page:
10
25
50
100
200