server: Store process/thread affinity as a 64-bit value.
diff --git a/server/process.h b/server/process.h
index 5311ae3..5b6dcda 100644
--- a/server/process.h
+++ b/server/process.h
@@ -63,8 +63,8 @@
     int                  running_threads; /* number of threads running in this process */
     timeout_t            start_time;      /* absolute time at process start */
     timeout_t            end_time;        /* absolute time at process end */
+    affinity_t           affinity;        /* process affinity mask */
     int                  priority;        /* priority class */
-    unsigned int         affinity;        /* process affinity mask */
     int                  suspend;         /* global process suspend count */
     int                  is_system;       /* is it a system process? */
     unsigned int         create_flags;    /* process creation flags */
diff --git a/server/protocol.def b/server/protocol.def
index 2f7f7c6..a8f3569 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -43,6 +43,7 @@
 typedef unsigned __int64 mem_size_t;
 typedef unsigned __int64 file_pos_t;
 typedef unsigned __int64 client_ptr_t;
+typedef unsigned __int64 affinity_t;
 typedef client_ptr_t mod_handle_t;
 
 struct request_header
@@ -588,12 +589,12 @@
 @REPLY
     process_id_t pid;              /* server process id */
     process_id_t ppid;             /* server process id of parent */
-    int          priority;         /* priority class */
-    unsigned int affinity;         /* process affinity mask */
+    affinity_t   affinity;         /* process affinity mask */
     client_ptr_t peb;              /* PEB address in process address space */
     timeout_t    start_time;       /* process start time */
     timeout_t    end_time;         /* process end time */
     int          exit_code;        /* process exit code */
+    int          priority;         /* priority class */
 @END
 
 
@@ -602,7 +603,7 @@
     obj_handle_t handle;       /* process handle */
     int          mask;         /* setting mask (see below) */
     int          priority;     /* priority class */
-    unsigned int affinity;     /* affinity mask */
+    affinity_t   affinity;     /* affinity mask */
 @END
 #define SET_PROCESS_INFO_PRIORITY 0x01
 #define SET_PROCESS_INFO_AFFINITY 0x02
@@ -616,11 +617,11 @@
     process_id_t pid;           /* server process id */
     thread_id_t  tid;           /* server thread id */
     client_ptr_t teb;           /* thread teb pointer */
-    int          priority;      /* thread priority level */
-    unsigned int affinity;      /* thread affinity mask */
+    affinity_t   affinity;      /* thread affinity mask */
     timeout_t    creation_time; /* thread creation time */
     timeout_t    exit_time;     /* thread exit time */
     int          exit_code;     /* thread exit code */
+    int          priority;      /* thread priority level */
     int          last;          /* last thread in process */
 @END
 
@@ -630,7 +631,7 @@
     obj_handle_t handle;       /* thread handle */
     int          mask;         /* setting mask (see below) */
     int          priority;     /* priority class */
-    unsigned int affinity;     /* affinity mask */
+    affinity_t   affinity;     /* affinity mask */
     obj_handle_t token;        /* impersonation token */
 @END
 #define SET_THREAD_INFO_PRIORITY 0x01
diff --git a/server/request.h b/server/request.h
index 0c83bbf5..b8d78f3 100644
--- a/server/request.h
+++ b/server/request.h
@@ -591,6 +591,7 @@
     (req_handler)req_set_window_layered_info,
 };
 
+C_ASSERT( sizeof(affinity_t) == 8 );
 C_ASSERT( sizeof(apc_call_t) == 40 );
 C_ASSERT( sizeof(apc_param_t) == 8 );
 C_ASSERT( sizeof(apc_result_t) == 40 );
@@ -681,12 +682,12 @@
 C_ASSERT( FIELD_OFFSET(struct get_process_info_request, handle) == 12 );
 C_ASSERT( FIELD_OFFSET(struct get_process_info_reply, pid) == 8 );
 C_ASSERT( FIELD_OFFSET(struct get_process_info_reply, ppid) == 12 );
-C_ASSERT( FIELD_OFFSET(struct get_process_info_reply, priority) == 16 );
-C_ASSERT( FIELD_OFFSET(struct get_process_info_reply, affinity) == 20 );
+C_ASSERT( FIELD_OFFSET(struct get_process_info_reply, affinity) == 16 );
 C_ASSERT( FIELD_OFFSET(struct get_process_info_reply, peb) == 24 );
 C_ASSERT( FIELD_OFFSET(struct get_process_info_reply, start_time) == 32 );
 C_ASSERT( FIELD_OFFSET(struct get_process_info_reply, end_time) == 40 );
 C_ASSERT( FIELD_OFFSET(struct get_process_info_reply, exit_code) == 48 );
+C_ASSERT( FIELD_OFFSET(struct get_process_info_reply, priority) == 52 );
 C_ASSERT( sizeof(struct get_process_info_reply) == 56 );
 C_ASSERT( FIELD_OFFSET(struct set_process_info_request, handle) == 12 );
 C_ASSERT( FIELD_OFFSET(struct set_process_info_request, mask) == 16 );
@@ -698,19 +699,19 @@
 C_ASSERT( FIELD_OFFSET(struct get_thread_info_reply, pid) == 8 );
 C_ASSERT( FIELD_OFFSET(struct get_thread_info_reply, tid) == 12 );
 C_ASSERT( FIELD_OFFSET(struct get_thread_info_reply, teb) == 16 );
-C_ASSERT( FIELD_OFFSET(struct get_thread_info_reply, priority) == 24 );
-C_ASSERT( FIELD_OFFSET(struct get_thread_info_reply, affinity) == 28 );
+C_ASSERT( FIELD_OFFSET(struct get_thread_info_reply, affinity) == 24 );
 C_ASSERT( FIELD_OFFSET(struct get_thread_info_reply, creation_time) == 32 );
 C_ASSERT( FIELD_OFFSET(struct get_thread_info_reply, exit_time) == 40 );
 C_ASSERT( FIELD_OFFSET(struct get_thread_info_reply, exit_code) == 48 );
-C_ASSERT( FIELD_OFFSET(struct get_thread_info_reply, last) == 52 );
-C_ASSERT( sizeof(struct get_thread_info_reply) == 56 );
+C_ASSERT( FIELD_OFFSET(struct get_thread_info_reply, priority) == 52 );
+C_ASSERT( FIELD_OFFSET(struct get_thread_info_reply, last) == 56 );
+C_ASSERT( sizeof(struct get_thread_info_reply) == 64 );
 C_ASSERT( FIELD_OFFSET(struct set_thread_info_request, handle) == 12 );
 C_ASSERT( FIELD_OFFSET(struct set_thread_info_request, mask) == 16 );
 C_ASSERT( FIELD_OFFSET(struct set_thread_info_request, priority) == 20 );
 C_ASSERT( FIELD_OFFSET(struct set_thread_info_request, affinity) == 24 );
-C_ASSERT( FIELD_OFFSET(struct set_thread_info_request, token) == 28 );
-C_ASSERT( sizeof(struct set_thread_info_request) == 32 );
+C_ASSERT( FIELD_OFFSET(struct set_thread_info_request, token) == 32 );
+C_ASSERT( sizeof(struct set_thread_info_request) == 40 );
 C_ASSERT( FIELD_OFFSET(struct get_dll_info_request, handle) == 12 );
 C_ASSERT( FIELD_OFFSET(struct get_dll_info_request, base_address) == 16 );
 C_ASSERT( FIELD_OFFSET(struct get_dll_info_reply, entry_point) == 8 );
diff --git a/server/thread.h b/server/thread.h
index 1815f0b..2e33470 100644
--- a/server/thread.h
+++ b/server/thread.h
@@ -79,8 +79,8 @@
     CONTEXT               *context;       /* current context if in an exception handler */
     CONTEXT               *suspend_context; /* current context if suspended */
     client_ptr_t           teb;           /* TEB address (in client address space) */
+    affinity_t             affinity;      /* affinity mask */
     int                    priority;      /* priority level */
-    unsigned int           affinity;      /* affinity mask */
     int                    suspend;       /* suspend count */
     obj_handle_t           desktop;       /* desktop handle */
     int                    desktop_users; /* number of objects using the thread desktop */
diff --git a/server/trace.c b/server/trace.c
index e30517d..9643feb 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -1039,8 +1039,9 @@
 {
     fprintf( stderr, " pid=%04x,", req->pid );
     fprintf( stderr, " ppid=%04x,", req->ppid );
-    fprintf( stderr, " priority=%d,", req->priority );
-    fprintf( stderr, " affinity=%08x,", req->affinity );
+    fprintf( stderr, " affinity=" );
+    dump_uint64( &req->affinity );
+    fprintf( stderr, "," );
     fprintf( stderr, " peb=" );
     dump_uint64( &req->peb );
     fprintf( stderr, "," );
@@ -1050,7 +1051,8 @@
     fprintf( stderr, " end_time=" );
     dump_timeout( &req->end_time );
     fprintf( stderr, "," );
-    fprintf( stderr, " exit_code=%d", req->exit_code );
+    fprintf( stderr, " exit_code=%d,", req->exit_code );
+    fprintf( stderr, " priority=%d", req->priority );
 }
 
 static void dump_set_process_info_request( const struct set_process_info_request *req )
@@ -1058,7 +1060,8 @@
     fprintf( stderr, " handle=%04x,", req->handle );
     fprintf( stderr, " mask=%d,", req->mask );
     fprintf( stderr, " priority=%d,", req->priority );
-    fprintf( stderr, " affinity=%08x", req->affinity );
+    fprintf( stderr, " affinity=" );
+    dump_uint64( &req->affinity );
 }
 
 static void dump_get_thread_info_request( const struct get_thread_info_request *req )
@@ -1074,8 +1077,9 @@
     fprintf( stderr, " teb=" );
     dump_uint64( &req->teb );
     fprintf( stderr, "," );
-    fprintf( stderr, " priority=%d,", req->priority );
-    fprintf( stderr, " affinity=%08x,", req->affinity );
+    fprintf( stderr, " affinity=" );
+    dump_uint64( &req->affinity );
+    fprintf( stderr, "," );
     fprintf( stderr, " creation_time=" );
     dump_timeout( &req->creation_time );
     fprintf( stderr, "," );
@@ -1083,6 +1087,7 @@
     dump_timeout( &req->exit_time );
     fprintf( stderr, "," );
     fprintf( stderr, " exit_code=%d,", req->exit_code );
+    fprintf( stderr, " priority=%d,", req->priority );
     fprintf( stderr, " last=%d", req->last );
 }
 
@@ -1091,7 +1096,9 @@
     fprintf( stderr, " handle=%04x,", req->handle );
     fprintf( stderr, " mask=%d,", req->mask );
     fprintf( stderr, " priority=%d,", req->priority );
-    fprintf( stderr, " affinity=%08x,", req->affinity );
+    fprintf( stderr, " affinity=" );
+    dump_uint64( &req->affinity );
+    fprintf( stderr, "," );
     fprintf( stderr, " token=%04x", req->token );
 }