Author: jimtabor
Date: Sat Sep 26 07:25:52 2009
New Revision: 43157
URL:
http://svn.reactos.org/svn/reactos?rev=43157&view=rev
Log:
- Alexandre Julliard : kernel32: Cope with an empty resource section in UpdateResource.
- Wine Bug 19783 :
http://bugs.winehq.org/show_bug.cgi?id=19783
Modified:
trunk/reactos/dll/win32/kernel32/misc/res.c
Modified: trunk/reactos/dll/win32/kernel32/misc/res.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/re…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/misc/res.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/misc/res.c [iso-8859-1] Sat Sep 26 07:25:52 2009
@@ -405,13 +405,6 @@
return NULL;
}
- /* check that the resources section is last */
- if (i != num_sections - 1)
- {
- DPRINT("FIXME: .rsrc isn't the last section\n");
- return NULL;
- }
-
return &sec[i];
}
@@ -565,6 +558,9 @@
return TRUE;
DPRINT("found .rsrc at %08x, size %08x\n", sec[i].PointerToRawData,
sec[i].SizeOfRawData);
+
+ if (!sec[i].PointerToRawData || sec[i].SizeOfRawData <
sizeof(IMAGE_RESOURCE_DIRECTORY))
+ return TRUE;
root = (void*) ((BYTE*)base + sec[i].PointerToRawData);
enumerate_mapped_resources( updates, base, mapping_size, root );
@@ -962,10 +958,15 @@
if (!sec)
goto done;
- if ((sec->SizeOfRawData + sec->PointerToRawData) != write_map->size)
- {
- DPRINT("FIXME: .rsrc isn't at the end of the image %08x + %08x !=
%08x\n",
- sec->SizeOfRawData, sec->PointerToRawData, write_map->size);
+ if (!sec->PointerToRawData) /* empty section */
+ {
+ sec->PointerToRawData = write_map->size;
+ sec->SizeOfRawData = 0;
+ }
+ else if ((sec->SizeOfRawData + sec->PointerToRawData) != write_map->size)
+ {
+ DPRINT(".rsrc isn't at the end of the image %08x + %08x != %08x for
%s\n",
+ sec->SizeOfRawData, sec->PointerToRawData, write_map->size,
updates->pFileName);
goto done;
}