Author: fireball
Date: Tue Jul 10 20:58:34 2012
New Revision: 56863
URL: http://svn.reactos.org/svn/reactos?rev=56863&view=rev
Log:
[SCSIPORT]
- Don't stop enumerating functions of a PCI device if current function returned invalid vendor id. Also add a check for returned data size. This fixes detection of some storage controllers, e.g. Intel ICH8, ICH9, ICH10 chipsets.
Thanks to Alter (UniATA author) for finding the problem and providing solution.
See issue #7147 for more details.
Modified:
trunk/reactos/drivers/storage/scsiport/scsiport.c
Modified: trunk/reactos/drivers/storage/scsiport/scsiport.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/scsiport/s…
==============================================================================
--- trunk/reactos/drivers/storage/scsiport/scsiport.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/storage/scsiport/scsiport.c [iso-8859-1] Tue Jul 10 20:58:34 2012
@@ -2350,10 +2350,13 @@
if (DataSize == 0)
return FALSE;
- /* If result is PCI_INVALID_VENDORID, then this device has no more
- "Functions" */
- if (PciConfig.VendorID == PCI_INVALID_VENDORID)
- break;
+ /* Check if result is PCI_INVALID_VENDORID or too small */
+ if ((DataSize < (ULONG)PCI_COMMON_HDR_LENGTH) ||
+ (PciConfig.VendorID == PCI_INVALID_VENDORID))
+ {
+ /* Continue to try the next function */
+ continue;
+ }
sprintf (VendorIdString, "%04hx", PciConfig.VendorID);
sprintf (DeviceIdString, "%04hx", PciConfig.DeviceID);
Author: ekohl
Date: Sun Jul 8 23:08:19 2012
New Revision: 56861
URL: http://svn.reactos.org/svn/reactos?rev=56861&view=rev
Log:
[SERVICES]
Correct comments and code error introduced in rev 56844.
Patch by Hermes Belusca.
I used a helper variable to determine whether or not ScmDeleteNamedPipeCriticalSection must be called. Changing the order in which functions are called could cause a deadlock.
See issue #7172 for more details.
Modified:
trunk/reactos/base/system/services/lock.c
trunk/reactos/base/system/services/rpcserver.c
trunk/reactos/base/system/services/services.c
Modified: trunk/reactos/base/system/services/lock.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/lock.…
==============================================================================
--- trunk/reactos/base/system/services/lock.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/services/lock.c [iso-8859-1] Sun Jul 8 23:08:19 2012
@@ -22,9 +22,9 @@
/* FUNCTIONS *****************************************************************/
/*
- * TRUE if locked by the Service Control Manager, FALSE otherwise
+ * NOTE: IsServiceController is TRUE if locked by the
+ * Service Control Manager, and FALSE otherwise.
*/
-
DWORD
ScmAcquireServiceStartLock(IN BOOL IsServiceController,
OUT LPSC_RPC_LOCK lpLock)
@@ -146,7 +146,7 @@
lpLockStatus->dwLockDuration = 0;
}
- /* Unlock the whole SC manager */
+ /* Unlock the service database */
ScmUnlockDatabase();
return;
@@ -178,7 +178,7 @@
lpLockStatus->dwLockDuration = 0;
}
- /* Unlock the whole SC manager */
+ /* Unlock the service database */
ScmUnlockDatabase();
return;
Modified: trunk/reactos/base/system/services/rpcserver.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/rpcse…
==============================================================================
--- trunk/reactos/base/system/services/rpcserver.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/services/rpcserver.c [iso-8859-1] Sun Jul 8 23:08:19 2012
@@ -2877,7 +2877,7 @@
return ERROR_ACCESS_DENIED;
}
- /* HACK: we need to compute instead the real length of the owner name */
+ /* FIXME: we need to compute instead the real length of the owner name */
dwRequiredSize = sizeof(QUERY_SERVICE_LOCK_STATUSW) + sizeof(WCHAR);
*pcbBytesNeeded = dwRequiredSize;
@@ -4243,16 +4243,13 @@
}
}
- /* Start the service */
- dwError = ScmStartService(lpService, argc, lpVector);
-
/* Acquire the service start lock until the service has been started */
dwError = ScmAcquireServiceStartLock(TRUE, &Lock);
if (dwError != ERROR_SUCCESS)
goto done;
- /* Start the service */
- dwError = ScmStartService(lpService, argc, lpVector);
+ /* Start the service */
+ dwError = ScmStartService(lpService, argc, lpVector);
/* Release the service start lock */
ScmReleaseServiceStartLock(&Lock);
Modified: trunk/reactos/base/system/services/services.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/servi…
==============================================================================
--- trunk/reactos/base/system/services/services.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/services/services.c [iso-8859-1] Sun Jul 8 23:08:19 2012
@@ -378,6 +378,7 @@
{
HANDLE hScmStartEvent = NULL;
SC_RPC_LOCK Lock = NULL;
+ BOOL bDeleteCriticalSection = FALSE;
DWORD dwError;
DPRINT("SERVICES: Service Control Manager\n");
@@ -442,6 +443,7 @@
AcquireLoadDriverPrivilege();
ScmInitNamedPipeCriticalSection();
+ bDeleteCriticalSection = TRUE;
/* Acquire the service start lock until autostart services have been started */
dwError = ScmAcquireServiceStartLock(TRUE, &Lock);
@@ -465,7 +467,8 @@
WaitForSingleObject(hScmShutdownEvent, INFINITE);
done:
- ScmDeleteNamedPipeCriticalSection();
+ if (bDeleteCriticalSection == TRUE)
+ ScmDeleteNamedPipeCriticalSection();
/* Close the shutdown event */
if (hScmShutdownEvent != NULL)