Commit d203af0f authored by Alexandre Julliard's avatar Alexandre Julliard

kernelbase: Add support for the PROC_THREAD_ATTRIBUTE_MACHINE_TYPE attribute.

parent ca7a7abe
......@@ -257,13 +257,14 @@ struct _PROC_THREAD_ATTRIBUTE_LIST
static NTSTATUS create_nt_process( HANDLE token, HANDLE debug, SECURITY_ATTRIBUTES *psa,
SECURITY_ATTRIBUTES *tsa, DWORD process_flags,
RTL_USER_PROCESS_PARAMETERS *params,
RTL_USER_PROCESS_INFORMATION *info, HANDLE parent,
RTL_USER_PROCESS_INFORMATION *info,
HANDLE parent, USHORT machine,
const struct proc_thread_attr *handle_list,
const struct proc_thread_attr *job_list)
{
OBJECT_ATTRIBUTES process_attr, thread_attr;
PS_CREATE_INFO create_info;
ULONG_PTR buffer[offsetof( PS_ATTRIBUTE_LIST, Attributes[8] ) / sizeof(ULONG_PTR)];
ULONG_PTR buffer[offsetof( PS_ATTRIBUTE_LIST, Attributes[9] ) / sizeof(ULONG_PTR)];
PS_ATTRIBUTE_LIST *attr = (PS_ATTRIBUTE_LIST *)buffer;
UNICODE_STRING nameW;
NTSTATUS status;
......@@ -330,6 +331,14 @@ static NTSTATUS create_nt_process( HANDLE token, HANDLE debug, SECURITY_ATTRIBUT
attr->Attributes[pos].ReturnLength = NULL;
pos++;
}
if (machine)
{
attr->Attributes[pos].Attribute = PS_ATTRIBUTE_MACHINE_TYPE;
attr->Attributes[pos].Size = sizeof(machine);
attr->Attributes[pos].Value = machine;
attr->Attributes[pos].ReturnLength = NULL;
pos++;
}
attr->TotalLength = offsetof( PS_ATTRIBUTE_LIST, Attributes[pos] );
InitializeObjectAttributes( &process_attr, NULL, 0, NULL, psa ? psa->lpSecurityDescriptor : NULL );
......@@ -371,7 +380,7 @@ static NTSTATUS create_vdm_process( HANDLE token, HANDLE debug, SECURITY_ATTRIBU
winevdm, params->ImagePathName.Buffer, params->CommandLine.Buffer );
RtlInitUnicodeString( &params->ImagePathName, winevdm );
RtlInitUnicodeString( &params->CommandLine, newcmdline );
status = create_nt_process( token, debug, psa, tsa, flags, params, info, NULL, NULL, NULL );
status = create_nt_process( token, debug, psa, tsa, flags, params, info, 0, 0, NULL, NULL );
HeapFree( GetProcessHeap(), 0, newcmdline );
return status;
}
......@@ -400,7 +409,7 @@ static NTSTATUS create_cmd_process( HANDLE token, HANDLE debug, SECURITY_ATTRIBU
swprintf( newcmdline, len, L"%s /s/c \"%s\"", comspec, params->CommandLine.Buffer );
RtlInitUnicodeString( &params->ImagePathName, comspec );
RtlInitUnicodeString( &params->CommandLine, newcmdline );
status = create_nt_process( token, debug, psa, tsa, flags, params, info, NULL, NULL, NULL );
status = create_nt_process( token, debug, psa, tsa, flags, params, info, 0, 0, NULL, NULL );
RtlFreeHeap( GetProcessHeap(), 0, newcmdline );
return status;
}
......@@ -510,6 +519,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessInternalW( HANDLE token, const WCHAR
RTL_USER_PROCESS_INFORMATION rtl_info;
HANDLE parent = 0, debug = 0;
ULONG nt_flags = 0;
USHORT machine = 0;
NTSTATUS status;
/* Process the AppName and/or CmdLine to get module name and path */
......@@ -602,6 +612,10 @@ BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessInternalW( HANDLE token, const WCHAR
TRACE( "PROC_THREAD_ATTRIBUTE_JOB_LIST handle count %Iu.\n",
attrs->attrs[i].size / sizeof(HANDLE) );
break;
case PROC_THREAD_ATTRIBUTE_MACHINE_TYPE:
machine = *(USHORT *)attrs->attrs[i].value;
TRACE( "PROC_THREAD_ATTRIBUTE_MACHINE %x.\n", machine );
break;
default:
FIXME("Unsupported attribute %#Ix.\n", attrs->attrs[i].attr);
break;
......@@ -616,7 +630,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessInternalW( HANDLE token, const WCHAR
if (flags & CREATE_SUSPENDED) nt_flags |= PROCESS_CREATE_FLAGS_SUSPENDED;
status = create_nt_process( token, debug, process_attr, thread_attr,
nt_flags, params, &rtl_info, parent, handle_list, job_list );
nt_flags, params, &rtl_info, parent, machine, handle_list, job_list );
switch (status)
{
case STATUS_SUCCESS:
......@@ -1722,6 +1736,9 @@ static inline DWORD validate_proc_thread_attribute( DWORD_PTR attr, SIZE_T size
case PROC_THREAD_ATTRIBUTE_JOB_LIST:
if ((size / sizeof(HANDLE)) * sizeof(HANDLE) != size) return ERROR_BAD_LENGTH;
break;
case PROC_THREAD_ATTRIBUTE_MACHINE_TYPE:
if (size != sizeof(USHORT)) return ERROR_BAD_LENGTH;
break;
default:
FIXME( "Unhandled attribute %Iu\n", attr & PROC_THREAD_ATTRIBUTE_NUMBER );
return ERROR_NOT_SUPPORTED;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment