Author: hbelusca Date: Wed Aug 28 13:23:09 2013 New Revision: 59855
URL: http://svn.reactos.org/svn/reactos?rev=59855&view=rev Log: [KERNEL32] - Add brackets around "case XXX:" so that I'm able to (un)fold regions of code when debugging and reading. - Temporarily skip AppCompat functionality added by Alex, in order to "fix" (read: hack-fix) launch of .bat/.cmd files. Indeed, when .bat/.cmd files get started with the CreateProcess function, a call to NtCreateSection fails with status STATUS_INVALID_IMAGE_NOT_MZ, as expected (line 2952). But the new AppCompat code (lines 3028 and 3031-3033 and following, and 3114), executed whenever the status code from NtCreateSection is STATUS_SUCCESS or STATUS_INVALID_IMAGE_NOT_MZ or something else, overwrites the status code by other values, so that, after we return to the main code path (lines 3174 and following), the status code isn't STATUS_INVALID_IMAGE_NOT_MZ anymore but STATUS_SUCCESS or whatever, and then, we fail to run the .bat/.cmd file (that should be done at lines 3314-3316 and following). To Alex_Ionescu: Have a look at this and fix it properly!!
Modified: trunk/reactos/dll/win32/kernel32/client/proc.c
Modified: trunk/reactos/dll/win32/kernel32/client/proc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/p... ============================================================================== --- trunk/reactos/dll/win32/kernel32/client/proc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/proc.c [iso-8859-1] Wed Aug 28 13:23:09 2013 @@ -2382,7 +2382,7 @@ /* Zero out the initial core variables and handles */ QuerySection = FALSE; InJob = FALSE; - SkipSaferAndAppCompat = FALSE; + SkipSaferAndAppCompat = TRUE; // HACK for making .bat/.cmd launch working again. ParameterFlags = 0; Flags = 0; DebugHandle = NULL; @@ -3174,6 +3174,7 @@ switch (Status) { case STATUS_INVALID_IMAGE_WIN_16: + { /* 16-bit binary. Should we use WOW or does the caller force VDM? */ if (!(dwCreationFlags & CREATE_FORCEDOS)) { @@ -3308,9 +3309,12 @@ }
// There is no break here on purpose, so FORCEDOS drops down! + } + case STATUS_INVALID_IMAGE_PROTECT: case STATUS_INVALID_IMAGE_NOT_MZ: case STATUS_INVALID_IMAGE_NE_FORMAT: + { /* We're launching an executable application */ BinarySubType = BINARY_TYPE_EXE;
@@ -3493,21 +3497,27 @@ /* We've already done all these checks, don't do them again */ SkipSaferAndAppCompat = TRUE; goto AppNameRetry; + }
case STATUS_INVALID_IMAGE_WIN_64: + { /* 64-bit binaries are not allowed to run on 32-bit ReactOS */ DPRINT1("64-bit binary, failing\n"); SetLastError(ERROR_EXE_MACHINE_TYPE_MISMATCH); Result = FALSE; goto Quickie; + }
case STATUS_FILE_IS_OFFLINE: + { /* Set the correct last error for this */ DPRINT1("File is offline, failing\n"); SetLastError(ERROR_FILE_OFFLINE); break; + }
default: + { /* Any other error, convert it to a generic Win32 error */ if (!NT_SUCCESS(Status)) { @@ -3520,6 +3530,7 @@ /* Otherwise, this must be success */ ASSERT(Status == STATUS_SUCCESS); break; + } }
/* Is this not a WOW application, but a WOW32 VDM was requested for it? */