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
July 2016
----- 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
18 participants
358 discussions
Start a n
N
ew thread
[ekohl] 71976: [USETUP] Keyboard Modifier LEDs not working in usetup. Patch by Carlo Bramini. CORE-3368 #resolve #comment Thanks a lot!
by ekohl@svn.reactos.org
Author: ekohl Date: Thu Jul 21 20:53:43 2016 New Revision: 71976 URL:
http://svn.reactos.org/svn/reactos?rev=71976&view=rev
Log: [USETUP] Keyboard Modifier LEDs not working in usetup. Patch by Carlo Bramini. CORE-3368 #resolve #comment Thanks a lot! Modified: trunk/reactos/base/setup/usetup/native/utils/console.c trunk/reactos/base/setup/usetup/native/utils/keytrans.c trunk/reactos/base/setup/usetup/native/utils/keytrans.h Modified: trunk/reactos/base/setup/usetup/native/utils/console.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/native/u…
============================================================================== --- trunk/reactos/base/setup/usetup/native/utils/console.c [iso-8859-1] (original) +++ trunk/reactos/base/setup/usetup/native/utils/console.c [iso-8859-1] Thu Jul 21 20:53:43 2016 @@ -218,7 +218,7 @@ return FALSE; lpBuffer->EventType = KEY_EVENT; - Status = IntTranslateKey(&InputData, &lpBuffer->Event.KeyEvent); + Status = IntTranslateKey(hConsoleInput, &InputData, &lpBuffer->Event.KeyEvent); if (!NT_SUCCESS(Status)) return FALSE; Modified: trunk/reactos/base/setup/usetup/native/utils/keytrans.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/native/u…
============================================================================== --- trunk/reactos/base/setup/usetup/native/utils/keytrans.c [iso-8859-1] (original) +++ trunk/reactos/base/setup/usetup/native/utils/keytrans.c [iso-8859-1] Thu Jul 21 20:53:43 2016 @@ -117,13 +117,6 @@ 0, 0, 0, 0 }; -/* - * Note how the keyboard lights are not handled, so while NUMLOCK_ON can - * be on, the light will never be. If this starts to be a problem it can be - * fixed, but it's too much work for too little gain to do now. - * Look in win32k/ntuser/input.c for an example. - */ - static WORD KeyTableNumlock[] = { /* 0x00 */ 0, 0, 0, 0, @@ -255,12 +248,15 @@ static void -IntUpdateControlKeyState(LPDWORD State, PKEYBOARD_INPUT_DATA InputData) +IntUpdateControlKeyState(HANDLE hConsoleInput, LPDWORD State, PKEYBOARD_INPUT_DATA InputData) { DWORD Value = 0; + DWORD oldState, newState; if (InputData->Flags & KEY_E1) /* Only the pause key has E1 */ return; + + oldState = newState = *State; if (!(InputData->Flags & KEY_E0)) { switch (InputData->MakeCode) { @@ -278,22 +274,19 @@ break; case 0x3A: - Value = CAPSLOCK_ON; if (!(InputData->Flags & KEY_BREAK)) - *State ^= Value; - return; + newState ^= CAPSLOCK_ON; + break; case 0x45: - Value = NUMLOCK_ON; if (!(InputData->Flags & KEY_BREAK)) - *State ^= Value; - return; + newState ^= NUMLOCK_ON; + break; case 0x46: - Value = SCROLLLOCK_ON; if (!(InputData->Flags & KEY_BREAK)) - *State ^= Value; - return; + newState ^= SCROLLLOCK_ON; + break; default: return; @@ -313,10 +306,52 @@ } } + /* Check if the state of the indicators has been changed */ + if ((oldState ^ newState) & (NUMLOCK_ON | CAPSLOCK_ON | SCROLLLOCK_ON)) + { + IO_STATUS_BLOCK IoStatusBlock; + NTSTATUS Status; + KEYBOARD_INDICATOR_PARAMETERS kip; + + kip.LedFlags = 0; + kip.UnitId = 0; + + if ((newState & NUMLOCK_ON)) + kip.LedFlags |= KEYBOARD_NUM_LOCK_ON; + + if ((newState & CAPSLOCK_ON)) + kip.LedFlags |= KEYBOARD_CAPS_LOCK_ON; + + if ((newState & SCROLLLOCK_ON)) + kip.LedFlags |= KEYBOARD_SCROLL_LOCK_ON; + + /* Update the state of the leds on primary keyboard */ + DPRINT("NtDeviceIoControlFile dwLeds=%x\n", kip.LedFlags); + + Status = NtDeviceIoControlFile( + hConsoleInput, + NULL, + NULL, + NULL, + &IoStatusBlock, + IOCTL_KEYBOARD_SET_INDICATORS, + &kip, + sizeof(kip), + NULL, + 0); + + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtDeviceIoControlFile(IOCTL_KEYBOARD_SET_INDICATORS) failed (Status %lx)\n", Status); + } + } else + /* Normal press/release state handling */ if (InputData->Flags & KEY_BREAK) - *State &= ~Value; + newState &= ~Value; else - *State |= Value; + newState |= Value; + + *State = newState; } static DWORD @@ -379,7 +414,7 @@ * in the app so I'll just fill the others with somewhat sane values */ NTSTATUS -IntTranslateKey(PKEYBOARD_INPUT_DATA InputData, KEY_EVENT_RECORD *Event) +IntTranslateKey(HANDLE hConsoleInput, PKEYBOARD_INPUT_DATA InputData, KEY_EVENT_RECORD *Event) { static DWORD dwControlKeyState; @@ -395,7 +430,7 @@ DPRINT("Translating: %x\n", InputData->MakeCode); - IntUpdateControlKeyState(&dwControlKeyState, InputData); + IntUpdateControlKeyState(hConsoleInput, &dwControlKeyState, InputData); Event->dwControlKeyState = dwControlKeyState; if (InputData->Flags & KEY_E0) Modified: trunk/reactos/base/setup/usetup/native/utils/keytrans.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/native/u…
============================================================================== --- trunk/reactos/base/setup/usetup/native/utils/keytrans.h [iso-8859-1] (original) +++ trunk/reactos/base/setup/usetup/native/utils/keytrans.h [iso-8859-1] Thu Jul 21 20:53:43 2016 @@ -28,6 +28,6 @@ #include <ntddkbd.h> NTSTATUS -IntTranslateKey(PKEYBOARD_INPUT_DATA InputData, KEY_EVENT_RECORD *Event); +IntTranslateKey(HANDLE hConsoleInput, PKEYBOARD_INPUT_DATA InputData, KEY_EVENT_RECORD *Event); /* EOF */
8 years, 5 months
1
0
0
0
[mjansen] 71975: [ACPPAGE] Add windows ME to the Win98 selection item. Patch by Lee Schroeder. CORE-11606 #resolve #comment Thanks!
by mjansen@svn.reactos.org
Author: mjansen Date: Thu Jul 21 17:29:41 2016 New Revision: 71975 URL:
http://svn.reactos.org/svn/reactos?rev=71975&view=rev
Log: [ACPPAGE] Add windows ME to the Win98 selection item. Patch by Lee Schroeder. CORE-11606 #resolve #comment Thanks! Modified: trunk/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp Modified: trunk/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/acppage/CLaye…
============================================================================== --- trunk/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp [iso-8859-1] Thu Jul 21 17:29:41 2016 @@ -72,7 +72,7 @@ const PCWSTR Name; } g_CompatModes[] = { { L"Windows 95", L"WIN95" }, - { L"Windows 98", L"WIN98" }, + { L"Windows 98/ME", L"WIN98" }, { L"Windows NT 4.0 (SP5)", L"NT4SP5" }, { L"Windows 2000", L"WIN2000" }, { L"Windows XP (SP2)", L"WINXPSP2" },
8 years, 5 months
1
0
0
0
[tfaber] 71974: [SERIAL] - Properly stub SerialPower CORE-11648
by tfaber@svn.reactos.org
Author: tfaber Date: Wed Jul 20 12:50:58 2016 New Revision: 71974 URL:
http://svn.reactos.org/svn/reactos?rev=71974&view=rev
Log: [SERIAL] - Properly stub SerialPower CORE-11648 Modified: trunk/reactos/drivers/serial/serial/power.c Modified: trunk/reactos/drivers/serial/serial/power.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/serial/serial/powe…
============================================================================== --- trunk/reactos/drivers/serial/serial/power.c [iso-8859-1] (original) +++ trunk/reactos/drivers/serial/serial/power.c [iso-8859-1] Wed Jul 20 12:50:58 2016 @@ -16,9 +16,12 @@ IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { + PSERIAL_DEVICE_EXTENSION DeviceExtension; + TRACE_(SERIAL, "IRP_MJ_POWER dispatch\n"); - Irp->IoStatus.Information = 0; - Irp->IoStatus.Status = STATUS_SUCCESS; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return STATUS_SUCCESS; + + DeviceExtension = DeviceObject->DeviceExtension; + PoStartNextPowerIrp(Irp); + IoSkipCurrentIrpStackLocation(Irp); + return PoCallDriver(DeviceExtension->LowerDevice, Irp); }
8 years, 5 months
1
0
0
0
[tfaber] 71973: [PARPORT] - Properly stub FdoPower and PdoPower CORE-11648
by tfaber@svn.reactos.org
Author: tfaber Date: Wed Jul 20 12:21:11 2016 New Revision: 71973 URL:
http://svn.reactos.org/svn/reactos?rev=71973&view=rev
Log: [PARPORT] - Properly stub FdoPower and PdoPower CORE-11648 Modified: trunk/reactos/drivers/parallel/parport/fdo.c trunk/reactos/drivers/parallel/parport/pdo.c Modified: trunk/reactos/drivers/parallel/parport/fdo.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/parallel/parport/f…
============================================================================== --- trunk/reactos/drivers/parallel/parport/fdo.c [iso-8859-1] (original) +++ trunk/reactos/drivers/parallel/parport/fdo.c [iso-8859-1] Wed Jul 20 12:21:11 2016 @@ -600,13 +600,14 @@ FdoPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { + PDEVICE_OBJECT LowerDevice; + DPRINT("FdoPower()\n"); - Irp->IoStatus.Information = 0; - Irp->IoStatus.Status = STATUS_SUCCESS; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - - return STATUS_SUCCESS; + LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice; + PoStartNextPowerIrp(Irp); + IoSkipCurrentIrpStackLocation(Irp); + return PoCallDriver(LowerDevice, Irp);; } /* EOF */ Modified: trunk/reactos/drivers/parallel/parport/pdo.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/parallel/parport/p…
============================================================================== --- trunk/reactos/drivers/parallel/parport/pdo.c [iso-8859-1] (original) +++ trunk/reactos/drivers/parallel/parport/pdo.c [iso-8859-1] Wed Jul 20 12:21:11 2016 @@ -175,12 +175,25 @@ PdoPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { + NTSTATUS Status; + PIO_STACK_LOCATION IoStack; + DPRINT("PdoPower()\n"); - Irp->IoStatus.Information = 0; - Irp->IoStatus.Status = STATUS_SUCCESS; + IoStack = IoGetCurrentIrpStackLocation(Irp); + + switch (IoStack->MinorFunction) + { + case IRP_MN_SET_POWER: + case IRP_MN_QUERY_POWER: + Irp->IoStatus.Status = STATUS_SUCCESS; + break; + } + + Status = Irp->IoStatus.Status; + PoStartNextPowerIrp(Irp); IoCompleteRequest(Irp, IO_NO_INCREMENT); - return STATUS_SUCCESS; + return Status; } /* EOF */
8 years, 5 months
1
0
0
0
[tfaber] 71972: [PCIIDEX] - Add a stub for PciIdeXPowerDispatch CORE-11648
by tfaber@svn.reactos.org
Author: tfaber Date: Wed Jul 20 11:49:22 2016 New Revision: 71972 URL:
http://svn.reactos.org/svn/reactos?rev=71972&view=rev
Log: [PCIIDEX] - Add a stub for PciIdeXPowerDispatch CORE-11648 Modified: trunk/reactos/drivers/storage/ide/pciidex/miniport.c Modified: trunk/reactos/drivers/storage/ide/pciidex/miniport.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/ide/pciide…
============================================================================== --- trunk/reactos/drivers/storage/ide/pciidex/miniport.c [iso-8859-1] (original) +++ trunk/reactos/drivers/storage/ide/pciidex/miniport.c [iso-8859-1] Wed Jul 20 11:49:22 2016 @@ -42,6 +42,42 @@ } } +_Dispatch_type_(IRP_MJ_POWER) +static DRIVER_DISPATCH PciIdeXPowerDispatch; +static NTSTATUS NTAPI +PciIdeXPowerDispatch( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + NTSTATUS Status; + PIO_STACK_LOCATION IoStack; + PDEVICE_OBJECT LowerDevice; + + IoStack = IoGetCurrentIrpStackLocation(Irp); + if (((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO) + { + LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice; + PoStartNextPowerIrp(Irp); + IoSkipCurrentIrpStackLocation(Irp); + return PoCallDriver(LowerDevice, Irp); + } + else + { + switch (IoStack->MinorFunction) + { + case IRP_MN_SET_POWER: + case IRP_MN_QUERY_POWER: + Irp->IoStatus.Status = STATUS_SUCCESS; + break; + } + Status = Irp->IoStatus.Status; + PoStartNextPowerIrp(Irp); + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return Status; + } +} + +_Dispatch_type_(IRP_MJ_PNP) static DRIVER_DISPATCH PciIdeXPnpDispatch; static NTSTATUS NTAPI PciIdeXPnpDispatch( @@ -83,6 +119,7 @@ for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++) DriverObject->MajorFunction[i] = PciIdeXForwardOrIgnore; + DriverObject->MajorFunction[IRP_MJ_POWER] = PciIdeXPowerDispatch; DriverObject->MajorFunction[IRP_MJ_PNP] = PciIdeXPnpDispatch; return STATUS_SUCCESS;
8 years, 5 months
1
0
0
0
[ekohl] 71971: [SERVICES] Service logon page: - Handle the interactive service type flag. - Change the service configuration in the apply function.
by ekohl@svn.reactos.org
Author: ekohl Date: Tue Jul 19 21:30:45 2016 New Revision: 71971 URL:
http://svn.reactos.org/svn/reactos?rev=71971&view=rev
Log: [SERVICES] Service logon page: - Handle the interactive service type flag. - Change the service configuration in the apply function. Modified: trunk/reactos/base/applications/mscutils/servman/propsheet_logon.c Modified: trunk/reactos/base/applications/mscutils/servman/propsheet_logon.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
============================================================================== --- trunk/reactos/base/applications/mscutils/servman/propsheet_logon.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/mscutils/servman/propsheet_logon.c [iso-8859-1] Tue Jul 19 21:30:45 2016 @@ -20,6 +20,7 @@ WCHAR szAccountName[64]; WCHAR szPassword1[64]; WCHAR szPassword2[64]; + INT nInteractive; BOOL bInitialized; BOOL bLocalSystem; BOOL bAccountChanged; @@ -43,6 +44,8 @@ if (bLocalSystem) { + SendDlgItemMessageW(hwndDlg, IDC_LOGON_INTERACTIVE, BM_SETCHECK, (WPARAM)pLogonData->nInteractive, 0); + if (pLogonData->bInitialized == TRUE) { GetDlgItemText(hwndDlg, IDC_LOGON_ACCOUNTNAME, pLogonData->szAccountName, 64); @@ -56,6 +59,10 @@ } else { + if (pLogonData->bInitialized == TRUE) + pLogonData->nInteractive = SendDlgItemMessageW(hwndDlg, IDC_LOGON_INTERACTIVE, BM_GETCHECK, 0, 0); + SendDlgItemMessageW(hwndDlg, IDC_LOGON_INTERACTIVE, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0); + SetDlgItemText(hwndDlg, IDC_LOGON_ACCOUNTNAME, pLogonData->szAccountName); SetDlgItemText(hwndDlg, IDC_LOGON_PASSWORD1, pLogonData->szPassword1); SetDlgItemText(hwndDlg, IDC_LOGON_PASSWORD2, pLogonData->szPassword2); @@ -65,10 +72,11 @@ } -#if 0 +static BOOL SetServiceAccount( LPWSTR lpServiceName, + DWORD dwServiceType, LPWSTR lpStartName, LPWSTR lpPassword) { @@ -91,7 +99,7 @@ if (hSc) { if (ChangeServiceConfigW(hSc, - SERVICE_NO_CHANGE, + dwServiceType, SERVICE_NO_CHANGE, SERVICE_NO_CHANGE, NULL, @@ -119,7 +127,6 @@ return bRet; } -#endif static @@ -145,6 +152,7 @@ WCHAR szAccountName[64]; WCHAR szPassword1[64]; WCHAR szPassword2[64]; + DWORD dwServiceType = SERVICE_NO_CHANGE; BOOL bRet = TRUE; if (!pLogonData->bAccountChanged) @@ -156,6 +164,13 @@ wcscpy(szAccountName, L"LocalSystem"); wcscpy(szPassword1, L""); wcscpy(szPassword2, L""); + + /* Handle the interactive flag */ + dwServiceType = pLogonData->pServiceConfig->dwServiceType; + if (SendDlgItemMessageW(hwndDlg, IDC_LOGON_INTERACTIVE, BM_GETCHECK, 0, 0) == BST_CHECKED) + dwServiceType |= SERVICE_INTERACTIVE_PROCESS; + else + dwServiceType &= ~SERVICE_INTERACTIVE_PROCESS; } else { @@ -175,22 +190,23 @@ ResourceMessageBox(GetModuleHandle(NULL), hwndDlg, MB_OK | MB_ICONWARNING, IDS_APPNAME, IDS_INVALID_PASSWORD); return FALSE; } - - - } - -#if 0 + } + + bRet = SetServiceAccount(pLogonData->pService->lpServiceName, + dwServiceType, szAccountName, szPassword1); if (bRet == FALSE) { } -#endif if (bRet == TRUE) + { pLogonData->bAccountChanged = FALSE; + + } return bRet; } @@ -240,13 +256,17 @@ if (pLogonData->pServiceConfig->lpServiceStartName == NULL || _wcsicmp(pLogonData->pServiceConfig->lpServiceStartName, L"LocalSystem") == 0) { - SendMessageW(GetDlgItem(hwndDlg, IDC_LOGON_SYSTEMACCOUNT), BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + SendDlgItemMessageW(hwndDlg, IDC_LOGON_SYSTEMACCOUNT, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + if (pLogonData->pServiceConfig->dwServiceType & SERVICE_INTERACTIVE_PROCESS) { + pLogonData->nInteractive = BST_CHECKED; + SendDlgItemMessageW(hwndDlg, IDC_LOGON_INTERACTIVE, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + } SetControlStates(hwndDlg, pLogonData, TRUE); } else { wcscpy(pLogonData->szAccountName, pLogonData->pServiceConfig->lpServiceStartName); - SendMessageW(GetDlgItem(hwndDlg, IDC_LOGON_THISACCOUNT), BM_SETCHECK, (WPARAM)BST_CHECKED, 0); + SendDlgItemMessageW(hwndDlg, IDC_LOGON_THISACCOUNT, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); SetControlStates(hwndDlg, pLogonData, FALSE); } } @@ -291,6 +311,17 @@ } break; + case IDC_LOGON_INTERACTIVE: + if (HIWORD(wParam) == BN_CLICKED) + { + if (pLogonData->bInitialized && pLogonData->bInitialized) + { + pLogonData->bAccountChanged = TRUE; + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + } + } + break; + case IDC_LOGON_ACCOUNTNAME: case IDC_LOGON_PASSWORD1: case IDC_LOGON_PASSWORD2: @@ -306,7 +337,7 @@ case WM_NOTIFY: switch (((LPNMHDR)lParam)->code) { - case PSN_QUERYINITIALFOCUS : + case PSN_QUERYINITIALFOCUS: return OnQueryInitialFocus(hwndDlg, pLogonData); case PSN_APPLY:
8 years, 5 months
1
0
0
0
[akhaldi] 71970: [KERNEL32_WINETEST] Sync thread tests with Wine Staging 1.9.14 now that Thomas fixed CORE-11511.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Tue Jul 19 18:12:15 2016 New Revision: 71970 URL:
http://svn.reactos.org/svn/reactos?rev=71970&view=rev
Log: [KERNEL32_WINETEST] Sync thread tests with Wine Staging 1.9.14 now that Thomas fixed CORE-11511. Modified: trunk/rostests/winetests/kernel32/thread.c Modified: trunk/rostests/winetests/kernel32/thread.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/kernel32/thread…
============================================================================== --- trunk/rostests/winetests/kernel32/thread.c [iso-8859-1] (original) +++ trunk/rostests/winetests/kernel32/thread.c [iso-8859-1] Tue Jul 19 18:12:15 2016 @@ -102,6 +102,7 @@ static BOOL (WINAPI *pGetThreadGroupAffinity)(HANDLE,GROUP_AFFINITY*); static BOOL (WINAPI *pSetThreadGroupAffinity)(HANDLE,const GROUP_AFFINITY*,GROUP_AFFINITY*); static NTSTATUS (WINAPI *pNtSetInformationThread)(HANDLE,THREADINFOCLASS,LPCVOID,ULONG); +static NTSTATUS (WINAPI *pNtSetLdtEntries)(ULONG,ULONG,ULONG,ULONG,ULONG,ULONG); static HANDLE create_target_process(const char *arg) { @@ -1100,6 +1101,118 @@ CloseHandle( thread ); } +static void test_GetThreadSelectorEntry(void) +{ + TEB *teb = NtCurrentTeb(); + LDT_ENTRY entry; + CONTEXT ctx; + TEB *teb_fs; + DWORD ret; + + memset(&ctx, 0x11, sizeof(ctx)); + ctx.ContextFlags = CONTEXT_SEGMENTS | CONTEXT_CONTROL; + ret = GetThreadContext(GetCurrentThread(), &ctx); + ok(ret, "GetThreadContext error %u\n", GetLastError()); + ok(!HIWORD(ctx.SegCs) && !HIWORD(ctx.SegDs) && !HIWORD(ctx.SegEs) && !HIWORD(ctx.SegFs) && !HIWORD(ctx.SegGs), + "cs %08x, ds %08x, es %08x, fs %08x, gs %08x\n", ctx.SegCs, ctx.SegDs, ctx.SegEs, ctx.SegFs, ctx.SegGs); + + ret = GetThreadSelectorEntry(GetCurrentThread(), ctx.SegCs, &entry); + ok(ret, "GetThreadSelectorEntry(SegCs) error %u\n", GetLastError()); + + ret = GetThreadSelectorEntry(GetCurrentThread(), ctx.SegDs, &entry); + ok(ret, "GetThreadSelectorEntry(SegDs) error %u\n", GetLastError()); + + memset(&entry, 0x11, sizeof(entry)); + ret = GetThreadSelectorEntry(GetCurrentThread(), ctx.SegFs, &entry); + ok(ret, "GetThreadSelectorEntry(SegFs) error %u\n", GetLastError()); + + teb_fs = (TEB *)((entry.HighWord.Bits.BaseHi << 24) | (entry.HighWord.Bits.BaseMid << 16) | entry.BaseLow); + ok(teb_fs == teb, "teb_fs %p != teb %p\n", teb_fs, teb); + + ret = (entry.HighWord.Bits.LimitHi << 16) | entry.LimitLow; + ok(ret == 0x0fff || ret == 0x4000 /* testbot win7u */, "got %#x\n", ret); + + ok(entry.HighWord.Bits.Dpl == 3, "got %#x\n", entry.HighWord.Bits.Dpl); + ok(entry.HighWord.Bits.Sys == 0, "got %#x\n", entry.HighWord.Bits.Sys); + ok(entry.HighWord.Bits.Pres == 1, "got %#x\n", entry.HighWord.Bits.Pres); + ok(entry.HighWord.Bits.Granularity == 0, "got %#x\n", entry.HighWord.Bits.Granularity); + ok(entry.HighWord.Bits.Default_Big == 1, "got %#x\n", entry.HighWord.Bits.Default_Big); + ok(entry.HighWord.Bits.Type == 0x13, "got %#x\n", entry.HighWord.Bits.Type); + ok(entry.HighWord.Bits.Reserved_0 == 0, "got %#x\n", entry.HighWord.Bits.Reserved_0); +} + +static void test_NtSetLdtEntries(void) +{ + THREAD_DESCRIPTOR_INFORMATION tdi; + LDT_ENTRY ds_entry; + CONTEXT ctx; + DWORD ret; + union + { + LDT_ENTRY entry; + DWORD dw[2]; + } sel; + + if (!pNtSetLdtEntries) + { + win_skip("NtSetLdtEntries is not available on this platform\n"); + return; + } + + if (pNtSetLdtEntries(0, 0, 0, 0, 0, 0) == STATUS_NOT_IMPLEMENTED) /* WoW64 */ + { + win_skip("NtSetLdtEntries is not implemented on this platform\n"); + return; + } + + ret = pNtSetLdtEntries(0, 0, 0, 0, 0, 0); + ok(!ret, "NtSetLdtEntries failed: %08x\n", ret); + + ctx.ContextFlags = CONTEXT_SEGMENTS; + ret = GetThreadContext(GetCurrentThread(), &ctx); + ok(ret, "GetThreadContext failed\n"); + + tdi.Selector = ctx.SegDs; + ret = pNtQueryInformationThread(GetCurrentThread(), ThreadDescriptorTableEntry, &tdi, sizeof(tdi), &ret); + ok(!ret, "NtQueryInformationThread failed: %08x\n", ret); + ds_entry = tdi.Entry; + + tdi.Selector = 0x000f; + ret = pNtQueryInformationThread(GetCurrentThread(), ThreadDescriptorTableEntry, &tdi, sizeof(tdi), &ret); + ok(ret == STATUS_ACCESS_VIOLATION, "got %08x\n", ret); + + tdi.Selector = 0x001f; + ret = pNtQueryInformationThread(GetCurrentThread(), ThreadDescriptorTableEntry, &tdi, sizeof(tdi), &ret); + ok(ret == STATUS_ACCESS_VIOLATION, "NtQueryInformationThread returned %08x\n", ret); + + ret = GetThreadSelectorEntry(GetCurrentThread(), 0x000f, &sel.entry); + ok(!ret, "GetThreadSelectorEntry should fail\n"); + + ret = GetThreadSelectorEntry(GetCurrentThread(), 0x001f, &sel.entry); + ok(!ret, "GetThreadSelectorEntry should fail\n"); + + memset(&sel.entry, 0x9a, sizeof(sel.entry)); + ret = GetThreadSelectorEntry(GetCurrentThread(), ctx.SegDs, &sel.entry); + ok(ret, "GetThreadSelectorEntry failed\n"); + ok(!memcmp(&ds_entry, &sel.entry, sizeof(ds_entry)), "entries do not match\n"); + + ret = pNtSetLdtEntries(0x000f, sel.dw[0], sel.dw[1], 0x001f, sel.dw[0], sel.dw[1]); + ok(!ret || broken(ret == STATUS_INVALID_LDT_DESCRIPTOR) /*XP*/, "NtSetLdtEntries failed: %08x\n", ret); + + if (!ret) + { + memset(&sel.entry, 0x9a, sizeof(sel.entry)); + ret = GetThreadSelectorEntry(GetCurrentThread(), 0x000f, &sel.entry); + ok(ret, "GetThreadSelectorEntry failed\n"); + ok(!memcmp(&ds_entry, &sel.entry, sizeof(ds_entry)), "entries do not match\n"); + + memset(&sel.entry, 0x9a, sizeof(sel.entry)); + ret = GetThreadSelectorEntry(GetCurrentThread(), 0x001f, &sel.entry); + ok(ret, "GetThreadSelectorEntry failed\n"); + ok(!memcmp(&ds_entry, &sel.entry, sizeof(ds_entry)), "entries do not match\n"); + } +} + #endif /* __i386__ */ static HANDLE finish_event; @@ -1644,7 +1757,7 @@ handle = (void*)0xdeadbeef; b = pGetCurrentActCtx(&handle); - ok(b, "GetCurentActCtx failed: %u\n", GetLastError()); + ok(b, "GetCurrentActCtx failed: %u\n", GetLastError()); ok(handle == 0, "active context %p\n", handle); /* without active context */ @@ -1663,7 +1776,7 @@ handle = 0; b = pGetCurrentActCtx(&handle); - ok(b, "GetCurentActCtx failed: %u\n", GetLastError()); + ok(b, "GetCurrentActCtx failed: %u\n", GetLastError()); ok(handle != 0, "no active context\n"); pReleaseActCtx(handle); @@ -1913,6 +2026,7 @@ X(NtQueryInformationThread); X(RtlGetThreadErrorMode); X(NtSetInformationThread); + X(NtSetLdtEntries); } #undef X } @@ -1965,6 +2079,8 @@ test_GetThreadExitCode(); #ifdef __i386__ test_SetThreadContext(); + test_GetThreadSelectorEntry(); + test_NtSetLdtEntries(); #endif test_QueueUserWorkItem(); test_RegisterWaitForSingleObject();
8 years, 5 months
1
0
0
0
[apriyadarshi] 71969: Implemented Dpc Routine, managed Srb functions and some code fixes!
by apriyadarshi@svn.reactos.org
Author: apriyadarshi Date: Tue Jul 19 16:50:59 2016 New Revision: 71969 URL:
http://svn.reactos.org/svn/reactos?rev=71969&view=rev
Log: Implemented Dpc Routine, managed Srb functions and some code fixes! Modified: branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.c branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.h Modified: branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/AHCI/drivers/storage/…
============================================================================== --- branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.c [iso-8859-1] (original) +++ branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.c [iso-8859-1] Tue Jul 19 16:50:59 2016 @@ -132,6 +132,7 @@ PCHAR nonCachedExtension, tmp; ULONG index, NCS, AlignedNCS; ULONG portCount, portImplemented, nonCachedExtensionSize; + PAHCI_PORT_EXTENSION PortExtension; DebugPrint("AhciAllocateResourceForAdapter()\n"); @@ -173,18 +174,21 @@ for (index = 0; index < portCount; index++) { - AdapterExtension->PortExtension[index].IsActive = FALSE; + PortExtension = &AdapterExtension->PortExtension[index]; + + PortExtension->DeviceParams.IsActive = FALSE; if ((AdapterExtension->PortImplemented & (1 << index)) != 0) { - AdapterExtension->PortExtension[index].PortNumber = index; - AdapterExtension->PortExtension[index].IsActive = TRUE; - AdapterExtension->PortExtension[index].AdapterExtension = AdapterExtension; - AdapterExtension->PortExtension[index].CommandList = (PAHCI_COMMAND_HEADER)nonCachedExtension; + PortExtension->PortNumber = index; + PortExtension->DeviceParams.IsActive = TRUE; + PortExtension->AdapterExtension = AdapterExtension; + PortExtension->CommandList = (PAHCI_COMMAND_HEADER)nonCachedExtension; tmp = (PCHAR)(nonCachedExtension + sizeof(AHCI_COMMAND_HEADER) * AlignedNCS); - AdapterExtension->PortExtension[index].ReceivedFIS = (PAHCI_RECEIVED_FIS)tmp; - AdapterExtension->PortExtension[index].IdentifyDeviceData = (PIDENTIFY_DEVICE_DATA)(tmp + sizeof(AHCI_RECEIVED_FIS)); + PortExtension->ReceivedFIS = (PAHCI_RECEIVED_FIS)tmp; + PortExtension->IdentifyDeviceData = (PIDENTIFY_DEVICE_DATA)(tmp + sizeof(AHCI_RECEIVED_FIS)); + PortExtension->MaxPortQueueDepth = NCS; nonCachedExtension += nonCachedExtensionSize; } } @@ -272,13 +276,6 @@ ssts.Status = StorPortReadRegisterUlong(AdapterExtension, &PortExtension->Port->SSTS); switch (ssts.DET) { - case 0x0: - case 0x1: - case 0x2: - default: - // unhandled case - DebugPrint("\tDET == %x Unsupported\n", ssts.DET); - return FALSE; case 0x3: { NT_ASSERT(cmd.ST == 0); @@ -299,6 +296,7 @@ { // failed to start FIS DMA engine // it can crash the driver later + // so better to turn this port off return FALSE; } @@ -325,30 +323,51 @@ // set IE ie.Status = StorPortReadRegisterUlong(AdapterExtension, &PortExtension->Port->IE); + /* Device to Host Register FIS Interrupt Enable */ ie.DHRE = 1; + /* PIO Setup FIS Interrupt Enable */ ie.PSE = 1; + /* DMA Setup FIS Interrupt Enable */ ie.DSE = 1; + /* Set Device Bits FIS Interrupt Enable */ ie.SDBE = 1; - + /* Unknown FIS Interrupt Enable */ ie.UFE = 0; + /* Descriptor Processed Interrupt Enable */ ie.DPE = 0; + /* Port Change Interrupt Enable */ ie.PCE = 1; - + /* Device Mechanical Presence Enable */ ie.DMPE = 0; - + /* PhyRdy Change Interrupt Enable */ ie.PRCE = 1; + /* Incorrect Port Multiplier Enable */ ie.IPME = 0; + /* Overflow Enable */ ie.OFE = 1; + /* Interface Non-fatal Error Enable */ ie.INFE = 1; + /* Interface Fatal Error Enable */ ie.IFE = 1; + /* Host Bus Data Error Enable */ ie.HBDE = 1; + /* Host Bus Fatal Error Enable */ ie.HBFE = 1; + /* Task File Error Enable */ ie.TFEE = 1; cmd.Status = StorPortReadRegisterUlong(AdapterExtension, &PortExtension->Port->CMD); - ie.CPDE = cmd.CPD; - - StorPortReadRegisterUlong(AdapterExtension, &PortExtension->Port->IE, ie.Status); + /* Cold Presence Detect Enable */ + if (cmd.CPD) // does it support CPD? + { + // disable it for now + ie.CPDE = 0; + } + + // should I replace this to single line? + // by directly setting ie.Status? + + StorPortWriteRegisterUlong(AdapterExtension, &PortExtension->Port->IE, ie.Status); cmd.ST = 1; StorPortWriteRegisterUlong(AdapterExtension, &PortExtension->Port->CMD, cmd.Status); @@ -362,20 +381,78 @@ return TRUE; } - case 0x4: - // no device found + default: + // unhandled case + DebugPrint("\tDET == %x Unsupported\n", ssts.DET); return FALSE; } - DebugPrint("\tInvalid DET value: %x\n", ssts.DET); - return FALSE; }// -- AhciStartPort(); /** - * @name AhciHwInitialize - * @implemented - * - * initializes the HBA and finds all devices that are of interest to the miniport driver. + * @name AhciCommandCompletionDpcRoutine + * @implemented + * + * Handles Completed Commands + * + * @param Dpc + * @param AdapterExtension + * @param SystemArgument1 + * @param SystemArgument2 + */ +VOID +AhciCommandCompletionDpcRoutine ( + __in PSTOR_DPC Dpc, + __in PAHCI_ADAPTER_EXTENSION AdapterExtension, + __in PAHCI_PORT_EXTENSION PortExtension, + __in PVOID SystemArgument2 + ) +{ + PSCSI_REQUEST_BLOCK Srb; + STOR_LOCK_HANDLE lockhandle; + PAHCI_SRB_EXTENSION SrbExtension; + PAHCI_COMPLETION_ROUTINE CompletionRoutine; + + UNREFERENCED_PARAMETER(Dpc); + UNREFERENCED_PARAMETER(SystemArgument2); + + DebugPrint("AhciCommandCompletionDpcRoutine()\n"); + + AhciZeroMemory(&lockhandle, sizeof(lockhandle)); + + StorPortAcquireSpinLock(AdapterExtension, InterruptLock, NULL, &lockhandle); + Srb = RemoveQueue(&PortExtension->CompletionQueue); + + NT_ASSERT(Srb != NULL); + + if (Srb->SrbStatus == SRB_STATUS_PENDING) + { + Srb->SrbStatus = SRB_STATUS_SUCCESS; + } + + SrbExtension = GetSrbExtension(Srb); + CompletionRoutine = SrbExtension->CompletionRoutine; + + if (CompletionRoutine != NULL) + { + // now it's completion routine responsibility to set SrbStatus + CompletionRoutine(PortExtension, Srb); + } + else + { + Srb->SrbStatus = SRB_STATUS_SUCCESS; + StorPortNotification(RequestComplete, AdapterExtension, Srb); + } + + StorPortReleaseSpinLock(AdapterExtension, &lockhandle); + return; +}// -- AhciCommandCompletionDpcRoutine(); + +/** + * @name AhciHwPassiveInitialize + * @implemented + * + * initializes the HBA and finds all devices that are of interest to the miniport driver. (at PASSIVE LEVEL) * * @param adapterExtension * @@ -383,40 +460,65 @@ * return TRUE if intialization was successful */ BOOLEAN +AhciHwPassiveInitialize ( + __in PAHCI_ADAPTER_EXTENSION AdapterExtension + ) +{ + ULONG index; + PAHCI_PORT_EXTENSION PortExtension; + + DebugPrint("AhciHwPassiveInitialize()\n"); + + for (index = 0; index < AdapterExtension->PortCount; index++) + { + if ((AdapterExtension->PortImplemented & (0x1 << index)) != 0) + { + PortExtension = &AdapterExtension->PortExtension[index]; + PortExtension->DeviceParams.IsActive = AhciStartPort(PortExtension); + StorPortInitializeDpc(AdapterExtension, &PortExtension->CommandCompletion, AhciCommandCompletionDpcRoutine); + } + } + + return TRUE; +}// -- AhciHwPassiveInitialize(); + +/** + * @name AhciHwInitialize + * @implemented + * + * initializes the HBA and finds all devices that are of interest to the miniport driver. + * + * @param adapterExtension + * + * @return + * return TRUE if intialization was successful + */ +BOOLEAN AhciHwInitialize ( - __in PVOID AdapterExtension - ) -{ - ULONG ghc, index; - PAHCI_PORT_EXTENSION PortExtension; - PAHCI_ADAPTER_EXTENSION adapterExtension; + __in PAHCI_ADAPTER_EXTENSION AdapterExtension + ) +{ + AHCI_GHC ghc; + MESSAGE_INTERRUPT_INFORMATION messageInfo; DebugPrint("AhciHwInitialize()\n"); - adapterExtension = AdapterExtension; - adapterExtension->StateFlags.MessagePerPort = FALSE; + AdapterExtension->StateFlags.MessagePerPort = FALSE; // First check what type of interrupt/synchronization device is using - ghc = StorPortReadRegisterUlong(adapterExtension, &adapterExtension->ABAR_Address->GHC); + ghc.Status = StorPortReadRegisterUlong(AdapterExtension, &AdapterExtension->ABAR_Address->GHC); // When set to â1â by hardware, indicates that the HBA requested more than one MSI vector // but has reverted to using the first vector only. When this bit is cleared to â0â, // the HBA has not reverted to single MSI mode (i.e. hardware is already in single MSI mode, // software has allocated the number of messages requested - if ((ghc & AHCI_Global_HBA_CONTROL_MRSM) == 0) - { - adapterExtension->StateFlags.MessagePerPort = TRUE; + if (ghc.MRSM == 0) + { + AdapterExtension->StateFlags.MessagePerPort = TRUE; DebugPrint("\tMultiple MSI based message not supported\n"); } - for (index = 0; index < adapterExtension->PortCount; index++) - { - if ((adapterExtension->PortImplemented & (0x1 << index)) != 0) - { - PortExtension = &adapterExtension->PortExtension[index]; - PortExtension->IsActive = AhciStartPort(PortExtension); - } - } + StorPortEnablePassiveInitialization(AdapterExtension, AhciHwPassiveInitialize); return TRUE; }// -- AhciHwInitialize(); @@ -438,9 +540,7 @@ { ULONG NCS, i; PSCSI_REQUEST_BLOCK Srb; - PAHCI_SRB_EXTENSION SrbExtension; PAHCI_ADAPTER_EXTENSION AdapterExtension; - PAHCI_COMPLETION_ROUTINE CompletionRoutine; DebugPrint("AhciCompleteIssuedSrb()\n"); @@ -458,24 +558,8 @@ Srb = PortExtension->Slot[i]; NT_ASSERT(Srb != NULL); - if (Srb->SrbStatus == SRB_STATUS_PENDING) - { - Srb->SrbStatus = SRB_STATUS_SUCCESS; - } - - SrbExtension = GetSrbExtension(Srb); - CompletionRoutine = SrbExtension->CompletionRoutine; - - if (CompletionRoutine != NULL) - { - // now it's completion routine responsibility to set SrbStatus - CompletionRoutine(AdapterExtension, PortExtension, Srb); - } - else - { - Srb->SrbStatus = SRB_STATUS_SUCCESS; - StorPortNotification(RequestComplete, AdapterExtension, Srb); - } + AddQueue(&PortExtension->CompletionQueue, Srb); + StorPortIssueDpc(AdapterExtension, &PortExtension->CommandCompletion, PortExtension, Srb); } } @@ -589,23 +673,21 @@ * return FALSE Indicates the interrupt was not ours. */ BOOLEAN -AhciHwInterrupt( +AhciHwInterrupt ( __in PAHCI_ADAPTER_EXTENSION AdapterExtension ) { ULONG portPending, nextPort, i, portCount; - DebugPrint("AhciHwInterrupt()\n"); - if (AdapterExtension->StateFlags.Removed) { return FALSE; } portPending = StorPortReadRegisterUlong(AdapterExtension, AdapterExtension->IS); + // we process interrupt for implemented ports only portCount = AdapterExtension->PortCount; - DebugPrint("\tPortPending: %d\n", portPending); portPending = portPending & AdapterExtension->PortImplemented; if (portPending == 0) @@ -616,18 +698,12 @@ for (i = 1; i <= portCount; i++) { nextPort = (AdapterExtension->LastInterruptPort + i) % portCount; - if ((portPending & (0x1 << nextPort)) == 0) continue; NT_ASSERT(IsPortValid(AdapterExtension, nextPort)); - if (nextPort == AdapterExtension->LastInterruptPort) - { - return FALSE; - } - - if (AdapterExtension->PortExtension[nextPort].IsActive == FALSE) + if (AdapterExtension->PortExtension[nextPort].DeviceParams.IsActive == FALSE) { continue; } @@ -635,6 +711,8 @@ // we can assign this interrupt to this port AdapterExtension->LastInterruptPort = nextPort; AhciInterruptHandler(&AdapterExtension->PortExtension[nextPort]); + + portPending &= ~(1 << nextPort); // interrupt belongs to this device // should always return TRUE @@ -672,6 +750,8 @@ pathId = Srb->PathId; function = Srb->Function; adapterExtension = AdapterExtension; + + DebugPrint("\tFunction: %x\n", function); if (!IsPortValid(adapterExtension, pathId)) { @@ -714,6 +794,7 @@ if (function == SRB_FUNCTION_EXECUTE_SCSI) { + DebugPrint("\tSRB_FUNCTION_EXECUTE_SCSI\n"); //
https://msdn.microsoft.com/en-us/windows/hardware/drivers/storage/handling-…
// On receipt of an SRB_FUNCTION_EXECUTE_SCSI request, a miniport driver's HwScsiStartIo // routine does the following: @@ -732,13 +813,22 @@ if (Srb->CdbLength > 0) { PCDB cdb = (PCDB)&Srb->Cdb; - if (cdb->CDB10.OperationCode == SCSIOP_INQUIRY) + NT_ASSERT(cdb != NULL); + + switch(cdb->CDB10.OperationCode) { - Srb->SrbStatus = DeviceInquiryRequest(adapterExtension, Srb, cdb); - } - else - { - Srb->SrbStatus = SRB_STATUS_NO_DEVICE; + case SCSIOP_INQUIRY: + Srb->SrbStatus = DeviceInquiryRequest(adapterExtension, Srb, cdb, TRUE); + break; + case SCSIOP_REPORT_LUNS: + Srb->SrbStatus = DeviceInquiryRequest(adapterExtension, Srb, cdb, FALSE); + break; + default: + { + DebugPrint("\tOperationCode: %d\n", cdb->CDB10.OperationCode); + Srb->SrbStatus = SRB_STATUS_NO_DEVICE; + } + break; } } else @@ -751,7 +841,7 @@ } DebugPrint("\tUnknown function code recieved: %x\n", function); - Srb->SrbStatus = SRB_STATUS_BAD_FUNCTION; + Srb->SrbStatus = SRB_STATUS_INVALID_REQUEST; StorPortNotification(RequestComplete, adapterExtension, Srb); return TRUE; }// -- AhciHwStartIo(); @@ -839,9 +929,10 @@ __in PBOOLEAN Reserved3 ) { - ULONG ghc, index, pci_cfg_len; + AHCI_GHC ghc; + ULONG index, pci_cfg_len; + PACCESS_RANGE accessRange; UCHAR pci_cfg_buf[sizeof(PCI_COMMON_CONFIG)]; - PACCESS_RANGE accessRange; PAHCI_MEMORY_REGISTERS abar; PPCI_COMMON_CONFIG pciConfigData; @@ -919,9 +1010,9 @@ // 10.1.2 // 1. Indicate that system software is AHCI aware by setting GHC.AE to â1â. // 3.1.2 -- AE bit is read-write only if CAP.SAM is '0' - ghc = StorPortReadRegisterUlong(adapterExtension, &abar->GHC); + ghc.Status = StorPortReadRegisterUlong(adapterExtension, &abar->GHC); // AE := Highest Significant bit of GHC - if ((ghc & AHCI_Global_HBA_CONTROL_AE) != 0)// Hmm, controller was already in power state + if (ghc.AE != 0)// Hmm, controller was already in power state { // reset controller to have it in known state DebugPrint("\tAE Already set, Reset()\n"); @@ -932,9 +1023,10 @@ } } - ghc = AHCI_Global_HBA_CONTROL_AE;// only AE=1 + ghc.Status = 0; + ghc.AE = 1;// only AE=1 // tell the controller that we know about AHCI - StorPortWriteRegisterUlong(adapterExtension, &abar->GHC, ghc); + StorPortWriteRegisterUlong(adapterExtension, &abar->GHC, ghc.Status); adapterExtension->IS = &abar->IS; adapterExtension->PortImplemented = StorPortReadRegisterUlong(adapterExtension, &abar->PI); @@ -954,6 +1046,11 @@ ConfigInfo->SynchronizationModel = StorSynchronizeFullDuplex; ConfigInfo->ScatterGather = TRUE; + // Turn IE -- Interrupt Enabled + ghc.Status = StorPortReadRegisterUlong(adapterExtension, &abar->GHC); + ghc.IE = 1; + StorPortWriteRegisterUlong(adapterExtension, &abar->GHC, ghc.Status); + // allocate necessary resource for each port if (!AhciAllocateResourceForAdapter(adapterExtension, ConfigInfo)) { @@ -966,11 +1063,6 @@ if ((adapterExtension->PortImplemented & (0x1 << index)) != 0) AhciPortInitialize(&adapterExtension->PortExtension[index]); } - - // Turn IE -- Interrupt Enabled - ghc = StorPortReadRegisterUlong(adapterExtension, &abar->GHC); - ghc |= AHCI_Global_HBA_CONTROL_IE; - StorPortWriteRegisterUlong(adapterExtension, &abar->GHC, ghc); return SP_RETURN_FOUND; }// -- AhciHwFindAdapter(); @@ -1044,8 +1136,10 @@ * @param PortExtension * @param Srb * - */ -VOID + * @return + * Number of CFIS fields used in DWORD + */ +ULONG AhciATA_CFIS ( __in PAHCI_PORT_EXTENSION PortExtension, __in PAHCI_SRB_EXTENSION SrbExtension @@ -1059,12 +1153,10 @@ cmdTable = (PAHCI_COMMAND_TABLE)SrbExtension; - NT_ASSERT(sizeof(cmdTable->CFIS) == 64); - AhciZeroMemory(&cmdTable->CFIS, sizeof(cmdTable->CFIS)); - cmdTable->CFIS[AHCI_ATA_CFIS_FisType] = 0x27; // FIS Type - cmdTable->CFIS[AHCI_ATA_CFIS_PMPort_C] = (1 << 7); // PM Port & C + cmdTable->CFIS[AHCI_ATA_CFIS_FisType] = FIS_TYPE_REG_H2D; // FIS Type + cmdTable->CFIS[AHCI_ATA_CFIS_PMPort_C] = (1 << 7); // PM Port & C cmdTable->CFIS[AHCI_ATA_CFIS_CommandReg] = SrbExtension->CommandReg; cmdTable->CFIS[AHCI_ATA_CFIS_FeaturesLow] = SrbExtension->FeaturesLow; @@ -1079,7 +1171,7 @@ cmdTable->CFIS[AHCI_ATA_CFIS_SectorCountLow] = SrbExtension->SectorCountLow; cmdTable->CFIS[AHCI_ATA_CFIS_SectorCountHigh] = SrbExtension->SectorCountHigh; - return; + return 5; }// -- AhciATA_CFIS(); /** @@ -1091,8 +1183,10 @@ * @param PortExtension * @param Srb * - */ -VOID + * @return + * Number of CFIS fields used in DWORD + */ +ULONG AhciATAPI_CFIS ( __in PAHCI_PORT_EXTENSION PortExtension, __in PAHCI_SRB_EXTENSION SrbExtension @@ -1103,7 +1197,7 @@ DebugPrint("AhciATAPI_CFIS()\n"); - return; + return 2; }// -- AhciATAPI_CFIS(); /** @@ -1147,6 +1241,11 @@ { cmdTable->PRDT[index].DBAU = sgl->List[index].PhysicalAddress.HighPart; } + + // Data Byte Count (DBC): A â0â based value that Indicates the length, in bytes, of the data block. + // A maximum of length of 4MB may exist for any entry. Bit â0â of this field must always be â1â to + // indicate an even byte count. A value of â1â indicates 2 bytes, â3â indicates 4 bytes, etc. + cmdTable->PRDT[index].DBC = sgl->List[index].Length - 1; } return sgl->NumberOfElements; @@ -1170,7 +1269,7 @@ __in ULONG SlotIndex ) { - ULONG prdtlen, sig, length; + ULONG prdtlen, sig, length, cfl; PAHCI_SRB_EXTENSION SrbExtension; PAHCI_COMMAND_HEADER CommandHeader; PAHCI_ADAPTER_EXTENSION AdapterExtension; @@ -1193,10 +1292,12 @@ sig = StorPortReadRegisterUlong(AdapterExtension, &PortExtension->Port->SIG); if (sig == 0x101) { + DebugPrint("\tATA Device Found!\n"); SrbExtension->CommandReg = IDE_COMMAND_IDENTIFY; } else { + DebugPrint("\tATAPI Device Found!\n"); SrbExtension->CommandReg = IDE_COMMAND_ATAPI_IDENTIFY; } } @@ -1207,13 +1308,14 @@ // program the CFIS in the CommandTable CommandHeader = &PortExtension->CommandList[SlotIndex]; + cfl = 0; if (IsAtaCommand(SrbExtension->AtaFunction)) { - AhciATA_CFIS(PortExtension, SrbExtension); + cfl = AhciATA_CFIS(PortExtension, SrbExtension); } else if (IsAtapiCommand(SrbExtension->AtaFunction)) { - AhciATAPI_CFIS(PortExtension, SrbExtension); + cfl = AhciATAPI_CFIS(PortExtension, SrbExtension); } prdtlen = 0; @@ -1225,7 +1327,8 @@ // Program the command header CommandHeader->DI.PRDTL = prdtlen; // number of entries in PRD table - CommandHeader->DI.CFL = 5; + CommandHeader->DI.CFL = cfl; + CommandHeader->DI.A = (SrbExtension->AtaFunction & ATA_FUNCTION_ATAPI_COMMAND) ? 1 : 0; CommandHeader->DI.W = (SrbExtension->Flags & ATA_FLAGS_DATA_OUT) ? 1 : 0; CommandHeader->DI.P = 0; // ATA Specifications says so CommandHeader->DI.PMP = 0; // Port Multiplier @@ -1243,21 +1346,21 @@ CommandHeader->Reserved[3] = 0; // set CommandHeader CTBA - // I am really not sure if SrbExtension is 128 byte aligned or not - // Command FIS will not work if it is not so. CommandTablePhysicalAddress = StorPortGetPhysicalAddress(AdapterExtension, NULL, SrbExtension, &length); + NT_ASSERT(length != 0); + // command table alignment NT_ASSERT((CommandTablePhysicalAddress.LowPart % 128) == 0); - CommandHeader->CTBA0 = CommandTablePhysicalAddress.LowPart; + CommandHeader->CTBA = CommandTablePhysicalAddress.LowPart; if (IsAdapterCAPS64(AdapterExtension->CAP)) { - CommandHeader->CTBA_U0 = CommandTablePhysicalAddress.HighPart; + CommandHeader->CTBA_U = CommandTablePhysicalAddress.HighPart; } // mark this slot @@ -1281,6 +1384,7 @@ ) { AHCI_PORT_CMD cmd; + ULONG sact, ci; ULONG QueueSlots, slotToActivate, tmp; PAHCI_ADAPTER_EXTENSION AdapterExtension; @@ -1290,7 +1394,9 @@ QueueSlots = PortExtension->QueueSlots; if (QueueSlots == 0) + { return; + } // section 3.3.14 // Bits in this field shall only be set to â1â by software when PxCMD.ST is set to â1â @@ -1300,6 +1406,9 @@ { return; } + + sact = StorPortReadRegisterUlong(AdapterExtension, &PortExtension->Port->SACT); + ci = StorPortReadRegisterUlong(AdapterExtension, &PortExtension->Port->CI); // get the lowest set bit tmp = QueueSlots & (QueueSlots - 1); @@ -1316,8 +1425,6 @@ // to validate in completeIssuedCommand PortExtension->CommandIssuedSlots |= slotToActivate; - DebugPrint("\tslotToActivate: %d\n", slotToActivate); - // tell the HBA to issue this Command Slot to the given port StorPortWriteRegisterUlong(AdapterExtension, &PortExtension->Port->CI, slotToActivate); @@ -1355,16 +1462,20 @@ NT_ASSERT(PathId < AdapterExtension->PortCount); + AhciZeroMemory(&lockhandle, sizeof(lockhandle)); + + // Acquire Lock + StorPortAcquireSpinLock(AdapterExtension, InterruptLock, NULL, &lockhandle); + // add Srb to queue AddQueue(&PortExtension->SrbQueue, Srb); - if (PortExtension->IsActive == FALSE) + if (PortExtension->DeviceParams.IsActive == FALSE) + { + // Release Lock + StorPortReleaseSpinLock(AdapterExtension, &lockhandle); return; // we should wait for device to get active - - AhciZeroMemory(&lockhandle, sizeof(lockhandle)); - - // Acquire Lock - StorPortAcquireSpinLock(AdapterExtension, InterruptLock, NULL, &lockhandle); + } occupiedSlots = (PortExtension->QueueSlots | PortExtension->CommandIssuedSlots); // Busy command slots for given port NCS = AHCI_Global_Port_CAP_NCS(AdapterExtension->CAP); @@ -1419,44 +1530,105 @@ */ VOID InquiryCompletion ( - __in PAHCI_ADAPTER_EXTENSION AdapterExtension, __in PAHCI_PORT_EXTENSION PortExtension, __in PSCSI_REQUEST_BLOCK Srb ) { - ULONG SrbStatus; + PCDB cdb; + PLUN_LIST LunList; PAHCI_SRB_EXTENSION SrbExtension; + PIDENTIFY_DEVICE_DATA IdentifyDeviceData; + ULONG SrbStatus, LunCount, DataBufferLength; DebugPrint("InquiryCompletion()\n"); NT_ASSERT(PortExtension != NULL); NT_ASSERT(Srb != NULL); + cdb = (PCDB)&Srb->Cdb; SrbStatus = Srb->SrbStatus; SrbExtension = GetSrbExtension(Srb); if (SrbStatus == SRB_STATUS_SUCCESS) { + IdentifyDeviceData = PortExtension->IdentifyDeviceData; + if (SrbExtension->CommandReg == IDE_COMMAND_IDENTIFY) { DebugPrint("Device: ATA\n"); - AdapterExtension->DeviceParams.DeviceType = AHCI_DEVICE_TYPE_ATA; + PortExtension->DeviceParams.DeviceType = AHCI_DEVICE_TYPE_ATA; + if (IdentifyDeviceData->GeneralConfiguration.RemovableMedia) + { + PortExtension->DeviceParams.RemovableDevice = 1; + } + + if (IdentifyDeviceData->CommandSetSupport.BigLba && IdentifyDeviceData->CommandSetActive.BigLba) + { + PortExtension->DeviceParams.Lba48BitMode = 1; + } + + PortExtension->DeviceParams.AccessType = DIRECT_ACCESS_DEVICE; + + // TODO: Add other device params } else { DebugPrint("Device: ATAPI\n"); - AdapterExtension->DeviceParams.DeviceType = AHCI_DEVICE_TYPE_ATAPI; - } - // TODO: Set Device Paramters + PortExtension->DeviceParams.DeviceType = AHCI_DEVICE_TYPE_ATAPI; + + PortExtension->DeviceParams.AccessType = READ_ONLY_DIRECT_ACCESS_DEVICE; + } } else if (SrbStatus == SRB_STATUS_NO_DEVICE) { DebugPrint("Device: No Device\n"); - AdapterExtension->DeviceParams.DeviceType = AHCI_DEVICE_TYPE_NODEVICE; + PortExtension->DeviceParams.DeviceType = AHCI_DEVICE_TYPE_NODEVICE; } else { return; + } + + if ((cdb != NULL) && (cdb->CDB10.OperationCode == SCSIOP_REPORT_LUNS)) + { + Srb->SrbStatus = SRB_STATUS_SUCCESS; + Srb->ScsiStatus = SCSISTAT_GOOD; + + SrbExtension->AtaFunction = 0; + DataBufferLength = Srb->DataTransferLength; + + LunList = (PLUN_LIST)Srb->DataBuffer; + if (PortExtension->DeviceParams.DeviceType == AHCI_DEVICE_TYPE_NODEVICE) + { + LunCount = 0; + } + else + { + LunCount = 1; + } + + if (DataBufferLength < sizeof(LUN_LIST)) + { + DebugPrint("\tSRB_STATUS_DATA_OVERRUN\n"); + Srb->SrbStatus = SRB_STATUS_DATA_OVERRUN; + } + else + { + LunList->LunListLength[0] = 0; + LunList->LunListLength[1] = 0; + LunList->LunListLength[2] = 0; + LunList->LunListLength[3] = 8; + + // followed by 8 entries + LunList->Lun[0][0] = 0; + LunList->Lun[0][1] = 0; + LunList->Lun[0][2] = 0; + LunList->Lun[0][3] = 0; + LunList->Lun[0][4] = 0; + LunList->Lun[0][5] = 0; + LunList->Lun[0][6] = 0; + LunList->Lun[0][7] = 0; + } } return; @@ -1482,13 +1654,15 @@ DeviceInquiryRequest ( __in PAHCI_ADAPTER_EXTENSION AdapterExtension, __in PSCSI_REQUEST_BLOCK Srb, - __in PCDB Cdb + __in PCDB Cdb, + __in BOOLEAN HasProductDataRequest ) { PVOID DataBuffer; - ULONG DataBufferLength; PAHCI_PORT_EXTENSION PortExtension; PAHCI_SRB_EXTENSION SrbExtension; + PVPD_SUPPORTED_PAGES_PAGE VpdOutputBuffer; + ULONG DataBufferLength, RequiredDataBufferLength; DebugPrint("DeviceInquiryRequest()\n"); @@ -1497,10 +1671,14 @@ SrbExtension = GetSrbExtension(Srb); PortExtension = &AdapterExtension->PortExtension[Srb->PathId]; - // 3.6.1 - // If the EVPD bit is set to zero, the device server shall return the standard INQUIRY data - if (Cdb->CDB6INQUIRY3.EnableVitalProductData == 0) - { + if (Srb->Lun != 0) + { + return SRB_STATUS_SELECTION_TIMEOUT; + } + else if ((HasProductDataRequest == FALSE) || (Cdb->CDB6INQUIRY3.EnableVitalProductData == 0)) + { + // 3.6.1 + // If the EVPD bit is set to zero, the device server shall return the standard INQUIRY data DebugPrint("\tEVPD Inquired\n"); NT_ASSERT(SrbExtension != NULL); @@ -1514,7 +1692,7 @@ SrbExtension->LBA0 = 0; SrbExtension->LBA1 = 0; SrbExtension->LBA2 = 0; - SrbExtension->Device = 0; + SrbExtension->Device = 0xA0; SrbExtension->LBA3 = 0; SrbExtension->LBA4 = 0; SrbExtension->LBA5 = 0; @@ -1526,8 +1704,11 @@ SrbExtension->Sgl.List[0].PhysicalAddress.LowPart = PortExtension->IdentifyDeviceDataPhysicalAddress.LowPart; SrbExtension->Sgl.List[0].PhysicalAddress.HighPart = PortExtension->IdentifyDeviceDataPhysicalAddress.HighPart; SrbExtension->Sgl.List[0].Length = sizeof(IDENTIFY_DEVICE_DATA); - } - else + + AhciProcessIO(AdapterExtension, Srb->PathId, Srb); + return SRB_STATUS_PENDING; + } + else if (HasProductDataRequest == TRUE) { DebugPrint("\tVPD Inquired\n"); @@ -1541,12 +1722,37 @@ AhciZeroMemory(DataBuffer, DataBufferLength); - // not supported - return SRB_STATUS_BAD_FUNCTION; - } - - AhciProcessIO(AdapterExtension, Srb->PathId, Srb); - return SRB_STATUS_PENDING; + switch(Cdb->CDB6INQUIRY3.PageCode) + { + case VPD_SUPPORTED_PAGES: + { + DebugPrint("\tVPD_SUPPORTED_PAGES\n"); + RequiredDataBufferLength = sizeof(VPD_SUPPORTED_PAGES_PAGE); + if (DataBufferLength < RequiredDataBufferLength) + { + DebugPrint("\tDataBufferLength: %d Required: %d\n", DataBufferLength, RequiredDataBufferLength); + return SRB_STATUS_INVALID_REQUEST; + } + else + { + VpdOutputBuffer = (PVPD_SUPPORTED_PAGES_PAGE)DataBuffer; + VpdOutputBuffer->DeviceType = PortExtension->DeviceParams.DeviceType; + VpdOutputBuffer->DeviceTypeQualifier = 0; + VpdOutputBuffer->PageCode = VPD_SUPPORTED_PAGES; + VpdOutputBuffer->PageLength = 1; + VpdOutputBuffer->SupportedPageList[0] = VPD_SUPPORTED_PAGES; + + return SRB_STATUS_SUCCESS; + } + } + break; + default: + DebugPrint("\tPageCode: %x\n", Cdb->CDB6INQUIRY3.PageCode); + break; + } + } + + return SRB_STATUS_INVALID_REQUEST; }// -- DeviceInquiryRequest(); /** @@ -1573,7 +1779,8 @@ __in PAHCI_ADAPTER_EXTENSION AdapterExtension ) { - ULONG ghc, ticks, ghcStatus; + ULONG ticks; + AHCI_GHC ghc; PAHCI_MEMORY_REGISTERS abar = NULL; DebugPrint("AhciAdapterReset()\n"); @@ -1585,13 +1792,13 @@ } // HR -- Very first bit (lowest significant) - ghc = AHCI_Global_HBA_CONTROL_HR; - StorPortWriteRegisterUlong(AdapterExtension, &abar->GHC, ghc); + ghc.HR = 1; + StorPortWriteRegisterUlong(AdapterExtension, &abar->GHC, ghc.Status); for (ticks = 0; ticks < 50; ++ticks) { - ghcStatus = StorPortReadRegisterUlong(AdapterExtension, &abar->GHC); - if ((ghcStatus & AHCI_Global_HBA_CONTROL_HR) == 0) + ghc.Status = StorPortReadRegisterUlong(AdapterExtension, &abar->GHC); + if (ghc.HR == 0) { break; } @@ -1658,7 +1865,7 @@ return FALSE; } - return AdapterExtension->PortExtension[pathId].IsActive; + return AdapterExtension->PortExtension[pathId].DeviceParams.IsActive; }// -- IsPortValid() /** Modified: branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.h URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/AHCI/drivers/storage/…
============================================================================== --- branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.h [iso-8859-1] (original) +++ branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.h [iso-8859-1] Tue Jul 19 16:50:59 2016 @@ -25,11 +25,16 @@ #define AHCI_DEVICE_TYPE_NODEVICE 3 // section 3.1.2 -#define AHCI_Global_HBA_CONTROL_HR (1 << 0) -#define AHCI_Global_HBA_CONTROL_IE (1 << 1) -#define AHCI_Global_HBA_CONTROL_MRSM (1 << 2) -#define AHCI_Global_HBA_CONTROL_AE (1 << 31) #define AHCI_Global_HBA_CAP_S64A (1 << 31) + +// FIS Types :
http://wiki.osdev.org/AHCI
+#define FIS_TYPE_REG_H2D 0x27 // Register FIS - host to device +#define FIS_TYPE_REG_D2H 0x34 // Register FIS - device to host +#define FIS_TYPE_DMA_ACT 0x39 // DMA activate FIS - device to host +#define FIS_TYPE_DMA_SETUP 0x41 // DMA setup FIS - bidirectional +#define FIS_TYPE_BIST 0x58 // BIST activate FIS - bidirectional +#define FIS_TYPE_PIO_SETUP 0x5F // PIO setup FIS - device to host +#define FIS_TYPE_DEV_BITS 0xA1 // Set device bits FIS - device to host #define AHCI_ATA_CFIS_FisType 0 #define AHCI_ATA_CFIS_PMPort_C 1 @@ -73,7 +78,6 @@ typedef VOID (*PAHCI_COMPLETION_ROUTINE) ( - __in PVOID AdapterExtension, __in PVOID PortExtension, __in PVOID Srb ); @@ -225,7 +229,7 @@ ULONG R : 1; // Reset ULONG B : 1; // BIST ULONG C : 1; //Clear Busy upon R_OK - ULONG DW0_Reserved : 1; + ULONG RSV : 1; ULONG PMP : 4; //Port Multiplier Port ULONG PRDTL : 16; //Physical Region Descriptor Table Length @@ -233,6 +237,20 @@ ULONG Status; } AHCI_COMMAND_HEADER_DESCRIPTION; + +typedef union _AHCI_GHC +{ + struct + { + ULONG HR : 1; + ULONG IE : 1; + ULONG MRSM : 1; + ULONG RSV0 : 28; + ULONG AE : 1; + }; + + ULONG Status; +} AHCI_GHC; // section 3.3.7 typedef union _AHCI_PORT_CMD @@ -340,10 +358,10 @@ typedef struct _AHCI_COMMAND_HEADER { AHCI_COMMAND_HEADER_DESCRIPTION DI; // DW 0 - ULONG PRDBC; // DW 1 - ULONG CTBA0; // DW 2 - ULONG CTBA_U0; // DW 3 - ULONG Reserved[4]; // DW 4-7 + ULONG PRDBC; // DW 1 + ULONG CTBA; // DW 2 + ULONG CTBA_U; // DW 3 + ULONG Reserved[4]; // DW 4-7 } AHCI_COMMAND_HEADER, *PAHCI_COMMAND_HEADER; // Received FIS @@ -384,7 +402,7 @@ ULONG Vendor[4]; // 0x70 ~ 0x7F, vendor specific } AHCI_PORT, *PAHCI_PORT; -typedef struct _AHCI_INTERRUPT_ENABLE +typedef union _AHCI_INTERRUPT_ENABLE { struct { @@ -408,6 +426,7 @@ ULONG TFEE :1; ULONG CPDE :1; }; + ULONG Status; } AHCI_INTERRUPT_ENABLE; @@ -436,9 +455,21 @@ ULONG PortNumber; ULONG QueueSlots; // slots which we have already assigned task (Slot) ULONG CommandIssuedSlots; // slots which has been programmed - BOOLEAN IsActive; + ULONG MaxPortQueueDepth; + + struct + { + UCHAR RemovableDevice; + UCHAR Lba48BitMode; + UCHAR AccessType; + UCHAR DeviceType; + UCHAR IsActive; + } DeviceParams; + + STOR_DPC CommandCompletion; PAHCI_PORT Port; // AHCI Port Infomation AHCI_QUEUE SrbQueue; // pending Srbs + AHCI_QUEUE CompletionQueue; PSCSI_REQUEST_BLOCK Slot[MAXIMUM_AHCI_PORT_NCS]; // Srbs which has been alloted a port PAHCI_RECEIVED_FIS ReceivedFIS; PAHCI_COMMAND_HEADER CommandList; @@ -469,11 +500,6 @@ ULONG CurrentCommandSlot; PVOID NonCachedExtension; // holds virtual address to noncached buffer allocated for Port Extension - - struct - { - UCHAR DeviceType; - } DeviceParams; struct { @@ -546,7 +572,8 @@ DeviceInquiryRequest ( __in PAHCI_ADAPTER_EXTENSION AdapterExtension, __in PSCSI_REQUEST_BLOCK Srb, - __in PCDB Cdb + __in PCDB Cdb, + __in BOOLEAN HasProductDataRequest ); __inline @@ -572,37 +599,56 @@ // Assertions // ////////////////////////////////////////////////////////////// -C_ASSERT(FIELD_OFFSET(AHCI_MEMORY_REGISTERS, CAP) == 0x00); -C_ASSERT(FIELD_OFFSET(AHCI_MEMORY_REGISTERS, GHC) == 0x04); -C_ASSERT(FIELD_OFFSET(AHCI_MEMORY_REGISTERS, IS) == 0x08); -C_ASSERT(FIELD_OFFSET(AHCI_MEMORY_REGISTERS, PI) == 0x0C); -C_ASSERT(FIELD_OFFSET(AHCI_MEMORY_REGISTERS, VS) == 0x10); -C_ASSERT(FIELD_OFFSET(AHCI_MEMORY_REGISTERS, CCC_CTL) == 0x14); -C_ASSERT(FIELD_OFFSET(AHCI_MEMORY_REGISTERS, CCC_PTS) == 0x18); -C_ASSERT(FIELD_OFFSET(AHCI_MEMORY_REGISTERS, EM_LOC) == 0x1C); -C_ASSERT(FIELD_OFFSET(AHCI_MEMORY_REGISTERS, EM_CTL) == 0x20); -C_ASSERT(FIELD_OFFSET(AHCI_MEMORY_REGISTERS, CAP2) == 0x24); -C_ASSERT(FIELD_OFFSET(AHCI_MEMORY_REGISTERS, BOHC) == 0x28); -C_ASSERT(FIELD_OFFSET(AHCI_MEMORY_REGISTERS, Reserved) == 0x2C); +// I assert every silly mistake I can do while coding +// because god never help me debugging the code +// but these asserts do :') + +C_ASSERT(FIELD_OFFSET(AHCI_MEMORY_REGISTERS, CAP) == 0x00); +C_ASSERT(FIELD_OFFSET(AHCI_MEMORY_REGISTERS, GHC) == 0x04); +C_ASSERT(FIELD_OFFSET(AHCI_MEMORY_REGISTERS, IS) == 0x08); +C_ASSERT(FIELD_OFFSET(AHCI_MEMORY_REGISTERS, PI) == 0x0C); +C_ASSERT(FIELD_OFFSET(AHCI_MEMORY_REGISTERS, VS) == 0x10); +C_ASSERT(FIELD_OFFSET(AHCI_MEMORY_REGISTERS, CCC_CTL) == 0x14); +C_ASSERT(FIELD_OFFSET(AHCI_MEMORY_REGISTERS, CCC_PTS) == 0x18); +C_ASSERT(FIELD_OFFSET(AHCI_MEMORY_REGISTERS, EM_LOC) == 0x1C); +C_ASSERT(FIELD_OFFSET(AHCI_MEMORY_REGISTERS, EM_CTL) == 0x20); +C_ASSERT(FIELD_OFFSET(AHCI_MEMORY_REGISTERS, CAP2) == 0x24); +C_ASSERT(FIELD_OFFSET(AHCI_MEMORY_REGISTERS, BOHC) == 0x28); +C_ASSERT(FIELD_OFFSET(AHCI_MEMORY_REGISTERS, Reserved) == 0x2C); C_ASSERT(FIELD_OFFSET(AHCI_MEMORY_REGISTERS, VendorSpecific) == 0xA0); -C_ASSERT(FIELD_OFFSET(AHCI_MEMORY_REGISTERS, PortList) == 0x100); - -C_ASSERT(FIELD_OFFSET(AHCI_PORT, CLB) == 0x00); -C_ASSERT(FIELD_OFFSET(AHCI_PORT, CLBU) == 0x04); -C_ASSERT(FIELD_OFFSET(AHCI_PORT, FB) == 0x08); -C_ASSERT(FIELD_OFFSET(AHCI_PORT, FBU) == 0x0C); -C_ASSERT(FIELD_OFFSET(AHCI_PORT, IS) == 0x10); -C_ASSERT(FIELD_OFFSET(AHCI_PORT, IE) == 0x14); -C_ASSERT(FIELD_OFFSET(AHCI_PORT, CMD) == 0x18); -C_ASSERT(FIELD_OFFSET(AHCI_PORT, RSV0) == 0x1C); -C_ASSERT(FIELD_OFFSET(AHCI_PORT, TFD) == 0x20); -C_ASSERT(FIELD_OFFSET(AHCI_PORT, SIG) == 0x24); -C_ASSERT(FIELD_OFFSET(AHCI_PORT, SSTS) == 0x28); -C_ASSERT(FIELD_OFFSET(AHCI_PORT, SCTL) == 0x2C); -C_ASSERT(FIELD_OFFSET(AHCI_PORT, SERR) == 0x30); -C_ASSERT(FIELD_OFFSET(AHCI_PORT, SACT) == 0x34); -C_ASSERT(FIELD_OFFSET(AHCI_PORT, CI) == 0x38); -C_ASSERT(FIELD_OFFSET(AHCI_PORT, SNTF) == 0x3C); -C_ASSERT(FIELD_OFFSET(AHCI_PORT, FBS) == 0x40); -C_ASSERT(FIELD_OFFSET(AHCI_PORT, RSV1) == 0x44); -C_ASSERT(FIELD_OFFSET(AHCI_PORT, Vendor) == 0x70); +C_ASSERT(FIELD_OFFSET(AHCI_MEMORY_REGISTERS, PortList) == 0x100); + +C_ASSERT(FIELD_OFFSET(AHCI_PORT, CLB) == 0x00); +C_ASSERT(FIELD_OFFSET(AHCI_PORT, CLBU) == 0x04); +C_ASSERT(FIELD_OFFSET(AHCI_PORT, FB) == 0x08); +C_ASSERT(FIELD_OFFSET(AHCI_PORT, FBU) == 0x0C); +C_ASSERT(FIELD_OFFSET(AHCI_PORT, IS) == 0x10); +C_ASSERT(FIELD_OFFSET(AHCI_PORT, IE) == 0x14); +C_ASSERT(FIELD_OFFSET(AHCI_PORT, CMD) == 0x18); +C_ASSERT(FIELD_OFFSET(AHCI_PORT, RSV0) == 0x1C); +C_ASSERT(FIELD_OFFSET(AHCI_PORT, TFD) == 0x20); +C_ASSERT(FIELD_OFFSET(AHCI_PORT, SIG) == 0x24); +C_ASSERT(FIELD_OFFSET(AHCI_PORT, SSTS) == 0x28); +C_ASSERT(FIELD_OFFSET(AHCI_PORT, SCTL) == 0x2C); +C_ASSERT(FIELD_OFFSET(AHCI_PORT, SERR) == 0x30); +C_ASSERT(FIELD_OFFSET(AHCI_PORT, SACT) == 0x34); +C_ASSERT(FIELD_OFFSET(AHCI_PORT, CI) == 0x38); +C_ASSERT(FIELD_OFFSET(AHCI_PORT, SNTF) == 0x3C); +C_ASSERT(FIELD_OFFSET(AHCI_PORT, FBS) == 0x40); +C_ASSERT(FIELD_OFFSET(AHCI_PORT, RSV1) == 0x44); +C_ASSERT(FIELD_OFFSET(AHCI_PORT, Vendor) == 0x70); + +C_ASSERT((sizeof(AHCI_COMMAND_TABLE) % 128) == 0); + +C_ASSERT(sizeof(AHCI_GHC) == sizeof(ULONG)); +C_ASSERT(sizeof(AHCI_PORT_CMD) == sizeof(ULONG)); +C_ASSERT(sizeof(AHCI_TASK_FILE_DATA) == sizeof(ULONG)); +C_ASSERT(sizeof(AHCI_INTERRUPT_ENABLE) == sizeof(ULONG)); +C_ASSERT(sizeof(AHCI_SERIAL_ATA_STATUS) == sizeof(ULONG)); +C_ASSERT(sizeof(AHCI_SERIAL_ATA_CONTROL) == sizeof(ULONG)); +C_ASSERT(sizeof(AHCI_COMMAND_HEADER_DESCRIPTION) == sizeof(ULONG)); + +C_ASSERT(FIELD_OFFSET(AHCI_COMMAND_TABLE, CFIS) == 0x00); +C_ASSERT(FIELD_OFFSET(AHCI_COMMAND_TABLE, ACMD) == 0x40); +C_ASSERT(FIELD_OFFSET(AHCI_COMMAND_TABLE, RSV0) == 0x50); +C_ASSERT(FIELD_OFFSET(AHCI_COMMAND_TABLE, PRDT) == 0x80);
8 years, 5 months
1
0
0
0
[tthompson] 71968: [NTFS] +FreeClusters(). Fix a DPRINT.
by tthompson@svn.reactos.org
Author: tthompson Date: Tue Jul 19 15:31:22 2016 New Revision: 71968 URL:
http://svn.reactos.org/svn/reactos?rev=71968&view=rev
Log: [NTFS] +FreeClusters(). Fix a DPRINT. Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/attrib.c branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/mft.c branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/ntfs.h Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/attrib.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyst…
============================================================================== --- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/attrib.c [iso-8859-1] (original) +++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/attrib.c [iso-8859-1] Tue Jul 19 15:31:22 2016 @@ -409,6 +409,208 @@ return TRUE; } +/** +* @name FreeClusters +* @implemented +* +* Shrinks the allocation size of a non-resident attribute by a given number of clusters. +* Frees the clusters from the volume's $BITMAP file as well as the attribute's data runs. +* +* @param Vcb +* Pointer to an NTFS_VCB for the destination volume. +* +* @param AttrContext +* Pointer to an NTFS_ATTR_CONTEXT describing the attribute from which the clusters will be freed. +* +* @param AttrOffset +* Byte offset of the destination attribute relative to its file record. +* +* @param FileRecord +* Pointer to a complete copy of the file record containing the attribute. Must be at least +* Vcb->NtfsInfo.BytesPerFileRecord bytes long. +* +* @param ClustersToFree +* Number of clusters that should be freed from the end of the data stream. Must be no more +* Than the number of clusters assigned to the attribute (HighestVCN + 1). +* +* @return +* STATUS_SUCCESS on success. STATUS_INVALID_PARAMETER if AttrContext describes a resident attribute, +* or if the caller requested more clusters be freed than the attribute has been allocated. +* STATUS_INSUFFICIENT_RESOURCES if ConvertDataRunsToLargeMCB() fails. +* STATUS_BUFFER_TOO_SMALL if ConvertLargeMCBToDataRuns() fails. +* +* +*/ +NTSTATUS +FreeClusters(PNTFS_VCB Vcb, + PNTFS_ATTR_CONTEXT AttrContext, + ULONG AttrOffset, + PFILE_RECORD_HEADER FileRecord, + ULONG ClustersToFree) +{ + NTSTATUS Status = STATUS_SUCCESS; + ULONG ClustersLeftToFree = ClustersToFree; + + // convert data runs to mcb + PUCHAR DataRun = (PUCHAR)&AttrContext->Record + AttrContext->Record.NonResident.MappingPairsOffset; + PNTFS_ATTR_RECORD DestinationAttribute = (PNTFS_ATTR_RECORD)((ULONG_PTR)FileRecord + AttrOffset); + LARGE_MCB DataRunsMCB; + ULONG NextAttributeOffset = AttrOffset + AttrContext->Record.Length; + PNTFS_ATTR_RECORD NextAttribute = (PNTFS_ATTR_RECORD)((ULONG_PTR)FileRecord + NextAttributeOffset); + ULONGLONG NextVBN = AttrContext->Record.NonResident.LowestVCN; + + // Allocate some memory for the RunBuffer + PUCHAR RunBuffer = ExAllocatePoolWithTag(NonPagedPool, Vcb->NtfsInfo.BytesPerFileRecord, TAG_NTFS); + ULONG RunBufferOffset = 0; + + PFILE_RECORD_HEADER BitmapRecord; + PNTFS_ATTR_CONTEXT DataContext; + ULONGLONG BitmapDataSize; + PUCHAR BitmapData; + RTL_BITMAP Bitmap; + ULONG LengthWritten; + + if (!AttrContext->Record.IsNonResident) + { + ExFreePoolWithTag(RunBuffer, TAG_NTFS); + return STATUS_INVALID_PARAMETER; + } + + // Convert the data runs to a map control block + Status = ConvertDataRunsToLargeMCB(DataRun, &DataRunsMCB, &NextVBN); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Unable to convert data runs to MCB (probably ran out of memory)!\n"); + ExFreePoolWithTag(RunBuffer, TAG_NTFS); + return Status; + } + + BitmapRecord = ExAllocatePoolWithTag(NonPagedPool, + Vcb->NtfsInfo.BytesPerFileRecord, + TAG_NTFS); + if (BitmapRecord == NULL) + { + DPRINT1("Error: Unable to allocate memory for bitmap file record!\n"); + FsRtlUninitializeLargeMcb(&DataRunsMCB); + ExFreePoolWithTag(RunBuffer, TAG_NTFS); + return STATUS_NO_MEMORY; + } + + Status = ReadFileRecord(Vcb, NTFS_FILE_BITMAP, BitmapRecord); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Error: Unable to read file record for bitmap!\n"); + FsRtlUninitializeLargeMcb(&DataRunsMCB); + ExFreePoolWithTag(BitmapRecord, TAG_NTFS); + ExFreePoolWithTag(RunBuffer, TAG_NTFS); + return 0; + } + + Status = FindAttribute(Vcb, BitmapRecord, AttributeData, L"", 0, &DataContext, NULL); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Error: Unable to find data attribute for bitmap file!\n"); + FsRtlUninitializeLargeMcb(&DataRunsMCB); + ExFreePoolWithTag(BitmapRecord, TAG_NTFS); + ExFreePoolWithTag(RunBuffer, TAG_NTFS); + return 0; + } + + BitmapDataSize = AttributeDataLength(&DataContext->Record); + BitmapDataSize = min(BitmapDataSize, 0xffffffff); + ASSERT((BitmapDataSize * 8) >= Vcb->NtfsInfo.ClusterCount); + BitmapData = ExAllocatePoolWithTag(NonPagedPool, ROUND_UP(BitmapDataSize, Vcb->NtfsInfo.BytesPerSector), TAG_NTFS); + if (BitmapData == NULL) + { + DPRINT1("Error: Unable to allocate memory for bitmap file data!\n"); + ReleaseAttributeContext(DataContext); + FsRtlUninitializeLargeMcb(&DataRunsMCB); + ExFreePoolWithTag(BitmapRecord, TAG_NTFS); + ExFreePoolWithTag(RunBuffer, TAG_NTFS); + return 0; + } + + ReadAttribute(Vcb, DataContext, 0, (PCHAR)BitmapData, (ULONG)BitmapDataSize); + + RtlInitializeBitMap(&Bitmap, (PULONG)BitmapData, Vcb->NtfsInfo.ClusterCount); + + // free clusters in $BITMAP file + while (ClustersLeftToFree > 0) + { + LONGLONG LargeVbn, LargeLbn; + + if (!FsRtlLookupLastLargeMcbEntry(&DataRunsMCB, &LargeVbn, &LargeLbn)) + { + Status = STATUS_INVALID_PARAMETER; + DPRINT1("DRIVER ERROR: FreeClusters called to free %lu clusters, which is %lu more clusters than are assigned to attribute!", + ClustersToFree, + ClustersLeftToFree); + break; + } + + if( LargeLbn != -1) + { + // deallocate this cluster + RtlClearBits(&Bitmap, LargeLbn, 1); + } + FsRtlTruncateLargeMcb(&DataRunsMCB, AttrContext->Record.NonResident.HighestVCN); + AttrContext->Record.NonResident.HighestVCN = min(AttrContext->Record.NonResident.HighestVCN, AttrContext->Record.NonResident.HighestVCN - 1); + ClustersLeftToFree--; + } + + // update $BITMAP file on disk + Status = WriteAttribute(Vcb, DataContext, 0, BitmapData, (ULONG)BitmapDataSize, &LengthWritten); + if (!NT_SUCCESS(Status)) + { + ReleaseAttributeContext(DataContext); + FsRtlUninitializeLargeMcb(&DataRunsMCB); + ExFreePoolWithTag(BitmapData, TAG_NTFS); + ExFreePoolWithTag(BitmapRecord, TAG_NTFS); + ExFreePoolWithTag(RunBuffer, TAG_NTFS); + return Status; + } + + ReleaseAttributeContext(DataContext); + ExFreePoolWithTag(BitmapData, TAG_NTFS); + ExFreePoolWithTag(BitmapRecord, TAG_NTFS); + + // Convert the map control block back to encoded data runs + ConvertLargeMCBToDataRuns(&DataRunsMCB, RunBuffer, Vcb->NtfsInfo.BytesPerCluster, &RunBufferOffset); + + // Update HighestVCN + DestinationAttribute->NonResident.HighestVCN = AttrContext->Record.NonResident.HighestVCN; + + // Write data runs to destination attribute + RtlCopyMemory((PVOID)((ULONG_PTR)DestinationAttribute + DestinationAttribute->NonResident.MappingPairsOffset), + RunBuffer, + RunBufferOffset); + + if (NextAttribute->Type == AttributeEnd) + { + // update attribute length + AttrContext->Record.Length = ALIGN_UP_BY(AttrContext->Record.NonResident.MappingPairsOffset + RunBufferOffset, 8); + DestinationAttribute->Length = AttrContext->Record.Length; + + // write end markers + NextAttribute = (PNTFS_ATTR_RECORD)((ULONG_PTR)DestinationAttribute + DestinationAttribute->Length); + NextAttribute->Type = AttributeEnd; + NextAttribute->Length = FILE_RECORD_END; + + // update file record length + FileRecord->BytesInUse = AttrOffset + DestinationAttribute->Length + (sizeof(ULONG) * 2); + } + + // Update the file record + Status = UpdateFileRecord(Vcb, AttrContext->FileMFTIndex, FileRecord); + + FsRtlUninitializeLargeMcb(&DataRunsMCB); + ExFreePoolWithTag(RunBuffer, TAG_NTFS); + + NtfsDumpDataRuns((PUCHAR)((ULONG_PTR)DestinationAttribute + DestinationAttribute->NonResident.MappingPairsOffset), 0); + + return Status; +} + static NTSTATUS InternalReadNonResidentAttributes(PFIND_ATTR_CONTXT Context) Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/mft.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyst…
============================================================================== --- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/mft.c [iso-8859-1] (original) +++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/mft.c [iso-8859-1] Tue Jul 19 15:31:22 2016 @@ -225,6 +225,7 @@ PLARGE_INTEGER DataSize) { NTSTATUS Status = STATUS_SUCCESS; + ULONG BytesPerCluster = Fcb->Vcb->NtfsInfo.BytesPerCluster; // are we truncating the file? if (DataSize->QuadPart < AttributeDataLength(&AttrContext->Record)) @@ -238,14 +239,13 @@ if (AttrContext->Record.IsNonResident) { - ULONG BytesPerCluster = Fcb->Vcb->NtfsInfo.BytesPerCluster; ULONGLONG AllocationSize = ROUND_UP(DataSize->QuadPart, BytesPerCluster); PNTFS_ATTR_RECORD DestinationAttribute = (PNTFS_ATTR_RECORD)((ULONG_PTR)FileRecord + AttrOffset); + ULONG ExistingClusters = AttrContext->Record.NonResident.AllocatedSize / BytesPerCluster; // do we need to increase the allocation size? if (AttrContext->Record.NonResident.AllocatedSize < AllocationSize) { - ULONG ExistingClusters = AttrContext->Record.NonResident.AllocatedSize / BytesPerCluster; ULONG ClustersNeeded = (AllocationSize / BytesPerCluster) - ExistingClusters; LARGE_INTEGER LastClusterInDataRun; ULONG NextAssignedCluster; @@ -284,15 +284,9 @@ } else if (AttrContext->Record.NonResident.AllocatedSize > AllocationSize) { - // shrink allocation size (TODO) - if (AllocationSize == 0) - { - // hack for notepad.exe - PUCHAR DataRuns = (PUCHAR)((ULONG_PTR)DestinationAttribute + DestinationAttribute->NonResident.MappingPairsOffset); - *DataRuns = 0; - DestinationAttribute->NonResident.HighestVCN = - AttrContext->Record.NonResident.HighestVCN = 0; - } + // shrink allocation size + ULONG ClustersToFree = ExistingClusters - (AllocationSize / BytesPerCluster); + Status = FreeClusters(Fcb->Vcb, AttrContext, AttrOffset, FileRecord, ClustersToFree); } // TODO: is the file compressed, encrypted, or sparse? @@ -1098,7 +1092,7 @@ if (!NT_SUCCESS(Status)) { - DPRINT1("UpdateFileRecord failed: %I64u written, %u expected\n", BytesWritten, Vcb->NtfsInfo.BytesPerFileRecord); + DPRINT1("UpdateFileRecord failed: %I64u written, %lu expected\n", BytesWritten, Vcb->NtfsInfo.BytesPerFileRecord); } // remove the fixup array (so the file record pointer can still be used) Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/ntfs.h URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyst…
============================================================================== --- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/ntfs.h [iso-8859-1] (original) +++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/ntfs.h [iso-8859-1] Tue Jul 19 15:31:22 2016 @@ -584,6 +584,13 @@ VOID FindCloseAttribute(PFIND_ATTR_CONTXT Context); +NTSTATUS +FreeClusters(PNTFS_VCB Vcb, + PNTFS_ATTR_CONTEXT AttrContext, + ULONG AttrOffset, + PFILE_RECORD_HEADER FileRecord, + ULONG ClustersToFree); + /* blockdev.c */ NTSTATUS
8 years, 5 months
1
0
0
0
[tfaber] 71967: [NTOS:KE] - Load LDT on context switch if required. CORE-11511 #resolve
by tfaber@svn.reactos.org
Author: tfaber Date: Tue Jul 19 12:51:49 2016 New Revision: 71967 URL:
http://svn.reactos.org/svn/reactos?rev=71967&view=rev
Log: [NTOS:KE] - Load LDT on context switch if required. CORE-11511 #resolve Modified: trunk/reactos/ntoskrnl/ke/i386/context.c trunk/reactos/ntoskrnl/ke/i386/ldt.c trunk/reactos/ntoskrnl/ke/i386/thrdini.c Modified: trunk/reactos/ntoskrnl/ke/i386/context.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/context.c…
============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/context.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/i386/context.c [iso-8859-1] Tue Jul 19 12:51:49 2016 @@ -34,9 +34,17 @@ /* Check for new LDT */ if (NewProcess->LdtDescriptor.LimitLow != OldProcess->LdtDescriptor.LimitLow) { - /* Not handled yet */ - UNIMPLEMENTED_DBGBREAK(); - return; + if (NewProcess->LdtDescriptor.LimitLow) + { + KeSetGdtSelector(KGDT_LDT, + ((PULONG)&NewProcess->LdtDescriptor)[0], + ((PULONG)&NewProcess->LdtDescriptor)[1]); + Ke386SetLocalDescriptorTable(KGDT_LDT); + } + else + { + Ke386SetLocalDescriptorTable(0); + } } /* Update CR3 */ Modified: trunk/reactos/ntoskrnl/ke/i386/ldt.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/ldt.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/ldt.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/i386/ldt.c [iso-8859-1] Tue Jul 19 12:51:49 2016 @@ -167,7 +167,7 @@ if ((Base + SegLimit > (ULONG_PTR) MmHighestUserAddress) || (Base > Base+SegLimit)) { - DPRINT1("WARNING: Windows would mark this descriptor invalid!"); + DPRINT1("WARNING: Windows would mark this descriptor invalid!\n"); } /* Modified: trunk/reactos/ntoskrnl/ke/i386/thrdini.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/thrdini.c…
============================================================================== --- trunk/reactos/ntoskrnl/ke/i386/thrdini.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/i386/thrdini.c [iso-8859-1] Tue Jul 19 12:51:49 2016 @@ -345,8 +345,17 @@ /* Check if there is a different LDT */ if (*(PULONGLONG)&OldProcess->LdtDescriptor != *(PULONGLONG)&NewProcess->LdtDescriptor) { - DPRINT1("LDT switch not implemented\n"); - ASSERT(FALSE); + if (NewProcess->LdtDescriptor.LimitLow) + { + KeSetGdtSelector(KGDT_LDT, + ((PULONG)&NewProcess->LdtDescriptor)[0], + ((PULONG)&NewProcess->LdtDescriptor)[1]); + Ke386SetLocalDescriptorTable(KGDT_LDT); + } + else + { + Ke386SetLocalDescriptorTable(0); + } } /* Switch address space and flush TLB */
8 years, 5 months
1
0
0
0
← Newer
1
...
7
8
9
10
11
12
13
...
36
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
Results per page:
10
25
50
100
200