Skip to content
Snippets Groups Projects
protocol.def 126 KiB
Newer Older
/* -*- C -*-
 *
 * Wine server protocol definition
 *
 * Copyright (C) 2001 Alexandre Julliard
 *
 * This file is used by tools/make_requests to build the
 * protocol structures in include/wine/server_protocol.h
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
#include <stdlib.h>
#include <time.h>
typedef unsigned int obj_handle_t;
typedef unsigned int user_handle_t;
typedef unsigned int process_id_t;
typedef unsigned int thread_id_t;
typedef unsigned int data_size_t;
typedef unsigned __int64 lparam_t;
typedef unsigned __int64 apc_param_t;
typedef unsigned __int64 mem_size_t;
typedef unsigned __int64 client_ptr_t;
typedef unsigned __int64 affinity_t;
    data_size_t  request_size; /* request variable part size */
    data_size_t  reply_size;   /* reply variable part maximum size */
    unsigned int error;        /* error result */
    data_size_t  reply_size;   /* reply variable part size */
};

/* placeholder structure for the maximum allowed request size */
/* this is used to construct the generic_request union */
struct request_max_size
{
    int pad[16]; /* the max request size is 16 ints */
};

#define FIRST_USER_HANDLE 0x0020  /* first possible value for low word of user handle */
#define LAST_USER_HANDLE  0xffef  /* last possible value for low word of user handle */


typedef union
{
    int code;   /* event code */
    struct
    {
        int              code;       /* DbgExceptionStateChange */
        int              first;      /* first chance exception? */
        unsigned int     exc_code;   /* exception code */
        unsigned int     flags;      /* exception flags */
        client_ptr_t     record;     /* exception record */
        client_ptr_t     address;    /* exception address */
        int              nb_params;  /* number of parameters */
        int              __pad;
        client_ptr_t     params[15]; /* parameters */
        int          code;       /* DbgCreateThreadStateChange */
        obj_handle_t handle;     /* handle to the new thread */
        client_ptr_t start;      /* thread startup routine */
    } create_thread;
    struct
    {
        int          code;       /* DbgCreateProcessStateChange */
        obj_handle_t file;       /* handle to the process exe file */
        obj_handle_t process;    /* handle to the new process */
        obj_handle_t thread;     /* handle to the new thread */
        mod_handle_t base;       /* base of executable image */
        int          dbg_offset; /* offset of debug info in file */
        int          dbg_size;   /* size of debug info */
        client_ptr_t start;      /* thread startup routine */
    } create_process;
    struct
    {
        int          code;       /* DbgExitThreadStateChange/DbgExitProcessStateChange */
        int          exit_code;  /* thread or process exit code */
    } exit;
    struct
    {
        int          code;       /* DbgLoadDllStateChange */
        obj_handle_t handle;     /* file handle for the dll */
        mod_handle_t base;       /* base address of the dll */
        int          dbg_offset; /* offset of debug info in file */
        int          dbg_size;   /* size of debug info */
        client_ptr_t name;       /* image name (optional) */
    } load_dll;
    struct
    {
        int          code;       /* DbgUnloadDllStateChange */
        int          __pad;
        mod_handle_t base;       /* base address of the dll */
    } unload_dll;
    unsigned int     machine;    /* machine type */
    unsigned int     flags;      /* SERVER_CTX_* flags */
    union
    {
        struct { unsigned int eip, ebp, esp, eflags, cs, ss; } i386_regs;
        struct { unsigned __int64 rip, rbp, rsp;
                 unsigned int cs, ss, flags, __pad; } x86_64_regs;
        struct { unsigned int sp, lr, pc, cpsr; } arm_regs;
André Zwing's avatar
André Zwing committed
        struct { unsigned __int64 sp, pc, pstate; } arm64_regs;
    } ctl;  /* selected by SERVER_CTX_CONTROL */
    union
    {
        struct { unsigned int eax, ebx, ecx, edx, esi, edi; } i386_regs;
        struct { unsigned __int64 rax,rbx, rcx, rdx, rsi, rdi,
                                  r8, r9, r10, r11, r12, r13, r14, r15; } x86_64_regs;
        struct { unsigned int r[13]; } arm_regs;
André Zwing's avatar
André Zwing committed
        struct { unsigned __int64 x[31]; } arm64_regs;
    } integer;  /* selected by SERVER_CTX_INTEGER */
    union
    {
        struct { unsigned int ds, es, fs, gs; } i386_regs;
        struct { unsigned int ds, es, fs, gs; } x86_64_regs;
    } seg;  /* selected by SERVER_CTX_SEGMENTS */
    union
    {
        struct { unsigned int ctrl, status, tag, err_off, err_sel, data_off, data_sel, cr0npx;
                 unsigned char regs[80]; } i386_regs;
        struct { struct { unsigned __int64 low, high; } fpregs[32]; } x86_64_regs;
        struct { unsigned __int64 d[32]; unsigned int fpscr; } arm_regs;
        struct { struct { unsigned __int64 low, high; } q[32]; unsigned int fpcr, fpsr; } arm64_regs;
    } fp;  /* selected by SERVER_CTX_FLOATING_POINT */
    union
    {
        struct { unsigned int dr0, dr1, dr2, dr3, dr6, dr7; } i386_regs;
        struct { unsigned __int64 dr0, dr1, dr2, dr3, dr6, dr7; } x86_64_regs;
        struct { unsigned int bvr[8], bcr[8], wvr[1], wcr[1]; } arm_regs;
        struct { unsigned __int64 bvr[8], wvr[2]; unsigned int bcr[8], wcr[2]; } arm64_regs;
    } debug;  /* selected by SERVER_CTX_DEBUG_REGISTERS */
    union
    {
        unsigned char i386_regs[512];
    } ext;                       /* selected by SERVER_CTX_EXTENDED_REGISTERS */
        struct { struct { unsigned __int64 low, high; } ymm_high[16]; } regs;
    } ymm;                       /* selected by SERVER_CTX_YMM_REGISTERS */
} context_t;

#define SERVER_CTX_CONTROL            0x01
#define SERVER_CTX_INTEGER            0x02
#define SERVER_CTX_SEGMENTS           0x04
#define SERVER_CTX_FLOATING_POINT     0x08
#define SERVER_CTX_DEBUG_REGISTERS    0x10
#define SERVER_CTX_EXTENDED_REGISTERS 0x20
#define SERVER_CTX_YMM_REGISTERS      0x40
/* structure used in sending an fd from client to server */
struct send_fd
{
    thread_id_t tid;  /* thread id */
    int         fd;   /* file descriptor on client-side */
};

/* structure sent by the server on the wait fifo */
struct wake_up_reply
{
    client_ptr_t cookie;    /* magic cookie that was passed in select_request */
    int          signaled;  /* wait result */
/* NT-style timeout, in 100ns units, negative means relative timeout */
typedef __int64 timeout_t;
#define TIMEOUT_INFINITE (((timeout_t)0x7fffffff) << 32 | 0xffffffff)
/* absolute timeout, negative means that monotonic clock is used */
typedef __int64 abstime_t;

/* structure for process startup info */
typedef struct
{
    unsigned int debug_flags;
    unsigned int console_flags;
    obj_handle_t console;
    obj_handle_t hstdin;
    obj_handle_t hstdout;
    obj_handle_t hstderr;
    unsigned int x;
    unsigned int y;
    unsigned int xsize;
    unsigned int ysize;
    unsigned int xchars;
    unsigned int ychars;
    unsigned int attribute;
    unsigned int flags;
    unsigned int show;
    data_size_t  curdir_len;
    data_size_t  dllpath_len;
    data_size_t  imagepath_len;
    data_size_t  cmdline_len;
    data_size_t  title_len;
    data_size_t  desktop_len;
    data_size_t  shellinfo_len;
    data_size_t  runtime_len;
    /* VARARG(curdir,unicode_str,curdir_len); */
    /* VARARG(dllpath,unicode_str,dllpath_len); */
    /* VARARG(imagepath,unicode_str,imagepath_len); */
    /* VARARG(cmdline,unicode_str,cmdline_len); */
    /* VARARG(title,unicode_str,title_len); */
    /* VARARG(desktop,unicode_str,desktop_len); */
    /* VARARG(shellinfo,unicode_str,shellinfo_len); */
    /* VARARG(runtime,unicode_str,runtime_len); */
} startup_info_t;

/* structure returned in the list of window properties */
typedef struct
{
    atom_t         atom;     /* property atom */
    int            string;   /* was atom a string originally? */
    lparam_t       data;     /* data stored in property */
/* structure to specify window rectangles */
typedef struct
{
    int  left;
    int  top;
    int  right;
    int  bottom;
} rectangle_t;

/* structure for parameters of async I/O calls */
typedef struct
{
    obj_handle_t    handle;        /* object to perform I/O on */
    obj_handle_t    event;         /* event to signal when done */
    client_ptr_t    iosb;          /* I/O status block in client addr space */
    client_ptr_t    user;          /* opaque user data containing callback pointer and async-specific data */
    client_ptr_t    apc;           /* user APC to call */
    apc_param_t     apc_context;   /* user APC context or completion value */
struct hw_msg_source
{
    unsigned int    device;        /* source device (IMDT_* values) */
    unsigned int    origin;        /* source origin (IMO_* values) */
};

union rawinput
{
    int type;
    struct
    {
        int            type;    /* RIM_TYPEKEYBOARD */
        unsigned int   message; /* message generated by this rawinput event */
        unsigned short vkey;    /* virtual key code */
        unsigned short scan;    /* scan code */
    } kbd;
    struct
    {
        int            type;    /* RIM_TYPEMOUSE */
        int            x;       /* x coordinate */
        int            y;       /* y coordinate */
        unsigned int   data;    /* mouse data */
    } mouse;
    struct
    {
        int            type;    /* RIM_TYPEHID */
        unsigned int   device;  /* rawinput device index */
        unsigned int   param;   /* rawinput message param */
        unsigned short usage_page;/* HID usage page */
        unsigned short usage;   /* HID usage */
        unsigned int   count;   /* HID report count */
        unsigned int   length;  /* HID report length */
    lparam_t             info;      /* extra info */
    data_size_t          size;      /* size of hardware message data */
    int                  __pad;
    unsigned int         hw_id;     /* unique id */
    unsigned int         flags;     /* hook flags */
    struct hw_msg_source source;    /* message source */
    union rawinput       rawinput;  /* rawinput message data */
    client_ptr_t    callback;   /* callback function */
    lparam_t        data;       /* user data for callback */
    lparam_t        result;     /* message result */
struct winevent_msg_data
{
    user_handle_t   hook;       /* hook handle */
    thread_id_t     tid;        /* thread id */
    client_ptr_t    hook_proc;  /* hook proc address */
typedef union
{
    int type;
    struct
    {
        int            type;    /* INPUT_KEYBOARD */
        unsigned short vkey;    /* virtual key code */
        unsigned short scan;    /* scan code */
        unsigned int   flags;   /* event flags */
        unsigned int   time;    /* event time */
        lparam_t       info;    /* extra info */
    } kbd;
    struct
    {
        int            type;    /* INPUT_MOUSE */
        int            x;       /* coordinates */
        int            y;
        unsigned int   data;    /* mouse data */
        unsigned int   flags;   /* event flags */
        unsigned int   time;    /* event time */
        lparam_t       info;    /* extra info */
    } mouse;
    struct
    {
        int            type;    /* INPUT_HARDWARE */
        unsigned int   msg;     /* message code */
        lparam_t       lparam;  /* message param */
        union rawinput rawinput;/* rawinput message data */
typedef union
{
    unsigned char            bytes[1];   /* raw data for sent messages */
    struct hardware_msg_data hardware;
/* structure returned in filesystem events */
struct filesystem_event
{
    int         action;
    data_size_t len;
    char        name[1];
};

typedef struct
{
    unsigned int low_part;
    int          high_part;
} luid_t;

typedef struct
{
    unsigned int read;
    unsigned int write;
    unsigned int exec;
    unsigned int all;
} generic_map_t;

#define MAX_ACL_LEN 65535

struct security_descriptor
{
    unsigned int control;       /* SE_ flags */
    data_size_t  owner_len;
    data_size_t  group_len;
    data_size_t  sacl_len;
    data_size_t  dacl_len;
    /* VARARG(owner,SID); */
    /* VARARG(group,SID); */
    /* VARARG(sacl,ACL); */
    /* VARARG(dacl,ACL); */
};

struct object_attributes
{
    obj_handle_t rootdir;       /* root directory */
    unsigned int attributes;    /* object attributes */
    data_size_t  sd_len;        /* length of security_descriptor data. may be 0 */
    data_size_t  name_len;      /* length of the name string. may be 0 */
    /* VARARG(sd,security_descriptor); */
    /* VARARG(name,unicode_str); */
struct object_type_info
{
    data_size_t   name_len;      /* length of the name string */
    unsigned int  index;         /* type index in global table */
    unsigned int  obj_count;     /* count of objects of this type */
    unsigned int  handle_count;  /* count of handles of this type */
    unsigned int  obj_max;       /* max count of objects of this type */
    unsigned int  handle_max;    /* max count of handles of this type */
    unsigned int  valid_access;  /* mask for valid access bits */
    generic_map_t mapping;       /* generic access mappings */
struct token_groups
{
    unsigned int count;
    /* unsigned int attributes[count]; */
    SELECT_SIGNAL_AND_WAIT,
    SELECT_KEYED_EVENT_WAIT,
    SELECT_KEYED_EVENT_RELEASE
        enum select_op  op;      /* SELECT_WAIT or SELECT_WAIT_ALL */
        obj_handle_t    handles[MAXIMUM_WAIT_OBJECTS];
    } wait;
    struct
    {
        enum select_op  op;      /* SELECT_SIGNAL_AND_WAIT */
        obj_handle_t    wait;
        obj_handle_t    signal;  /* must be last in the structure so we can remove it on retries */
    } signal_and_wait;
    struct
    {
        enum select_op  op;      /* SELECT_KEYED_EVENT_WAIT or SELECT_KEYED_EVENT_RELEASE */
        obj_handle_t    handle;
        client_ptr_t    key;
    } keyed_event;
enum apc_type
{
    APC_NONE,
    APC_USER,
    APC_ASYNC_IO,
    APC_VIRTUAL_ALLOC,
    APC_CREATE_THREAD,
    APC_BREAK_PROCESS
    enum apc_type    type;     /* APC_USER */
    int              __pad;
    client_ptr_t     func;     /* void (__stdcall *func)(ULONG_PTR,ULONG_PTR,ULONG_PTR); */
    apc_param_t      args[3];  /* arguments for user function */
} user_apc_t;

typedef union
{
    enum apc_type type;
    user_apc_t    user;
    struct
    {
        enum apc_type    type;     /* APC_ASYNC_IO */
        unsigned int     status;   /* I/O status */
        client_ptr_t     user;     /* user pointer */
        client_ptr_t     sb;       /* status block */
        data_size_t      result;   /* result size */
        enum apc_type    type;         /* APC_VIRTUAL_ALLOC */
        unsigned int     op_type;      /* type of operation */
        client_ptr_t     addr;         /* requested address */
        mem_size_t       size;         /* allocation size */
        mem_size_t       zero_bits;    /* number of zero high bits */
        unsigned int     prot;         /* memory protection flags */
    } virtual_alloc;
    struct
    {
        enum apc_type    type;      /* APC_VIRTUAL_FREE */
        unsigned int     op_type;   /* type of operation */
        client_ptr_t     addr;      /* requested address */
        mem_size_t       size;      /* allocation size */
    struct
    {
        enum apc_type    type;      /* APC_VIRTUAL_QUERY */
        int              __pad;
        client_ptr_t     addr;      /* requested address */
    struct
    {
        enum apc_type    type;      /* APC_VIRTUAL_PROTECT */
        unsigned int     prot;      /* new protection flags */
        client_ptr_t     addr;      /* requested address */
        mem_size_t       size;      /* requested size */
    struct
    {
        enum apc_type    type;      /* APC_VIRTUAL_FLUSH */
        int              __pad;
        client_ptr_t     addr;      /* requested address */
        mem_size_t       size;      /* requested size */
    struct
    {
        enum apc_type    type;      /* APC_VIRTUAL_LOCK */
        int              __pad;
        client_ptr_t     addr;      /* requested address */
        mem_size_t       size;      /* requested size */
    } virtual_lock;
    struct
    {
        enum apc_type    type;      /* APC_VIRTUAL_UNLOCK */
        int              __pad;
        client_ptr_t     addr;      /* requested address */
        mem_size_t       size;      /* requested size */
        enum apc_type    type;         /* APC_MAP_VIEW */
        obj_handle_t     handle;       /* mapping handle */
        client_ptr_t     addr;         /* requested address */
        mem_size_t       size;         /* allocation size */
        file_pos_t       offset;       /* file offset */
        mem_size_t       zero_bits;    /* number of zero high bits */
        unsigned int     alloc_type;   /* allocation type */
        unsigned int     prot;         /* memory protection flags */
    } map_view;
    struct
    {
        enum apc_type    type;      /* APC_UNMAP_VIEW */
    {
        enum apc_type    type;      /* APC_CREATE_THREAD */
        unsigned int     flags;     /* creation flags */
        client_ptr_t     func;      /* void (__stdcall *func)(void*);  start function */
        client_ptr_t     arg;       /* argument for start function */
        mem_size_t       zero_bits; /* number of zero high bits for thread stack */
        mem_size_t       reserve;   /* reserve size for thread stack */
        mem_size_t       commit;    /* commit size for thread stack */
    struct
    {
        enum apc_type    type;         /* APC_DUP_HANDLE */
        obj_handle_t     src_handle;   /* src handle to duplicate */
        obj_handle_t     dst_process;  /* dst process handle */
        unsigned int     access;       /* wanted access rights */
        unsigned int     attributes;   /* object attributes */
        unsigned int     options;      /* duplicate options */
    } dup_handle;
typedef union
{
    enum apc_type type;
    struct
    {
        enum apc_type    type;      /* APC_ASYNC_IO */
        unsigned int     status;    /* new status of async operation */
        unsigned int     total;     /* bytes transferred */
    {
        enum apc_type    type;      /* APC_VIRTUAL_ALLOC */
        unsigned int     status;    /* status returned by call */
        mem_size_t       size;      /* resulting size */
    } virtual_alloc;
    struct
    {
        enum apc_type    type;      /* APC_VIRTUAL_FREE */
        unsigned int     status;    /* status returned by call */
        mem_size_t       size;      /* resulting size */
    struct
    {
        enum apc_type    type;      /* APC_VIRTUAL_QUERY */
        unsigned int     status;    /* status returned by call */
        client_ptr_t     base;      /* resulting base address */
        client_ptr_t     alloc_base;/* resulting allocation base */
        mem_size_t       size;      /* resulting region size */
        unsigned short   state;     /* resulting region state */
        unsigned short   prot;      /* resulting region protection */
        unsigned short   alloc_prot;/* resulting allocation protection */
        unsigned short   alloc_type;/* resulting region allocation type */
    struct
    {
        enum apc_type    type;      /* APC_VIRTUAL_PROTECT */
        unsigned int     status;    /* status returned by call */
        mem_size_t       size;      /* resulting size */
        unsigned int     prot;      /* old protection flags */
    } virtual_protect;
    struct
    {
        enum apc_type    type;      /* APC_VIRTUAL_FLUSH */
        unsigned int     status;    /* status returned by call */
        mem_size_t       size;      /* resulting size */
    struct
    {
        enum apc_type    type;      /* APC_VIRTUAL_LOCK */
        unsigned int     status;    /* status returned by call */
        mem_size_t       size;      /* resulting size */
    } virtual_lock;
    struct
    {
        enum apc_type    type;      /* APC_VIRTUAL_UNLOCK */
        unsigned int     status;    /* status returned by call */
        mem_size_t       size;      /* resulting size */
    {
        enum apc_type    type;      /* APC_MAP_VIEW */
        unsigned int     status;    /* status returned by call */
        mem_size_t       size;      /* resulting size */
        enum apc_type    type;      /* APC_UNMAP_VIEW */
        unsigned int     status;    /* status returned by call */
    } unmap_view;
    struct
    {
        enum apc_type    type;      /* APC_CREATE_THREAD */
        unsigned int     status;    /* status returned by call */
        process_id_t     pid;       /* process id */
        thread_id_t      tid;       /* thread id */
        client_ptr_t     teb;       /* thread teb (in process address space) */
        obj_handle_t     handle;    /* handle to new thread */
    } create_thread;
    {
        enum apc_type    type;      /* APC_DUP_HANDLE */
        unsigned int     status;    /* status returned by call */
        obj_handle_t     handle;    /* duplicated handle in dst process */
    } dup_handle;
    struct
    {
        enum apc_type    type;      /* APC_BREAK_PROCESS */
        unsigned int     status;    /* status returned by call */
    } break_process;
enum irp_type
{
    IRP_CALL_NONE,
    IRP_CALL_CREATE,
    IRP_CALL_CLOSE,
    IRP_CALL_READ,
    IRP_CALL_WRITE,
    IRP_CALL_FLUSH,
    IRP_CALL_IOCTL,
    IRP_CALL_FREE,
    IRP_CALL_CANCEL
    enum irp_type        type;      /* irp call type */
        enum irp_type    type;      /* IRP_CALL_CREATE */
        unsigned int     access;    /* access rights */
        unsigned int     sharing;   /* sharing flags */
        unsigned int     options;   /* file options */
        client_ptr_t     device;    /* opaque ptr for the device */
        obj_handle_t     file;      /* file handle */
        enum irp_type    type;      /* IRP_CALL_CLOSE */
        client_ptr_t     file;      /* opaque ptr for the file object */
        enum irp_type    type;      /* IRP_CALL_READ */
        unsigned int     key;       /* driver key */
        data_size_t      out_size;  /* needed output size */
        int              __pad;
        client_ptr_t     file;      /* opaque ptr for the file object */
        file_pos_t       pos;       /* file position */
    } read;
    struct
    {
        enum irp_type    type;      /* IRP_CALL_WRITE */
        unsigned int     key;       /* driver key */
        client_ptr_t     file;      /* opaque ptr for the file object */
        file_pos_t       pos;       /* file position */
    } write;
    struct
        enum irp_type    type;      /* IRP_CALL_FLUSH */
        client_ptr_t     file;      /* opaque ptr for the file object */
        enum irp_type    type;      /* IRP_CALL_IOCTL */
        ioctl_code_t     code;      /* ioctl code */
        data_size_t      out_size;  /* needed output size */
        int              __pad;
        client_ptr_t     file;      /* opaque ptr for the file object */
    {
        enum irp_type    type;      /* IRP_CALL_VOLUME */
        unsigned int     info_class;/* information class */
        data_size_t      out_size;  /* needed output size */
        int              __pad;
        client_ptr_t     file;      /* opaque ptr for the file object */
    } volume;
    struct
        enum irp_type    type;      /* IRP_CALL_FREE */
        int              __pad;
        client_ptr_t     obj;       /* opaque ptr for the freed object */
    struct
    {
        enum irp_type    type;      /* IRP_CALL_CANCEL */
        int              __pad;
        client_ptr_t     irp;       /* opaque ptr for canceled irp */
    } cancel;
/* information about a PE image mapping, roughly equivalent to SECTION_IMAGE_INFORMATION */
typedef struct
{
    client_ptr_t   base;
    mem_size_t     stack_size;
    mem_size_t     stack_commit;
    unsigned int   entry_point;
    unsigned int   map_size;
    unsigned int   zerobits;
    unsigned int   subsystem;
    unsigned short subsystem_minor;
    unsigned short subsystem_major;
    unsigned short osversion_major;
    unsigned short osversion_minor;
    unsigned short image_charact;
    unsigned short dll_charact;
    unsigned short machine;
    unsigned char  contains_code;
    unsigned char  image_flags;
    unsigned int   loader_flags;
    unsigned int   header_size;
    unsigned int   file_size;
    unsigned int   checksum;
    unsigned int   dbg_offset;
    unsigned int   dbg_size;
#define IMAGE_FLAGS_ComPlusNativeReady        0x01
#define IMAGE_FLAGS_ComPlusILOnly             0x02
#define IMAGE_FLAGS_ImageDynamicallyRelocated 0x04
#define IMAGE_FLAGS_ImageMappedFlat           0x08
#define IMAGE_FLAGS_BaseBelow4gb              0x10
#define IMAGE_FLAGS_ComPlusPrefer32bit        0x20
#define IMAGE_FLAGS_WineBuiltin               0x40
#define IMAGE_FLAGS_WineFakeDll               0x80
struct rawinput_device
{
    unsigned short usage_page;
    unsigned short usage;
    unsigned int   flags;
    user_handle_t  target;
};

typedef struct
{
    int x;
    int y;
    unsigned int time;
    int __pad;
    lparam_t info;
} cursor_pos_t;

/****************************************************************/
/* Request declarations */

/* Create a new process from the context of the parent */
@REQ(new_process)
    obj_handle_t token;          /* process token */
    obj_handle_t debug;          /* process debug object */
    obj_handle_t parent_process; /* parent process */
    unsigned int flags;          /* process creation flags */
    int          socket_fd;      /* file descriptor for process socket */
    unsigned int access;         /* access rights for process object */
    unsigned short machine;      /* architecture that the new process will use */
    data_size_t  info_size;      /* size of startup info */
    data_size_t  handles_size;   /* length of explicit handles list */
    data_size_t  jobs_size;      /* length of jobs list */
    VARARG(objattr,object_attributes);   /* object attributes */
    VARARG(handles,uints,handles_size);  /* handles list */
    VARARG(jobs,uints,jobs_size);        /* jobs list */
    VARARG(info,startup_info,info_size); /* startup information */
    VARARG(env,unicode_str);     /* environment for new process */
    obj_handle_t info;           /* new process info handle */
    process_id_t pid;            /* process id */
    obj_handle_t handle;         /* process handle (in the current process) */
@END


/* Retrieve information about a newly started process */
@REQ(get_new_process_info)
    obj_handle_t info;           /* info handle returned from new_process_request */
    int          success;      /* did the process start successfully? */
    int          exit_code;    /* process exit code if failed */
    obj_handle_t process;      /* process in which to create thread */
    unsigned int access;       /* wanted access rights */
    int          suspend;      /* new thread should be suspended on creation */
    int          request_fd;   /* fd for request pipe */
    VARARG(objattr,object_attributes); /* object attributes */
    obj_handle_t handle;       /* thread handle (in the current process) */
/* Retrieve the new process startup info */
@REQ(get_startup_info)
@REPLY
    data_size_t  info_size;    /* size of startup info */
    VARARG(info,startup_info,info_size); /* startup information */
    VARARG(env,unicode_str);   /* environment */
@END


/* Signal the end of the process initialization */
@REQ(init_process_done)
    client_ptr_t teb;          /* TEB of new thread (in process address space) */
    client_ptr_t peb;          /* PEB of new process (in process address space) */
    client_ptr_t ldt_copy;     /* address of LDT copy (in process address space) */
    client_ptr_t entry;        /* process entry point */
/* Initialize the first thread of a new process */
@REQ(init_first_thread)
    int          unix_pid;     /* Unix pid of new process */
    int          unix_tid;     /* Unix tid of new thread */
    int          reply_fd;     /* fd for reply pipe */
    int          wait_fd;      /* fd for blocking calls pipe */
@REPLY
    process_id_t pid;          /* process id of the new thread's process */
    thread_id_t  tid;          /* thread id of the new thread */
    timeout_t    server_start; /* server start time */
    unsigned int session_id;   /* process session id */
    data_size_t  info_size;    /* total size of startup info */
    VARARG(machines,ushorts);  /* array of supported machines */
@END


/* Initialize a new thread; called from the child after pthread_create() */
@REQ(init_thread)
    int          unix_tid;     /* Unix tid of new thread */
    int          reply_fd;     /* fd for reply pipe */
    int          wait_fd;      /* fd for blocking calls pipe */
    client_ptr_t teb;          /* TEB of new thread (in thread address space) */
    client_ptr_t entry;        /* entry point (in thread address space) */
@REPLY
@END


/* Terminate a process */
@REQ(terminate_process)
    obj_handle_t handle;       /* process handle to terminate */
    int          exit_code;    /* process exit code */
@REPLY
    int          self;         /* suicide? */
@END


/* Terminate a thread */
@REQ(terminate_thread)
    obj_handle_t handle;       /* thread handle to terminate */
    int          exit_code;    /* thread exit code */
@REPLY
    int          self;         /* suicide? */
@END


/* Retrieve information about a process */
@REQ(get_process_info)
    obj_handle_t handle;           /* process handle */
    process_id_t pid;              /* server process id */
    process_id_t ppid;             /* server process id of parent */
    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 */
    unsigned int session_id;       /* process session id */
    int          exit_code;        /* process exit code */
    int          priority;         /* priority class */
    unsigned short machine;        /* process architecture */
    VARARG(image,pe_image_info);   /* image info for main exe */
@END


/* Retrieve debug information about a process */
@REQ(get_process_debug_info)
    obj_handle_t handle;           /* process handle */
@REPLY
    obj_handle_t debug;            /* handle to debug port */
    int          debug_children;   /* inherit debugger to child processes */
    VARARG(image,pe_image_info);   /* image info for main exe */
/* Fetch the name of the process image */
@REQ(get_process_image_name)
    obj_handle_t handle;           /* process handle */
    int          win32;            /* return a win32 filename? */
@REPLY
    data_size_t  len;              /* len in bytes required to store filename */
    VARARG(name,unicode_str);      /* image name for main exe */
@END


/* Retrieve information about a process memory usage */
@REQ(get_process_vm_counters)
    obj_handle_t handle;                        /* process handle */
@REPLY
    mem_size_t peak_virtual_size;               /* peak virtual memory in bytes */
    mem_size_t virtual_size;                    /* virtual memory in bytes */
    mem_size_t peak_working_set_size;           /* peak real memory in bytes */
    mem_size_t working_set_size;                /* real memory in bytes */
    mem_size_t pagefile_usage;                  /* commit charge in bytes */
    mem_size_t peak_pagefile_usage;             /* peak commit charge in bytes */