Changed the indentation to a human readable format (no code change).

svn path=/trunk/; revision=14454
This commit is contained in:
Hartmut Birr 2005-04-02 19:33:08 +00:00
parent 8a17f1f08d
commit ff278d3830

View file

@ -32,13 +32,10 @@ typedef NTSTATUS STDCALL (K32_MBSTR_TO_WCSTR)
BOOLEAN
);
NTSTATUS STDCALL K32MbStrToWcStr
(
IN K32_MBSTR_TO_WCSTR * True,
NTSTATUS STDCALL K32MbStrToWcStr(IN K32_MBSTR_TO_WCSTR * True,
UNICODE_STRING * DestStr,
ANSI_STRING * SourceStr,
BOOLEAN Allocate
)
BOOLEAN Allocate)
{
if(SourceStr->Buffer == NULL)
{
@ -50,11 +47,8 @@ NTSTATUS STDCALL K32MbStrToWcStr
return True(DestStr, SourceStr, Allocate);
}
VOID STDCALL RtlRosR32AttribsToNativeAttribs
(
OUT OBJECT_ATTRIBUTES * NativeAttribs,
IN SECURITY_ATTRIBUTES * Ros32Attribs OPTIONAL
)
VOID STDCALL RtlRosR32AttribsToNativeAttribs(OUT OBJECT_ATTRIBUTES * NativeAttribs,
IN SECURITY_ATTRIBUTES * Ros32Attribs OPTIONAL)
{
NativeAttribs->Length = sizeof(*NativeAttribs);
NativeAttribs->ObjectName = NULL;
@ -68,20 +62,21 @@ VOID STDCALL RtlRosR32AttribsToNativeAttribs
NativeAttribs->SecurityDescriptor = Ros32Attribs->lpSecurityDescriptor;
if(Ros32Attribs->bInheritHandle)
{
NativeAttribs->Attributes |= OBJ_INHERIT;
}
}
else
{
NativeAttribs->SecurityDescriptor = NULL;
}
}
VOID STDCALL RtlRosR32AttribsToNativeAttribsNamed
(
OUT OBJECT_ATTRIBUTES * NativeAttribs,
VOID STDCALL RtlRosR32AttribsToNativeAttribsNamed(OUT OBJECT_ATTRIBUTES * NativeAttribs,
IN SECURITY_ATTRIBUTES * Ros32Attribs OPTIONAL,
OUT UNICODE_STRING * NativeName OPTIONAL,
IN WCHAR * Ros32Name OPTIONAL,
IN HANDLE Ros32NameRoot OPTIONAL
)
IN HANDLE Ros32NameRoot OPTIONAL)
{
if(!NativeAttribs) return;
@ -144,12 +139,9 @@ BOOL STDCALL CreateProcessA(LPCSTR lpApplicationName,
BOOL bRetVal;
STARTUPINFOW wsiStartupInfo;
NTSTATUS STDCALL_FUNC (*pTrue)
(
UNICODE_STRING *,
NTSTATUS STDCALL_FUNC (*pTrue)(UNICODE_STRING *,
ANSI_STRING *,
BOOLEAN
);
BOOLEAN);
ULONG STDCALL_FUNC (*pRtlMbStringToUnicodeSize)(ANSI_STRING *);
@ -318,9 +310,13 @@ _except_handler(EXCEPTION_RECORD *ExceptionRecord,
/* translate EXCEPTION_XXX defines into EXCEPTION_DISPOSITION enum values */
if (ExceptionDisposition == EXCEPTION_CONTINUE_EXECUTION)
{
return ExceptionContinueExecution;
}
else if (ExceptionDisposition == EXCEPTION_CONTINUE_SEARCH)
{
return ExceptionContinueSearch;
}
return -1; /* unknown return from UnhandledExceptionFilter */
}
@ -343,15 +339,12 @@ BaseProcessStart(LPTHREAD_START_ROUTINE lpStartAddress,
}
HANDLE STDCALL KlCreateFirstThread
(
HANDLE ProcessHandle,
HANDLE STDCALL KlCreateFirstThread(HANDLE ProcessHandle,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
PSECTION_IMAGE_INFORMATION Sii,
LPTHREAD_START_ROUTINE lpStartAddress,
DWORD dwCreationFlags,
LPDWORD lpThreadId
)
LPDWORD lpThreadId)
{
OBJECT_ATTRIBUTES oaThreadAttribs;
CLIENT_ID cidClientId;
@ -364,14 +357,16 @@ HANDLE STDCALL KlCreateFirstThread
/* native image */
if(Sii->Subsystem != IMAGE_SUBSYSTEM_NATIVE)
{
pTrueStartAddress = (PVOID)BaseProcessStart;
}
/* Win32 image */
else
{
pTrueStartAddress = (PVOID)RtlBaseProcessStartRoutine;
}
DPRINT
(
"RtlRosCreateUserThreadVa\n"
DPRINT("RtlRosCreateUserThreadVa\n"
"(\n"
" ProcessHandle %p,\n"
" ObjectAttributes %p,\n"
@ -397,13 +392,10 @@ HANDLE STDCALL KlCreateFirstThread
&cidClientId,
2,
lpStartAddress,
PEB_BASE
);
PEB_BASE);
/* create the first thread */
nErrCode = RtlRosCreateUserThreadVa
(
ProcessHandle,
nErrCode = RtlRosCreateUserThreadVa(ProcessHandle,
&oaThreadAttribs,
dwCreationFlags & CREATE_SUSPENDED,
0,
@ -414,9 +406,7 @@ HANDLE STDCALL KlCreateFirstThread
&cidClientId,
2,
(ULONG_PTR)lpStartAddress,
(ULONG_PTR)PEB_BASE
);
(ULONG_PTR)PEB_BASE);
/* failure */
if(!NT_SUCCESS(nErrCode))
{
@ -424,17 +414,14 @@ HANDLE STDCALL KlCreateFirstThread
return NULL;
}
DPRINT
(
"StackReserve %p\n"
DPRINT("StackReserve %p\n"
"StackCommit %p\n"
"ThreadHandle %p\n"
"ClientId.UniqueThread %p\n",
Sii->StackReserve,
Sii->StackCommit,
hThread,
cidClientId.UniqueThread
);
cidClientId.UniqueThread);
/* success */
if(lpThreadId) *lpThreadId = (DWORD)cidClientId.UniqueThread;
@ -510,13 +497,10 @@ HANDLE KlMapFile(LPCWSTR lpApplicationName)
return(hSection);
}
static NTSTATUS KlInitPeb
(
HANDLE ProcessHandle,
static NTSTATUS KlInitPeb(HANDLE ProcessHandle,
PRTL_USER_PROCESS_PARAMETERS Ppb,
PVOID * ImageBaseAddress,
ULONG ImageSubSystem
)
ULONG ImageSubSystem)
{
NTSTATUS Status;
PVOID PpbBase;
@ -754,9 +738,7 @@ GetFileName(LPCWSTR CurDir, LPCWSTR AppName, LPWSTR CmdLine, LPWSTR Buffer,
* @implemented
*/
BOOL STDCALL
CreateProcessW
(
LPCWSTR lpApplicationName,
CreateProcessW(LPCWSTR lpApplicationName,
LPWSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
@ -765,8 +747,7 @@ CreateProcessW
LPVOID lpEnvironment,
LPCWSTR lpCurrentDirectory,
LPSTARTUPINFOW lpStartupInfo,
LPPROCESS_INFORMATION lpProcessInformation
)
LPPROCESS_INFORMATION lpProcessInformation)
{
HANDLE hSection, hProcess, hThread;
NTSTATUS Status;
@ -935,12 +916,12 @@ CreateProcessW
IO_STATUS_BLOCK Iosb;
LARGE_INTEGER Offset;
HANDLE hFile = NULL;
DPRINT("Inspecting Image Header for image type id\n");
// Find the application name
if (!RtlDosPathNameToNtPathName_U((LPWSTR)lpApplicationName,
&ApplicationNameString, NULL, NULL)) {
&ApplicationNameString, NULL, NULL))
{
return FALSE;
}
DPRINT("ApplicationName %S\n",ApplicationNameString.Buffer);
@ -961,7 +942,8 @@ CreateProcessW
RtlFreeUnicodeString(&ApplicationNameString);
if (!NT_SUCCESS(Status)) {
if (!NT_SUCCESS(Status))
{
DPRINT("Failed to open file\n");
SetLastErrorByStatus(Status);
return FALSE;
@ -979,19 +961,22 @@ CreateProcessW
&Offset,
0);
if (!NT_SUCCESS(Status)) {
if (!NT_SUCCESS(Status))
{
DPRINT("Failed to read from file\n");
SetLastErrorByStatus(Status);
return FALSE;
}
if (Iosb.Information != sizeof(DosHeader)) {
if (Iosb.Information != sizeof(DosHeader))
{
DPRINT("Failed to read dos header from file\n");
SetLastErrorByStatus(STATUS_INVALID_IMAGE_FORMAT);
return FALSE;
}
// Check the DOS signature
if (DosHeader.e_magic != IMAGE_DOS_SIGNATURE) {
if (DosHeader.e_magic != IMAGE_DOS_SIGNATURE)
{
DPRINT("Failed dos magic check\n");
SetLastErrorByStatus(STATUS_INVALID_IMAGE_FORMAT);
return FALSE;