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

View file

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