[KERNEL32]

*Just* clarify some parts of the code and argument names of functions, and do not hardcode constant values; use #defines instead.

svn path=/trunk/; revision=59791
This commit is contained in:
Hermès Bélusca-Maïto 2013-08-22 12:47:14 +00:00
parent 068cf237e9
commit c1826bc280
2 changed files with 27 additions and 18 deletions

View file

@ -26,11 +26,11 @@ typedef struct _ENV_INFO
ENV_INFO BasepEnvNameType[] = ENV_INFO BasepEnvNameType[] =
{ {
{3, sizeof(L"PATH"), L"PATH"}, {3, sizeof(L"PATH") , L"PATH" },
{2, sizeof(L"WINDIR"), L"WINDIR"}, {2, sizeof(L"WINDIR") , L"WINDIR" },
{2, sizeof(L"SYSTEMROOT"), L"SYSTEMROOT"}, {2, sizeof(L"SYSTEMROOT"), L"SYSTEMROOT"},
{3, sizeof(L"TEMP"), L"TEMP"}, {3, sizeof(L"TEMP") , L"TEMP" },
{3, sizeof(L"TMP"), L"TMP"}, {3, sizeof(L"TMP") , L"TMP" },
}; };
UNICODE_STRING BaseDotComSuffixName = RTL_CONSTANT_STRING(L".com"); UNICODE_STRING BaseDotComSuffixName = RTL_CONSTANT_STRING(L".com");
@ -99,19 +99,21 @@ BaseUpdateVDMEntry(IN ULONG UpdateIndex,
{ {
/* VDM is being undone */ /* VDM is being undone */
case VdmEntryUndo: case VdmEntryUndo:
{
/* Tell the server how far we had gotten along */ /* Tell the server how far we had gotten along */
UpdateVdmEntry->iTask = (ULONG)*WaitHandle; UpdateVdmEntry->iTask = (ULONG)*WaitHandle;
UpdateVdmEntry->VDMCreationState = IndexInfo; UpdateVdmEntry->VDMCreationState = IndexInfo;
break; break;
}
/* VDM is ready with a new process handle */ /* VDM is ready with a new process handle */
case VdmEntryUpdateProcess: case VdmEntryUpdateProcess:
{
/* Send it the process handle */ /* Send it the process handle */
UpdateVdmEntry->VDMProcessHandle = *WaitHandle; UpdateVdmEntry->VDMProcessHandle = *WaitHandle;
UpdateVdmEntry->iTask = IndexInfo; UpdateVdmEntry->iTask = IndexInfo;
break; break;
}
} }
/* Also check what kind of binary this is for the console handle */ /* Also check what kind of binary this is for the console handle */
@ -123,11 +125,11 @@ BaseUpdateVDMEntry(IN ULONG UpdateIndex,
else if (UpdateVdmEntry->iTask) else if (UpdateVdmEntry->iTask)
{ {
/* No handle for true VDM */ /* No handle for true VDM */
UpdateVdmEntry->ConsoleHandle = 0; UpdateVdmEntry->ConsoleHandle = NULL;
} }
else else
{ {
/* Otherwise, send the regular consoel handle */ /* Otherwise, use the regular console handle */
UpdateVdmEntry->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; UpdateVdmEntry->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle;
} }
@ -196,7 +198,7 @@ BaseCheckForVDM(IN HANDLE ProcessHandle,
BOOL BOOL
WINAPI WINAPI
BaseGetVdmConfigInfo(IN LPCWSTR Reserved, BaseGetVdmConfigInfo(IN LPCWSTR CommandLineReserved,
IN ULONG DosSeqId, IN ULONG DosSeqId,
IN ULONG BinaryType, IN ULONG BinaryType,
IN PUNICODE_STRING CmdLineString, IN PUNICODE_STRING CmdLineString,
@ -209,7 +211,7 @@ BaseGetVdmConfigInfo(IN LPCWSTR Reserved,
/* Clear the buffer in case we fail */ /* Clear the buffer in case we fail */
CmdLineString->Buffer = 0; CmdLineString->Buffer = 0;
/* Always return the same size */ /* Always return the same size: 16 Mb */
*VdmSize = 0x1000000; *VdmSize = 0x1000000;
/* Get the system directory */ /* Get the system directory */
@ -224,24 +226,31 @@ BaseGetVdmConfigInfo(IN LPCWSTR Reserved,
/* Check if this is VDM with a DOS Sequence ID */ /* Check if this is VDM with a DOS Sequence ID */
if (DosSeqId) if (DosSeqId)
{ {
/* Build the VDM string for it */ /*
* Build the VDM string for it:
* -i%lx : Gives the DOS Sequence ID;
* %s%c : Nothing if DOS VDM, -w if WoW VDM, -ws if separate WoW VDM.
*/
_snwprintf(CommandLine, _snwprintf(CommandLine,
sizeof(CommandLine), sizeof(CommandLine),
L"\"%s\\ntvdm.exe\" -i%lx %s%c", L"\"%s\\ntvdm.exe\" -i%lx %s%c",
Buffer, Buffer,
DosSeqId, DosSeqId,
(BinaryType == 0x10) ? L" " : L"-w", (BinaryType == BINARY_TYPE_DOS) ? L" " : L"-w",
(BinaryType == 0x40) ? 's' : ' '); (BinaryType == BINARY_TYPE_SEPARATE_WOW) ? L's' : L' ');
} }
else else
{ {
/* Non-DOS, build the string for it without the task ID */ /*
* Build the string for it without the DOS Sequence ID:
* %s%c : Nothing if DOS VDM, -w if WoW VDM, -ws if separate WoW VDM.
*/
_snwprintf(CommandLine, _snwprintf(CommandLine,
sizeof(CommandLine), sizeof(CommandLine),
L"\"%s\\ntvdm.exe\" %s%c", L"\"%s\\ntvdm.exe\" %s%c",
Buffer, Buffer,
(BinaryType == 0x10) ? L" " : L"-w", (BinaryType == BINARY_TYPE_DOS) ? L" " : L"-w",
(BinaryType == 0x40) ? 's' : ' '); (BinaryType == BINARY_TYPE_SEPARATE_WOW) ? L's' : L' ');
} }
/* Create the actual string */ /* Create the actual string */

View file

@ -376,7 +376,7 @@ BaseDestroyVDMEnvironment(
BOOL BOOL
WINAPI WINAPI
BaseGetVdmConfigInfo( BaseGetVdmConfigInfo(
IN LPCWSTR Reserved, IN LPCWSTR CommandLineReserved,
IN ULONG DosSeqId, IN ULONG DosSeqId,
IN ULONG BinaryType, IN ULONG BinaryType,
IN PUNICODE_STRING CmdLineString, IN PUNICODE_STRING CmdLineString,