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
December 2009
----- 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
22 participants
501 discussions
Start a n
N
ew thread
[janderwald] 44662: [MMIXER_TEST] - Allocate the unicode version of LPMIXERCONTROL as mmixer api expects those - Fix building of mmixer_test as mmixer now uses KsCreatePin
by janderwald@svn.reactos.org
Author: janderwald Date: Sun Dec 20 01:55:50 2009 New Revision: 44662 URL:
http://svn.reactos.org/svn/reactos?rev=44662&view=rev
Log: [MMIXER_TEST] - Allocate the unicode version of LPMIXERCONTROL as mmixer api expects those - Fix building of mmixer_test as mmixer now uses KsCreatePin Modified: trunk/rostests/tests/mmixer_test/mmixer_test.rbuild trunk/rostests/tests/mmixer_test/test.c Modified: trunk/rostests/tests/mmixer_test/mmixer_test.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/tests/mmixer_test/mmixer_…
============================================================================== --- trunk/rostests/tests/mmixer_test/mmixer_test.rbuild [iso-8859-1] (original) +++ trunk/rostests/tests/mmixer_test/mmixer_test.rbuild [iso-8859-1] Sun Dec 20 01:55:50 2009 @@ -8,5 +8,6 @@ <library>kernel32</library> <library>winmm</library> <library>mmixer</library> + <library>ksuser</library> <file>test.c</file> </module> Modified: trunk/rostests/tests/mmixer_test/test.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/tests/mmixer_test/test.c?…
============================================================================== --- trunk/rostests/tests/mmixer_test/test.c [iso-8859-1] (original) +++ trunk/rostests/tests/mmixer_test/test.c [iso-8859-1] Sun Dec 20 01:55:50 2009 @@ -199,6 +199,7 @@ *OutKey = SetupDiOpenDeviceInterfaceRegKey(EnumContext, &InterfaceData, 0, KEY_READ); if ((HKEY)*OutKey == INVALID_HANDLE_VALUE) { + printf("SetupDiOpenDeviceInterfaceRegKey failed with %lx\n", GetLastError()); HeapFree(GetProcessHeap(), 0, DetailData); return MM_STATUS_UNSUCCESSFUL; } @@ -281,14 +282,14 @@ HANDLE hMixer2; HMIXER hMixer1; MIXERLINEW MixerLine1, MixerLine2; - MIXERLINECONTROLS Controls1, Controls2; + MIXERLINECONTROLSW Controls1, Controls2; ZeroMemory(&MixerContext, sizeof(MIXER_CONTEXT)); DeviceHandle = SetupDiGetClassDevs(&CategoryGuid, NULL, NULL, - DIGCF_DEVICEINTERFACE|DIGCF_PRESENT); + DIGCF_DEVICEINTERFACE/*|DIGCF_PRESENT */); if (DeviceHandle == INVALID_HANDLE_VALUE) { printf("SetupDiGetClassDevs failed with %lx\n", GetLastError()); @@ -336,8 +337,8 @@ wprintf(L"MMIX: dwDestination %lx dwSource %lx dwLineID %lx dwUser %lx dwComponentType %lx cChannels %lx cConnections %lx cControls %lx szShortName %s szName %s\n\n", MixerLine2.dwDestination, MixerLine2.dwSource, MixerLine2.dwLineID, MixerLine2.dwUser, MixerLine2.dwComponentType, MixerLine2.cChannels, MixerLine2.cConnections, MixerLine2.cControls, MixerLine2.szShortName, MixerLine2.szName); - Controls1.cbStruct = sizeof(MIXERLINECONTROLS); - Controls2.cbStruct = sizeof(MIXERLINECONTROLS); + Controls1.cbStruct = sizeof(MIXERLINECONTROLSW); + Controls2.cbStruct = sizeof(MIXERLINECONTROLSW); Controls1.cbmxctrl = sizeof(MIXERCONTROL); Controls2.cbmxctrl = sizeof(MIXERCONTROL); @@ -350,21 +351,31 @@ - Controls1.pamxctrl = (LPMIXERCONTROL)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MIXERCONTROL) * Controls1.cControls); - Controls2.pamxctrl = (LPMIXERCONTROL)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MIXERCONTROL) * Controls2.cControls); + Controls1.pamxctrl = (LPMIXERCONTROLW)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MIXERCONTROLW) * Controls1.cControls); + Controls2.pamxctrl = (LPMIXERCONTROLW)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MIXERCONTROLW) * Controls2.cControls); for(SubIndex = 0; SubIndex < Controls1.cControls; SubIndex++) - Controls1.pamxctrl[SubIndex].cbStruct = sizeof(MIXERCONTROL); + Controls1.pamxctrl[SubIndex].cbStruct = sizeof(MIXERCONTROLW); for(SubIndex = 0; SubIndex < Controls2.cControls; SubIndex++) - Controls2.pamxctrl[SubIndex].cbStruct = sizeof(MIXERCONTROL); - - mixerGetLineControls((HMIXEROBJ)hMixer1, &Controls1, MIXER_GETLINECONTROLSF_ALL); + Controls2.pamxctrl[SubIndex].cbStruct = sizeof(MIXERCONTROLW); + + mixerGetLineControlsW((HMIXEROBJ)hMixer1, &Controls1, MIXER_GETLINECONTROLSF_ALL); + MMixerGetLineControls(&MixerContext, hMixer2, MIXER_GETLINECONTROLSF_ALL, &Controls2); wprintf(L"----------------------------------------\n"); - for(SubIndex = 0; SubIndex < Controls1.cControls; SubIndex++) + for(SubIndex = 0; SubIndex < Controls1.cControls || SubIndex < Controls2.cControls; SubIndex++) { - wprintf(L"WINM: Index %d dwControlID %lx dwControlType %lx fdwControl %lx cMultipleItems %lx szName %s szShortName %s \n", SubIndex, Controls1.pamxctrl[SubIndex].dwControlID, Controls1.pamxctrl[SubIndex].dwControlType, Controls1.pamxctrl[SubIndex].fdwControl, Controls1.pamxctrl[SubIndex].cMultipleItems, Controls1.pamxctrl[SubIndex].szName, Controls1.pamxctrl[SubIndex].szShortName); + if (SubIndex < Controls1.cControls) + { + wprintf(L"WINM: Index %d dwControlID %lx dwControlType %lx fdwControl %lx cMultipleItems %lx szName %s szShortName %s \n", SubIndex, Controls1.pamxctrl[SubIndex].dwControlID, Controls1.pamxctrl[SubIndex].dwControlType, Controls1.pamxctrl[SubIndex].fdwControl, Controls1.pamxctrl[SubIndex].cMultipleItems, Controls1.pamxctrl[SubIndex].szName, Controls1.pamxctrl[SubIndex].szShortName); + } + + if (SubIndex < Controls2.cControls) + { + wprintf(L"MMIX: Index %d dwControlID %lx dwControlType %lx fdwControl %lx cMultipleItems %lx szName %s szShortName %s \n", SubIndex, Controls2.pamxctrl[SubIndex].dwControlID, Controls2.pamxctrl[SubIndex].dwControlType, Controls2.pamxctrl[SubIndex].fdwControl, Controls2.pamxctrl[SubIndex].cMultipleItems, Controls2.pamxctrl[SubIndex].szName, Controls2.pamxctrl[SubIndex].szShortName); + } + } wprintf(L"----------------------------------------\n");
15 years
1
0
0
0
[janderwald] 44661: [SETUPAPI] - Implement SetupDiOpenDeviceInterfaceRegKey
by janderwald@svn.reactos.org
Author: janderwald Date: Sun Dec 20 01:53:21 2009 New Revision: 44661 URL:
http://svn.reactos.org/svn/reactos?rev=44661&view=rev
Log: [SETUPAPI] - Implement SetupDiOpenDeviceInterfaceRegKey Modified: trunk/reactos/dll/win32/setupapi/interface.c trunk/reactos/dll/win32/setupapi/stubs.c Modified: trunk/reactos/dll/win32/setupapi/interface.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/interfa…
============================================================================== --- trunk/reactos/dll/win32/setupapi/interface.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/setupapi/interface.c [iso-8859-1] Sun Dec 20 01:53:21 2009 @@ -337,11 +337,9 @@ IN HDEVINFO DeviceInfoSet, IN struct DeviceInfo *devInfo) { - BOOL ret; HKEY hKey, hRefKey; LPWSTR Path; SP_DEVICE_INTERFACE_DATA DeviceInterfaceData; - PLIST_ENTRY InterfaceListEntry; struct DeviceInterface *DevItf = NULL; if (InterfaceFlags != 0) @@ -425,6 +423,8 @@ SetLastError(ERROR_INVALID_HANDLE); else if (!DeviceInfoData) SetLastError(ERROR_INVALID_PARAMETER); + else if (DeviceInfoData && DeviceInfoData->Reserved == 0) + SetLastError(ERROR_INVALID_USER_BUFFER); else if (DeviceInfoData && DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA)) SetLastError(ERROR_INVALID_USER_BUFFER); else @@ -537,3 +537,87 @@ TRACE("Returning %d\n", ret); return ret; } + +HKEY WINAPI +SetupDiOpenDeviceInterfaceRegKey( + IN HDEVINFO DeviceInfoSet, IN PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, IN DWORD Reserved, IN REGSAM samDesired) +{ + HKEY hKey = INVALID_HANDLE_VALUE, hDevKey; + struct DeviceInfoSet * list; + + TRACE("%p %p %p 0x%08x 0x%08x)\n", DeviceInfoSet, DeviceInterfaceData, Reserved, samDesired); + + if (!DeviceInfoSet) + SetLastError(ERROR_INVALID_PARAMETER); + else if (DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE) + SetLastError(ERROR_INVALID_HANDLE); + else if ((list = (struct DeviceInfoSet *)DeviceInfoSet)->magic != SETUP_DEVICE_INFO_SET_MAGIC) + SetLastError(ERROR_INVALID_HANDLE); + else if (!DeviceInterfaceData) + SetLastError(ERROR_INVALID_PARAMETER); + else if (DeviceInterfaceData && DeviceInterfaceData->Reserved == 0) + SetLastError(ERROR_INVALID_USER_BUFFER); + else if (DeviceInterfaceData && DeviceInterfaceData->cbSize != sizeof(SP_DEVICE_INTERFACE_DATA)) + SetLastError(ERROR_INVALID_USER_BUFFER); + else + { + struct DeviceInterface *DevItf; + LPWSTR Path, Guid, Slash; + DWORD Length; + DevItf = (struct DeviceInterface *)DeviceInterfaceData->Reserved; + + Length = wcslen(DevItf->SymbolicLink); + + Path = HeapAlloc(GetProcessHeap(), 0, (Length+2) * sizeof(WCHAR)); + if (!Path) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return INVALID_HANDLE_VALUE; + } + + wcscpy(Path, DevItf->SymbolicLink); + + Guid = wcsrchr(Path, '}'); + Slash = wcsrchr(Path, '\\'); + if (!Guid || !Slash) + { + SetLastError(ERROR_INVALID_PARAMETER); + return INVALID_HANDLE_VALUE; + } + + if ((ULONG_PTR)Slash > (ULONG_PTR)Guid) + { + /* Create an extra slash */ + memmove(Slash+1, Slash, (wcslen(Slash) + 1) * sizeof(WCHAR)); + Slash[1] = L'#'; + } + + Guid = Path; + while((ULONG_PTR)Guid < (ULONG_PTR)Slash) + { + if (*Guid == L'\\') + *Guid = L'#'; + + Guid++; + } + + hKey = SetupDiOpenClassRegKeyExW(&DeviceInterfaceData->InterfaceClassGuid, samDesired, DIOCR_INTERFACE, NULL, NULL); + if (hKey != INVALID_HANDLE_VALUE) + { + if (RegOpenKeyExW(hKey, Path, 0, samDesired, &hDevKey) == ERROR_SUCCESS) + { + RegCloseKey(hKey); + hKey = hDevKey; + } + else + { + RegCloseKey(hKey); + hKey = INVALID_HANDLE_VALUE; + } + } + + HeapFree(GetProcessHeap(), 0, Path); + } + + return hKey; +} Modified: trunk/reactos/dll/win32/setupapi/stubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/stubs.c…
============================================================================== --- trunk/reactos/dll/win32/setupapi/stubs.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/setupapi/stubs.c [iso-8859-1] Sun Dec 20 01:53:21 2009 @@ -241,8 +241,4 @@ return FALSE; } -HKEY WINAPI SetupDiOpenDeviceInterfaceRegKey(IN HDEVINFO DeviceInfoSet, IN PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, IN DWORD Reserved, IN REGSAM samDesired) -{ - FIXME("%p %p %p 0x%08x 0x%08x: stub\n", DeviceInfoSet, DeviceInterfaceData, Reserved, samDesired); - return INVALID_HANDLE_VALUE; -} +
15 years
1
0
0
0
[janderwald] 44660: [MMIXER] - Fix buffer overflow
by janderwald@svn.reactos.org
Author: janderwald Date: Sat Dec 19 22:44:39 2009 New Revision: 44660 URL:
http://svn.reactos.org/svn/reactos?rev=44660&view=rev
Log: [MMIXER] - Fix buffer overflow Modified: trunk/reactos/lib/drivers/sound/mmixer/controls.c Modified: trunk/reactos/lib/drivers/sound/mmixer/controls.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmixer/c…
============================================================================== --- trunk/reactos/lib/drivers/sound/mmixer/controls.c [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/sound/mmixer/controls.c [iso-8859-1] Sat Dec 19 22:44:39 2009 @@ -576,8 +576,12 @@ if (LineName) { - wcscpy(DestinationLine->Line.szShortName, LineName); - wcscpy(DestinationLine->Line.szName, LineName); + MixerContext->Copy(DestinationLine->Line.szShortName, LineName, (min(MIXER_SHORT_NAME_CHARS, wcslen(LineName)+1)) * sizeof(WCHAR)); + DestinationLine->Line.szShortName[MIXER_SHORT_NAME_CHARS-1] = L'\0'; + + MixerContext->Copy(DestinationLine->Line.szName, LineName, (min(MIXER_LONG_NAME_CHARS, wcslen(LineName)+1)) * sizeof(WCHAR)); + DestinationLine->Line.szName[MIXER_LONG_NAME_CHARS-1] = L'\0'; + } else {
15 years
1
0
0
0
[janderwald] 44659: [MMIXER] - Fix broken check in MMixerAddMixerControl, which only copied the node name on failure - Add initialization of LineControlsExtraDat LIST_ENTRY type, which resulted in a crash
by janderwald@svn.reactos.org
Author: janderwald Date: Sat Dec 19 21:45:29 2009 New Revision: 44659 URL:
http://svn.reactos.org/svn/reactos?rev=44659&view=rev
Log: [MMIXER] - Fix broken check in MMixerAddMixerControl, which only copied the node name on failure - Add initialization of LineControlsExtraDat LIST_ENTRY type, which resulted in a crash Modified: trunk/reactos/lib/drivers/sound/mmixer/controls.c Modified: trunk/reactos/lib/drivers/sound/mmixer/controls.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmixer/c…
============================================================================== --- trunk/reactos/lib/drivers/sound/mmixer/controls.c [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/sound/mmixer/controls.c [iso-8859-1] Sat Dec 19 21:45:29 2009 @@ -207,7 +207,8 @@ /* get node name */ Status = MixerContext->Control(hDevice, IOCTL_KS_PROPERTY, (PVOID)&Node, sizeof(KSP_NODE), (LPVOID)Name, BytesReturned, &BytesReturned); - if (Status != MM_STATUS_SUCCESS) + + if (Status == MM_STATUS_SUCCESS) { MixerContext->Copy(MixerControl->szShortName, Name, (min(MIXER_SHORT_NAME_CHARS, wcslen(Name)+1)) * sizeof(WCHAR)); MixerControl->szShortName[MIXER_SHORT_NAME_CHARS-1] = L'\0'; @@ -300,7 +301,6 @@ { MixerContext->Free(Desc); MixerContext->Free(VolumeData); - return MM_STATUS_NO_MEMORY; } @@ -315,7 +315,6 @@ } MixerContext->Free(Desc); } - DPRINT("Status %x Name %S\n", Status, MixerControl->szName); return MM_STATUS_SUCCESS; @@ -594,6 +593,8 @@ DestinationLine->Line.Target.vDriverVersion = MixerInfo->MixCaps.vDriverVersion; wcscpy(DestinationLine->Line.Target.szPname, MixerInfo->MixCaps.szPname); + // initialize extra line + InitializeListHead(&DestinationLine->LineControlsExtraData); // insert into mixer info InsertHeadList(&MixerInfo->LineList, &DestinationLine->Entry); @@ -988,7 +989,7 @@ IN LPMIXER_DATA MixerData, IN PULONG DeviceCount) { - PKSMULTIPLE_ITEM NodeTypes, NodeConnections; + PKSMULTIPLE_ITEM NodeTypes = NULL, NodeConnections = NULL; MIXER_STATUS Status; ULONG PinCount; ULONG NodeIndex; @@ -1016,6 +1017,7 @@ } // check if the filter has an wave out node + NodeIndex = MMixerGetIndexOfGuid(NodeTypes, &KSNODETYPE_DAC); if (NodeIndex != MAXULONG) {
15 years
1
0
0
0
[janderwald] 44658: [KS] - Return correct status code
by janderwald@svn.reactos.org
Author: janderwald Date: Sat Dec 19 21:42:48 2009 New Revision: 44658 URL:
http://svn.reactos.org/svn/reactos?rev=44658&view=rev
Log: [KS] - Return correct status code Modified: trunk/reactos/drivers/ksfilter/ks/topology.c Modified: trunk/reactos/drivers/ksfilter/ks/topology.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/topolo…
============================================================================== --- trunk/reactos/drivers/ksfilter/ks/topology.c [iso-8859-1] (original) +++ trunk/reactos/drivers/ksfilter/ks/topology.c [iso-8859-1] Sat Dec 19 21:42:48 2009 @@ -308,7 +308,7 @@ if (KeyInfo->DataLength + sizeof(WCHAR) > IoStack->Parameters.DeviceIoControl.OutputBufferLength) { Irp->IoStatus.Information = KeyInfo->DataLength + sizeof(WCHAR); - Status = STATUS_BUFFER_TOO_SMALL; + Status = STATUS_MORE_ENTRIES; ExFreePool(KeyInfo); break; }
15 years
1
0
0
0
[gschneider] 44657: [gdi32] Use predefined unimplemented macro for stubs, correct header paths
by gschneider@svn.reactos.org
Author: gschneider Date: Sat Dec 19 20:07:36 2009 New Revision: 44657 URL:
http://svn.reactos.org/svn/reactos?rev=44657&view=rev
Log: [gdi32] Use predefined unimplemented macro for stubs, correct header paths Modified: trunk/reactos/dll/win32/gdi32/misc/stubs.c trunk/reactos/dll/win32/gdi32/misc/stubsa.c trunk/reactos/dll/win32/gdi32/misc/stubsw.c Modified: trunk/reactos/dll/win32/gdi32/misc/stubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/misc/stubs…
============================================================================== --- trunk/reactos/dll/win32/gdi32/misc/stubs.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdi32/misc/stubs.c [iso-8859-1] Sat Dec 19 20:07:36 2009 @@ -1,6 +1,5 @@ -/* $Id$ - * - * reactos/lib/gdi32/misc/stubs.c +/* + * dll/win32/gdi32/misc/stubs.c * * GDI32.DLL Stubs * @@ -10,6 +9,7 @@ */ #include "precomp.h" +#include <debug.h> #define SIZEOF_DEVMODEA_300 124 #define SIZEOF_DEVMODEA_400 148 @@ -17,8 +17,6 @@ #define SIZEOF_DEVMODEW_300 188 #define SIZEOF_DEVMODEW_400 212 #define SIZEOF_DEVMODEW_500 220 - -#define UNIMPLEMENTED DbgPrint("GDI32: %s is unimplemented, please try again later.\n", __FUNCTION__); /* Modified: trunk/reactos/dll/win32/gdi32/misc/stubsa.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/misc/stubs…
============================================================================== --- trunk/reactos/dll/win32/gdi32/misc/stubsa.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdi32/misc/stubsa.c [iso-8859-1] Sat Dec 19 20:07:36 2009 @@ -1,6 +1,5 @@ -/* $Id$ - * - * reactos/lib/gdi32/misc/stubs.c +/* + * dll/win32/gdi32/misc/stubsa.c * * GDI32.DLL Stubs for ANSI functions * @@ -10,8 +9,8 @@ */ #include "precomp.h" +#include <debug.h> -#define UNIMPLEMENTED DbgPrint("GDI32: %s is unimplemented, please try again later.\n", __FUNCTION__); /* * @unimplemented Modified: trunk/reactos/dll/win32/gdi32/misc/stubsw.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/misc/stubs…
============================================================================== --- trunk/reactos/dll/win32/gdi32/misc/stubsw.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdi32/misc/stubsw.c [iso-8859-1] Sat Dec 19 20:07:36 2009 @@ -1,6 +1,5 @@ -/* $Id$ - * - * reactos/lib/gdi32/misc/stubs.c +/* + * dll/win32/gdi32/misc/stubsw.c * * GDI32.DLL Stubs for Unicode functions * @@ -10,10 +9,7 @@ */ #include "precomp.h" - -#define UNIMPLEMENTED DbgPrint("GDI32: %s is unimplemented, please try again later.\n", __FUNCTION__); - - +#include <debug.h> /*
15 years
1
0
0
0
[gschneider] 44656: [win32k] Add parameter checks for NtGdiSetVirtualResolution
by gschneider@svn.reactos.org
Author: gschneider Date: Sat Dec 19 19:57:27 2009 New Revision: 44656 URL:
http://svn.reactos.org/svn/reactos?rev=44656&view=rev
Log: [win32k] Add parameter checks for NtGdiSetVirtualResolution Modified: trunk/reactos/subsystems/win32/win32k/objects/coord.c Modified: trunk/reactos/subsystems/win32/win32k/objects/coord.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/coord.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/coord.c [iso-8859-1] Sat Dec 19 19:57:27 2009 @@ -1024,7 +1024,20 @@ PDC dc; PDC_ATTR pdcattr; - // Need test types for zeros and non zeros + /* Check parameters (all zeroes resets to real resolution) */ + if (cxVirtualDevicePixel == 0 && cyVirtualDevicePixel == 0 && + cxVirtualDeviceMm == 0 && cyVirtualDeviceMm == 0) + { + cxVirtualDevicePixel = NtGdiGetDeviceCaps(hdc, HORZRES); + cyVirtualDevicePixel = NtGdiGetDeviceCaps(hdc, VERTRES); + cxVirtualDeviceMm = NtGdiGetDeviceCaps(hdc, HORZSIZE); + cyVirtualDeviceMm = NtGdiGetDeviceCaps(hdc, VERTSIZE); + } + else if (cxVirtualDevicePixel == 0 || cyVirtualDevicePixel == 0 || + cxVirtualDeviceMm == 0 || cyVirtualDeviceMm == 0) + { + return FALSE; + } dc = DC_LockDc(hdc); if (!dc) return FALSE;
15 years
1
0
0
0
[gadamopoulos] 44655: [win32k] - Don't store SYSTEM_CURSORINFO inside WINSTATION_OBJECT. Use a global variable instead - Remove IntGetCursorLocation. Use directly gpsi->ptCursor
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Sat Dec 19 17:23:05 2009 New Revision: 44655 URL:
http://svn.reactos.org/svn/reactos?rev=44655&view=rev
Log: [win32k] - Don't store SYSTEM_CURSORINFO inside WINSTATION_OBJECT. Use a global variable instead - Remove IntGetCursorLocation. Use directly gpsi->ptCursor Modified: trunk/reactos/subsystems/win32/win32k/include/cursoricon.h trunk/reactos/subsystems/win32/win32k/include/winsta.h trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c trunk/reactos/subsystems/win32/win32k/ntuser/input.c trunk/reactos/subsystems/win32/win32k/ntuser/keyboard.c trunk/reactos/subsystems/win32/win32k/ntuser/message.c trunk/reactos/subsystems/win32/win32k/ntuser/metric.c trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c Modified: trunk/reactos/subsystems/win32/win32k/include/cursoricon.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/cursoricon.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/cursoricon.h [iso-8859-1] Sat Dec 19 17:23:05 2009 @@ -69,21 +69,20 @@ BOOL ScreenSaverRunning; } SYSTEM_CURSORINFO, *PSYSTEM_CURSORINFO; -HCURSOR FASTCALL IntSetCursor(PWINSTATION_OBJECT WinStaObject, PCURICON_OBJECT NewCursor, BOOL ForceChange); -BOOL FASTCALL IntSetupCurIconHandles(PWINSTATION_OBJECT WinStaObject); -PCURICON_OBJECT FASTCALL IntCreateCurIconHandle(PWINSTATION_OBJECT WinStaObject); +BOOL FASTCALL InitCursorImpl(); +PCURICON_OBJECT FASTCALL IntCreateCurIconHandle(); VOID FASTCALL IntCleanupCurIcons(struct _EPROCESS *Process, PPROCESSINFO Win32Process); - -BOOL FASTCALL IntGetCursorLocation(PWINSTATION_OBJECT WinStaObject, POINT *loc); BOOL UserDrawIconEx(HDC hDc, INT xLeft, INT yTop, PCURICON_OBJECT pIcon, INT cxWidth, INT cyHeight, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags); PCURICON_OBJECT FASTCALL UserGetCurIconObject(HCURSOR hCurIcon); +BOOL FASTCALL UserSetCursorPos( INT x, INT y); + int APIENTRY UserShowCursor(BOOL bShow); -#define IntGetSysCursorInfo(WinStaObj) \ - (PSYSTEM_CURSORINFO)((WinStaObj)->SystemCursor) +PSYSTEM_CURSORINFO FASTCALL +IntGetSysCursorInfo(); #define IntReleaseCurIconObject(CurIconObj) \ UserDereferenceObject(CurIconObj) Modified: trunk/reactos/subsystems/win32/win32k/include/winsta.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/winsta.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/winsta.h [iso-8859-1] Sat Dec 19 17:23:05 2009 @@ -29,7 +29,6 @@ LIST_ENTRY DesktopListHead; PRTL_ATOM_TABLE AtomTable; HANDLE SystemMenuTemplate; - PVOID SystemCursor; UINT CaretBlinkRate; HANDLE ShellWindow; HANDLE ShellListView; Modified: trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c [iso-8859-1] Sat Dec 19 17:23:05 2009 @@ -44,13 +44,36 @@ static PAGED_LOOKASIDE_LIST gProcessLookasideList; static LIST_ENTRY gCurIconList; +SYSTEM_CURSORINFO gSysCursorInfo; + BOOL FASTCALL -IntGetCursorLocation(PWINSTATION_OBJECT WinSta, POINT *loc) -{ - loc->x = gpsi->ptCursor.x; - loc->y = gpsi->ptCursor.y; +InitCursorImpl() +{ + ExInitializePagedLookasideList(&gProcessLookasideList, + NULL, + NULL, + 0, + sizeof(CURICON_PROCESS), + TAG_DIB, + 128); + InitializeListHead(&gCurIconList); + + gSysCursorInfo.Enabled = FALSE; + gSysCursorInfo.ButtonsDown = 0; + gSysCursorInfo.CursorClipInfo.IsClipped = FALSE; + gSysCursorInfo.LastBtnDown = 0; + gSysCursorInfo.CurrentCursorObject = NULL; + gSysCursorInfo.ShowingCursor = 0; + gSysCursorInfo.ClickLockActive = FALSE; + gSysCursorInfo.ClickLockTime = 0; return TRUE; +} + +PSYSTEM_CURSORINFO FASTCALL +IntGetSysCursorInfo() +{ + return &gSysCursorInfo; } /* This function creates a reference for the object! */ @@ -78,8 +101,7 @@ HCURSOR FASTCALL -IntSetCursor( - PWINSTATION_OBJECT WinSta, +UserSetCursor( PCURICON_OBJECT NewCursor, BOOL ForceChange) { @@ -88,8 +110,9 @@ HCURSOR hOldCursor = (HCURSOR)0; HDC hdcScreen; BOOL bResult; - - CurInfo = IntGetSysCursorInfo(WinSta); + + CurInfo = IntGetSysCursorInfo(); + OldCursor = CurInfo->CurrentCursorObject; if (OldCursor) { @@ -152,22 +175,6 @@ return hOldCursor; } - -BOOL FASTCALL -IntSetupCurIconHandles(PWINSTATION_OBJECT WinSta) -{ - ExInitializePagedLookasideList(&gProcessLookasideList, - NULL, - NULL, - 0, - sizeof(CURICON_PROCESS), - TAG_DIB, - 128); - InitializeListHead(&gCurIconList); - - return TRUE; -} - /* * We have to register that this object is in use by the current * process. The only way to do that seems to be to walk the list @@ -207,7 +214,7 @@ } PCURICON_OBJECT FASTCALL -IntFindExistingCurIconObject(PWINSTATION_OBJECT WinSta, HMODULE hModule, +IntFindExistingCurIconObject(HMODULE hModule, HRSRC hRsrc, LONG cx, LONG cy) { PCURICON_OBJECT CurIcon; @@ -241,7 +248,7 @@ } PCURICON_OBJECT FASTCALL -IntCreateCurIconHandle(PWINSTATION_OBJECT WinSta) +IntCreateCurIconHandle() { PCURICON_OBJECT CurIcon; HANDLE hCurIcon; @@ -271,7 +278,7 @@ } BOOLEAN FASTCALL -IntDestroyCurIconObject(PWINSTATION_OBJECT WinSta, PCURICON_OBJECT CurIcon, BOOL ProcessCleanup) +IntDestroyCurIconObject(PCURICON_OBJECT CurIcon, BOOL ProcessCleanup) { PSYSTEM_CURSORINFO CurInfo; HBITMAP bmpMask, bmpColor; @@ -321,12 +328,12 @@ RemoveEntryList(&CurIcon->ListEntry); } - CurInfo = IntGetSysCursorInfo(WinSta); + CurInfo = IntGetSysCursorInfo(); if (CurInfo->CurrentCursorObject == CurIcon) { /* Hide the cursor if we're destroying the current cursor */ - IntSetCursor(WinSta, NULL, TRUE); + UserSetCursor(NULL, TRUE); } bmpMask = CurIcon->IconInfo.hbmMask; @@ -356,15 +363,8 @@ VOID FASTCALL IntCleanupCurIcons(struct _EPROCESS *Process, PPROCESSINFO Win32Process) { - PWINSTATION_OBJECT WinSta; PCURICON_OBJECT CurIcon, tmp; PCURICON_PROCESS ProcessData; - - WinSta = IntGetWinStaObj(); - if (WinSta == NULL) - { - return; - } LIST_FOR_EACH_SAFE(CurIcon, tmp, &gCurIconList, CURICON_OBJECT, ListEntry) { @@ -376,7 +376,7 @@ if (Win32Process == ProcessData->Process) { RemoveEntryList(&CurIcon->ListEntry); - IntDestroyCurIconObject(WinSta, CurIcon, TRUE); + IntDestroyCurIconObject(CurIcon, TRUE); CurIcon = NULL; break; } @@ -391,7 +391,6 @@ } } - ObDereferenceObject(WinSta); } /* @@ -402,7 +401,6 @@ NtUserCreateCursorIconHandle(PICONINFO IconInfo OPTIONAL, BOOL Indirect) { PCURICON_OBJECT CurIcon; - PWINSTATION_OBJECT WinSta; PSURFACE psurfBmp; NTSTATUS Status; HANDLE Ret; @@ -411,16 +409,9 @@ DPRINT("Enter NtUserCreateCursorIconHandle\n"); UserEnterExclusive(); - WinSta = IntGetWinStaObj(); - if (WinSta == NULL) - { - RETURN((HANDLE)0); - } - - if (!(CurIcon = IntCreateCurIconHandle(WinSta))) + if (!(CurIcon = IntCreateCurIconHandle())) { SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); - ObDereferenceObject(WinSta); RETURN((HANDLE)0); } @@ -473,7 +464,6 @@ } UserDereferenceObject(CurIcon); - ObDereferenceObject(WinSta); RETURN(Ret); CLEANUP: @@ -643,7 +633,6 @@ { CURSORINFO SafeCi; PSYSTEM_CURSORINFO CurInfo; - PWINSTATION_OBJECT WinSta; NTSTATUS Status = STATUS_SUCCESS; PCURICON_OBJECT CurIcon; BOOL Ret = FALSE; @@ -652,20 +641,14 @@ DPRINT("Enter NtUserGetCursorInfo\n"); UserEnterExclusive(); - WinSta = IntGetWinStaObj(); - if (WinSta == NULL) - { - RETURN(FALSE); - } - - CurInfo = IntGetSysCursorInfo(WinSta); + CurInfo = IntGetSysCursorInfo(); CurIcon = (PCURICON_OBJECT)CurInfo->CurrentCursorObject; SafeCi.cbSize = sizeof(CURSORINFO); SafeCi.flags = ((CurInfo->ShowingCursor && CurIcon) ? CURSOR_SHOWING : 0); SafeCi.hCursor = (CurIcon ? (HCURSOR)CurIcon->Self : (HCURSOR)0); - IntGetCursorLocation(WinSta, &SafeCi.ptScreenPos); + SafeCi.ptScreenPos = gpsi->ptCursor; _SEH2_TRY { @@ -690,7 +673,6 @@ SetLastNtError(Status); } - ObDereferenceObject(WinSta); RETURN(Ret); CLEANUP: @@ -709,35 +691,23 @@ RECTL *UnsafeRect) { /* FIXME - check if process has WINSTA_WRITEATTRIBUTES */ - - PWINSTATION_OBJECT WinSta; PSYSTEM_CURSORINFO CurInfo; RECTL Rect; PWINDOW_OBJECT DesktopWindow = NULL; - POINT MousePos = {0}; DECLARE_RETURN(BOOL); DPRINT("Enter NtUserClipCursor\n"); UserEnterExclusive(); - WinSta = IntGetWinStaObj(); - if (WinSta == NULL) - { - RETURN(FALSE); - } - if (NULL != UnsafeRect && ! NT_SUCCESS(MmCopyFromCaller(&Rect, UnsafeRect, sizeof(RECT)))) { - ObDereferenceObject(WinSta); SetLastWin32Error(ERROR_INVALID_PARAMETER); RETURN(FALSE); } - CurInfo = IntGetSysCursorInfo(WinSta); - IntGetCursorLocation(WinSta, &MousePos); - - if (WinSta->ActiveDesktop) - DesktopWindow = UserGetWindowObject(WinSta->ActiveDesktop->DesktopWindow); + CurInfo = IntGetSysCursorInfo(); + + DesktopWindow = UserGetDesktopWindow(); if ((Rect.right > Rect.left) && (Rect.bottom > Rect.top) && DesktopWindow && UnsafeRect != NULL) @@ -750,8 +720,8 @@ CurInfo->CursorClipInfo.Right = min(Rect.right - 1, DesktopWindow->Wnd->rcWindow.right - 1); CurInfo->CursorClipInfo.Bottom = min(Rect.bottom - 1, DesktopWindow->Wnd->rcWindow.bottom - 1); - mi.dx = MousePos.x; - mi.dy = MousePos.y; + mi.dx = gpsi->ptCursor.x; + mi.dy = gpsi->ptCursor.y; mi.mouseData = 0; mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE; mi.time = 0; @@ -762,8 +732,6 @@ } CurInfo->CursorClipInfo.IsClipped = FALSE; - ObDereferenceObject(WinSta); - RETURN(TRUE); CLEANUP: @@ -782,7 +750,6 @@ HANDLE hCurIcon, DWORD Unknown) { - PWINSTATION_OBJECT WinSta; PCURICON_OBJECT CurIcon; BOOL ret; DECLARE_RETURN(BOOL); @@ -790,22 +757,14 @@ DPRINT("Enter NtUserDestroyCursorIcon\n"); UserEnterExclusive(); - WinSta = IntGetWinStaObj(); - if (WinSta == NULL) + if (!(CurIcon = UserGetCurIconObject(hCurIcon))) { RETURN(FALSE); } - if (!(CurIcon = UserGetCurIconObject(hCurIcon))) - { - ObDereferenceObject(WinSta); - RETURN(FALSE); - } - - ret = IntDestroyCurIconObject(WinSta, CurIcon, FALSE); + ret = IntDestroyCurIconObject(CurIcon, FALSE); /* Note: IntDestroyCurIconObject will remove our reference for us! */ - ObDereferenceObject(WinSta); RETURN(ret); CLEANUP: @@ -827,31 +786,22 @@ LONG cy) { PCURICON_OBJECT CurIcon; - PWINSTATION_OBJECT WinSta; HANDLE Ret = (HANDLE)0; DECLARE_RETURN(HICON); DPRINT("Enter NtUserFindExistingCursorIcon\n"); UserEnterExclusive(); - WinSta = IntGetWinStaObj(); - if (WinSta == NULL) - { + CurIcon = IntFindExistingCurIconObject(hModule, hRsrc, cx, cy); + if (CurIcon) + { + Ret = CurIcon->Self; + +// IntReleaseCurIconObject(CurIcon);//faxme: is this correct? does IntFindExistingCurIconObject add a ref? RETURN(Ret); } - CurIcon = IntFindExistingCurIconObject(WinSta, hModule, hRsrc, cx, cy); - if (CurIcon) - { - Ret = CurIcon->Self; - -// IntReleaseCurIconObject(CurIcon);//faxme: is this correct? does IntFindExistingCurIconObject add a ref? - ObDereferenceObject(WinSta); - RETURN(Ret); - } - SetLastWin32Error(ERROR_INVALID_CURSOR_HANDLE); - ObDereferenceObject(WinSta); RETURN((HANDLE)0); CLEANUP: @@ -871,7 +821,6 @@ { /* FIXME - check if process has WINSTA_READATTRIBUTES */ PSYSTEM_CURSORINFO CurInfo; - PWINSTATION_OBJECT WinSta; RECTL Rect; NTSTATUS Status; DECLARE_RETURN(BOOL); @@ -882,13 +831,7 @@ if (!lpRect) RETURN(FALSE); - WinSta = IntGetWinStaObj(); - if (WinSta == NULL) - { - RETURN(FALSE); - } - - CurInfo = IntGetSysCursorInfo(WinSta); + CurInfo = IntGetSysCursorInfo(); if (CurInfo->CursorClipInfo.IsClipped) { Rect.left = CurInfo->CursorClipInfo.Left; @@ -907,12 +850,9 @@ Status = MmCopyToCaller(lpRect, &Rect, sizeof(RECT)); if (!NT_SUCCESS(Status)) { - ObDereferenceObject(WinSta); SetLastNtError(Status); RETURN(FALSE); } - - ObDereferenceObject(WinSta); RETURN(TRUE); @@ -933,23 +873,15 @@ { PCURICON_OBJECT CurIcon; HICON OldCursor; - PWINSTATION_OBJECT WinSta; DECLARE_RETURN(HCURSOR); DPRINT("Enter NtUserSetCursor\n"); UserEnterExclusive(); - WinSta = IntGetWinStaObj(); - if (WinSta == NULL) - { - RETURN(NULL); - } - if (hCursor) { if (!(CurIcon = UserGetCurIconObject(hCursor))) { - ObDereferenceObject(WinSta); RETURN(NULL); } } @@ -958,13 +890,12 @@ CurIcon = NULL; } - OldCursor = IntSetCursor(WinSta, CurIcon, FALSE); + OldCursor = UserSetCursor(CurIcon, FALSE); if (CurIcon) { UserDereferenceObject(CurIcon); } - ObDereferenceObject(WinSta); RETURN(OldCursor); @@ -987,7 +918,6 @@ PCURICON_OBJECT CurIcon; ICONINFO IconInfo; PSURFACE psurfBmp; - PWINSTATION_OBJECT WinSta; NTSTATUS Status; BOOL Ret = FALSE; DECLARE_RETURN(BOOL); @@ -995,15 +925,8 @@ DPRINT("Enter NtUserSetCursorContents\n"); UserEnterExclusive(); - WinSta = IntGetWinStaObj(); - if (WinSta == NULL) - { - RETURN(FALSE); - } - if (!(CurIcon = UserGetCurIconObject(hCurIcon))) { - ObDereferenceObject(WinSta); RETURN(FALSE); } @@ -1057,7 +980,6 @@ { UserDereferenceObject(CurIcon); } - ObDereferenceObject(WinSta); RETURN(Ret); CLEANUP: @@ -1080,7 +1002,6 @@ PICONINFO pIconInfo) { PCURICON_OBJECT CurIcon; - PWINSTATION_OBJECT WinSta; PSURFACE psurfBmp; NTSTATUS Status = STATUS_SUCCESS; BOOL Ret = FALSE; @@ -1089,15 +1010,8 @@ DPRINT("Enter NtUserSetCursorIconData\n"); UserEnterExclusive(); - WinSta = IntGetWinStaObj(); - if (WinSta == NULL) - { - RETURN(FALSE); - } - if (!(CurIcon = UserGetCurIconObject(Handle))) { - ObDereferenceObject(WinSta); RETURN(FALSE); } @@ -1149,7 +1063,6 @@ Ret = TRUE; UserDereferenceObject(CurIcon); - ObDereferenceObject(WinSta); RETURN(Ret); CLEANUP: @@ -1169,7 +1082,6 @@ HRSRC hGroupRsrc) { PCURICON_OBJECT CurIcon; - PWINSTATION_OBJECT WinSta; NTSTATUS Status; POINT SafeHotspot; BOOL Ret = FALSE; @@ -1178,15 +1090,8 @@ DPRINT("Enter NtUserSetCursorIconData\n"); UserEnterExclusive(); - WinSta = IntGetWinStaObj(); - if (WinSta == NULL) - { - RETURN(FALSE); - } - if (!(CurIcon = UserGetCurIconObject(hCurIcon))) { - ObDereferenceObject(WinSta); RETURN(FALSE); } @@ -1231,7 +1136,6 @@ done: UserDereferenceObject(CurIcon); - ObDereferenceObject(WinSta); RETURN(Ret); @@ -1608,10 +1512,7 @@ APIENTRY UserShowCursor(BOOL bShow) { - PTHREADINFO pti = PsGetCurrentThreadWin32Thread(); - PWINSTATION_OBJECT WinSta = pti->Desktop->WindowStation; PSYSTEM_CURSORINFO CurInfo; - HDC Screen; PDC dc; SURFOBJ *SurfObj; @@ -1619,6 +1520,8 @@ PDEVOBJ *ppdev; GDIPOINTER *pgp; int showpointer=0; + + CurInfo = IntGetSysCursorInfo(); if (!(Screen = IntGetScreenDC())) { @@ -1656,8 +1559,6 @@ } pgp = &ppdev->Pointer; - - CurInfo = IntGetSysCursorInfo(WinSta); if (bShow == FALSE) { Modified: trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] Sat Dec 19 17:23:05 2009 @@ -1684,18 +1684,23 @@ RETURN(FALSE); } - /* FIXME: Fail if the desktop belong to an invisible window station */ + if(DesktopObject->WindowStation != InputWindowStation) + { + ObDereferenceObject(DesktopObject); + DPRINT1("Switching desktop 0x%x denied because desktop doesn't belong to the interactive winsta!\n", hDesktop); + RETURN(FALSE); + } + /* FIXME: Fail if the process is associated with a secured desktop such as Winlogon or Screen-Saver */ /* FIXME: Connect to input device */ /* Set the active desktop in the desktop's window station. */ - DesktopObject->WindowStation->ActiveDesktop = DesktopObject; + InputWindowStation->ActiveDesktop = DesktopObject; /* Set the global state. */ InputDesktop = DesktopObject; InputDesktopHandle = hDesktop; - InputWindowStation = DesktopObject->WindowStation; ObDereferenceObject(DesktopObject); Modified: trunk/reactos/subsystems/win32/win32k/ntuser/input.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/input.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/input.c [iso-8859-1] Sat Dec 19 17:23:05 2009 @@ -1095,7 +1095,7 @@ ASSERT(WinSta); - CurInfo = IntGetSysCursorInfo(WinSta); + CurInfo = IntGetSysCursorInfo(); if(!mi->time) { @@ -1107,9 +1107,7 @@ SwapButtons = gspv.bMouseBtnSwap; DoMove = FALSE; - IntGetCursorLocation(WinSta, &MousePos); - OrgPos.x = MousePos.x; - OrgPos.y = MousePos.y; + OrgPos = MousePos = gpsi->ptCursor; if(mi->dwFlags & MOUSEEVENTF_MOVE) { @@ -1410,8 +1408,7 @@ /* All messages have to contain the cursor point. */ pti = PsGetCurrentThreadWin32Thread(); - IntGetCursorLocation(pti->Desktop->WindowStation, - &Msg.pt); + Msg.pt = gpsi->ptCursor; DPRINT1("Kbd Hook msg %d wParam %d lParam 0x%08x dropped by WH_KEYBOARD_LL hook\n", Msg.message, vk_hook, Msg.lParam); @@ -1464,8 +1461,8 @@ FocusMessageQueue->Desktop->pDeskInfo->LastInputWasKbd = TRUE; - IntGetCursorLocation(FocusMessageQueue->Desktop->WindowStation, - &Msg.pt); + Msg.pt = gpsi->ptCursor; + MsqPostMessage(FocusMessageQueue, &Msg, FALSE, QS_KEY); } else Modified: trunk/reactos/subsystems/win32/win32k/ntuser/keyboard.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/keyboard.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/keyboard.c [iso-8859-1] Sat Dec 19 17:23:05 2009 @@ -441,8 +441,7 @@ return FALSE; /* All messages have to contain the cursor point. */ - IntGetCursorLocation(pti->Desktop->WindowStation, - &NewMsg.pt); + NewMsg.pt = gpsi->ptCursor; switch (lpMsg->wParam) { Modified: trunk/reactos/subsystems/win32/win32k/ntuser/message.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/message.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/message.c [iso-8859-1] Sat Dec 19 17:23:05 2009 @@ -454,14 +454,9 @@ { WPARAM wParam; PSYSTEM_CURSORINFO CurInfo; - - if(!IntGetWindowStationObject(InputWindowStation)) - { - break; - } - CurInfo = IntGetSysCursorInfo(InputWindowStation); + CurInfo = IntGetSysCursorInfo(); + wParam = (WPARAM)(CurInfo->ButtonsDown); - ObDereferenceObject(InputWindowStation); co_IntSendMessage(Msg->hwnd, WM_MOUSEMOVE, wParam, Msg->lParam); co_IntSendMessage(Msg->hwnd, WM_SETCURSOR, (WPARAM)Msg->hwnd, MAKELPARAM(HTCLIENT, Msg->message)); @@ -1094,7 +1089,8 @@ Message.message = Msg; Message.wParam = wParam; Message.lParam = lParam; - IntGetCursorLocation(pThread->Desktop->WindowStation, &Message.pt); + Message.pt = gpsi->ptCursor; + KeQueryTickCount(&LargeTickCount); pThread->timeLast = Message.time = MsqCalculateMessageTime(&LargeTickCount); MsqPostMessage(pThread->MessageQueue, &Message, FALSE, QS_POSTMESSAGE); @@ -1180,7 +1176,7 @@ Message.message = Msg; Message.wParam = wParam; Message.lParam = lParam; - IntGetCursorLocation(pti->Desktop->WindowStation, &Message.pt); + Message.pt = gpsi->ptCursor; KeQueryTickCount(&LargeTickCount); pti->timeLast = Message.time = MsqCalculateMessageTime(&LargeTickCount); MsqPostMessage(Window->MessageQueue, &Message, FALSE, QS_POSTMESSAGE); Modified: trunk/reactos/subsystems/win32/win32k/ntuser/metric.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/metric.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/metric.c [iso-8859-1] Sat Dec 19 17:23:05 2009 @@ -23,27 +23,10 @@ FASTCALL InitMetrics(VOID) { - NTSTATUS Status; - PWINSTATION_OBJECT WinStaObject; - ULONG Width = 640, Height = 480; - PSYSTEM_CURSORINFO CurInfo; INT *piSysMet; - Width = pPrimarySurface->gdiinfo.ulHorzRes; - Height = pPrimarySurface->gdiinfo.ulVertRes; - - Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation, - KernelMode, - 0, - &WinStaObject); - if (NT_SUCCESS(Status)) - { - CurInfo = IntGetSysCursorInfo(WinStaObject); - } - else - { - CurInfo = NULL; - } + ULONG Width = pPrimarySurface->gdiinfo.ulHorzRes; + ULONG Height = pPrimarySurface->gdiinfo.ulVertRes; piSysMet = gpsi->aiSysMet; @@ -175,11 +158,6 @@ gpsi->dwSRVIFlags |= SRVINFO_METRICS; Setup = TRUE; - if (NT_SUCCESS(Status)) - { - ObDereferenceObject(WinStaObject); - } - return TRUE; } Modified: trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] Sat Dec 19 17:23:05 2009 @@ -236,7 +236,6 @@ MsqIsClkLck(LPMSG Msg, BOOL Remove) { PTHREADINFO pti; - PWINSTATION_OBJECT WinStaObject; PSYSTEM_CURSORINFO CurInfo; BOOL Res = FALSE; @@ -246,9 +245,7 @@ return FALSE; } - WinStaObject = pti->Desktop->WindowStation; - - CurInfo = IntGetSysCursorInfo(WinStaObject); + CurInfo = IntGetSysCursorInfo(); switch (Msg->message) { @@ -279,7 +276,6 @@ MsqIsDblClk(LPMSG Msg, BOOL Remove) { PTHREADINFO pti; - PWINSTATION_OBJECT WinStaObject; PSYSTEM_CURSORINFO CurInfo; LONG dX, dY; BOOL Res; @@ -290,9 +286,7 @@ return FALSE; } - WinStaObject = pti->Desktop->WindowStation; - - CurInfo = IntGetSysCursorInfo(WinStaObject); + CurInfo = IntGetSysCursorInfo(); Res = (Msg->hwnd == (HWND)CurInfo->LastClkWnd) && ((Msg->time - CurInfo->LastBtnDown) < gspv.iDblClickTime); if(Res) @@ -841,8 +835,7 @@ FocusMessageQueue->Desktop->pDeskInfo->LastInputWasKbd = TRUE; - IntGetCursorLocation(FocusMessageQueue->Desktop->WindowStation, - &Msg.pt); + Msg.pt = gpsi->ptCursor; MsqPostMessage(FocusMessageQueue, &Msg, FALSE, QS_KEY); } else @@ -859,7 +852,6 @@ { PWINDOW_OBJECT Window; PTHREADINFO Win32Thread; - PWINSTATION_OBJECT WinSta; MSG Mesg; LARGE_INTEGER LargeTickCount; NTSTATUS Status; @@ -878,7 +870,6 @@ return; } - WinSta = Win32Thread->Desktop->WindowStation; Window = IntGetWindowObject(hWnd); if (!Window) { @@ -892,7 +883,7 @@ Mesg.lParam = lParam; KeQueryTickCount(&LargeTickCount); Mesg.time = MsqCalculateMessageTime(&LargeTickCount); - IntGetCursorLocation(WinSta, &Mesg.pt); + Mesg.pt = gpsi->ptCursor; MsqPostMessage(Window->MessageQueue, &Mesg, FALSE, QS_HOTKEY); UserDereferenceObject(Window); ObDereferenceObject (Thread); @@ -1876,7 +1867,6 @@ LARGE_INTEGER LargeTickCount; PLIST_ENTRY EnumEntry; BOOLEAN GotMessage; - PTHREADINFO pti; DPRINT("MsqGetTimerMessage queue %p msg %p restart %s\n", MessageQueue, Msg, Restart ? "TRUE" : "FALSE"); @@ -1928,9 +1918,7 @@ Msg->lParam = (LPARAM) Timer->TimerFunc; KeQueryTickCount(&LargeTickCount); Msg->time = MsqCalculateMessageTime(&LargeTickCount); - pti = PsGetCurrentThreadWin32Thread(); - IntGetCursorLocation(pti->Desktop->WindowStation, - &Msg->pt); + Msg->pt = gpsi->ptCursor; if (Restart) { Modified: trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c [iso-8859-1] Sat Dec 19 17:23:05 2009 @@ -203,54 +203,34 @@ case ONEPARAM_ROUTINE_CREATECURICONHANDLE: { PCURICON_OBJECT CurIcon; - PWINSTATION_OBJECT WinSta; - - WinSta = IntGetWinStaObj(); - if(WinSta == NULL) - { + + if (!(CurIcon = IntCreateCurIconHandle())) + { + SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); RETURN(0); } - if (!(CurIcon = IntCreateCurIconHandle(WinSta))) - { - SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); - ObDereferenceObject(WinSta); - RETURN(0); - } - - ObDereferenceObject(WinSta); RETURN((DWORD)CurIcon->Self); } case ONEPARAM_ROUTINE_GETCURSORPOSITION: { - PWINSTATION_OBJECT WinSta; - NTSTATUS Status; - POINT Pos; - - if(!Param) - RETURN( (DWORD)FALSE); - Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation, - KernelMode, - 0, - &WinSta); - if (!NT_SUCCESS(Status)) - RETURN( (DWORD)FALSE); - - /* FIXME - check if process has WINSTA_READATTRIBUTES */ - IntGetCursorLocation(WinSta, &Pos); - - Status = MmCopyToCaller((PPOINT)Param, &Pos, sizeof(POINT)); - if(!NT_SUCCESS(Status)) - { - ObDereferenceObject(WinSta); - SetLastNtError(Status); - RETURN( FALSE); - } - - ObDereferenceObject(WinSta); - - RETURN( (DWORD)TRUE); + BOOL ret = TRUE; + + + _SEH2_TRY + { + ProbeForWrite((POINT*)Param,sizeof(POINT),1); + RtlCopyMemory((POINT*)Param,&gpsi->ptCursor,sizeof(POINT)); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + SetLastNtError(_SEH2_GetExceptionCode()); + ret = FALSE; + } + _SEH2_END; + + RETURN (ret); } case ONEPARAM_ROUTINE_ISWINDOWINDESTROY: Modified: trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c [iso-8859-1] Sat Dec 19 17:23:05 2009 @@ -395,7 +395,6 @@ DWORD Unknown5, DWORD Unknown6) { - PSYSTEM_CURSORINFO CurInfo; UNICODE_STRING WindowStationName; UNICODE_STRING FullWindowStationName; PWINSTATION_OBJECT WindowStationObject; @@ -522,61 +521,16 @@ WindowStationObject->FlatMenu = FALSE; - if(!(CurInfo = ExAllocatePool(PagedPool, sizeof(SYSTEM_CURSORINFO)))) - { - ExFreePool(FullWindowStationName.Buffer); - /* FIXME - Delete window station object */ - ObDereferenceObject(WindowStationObject); - SetLastNtError(STATUS_INSUFFICIENT_RESOURCES); - return 0; - } - - CurInfo->Enabled = FALSE; - CurInfo->ButtonsDown = 0; - CurInfo->CursorClipInfo.IsClipped = FALSE; - CurInfo->LastBtnDown = 0; - CurInfo->CurrentCursorObject = NULL; - CurInfo->ShowingCursor = 0; - CurInfo->ClickLockActive = FALSE; - CurInfo->ClickLockTime = 0; - -/* - // not used anymore - CurInfo->WheelScroLines = gspv.iWheelScrollLines; -#if (_WIN32_WINNT >= 0x0600) - CurInfo->WheelScroChars = gspv.iWheelScrollChars; -#endif - CurInfo->SwapButtons = gspv.bMouseBtnSwap; - CurInfo->DblClickSpeed = gspv.iDblClickTime; - CurInfo->DblClickWidth = gspv.iDblClickWidth; - CurInfo->DblClickHeight = gspv.iDblClickHeight; - - CurInfo->MouseSpeed = gspv.iMouseSpeed; - CurInfo->CursorAccelerationInfo.FirstThreshold = gspv.caiMouse.FirstThreshold; - CurInfo->CursorAccelerationInfo.SecondThreshold = gspv.caiMouse.SecondThreshold; - CurInfo->CursorAccelerationInfo.Acceleration = gspv.caiMouse.Acceleration; - - CurInfo->MouseHoverTime = gspv.iMouseHoverTime; - CurInfo->MouseHoverWidth = gspv.iMouseHoverWidth; - CurInfo->MouseHoverHeight = gspv.iMouseHoverHeight; -*/ - -// WindowStationObject->ScreenSaverActive = FALSE; -// WindowStationObject->ScreenSaverTimeOut = 10; - WindowStationObject->SystemCursor = CurInfo; - - /* END FIXME loading from register */ - if (!IntSetupClipboard(WindowStationObject)) { DPRINT1("WindowStation: Error Setting up the clipboard!!!\n"); } - if (!IntSetupCurIconHandles(WindowStationObject)) - { - DPRINT1("Setting up the Cursor/Icon Handle table failed!\n"); - /* FIXME: Complain more loudly? */ - ExFreePool(FullWindowStationName.Buffer); + if (InputWindowStation == NULL) + { + InputWindowStation = WindowStationObject; + + InitCursorImpl(); } DPRINT("Window station successfully created (%wZ)\n", &FullWindowStationName); @@ -708,12 +662,6 @@ DPRINT("Validation of window station handle (0x%X) failed\n", hWinSta); return FALSE; } - -#if 0 - /* FIXME - free the cursor information when actually deleting the object!! */ - ASSERT(Object->SystemCursor); - ExFreePool(Object->SystemCursor); -#endif ObDereferenceObject(Object);
15 years
1
0
0
0
[gschneider] 44654: [win32k] - Simplify GdiExtSelectClipRgn slightly - Add missing line break
by gschneider@svn.reactos.org
Author: gschneider Date: Sat Dec 19 14:08:53 2009 New Revision: 44654 URL:
http://svn.reactos.org/svn/reactos?rev=44654&view=rev
Log: [win32k] - Simplify GdiExtSelectClipRgn slightly - Add missing line break Modified: trunk/reactos/subsystems/win32/win32k/ntuser/scrollbar.c trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c Modified: trunk/reactos/subsystems/win32/win32k/ntuser/scrollbar.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/scrollbar.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/scrollbar.c [iso-8859-1] Sat Dec 19 14:08:53 2009 @@ -729,7 +729,7 @@ if(!SBID_IS_VALID(Obj)) { SetLastWin32Error(ERROR_INVALID_PARAMETER); - DPRINT1("Trying to set scrollinfo for unknown scrollbar type %d", Obj); + DPRINT1("Trying to set scrollinfo for unknown scrollbar type %d\n", Obj); RETURN( FALSE); } Modified: trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c [iso-8859-1] Sat Dec 19 14:08:53 2009 @@ -96,10 +96,9 @@ int FASTCALL GdiExtSelectClipRgn(PDC dc, - HRGN hrgn, - int fnMode) -{ - int retval; + HRGN hrgn, + int fnMode) +{ // dc->fs &= ~DC_FLAG_DIRTY_RAO; if (!hrgn) @@ -110,7 +109,6 @@ { GreDeleteObject(dc->rosdc.hClipRgn); dc->rosdc.hClipRgn = NULL; - retval = NULLREGION; } } else @@ -144,8 +142,7 @@ NtGdiCombineRgn(dc->rosdc.hClipRgn, dc->rosdc.hClipRgn, hrgn, fnMode); } - retval = CLIPPING_UpdateGCRegion(dc); - return retval; + return CLIPPING_UpdateGCRegion(dc); }
15 years
1
0
0
0
[tkreuzer] 44653: [MM] - Improve MiGetPteForProcess Implement MiGetPteProtection, MiSetPteProtection, MmCreateVirtualMappingUnsafe, MmCreateVirtualMapping
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sat Dec 19 04:43:33 2009 New Revision: 44653 URL:
http://svn.reactos.org/svn/reactos?rev=44653&view=rev
Log: [MM] - Improve MiGetPteForProcess Implement MiGetPteProtection, MiSetPteProtection, MmCreateVirtualMappingUnsafe, MmCreateVirtualMapping Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/mm/amd64/page.c Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/mm/amd64/page.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
============================================================================== --- branches/ros-amd64-bringup/reactos/ntoskrnl/mm/amd64/page.c [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/ntoskrnl/mm/amd64/page.c [iso-8859-1] Sat Dec 19 04:43:33 2009 @@ -18,6 +18,14 @@ #pragma alloc_text(INIT, MiInitPageDirectoryMap) #endif +#undef InterlockedExchangePte +#define InterlockedExchangePte(pte1, pte2) \ + InterlockedExchange64(&pte1->u.Long, pte2.u.Long) + +#define PAGE_EXECUTE_ANY (PAGE_EXECUTE|PAGE_EXECUTE_READ|PAGE_EXECUTE_READWRITE|PAGE_EXECUTE_WRITECOPY) +#define PAGE_WRITE_ANY (PAGE_EXECUTE_READWRITE|PAGE_READWRITE|PAGE_EXECUTE_WRITECOPY|PAGE_WRITECOPY) +#define PAGE_WRITECOPY_ANY (PAGE_EXECUTE_WRITECOPY|PAGE_WRITECOPY) + extern MMPTE HyperTemplatePte; /* GLOBALS *****************************************************************/ @@ -53,7 +61,7 @@ PVOID Address, BOOLEAN Create) { - PMMPTE Pte; + MMPTE TmplPte, *Pte; /* Check if we need hypersapce mapping */ if (Address < MmSystemRangeStart && @@ -64,25 +72,33 @@ } else if (Create) { + TmplPte.u.Long = 0; + TmplPte.u.Flush.Valid = 1; + TmplPte.u.Flush.Write = 1; + /* Get the PXE */ Pte = MiAddressToPxe(Address); if (!Pte->u.Hard.Valid) - InterlockedBitTestAndSet64(&Pte->u.Long, 0); + { + TmplPte.u.Hard.PageFrameNumber = MiAllocPage(TRUE); + InterlockedExchangePte(Pte, TmplPte); + } /* Get the PPE */ Pte = MiAddressToPpe(Address); if (!Pte->u.Hard.Valid) - InterlockedBitTestAndSet64(&Pte->u.Long, 0); + { + TmplPte.u.Hard.PageFrameNumber = MiAllocPage(TRUE); + InterlockedExchangePte(Pte, TmplPte); + } /* Get the PDE */ Pte = MiAddressToPde(Address); if (!Pte->u.Hard.Valid) - InterlockedBitTestAndSet64(&Pte->u.Long, 0); - - /* Get the PTE */ - Pte = MiAddressToPte(Address); - - return Pte; + { + TmplPte.u.Hard.PageFrameNumber = MiAllocPage(TRUE); + InterlockedExchangePte(Pte, TmplPte); + } } else { @@ -100,14 +116,9 @@ Pte = MiAddressToPde(Address); if (!Pte->u.Hard.Valid) return NULL; - - /* Get the PTE */ - Pte = MiAddressToPte(Address); - - return Pte; - } - - return 0; + } + + return MiAddressToPte(Address); } static @@ -128,75 +139,11 @@ return PteValue; } - -/* FUNCTIONS ***************************************************************/ - -PFN_NUMBER -NTAPI -MmGetPfnForProcess(PEPROCESS Process, - PVOID Address) -{ - MMPTE Pte; - Pte.u.Long = MiGetPteValueForProcess(Process, Address); - return Pte.u.Hard.Valid ? Pte.u.Hard.PageFrameNumber : 0; -} - -PHYSICAL_ADDRESS -NTAPI -MmGetPhysicalAddress(PVOID Address) -{ - PHYSICAL_ADDRESS p; - MMPTE Pte; - - Pte.u.Long = MiGetPteValueForProcess(NULL, Address); - if (Pte.u.Hard.Valid) - { - p.QuadPart = Pte.u.Hard.PageFrameNumber * PAGE_SIZE; - p.u.LowPart |= (ULONG_PTR)Address & (PAGE_SIZE - 1); - } - else - { - p.QuadPart = 0; - } - - return p; -} - -BOOLEAN -NTAPI -MmIsPagePresent(PEPROCESS Process, PVOID Address) -{ - MMPTE Pte; - Pte.u.Long = MiGetPteValueForProcess(Process, Address); - return Pte.u.Hard.Valid; -} - -BOOLEAN -NTAPI -MmIsPageSwapEntry(PEPROCESS Process, PVOID Address) -{ - MMPTE Pte; - Pte.u.Long = MiGetPteValueForProcess(Process, Address); - return Pte.u.Hard.Valid && Pte.u.Soft.Transition; -} - -BOOLEAN -NTAPI -MmIsDirtyPage(PEPROCESS Process, PVOID Address) -{ - MMPTE Pte; - Pte.u.Long = MiGetPteValueForProcess(Process, Address); - return Pte.u.Hard.Valid && Pte.u.Hard.Dirty; -} - ULONG NTAPI -MmGetPageProtect(PEPROCESS Process, PVOID Address) -{ - MMPTE Pte; +MiGetPteProtection(MMPTE Pte) +{ ULONG Protect; - - Pte.u.Long = MiGetPteValueForProcess(Process, Address); if (!Pte.u.Flush.Valid) { @@ -228,11 +175,93 @@ Protect |= PAGE_WRITETHROUGH; // PAGE_GUARD ? - return Protect; } -#define PAGE_EXECUTE_ANY (PAGE_EXECUTE|PAGE_EXECUTE_READ|PAGE_EXECUTE_READWRITE|PAGE_EXECUTE_WRITECOPY) +VOID +NTAPI +MiSetPteProtection(PMMPTE Pte, ULONG Protection) +{ + Pte->u.Flush.CopyOnWrite = (Protection & PAGE_WRITECOPY_ANY) ? 1 : 0; + Pte->u.Flush.Write = (Protection & PAGE_WRITE_ANY) ? 1 : 0; + Pte->u.Flush.CacheDisable = (Protection & PAGE_NOCACHE) ? 1 : 0; + Pte->u.Flush.WriteThrough = (Protection & PAGE_WRITETHROUGH) ? 1 : 0; + + // FIXME: This doesn't work. Why? +// Pte->u.Flush.NoExecute = (Protection & PAGE_EXECUTE_ANY) ? 0 : 1; +} + +/* FUNCTIONS ***************************************************************/ + +PFN_NUMBER +NTAPI +MmGetPfnForProcess(PEPROCESS Process, + PVOID Address) +{ + MMPTE Pte; + Pte.u.Long = MiGetPteValueForProcess(Process, Address); + return Pte.u.Hard.Valid ? Pte.u.Hard.PageFrameNumber : 0; +} + +PHYSICAL_ADDRESS +NTAPI +MmGetPhysicalAddress(PVOID Address) +{ + PHYSICAL_ADDRESS p; + MMPTE Pte; + + Pte.u.Long = MiGetPteValueForProcess(NULL, Address); + if (Pte.u.Hard.Valid) + { + p.QuadPart = Pte.u.Hard.PageFrameNumber * PAGE_SIZE; + p.u.LowPart |= (ULONG_PTR)Address & (PAGE_SIZE - 1); + } + else + { + p.QuadPart = 0; + } + + return p; +} + +BOOLEAN +NTAPI +MmIsPagePresent(PEPROCESS Process, PVOID Address) +{ + MMPTE Pte; + Pte.u.Long = MiGetPteValueForProcess(Process, Address); + return Pte.u.Hard.Valid; +} + +BOOLEAN +NTAPI +MmIsPageSwapEntry(PEPROCESS Process, PVOID Address) +{ + MMPTE Pte; + Pte.u.Long = MiGetPteValueForProcess(Process, Address); + return Pte.u.Hard.Valid && Pte.u.Soft.Transition; +} + +BOOLEAN +NTAPI +MmIsDirtyPage(PEPROCESS Process, PVOID Address) +{ + MMPTE Pte; + Pte.u.Long = MiGetPteValueForProcess(Process, Address); + return Pte.u.Hard.Valid && Pte.u.Hard.Dirty; +} + +ULONG +NTAPI +MmGetPageProtect(PEPROCESS Process, PVOID Address) +{ + MMPTE Pte; + ULONG Protect; + + Pte.u.Long = MiGetPteValueForProcess(Process, Address); + + return MiGetPteProtection(Pte); +} VOID NTAPI @@ -241,27 +270,14 @@ PMMPTE Pte; MMPTE NewPte; - if (!(flProtect & PAGE_EXECUTE_ANY)) - NewPte.u.Flush.NoExecute = 1; - - if (flProtect & (PAGE_EXECUTE_WRITECOPY|PAGE_WRITECOPY)) - { - NewPte.u.Flush.Write = 1; - NewPte.u.Flush.CopyOnWrite = 1; - } - - if (flProtect & (PAGE_EXECUTE_READWRITE|PAGE_READWRITE)) - NewPte.u.Flush.Write = 1; - - if (flProtect & PAGE_NOCACHE) - NewPte.u.Flush.CacheDisable = 1; - - if (flProtect & PAGE_WRITETHROUGH) - NewPte.u.Flush.WriteThrough = 1; - Pte = MiGetPteForProcess(Process, Address, FALSE); - - InterlockedExchange64(&Pte->u.Long, NewPte.u.Long); + ASSERT(Pte != NULL); + + NewPte = *Pte; + + MiSetPteProtection(&NewPte, flProtect); + + InterlockedExchangePte(Pte, NewPte); MiFlushTlb(Pte, Address); } @@ -409,26 +425,74 @@ NTSTATUS NTAPI -MmCreateVirtualMappingUnsafe(PEPROCESS Process, - PVOID Address, - ULONG flProtect, - PPFN_NUMBER Pages, - ULONG PageCount) -{ - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; +MmCreateVirtualMappingUnsafe( + PEPROCESS Process, + PVOID Address, + ULONG PageProtection, + PPFN_NUMBER Pages, + ULONG PageCount) +{ + ULONG i; + MMPTE TmplPte, *Pte; + + /* Check if the range is valid */ + if ((Process == NULL && Address < MmSystemRangeStart) || + (Process != NULL && Address > MmHighestUserAddress)) + { + DPRINT1("Address 0x%p is invalid for process %p\n", Address, Process); + ASSERT(FALSE); + } + + TmplPte.u.Long = 0; + TmplPte.u.Hard.Valid = 1; + MiSetPteProtection(&TmplPte, PageProtection); + +//__debugbreak(); + + for (i = 0; i < PageCount; i++) + { + TmplPte.u.Hard.PageFrameNumber = Pages[i]; + + Pte = MiGetPteForProcess(Process, Address, TRUE); + +DPRINT1("MmCreateVirtualMappingUnsafe, Address=%p, TmplPte=%p, Pte=%p\n", + Address, TmplPte.u.Long, Pte); + + if (InterlockedExchangePte(Pte, TmplPte)) + { + KeInvalidateTlbEntry(Address); + } + + if (MiIsHyperspaceAddress(Pte)) + MmDeleteHyperspaceMapping((PVOID)PAGE_ROUND_DOWN(Pte)); + + Address = (PVOID)((ULONG64)Address + PAGE_SIZE); + } + + + return STATUS_SUCCESS; } NTSTATUS NTAPI MmCreateVirtualMapping(PEPROCESS Process, PVOID Address, - ULONG flProtect, + ULONG Protect, PPFN_NUMBER Pages, ULONG PageCount) { - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; + ULONG i; + + for (i = 0; i < PageCount; i++) + { + if (!MmIsPageInUse(Pages[i])) + { + DPRINT1("Page %x not in use\n", Pages[i]); + KeBugCheck(MEMORY_MANAGEMENT); + } + } + + return MmCreateVirtualMappingUnsafe(Process, Address, Protect, Pages, PageCount); } NTSTATUS
15 years
1
0
0
0
← Newer
1
...
16
17
18
19
20
21
22
...
51
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Results per page:
10
25
50
100
200