make PE loader more lenient with alignment. it could previously not load
PEs that I can load on Windows
Modified: trunk/reactos/ntoskrnl/mm/pe.c
_____
Modified: trunk/reactos/ntoskrnl/mm/pe.c
--- trunk/reactos/ntoskrnl/mm/pe.c 2005-05-26 13:50:52 UTC (rev
15517)
+++ trunk/reactos/ntoskrnl/mm/pe.c 2005-05-26 13:52:30 UTC (rev
15518)
@@ -518,8 +518,8 @@
/* size of the executable's headers */
if(RTL_CONTAINS_FIELD(piohOptHeader, cbOptHeaderSize, SizeOfHeaders))
{
- if(!IsAligned(piohOptHeader->SizeOfHeaders, nFileAlignment))
- DIE(("SizeOfHeaders is not aligned\n"));
+ //if(!IsAligned(piohOptHeader->SizeOfHeaders, nFileAlignment))
+ //DIE(("SizeOfHeaders is not aligned\n"));
if(cbSectionHeadersSize > piohOptHeader->SizeOfHeaders)
DIE(("The section headers overflow SizeOfHeaders\n"));
@@ -611,7 +611,7 @@
/* initialize the headers segment */
pssSegments = ImageSectionObject->Segments;
- ASSERT(IsAligned(cbHeadersSize, nFileAlignment));
+ //ASSERT(IsAligned(cbHeadersSize, nFileAlignment));
if(!AlignUp(&nFileSizeOfHeaders, cbHeadersSize, nFileAlignment))
DIE(("Cannot align the size of the section headers\n"));
@@ -655,8 +655,8 @@
DIE(("SizeOfRawData[%u] is not aligned\n", i));
#endif
- if(!IsAligned(pishSectionHeaders[i].PointerToRawData,
nFileAlignment))
- DIE(("PointerToRawData[%u] is not aligned\n", i));
+ //if(!IsAligned(pishSectionHeaders[i].PointerToRawData,
nFileAlignment))
+ //DIE(("PointerToRawData[%u] is not aligned\n", i));
/* conversion */
pssSegments[i].FileOffset = pishSectionHeaders[i].PointerToRawData;
Set non-retail (checked) build as default. Developers should have no
reason to use a retail build unless testing a final release version.
This also speeds up compilation and reduces the number of compile errors
due to developers building with dbg=0 and breaking dbg=1 code. Please do
not code with dbg=0 without testing your patches in dbg=1.
Modified: trunk/reactos/config
_____
Modified: trunk/reactos/config
--- trunk/reactos/config 2005-05-26 13:48:55 UTC (rev 15516)
+++ trunk/reactos/config 2005-05-26 13:50:52 UTC (rev 15517)
@@ -14,7 +14,7 @@
# be optimized for.
#
-OARCH := i486
+OARCH := i486
#
# Whether to compile in the kernel debugger
@@ -25,7 +25,7 @@
# Whether to compile for debugging
# Enabling this enables ASSERTS, GDB and Special Debug Routines
#
-DBG := 0
+DBG := 1
#
# Whether to compile a multiprocessor or single processor version
Dynamically load and detect iphlpapi. Makes rpcrt4 work on systems
without the DLL and also does not force every app on the system to load
the network libraries like before
Modified: trunk/reactos/lib/rpcrt4/rpcrt4_main.c
_____
Modified: trunk/reactos/lib/rpcrt4/rpcrt4_main.c
--- trunk/reactos/lib/rpcrt4/rpcrt4_main.c 2005-05-26 13:44:14 UTC
(rev 15512)
+++ trunk/reactos/lib/rpcrt4/rpcrt4_main.c 2005-05-26 13:45:08 UTC
(rev 15513)
@@ -319,6 +319,8 @@
*time += TICKS_15_OCT_1582_TO_1601;
}
+typedef DWORD WINAPI (*LPGETADAPTERSINFO)(PIP_ADAPTER_INFO
pAdapterInfo, PULONG pOutBufLen);
+
/* Assume that a hardware address is at least 6 bytes long */
#define ADDRESS_BYTES_NEEDED 6
@@ -329,28 +331,46 @@
ULONG buflen = sizeof(IP_ADAPTER_INFO);
PIP_ADAPTER_INFO adapter = HeapAlloc(GetProcessHeap(), 0, buflen);
+ HANDLE hIpHlpApi;
+ LPGETADAPTERSINFO pGetAdaptersInfo;
+
+ hIpHlpApi = LoadLibrary("iphlpapi.dll");
+ if (hIpHlpApi)
+ {
+ pGetAdaptersInfo = (LPGETADAPTERSINFO)GetProcAddress(hIpHlpApi,
"GetAdaptersInfo");
+ if (pGetAdaptersInfo)
+ {
+ if (pGetAdaptersInfo(adapter, &buflen) ==
ERROR_BUFFER_OVERFLOW) {
+ HeapFree(GetProcessHeap(), 0, adapter);
+ adapter = HeapAlloc(GetProcessHeap(), 0, buflen);
+ }
- if (GetAdaptersInfo(adapter, &buflen) == ERROR_BUFFER_OVERFLOW) {
- HeapFree(GetProcessHeap(), 0, adapter);
- adapter = HeapAlloc(GetProcessHeap(), 0, buflen);
- }
-
- if (GetAdaptersInfo(adapter, &buflen) == NO_ERROR) {
- for (i = 0; i < ADDRESS_BYTES_NEEDED; i++) {
- address[i] = adapter->Address[i];
+ if (pGetAdaptersInfo(adapter, &buflen) == NO_ERROR) {
+ for (i = 0; i < ADDRESS_BYTES_NEEDED; i++) {
+ address[i] = adapter->Address[i];
+ }
+ }
+ else
+ {
+ goto local;
+ }
}
+
+ /* Free the Library */
+ FreeLibrary(hIpHlpApi);
+ goto exit;
}
+
+local:
/* We can't get a hardware address, just use random numbers.
- Set the multicast bit to prevent conflicts with real cards. */
- else {
- for (i = 0; i < ADDRESS_BYTES_NEEDED; i++) {
- address[i] = rand() & 0xff;
- }
-
- address[0] |= 0x01;
- status = RPC_S_UUID_LOCAL_ONLY;
+ Set the multicast bit to prevent conflicts with real cards. */
+ for (i = 0; i < ADDRESS_BYTES_NEEDED; i++) {
+ address[i] = rand() & 0xff;
}
-
+ address[0] |= 0x01;
+ status = RPC_S_UUID_LOCAL_ONLY;
+
+exit:
HeapFree(GetProcessHeap(), 0, adapter);
return status;
}