Author: cgutman
Date: Sun Aug 21 02:40:58 2011
New Revision: 53350
URL: http://svn.reactos.org/svn/reactos?rev=53350&view=rev
Log:
[PNPMGR]
- Fix a major logic bug in device tree traversal functions
Modified:
trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.…
==============================================================================
--- trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] Sun Aug 21 02:40:58 2011
@@ -1346,10 +1346,7 @@
* Pointer to parent node to retrieve child node information for.
*
* Remarks
- * We only return a status code indicating an error (STATUS_UNSUCCESSFUL)
- * when we reach a device node which is not a direct child of the device
- * node for which we retrieve information of child nodes for. Any errors
- * that occur is logged instead so that all child services have a chance
+ * Any errors that occur are logged instead so that all child services have a chance
* of being interrogated.
*/
@@ -1395,9 +1392,8 @@
if (DeviceNode->Parent != ParentDeviceNode)
{
- /* Stop the traversal immediately and indicate successful operation */
- DPRINT("Stop\n");
- return STATUS_UNSUCCESSFUL;
+ DPRINT("Skipping 2+ level child\n");
+ return STATUS_SUCCESS;
}
/* Skip processing if it was already completed before */
@@ -1963,10 +1959,7 @@
* Pointer to parent node to retrieve child node configuration for.
*
* Remarks
- * We only return a status code indicating an error (STATUS_UNSUCCESSFUL)
- * when we reach a device node which is not a direct child of the device
- * node for which we configure child services for. Any errors that occur is
- * logged instead so that all child services have a chance of beeing
+ * Any errors that occur are logged instead so that all child services have a chance of beeing
* configured.
*/
@@ -1999,11 +1992,11 @@
* Make sure this device node is a direct child of the parent device node
* that is given as an argument
*/
+
if (DeviceNode->Parent != ParentDeviceNode)
{
- /* Stop the traversal immediately and indicate successful operation */
- DPRINT("Stop\n");
- return STATUS_UNSUCCESSFUL;
+ DPRINT("Skipping 2+ level child\n");
+ return STATUS_SUCCESS;
}
if (!(DeviceNode->Flags & (DNF_DISABLED | DNF_STARTED | DNF_ADDED)))
@@ -2096,10 +2089,7 @@
*
* Remarks
* If the driver image for a service is not loaded and initialized
- * it is done here too. We only return a status code indicating an
- * error (STATUS_UNSUCCESSFUL) when we reach a device node which is
- * not a direct child of the device node for which we initialize
- * child services for. Any errors that occur is logged instead so
+ * it is done here too. Any errors that occur are logged instead so
* that all child services have a chance of being initialized.
*/
@@ -2132,11 +2122,8 @@
if (DeviceNode->Parent != ParentDeviceNode)
{
- /*
- * Stop the traversal immediately and indicate unsuccessful operation
- */
- DPRINT("Stop\n");
- return STATUS_UNSUCCESSFUL;
+ DPRINT("Skipping 2+ level child\n");
+ return STATUS_SUCCESS;
}
if (IopDeviceNodeHasFlag(DeviceNode, DNF_STARTED) ||
Author: tkreuzer
Date: Sat Aug 20 21:20:33 2011
New Revision: 53348
URL: http://svn.reactos.org/svn/reactos?rev=53348&view=rev
Log:
[VFATLIB]
Fix completely non-standard, broken and retarded definition of GET_UNALIGNED_W for 64 bit architectures
The function is supposed to read an unaligned little endian USHORT value. The old version copied the 2 bytes with memcpy to an aligned stack variable and then (bug bug) read the unaligned value directly (discarding the result of the previous operation) and passed it to bswap if neccessary.
The new function simply reads the 2 bytes and combines them using << and |.
Modified:
trunk/reactos/lib/fslib/vfatlib/check/boot.c
Modified: trunk/reactos/lib/fslib/vfatlib/check/boot.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fslib/vfatlib/check/bo…
==============================================================================
--- trunk/reactos/lib/fslib/vfatlib/check/boot.c [iso-8859-1] (original)
+++ trunk/reactos/lib/fslib/vfatlib/check/boot.c [iso-8859-1] Sat Aug 20 21:20:33 2011
@@ -30,18 +30,17 @@
{ 0xff, "5.25\" 320k floppy 2s/40tr/8sec" },
};
-#if defined __alpha || defined __ia64__ || defined __s390x__ || defined __x86_64__ || defined __ppc64__
-/* Unaligned fields must first be copied byte-wise */
-#define GET_UNALIGNED_W(f) \
- ({ \
- unsigned short __v; \
- memcpy( &__v, &f, sizeof(__v) ); \
- CF_LE_W( *(unsigned short *)&f ); \
- })
+#if defined __alpha || defined __ia64__ || defined __x86_64__ || defined __ppc64__
+/* Unaligned fields must first be copied byte-wise (little endian) */
+#define GET_UNALIGNED_W(u) \
+ (((unsigned char*)(&u))[0] | (((unsigned char*)&(u))[1] << 8))
+#elif defined __s390x__
+/* Unaligned fields must first be copied byte-wise (big endian) */
+#define GET_UNALIGNED_W(pu) \
+ (((unsigned char*)&(u))[1] | (((unsigned char*)&(u))[0] << 8))
#else
#define GET_UNALIGNED_W(f) CF_LE_W( *(unsigned short *)&f )
#endif
-
static char *get_media_descr( unsigned char media )
{