ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
June 2006
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
19 participants
595 discussions
Start a n
N
ew thread
[greatlrd] 22733: 1. revert my last changes to this file 2. Did solv the heapfree null check with if statement
by greatlrd@svn.reactos.org
Author: greatlrd Date: Sat Jul 1 02:26:19 2006 New Revision: 22733 URL:
http://svn.reactos.org/svn/reactos?rev=22733&view=rev
Log: 1. revert my last changes to this file 2. Did solv the heapfree null check with if statement Modified: trunk/reactos/dll/win32/advapi32/service/scm.c Modified: trunk/reactos/dll/win32/advapi32/service/scm.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/service…
============================================================================== --- trunk/reactos/dll/win32/advapi32/service/scm.c (original) +++ trunk/reactos/dll/win32/advapi32/service/scm.c Sat Jul 1 02:26:19 2006 @@ -443,7 +443,7 @@ { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return NULL; + goto cleanup; } MultiByteToWideChar(CP_ACP, 0, lpServiceName, -1, lpServiceNameW, len); } @@ -456,8 +456,7 @@ { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - HeapFree(GetProcessHeap(), 0, lpServiceNameW); - return NULL; + goto cleanup; } MultiByteToWideChar(CP_ACP, 0, lpDisplayName, -1, lpDisplayNameW, len); } @@ -470,9 +469,7 @@ { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - HeapFree(GetProcessHeap(), 0, lpServiceNameW); - HeapFree(GetProcessHeap(), 0, lpDisplayNameW); - return NULL; + goto cleanup; } MultiByteToWideChar(CP_ACP, 0, lpDisplayName, -1, lpBinaryPathNameW, len); } @@ -485,10 +482,7 @@ { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - HeapFree(GetProcessHeap(), 0, lpServiceNameW); - HeapFree(GetProcessHeap(), 0, lpDisplayNameW); - HeapFree(GetProcessHeap(), 0, lpBinaryPathNameW); - return NULL; + goto cleanup; } MultiByteToWideChar(CP_ACP, 0, lpLoadOrderGroup, -1, lpLoadOrderGroupW, len); } @@ -509,11 +503,7 @@ { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - HeapFree(GetProcessHeap(), 0, lpServiceNameW); - HeapFree(GetProcessHeap(), 0, lpDisplayNameW); - HeapFree(GetProcessHeap(), 0, lpBinaryPathNameW); - HeapFree(GetProcessHeap(), 0, lpLoadOrderGroupW); - return NULL; + goto cleanup; } MultiByteToWideChar(CP_ACP, 0, lpDependencies, -1, lpDependenciesW, dwDependenciesLength); } @@ -526,12 +516,7 @@ { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - HeapFree(GetProcessHeap(), 0, lpServiceNameW); - HeapFree(GetProcessHeap(), 0, lpDisplayNameW); - HeapFree(GetProcessHeap(), 0, lpBinaryPathNameW); - HeapFree(GetProcessHeap(), 0, lpLoadOrderGroupW); - HeapFree(GetProcessHeap(), 0, lpDependenciesW); - return NULL; + goto cleanup; } MultiByteToWideChar(CP_ACP, 0, lpServiceStartName, -1, lpServiceStartNameW, len); } @@ -544,13 +529,7 @@ { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - HeapFree(GetProcessHeap(), 0, lpServiceNameW); - HeapFree(GetProcessHeap(), 0, lpDisplayNameW); - HeapFree(GetProcessHeap(), 0, lpBinaryPathNameW); - HeapFree(GetProcessHeap(), 0, lpLoadOrderGroupW); - HeapFree(GetProcessHeap(), 0, lpDependenciesW); - HeapFree(GetProcessHeap(), 0, lpServiceStartNameW); - return NULL; + goto cleanup; } MultiByteToWideChar(CP_ACP, 0, lpPassword, -1, lpPasswordW, len); } @@ -569,14 +548,35 @@ lpServiceStartNameW, lpPasswordW); - - HeapFree(GetProcessHeap(), 0, lpServiceNameW); - HeapFree(GetProcessHeap(), 0, lpDisplayNameW); - HeapFree(GetProcessHeap(), 0, lpBinaryPathNameW); - HeapFree(GetProcessHeap(), 0, lpLoadOrderGroupW); - HeapFree(GetProcessHeap(), 0, lpDependenciesW); - HeapFree(GetProcessHeap(), 0, lpServiceStartNameW); - HeapFree(GetProcessHeap(), 0, lpPasswordW); +cleanup: + if (lpServiceNameW !=NULL) + { + HeapFree(GetProcessHeap(), 0, lpServiceNameW); + } + if (lpDisplayNameW != NULL) + { + HeapFree(GetProcessHeap(), 0, lpDisplayNameW); + } + if (lpBinaryPathNameW != NULL) + { + HeapFree(GetProcessHeap(), 0, lpBinaryPathNameW); + } + if (lpLoadOrderGroupW != NULL) + { + HeapFree(GetProcessHeap(), 0, lpLoadOrderGroupW); + } + if (lpDependenciesW != NULL) + { + HeapFree(GetProcessHeap(), 0, lpDependenciesW); + } + if (lpServiceStartNameW != NULL) + { + HeapFree(GetProcessHeap(), 0, lpServiceStartNameW); + } + if (lpPasswordW != NULL) + { + HeapFree(GetProcessHeap(), 0, lpPasswordW); + } return RetVal; }
18 years, 5 months
1
0
0
0
[greatlrd] 22732: CreateServiceA 1. Do not try todo HeapFree when pointer is NULL in cleanup: 2. Remove goto cleanup code 3. Rewrote the code so it does not need goto
by greatlrd@svn.reactos.org
Author: greatlrd Date: Sat Jul 1 02:07:54 2006 New Revision: 22732 URL:
http://svn.reactos.org/svn/reactos?rev=22732&view=rev
Log: CreateServiceA 1. Do not try todo HeapFree when pointer is NULL in cleanup: 2. Remove goto cleanup code 3. Rewrote the code so it does not need goto Modified: trunk/reactos/dll/win32/advapi32/service/scm.c Modified: trunk/reactos/dll/win32/advapi32/service/scm.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/service…
============================================================================== --- trunk/reactos/dll/win32/advapi32/service/scm.c (original) +++ trunk/reactos/dll/win32/advapi32/service/scm.c Sat Jul 1 02:07:54 2006 @@ -442,7 +442,8 @@ if (!lpServiceNameW) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - goto cleanup; + + return NULL; } MultiByteToWideChar(CP_ACP, 0, lpServiceName, -1, lpServiceNameW, len); } @@ -454,7 +455,9 @@ if (!lpDisplayNameW) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - goto cleanup; + + HeapFree(GetProcessHeap(), 0, lpServiceNameW); + return NULL; } MultiByteToWideChar(CP_ACP, 0, lpDisplayName, -1, lpDisplayNameW, len); } @@ -466,7 +469,10 @@ if (!lpBinaryPathNameW) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - goto cleanup; + + HeapFree(GetProcessHeap(), 0, lpServiceNameW); + HeapFree(GetProcessHeap(), 0, lpDisplayNameW); + return NULL; } MultiByteToWideChar(CP_ACP, 0, lpDisplayName, -1, lpBinaryPathNameW, len); } @@ -478,7 +484,11 @@ if (!lpLoadOrderGroupW) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - goto cleanup; + + HeapFree(GetProcessHeap(), 0, lpServiceNameW); + HeapFree(GetProcessHeap(), 0, lpDisplayNameW); + HeapFree(GetProcessHeap(), 0, lpBinaryPathNameW); + return NULL; } MultiByteToWideChar(CP_ACP, 0, lpLoadOrderGroup, -1, lpLoadOrderGroupW, len); } @@ -498,7 +508,12 @@ if (!lpDependenciesW) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - goto cleanup; + + HeapFree(GetProcessHeap(), 0, lpServiceNameW); + HeapFree(GetProcessHeap(), 0, lpDisplayNameW); + HeapFree(GetProcessHeap(), 0, lpBinaryPathNameW); + HeapFree(GetProcessHeap(), 0, lpLoadOrderGroupW); + return NULL; } MultiByteToWideChar(CP_ACP, 0, lpDependencies, -1, lpDependenciesW, dwDependenciesLength); } @@ -510,7 +525,13 @@ if (!lpServiceStartNameW) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - goto cleanup; + + HeapFree(GetProcessHeap(), 0, lpServiceNameW); + HeapFree(GetProcessHeap(), 0, lpDisplayNameW); + HeapFree(GetProcessHeap(), 0, lpBinaryPathNameW); + HeapFree(GetProcessHeap(), 0, lpLoadOrderGroupW); + HeapFree(GetProcessHeap(), 0, lpDependenciesW); + return NULL; } MultiByteToWideChar(CP_ACP, 0, lpServiceStartName, -1, lpServiceStartNameW, len); } @@ -522,7 +543,14 @@ if (!lpPasswordW) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); - goto cleanup; + + HeapFree(GetProcessHeap(), 0, lpServiceNameW); + HeapFree(GetProcessHeap(), 0, lpDisplayNameW); + HeapFree(GetProcessHeap(), 0, lpBinaryPathNameW); + HeapFree(GetProcessHeap(), 0, lpLoadOrderGroupW); + HeapFree(GetProcessHeap(), 0, lpDependenciesW); + HeapFree(GetProcessHeap(), 0, lpServiceStartNameW); + return NULL; } MultiByteToWideChar(CP_ACP, 0, lpPassword, -1, lpPasswordW, len); } @@ -541,7 +569,7 @@ lpServiceStartNameW, lpPasswordW); -cleanup: + HeapFree(GetProcessHeap(), 0, lpServiceNameW); HeapFree(GetProcessHeap(), 0, lpDisplayNameW); HeapFree(GetProcessHeap(), 0, lpBinaryPathNameW);
18 years, 5 months
1
0
0
0
[hpoussin] 22731: - Simplify GetFileExt
by hpoussin@svn.reactos.org
Author: hpoussin Date: Sat Jul 1 01:54:25 2006 New Revision: 22731 URL:
http://svn.reactos.org/svn/reactos?rev=22731&view=rev
Log: - Simplify GetFileExt Modified: trunk/reactos/dll/win32/newdev/newdev.c Modified: trunk/reactos/dll/win32/newdev/newdev.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/newdev/newdev.c?…
============================================================================== --- trunk/reactos/dll/win32/newdev/newdev.c (original) +++ trunk/reactos/dll/win32/newdev/newdev.c Sat Jul 1 01:54:25 2006 @@ -325,22 +325,16 @@ return TRUE; } -static LPTSTR +static LPCTSTR GetFileExt(IN LPTSTR FileName) { - if (FileName == 0) + LPCTSTR Dot; + + Dot = _tcsrchr(FileName, _T('.')); + if (!Dot) return _T(""); - int i = _tcsclen(FileName); - while ((i >= 0) && (FileName[i] != _T('.'))) - i--; - - FileName = _tcslwr(FileName); - - if (i >= 0) - return &FileName[i]; - else - return _T(""); + return Dot; } static BOOL @@ -390,7 +384,7 @@ { LPCTSTR pszExtension = GetFileExt(FileName); - if ((_tcscmp(pszExtension, _T(".inf")) == 0) && (_tcscmp(LastDirPath, DirPath) != 0)) + if ((_tcsicmp(pszExtension, _T(".inf")) == 0) && (_tcscmp(LastDirPath, DirPath) != 0)) { _tcscpy(LastDirPath, DirPath);
18 years, 5 months
1
0
0
0
[hpoussin] 22730: Pass the correct object type and desired access to ObOpenObjectByName
by hpoussin@svn.reactos.org
Author: hpoussin Date: Sat Jul 1 01:49:12 2006 New Revision: 22730 URL:
http://svn.reactos.org/svn/reactos?rev=22730&view=rev
Log: Pass the correct object type and desired access to ObOpenObjectByName Modified: trunk/reactos/drivers/base/green/pnp.c Modified: trunk/reactos/drivers/base/green/pnp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/green/pnp.c?r…
============================================================================== --- trunk/reactos/drivers/base/green/pnp.c (original) +++ trunk/reactos/drivers/base/green/pnp.c Sat Jul 1 01:49:12 2006 @@ -21,7 +21,7 @@ OBJECT_ATTRIBUTES ObjectAttributes; ULONG Fcr; HANDLE LocalHandle = 0; - ACCESS_MASK DesiredAccess = 0; /* FIXME */ + ACCESS_MASK DesiredAccess = FILE_ANY_ACCESS; NTSTATUS Status; DriverExtension = IoGetDriverObjectExtension(DriverObject, DriverObject); @@ -50,7 +50,7 @@ InitializeObjectAttributes(&ObjectAttributes, &DriverExtension->AttachedDeviceName, OBJ_KERNEL_HANDLE, NULL, NULL); Status = ObOpenObjectByName( &ObjectAttributes, - IoDeviceObjectType, + IoFileObjectType, KernelMode, NULL, DesiredAccess,
18 years, 5 months
1
0
0
0
[hpoussin] 22729: Use ObOpenObjectByPointer instead of creating ourselves the IRP_MJ_CREATE/CLEANUP/CLOSE IRPs
by hpoussin@svn.reactos.org
Author: hpoussin Date: Sat Jul 1 01:47:42 2006 New Revision: 22729 URL:
http://svn.reactos.org/svn/reactos?rev=22729&view=rev
Log: Use ObOpenObjectByPointer instead of creating ourselves the IRP_MJ_CREATE/CLEANUP/CLOSE IRPs Modified: trunk/reactos/drivers/bus/serenum/detect.c trunk/reactos/drivers/input/sermouse/detect.c Modified: trunk/reactos/drivers/bus/serenum/detect.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/bus/serenum/detect…
============================================================================== --- trunk/reactos/drivers/bus/serenum/detect.c (original) +++ trunk/reactos/drivers/bus/serenum/detect.c Sat Jul 1 01:47:42 2006 @@ -55,44 +55,6 @@ if (OutputBufferSize) { *OutputBufferSize = IoStatus.Information; - } - - return Status; -} - -static NTSTATUS -SendIrp( - IN PDEVICE_OBJECT DeviceObject, - IN ULONG MajorFunction) -{ - KEVENT Event; - PIRP Irp; - IO_STATUS_BLOCK IoStatus; - NTSTATUS Status; - - KeInitializeEvent(&Event, NotificationEvent, FALSE); - - Irp = IoBuildSynchronousFsdRequest( - MajorFunction, - DeviceObject, - NULL, - 0, - NULL, - &Event, - &IoStatus); - if (Irp == NULL) - { - DPRINT("IoBuildSynchronousFsdRequest() failed\n"); - return STATUS_INSUFFICIENT_RESOURCES; - } - - Status = IoCallDriver(DeviceObject, Irp); - - if (Status == STATUS_PENDING) - { - DPRINT("Operation pending\n"); - KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL); - Status = IoStatus.Status; } return Status; @@ -256,6 +218,7 @@ IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT LowerDevice) { + HANDLE Handle = NULL; UCHAR Buffer[256]; ULONG BaudRate; ULONG_PTR TotalBytesReceived = 0; @@ -270,7 +233,14 @@ NTSTATUS Status; /* Open port */ - Status = SendIrp(LowerDevice, IRP_MJ_CREATE); + Status = ObOpenObjectByPointer( + LowerDevice, + OBJ_KERNEL_HANDLE, + NULL, + 0, + NULL, + KernelMode, + &Handle); if (!NT_SUCCESS(Status)) goto ByeBye; /* 1. COM port initialization, check for device enumerate */ @@ -459,8 +429,8 @@ ByeBye: /* Close port */ - SendIrp(LowerDevice, IRP_MJ_CLOSE); - SendIrp(LowerDevice, IRP_MJ_CLEANUP); + if (Handle) + ZwClose(Handle); return Status; } @@ -469,6 +439,7 @@ IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT LowerDevice) { + HANDLE Handle = NULL; ULONG Fcr, Mcr; ULONG BaudRate; ULONG Command; @@ -490,7 +461,14 @@ RtlZeroMemory(Buffer, sizeof(Buffer)); /* Open port */ - Status = SendIrp(LowerDevice, IRP_MJ_CREATE); + Status = ObOpenObjectByPointer( + LowerDevice, + OBJ_EXCLUSIVE | OBJ_KERNEL_HANDLE, + NULL, + 0, + NULL, + KernelMode, + &Handle); if (!NT_SUCCESS(Status)) return Status; /* Reset UART */ @@ -610,7 +588,7 @@ ByeBye: /* Close port */ - SendIrp(LowerDevice, IRP_MJ_CLOSE); - SendIrp(LowerDevice, IRP_MJ_CLEANUP); + if (Handle) + ZwClose(Handle); return Status; } Modified: trunk/reactos/drivers/input/sermouse/detect.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/sermouse/det…
============================================================================== --- trunk/reactos/drivers/input/sermouse/detect.c (original) +++ trunk/reactos/drivers/input/sermouse/detect.c Sat Jul 1 01:47:42 2006 @@ -58,44 +58,6 @@ if (OutputBufferSize) { *OutputBufferSize = IoStatus.Information; - } - - return Status; -} - -static NTSTATUS -SendIrp( - IN PDEVICE_OBJECT DeviceObject, - IN ULONG MajorFunction) -{ - KEVENT Event; - PIRP Irp; - IO_STATUS_BLOCK IoStatus; - NTSTATUS Status; - - KeInitializeEvent(&Event, NotificationEvent, FALSE); - - Irp = IoBuildSynchronousFsdRequest( - MajorFunction, - DeviceObject, - NULL, - 0, - NULL, - &Event, - &IoStatus); - if (Irp == NULL) - { - DPRINT("IoBuildSynchronousFsdRequest() failed\n"); - return STATUS_INSUFFICIENT_RESOURCES; - } - - Status = IoCallDriver(DeviceObject, Irp); - - if (Status == STATUS_PENDING) - { - DPRINT("Operation pending\n"); - KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL); - Status = IoStatus.Status; } return Status; @@ -155,6 +117,7 @@ SermouseDetectLegacyDevice( IN PDEVICE_OBJECT LowerDevice) { + HANDLE Handle; ULONG Fcr, Mcr; ULONG BaudRate; ULONG Command; @@ -170,7 +133,14 @@ RtlZeroMemory(Buffer, sizeof(Buffer)); /* Open port */ - Status = SendIrp(LowerDevice, IRP_MJ_CREATE); + Status = ObOpenObjectByPointer( + LowerDevice, + OBJ_EXCLUSIVE | OBJ_KERNEL_HANDLE, + NULL, + 0, + NULL, + KernelMode, + &Handle); if (!NT_SUCCESS(Status)) return mtNone; /* Reset UART */ @@ -268,7 +238,7 @@ ByeBye: /* Close port */ - SendIrp(LowerDevice, IRP_MJ_CLOSE); - SendIrp(LowerDevice, IRP_MJ_CLEANUP); + if (Handle) + ZwClose(Handle); return MouseType; }
18 years, 5 months
1
0
0
0
[hpoussin] 22728: In ObOpenObjectByPointer, always pass right mapping to SeCreateAccessState, instead of relying on a optional/incorrect parameter
by hpoussin@svn.reactos.org
Author: hpoussin Date: Sat Jul 1 01:34:53 2006 New Revision: 22728 URL:
http://svn.reactos.org/svn/reactos?rev=22728&view=rev
Log: In ObOpenObjectByPointer, always pass right mapping to SeCreateAccessState, instead of relying on a optional/incorrect parameter Modified: trunk/reactos/ntoskrnl/ob/obhandle.c Modified: trunk/reactos/ntoskrnl/ob/obhandle.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/obhandle.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/ob/obhandle.c (original) +++ trunk/reactos/ntoskrnl/ob/obhandle.c Sat Jul 1 01:34:53 2006 @@ -1612,10 +1612,14 @@ IN KPROCESSOR_MODE AccessMode, OUT PHANDLE Handle) { + POBJECT_HEADER Header; NTSTATUS Status; ACCESS_STATE AccessState; AUX_DATA AuxData; PAGED_CODE(); + + /* Get the Header Info */ + Header = OBJECT_TO_OBJECT_HEADER(Object); /* Reference the object */ Status = ObReferenceObjectByPointer(Object, @@ -1632,7 +1636,7 @@ Status = SeCreateAccessState(&AccessState, &AuxData, DesiredAccess, - &ObjectType->TypeInfo.GenericMapping); + &Header->Type->TypeInfo.GenericMapping); if (!NT_SUCCESS(Status)) { /* Fail */
18 years, 5 months
1
0
0
0
[ion] 22727: - Better organize some APIs that were a bit all over the place. No code/formatting changes.
by ion@svn.reactos.org
Author: ion Date: Fri Jun 30 23:37:45 2006 New Revision: 22727 URL:
http://svn.reactos.org/svn/reactos?rev=22727&view=rev
Log: - Better organize some APIs that were a bit all over the place. No code/formatting changes. Added: trunk/reactos/ntoskrnl/io/util.c - copied, changed from r22693, trunk/reactos/ntoskrnl/io/share.c Removed: trunk/reactos/ntoskrnl/io/share.c Modified: trunk/reactos/ntoskrnl/io/device.c trunk/reactos/ntoskrnl/io/file.c trunk/reactos/ntoskrnl/io/fs.c trunk/reactos/ntoskrnl/io/iofunc.c trunk/reactos/ntoskrnl/io/iomgr.c trunk/reactos/ntoskrnl/io/irp.c trunk/reactos/ntoskrnl/ntoskrnl.rbuild Modified: trunk/reactos/ntoskrnl/io/device.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/device.c?rev=2…
============================================================================== --- trunk/reactos/ntoskrnl/io/device.c (original) +++ trunk/reactos/ntoskrnl/io/device.c Fri Jun 30 23:37:45 2006 @@ -1105,16 +1105,4 @@ } } -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoValidateDeviceIoControlAccess(IN PIRP Irp, - IN ULONG RequiredAccess) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - /* EOF */ Modified: trunk/reactos/ntoskrnl/io/file.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/file.c?rev=227…
============================================================================== --- trunk/reactos/ntoskrnl/io/file.c (original) +++ trunk/reactos/ntoskrnl/io/file.c Fri Jun 30 23:37:45 2006 @@ -1462,5 +1462,202 @@ FileInformation); } - +/* + * @unimplemented + */ +BOOLEAN STDCALL +IoFastQueryNetworkAttributes(IN POBJECT_ATTRIBUTES ObjectAttributes, + IN ACCESS_MASK DesiredAccess, + IN ULONG OpenOptions, + OUT PIO_STATUS_BLOCK IoStatus, + OUT PFILE_NETWORK_OPEN_INFORMATION Buffer) +{ + UNIMPLEMENTED; + return(FALSE); +} + +/* + * @implemented + */ +VOID STDCALL +IoUpdateShareAccess(PFILE_OBJECT FileObject, + PSHARE_ACCESS ShareAccess) +{ + PAGED_CODE(); + + if (FileObject->ReadAccess || + FileObject->WriteAccess || + FileObject->DeleteAccess) + { + ShareAccess->OpenCount++; + + ShareAccess->Readers += FileObject->ReadAccess; + ShareAccess->Writers += FileObject->WriteAccess; + ShareAccess->Deleters += FileObject->DeleteAccess; + ShareAccess->SharedRead += FileObject->SharedRead; + ShareAccess->SharedWrite += FileObject->SharedWrite; + ShareAccess->SharedDelete += FileObject->SharedDelete; + } +} + + +/* + * @implemented + */ +NTSTATUS STDCALL +IoCheckShareAccess(IN ACCESS_MASK DesiredAccess, + IN ULONG DesiredShareAccess, + IN PFILE_OBJECT FileObject, + IN PSHARE_ACCESS ShareAccess, + IN BOOLEAN Update) +{ + BOOLEAN ReadAccess; + BOOLEAN WriteAccess; + BOOLEAN DeleteAccess; + BOOLEAN SharedRead; + BOOLEAN SharedWrite; + BOOLEAN SharedDelete; + + PAGED_CODE(); + + ReadAccess = (DesiredAccess & (FILE_READ_DATA | FILE_EXECUTE)) != 0; + WriteAccess = (DesiredAccess & (FILE_WRITE_DATA | FILE_APPEND_DATA)) != 0; + DeleteAccess = (DesiredAccess & DELETE) != 0; + + FileObject->ReadAccess = ReadAccess; + FileObject->WriteAccess = WriteAccess; + FileObject->DeleteAccess = DeleteAccess; + + if (ReadAccess || WriteAccess || DeleteAccess) + { + SharedRead = (DesiredShareAccess & FILE_SHARE_READ) != 0; + SharedWrite = (DesiredShareAccess & FILE_SHARE_WRITE) != 0; + SharedDelete = (DesiredShareAccess & FILE_SHARE_DELETE) != 0; + + FileObject->SharedRead = SharedRead; + FileObject->SharedWrite = SharedWrite; + FileObject->SharedDelete = SharedDelete; + + if ((ReadAccess && (ShareAccess->SharedRead < ShareAccess->OpenCount)) || + (WriteAccess && (ShareAccess->SharedWrite < ShareAccess->OpenCount)) || + (DeleteAccess && (ShareAccess->SharedDelete < ShareAccess->OpenCount)) || + ((ShareAccess->Readers != 0) && !SharedRead) || + ((ShareAccess->Writers != 0) && !SharedWrite) || + ((ShareAccess->Deleters != 0) && !SharedDelete)) + { + return(STATUS_SHARING_VIOLATION); + } + + if (Update) + { + ShareAccess->OpenCount++; + + ShareAccess->Readers += ReadAccess; + ShareAccess->Writers += WriteAccess; + ShareAccess->Deleters += DeleteAccess; + ShareAccess->SharedRead += SharedRead; + ShareAccess->SharedWrite += SharedWrite; + ShareAccess->SharedDelete += SharedDelete; + } + } + + return(STATUS_SUCCESS); +} + + +/* + * @implemented + */ +VOID STDCALL +IoRemoveShareAccess(IN PFILE_OBJECT FileObject, + IN PSHARE_ACCESS ShareAccess) +{ + PAGED_CODE(); + + if (FileObject->ReadAccess || + FileObject->WriteAccess || + FileObject->DeleteAccess) + { + ShareAccess->OpenCount--; + + ShareAccess->Readers -= FileObject->ReadAccess; + ShareAccess->Writers -= FileObject->WriteAccess; + ShareAccess->Deleters -= FileObject->DeleteAccess; + ShareAccess->SharedRead -= FileObject->SharedRead; + ShareAccess->SharedWrite -= FileObject->SharedWrite; + ShareAccess->SharedDelete -= FileObject->SharedDelete; + } +} + + +/* + * @implemented + */ +VOID STDCALL +IoSetShareAccess(IN ACCESS_MASK DesiredAccess, + IN ULONG DesiredShareAccess, + IN PFILE_OBJECT FileObject, + OUT PSHARE_ACCESS ShareAccess) +{ + BOOLEAN ReadAccess; + BOOLEAN WriteAccess; + BOOLEAN DeleteAccess; + BOOLEAN SharedRead; + BOOLEAN SharedWrite; + BOOLEAN SharedDelete; + + PAGED_CODE(); + + ReadAccess = (DesiredAccess & (FILE_READ_DATA | FILE_EXECUTE)) != 0; + WriteAccess = (DesiredAccess & (FILE_WRITE_DATA | FILE_APPEND_DATA)) != 0; + DeleteAccess = (DesiredAccess & DELETE) != 0; + + FileObject->ReadAccess = ReadAccess; + FileObject->WriteAccess = WriteAccess; + FileObject->DeleteAccess = DeleteAccess; + + if (!ReadAccess && !WriteAccess && !DeleteAccess) + { + ShareAccess->OpenCount = 0; + ShareAccess->Readers = 0; + ShareAccess->Writers = 0; + ShareAccess->Deleters = 0; + + ShareAccess->SharedRead = 0; + ShareAccess->SharedWrite = 0; + ShareAccess->SharedDelete = 0; + } + else + { + SharedRead = (DesiredShareAccess & FILE_SHARE_READ) != 0; + SharedWrite = (DesiredShareAccess & FILE_SHARE_WRITE) != 0; + SharedDelete = (DesiredShareAccess & FILE_SHARE_DELETE) != 0; + + FileObject->SharedRead = SharedRead; + FileObject->SharedWrite = SharedWrite; + FileObject->SharedDelete = SharedDelete; + + ShareAccess->OpenCount = 1; + ShareAccess->Readers = ReadAccess; + ShareAccess->Writers = WriteAccess; + ShareAccess->Deleters = DeleteAccess; + + ShareAccess->SharedRead = SharedRead; + ShareAccess->SharedWrite = SharedWrite; + ShareAccess->SharedDelete = SharedDelete; + } +} + +/* + * @unimplemented + */ +VOID +STDCALL +IoCancelFileOpen( + IN PDEVICE_OBJECT DeviceObject, + IN PFILE_OBJECT FileObject + ) +{ + UNIMPLEMENTED; +} /* EOF */ Modified: trunk/reactos/ntoskrnl/io/fs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/fs.c?rev=22727…
============================================================================== --- trunk/reactos/ntoskrnl/io/fs.c (original) +++ trunk/reactos/ntoskrnl/io/fs.c Fri Jun 30 23:37:45 2006 @@ -47,19 +47,6 @@ /* FUNCTIONS *****************************************************************/ - -/* - * @unimplemented - */ -VOID -STDCALL -IoCancelFileOpen( - IN PDEVICE_OBJECT DeviceObject, - IN PFILE_OBJECT FileObject - ) -{ - UNIMPLEMENTED; -} VOID INIT_FUNCTION IoInitFileSystemImplementation(VOID) @@ -422,40 +409,6 @@ } -/* - * @implemented - */ -PDEVICE_OBJECT STDCALL -IoGetDeviceToVerify(IN PETHREAD Thread) -/* - * FUNCTION: Returns a pointer to the device, representing a removable-media - * device, that is the target of the given thread's I/O request - */ -{ - return(Thread->DeviceToVerify); -} - - -/* - * @implemented - */ -VOID STDCALL -IoSetDeviceToVerify(IN PETHREAD Thread, - IN PDEVICE_OBJECT DeviceObject) -{ - Thread->DeviceToVerify = DeviceObject; -} - - -/* - * @implemented - */ -VOID STDCALL -IoSetHardErrorOrVerifyDevice(IN PIRP Irp, - IN PDEVICE_OBJECT DeviceObject) -{ - Irp->Tail.Overlay.Thread->DeviceToVerify = DeviceObject; -} /* Modified: trunk/reactos/ntoskrnl/io/iofunc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iofunc.c?rev=2…
============================================================================== --- trunk/reactos/ntoskrnl/io/iofunc.c (original) +++ trunk/reactos/ntoskrnl/io/iofunc.c Fri Jun 30 23:37:45 2006 @@ -400,6 +400,84 @@ /* Return the Length and Status. ReturnedLength is NOT optional */ *ReturnedLength = IoStatusBlock.Information; return Status; +} + +/* + * @unimplemented + */ +NTSTATUS STDCALL +IoSetInformation(IN PFILE_OBJECT FileObject, + IN FILE_INFORMATION_CLASS FileInformationClass, + IN ULONG Length, + IN PVOID FileInformation) +{ + IO_STATUS_BLOCK IoStatusBlock; + PIRP Irp; + PDEVICE_OBJECT DeviceObject; + PIO_STACK_LOCATION StackPtr; + NTSTATUS Status; + + ASSERT(FileInformation != NULL); + + if (FileInformationClass == FileCompletionInformation) + { + return STATUS_NOT_IMPLEMENTED; + } + + + + Status = ObReferenceObjectByPointer(FileObject, + 0, /* FIXME - depends on the information class */ + IoFileObjectType, + KernelMode); + if (!NT_SUCCESS(Status)) + { + return(Status); + } + + DPRINT("FileObject 0x%p\n", FileObject); + + DeviceObject = FileObject->DeviceObject; + + Irp = IoAllocateIrp(DeviceObject->StackSize, + TRUE); + if (Irp == NULL) + { + ObDereferenceObject(FileObject); + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* Trigger FileObject/Event dereferencing */ + Irp->Tail.Overlay.OriginalFileObject = FileObject; + Irp->RequestorMode = KernelMode; + Irp->AssociatedIrp.SystemBuffer = FileInformation; + Irp->UserIosb = &IoStatusBlock; + Irp->UserEvent = &FileObject->Event; + Irp->Tail.Overlay.Thread = PsGetCurrentThread(); + KeResetEvent( &FileObject->Event ); + + StackPtr = IoGetNextIrpStackLocation(Irp); + StackPtr->MajorFunction = IRP_MJ_SET_INFORMATION; + StackPtr->MinorFunction = 0; + StackPtr->Flags = 0; + StackPtr->Control = 0; + StackPtr->DeviceObject = DeviceObject; + StackPtr->FileObject = FileObject; + StackPtr->Parameters.SetFile.FileInformationClass = FileInformationClass; + StackPtr->Parameters.SetFile.Length = Length; + + Status = IoCallDriver(FileObject->DeviceObject, Irp); + if (Status==STATUS_PENDING) + { + KeWaitForSingleObject(&FileObject->Event, + Executive, + KernelMode, + FileObject->Flags & FO_ALERTABLE_IO, + NULL); + Status = IoStatusBlock.Status; + } + + return Status; } /* NATIVE SERVICES ***********************************************************/ @@ -2342,3 +2420,4 @@ UNIMPLEMENTED; return(STATUS_NOT_IMPLEMENTED); } + Modified: trunk/reactos/ntoskrnl/io/iomgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr.c?rev=22…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr.c (original) +++ trunk/reactos/ntoskrnl/io/iomgr.c Fri Jun 30 23:37:45 2006 @@ -34,7 +34,6 @@ FILE_GENERIC_EXECUTE, FILE_ALL_ACCESS}; -static KSPIN_LOCK CancelSpinLock; extern LIST_ENTRY ShutdownListHead; extern KSPIN_LOCK ShutdownListLock; extern NPAGED_LOOKASIDE_LIST IoCompletionPacketLookaside; @@ -60,6 +59,7 @@ INIT_FUNCTION IoInitCancelHandling(VOID) { + extern KSPIN_LOCK CancelSpinLock; KeInitializeSpinLock(&CancelSpinLock); } @@ -479,88 +479,4 @@ NULL); } -/* FUNCTIONS *****************************************************************/ - -/* - * @implemented - */ -VOID -STDCALL -IoAcquireCancelSpinLock(PKIRQL Irql) -{ - KeAcquireSpinLock(&CancelSpinLock,Irql); -} - -/* - * @implemented - */ -PVOID -STDCALL -IoGetInitialStack(VOID) -{ - return(PsGetCurrentThread()->Tcb.InitialStack); -} - -/* - * @implemented - */ -VOID -STDCALL -IoGetStackLimits(OUT PULONG LowLimit, - OUT PULONG HighLimit) -{ - *LowLimit = (ULONG)NtCurrentTeb()->Tib.StackLimit; - *HighLimit = (ULONG)NtCurrentTeb()->Tib.StackBase; -} - -/* - * @implemented - */ -BOOLEAN -STDCALL -IoIsSystemThread(IN PETHREAD Thread) -{ - /* Call the Ps Function */ - return PsIsSystemThread(Thread); -} - -/* - * @implemented - */ -BOOLEAN STDCALL -IoIsWdmVersionAvailable(IN UCHAR MajorVersion, - IN UCHAR MinorVersion) -{ - /* MinorVersion = 0x20 : WinXP - 0x10 : Win2k - 0x5 : WinMe - <0x5 : Win98 - - We report Win2k now - */ - if (MajorVersion <= 1 && MinorVersion <= 0x10) - return TRUE; - return FALSE; -} - -/* - * @implemented - */ -VOID -STDCALL -IoReleaseCancelSpinLock(KIRQL Irql) -{ - KeReleaseSpinLock(&CancelSpinLock,Irql); -} - -/* - * @implemented - */ -PEPROCESS -STDCALL -IoThreadToProcess(IN PETHREAD Thread) -{ - return(Thread->ThreadsProcess); -} - /* EOF */ Modified: trunk/reactos/ntoskrnl/io/irp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/irp.c?rev=2272…
============================================================================== --- trunk/reactos/ntoskrnl/io/irp.c (original) +++ trunk/reactos/ntoskrnl/io/irp.c Fri Jun 30 23:37:45 2006 @@ -837,7 +837,7 @@ /* Sync IRPs are queued to requestor thread's irp cancel/cleanup list */ IoQueueThreadIrp(Irp); - return(Irp); + return Irp; } /* Removed: trunk/reactos/ntoskrnl/io/share.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/share.c?rev=22…
============================================================================== --- trunk/reactos/ntoskrnl/io/share.c (original) +++ trunk/reactos/ntoskrnl/io/share.c (removed) @@ -1,333 +1,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/share.c - * PURPOSE: No purpose listed. - * - * PROGRAMMERS: David Welch (welch(a)mcmail.com) - */ - -/* INCLUDES *****************************************************************/ - -#include <ntoskrnl.h> -#define NDEBUG -#include <internal/debug.h> - -/* FUNCTIONS *****************************************************************/ - -/* - * @implemented - */ -VOID STDCALL -IoUpdateShareAccess(PFILE_OBJECT FileObject, - PSHARE_ACCESS ShareAccess) -{ - PAGED_CODE(); - - if (FileObject->ReadAccess || - FileObject->WriteAccess || - FileObject->DeleteAccess) - { - ShareAccess->OpenCount++; - - ShareAccess->Readers += FileObject->ReadAccess; - ShareAccess->Writers += FileObject->WriteAccess; - ShareAccess->Deleters += FileObject->DeleteAccess; - ShareAccess->SharedRead += FileObject->SharedRead; - ShareAccess->SharedWrite += FileObject->SharedWrite; - ShareAccess->SharedDelete += FileObject->SharedDelete; - } -} - - -/* - * @implemented - */ -NTSTATUS STDCALL -IoCheckShareAccess(IN ACCESS_MASK DesiredAccess, - IN ULONG DesiredShareAccess, - IN PFILE_OBJECT FileObject, - IN PSHARE_ACCESS ShareAccess, - IN BOOLEAN Update) -{ - BOOLEAN ReadAccess; - BOOLEAN WriteAccess; - BOOLEAN DeleteAccess; - BOOLEAN SharedRead; - BOOLEAN SharedWrite; - BOOLEAN SharedDelete; - - PAGED_CODE(); - - ReadAccess = (DesiredAccess & (FILE_READ_DATA | FILE_EXECUTE)) != 0; - WriteAccess = (DesiredAccess & (FILE_WRITE_DATA | FILE_APPEND_DATA)) != 0; - DeleteAccess = (DesiredAccess & DELETE) != 0; - - FileObject->ReadAccess = ReadAccess; - FileObject->WriteAccess = WriteAccess; - FileObject->DeleteAccess = DeleteAccess; - - if (ReadAccess || WriteAccess || DeleteAccess) - { - SharedRead = (DesiredShareAccess & FILE_SHARE_READ) != 0; - SharedWrite = (DesiredShareAccess & FILE_SHARE_WRITE) != 0; - SharedDelete = (DesiredShareAccess & FILE_SHARE_DELETE) != 0; - - FileObject->SharedRead = SharedRead; - FileObject->SharedWrite = SharedWrite; - FileObject->SharedDelete = SharedDelete; - - if ((ReadAccess && (ShareAccess->SharedRead < ShareAccess->OpenCount)) || - (WriteAccess && (ShareAccess->SharedWrite < ShareAccess->OpenCount)) || - (DeleteAccess && (ShareAccess->SharedDelete < ShareAccess->OpenCount)) || - ((ShareAccess->Readers != 0) && !SharedRead) || - ((ShareAccess->Writers != 0) && !SharedWrite) || - ((ShareAccess->Deleters != 0) && !SharedDelete)) - { - return(STATUS_SHARING_VIOLATION); - } - - if (Update) - { - ShareAccess->OpenCount++; - - ShareAccess->Readers += ReadAccess; - ShareAccess->Writers += WriteAccess; - ShareAccess->Deleters += DeleteAccess; - ShareAccess->SharedRead += SharedRead; - ShareAccess->SharedWrite += SharedWrite; - ShareAccess->SharedDelete += SharedDelete; - } - } - - return(STATUS_SUCCESS); -} - - -/* - * @implemented - */ -VOID STDCALL -IoRemoveShareAccess(IN PFILE_OBJECT FileObject, - IN PSHARE_ACCESS ShareAccess) -{ - PAGED_CODE(); - - if (FileObject->ReadAccess || - FileObject->WriteAccess || - FileObject->DeleteAccess) - { - ShareAccess->OpenCount--; - - ShareAccess->Readers -= FileObject->ReadAccess; - ShareAccess->Writers -= FileObject->WriteAccess; - ShareAccess->Deleters -= FileObject->DeleteAccess; - ShareAccess->SharedRead -= FileObject->SharedRead; - ShareAccess->SharedWrite -= FileObject->SharedWrite; - ShareAccess->SharedDelete -= FileObject->SharedDelete; - } -} - - -/* - * @implemented - */ -VOID STDCALL -IoSetShareAccess(IN ACCESS_MASK DesiredAccess, - IN ULONG DesiredShareAccess, - IN PFILE_OBJECT FileObject, - OUT PSHARE_ACCESS ShareAccess) -{ - BOOLEAN ReadAccess; - BOOLEAN WriteAccess; - BOOLEAN DeleteAccess; - BOOLEAN SharedRead; - BOOLEAN SharedWrite; - BOOLEAN SharedDelete; - - PAGED_CODE(); - - ReadAccess = (DesiredAccess & (FILE_READ_DATA | FILE_EXECUTE)) != 0; - WriteAccess = (DesiredAccess & (FILE_WRITE_DATA | FILE_APPEND_DATA)) != 0; - DeleteAccess = (DesiredAccess & DELETE) != 0; - - FileObject->ReadAccess = ReadAccess; - FileObject->WriteAccess = WriteAccess; - FileObject->DeleteAccess = DeleteAccess; - - if (!ReadAccess && !WriteAccess && !DeleteAccess) - { - ShareAccess->OpenCount = 0; - ShareAccess->Readers = 0; - ShareAccess->Writers = 0; - ShareAccess->Deleters = 0; - - ShareAccess->SharedRead = 0; - ShareAccess->SharedWrite = 0; - ShareAccess->SharedDelete = 0; - } - else - { - SharedRead = (DesiredShareAccess & FILE_SHARE_READ) != 0; - SharedWrite = (DesiredShareAccess & FILE_SHARE_WRITE) != 0; - SharedDelete = (DesiredShareAccess & FILE_SHARE_DELETE) != 0; - - FileObject->SharedRead = SharedRead; - FileObject->SharedWrite = SharedWrite; - FileObject->SharedDelete = SharedDelete; - - ShareAccess->OpenCount = 1; - ShareAccess->Readers = ReadAccess; - ShareAccess->Writers = WriteAccess; - ShareAccess->Deleters = DeleteAccess; - - ShareAccess->SharedRead = SharedRead; - ShareAccess->SharedWrite = SharedWrite; - ShareAccess->SharedDelete = SharedDelete; - } -} - - -/* - * @implemented - */ -NTSTATUS STDCALL -IoCheckDesiredAccess(IN OUT PACCESS_MASK DesiredAccess, - IN ACCESS_MASK GrantedAccess) -{ - PAGED_CODE(); - - RtlMapGenericMask(DesiredAccess, - &IoFileObjectType->TypeInfo.GenericMapping); - - if ((~(*DesiredAccess) & GrantedAccess) != 0) - return STATUS_ACCESS_DENIED; - else - return STATUS_SUCCESS; -} - - -/* - * @unimplemented - */ -NTSTATUS STDCALL -IoCheckEaBufferValidity(IN PFILE_FULL_EA_INFORMATION EaBuffer, - IN ULONG EaLength, - OUT PULONG ErrorOffset) -{ - UNIMPLEMENTED; - return(STATUS_NOT_IMPLEMENTED); -} - - -/* - * @unimplemented - */ -NTSTATUS STDCALL -IoCheckFunctionAccess(IN ACCESS_MASK GrantedAccess, - IN UCHAR MajorFunction, - IN UCHAR MinorFunction, - IN ULONG IoControlCode, - IN PVOID ExtraData OPTIONAL, - IN PVOID ExtraData2 OPTIONAL) -{ - UNIMPLEMENTED; - return(STATUS_NOT_IMPLEMENTED); -} - - -/* - * @unimplemented - */ -NTSTATUS STDCALL -IoSetInformation(IN PFILE_OBJECT FileObject, - IN FILE_INFORMATION_CLASS FileInformationClass, - IN ULONG Length, - IN PVOID FileInformation) -{ - IO_STATUS_BLOCK IoStatusBlock; - PIRP Irp; - PDEVICE_OBJECT DeviceObject; - PIO_STACK_LOCATION StackPtr; - NTSTATUS Status; - - ASSERT(FileInformation != NULL); - - if (FileInformationClass == FileCompletionInformation) - { - return STATUS_NOT_IMPLEMENTED; - } - - - - Status = ObReferenceObjectByPointer(FileObject, - 0, /* FIXME - depends on the information class */ - IoFileObjectType, - KernelMode); - if (!NT_SUCCESS(Status)) - { - return(Status); - } - - DPRINT("FileObject 0x%p\n", FileObject); - - DeviceObject = FileObject->DeviceObject; - - Irp = IoAllocateIrp(DeviceObject->StackSize, - TRUE); - if (Irp == NULL) - { - ObDereferenceObject(FileObject); - return STATUS_INSUFFICIENT_RESOURCES; - } - - /* Trigger FileObject/Event dereferencing */ - Irp->Tail.Overlay.OriginalFileObject = FileObject; - Irp->RequestorMode = KernelMode; - Irp->AssociatedIrp.SystemBuffer = FileInformation; - Irp->UserIosb = &IoStatusBlock; - Irp->UserEvent = &FileObject->Event; - Irp->Tail.Overlay.Thread = PsGetCurrentThread(); - KeResetEvent( &FileObject->Event ); - - StackPtr = IoGetNextIrpStackLocation(Irp); - StackPtr->MajorFunction = IRP_MJ_SET_INFORMATION; - StackPtr->MinorFunction = 0; - StackPtr->Flags = 0; - StackPtr->Control = 0; - StackPtr->DeviceObject = DeviceObject; - StackPtr->FileObject = FileObject; - StackPtr->Parameters.SetFile.FileInformationClass = FileInformationClass; - StackPtr->Parameters.SetFile.Length = Length; - - Status = IoCallDriver(FileObject->DeviceObject, Irp); - if (Status==STATUS_PENDING) - { - KeWaitForSingleObject(&FileObject->Event, - Executive, - KernelMode, - FileObject->Flags & FO_ALERTABLE_IO, - NULL); - Status = IoStatusBlock.Status; - } - - return Status; -} - - -/* - * @unimplemented - */ -BOOLEAN STDCALL -IoFastQueryNetworkAttributes(IN POBJECT_ATTRIBUTES ObjectAttributes, - IN ACCESS_MASK DesiredAccess, - IN ULONG OpenOptions, - OUT PIO_STATUS_BLOCK IoStatus, - OUT PFILE_NETWORK_OPEN_INFORMATION Buffer) -{ - UNIMPLEMENTED; - return(FALSE); -} - -/* EOF */ Copied: trunk/reactos/ntoskrnl/io/util.c (from r22693, trunk/reactos/ntoskrnl/io/share.c) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/util.c?p2=trun…
============================================================================== --- trunk/reactos/ntoskrnl/io/share.c (original) +++ trunk/reactos/ntoskrnl/io/util.c Fri Jun 30 23:37:45 2006 @@ -1,11 +1,9 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/share.c - * PURPOSE: No purpose listed. - * - * PROGRAMMERS: David Welch (welch(a)mcmail.com) +/* + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory + * FILE: ntoskrnl/io/util.c + * PURPOSE: I/O Utility Functions + * PROGRAMMERS: <UNKNOWN> */ /* INCLUDES *****************************************************************/ @@ -14,180 +12,93 @@ #define NDEBUG #include <internal/debug.h> +/* DATA **********************************************************************/ + +KSPIN_LOCK CancelSpinLock; + /* FUNCTIONS *****************************************************************/ /* * @implemented */ -VOID STDCALL -IoUpdateShareAccess(PFILE_OBJECT FileObject, - PSHARE_ACCESS ShareAccess) +VOID +STDCALL +IoAcquireCancelSpinLock(PKIRQL Irql) { - PAGED_CODE(); - - if (FileObject->ReadAccess || - FileObject->WriteAccess || - FileObject->DeleteAccess) - { - ShareAccess->OpenCount++; - - ShareAccess->Readers += FileObject->ReadAccess; - ShareAccess->Writers += FileObject->WriteAccess; - ShareAccess->Deleters += FileObject->DeleteAccess; - ShareAccess->SharedRead += FileObject->SharedRead; - ShareAccess->SharedWrite += FileObject->SharedWrite; - ShareAccess->SharedDelete += FileObject->SharedDelete; - } + KeAcquireSpinLock(&CancelSpinLock,Irql); } - /* * @implemented */ -NTSTATUS STDCALL -IoCheckShareAccess(IN ACCESS_MASK DesiredAccess, - IN ULONG DesiredShareAccess, - IN PFILE_OBJECT FileObject, - IN PSHARE_ACCESS ShareAccess, - IN BOOLEAN Update) +PVOID +STDCALL +IoGetInitialStack(VOID) { - BOOLEAN ReadAccess; - BOOLEAN WriteAccess; - BOOLEAN DeleteAccess; - BOOLEAN SharedRead; - BOOLEAN SharedWrite; - BOOLEAN SharedDelete; - - PAGED_CODE(); - - ReadAccess = (DesiredAccess & (FILE_READ_DATA | FILE_EXECUTE)) != 0; - WriteAccess = (DesiredAccess & (FILE_WRITE_DATA | FILE_APPEND_DATA)) != 0; - DeleteAccess = (DesiredAccess & DELETE) != 0; - - FileObject->ReadAccess = ReadAccess; - FileObject->WriteAccess = WriteAccess; - FileObject->DeleteAccess = DeleteAccess; - - if (ReadAccess || WriteAccess || DeleteAccess) - { - SharedRead = (DesiredShareAccess & FILE_SHARE_READ) != 0; - SharedWrite = (DesiredShareAccess & FILE_SHARE_WRITE) != 0; - SharedDelete = (DesiredShareAccess & FILE_SHARE_DELETE) != 0; - - FileObject->SharedRead = SharedRead; - FileObject->SharedWrite = SharedWrite; - FileObject->SharedDelete = SharedDelete; - - if ((ReadAccess && (ShareAccess->SharedRead < ShareAccess->OpenCount)) || - (WriteAccess && (ShareAccess->SharedWrite < ShareAccess->OpenCount)) || - (DeleteAccess && (ShareAccess->SharedDelete < ShareAccess->OpenCount)) || - ((ShareAccess->Readers != 0) && !SharedRead) || - ((ShareAccess->Writers != 0) && !SharedWrite) || - ((ShareAccess->Deleters != 0) && !SharedDelete)) - { - return(STATUS_SHARING_VIOLATION); - } - - if (Update) - { - ShareAccess->OpenCount++; - - ShareAccess->Readers += ReadAccess; - ShareAccess->Writers += WriteAccess; - ShareAccess->Deleters += DeleteAccess; - ShareAccess->SharedRead += SharedRead; - ShareAccess->SharedWrite += SharedWrite; - ShareAccess->SharedDelete += SharedDelete; - } - } - - return(STATUS_SUCCESS); + return(PsGetCurrentThread()->Tcb.InitialStack); } - /* * @implemented */ -VOID STDCALL -IoRemoveShareAccess(IN PFILE_OBJECT FileObject, - IN PSHARE_ACCESS ShareAccess) +VOID +STDCALL +IoGetStackLimits(OUT PULONG LowLimit, + OUT PULONG HighLimit) { - PAGED_CODE(); - - if (FileObject->ReadAccess || - FileObject->WriteAccess || - FileObject->DeleteAccess) - { - ShareAccess->OpenCount--; - - ShareAccess->Readers -= FileObject->ReadAccess; - ShareAccess->Writers -= FileObject->WriteAccess; - ShareAccess->Deleters -= FileObject->DeleteAccess; - ShareAccess->SharedRead -= FileObject->SharedRead; - ShareAccess->SharedWrite -= FileObject->SharedWrite; - ShareAccess->SharedDelete -= FileObject->SharedDelete; - } + *LowLimit = (ULONG)NtCurrentTeb()->Tib.StackLimit; + *HighLimit = (ULONG)NtCurrentTeb()->Tib.StackBase; } - /* * @implemented */ -VOID STDCALL -IoSetShareAccess(IN ACCESS_MASK DesiredAccess, - IN ULONG DesiredShareAccess, - IN PFILE_OBJECT FileObject, - OUT PSHARE_ACCESS ShareAccess) +BOOLEAN +STDCALL +IoIsSystemThread(IN PETHREAD Thread) { - BOOLEAN ReadAccess; - BOOLEAN WriteAccess; - BOOLEAN DeleteAccess; - BOOLEAN SharedRead; - BOOLEAN SharedWrite; - BOOLEAN SharedDelete; - - PAGED_CODE(); - - ReadAccess = (DesiredAccess & (FILE_READ_DATA | FILE_EXECUTE)) != 0; - WriteAccess = (DesiredAccess & (FILE_WRITE_DATA | FILE_APPEND_DATA)) != 0; - DeleteAccess = (DesiredAccess & DELETE) != 0; - - FileObject->ReadAccess = ReadAccess; - FileObject->WriteAccess = WriteAccess; - FileObject->DeleteAccess = DeleteAccess; - - if (!ReadAccess && !WriteAccess && !DeleteAccess) - { - ShareAccess->OpenCount = 0; - ShareAccess->Readers = 0; - ShareAccess->Writers = 0; - ShareAccess->Deleters = 0; - - ShareAccess->SharedRead = 0; - ShareAccess->SharedWrite = 0; - ShareAccess->SharedDelete = 0; - } - else - { - SharedRead = (DesiredShareAccess & FILE_SHARE_READ) != 0; - SharedWrite = (DesiredShareAccess & FILE_SHARE_WRITE) != 0; - SharedDelete = (DesiredShareAccess & FILE_SHARE_DELETE) != 0; - - FileObject->SharedRead = SharedRead; - FileObject->SharedWrite = SharedWrite; - FileObject->SharedDelete = SharedDelete; - - ShareAccess->OpenCount = 1; - ShareAccess->Readers = ReadAccess; - ShareAccess->Writers = WriteAccess; - ShareAccess->Deleters = DeleteAccess; - - ShareAccess->SharedRead = SharedRead; - ShareAccess->SharedWrite = SharedWrite; - ShareAccess->SharedDelete = SharedDelete; - } + /* Call the Ps Function */ + return PsIsSystemThread(Thread); } +/* + * @implemented + */ +BOOLEAN STDCALL +IoIsWdmVersionAvailable(IN UCHAR MajorVersion, + IN UCHAR MinorVersion) +{ + /* MinorVersion = 0x20 : WinXP + 0x10 : Win2k + 0x5 : WinMe + <0x5 : Win98 + + We report Win2k now + */ + if (MajorVersion <= 1 && MinorVersion <= 0x10) + return TRUE; + return FALSE; +} + +/* + * @implemented + */ +VOID +STDCALL +IoReleaseCancelSpinLock(KIRQL Irql) +{ + KeReleaseSpinLock(&CancelSpinLock,Irql); +} + +/* + * @implemented + */ +PEPROCESS +STDCALL +IoThreadToProcess(IN PETHREAD Thread) +{ + return(Thread->ThreadsProcess); +} /* * @implemented @@ -236,98 +147,52 @@ return(STATUS_NOT_IMPLEMENTED); } - /* * @unimplemented */ -NTSTATUS STDCALL -IoSetInformation(IN PFILE_OBJECT FileObject, - IN FILE_INFORMATION_CLASS FileInformationClass, - IN ULONG Length, - IN PVOID FileInformation) +NTSTATUS +STDCALL +IoValidateDeviceIoControlAccess(IN PIRP Irp, + IN ULONG RequiredAccess) { - IO_STATUS_BLOCK IoStatusBlock; - PIRP Irp; - PDEVICE_OBJECT DeviceObject; - PIO_STACK_LOCATION StackPtr; - NTSTATUS Status; + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} - ASSERT(FileInformation != NULL); - - if (FileInformationClass == FileCompletionInformation) - { - return STATUS_NOT_IMPLEMENTED; - } - - - - Status = ObReferenceObjectByPointer(FileObject, - 0, /* FIXME - depends on the information class */ - IoFileObjectType, - KernelMode); - if (!NT_SUCCESS(Status)) - { - return(Status); - } - - DPRINT("FileObject 0x%p\n", FileObject); - - DeviceObject = FileObject->DeviceObject; - - Irp = IoAllocateIrp(DeviceObject->StackSize, - TRUE); - if (Irp == NULL) - { - ObDereferenceObject(FileObject); - return STATUS_INSUFFICIENT_RESOURCES; - } - - /* Trigger FileObject/Event dereferencing */ - Irp->Tail.Overlay.OriginalFileObject = FileObject; - Irp->RequestorMode = KernelMode; - Irp->AssociatedIrp.SystemBuffer = FileInformation; - Irp->UserIosb = &IoStatusBlock; - Irp->UserEvent = &FileObject->Event; - Irp->Tail.Overlay.Thread = PsGetCurrentThread(); - KeResetEvent( &FileObject->Event ); - - StackPtr = IoGetNextIrpStackLocation(Irp); - StackPtr->MajorFunction = IRP_MJ_SET_INFORMATION; - StackPtr->MinorFunction = 0; - StackPtr->Flags = 0; - StackPtr->Control = 0; - StackPtr->DeviceObject = DeviceObject; - StackPtr->FileObject = FileObject; - StackPtr->Parameters.SetFile.FileInformationClass = FileInformationClass; - StackPtr->Parameters.SetFile.Length = Length; - - Status = IoCallDriver(FileObject->DeviceObject, Irp); - if (Status==STATUS_PENDING) - { - KeWaitForSingleObject(&FileObject->Event, - Executive, - KernelMode, - FileObject->Flags & FO_ALERTABLE_IO, - NULL); - Status = IoStatusBlock.Status; - } - - return Status; +/* + * @implemented + */ +VOID STDCALL +IoSetDeviceToVerify(IN PETHREAD Thread, + IN PDEVICE_OBJECT DeviceObject) +{ + Thread->DeviceToVerify = DeviceObject; } /* - * @unimplemented + * @implemented */ -BOOLEAN STDCALL -IoFastQueryNetworkAttributes(IN POBJECT_ATTRIBUTES ObjectAttributes, - IN ACCESS_MASK DesiredAccess, - IN ULONG OpenOptions, - OUT PIO_STATUS_BLOCK IoStatus, - OUT PFILE_NETWORK_OPEN_INFORMATION Buffer) +VOID STDCALL +IoSetHardErrorOrVerifyDevice(IN PIRP Irp, + IN PDEVICE_OBJECT DeviceObject) { - UNIMPLEMENTED; - return(FALSE); + Irp->Tail.Overlay.Thread->DeviceToVerify = DeviceObject; } +/* + * @implemented + */ +PDEVICE_OBJECT STDCALL +IoGetDeviceToVerify(IN PETHREAD Thread) +/* + * FUNCTION: Returns a pointer to the device, representing a removable-media + * device, that is the target of the given thread's I/O request + */ +{ + return(Thread->DeviceToVerify); +} + + + /* EOF */ Modified: trunk/reactos/ntoskrnl/ntoskrnl.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl.rbuild?r…
============================================================================== --- trunk/reactos/ntoskrnl/ntoskrnl.rbuild (original) +++ trunk/reactos/ntoskrnl/ntoskrnl.rbuild Fri Jun 30 23:37:45 2006 @@ -189,7 +189,7 @@ <file>rawfs.c</file> <file>remlock.c</file> <file>resource.c</file> - <file>share.c</file> + <file>util.c</file> <file>symlink.c</file> <file>timer.c</file> <file>vpb.c</file>
18 years, 5 months
1
0
0
0
[ion] 22726: [AUDIT] - These are yet more < 10 line wrappers. [FORMATTING] - Fixup file headers, formatting and some comments.
by ion@svn.reactos.org
Author: ion Date: Fri Jun 30 23:09:39 2006 New Revision: 22726 URL:
http://svn.reactos.org/svn/reactos?rev=22726&view=rev
Log: [AUDIT] - These are yet more < 10 line wrappers. [FORMATTING] - Fixup file headers, formatting and some comments. Modified: trunk/reactos/ntoskrnl/io/adapter.c (contents, props changed) trunk/reactos/ntoskrnl/io/controller.c (contents, props changed) Modified: trunk/reactos/ntoskrnl/io/adapter.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/adapter.c?rev=…
============================================================================== --- trunk/reactos/ntoskrnl/io/adapter.c (original) +++ trunk/reactos/ntoskrnl/io/adapter.c Fri Jun 30 23:09:39 2006 @@ -1,11 +1,10 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel +/* + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory * FILE: ntoskrnl/io/adapter.c - * PURPOSE: DMA handling - * - * PROGRAMMERS: David Welch (welch(a)mcmail.com) + * PURPOSE: I/O Wrappers for HAL Adapter APIs + * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org) + * Filip Navara (navaraf(a)reactos.org) */ /* INCLUDES *****************************************************************/ @@ -16,34 +15,35 @@ /* DATA **********************************************************************/ -POBJECT_TYPE IoAdapterObjectType = NULL; /* FIXME */ -POBJECT_TYPE IoDeviceHandlerObjectType = NULL; /* FIXME */ -ULONG IoDeviceHandlerObjectSize = 0; /* FIXME */ +POBJECT_TYPE IoAdapterObjectType; +POBJECT_TYPE IoDeviceHandlerObjectType; +ULONG IoDeviceHandlerObjectSize; /* FUNCTIONS *****************************************************************/ /* * @implemented */ -NTSTATUS STDCALL -IoAllocateAdapterChannel (PADAPTER_OBJECT AdapterObject, - PDEVICE_OBJECT DeviceObject, - ULONG NumberOfMapRegisters, - PDRIVER_CONTROL ExecutionRoutine, - PVOID Context) +NTSTATUS +NTAPI +IoAllocateAdapterChannel(IN PADAPTER_OBJECT AdapterObject, + IN PDEVICE_OBJECT DeviceObject, + IN ULONG NumberOfMapRegisters, + IN PDRIVER_CONTROL ExecutionRoutine, + IN PVOID Context) { - DeviceObject->Queue.Wcb.DeviceObject = DeviceObject; - DeviceObject->Queue.Wcb.DeviceContext = Context; - DeviceObject->Queue.Wcb.CurrentIrp = DeviceObject->CurrentIrp; + PWAIT_CONTEXT_BLOCK Wcb = &DeviceObject->Queue.Wcb; - return HalAllocateAdapterChannel( AdapterObject, - &DeviceObject->Queue.Wcb, - NumberOfMapRegisters, - ExecutionRoutine); + /* Initialize the WCB */ + Wcb->DeviceObject = DeviceObject; + Wcb->DeviceContext = Context; + Wcb->CurrentIrp = DeviceObject->CurrentIrp; + + /* Call HAL */ + return HalAllocateAdapterChannel(AdapterObject, + Wcb, + NumberOfMapRegisters, + ExecutionRoutine); } - -/* NOTE: Missing IoXXXAdapter finctions in HAL.DLL */ - - /* EOF */ Propchange: trunk/reactos/ntoskrnl/io/adapter.c ------------------------------------------------------------------------------ --- svn:needs-lock (original) +++ svn:needs-lock (removed) @@ -1,1 +1,0 @@ -* Modified: trunk/reactos/ntoskrnl/io/controller.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/controller.c?r…
============================================================================== --- trunk/reactos/ntoskrnl/io/controller.c (original) +++ trunk/reactos/ntoskrnl/io/controller.c Fri Jun 30 23:09:39 2006 @@ -1,10 +1,9 @@ /* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/io/contrller.c - * PURPOSE: Implements the controller object - * - * PROGRAMMERS: Alex Ionescu (alex(a)relsoft.net) + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory + * FILE: ntoskrnl/io/controller.c + * PURPOSE: I/O Wrappers (called Controllers) for Kernel Device Queues + * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org) */ /* INCLUDES *****************************************************************/ @@ -20,27 +19,16 @@ /* * @implemented - * - * FUNCTION: Sets up a call to a driver-supplied ControllerControl routine - * as soon as the device controller, represented by the given controller - * object, is available to carry out an I/O operation for the target device, - * represented by the given device object. - * ARGUMENTS: - * ControllerObject = Driver created controller object - * DeviceObject = Target device for the current irp - * ExecutionRoutine = Routine to be called when the device is available - * Context = Driver supplied context to be passed on to the above routine */ VOID -STDCALL -IoAllocateController(PCONTROLLER_OBJECT ControllerObject, - PDEVICE_OBJECT DeviceObject, - PDRIVER_CONTROL ExecutionRoutine, - PVOID Context) +NTAPI +IoAllocateController(IN PCONTROLLER_OBJECT ControllerObject, + IN PDEVICE_OBJECT DeviceObject, + IN PDRIVER_CONTROL ExecutionRoutine, + IN PVOID Context) { IO_ALLOCATION_ACTION Result; - - ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL); + ASSERT_IRQL(DISPATCH_LEVEL); /* Initialize the Wait Context Block */ DeviceObject->Queue.Wcb.DeviceContext = Context; @@ -50,36 +38,29 @@ if (!KeInsertDeviceQueue(&ControllerObject->DeviceWaitQueue, &DeviceObject->Queue.Wcb.WaitQueueEntry)); { + /* Call the execution routine */ Result = ExecutionRoutine(DeviceObject, DeviceObject->CurrentIrp, NULL, Context); - } - if (Result == DeallocateObject) - { - IoFreeController(ControllerObject); + /* Free the controller if this was requested */ + if (Result == DeallocateObject) IoFreeController(ControllerObject); } } /* * @implemented - * - * FUNCTION: Allocates memory and initializes a controller object - * ARGUMENTS: - * Size = Size (in bytes) to be allocated for the controller extension - * RETURNS: A pointer to the created object */ PCONTROLLER_OBJECT -STDCALL -IoCreateController(ULONG Size) - +NTAPI +IoCreateController(IN ULONG Size) { PCONTROLLER_OBJECT Controller; OBJECT_ATTRIBUTES ObjectAttributes; HANDLE Handle; NTSTATUS Status; - ASSERT_IRQL(PASSIVE_LEVEL); + PAGED_CODE(); /* Initialize an empty OBA */ InitializeObjectAttributes(&ObjectAttributes, NULL, 0, NULL, NULL); @@ -123,15 +104,10 @@ /* * @implemented - * - * FUNCTION: Removes a given controller object from the system - * ARGUMENTS: - * ControllerObject = Controller object to be released */ VOID -STDCALL -IoDeleteController(PCONTROLLER_OBJECT ControllerObject) - +NTAPI +IoDeleteController(IN PCONTROLLER_OBJECT ControllerObject) { /* Just Dereference it */ ObDereferenceObject(ControllerObject); @@ -139,40 +115,33 @@ /* * @implemented - * - * FUNCTION: Releases a previously allocated controller object when a - * device has finished an I/O request - * ARGUMENTS: - * ControllerObject = Controller object to be released */ VOID -STDCALL -IoFreeController(PCONTROLLER_OBJECT ControllerObject) +NTAPI +IoFreeController(IN PCONTROLLER_OBJECT ControllerObject) { PKDEVICE_QUEUE_ENTRY QueueEntry; PDEVICE_OBJECT DeviceObject; IO_ALLOCATION_ACTION Result; /* Remove the Queue */ - if ((QueueEntry = KeRemoveDeviceQueue(&ControllerObject->DeviceWaitQueue))) + QueueEntry = KeRemoveDeviceQueue(&ControllerObject->DeviceWaitQueue); + if (QueueEntry) { /* Get the Device Object */ DeviceObject = CONTAINING_RECORD(QueueEntry, DEVICE_OBJECT, Queue.Wcb.WaitQueueEntry); + /* Call the routine */ Result = DeviceObject->Queue.Wcb.DeviceRoutine(DeviceObject, DeviceObject->CurrentIrp, NULL, - DeviceObject->Queue.Wcb.DeviceContext); - /* Check the result */ - if (Result == DeallocateObject) - { - /* Free it again */ - IoFreeController(ControllerObject); - } + DeviceObject-> + Queue.Wcb.DeviceContext); + /* Free the controller if this was requested */ + if (Result == DeallocateObject) IoFreeController(ControllerObject); } } - /* EOF */ Propchange: trunk/reactos/ntoskrnl/io/controller.c ------------------------------------------------------------------------------ --- svn:needs-lock (original) +++ svn:needs-lock (removed) @@ -1,1 +1,0 @@ -*
18 years, 5 months
1
0
0
0
[ion] 22725: [FORMATTING] - Tabs->spaces and proper prototype formatting.
by ion@svn.reactos.org
Author: ion Date: Fri Jun 30 23:01:01 2006 New Revision: 22725 URL:
http://svn.reactos.org/svn/reactos?rev=22725&view=rev
Log: [FORMATTING] - Tabs->spaces and proper prototype formatting. Modified: trunk/reactos/ntoskrnl/io/efi.c trunk/reactos/ntoskrnl/io/wmi.c Modified: trunk/reactos/ntoskrnl/io/efi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/efi.c?rev=2272…
============================================================================== --- trunk/reactos/ntoskrnl/io/efi.c (original) +++ trunk/reactos/ntoskrnl/io/efi.c Fri Jun 30 23:01:01 2006 @@ -1,107 +1,91 @@ /* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory * FILE: ntoskrnl/io/efi.c - * PURPOSE: EFI Unimplemented Function Calls - * - * PROGRAMMERS: Alex Ionescu (alex(a)relsoft.net) + * PURPOSE: I/O Functions for EFI Machines + * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org) */ /* INCLUDES *****************************************************************/ #include <ntoskrnl.h> +#define NDEBUG #include <internal/debug.h> /* FUNCTIONS *****************************************************************/ NTSTATUS -STDCALL -NtAddBootEntry( - IN PUNICODE_STRING EntryName, - IN PUNICODE_STRING EntryValue - ) +NTAPI +NtAddBootEntry(IN PUNICODE_STRING EntryName, + IN PUNICODE_STRING EntryValue) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; } NTSTATUS -STDCALL -NtDeleteBootEntry( - IN PUNICODE_STRING EntryName, - IN PUNICODE_STRING EntryValue - ) +NTAPI +NtDeleteBootEntry(IN PUNICODE_STRING EntryName, + IN PUNICODE_STRING EntryValue) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; } NTSTATUS -STDCALL -NtEnumerateBootEntries( - IN PVOID Buffer, - IN PULONG BufferLength - ) +NTAPI +NtEnumerateBootEntries(IN PVOID Buffer, + IN PULONG BufferLength) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; } NTSTATUS -STDCALL -NtQueryBootEntryOrder( - IN PULONG Ids, - IN PULONG Count - ) +NTAPI +NtQueryBootEntryOrder(IN PULONG Ids, + IN PULONG Count) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; } NTSTATUS -STDCALL -NtQueryBootOptions( - IN PBOOT_OPTIONS BootOptions, - IN PULONG BootOptionsLength - ) +NTAPI +NtQueryBootOptions(IN PBOOT_OPTIONS BootOptions, + IN PULONG BootOptionsLength) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; } NTSTATUS -STDCALL -NtSetBootEntryOrder( - IN PULONG Ids, - IN PULONG Count - ) +NTAPI +NtSetBootEntryOrder(IN PULONG Ids, + IN PULONG Count) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; } NTSTATUS -STDCALL -NtSetBootOptions( - IN PBOOT_OPTIONS BootOptions, - IN ULONG FieldsToChange - ) +NTAPI +NtSetBootOptions(IN PBOOT_OPTIONS BootOptions, + IN ULONG FieldsToChange) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; } NTSTATUS -STDCALL -NtTranslateFilePath( - PFILE_PATH InputFilePath, - ULONG OutputType, - PFILE_PATH OutputFilePath, - ULONG OutputFilePathLength - ) +NTAPI +NtTranslateFilePath(PFILE_PATH InputFilePath, + ULONG OutputType, + PFILE_PATH OutputFilePath, + ULONG OutputFilePathLength) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; } /* EOF */ Modified: trunk/reactos/ntoskrnl/io/wmi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/wmi.c?rev=2272…
============================================================================== --- trunk/reactos/ntoskrnl/io/wmi.c (original) +++ trunk/reactos/ntoskrnl/io/wmi.c Fri Jun 30 23:01:01 2006 @@ -1,11 +1,9 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel +/* + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory * FILE: ntoskrnl/io/wmi.c - * PURPOSE: Windows Management Instrumentation - * - * PROGRAMMERS: Alex Ionescu (alex(a)relsoft.net) + * PURPOSE: I/O Windows Management Instrumentation (WMI) Support + * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org) */ /* INCLUDES *****************************************************************/ @@ -20,240 +18,212 @@ * @unimplemented */ NTSTATUS -STDCALL -IoWMIRegistrationControl( - IN PDEVICE_OBJECT DeviceObject, - IN ULONG Action - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoWMIAllocateInstanceIds( - IN GUID *Guid, - IN ULONG InstanceCount, - OUT ULONG *FirstInstanceId - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoWMISuggestInstanceName( - IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL, - IN PUNICODE_STRING SymbolicLinkName OPTIONAL, - IN BOOLEAN CombineNames, - OUT PUNICODE_STRING SuggestedInstanceName - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoWMIWriteEvent( - IN PVOID WnodeEventItem - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL IoWMIOpenBlock( - IN GUID *DataBlockGuid, - IN ULONG DesiredAccess, - OUT PVOID *DataBlockObject - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL IoWMIQueryAllData( - IN PVOID DataBlockObject, - IN OUT ULONG *InOutBufferSize, - OUT PVOID OutBuffer -) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoWMIQueryAllDataMultiple( - IN PVOID *DataBlockObjectList, - IN ULONG ObjectCount, - IN OUT ULONG *InOutBufferSize, - OUT PVOID OutBuffer -) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoWMIQuerySingleInstance( - IN PVOID DataBlockObject, - IN PUNICODE_STRING InstanceName, - IN OUT ULONG *InOutBufferSize, - OUT PVOID OutBuffer -) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoWMIQuerySingleInstanceMultiple( - IN PVOID *DataBlockObjectList, - IN PUNICODE_STRING InstanceNames, - IN ULONG ObjectCount, - IN OUT ULONG *InOutBufferSize, - OUT PVOID OutBuffer -) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoWMISetSingleInstance( - IN PVOID DataBlockObject, - IN PUNICODE_STRING InstanceName, - IN ULONG Version, - IN ULONG ValueBufferSize, - IN PVOID ValueBuffer - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoWMISetSingleItem( - IN PVOID DataBlockObject, - IN PUNICODE_STRING InstanceName, - IN ULONG DataItemId, - IN ULONG Version, - IN ULONG ValueBufferSize, - IN PVOID ValueBuffer - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoWMIExecuteMethod( - IN PVOID DataBlockObject, - IN PUNICODE_STRING InstanceName, - IN ULONG MethodId, - IN ULONG InBufferSize, - IN OUT PULONG OutBufferSize, - IN OUT PUCHAR InOutBuffer - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoWMISetNotificationCallback( - IN PVOID Object, - IN WMI_NOTIFICATION_CALLBACK Callback, - IN PVOID Context - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoWMIHandleToInstanceName( - IN PVOID DataBlockObject, - IN HANDLE FileHandle, - OUT PUNICODE_STRING InstanceName - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -IoWMIDeviceObjectToInstanceName( - IN PVOID DataBlockObject, - IN PDEVICE_OBJECT DeviceObject, - OUT PUNICODE_STRING InstanceName - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* - * @unimplemented - */ -NTSTATUS -STDCALL +NTAPI +IoWMIRegistrationControl(IN PDEVICE_OBJECT DeviceObject, + IN ULONG Action) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @unimplemented + */ +NTSTATUS +NTAPI +IoWMIAllocateInstanceIds(IN GUID *Guid, + IN ULONG InstanceCount, + OUT ULONG *FirstInstanceId) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @unimplemented + */ +NTSTATUS +NTAPI +IoWMISuggestInstanceName(IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL, + IN PUNICODE_STRING SymbolicLinkName OPTIONAL, + IN BOOLEAN CombineNames, + OUT PUNICODE_STRING SuggestedInstanceName) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @unimplemented + */ +NTSTATUS +NTAPI +IoWMIWriteEvent(IN PVOID WnodeEventItem) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @unimplemented + */ +NTSTATUS +NTAPI +IoWMIOpenBlock(IN GUID *DataBlockGuid, + IN ULONG DesiredAccess, + OUT PVOID *DataBlockObject) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @unimplemented + */ +NTSTATUS +NTAPI +IoWMIQueryAllData(IN PVOID DataBlockObject, + IN OUT ULONG *InOutBufferSize, + OUT PVOID OutBuffer) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @unimplemented + */ +NTSTATUS +NTAPI +IoWMIQueryAllDataMultiple(IN PVOID *DataBlockObjectList, + IN ULONG ObjectCount, + IN OUT ULONG *InOutBufferSize, + OUT PVOID OutBuffer) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @unimplemented + */ +NTSTATUS +NTAPI +IoWMIQuerySingleInstance(IN PVOID DataBlockObject, + IN PUNICODE_STRING InstanceName, + IN OUT ULONG *InOutBufferSize, + OUT PVOID OutBuffer) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @unimplemented + */ +NTSTATUS +NTAPI +IoWMIQuerySingleInstanceMultiple(IN PVOID *DataBlockObjectList, + IN PUNICODE_STRING InstanceNames, + IN ULONG ObjectCount, + IN OUT ULONG *InOutBufferSize, + OUT PVOID OutBuffer) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @unimplemented + */ +NTSTATUS +NTAPI +IoWMISetSingleInstance(IN PVOID DataBlockObject, + IN PUNICODE_STRING InstanceName, + IN ULONG Version, + IN ULONG ValueBufferSize, + IN PVOID ValueBuffer) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @unimplemented + */ +NTSTATUS +NTAPI +IoWMISetSingleItem(IN PVOID DataBlockObject, + IN PUNICODE_STRING InstanceName, + IN ULONG DataItemId, + IN ULONG Version, + IN ULONG ValueBufferSize, + IN PVOID ValueBuffer) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @unimplemented + */ +NTSTATUS +NTAPI +IoWMIExecuteMethod(IN PVOID DataBlockObject, + IN PUNICODE_STRING InstanceName, + IN ULONG MethodId, + IN ULONG InBufferSize, + IN OUT PULONG OutBufferSize, + IN OUT PUCHAR InOutBuffer) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @unimplemented + */ +NTSTATUS +NTAPI +IoWMISetNotificationCallback(IN PVOID Object, + IN WMI_NOTIFICATION_CALLBACK Callback, + IN PVOID Context) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @unimplemented + */ +NTSTATUS +NTAPI +IoWMIHandleToInstanceName(IN PVOID DataBlockObject, + IN HANDLE FileHandle, + OUT PUNICODE_STRING InstanceName) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @unimplemented + */ +NTSTATUS +NTAPI +IoWMIDeviceObjectToInstanceName(IN PVOID DataBlockObject, + IN PDEVICE_OBJECT DeviceObject, + OUT PUNICODE_STRING InstanceName) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @unimplemented + */ +NTSTATUS +NTAPI NtTraceEvent(IN ULONG TraceHandle, IN ULONG Flags, IN ULONG TraceHeaderLength,
18 years, 5 months
1
0
0
0
[ion] 22724: [AUDIT] - Irq.c is another lame wrapper. - Remlock's code was written by Filip Navara and is clean. My additions are based on wdm.h and only add size checks and fix two visible bugs. - Add basic support/detection for debug I/O remove blocks (we bugcheck if we identify one though). - Simplify IoReleaseRemoveLockAndWaitEx - Remove locks are SYNCH events, not Notification events! - Make sure IoConnectInterrupt returns NULL to the caller on failure.
by ion@svn.reactos.org
Author: ion Date: Fri Jun 30 22:54:34 2006 New Revision: 22724 URL:
http://svn.reactos.org/svn/reactos?rev=22724&view=rev
Log: [AUDIT] - Irq.c is another lame wrapper. - Remlock's code was written by Filip Navara and is clean. My additions are based on wdm.h and only add size checks and fix two visible bugs. - Add basic support/detection for debug I/O remove blocks (we bugcheck if we identify one though). - Simplify IoReleaseRemoveLockAndWaitEx - Remove locks are SYNCH events, not Notification events! - Make sure IoConnectInterrupt returns NULL to the caller on failure. Modified: trunk/reactos/ntoskrnl/include/internal/io.h trunk/reactos/ntoskrnl/io/irq.c (contents, props changed) trunk/reactos/ntoskrnl/io/remlock.c (contents, props changed) Modified: trunk/reactos/ntoskrnl/include/internal/io.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/io.h (original) +++ trunk/reactos/ntoskrnl/include/internal/io.h Fri Jun 30 22:54:34 2006 @@ -207,6 +207,27 @@ PIO_WORKITEM_ROUTINE WorkerRoutine; PVOID Context; } IO_WORKITEM, *PIO_WORKITEM; + +// +// I/O Wrapper around the Kernel Interrupt +// +typedef struct _IO_INTERRUPT +{ + KINTERRUPT FirstInterrupt; + PKINTERRUPT Interrupt[MAXIMUM_PROCESSORS]; + KSPIN_LOCK SpinLock; +} IO_INTERRUPT, *PIO_INTERRUPT; + +// +// To simplify matters, the kernel is made to support both the checked and free +// version of the I/O Remove Lock in the same binary. This structure includes +// both, since the DDK has the structure with a compile-time #ifdef. +// +typedef struct _EXTENDED_IO_REMOVE_LOCK +{ + IO_REMOVE_LOCK_COMMON_BLOCK Common; + IO_REMOVE_LOCK_DBG_BLOCK Dbg; +} EXTENDED_IO_REMOVE_LOCK, *PEXTENDED_IO_REMOVE_LOCK; // // Dummy File Object used inside the Open Packet so that OB knows how to Modified: trunk/reactos/ntoskrnl/io/irq.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/irq.c?rev=2272…
============================================================================== --- trunk/reactos/ntoskrnl/io/irq.c (original) +++ trunk/reactos/ntoskrnl/io/irq.c Fri Jun 30 22:54:34 2006 @@ -1,11 +1,9 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel +/* + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory * FILE: ntoskrnl/io/irq.c - * PURPOSE: IRQ handling - * - * PROGRAMMERS: David Welch (welch(a)mcmail.com) + * PURPOSE: I/O Wrappers (called Completion Ports) for Kernel Queues + * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org) */ /* INCLUDES *****************************************************************/ @@ -14,58 +12,24 @@ #define NDEBUG #include <internal/debug.h> -/* TYPES ********************************************************************/ -typedef struct _IO_INTERRUPT -{ - KINTERRUPT FirstInterrupt; - PKINTERRUPT Interrupt[MAXIMUM_PROCESSORS]; - KSPIN_LOCK SpinLock; -} IO_INTERRUPT, *PIO_INTERRUPT; - /* FUNCTIONS *****************************************************************/ /* - * FUNCTION: Registers a driver's isr to be called when its device interrupts - * ARGUMENTS: - * InterruptObject (OUT) = Points to the interrupt object created on - * return - * ServiceRoutine = Routine to be called when the device interrupts - * ServiceContext = Parameter to be passed to ServiceRoutine - * SpinLock = Initalized spinlock that will be used to synchronize - * access between the isr and other driver routines. This is - * required if the isr handles more than one vector or the - * driver has more than one isr - * Vector = Interrupt vector to allocate - * (returned from HalGetInterruptVector) - * Irql = DIRQL returned from HalGetInterruptVector - * SynchronizeIrql = DIRQL at which the isr will execute. This must - * be the highest of all the DIRQLs returned from - * HalGetInterruptVector if the driver has multiple - * isrs - * InterruptMode = Specifies if the interrupt is LevelSensitive or - * Latched - * ShareVector = Specifies if the vector can be shared - * ProcessorEnableMask = Processors on the isr can run - * FloatingSave = TRUE if the floating point stack should be saved when - * the isr runs. Must be false for x86 drivers - * RETURNS: Status - * IRQL: PASSIVE_LEVEL - * * @implemented */ -NTSTATUS -STDCALL -IoConnectInterrupt(PKINTERRUPT* InterruptObject, - PKSERVICE_ROUTINE ServiceRoutine, - PVOID ServiceContext, - PKSPIN_LOCK SpinLock, - ULONG Vector, - KIRQL Irql, - KIRQL SynchronizeIrql, - KINTERRUPT_MODE InterruptMode, - BOOLEAN ShareVector, - KAFFINITY ProcessorEnableMask, - BOOLEAN FloatingSave) +NTSTATUS +NTAPI +IoConnectInterrupt(OUT PKINTERRUPT *InterruptObject, + IN PKSERVICE_ROUTINE ServiceRoutine, + IN PVOID ServiceContext, + IN PKSPIN_LOCK SpinLock, + IN ULONG Vector, + IN KIRQL Irql, + IN KIRQL SynchronizeIrql, + IN KINTERRUPT_MODE InterruptMode, + IN BOOLEAN ShareVector, + IN KAFFINITY ProcessorEnableMask, + IN BOOLEAN FloatingSave) { PKINTERRUPT Interrupt; PKINTERRUPT InterruptUsed; @@ -74,10 +38,10 @@ BOOLEAN FirstRun = TRUE; ULONG count; LONG i; - PAGED_CODE(); - DPRINT("IoConnectInterrupt(Vector %x)\n",Vector); + /* Assume failure */ + *InterruptObject = NULL; /* Convert the Mask */ ProcessorEnableMask &= ((1 << KeNumberProcessors) - 1); @@ -90,32 +54,25 @@ { if (ProcessorEnableMask & (1 << i)) count++; } - + /* Allocate the array of I/O Interrupts */ IoInterrupt = ExAllocatePoolWithTag(NonPagedPool, (count - 1)* sizeof(KINTERRUPT) + sizeof(IO_INTERRUPT), TAG_KINTERRUPT); - if (!IoInterrupt) return(STATUS_INSUFFICIENT_RESOURCES); + if (!IoInterrupt) return STATUS_INSUFFICIENT_RESOURCES; /* Select which Spinlock to use */ - if (SpinLock) - { - SpinLockUsed = SpinLock; - } - else - { - SpinLockUsed = &IoInterrupt->SpinLock; - } - + SpinLockUsed = SpinLock ? SpinLock : &IoInterrupt->SpinLock; + /* We first start with a built-in Interrupt inside the I/O Structure */ *InterruptObject = &IoInterrupt->FirstInterrupt; Interrupt = (PKINTERRUPT)(IoInterrupt + 1); FirstRun = TRUE; - + /* Start with a fresh structure */ RtlZeroMemory(IoInterrupt, sizeof(IO_INTERRUPT)); - + /* Now create all the interrupts */ for (i = 0; i < KeNumberProcessors; i++) { @@ -124,7 +81,7 @@ { /* Check which one we will use */ InterruptUsed = FirstRun ? &IoInterrupt->FirstInterrupt : Interrupt; - + /* Initialize it */ KeInitializeInterrupt(InterruptUsed, ServiceRoutine, @@ -137,7 +94,7 @@ ShareVector, i, FloatingSave); - + /* Connect it */ if (!KeConnectInterrupt(InterruptUsed)) { @@ -152,9 +109,11 @@ /* Far enough, so disconnect everything */ IoDisconnectInterrupt(&IoInterrupt->FirstInterrupt); } + + /* And fail */ return STATUS_INVALID_PARAMETER; } - + /* Now we've used up our First Run */ if (FirstRun) { @@ -173,39 +132,35 @@ } /* - * FUNCTION: Releases a drivers isr - * ARGUMENTS: - * InterruptObject = isr to release - * * @implemented */ VOID -STDCALL +NTAPI IoDisconnectInterrupt(PKINTERRUPT InterruptObject) - { LONG i; PIO_INTERRUPT IoInterrupt; - PAGED_CODE(); - + /* Get the I/O Interrupt */ - IoInterrupt = CONTAINING_RECORD(InterruptObject, - IO_INTERRUPT, + IoInterrupt = CONTAINING_RECORD(InterruptObject, + IO_INTERRUPT, FirstInterrupt); - + /* Disconnect the first one */ KeDisconnectInterrupt(&IoInterrupt->FirstInterrupt); /* Now disconnect the others */ for (i = 0; i < KeNumberProcessors; i++) { + /* Make sure one was registered */ if (IoInterrupt->Interrupt[i]) { + /* Disconnect it */ KeDisconnectInterrupt(&InterruptObject[i]); } } - + /* Free the I/O Interrupt */ ExFreePool(IoInterrupt); } Propchange: trunk/reactos/ntoskrnl/io/irq.c ------------------------------------------------------------------------------ --- svn:needs-lock (original) +++ svn:needs-lock (removed) @@ -1,1 +1,0 @@ -* Modified: trunk/reactos/ntoskrnl/io/remlock.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/remlock.c?rev=…
============================================================================== --- trunk/reactos/ntoskrnl/io/remlock.c (original) +++ trunk/reactos/ntoskrnl/io/remlock.c Fri Jun 30 22:54:34 2006 @@ -1,17 +1,16 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel +/* + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory * FILE: ntoskrnl/io/remlock.c - * PURPOSE: Remove Lock functions - * - * PROGRAMMERS: Filip Navara (xnavara(a)volny.cz) + * PURPOSE: Remove Lock Support + * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org) + * Filip Navara (navaraf(a)reactos.org) */ /* INCLUDES ******************************************************************/ +#include <ntoskrnl.h> #define NDEBUG -#include <ntoskrnl.h> #include <internal/debug.h> /* FUNCTIONS *****************************************************************/ @@ -20,81 +19,139 @@ * @implemented */ VOID -STDCALL -IoInitializeRemoveLockEx( - IN PIO_REMOVE_LOCK RemoveLock, - IN ULONG AllocateTag, - IN ULONG MaxLockedMinutes, - IN ULONG HighWatermark, - IN ULONG RemlockSize) +NTAPI +IoInitializeRemoveLockEx(IN PIO_REMOVE_LOCK RemoveLock, + IN ULONG AllocateTag, + IN ULONG MaxLockedMinutes, + IN ULONG HighWatermark, + IN ULONG RemlockSize) { - DPRINT("IoInitializeRemoveLockEx called\n"); - RtlZeroMemory(RemoveLock, RemlockSize); - RemoveLock->Common.IoCount = 1; - KeInitializeEvent(&RemoveLock->Common.RemoveEvent, NotificationEvent, FALSE); + PEXTENDED_IO_REMOVE_LOCK Lock = (PEXTENDED_IO_REMOVE_LOCK)RemoveLock; + PAGED_CODE(); + + /* Check if this is a debug lock */ + if (RemlockSize == sizeof(IO_REMOVE_LOCK_DBG_BLOCK)) + { + /* Clear the lock */ + RtlZeroMemory(Lock, RemlockSize); + + /* Setup debug parameters */ + Lock->Dbg.HighWatermark = HighWatermark; + Lock->Dbg.MaxLockedTicks = MaxLockedMinutes * 600000000; + Lock->Dbg.AllocateTag = AllocateTag; + KeInitializeSpinLock(&Lock->Dbg.Spin); + } + else + { + /* Otherwise, setup a free block */ + Lock->Common.Removed = FALSE; + Lock->Common.IoCount = 1; + KeInitializeEvent(&Lock->Common.RemoveEvent, + SynchronizationEvent, + FALSE); + } } /* * @implemented */ NTSTATUS -STDCALL -IoAcquireRemoveLockEx( - IN PIO_REMOVE_LOCK RemoveLock, - IN OPTIONAL PVOID Tag, - IN LPCSTR File, - IN ULONG Line, - IN ULONG RemlockSize) +NTAPI +IoAcquireRemoveLockEx(IN PIO_REMOVE_LOCK RemoveLock, + IN OPTIONAL PVOID Tag, + IN LPCSTR File, + IN ULONG Line, + IN ULONG RemlockSize) { - DPRINT("IoAcquireRemoveLockEx called\n"); - InterlockedIncrement(&RemoveLock->Common.IoCount); - if (RemoveLock->Common.Removed) - { - if (InterlockedDecrement(&RemoveLock->Common.IoCount) == 0) + PEXTENDED_IO_REMOVE_LOCK Lock = (PEXTENDED_IO_REMOVE_LOCK)RemoveLock; + + /* Increase the lock count */ + InterlockedIncrement(&Lock->Common.IoCount); + if (!Lock->Common.Removed) { - KeSetEvent(&RemoveLock->Common.RemoveEvent, IO_NO_INCREMENT, FALSE); + /* Check what kind of lock this is */ + if (RemlockSize == sizeof(IO_REMOVE_LOCK_DBG_BLOCK)) + { + /* FIXME: Not yet supported */ + DPRINT1("UNIMPLEMENTED\n"); + KEBUGCHECK(0); + } } - return STATUS_DELETE_PENDING; - } - return STATUS_SUCCESS; + else + { + /* Otherwise, decrement the count and check if it's gone */ + if (!InterlockedDecrement(&Lock->Common.IoCount)) + { + /* Signal the event */ + KeSetEvent(&Lock->Common.RemoveEvent, IO_NO_INCREMENT, FALSE); + } + + /* Return pending delete */ + return STATUS_DELETE_PENDING; + } + + /* Otherwise, return success */ + return STATUS_SUCCESS; } /* * @implemented */ VOID -STDCALL -IoReleaseRemoveLockEx( - IN PIO_REMOVE_LOCK RemoveLock, - IN PVOID Tag, - IN ULONG RemlockSize) +NTAPI +IoReleaseRemoveLockEx(IN PIO_REMOVE_LOCK RemoveLock, + IN PVOID Tag, + IN ULONG RemlockSize) { - LONG IoCount; + PEXTENDED_IO_REMOVE_LOCK Lock = (PEXTENDED_IO_REMOVE_LOCK)RemoveLock; - DPRINT("IoReleaseRemoveLockEx called\n"); - IoCount = InterlockedDecrement(&RemoveLock->Common.IoCount); - if (IoCount == 0) - { - KeSetEvent(&RemoveLock->Common.RemoveEvent, IO_NO_INCREMENT, FALSE); - } + /* Check what kind of lock this is */ + if (RemlockSize == sizeof(IO_REMOVE_LOCK_DBG_BLOCK)) + { + /* FIXME: Not yet supported */ + DPRINT1("UNIMPLEMENTED\n"); + KEBUGCHECK(0); + } + + /* Decrement the lock count */ + if (!InterlockedDecrement(&Lock->Common.IoCount)); + { + /* Signal the event */ + KeSetEvent(&Lock->Common.RemoveEvent, IO_NO_INCREMENT, FALSE); + } } /* * @implemented */ VOID -STDCALL -IoReleaseRemoveLockAndWaitEx( - IN PIO_REMOVE_LOCK RemoveLock, - IN PVOID Tag, - IN ULONG RemlockSize) +NTAPI +IoReleaseRemoveLockAndWaitEx(IN PIO_REMOVE_LOCK RemoveLock, + IN PVOID Tag, + IN ULONG RemlockSize) { - DPRINT("IoReleaseRemoveLockAndWaitEx called\n"); - RemoveLock->Common.Removed = TRUE; - InterlockedDecrement(&RemoveLock->Common.IoCount); - IoReleaseRemoveLockEx(RemoveLock, Tag, RemlockSize); - KeWaitForSingleObject(&RemoveLock->Common.RemoveEvent, Executive, KernelMode, - FALSE, NULL); + PEXTENDED_IO_REMOVE_LOCK Lock = (PEXTENDED_IO_REMOVE_LOCK)RemoveLock; + PAGED_CODE(); + + /* Remove the lock and decrement the count */ + Lock->Common.Removed = TRUE; + if (InterlockedDecrement(&Lock->Common.IoCount) > 0) + { + /* Wait for it */ + KeWaitForSingleObject(&Lock->Common.RemoveEvent, + Executive, + KernelMode, + FALSE, + NULL); + } + + /* Check what kind of lock this is */ + if (RemlockSize == sizeof(IO_REMOVE_LOCK_DBG_BLOCK)) + { + /* FIXME: Not yet supported */ + DPRINT1("UNIMPLEMENTED\n"); + KEBUGCHECK(0); + } } /* EOF */ Propchange: trunk/reactos/ntoskrnl/io/remlock.c ------------------------------------------------------------------------------ --- svn:needs-lock (original) +++ svn:needs-lock (removed) @@ -1,1 +1,0 @@ -*
18 years, 5 months
1
0
0
0
← Newer
1
2
3
4
...
60
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
52
53
54
55
56
57
58
59
60
Results per page:
10
25
50
100
200