protocol.def 120 KB
Newer Older
1 2 3 4 5 6 7 8
/* -*- 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
9 10 11 12 13 14 15 16 17 18 19 20 21
 *
 * 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
22
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 24 25 26
 */

@HEADER  /* start of C declarations */

27
#include <stdarg.h>
28 29
#include <stdlib.h>
#include <time.h>
30 31 32

#include <windef.h>
#include <winbase.h>
33

34
typedef unsigned int obj_handle_t;
35
typedef unsigned int user_handle_t;
36
typedef unsigned int atom_t;
37 38 39
typedef unsigned int process_id_t;
typedef unsigned int thread_id_t;
typedef unsigned int data_size_t;
40
typedef unsigned int ioctl_code_t;
41
typedef unsigned __int64 lparam_t;
42
typedef unsigned __int64 apc_param_t;
43
typedef unsigned __int64 mem_size_t;
44
typedef unsigned __int64 file_pos_t;
45
typedef unsigned __int64 client_ptr_t;
46
typedef unsigned __int64 affinity_t;
47
typedef client_ptr_t mod_handle_t;
48

49 50
struct request_header
{
51
    int          req;          /* request code */
52 53
    data_size_t  request_size; /* request variable part size */
    data_size_t  reply_size;   /* reply variable part maximum size */
54 55 56 57
};

struct reply_header
{
58
    unsigned int error;        /* error result */
59
    data_size_t  reply_size;   /* reply variable part size */
60 61 62 63 64 65 66 67 68
};

/* 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 */
};

69 70 71 72
#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 */


73
/* debug event data */
74 75 76 77 78
typedef union
{
    int code;   /* event code */
    struct
    {
79 80 81 82 83 84 85 86 87
        int              code;       /* EXCEPTION_DEBUG_EVENT */
        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 */
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
    } exception;
    struct
    {
        int          code;       /* CREATE_THREAD_DEBUG_EVENT */
        obj_handle_t handle;     /* handle to the new thread */
        client_ptr_t teb;        /* thread teb (in debugged process address space) */
        client_ptr_t start;      /* thread startup routine */
    } create_thread;
    struct
    {
        int          code;       /* CREATE_PROCESS_DEBUG_EVENT */
        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 teb;        /* thread teb (in debugged process address space) */
        client_ptr_t start;      /* thread startup routine */
        client_ptr_t name;       /* image name (optional) */
        int          unicode;    /* is it Unicode? */
    } create_process;
    struct
    {
        int          code;       /* EXIT_THREAD_DEBUG_EVENT/EXIT_PROCESS_DEBUG_EVENT */
        int          exit_code;  /* thread or process exit code */
    } exit;
    struct
    {
        int          code;       /* LOAD_DLL_DEBUG_EVENT */
        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) */
        int          unicode;    /* is it Unicode? */
    } load_dll;
    struct
    {
        int          code;       /* UNLOAD_DLL_DEBUG_EVENT */
        int          __pad;
        mod_handle_t base;       /* base address of the dll */
    } unload_dll;
    struct
    {
        int          code;       /* OUTPUT_DEBUG_STRING_EVENT */
        data_size_t  length;     /* string length */
135
        client_ptr_t string;     /* string to display (in debugged process address space) */
136 137 138 139 140 141 142
    } output_string;
    struct
    {
        int          code;       /* RIP_EVENT */
        int          error;      /* ??? */
        int          type;       /* ??? */
    } rip_info;
143 144
} debug_event_t;

145 146 147
/* supported CPU types */
enum cpu_type
{
148
    CPU_x86, CPU_x86_64, CPU_POWERPC, CPU_ARM, CPU_ARM64
149 150 151
};
typedef int cpu_type_t;

152 153 154 155 156 157 158 159 160
/* context data */
typedef struct
{
    cpu_type_t       cpu;        /* cpu 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;
161 162
                 unsigned int cs, ss, flags, __pad; } x86_64_regs;
        struct { unsigned int iar, msr, ctr, lr, dar, dsisr, trap, __pad; } powerpc_regs;
163
        struct { unsigned int sp, lr, pc, cpsr; } arm_regs;
164
        struct { unsigned __int64 sp, pc, pstate; } arm64_regs;
165 166 167 168 169 170 171
    } 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 gpr[32], cr, xer; } powerpc_regs;
172
        struct { unsigned int r[13]; } arm_regs;
173
        struct { unsigned __int64 x[31]; } arm64_regs;
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
    } 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 { double fpr[32], fpscr; } powerpc_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 dr[8]; } powerpc_regs;
    } debug;  /* selected by SERVER_CTX_DEBUG_REGISTERS */
    union
    {
        unsigned char i386_regs[512];
    } ext;                       /* selected by SERVER_CTX_EXTENDED_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

206 207 208
/* structure used in sending an fd from client to server */
struct send_fd
{
209 210
    thread_id_t tid;  /* thread id */
    int         fd;   /* file descriptor on client-side */
211 212 213 214 215
};

/* structure sent by the server on the wait fifo */
struct wake_up_reply
{
216 217
    client_ptr_t cookie;    /* magic cookie that was passed in select_request */
    int          signaled;  /* wait result */
218
    int          __pad;
219 220
};

221 222 223
/* NT-style timeout, in 100ns units, negative means relative timeout */
typedef __int64 timeout_t;
#define TIMEOUT_INFINITE (((timeout_t)0x7fffffff) << 32 | 0xffffffff)
224

225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
/* 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;

261 262 263 264
/* structure returned in the list of window properties */
typedef struct
{
    atom_t         atom;     /* property atom */
265
    int            string;   /* was atom a string originally? */
266
    lparam_t       data;     /* data stored in property */
267 268
} property_data_t;

269 270 271 272 273 274 275 276 277
/* structure to specify window rectangles */
typedef struct
{
    int  left;
    int  top;
    int  right;
    int  bottom;
} rectangle_t;

278 279 280
/* structure for parameters of async I/O calls */
typedef struct
{
281 282
    obj_handle_t    handle;        /* object to perform I/O on */
    obj_handle_t    event;         /* event to signal when done */
283 284 285
    client_ptr_t    callback;      /* client-side callback to call upon end of async */
    client_ptr_t    iosb;          /* I/O status block in client addr space */
    client_ptr_t    arg;           /* opaque user data to pass to callback */
286
    apc_param_t     cvalue;        /* completion value to use for completion events */
287 288
} async_data_t;

289
/* structures for extra message data */
290

291 292 293 294 295 296
struct hardware_msg_data
{
    lparam_t        info;      /* extra info */
    int             x;         /* x position */
    int             y;         /* y position */
    unsigned int    hw_id;     /* unique id */
297
    unsigned int    flags;     /* hook flags */
298 299 300 301
    union
    {
        int type;
        struct
302 303 304 305 306 307 308
        {
            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
309 310 311 312 313 314 315
        {
            int            type;    /* RIM_TYPEMOUSE */
            int            x;       /* x coordinate */
            int            y;       /* y coordinate */
            unsigned int   data;    /* mouse data */
        } mouse;
    } rawinput;
316 317
};

318 319
struct callback_msg_data
{
320
    client_ptr_t    callback;   /* callback function */
321 322
    lparam_t        data;       /* user data for callback */
    lparam_t        result;     /* message result */
323 324
};

325 326 327 328
struct winevent_msg_data
{
    user_handle_t   hook;       /* hook handle */
    thread_id_t     tid;        /* thread id */
329
    client_ptr_t    hook_proc;  /* hook proc address */
330 331 332
    /* followed by module name if any */
};

333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362
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 */
    } hw;
} hw_input_t;

363 364 365
typedef union
{
    unsigned char            bytes[1];   /* raw data for sent messages */
366
    struct hardware_msg_data hardware;
367
    struct callback_msg_data callback;
368 369 370
    struct winevent_msg_data winevent;
} message_data_t;

371 372 373 374 375 376 377
/* structure for console char/attribute info */
typedef struct
{
    WCHAR          ch;
    unsigned short attr;
} char_info_t;

378 379 380 381 382 383 384 385
/* structure returned in filesystem events */
struct filesystem_event
{
    int         action;
    data_size_t len;
    char        name[1];
};

386 387 388 389 390 391
typedef struct
{
    unsigned int low_part;
    int          high_part;
} luid_t;

392 393 394 395 396
#define MAX_ACL_LEN 65535

struct security_descriptor
{
    unsigned int control;       /* SE_ flags */
397 398 399 400
    data_size_t  owner_len;
    data_size_t  group_len;
    data_size_t  sacl_len;
    data_size_t  dacl_len;
401 402 403 404 405 406 407 408 409 410
    /* VARARG(owner,SID); */
    /* VARARG(group,SID); */
    /* VARARG(sacl,ACL); */
    /* VARARG(dacl,ACL); */
};

struct object_attributes
{
    obj_handle_t rootdir; /* root directory */
    data_size_t sd_len;   /* length of security_descriptor data. may be 0 */
411
    data_size_t name_len; /* length of the name string. may be 0 */
412 413
    /* VARARG(sd,security_descriptor); */
    /* VARARG(name,unicode_str); */
414 415
};

416 417 418 419
struct token_groups
{
    unsigned int count;
    /* unsigned int attributes[count]; */
420
    /* VARARG(sids,SID); */
421 422
};

423 424 425
enum select_op
{
    SELECT_NONE,
426
    SELECT_WAIT,
427
    SELECT_WAIT_ALL,
428 429 430
    SELECT_SIGNAL_AND_WAIT,
    SELECT_KEYED_EVENT_WAIT,
    SELECT_KEYED_EVENT_RELEASE
431 432 433 434 435 436 437
};

typedef union
{
    enum select_op op;
    struct
    {
438
        enum select_op  op;      /* SELECT_WAIT or SELECT_WAIT_ALL */
439 440
        obj_handle_t    handles[MAXIMUM_WAIT_OBJECTS];
    } wait;
441 442 443 444 445 446
    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;
447 448 449 450 451 452
    struct
    {
        enum select_op  op;      /* SELECT_KEYED_EVENT_WAIT or SELECT_KEYED_EVENT_RELEASE */
        obj_handle_t    handle;
        client_ptr_t    key;
    } keyed_event;
453 454
} select_op_t;

455 456 457 458 459 460 461
enum apc_type
{
    APC_NONE,
    APC_USER,
    APC_TIMER,
    APC_ASYNC_IO,
    APC_VIRTUAL_ALLOC,
462
    APC_VIRTUAL_FREE,
463
    APC_VIRTUAL_QUERY,
464
    APC_VIRTUAL_PROTECT,
465 466
    APC_VIRTUAL_FLUSH,
    APC_VIRTUAL_LOCK,
467
    APC_VIRTUAL_UNLOCK,
468 469
    APC_MAP_VIEW,
    APC_UNMAP_VIEW,
470
    APC_CREATE_THREAD
471
};
472 473 474 475 476 477 478

typedef union
{
    enum apc_type type;
    struct
    {
        enum apc_type    type;     /* APC_USER */
479 480
        int              __pad;
        client_ptr_t     func;     /* void (__stdcall *func)(ULONG_PTR,ULONG_PTR,ULONG_PTR); */
481
        apc_param_t      args[3];  /* arguments for user function */
482 483 484
    } user;
    struct
    {
485
        enum apc_type    type;     /* APC_TIMER */
486
        int              __pad;
487
        client_ptr_t     func;     /* void (__stdcall *func)(void*, unsigned int, unsigned int); */
488
        timeout_t        time;     /* absolute time of expiration */
489
        client_ptr_t     arg;      /* user argument */
490 491 492 493 494
    } timer;
    struct
    {
        enum apc_type    type;     /* APC_ASYNC_IO */
        unsigned int     status;   /* I/O status */
495 496 497
        client_ptr_t     func;     /* unsigned int (*func)(void*, void*, unsigned int, void **); */
        client_ptr_t     user;     /* user pointer */
        client_ptr_t     sb;       /* status block */
498
    } async_io;
499 500 501
    struct
    {
        enum apc_type    type;      /* APC_VIRTUAL_ALLOC */
502 503
        unsigned int     op_type;   /* type of operation */
        client_ptr_t     addr;      /* requested address */
504
        mem_size_t       size;      /* allocation size */
505 506 507 508 509 510 511
        unsigned int     zero_bits; /* allocation alignment */
        unsigned int     prot;      /* memory protection flags */
    } virtual_alloc;
    struct
    {
        enum apc_type    type;      /* APC_VIRTUAL_FREE */
        unsigned int     op_type;   /* type of operation */
512 513
        client_ptr_t     addr;      /* requested address */
        mem_size_t       size;      /* allocation size */
514
    } virtual_free;
515 516 517
    struct
    {
        enum apc_type    type;      /* APC_VIRTUAL_QUERY */
518 519
        int              __pad;
        client_ptr_t     addr;      /* requested address */
520
    } virtual_query;
521 522 523 524
    struct
    {
        enum apc_type    type;      /* APC_VIRTUAL_PROTECT */
        unsigned int     prot;      /* new protection flags */
525 526
        client_ptr_t     addr;      /* requested address */
        mem_size_t       size;      /* requested size */
527
    } virtual_protect;
528 529 530
    struct
    {
        enum apc_type    type;      /* APC_VIRTUAL_FLUSH */
531 532
        int              __pad;
        client_ptr_t     addr;      /* requested address */
533
        mem_size_t       size;      /* requested size */
534
    } virtual_flush;
535 536 537
    struct
    {
        enum apc_type    type;      /* APC_VIRTUAL_LOCK */
538 539
        int              __pad;
        client_ptr_t     addr;      /* requested address */
540
        mem_size_t       size;      /* requested size */
541 542 543 544
    } virtual_lock;
    struct
    {
        enum apc_type    type;      /* APC_VIRTUAL_UNLOCK */
545 546
        int              __pad;
        client_ptr_t     addr;      /* requested address */
547
        mem_size_t       size;      /* requested size */
548
    } virtual_unlock;
549
    struct
550 551 552
    {
        enum apc_type    type;      /* APC_MAP_VIEW */
        obj_handle_t     handle;    /* mapping handle */
553
        client_ptr_t     addr;      /* requested address */
554
        mem_size_t       size;      /* allocation size */
555
        file_pos_t       offset;    /* file offset */
556
        unsigned int     alloc_type;/* allocation type */
557 558
        unsigned short   zero_bits; /* allocation alignment */
        unsigned short   prot;      /* memory protection flags */
559 560 561 562
    } map_view;
    struct
    {
        enum apc_type    type;      /* APC_UNMAP_VIEW */
563 564
        int              __pad;
        client_ptr_t     addr;      /* view address */
565 566
    } unmap_view;
    struct
567 568
    {
        enum apc_type    type;      /* APC_CREATE_THREAD */
569 570 571
        int              suspend;   /* suspended thread? */
        client_ptr_t     func;      /* void (__stdcall *func)(void*);  start function */
        client_ptr_t     arg;       /* argument for start function */
572 573
        mem_size_t       reserve;   /* reserve size for thread stack */
        mem_size_t       commit;    /* commit size for thread stack */
574
    } create_thread;
575 576
} apc_call_t;

577 578 579 580
typedef union
{
    enum apc_type type;
    struct
581 582 583
    {
        enum apc_type    type;      /* APC_ASYNC_IO */
        unsigned int     status;    /* new status of async operation */
584
        client_ptr_t     apc;       /* user APC to call */
585
        unsigned int     total;     /* bytes transferred */
586 587
    } async_io;
    struct
588 589 590
    {
        enum apc_type    type;      /* APC_VIRTUAL_ALLOC */
        unsigned int     status;    /* status returned by call */
591
        client_ptr_t     addr;      /* resulting address */
592
        mem_size_t       size;      /* resulting size */
593 594 595 596 597
    } virtual_alloc;
    struct
    {
        enum apc_type    type;      /* APC_VIRTUAL_FREE */
        unsigned int     status;    /* status returned by call */
598
        client_ptr_t     addr;      /* resulting address */
599
        mem_size_t       size;      /* resulting size */
600
    } virtual_free;
601 602 603 604
    struct
    {
        enum apc_type    type;      /* APC_VIRTUAL_QUERY */
        unsigned int     status;    /* status returned by call */
605 606
        client_ptr_t     base;      /* resulting base address */
        client_ptr_t     alloc_base;/* resulting allocation base */
607
        mem_size_t       size;      /* resulting region size */
608 609 610 611
        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 */
612
    } virtual_query;
613 614 615 616
    struct
    {
        enum apc_type    type;      /* APC_VIRTUAL_PROTECT */
        unsigned int     status;    /* status returned by call */
617
        client_ptr_t     addr;      /* resulting address */
618
        mem_size_t       size;      /* resulting size */
619 620
        unsigned int     prot;      /* old protection flags */
    } virtual_protect;
621 622 623 624
    struct
    {
        enum apc_type    type;      /* APC_VIRTUAL_FLUSH */
        unsigned int     status;    /* status returned by call */
625
        client_ptr_t     addr;      /* resulting address */
626
        mem_size_t       size;      /* resulting size */
627
    } virtual_flush;
628 629 630 631
    struct
    {
        enum apc_type    type;      /* APC_VIRTUAL_LOCK */
        unsigned int     status;    /* status returned by call */
632
        client_ptr_t     addr;      /* resulting address */
633
        mem_size_t       size;      /* resulting size */
634 635 636 637 638
    } virtual_lock;
    struct
    {
        enum apc_type    type;      /* APC_VIRTUAL_UNLOCK */
        unsigned int     status;    /* status returned by call */
639
        client_ptr_t     addr;      /* resulting address */
640
        mem_size_t       size;      /* resulting size */
641
    } virtual_unlock;
642
    struct
643 644 645
    {
        enum apc_type    type;      /* APC_MAP_VIEW */
        unsigned int     status;    /* status returned by call */
646
        client_ptr_t     addr;      /* resulting address */
647
        mem_size_t       size;      /* resulting size */
648 649 650 651 652 653 654
    } map_view;
    struct
    {
        enum apc_type    type;      /* APC_MAP_VIEW */
        unsigned int     status;    /* status returned by call */
    } unmap_view;
    struct
655 656 657 658 659 660
    {
        enum apc_type    type;      /* APC_CREATE_THREAD */
        unsigned int     status;    /* status returned by call */
        thread_id_t      tid;       /* thread id */
        obj_handle_t     handle;    /* handle to new thread */
    } create_thread;
661 662
} apc_result_t;

663 664 665 666 667 668 669 670
struct rawinput_device
{
    unsigned short usage_page;
    unsigned short usage;
    unsigned int   flags;
    user_handle_t  target;
};

671 672 673 674 675
/****************************************************************/
/* Request declarations */

/* Create a new process from the context of the parent */
@REQ(new_process)
676 677 678 679 680 681 682 683
    int          inherit_all;    /* inherit all handles from parent */
    unsigned int create_flags;   /* creation flags */
    int          socket_fd;      /* file descriptor for process socket */
    obj_handle_t exe_file;       /* file handle for main exe */
    unsigned int process_access; /* access rights for process object */
    unsigned int process_attr;   /* attributes for process object */
    unsigned int thread_access;  /* access rights for thread object */
    unsigned int thread_attr;    /* attributes for thread object */
684 685
    data_size_t  info_size;      /* size of startup info */
    VARARG(info,startup_info,info_size); /* startup information */
686
    VARARG(env,unicode_str);     /* environment for new process */
687
@REPLY
688 689 690 691 692
    obj_handle_t info;           /* new process info handle */
    process_id_t pid;            /* process id */
    obj_handle_t phandle;        /* process handle (in the current process) */
    thread_id_t  tid;            /* thread id */
    obj_handle_t thandle;        /* thread handle (in the current process) */
693 694 695 696 697
@END


/* Retrieve information about a newly started process */
@REQ(get_new_process_info)
698
    obj_handle_t info;           /* info handle returned from new_process_request */
699
@REPLY
700
    int          success;      /* did the process start successfully? */
701
    int          exit_code;    /* process exit code if failed */
702 703 704 705 706
@END


/* Create a new thread from the context of the parent */
@REQ(new_thread)
707 708
    unsigned int access;       /* wanted access rights */
    unsigned int attributes;   /* object attributes */
709 710 711
    int          suspend;      /* new thread should be suspended on creation */
    int          request_fd;   /* fd for request pipe */
@REPLY
712
    thread_id_t  tid;          /* thread id */
713
    obj_handle_t handle;       /* thread handle (in the current process) */
714 715 716
@END


717 718 719
/* Retrieve the new process startup info */
@REQ(get_startup_info)
@REPLY
720
    obj_handle_t exe_file;     /* file handle for main exe */
721 722
    data_size_t  info_size;    /* size of startup info */
    VARARG(info,startup_info,info_size); /* startup information */
723
    VARARG(env,unicode_str);   /* environment */
724 725 726 727 728
@END


/* Signal the end of the process initialization */
@REQ(init_process_done)
729
    int          gui;          /* is it a GUI process? */
730
    mod_handle_t module;       /* main module base address */
731
    client_ptr_t ldt_copy;     /* address of LDT copy (in thread address space) */
732
    client_ptr_t entry;        /* process entry point */
733 734 735 736 737 738
@END


/* Initialize a thread; called from the child after fork()/clone() */
@REQ(init_thread)
    int          unix_pid;     /* Unix pid of new thread */
739
    int          unix_tid;     /* Unix tid of new thread */
740
    int          debug_level;  /* new debug level */
741
    client_ptr_t teb;          /* TEB of new thread (in thread address space) */
742
    client_ptr_t entry;        /* entry point or PEB if initial thread (in thread address space) */
743 744
    int          reply_fd;     /* fd for reply pipe */
    int          wait_fd;      /* fd for blocking calls pipe */
745
    cpu_type_t   cpu;          /* CPU that this thread is running on */
746
@REPLY
747 748
    process_id_t pid;          /* process id of the new thread's process */
    thread_id_t  tid;          /* thread id of the new thread */
749
    timeout_t    server_start; /* server start time */
750
    data_size_t  info_size;    /* total size of startup info */
751
    int          version;      /* protocol version */
752
    unsigned int all_cpus;     /* bitset of supported CPUs */
753 754 755 756 757
@END


/* Terminate a process */
@REQ(terminate_process)
758
    obj_handle_t handle;       /* process handle to terminate */
759 760 761 762 763 764 765 766
    int          exit_code;    /* process exit code */
@REPLY
    int          self;         /* suicide? */
@END


/* Terminate a thread */
@REQ(terminate_thread)
767
    obj_handle_t handle;       /* thread handle to terminate */
768 769 770 771 772 773 774 775 776
    int          exit_code;    /* thread exit code */
@REPLY
    int          self;         /* suicide? */
    int          last;         /* last thread in this process? */
@END


/* Retrieve information about a process */
@REQ(get_process_info)
777
    obj_handle_t handle;           /* process handle */
778
@REPLY
779
    process_id_t pid;              /* server process id */
780
    process_id_t ppid;             /* server process id of parent */
781
    affinity_t   affinity;         /* process affinity mask */
782
    client_ptr_t peb;              /* PEB address in process address space */
783 784
    timeout_t    start_time;       /* process start time */
    timeout_t    end_time;         /* process end time */
785
    int          exit_code;        /* process exit code */
786
    int          priority;         /* priority class */
787
    cpu_type_t   cpu;              /* CPU that this process is running on */
788
    int          debugger_present; /* process is being debugged */
789 790 791
@END


792
/* Set a process information */
793
@REQ(set_process_info)
794
    obj_handle_t handle;       /* process handle */
795 796
    int          mask;         /* setting mask (see below) */
    int          priority;     /* priority class */
797
    affinity_t   affinity;     /* affinity mask */
798 799 800 801 802 803 804
@END
#define SET_PROCESS_INFO_PRIORITY 0x01
#define SET_PROCESS_INFO_AFFINITY 0x02


/* Retrieve information about a thread */
@REQ(get_thread_info)
805 806
    obj_handle_t handle;        /* thread handle */
    thread_id_t  tid_in;        /* thread id (optional) */
807
@REPLY
808
    process_id_t pid;           /* server process id */
809
    thread_id_t  tid;           /* server thread id */
810
    client_ptr_t teb;           /* thread teb pointer */
811
    affinity_t   affinity;      /* thread affinity mask */
812 813
    timeout_t    creation_time; /* thread creation time */
    timeout_t    exit_time;     /* thread exit time */
814
    int          exit_code;     /* thread exit code */
815
    int          priority;      /* thread priority level */
816
    int          last;          /* last thread in process */
817 818 819
@END


820
/* Set a thread information */
821
@REQ(set_thread_info)
822
    obj_handle_t handle;       /* thread handle */
823 824
    int          mask;         /* setting mask (see below) */
    int          priority;     /* priority class */
825
    affinity_t   affinity;     /* affinity mask */
826
    obj_handle_t token;        /* impersonation token */
827 828 829
@END
#define SET_THREAD_INFO_PRIORITY 0x01
#define SET_THREAD_INFO_AFFINITY 0x02
830
#define SET_THREAD_INFO_TOKEN    0x04
831 832


833 834 835
/* Retrieve information about a module */
@REQ(get_dll_info)
    obj_handle_t handle;       /* process handle */
836
    mod_handle_t base_address; /* base address of module */
837
@REPLY
838
    client_ptr_t entry_point;
839
    data_size_t  size;            /* module size */
840
    data_size_t  filename_len;    /* buffer len in bytes required to store filename */
841
    VARARG(filename,unicode_str); /* file name of module */
842 843 844
@END


845 846
/* Suspend a thread */
@REQ(suspend_thread)
847
    obj_handle_t handle;       /* thread handle */
848 849 850 851 852 853 854
@REPLY
    int          count;        /* new suspend count */
@END


/* Resume a thread */
@REQ(resume_thread)
855
    obj_handle_t handle;       /* thread handle */
856 857 858 859 860 861 862
@REPLY
    int          count;        /* new suspend count */
@END


/* Notify the server that a dll has been loaded */
@REQ(load_dll)
863
    obj_handle_t mapping;      /* file mapping handle */
864
    mod_handle_t base;         /* base address */
865
    client_ptr_t name;         /* ptr to ptr to name (in process addr space) */
866
    data_size_t  size;         /* dll size */
867 868
    int          dbg_offset;   /* debug info offset */
    int          dbg_size;     /* debug info size */
869
    VARARG(filename,unicode_str); /* file name of dll */
870 871 872 873 874
@END


/* Notify the server that a dll is being unloaded */
@REQ(unload_dll)
875
    mod_handle_t base;         /* base address */
876 877 878
@END


879
/* Queue an APC for a thread or process */
880
@REQ(queue_apc)
881
    obj_handle_t handle;       /* thread or process handle */
882
    apc_call_t   call;         /* call arguments */
883 884
@REPLY
    obj_handle_t handle;       /* APC handle */
885
    int          self;         /* run APC in caller itself? */
886 887 888
@END


889 890 891 892 893 894 895 896
/* Get the result of an APC call */
@REQ(get_apc_result)
    obj_handle_t handle;       /* handle to the APC */
@REPLY
    apc_result_t result;       /* result of the APC */
@END


897 898
/* Close a handle for the current process */
@REQ(close_handle)
899
    obj_handle_t handle;       /* handle to close */
900 901 902 903 904
@END


/* Set a handle information */
@REQ(set_handle_info)
905
    obj_handle_t handle;       /* handle we are interested in */
906 907 908 909
    int          flags;        /* new handle flags */
    int          mask;         /* mask for flags to set */
@REPLY
    int          old_flags;    /* old flag value */
910 911 912
@END


913 914
/* Duplicate a handle */
@REQ(dup_handle)
915 916 917
    obj_handle_t src_process;  /* src process handle */
    obj_handle_t src_handle;   /* src handle to duplicate */
    obj_handle_t dst_process;  /* dst process handle */
918
    unsigned int access;       /* wanted access rights */
919 920
    unsigned int attributes;   /* object attributes */
    unsigned int options;      /* duplicate options (see below) */
921
@REPLY
922
    obj_handle_t handle;       /* duplicated handle in dst process */
923
    int          self;         /* is the source the current process? */
924
    int          closed;       /* whether the source handle has been closed */
925 926 927 928 929 930 931 932
@END
#define DUP_HANDLE_CLOSE_SOURCE  DUPLICATE_CLOSE_SOURCE
#define DUP_HANDLE_SAME_ACCESS   DUPLICATE_SAME_ACCESS
#define DUP_HANDLE_MAKE_GLOBAL   0x80000000  /* Not a Windows flag */


/* Open a handle to a process */
@REQ(open_process)
933
    process_id_t pid;          /* process id to open */
934
    unsigned int access;       /* wanted access rights */
935
    unsigned int attributes;   /* object attributes */
936
@REPLY
937
    obj_handle_t handle;       /* handle to the process */
938 939 940
@END


941 942
/* Open a handle to a thread */
@REQ(open_thread)
943
    thread_id_t  tid;          /* thread id to open */
944
    unsigned int access;       /* wanted access rights */
945
    unsigned int attributes;   /* object attributes */
946
@REPLY
947
    obj_handle_t handle;       /* handle to the thread */
948 949 950
@END


951 952 953
/* Wait for handles */
@REQ(select)
    int          flags;        /* wait flags (see below) */
954
    client_ptr_t cookie;       /* magic cookie to return to client */
955
    timeout_t    timeout;      /* timeout */
956
    obj_handle_t prev_apc;     /* handle to previous APC */
957
    VARARG(result,apc_result); /* result of previous APC */
958
    VARARG(data,select_op);    /* operation-specific data */
959 960
@REPLY
    timeout_t    timeout;      /* timeout converted to absolute */
961
    apc_call_t   call;         /* APC call arguments */
962
    obj_handle_t apc_handle;   /* handle to next APC */
963
@END
964 965
#define SELECT_ALERTABLE     1
#define SELECT_INTERRUPTIBLE 2
966 967 968 969


/* Create an event */
@REQ(create_event)
970
    unsigned int access;        /* wanted access rights */
971
    unsigned int attributes;    /* object attributes */
972 973
    int          manual_reset;  /* manual reset event */
    int          initial_state; /* initial state of the event */
974
    VARARG(objattr,object_attributes); /* object attributes */
975
@REPLY
976
    obj_handle_t handle;        /* handle to the event */
977 978 979 980
@END

/* Event operation */
@REQ(event_op)
981
    obj_handle_t  handle;       /* handle to event */
982 983 984 985
    int           op;           /* event operation (see below) */
@END
enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };

986 987 988 989 990 991
@REQ(query_event)
    obj_handle_t  handle;       /* handle to event */
@REPLY
    int          manual_reset;  /* manual reset event */
    int          state;         /* current state of the event */
@END
992 993 994 995

/* Open an event */
@REQ(open_event)
    unsigned int access;        /* wanted access rights */
996
    unsigned int attributes;    /* object attributes */
997
    obj_handle_t rootdir;       /* root directory */
998 999
    VARARG(name,unicode_str);   /* object name */
@REPLY
1000
    obj_handle_t handle;        /* handle to the event */
1001 1002 1003
@END


1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023
/* Create a keyed event */
@REQ(create_keyed_event)
    unsigned int access;        /* wanted access rights */
    unsigned int attributes;    /* object attributes */
    VARARG(objattr,object_attributes); /* object attributes */
@REPLY
    obj_handle_t handle;        /* handle to the event */
@END

/* Open a keyed event */
@REQ(open_keyed_event)
    unsigned int access;        /* wanted access rights */
    unsigned int attributes;    /* object attributes */
    obj_handle_t rootdir;       /* root directory */
    VARARG(name,unicode_str);   /* object name */
@REPLY
    obj_handle_t handle;        /* handle to the event */
@END


1024 1025
/* Create a mutex */
@REQ(create_mutex)
1026
    unsigned int access;        /* wanted access rights */
1027
    unsigned int attributes;    /* object attributes */
1028
    int          owned;         /* initially owned? */
1029
    VARARG(objattr,object_attributes); /* object attributes */
1030
@REPLY
1031
    obj_handle_t handle;        /* handle to the mutex */
1032 1033 1034 1035 1036
@END


/* Release a mutex */
@REQ(release_mutex)
1037
    obj_handle_t handle;        /* handle to the mutex */
1038 1039
@REPLY
    unsigned int prev_count;    /* value of internal counter, before release */
1040 1041 1042 1043 1044 1045
@END


/* Open a mutex */
@REQ(open_mutex)
    unsigned int access;        /* wanted access rights */
1046
    unsigned int attributes;    /* object attributes */
1047
    obj_handle_t rootdir;       /* root directory */
1048 1049
    VARARG(name,unicode_str);   /* object name */
@REPLY
1050
    obj_handle_t handle;        /* handle to the mutex */
1051 1052 1053 1054 1055
@END


/* Create a semaphore */
@REQ(create_semaphore)
1056
    unsigned int access;        /* wanted access rights */
1057
    unsigned int attributes;    /* object attributes */
1058 1059
    unsigned int initial;       /* initial count */
    unsigned int max;           /* maximum count */
1060
    VARARG(objattr,object_attributes); /* object attributes */
1061
@REPLY
1062
    obj_handle_t handle;        /* handle to the semaphore */
1063 1064 1065 1066 1067
@END


/* Release a semaphore */
@REQ(release_semaphore)
1068
    obj_handle_t handle;        /* handle to the semaphore */
1069 1070 1071 1072 1073 1074 1075 1076 1077
    unsigned int count;         /* count to add to semaphore */
@REPLY
    unsigned int prev_count;    /* previous semaphore count */
@END


/* Open a semaphore */
@REQ(open_semaphore)
    unsigned int access;        /* wanted access rights */
1078
    unsigned int attributes;    /* object attributes */
1079
    obj_handle_t rootdir;       /* root directory */
1080 1081
    VARARG(name,unicode_str);   /* object name */
@REPLY
1082
    obj_handle_t handle;        /* handle to the semaphore */
1083 1084 1085 1086 1087 1088
@END


/* Create a file */
@REQ(create_file)
    unsigned int access;        /* wanted access rights */
1089
    unsigned int attributes;    /* object attributes */
1090 1091
    unsigned int sharing;       /* sharing flags */
    int          create;        /* file create action */
1092
    unsigned int options;       /* file options */
1093
    unsigned int attrs;         /* file attributes for creation */
1094
    VARARG(objattr,object_attributes); /* object attributes */
1095 1096
    VARARG(filename,string);    /* file name */
@REPLY
1097
    obj_handle_t handle;        /* handle to the file */
1098 1099 1100
@END


1101 1102 1103 1104 1105 1106
/* Open a file object */
@REQ(open_file_object)
    unsigned int access;        /* wanted access rights */
    unsigned int attributes;    /* open attributes */
    obj_handle_t rootdir;       /* root directory */
    unsigned int sharing;       /* sharing flags */
1107
    unsigned int options;       /* file options */
1108 1109 1110 1111 1112 1113
    VARARG(filename,unicode_str); /* file name */
@REPLY
    obj_handle_t handle;        /* handle to the file */
@END


1114 1115 1116
/* Allocate a file handle for a Unix fd */
@REQ(alloc_file_handle)
    unsigned int access;        /* wanted access rights */
1117
    unsigned int attributes;    /* object attributes */
1118 1119
    int          fd;            /* file descriptor on the client side */
@REPLY
1120
    obj_handle_t handle;        /* handle to the file */
1121 1122 1123
@END


1124 1125 1126 1127 1128 1129 1130 1131 1132
/* Get the Unix name from a file handle */
@REQ(get_handle_unix_name)
    obj_handle_t   handle;      /* file handle */
@REPLY
    data_size_t    name_len;    /* unix name length */
    VARARG(name,string);        /* unix name */
@END


1133 1134
/* Get a Unix fd to access a file */
@REQ(get_handle_fd)
1135
    obj_handle_t handle;        /* handle to the file */
1136
@REPLY
1137
    int          type;          /* file type (see below) */
1138
    int          cacheable;     /* can fd be cached in the client? */
1139 1140
    unsigned int access;        /* file access rights */
    unsigned int options;       /* file open options */
1141
@END
1142 1143 1144 1145 1146 1147 1148 1149 1150
enum server_fd_type
{
    FD_TYPE_INVALID,  /* invalid file (no associated fd) */
    FD_TYPE_FILE,     /* regular file */
    FD_TYPE_DIR,      /* directory */
    FD_TYPE_SOCKET,   /* socket */
    FD_TYPE_SERIAL,   /* serial port */
    FD_TYPE_PIPE,     /* named pipe */
    FD_TYPE_MAILSLOT, /* mailslot */
1151
    FD_TYPE_CHAR,     /* unspecified char device */
1152 1153 1154
    FD_TYPE_DEVICE,   /* Windows device file */
    FD_TYPE_NB_TYPES
};
1155

1156 1157 1158

/* Flush a file buffers */
@REQ(flush_file)
1159
    obj_handle_t handle;        /* handle to the file */
1160 1161
@REPLY
    obj_handle_t event;         /* event set when finished */
1162 1163 1164 1165 1166
@END


/* Lock a region of a file */
@REQ(lock_file)
1167
    obj_handle_t handle;        /* handle to the file */
1168 1169
    file_pos_t   offset;        /* offset of start of lock */
    file_pos_t   count;         /* count of bytes to lock */
1170 1171 1172 1173 1174
    int          shared;        /* shared or exclusive lock? */
    int          wait;          /* do we want to wait? */
@REPLY
    obj_handle_t handle;        /* handle to wait on */
    int          overlapped;    /* is it an overlapped I/O handle? */
1175 1176 1177 1178 1179
@END


/* Unlock a region of a file */
@REQ(unlock_file)
1180
    obj_handle_t handle;        /* handle to the file */
1181 1182
    file_pos_t   offset;        /* offset of start of unlock */
    file_pos_t   count;         /* count of bytes to unlock */
1183 1184 1185 1186 1187 1188
@END


/* Create a socket */
@REQ(create_socket)
    unsigned int access;        /* wanted access rights */
1189
    unsigned int attributes;    /* object attributes */
1190 1191 1192
    int          family;        /* family, see socket manpage */
    int          type;          /* type, see socket manpage */
    int          protocol;      /* protocol, see socket manpage */
1193
    unsigned int flags;         /* socket flags */
1194
@REPLY
1195
    obj_handle_t handle;        /* handle to the new socket */
1196 1197 1198 1199 1200
@END


/* Accept a socket */
@REQ(accept_socket)
1201
    obj_handle_t lhandle;       /* handle to the listening socket */
1202
    unsigned int access;        /* wanted access rights */
1203
    unsigned int attributes;    /* object attributes */
1204
@REPLY
1205
    obj_handle_t handle;        /* handle to the new socket */
1206 1207 1208
@END


1209 1210 1211 1212 1213 1214 1215
/* Accept into an initialized socket */
@REQ(accept_into_socket)
    obj_handle_t lhandle;       /* handle to the listening socket */
    obj_handle_t ahandle;       /* handle to the accepting socket */
@END


1216 1217
/* Set socket event parameters */
@REQ(set_socket_event)
1218
    obj_handle_t  handle;        /* handle to the socket */
1219
    unsigned int  mask;          /* event mask */
1220
    obj_handle_t  event;         /* event object */
1221 1222
    user_handle_t window;        /* window to send the message to */
    unsigned int  msg;           /* message to send */
1223 1224 1225 1226 1227
@END


/* Get socket event parameters */
@REQ(get_socket_event)
1228
    obj_handle_t handle;        /* handle to the socket */
1229
    int          service;       /* clear pending? */
1230
    obj_handle_t c_event;       /* event to clear */
1231 1232 1233 1234 1235 1236 1237 1238
@REPLY
    unsigned int mask;          /* event mask */
    unsigned int pmask;         /* pending events */
    unsigned int state;         /* status bits */
    VARARG(errors,ints);        /* event errors */
@END


1239
/* Re-enable pending socket events */
1240
@REQ(enable_socket_event)
1241
    obj_handle_t handle;        /* handle to the socket */
1242 1243 1244 1245 1246
    unsigned int mask;          /* events to re-enable */
    unsigned int sstate;        /* status bits to set */
    unsigned int cstate;        /* status bits to clear */
@END

1247
@REQ(set_socket_deferred)
1248 1249
    obj_handle_t handle;        /* handle to the socket */
    obj_handle_t deferred;      /* handle to the socket for which accept() is deferred */
1250
@END
1251

1252
/* Allocate a console (only used by a console renderer) */
1253 1254
@REQ(alloc_console)
    unsigned int access;        /* wanted access rights */
1255
    unsigned int attributes;    /* object attributes */
1256
    process_id_t pid;           /* pid of process which shall be attached to the console */
1257
    int          input_fd;      /* if pid=-1 (bare console to current process), fd for input */
1258
@REPLY
1259 1260
    obj_handle_t handle_in;     /* handle to console input */
    obj_handle_t event;         /* handle to renderer events change notification */
1261 1262 1263 1264 1265 1266 1267 1268
@END


/* Free the console of the current process */
@REQ(free_console)
@END


1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314
#define CONSOLE_RENDERER_NONE_EVENT        0x00
#define CONSOLE_RENDERER_TITLE_EVENT       0x01
#define CONSOLE_RENDERER_ACTIVE_SB_EVENT   0x02
#define CONSOLE_RENDERER_SB_RESIZE_EVENT   0x03
#define CONSOLE_RENDERER_UPDATE_EVENT      0x04
#define CONSOLE_RENDERER_CURSOR_POS_EVENT  0x05
#define CONSOLE_RENDERER_CURSOR_GEOM_EVENT 0x06
#define CONSOLE_RENDERER_DISPLAY_EVENT     0x07
#define CONSOLE_RENDERER_EXIT_EVENT        0x08
struct console_renderer_event
{
    short event;
    union
    {
        struct update
        {
            short top;
            short bottom;
        } update;
        struct resize
        {
            short width;
            short height;
        } resize;
        struct cursor_pos
        {
            short x;
            short y;
        } cursor_pos;
        struct cursor_geom
        {
            short visible;
            short size;
        } cursor_geom;
        struct display
        {
            short left;
            short top;
            short width;
            short height;
        } display;
    } u;
};

/* retrieve console events for the renderer */
@REQ(get_console_renderer_events)
1315
    obj_handle_t handle;        /* handle to console input events */
1316 1317 1318 1319 1320
@REPLY
    VARARG(data,bytes);         /* the various console_renderer_events */
@END


1321 1322
/* Open a handle to the process console */
@REQ(open_console)
1323
    obj_handle_t from;          /* 0 (resp 1) input (resp output) of current process console */
1324
                                /* otherwise console_in handle to get active screen buffer? */
1325
    unsigned int access;        /* wanted access rights */
1326
    unsigned int attributes;    /* object attributes */
1327
    int          share;         /* share mask (only for output handles) */
1328
@REPLY
1329
    obj_handle_t handle;        /* handle to the console */
1330 1331 1332
@END


1333 1334 1335 1336 1337 1338
/* Get the input queue wait event */
@REQ(get_console_wait_event)
@REPLY
    obj_handle_t handle;
@END

1339 1340
/* Get a console mode (input or output) */
@REQ(get_console_mode)
1341
    obj_handle_t handle;        /* handle to the console */
1342 1343 1344 1345 1346 1347 1348
@REPLY
    int          mode;          /* console mode */
@END


/* Set a console mode (input or output) */
@REQ(set_console_mode)
1349
    obj_handle_t handle;        /* handle to the console */
1350 1351 1352 1353
    int          mode;          /* console mode */
@END


1354 1355
/* Set info about a console (input only) */
@REQ(set_console_input_info)
1356 1357 1358 1359 1360 1361 1362 1363 1364 1365
    obj_handle_t  handle;        /* handle to console input, or 0 for process' console */
    int           mask;          /* setting mask (see below) */
    obj_handle_t  active_sb;     /* active screen buffer */
    int           history_mode;  /* whether we duplicate lines in history */
    int           history_size;  /* number of lines in history */
    int           edition_mode;  /* index to the edition mode flavors */
    int           input_cp;      /* console input codepage */
    int           output_cp;     /* console output codepage */
    user_handle_t win;           /* console window if backend supports it */
    VARARG(title,unicode_str);   /* console title */
1366 1367 1368 1369 1370
@END
#define SET_CONSOLE_INPUT_INFO_ACTIVE_SB        0x01
#define SET_CONSOLE_INPUT_INFO_TITLE            0x02
#define SET_CONSOLE_INPUT_INFO_HISTORY_MODE     0x04
#define SET_CONSOLE_INPUT_INFO_HISTORY_SIZE     0x08
1371
#define SET_CONSOLE_INPUT_INFO_EDITION_MODE     0x10
1372 1373
#define SET_CONSOLE_INPUT_INFO_INPUT_CODEPAGE   0x20
#define SET_CONSOLE_INPUT_INFO_OUTPUT_CODEPAGE  0x40
1374
#define SET_CONSOLE_INPUT_INFO_WIN              0x80
1375 1376 1377 1378


/* Get info about a console (input only) */
@REQ(get_console_input_info)
1379
    obj_handle_t  handle;         /* handle to console input, or 0 for process' console */
1380
@REPLY
1381 1382 1383 1384 1385 1386 1387 1388
    int           history_mode;   /* whether we duplicate lines in history */
    int           history_size;   /* number of lines in history */
    int           history_index;  /* number of used lines in history */
    int           edition_mode;   /* index to the edition mode flavors */
    int           input_cp;       /* console input codepage */
    int           output_cp;      /* console output codepage */
    user_handle_t win;            /* console window if backend supports it */
    VARARG(title,unicode_str);    /* console title */
1389 1390 1391 1392 1393
@END


/* appends a string to console's history */
@REQ(append_console_input_history)
1394
    obj_handle_t handle;        /* handle to console input, or 0 for process' console */
1395 1396 1397 1398 1399 1400
    VARARG(line,unicode_str);   /* line to add */
@END


/* appends a string to console's history */
@REQ(get_console_input_history)
1401
    obj_handle_t handle;        /* handle to console input, or 0 for process' console */
1402 1403
    int          index;         /* index to get line from */
@REPLY
1404
    int          total;         /* total length of line in Unicode chars */
1405 1406 1407 1408 1409 1410
    VARARG(line,unicode_str);   /* line to add */
@END


/* creates a new screen buffer on process' console */
@REQ(create_console_output)
1411
    obj_handle_t handle_in;     /* handle to console input, or 0 for process' console */
1412 1413 1414
    unsigned int access;        /* wanted access rights */
    unsigned int attributes;    /* object attributes */
    unsigned int share;         /* sharing credentials */
1415
    int          fd;            /* for bare consoles, fd the screen-buffer is attached to */
1416
@REPLY
1417
    obj_handle_t handle_out;    /* handle to the screen buffer */
1418 1419 1420
@END


1421
/* Set info about a console (output only) */
1422
@REQ(set_console_output_info)
1423
    obj_handle_t handle;        /* handle to the console */
1424
    int          mask;          /* setting mask (see below) */
1425 1426 1427 1428 1429 1430 1431 1432
    short int    cursor_size;   /* size of cursor (percentage filled) */
    short int    cursor_visible;/* cursor visibility flag */
    short int    cursor_x;      /* position of cursor (x, y) */
    short int    cursor_y;
    short int    width;         /* width of the screen buffer */
    short int    height;        /* height of the screen buffer */
    short int    attr;          /* default attribute */
    short int    win_left;      /* window actually displayed by renderer */
1433
    short int    win_top;       /* the rect area is expressed within the */
1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445
    short int    win_right;     /* boundaries of the screen buffer */
    short int    win_bottom;
    short int    max_width;     /* maximum size (width x height) for the window */
    short int    max_height;
@END
#define SET_CONSOLE_OUTPUT_INFO_CURSOR_GEOM     0x01
#define SET_CONSOLE_OUTPUT_INFO_CURSOR_POS      0x02
#define SET_CONSOLE_OUTPUT_INFO_SIZE            0x04
#define SET_CONSOLE_OUTPUT_INFO_ATTR            0x08
#define SET_CONSOLE_OUTPUT_INFO_DISPLAY_WINDOW  0x10
#define SET_CONSOLE_OUTPUT_INFO_MAX_SIZE        0x20

1446 1447

/* Get info about a console (output only) */
1448
@REQ(get_console_output_info)
1449
    obj_handle_t handle;        /* handle to the console */
1450
@REPLY
1451 1452 1453 1454 1455 1456 1457 1458
    short int    cursor_size;   /* size of cursor (percentage filled) */
    short int    cursor_visible;/* cursor visibility flag */
    short int    cursor_x;      /* position of cursor (x, y) */
    short int    cursor_y;
    short int    width;         /* width of the screen buffer */
    short int    height;        /* height of the screen buffer */
    short int    attr;          /* default attribute */
    short int    win_left;      /* window actually displayed by renderer */
1459
    short int    win_top;       /* the rect area is expressed within the */
1460 1461 1462 1463
    short int    win_right;     /* boundaries of the screen buffer */
    short int    win_bottom;
    short int    max_width;     /* maximum size (width x height) for the window */
    short int    max_height;
1464 1465 1466 1467
@END

/* Add input records to a console input queue */
@REQ(write_console_input)
1468
    obj_handle_t handle;        /* handle to the console input */
1469 1470 1471 1472 1473
    VARARG(rec,input_records);  /* input records */
@REPLY
    int          written;       /* number of records written */
@END

1474

1475 1476
/* Fetch input records from a console input queue */
@REQ(read_console_input)
1477
    obj_handle_t handle;        /* handle to the console input */
1478 1479 1480 1481 1482 1483 1484
    int          flush;         /* flush the retrieved records from the queue? */
@REPLY
    int          read;          /* number of records read */
    VARARG(rec,input_records);  /* input records */
@END


1485 1486
/* write data (chars and/or attributes) in a screen buffer */
@REQ(write_console_output)
1487
    obj_handle_t handle;        /* handle to the console output */
1488 1489 1490 1491
    int          x;             /* position where to start writing */
    int          y;
    int          mode;          /* char info (see below) */
    int          wrap;          /* wrap around at end of line? */
1492 1493
    VARARG(data,bytes);         /* info to write */
@REPLY
1494 1495 1496
    int          written;       /* number of char infos actually written */
    int          width;         /* width of screen buffer */
    int          height;        /* height of screen buffer */
1497
@END
1498 1499 1500 1501 1502 1503 1504
enum char_info_mode
{
    CHAR_INFO_MODE_TEXT,        /* characters only */
    CHAR_INFO_MODE_ATTR,        /* attributes only */
    CHAR_INFO_MODE_TEXTATTR,    /* both characters and attributes */
    CHAR_INFO_MODE_TEXTSTDATTR  /* characters but use standard attributes */
};
1505 1506


1507 1508
/* fill a screen buffer with constant data (chars and/or attributes) */
@REQ(fill_console_output)
1509
    obj_handle_t handle;        /* handle to the console output */
1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521
    int          x;             /* position where to start writing */
    int          y;
    int          mode;          /* char info mode */
    int          count;         /* number to write */
    int          wrap;          /* wrap around at end of line? */
    char_info_t  data;          /* data to write */
@REPLY
    int          written;       /* number of char infos actually written */
@END


/* read data (chars and/or attributes) from a screen buffer */
1522
@REQ(read_console_output)
1523
    obj_handle_t handle;        /* handle to the console output */
1524 1525 1526 1527
    int          x;             /* position (x,y) where to start reading */
    int          y;
    int          mode;          /* char info mode */
    int          wrap;          /* wrap around at end of line? */
1528
@REPLY
1529 1530
    int          width;         /* width of screen buffer */
    int          height;        /* height of screen buffer */
1531 1532 1533
    VARARG(data,bytes);
@END

1534

1535 1536
/* move a rect (of data) in screen buffer content */
@REQ(move_console_output)
1537
    obj_handle_t handle;        /* handle to the console output */
1538 1539 1540 1541 1542 1543 1544 1545 1546
    short int    x_src;         /* position (x, y) of rect to start moving from */
    short int    y_src;
    short int    x_dst;         /* position (x, y) of rect to move to */
    short int    y_dst;
    short int    w;             /* size of the rect (width, height) to move */
    short int    h;
@END


1547 1548 1549
/* Sends a signal to a process group */
@REQ(send_console_signal)
    int          signal;        /* the signal to send */
1550
    process_id_t group_id;      /* the group to send the signal to */
1551 1552 1553
@END


1554 1555
/* enable directory change notifications */
@REQ(read_directory_changes)
1556
    unsigned int filter;        /* notification filter */
1557
    int          subtree;       /* watch the subtree? */
1558
    int          want_data;     /* flag indicating whether change data should be collected */
1559
    async_data_t async;         /* async I/O parameters */
1560 1561 1562 1563 1564 1565
@END


@REQ(read_change)
    obj_handle_t handle;
@REPLY
1566
    VARARG(events,filesystem_event);  /* collected filesystem events */
1567 1568 1569 1570 1571
@END


/* Create a file mapping */
@REQ(create_mapping)
1572 1573
    unsigned int access;        /* wanted access rights */
    unsigned int attributes;    /* object attributes */
1574
    unsigned int protect;       /* protection flags (see below) */
1575
    mem_size_t   size;          /* mapping size */
1576
    obj_handle_t file_handle;   /* file handle */
1577
    VARARG(objattr,object_attributes); /* object attributes */
1578
@REPLY
1579
    obj_handle_t handle;        /* handle to the mapping */
1580
@END
1581
/* per-page protection flags */
1582 1583 1584 1585 1586 1587 1588
#define VPROT_READ       0x01
#define VPROT_WRITE      0x02
#define VPROT_EXEC       0x04
#define VPROT_WRITECOPY  0x08
#define VPROT_GUARD      0x10
#define VPROT_NOCACHE    0x20
#define VPROT_COMMITTED  0x40
1589
#define VPROT_WRITEWATCH 0x80
1590 1591 1592 1593
/* per-mapping protection flags */
#define VPROT_IMAGE      0x0100  /* mapping for an exe image */
#define VPROT_SYSTEM     0x0200  /* system view (underlying mmap not under our control) */
#define VPROT_VALLOC     0x0400  /* allocated by VirtualAlloc */
1594
#define VPROT_NOEXEC     0x0800  /* don't force exec permission */
1595 1596 1597 1598 1599


/* Open a mapping */
@REQ(open_mapping)
    unsigned int access;        /* wanted access rights */
1600
    unsigned int attributes;    /* object attributes */
1601
    obj_handle_t rootdir;       /* root directory */
1602 1603
    VARARG(name,unicode_str);   /* object name */
@REPLY
1604
    obj_handle_t handle;        /* handle to the mapping */
1605 1606 1607 1608 1609
@END


/* Get information about a file mapping */
@REQ(get_mapping_info)
1610
    obj_handle_t handle;        /* handle to the mapping */
1611
    unsigned int access;        /* wanted access rights */
1612
@REPLY
1613
    mem_size_t   size;          /* mapping size */
1614 1615
    int          protect;       /* protection flags */
    int          header_size;   /* header size (for VPROT_IMAGE mapping) */
1616
    client_ptr_t base;          /* default base addr (for VPROT_IMAGE mapping) */
1617
    obj_handle_t mapping;       /* duplicate mapping handle unless removable */
1618
    obj_handle_t shared_file;   /* shared mapping file handle */
1619 1620 1621
@END


1622 1623 1624 1625 1626
/* Get a range of committed pages in a file mapping */
@REQ(get_mapping_committed_range)
    obj_handle_t handle;        /* handle to the mapping */
    file_pos_t   offset;        /* starting offset (page-aligned, in bytes) */
@REPLY
1627
    mem_size_t   size;          /* size of range starting at offset (page-aligned, in bytes) */
1628 1629 1630 1631 1632 1633 1634 1635
    int          committed;     /* whether it is a committed range */
@END


/* Add a range to the committed pages in a file mapping */
@REQ(add_mapping_committed_range)
    obj_handle_t handle;        /* handle to the mapping */
    file_pos_t   offset;        /* starting offset (page-aligned, in bytes) */
1636
    mem_size_t   size;          /* size to set (page-aligned, in bytes) or 0 if only retrieving */
1637 1638 1639
@END


1640 1641
#define SNAP_PROCESS    0x00000001
#define SNAP_THREAD     0x00000002
1642 1643
/* Create a snapshot */
@REQ(create_snapshot)
1644
    unsigned int attributes;    /* object attributes */
1645
    unsigned int flags;         /* snapshot flags (SNAP_*) */
1646
@REPLY
1647
    obj_handle_t handle;        /* handle to the snapshot */
1648 1649 1650 1651 1652
@END


/* Get the next process from a snapshot */
@REQ(next_process)
1653
    obj_handle_t handle;        /* handle to the snapshot */
1654 1655 1656
    int          reset;         /* reset snapshot position? */
@REPLY
    int          count;         /* process usage count */
1657 1658
    process_id_t pid;           /* process id */
    process_id_t ppid;          /* parent process id */
1659 1660
    int          threads;       /* number of threads */
    int          priority;      /* process priority */
1661
    int          handles;       /* number of handles */
1662
    int          unix_pid;      /* Unix pid */
1663
    VARARG(filename,unicode_str); /* file name of main exe */
1664 1665 1666 1667 1668
@END


/* Get the next thread from a snapshot */
@REQ(next_thread)
1669
    obj_handle_t handle;        /* handle to the snapshot */
1670 1671 1672
    int          reset;         /* reset snapshot position? */
@REPLY
    int          count;         /* thread usage count */
1673 1674
    process_id_t pid;           /* process id */
    thread_id_t  tid;           /* thread id */
1675 1676 1677 1678 1679 1680 1681 1682 1683
    int          base_pri;      /* base priority */
    int          delta_pri;     /* delta priority */
@END


/* Wait for a debug event */
@REQ(wait_debug_event)
    int           get_handle;  /* should we alloc a handle for waiting? */
@REPLY
1684 1685
    process_id_t  pid;         /* process id */
    thread_id_t   tid;         /* thread id */
1686
    obj_handle_t  wait;        /* wait handle if no event ready */
1687 1688 1689 1690 1691 1692
    VARARG(event,debug_event); /* debug event data */
@END


/* Queue an exception event */
@REQ(queue_exception_event)
1693 1694 1695 1696 1697 1698 1699 1700
    int           first;       /* first chance exception? */
    unsigned int  code;        /* exception code */
    unsigned int  flags;       /* exception flags */
    client_ptr_t  record;      /* exception record */
    client_ptr_t  address;     /* exception address */
    data_size_t   len;         /* size of parameters */
    VARARG(params,uints64,len);/* exception parameters */
    VARARG(context,context);   /* thread context */
1701
@REPLY
1702
    obj_handle_t     handle;   /* handle to the queued event */
1703 1704 1705 1706 1707
@END


/* Retrieve the status of an exception event */
@REQ(get_exception_status)
1708
    obj_handle_t     handle;   /* handle to the queued event */
1709
@REPLY
1710 1711 1712 1713 1714 1715
    VARARG(context,context);   /* modified thread context */
@END


/* Send an output string to the debugger */
@REQ(output_debug_string)
1716 1717
    data_size_t   length;      /* string length */
    client_ptr_t  string;      /* string to display (in debugged process address space) */
1718 1719 1720 1721 1722
@END


/* Continue a debug event */
@REQ(continue_debug_event)
1723 1724
    process_id_t pid;          /* process id to continue */
    thread_id_t  tid;          /* thread id to continue */
1725 1726 1727 1728
    int          status;       /* continuation status */
@END


1729
/* Start/stop debugging an existing process */
1730
@REQ(debug_process)
1731
    process_id_t pid;          /* id of the process to debug */
1732 1733 1734 1735
    int          attach;       /* 1=attaching / 0=detaching from the process */
@END


1736 1737
/* Simulate a breakpoint in a process */
@REQ(debug_break)
1738
    obj_handle_t handle;       /* process handle */
1739 1740 1741 1742 1743
@REPLY
    int          self;         /* was it the caller itself? */
@END


1744 1745 1746
/* Set debugger kill on exit flag */
@REQ(set_debugger_kill_on_exit)
    int          kill_on_exit;  /* 0=detach/1=kill debuggee when debugger dies */
1747 1748 1749 1750 1751
@END


/* Read data from a process address space */
@REQ(read_process_memory)
1752
    obj_handle_t handle;       /* process handle */
1753
    client_ptr_t addr;         /* addr to read from */
1754 1755 1756 1757 1758 1759 1760
@REPLY
    VARARG(data,bytes);        /* result data */
@END


/* Write data to a process address space */
@REQ(write_process_memory)
1761
    obj_handle_t handle;       /* process handle */
1762
    client_ptr_t addr;         /* addr to write to */
1763
    VARARG(data,bytes);        /* data to write */
1764 1765 1766 1767 1768
@END


/* Create a registry key */
@REQ(create_key)
1769
    obj_handle_t parent;       /* handle to the parent key */
1770
    unsigned int access;       /* desired access rights */
1771
    unsigned int attributes;   /* object attributes */
1772
    unsigned int options;      /* creation options */
1773
    data_size_t  namelen;      /* length of key name in bytes */
1774 1775
    VARARG(name,unicode_str,namelen);  /* key name */
    VARARG(class,unicode_str);         /* class name */
1776
@REPLY
1777
    obj_handle_t hkey;         /* handle to the created key */
1778 1779 1780 1781 1782
    int          created;      /* has it been newly created? */
@END

/* Open a registry key */
@REQ(open_key)
1783
    obj_handle_t parent;       /* handle to the parent key */
1784
    unsigned int access;       /* desired access rights */
1785
    unsigned int attributes;   /* object attributes */
1786 1787
    VARARG(name,unicode_str);  /* key name */
@REPLY
1788
    obj_handle_t hkey;         /* handle to the open key */
1789 1790 1791 1792 1793
@END


/* Delete a registry key */
@REQ(delete_key)
1794
    obj_handle_t hkey;         /* handle to the key */
1795 1796 1797
@END


1798 1799 1800 1801 1802 1803
/* Flush a registry key */
@REQ(flush_key)
    obj_handle_t hkey;         /* handle to the key */
@END


1804 1805
/* Enumerate registry subkeys */
@REQ(enum_key)
1806
    obj_handle_t hkey;         /* handle to registry key */
1807
    int          index;        /* index of subkey (or -1 for current key) */
1808
    int          info_class;   /* requested information class */
1809 1810 1811 1812 1813 1814 1815
@REPLY
    int          subkeys;      /* number of subkeys */
    int          max_subkey;   /* longest subkey name */
    int          max_class;    /* longest class name */
    int          values;       /* number of values */
    int          max_value;    /* longest value name */
    int          max_data;     /* longest value data */
1816
    timeout_t    modif;        /* last modification time */
1817 1818
    data_size_t  total;        /* total length needed for full name and class */
    data_size_t  namelen;      /* length of key name in bytes */
1819 1820
    VARARG(name,unicode_str,namelen);  /* key name */
    VARARG(class,unicode_str);         /* class name */
1821 1822 1823 1824 1825
@END


/* Set a value of a registry key */
@REQ(set_key_value)
1826
    obj_handle_t hkey;         /* handle to registry key */
1827
    int          type;         /* value type */
1828
    data_size_t  namelen;      /* length of value name in bytes */
1829 1830
    VARARG(name,unicode_str,namelen);  /* value name */
    VARARG(data,bytes);                /* value data */
1831 1832 1833 1834 1835
@END


/* Retrieve the value of a registry key */
@REQ(get_key_value)
1836
    obj_handle_t hkey;         /* handle to registry key */
1837
    VARARG(name,unicode_str);  /* value name */
1838 1839
@REPLY
    int          type;         /* value type */
1840
    data_size_t  total;        /* total length needed for data */
1841 1842 1843 1844 1845 1846
    VARARG(data,bytes);        /* value data */
@END


/* Enumerate a value of a registry key */
@REQ(enum_key_value)
1847
    obj_handle_t hkey;         /* handle to registry key */
1848
    int          index;        /* value index */
1849
    int          info_class;   /* requested information class */
1850 1851
@REPLY
    int          type;         /* value type */
1852 1853
    data_size_t  total;        /* total length needed for full name and data */
    data_size_t  namelen;      /* length of value name in bytes */
1854 1855
    VARARG(name,unicode_str,namelen);  /* value name */
    VARARG(data,bytes);                /* value data */
1856 1857 1858 1859 1860
@END


/* Delete a value of a registry key */
@REQ(delete_key_value)
1861
    obj_handle_t hkey;         /* handle to registry key */
1862 1863 1864 1865 1866 1867
    VARARG(name,unicode_str);  /* value name */
@END


/* Load a registry branch from a file */
@REQ(load_registry)
1868 1869
    obj_handle_t hkey;         /* root key to load to */
    obj_handle_t file;         /* file to load from */
1870 1871 1872 1873
    VARARG(name,unicode_str);  /* subkey name */
@END


1874 1875 1876 1877 1878 1879
/* UnLoad a registry branch from a file */
@REQ(unload_registry)
    obj_handle_t hkey;         /* root key to unload to */
@END


1880 1881
/* Save a registry branch to a file */
@REQ(save_registry)
1882 1883
    obj_handle_t hkey;         /* key to save */
    obj_handle_t file;         /* file to save to */
1884 1885 1886
@END


1887
/* Add a registry key change notification */
1888 1889 1890 1891 1892 1893 1894 1895
@REQ(set_registry_notification)
    obj_handle_t hkey;         /* key to watch for changes */
    obj_handle_t event;        /* event to set */
    int          subtree;      /* should we watch the whole subtree? */
    unsigned int filter;       /* things to watch */
@END


1896 1897
/* Create a waitable timer */
@REQ(create_timer)
1898
    unsigned int access;        /* wanted access rights */
1899
    unsigned int attributes;    /* object attributes */
1900
    obj_handle_t rootdir;       /* root directory */
1901 1902 1903
    int          manual;        /* manual reset */
    VARARG(name,unicode_str);   /* object name */
@REPLY
1904
    obj_handle_t handle;        /* handle to the timer */
1905 1906 1907 1908 1909 1910
@END


/* Open a waitable timer */
@REQ(open_timer)
    unsigned int access;        /* wanted access rights */
1911
    unsigned int attributes;    /* object attributes */
1912
    obj_handle_t rootdir;       /* root directory */
1913 1914
    VARARG(name,unicode_str);   /* object name */
@REPLY
1915
    obj_handle_t handle;        /* handle to the timer */
1916 1917 1918 1919
@END

/* Set a waitable timer */
@REQ(set_timer)
1920
    obj_handle_t handle;        /* handle to the timer */
1921
    timeout_t    expire;        /* next expiration absolute time */
1922 1923
    client_ptr_t callback;      /* callback function */
    client_ptr_t arg;           /* callback argument */
1924
    int          period;        /* timer period in ms */
1925 1926
@REPLY
    int          signaled;      /* was the timer signaled before this call ? */
1927 1928 1929 1930
@END

/* Cancel a waitable timer */
@REQ(cancel_timer)
1931
    obj_handle_t handle;        /* handle to the timer */
1932 1933
@REPLY
     int         signaled;      /* was the timer signaled before this calltime ? */
1934 1935
@END

1936 1937 1938 1939
/* Get information on a waitable timer */
@REQ(get_timer_info)
    obj_handle_t handle;        /* handle to the timer */
@REPLY
1940
    timeout_t    when;          /* absolute time when the timer next expires */
1941 1942 1943
    int          signaled;      /* is the timer signaled? */
@END

1944 1945 1946

/* Retrieve the current context of a thread */
@REQ(get_thread_context)
1947
    obj_handle_t handle;       /* thread handle */
1948
    unsigned int flags;        /* context flags */
1949
    int          suspend;      /* suspend the thread if needed */
1950
@REPLY
1951
    int          self;         /* was it a handle to the current thread? */
1952 1953 1954 1955 1956 1957
    VARARG(context,context);   /* thread context */
@END


/* Set the current context of a thread */
@REQ(set_thread_context)
1958
    obj_handle_t handle;       /* thread handle */
1959
    int          suspend;      /* suspend the thread if needed */
1960
    VARARG(context,context);   /* thread context */
1961 1962
@REPLY
    int          self;         /* was it a handle to the current thread? */
1963 1964 1965 1966 1967
@END


/* Fetch a selector entry for a thread */
@REQ(get_selector_entry)
1968
    obj_handle_t  handle;      /* thread handle */
1969 1970 1971 1972 1973 1974 1975 1976 1977 1978
    int           entry;       /* LDT entry */
@REPLY
    unsigned int  base;        /* selector base */
    unsigned int  limit;       /* selector limit */
    unsigned char flags;       /* selector flags */
@END


/* Add an atom */
@REQ(add_atom)
1979
    obj_handle_t  table;       /* which table to add atom to */
1980 1981
    VARARG(name,unicode_str);  /* atom name */
@REPLY
1982
    atom_t        atom;        /* resulting atom */
1983 1984 1985 1986 1987
@END


/* Delete an atom */
@REQ(delete_atom)
1988
    obj_handle_t  table;       /* which table to delete atom from */
1989
    atom_t        atom;        /* atom handle */
1990 1991 1992 1993 1994
@END


/* Find an atom */
@REQ(find_atom)
1995
    obj_handle_t table;        /* which table to find atom from */
1996 1997
    VARARG(name,unicode_str);  /* atom name */
@REPLY
1998
    atom_t       atom;         /* atom handle */
1999 2000 2001
@END


2002 2003 2004
/* Get information about an atom */
@REQ(get_atom_information)
    obj_handle_t table;        /* which table to find atom from */
2005
    atom_t       atom;         /* atom handle */
2006 2007
@REPLY
    int          count;        /* atom lock count */
2008
    int          pinned;       /* whether the atom has been pinned */
2009
    data_size_t  total;        /* actual length of atom name */
2010 2011 2012 2013
    VARARG(name,unicode_str);  /* atom name */
@END


2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029
/* Set information about an atom */
@REQ(set_atom_information)
    obj_handle_t table;        /* which table to find atom from */
    atom_t       atom;         /* atom handle */
    int          pinned;       /* whether to bump atom information */
@END


/* Empty an atom table */
@REQ(empty_atom_table)
    obj_handle_t table;        /* which table to find atom from */
    int          if_pinned;    /* whether to delete pinned atoms */
@END


/* Init an atom table */
2030
@REQ(init_atom_table)
2031 2032 2033
    int          entries;      /* number of entries (only for local) */
@REPLY
    obj_handle_t table;        /* handle to the atom table */
2034 2035 2036 2037 2038 2039
@END


/* Get the message queue of the current thread */
@REQ(get_msg_queue)
@REPLY
2040
    obj_handle_t handle;       /* handle to the queue */
2041 2042 2043
@END


2044 2045 2046 2047 2048 2049
/* Set the file descriptor associated to the current thread queue */
@REQ(set_queue_fd)
    obj_handle_t handle;       /* handle to the file descriptor */
@END


2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069
/* Set the current message queue wakeup mask */
@REQ(set_queue_mask)
    unsigned int wake_mask;    /* wakeup bits mask */
    unsigned int changed_mask; /* changed bits mask */
    int          skip_wait;    /* will we skip waiting if signaled? */
@REPLY
    unsigned int wake_bits;    /* current wake bits */
    unsigned int changed_bits; /* current changed bits */
@END


/* Get the current message queue status */
@REQ(get_queue_status)
    int          clear;        /* should we clear the change bits? */
@REPLY
    unsigned int wake_bits;    /* wake bits */
    unsigned int changed_bits; /* changed bits since last time */
@END


2070 2071
/* Retrieve the process idle event */
@REQ(get_process_idle_event)
2072
    obj_handle_t handle;       /* process handle */
2073
@REPLY
2074
    obj_handle_t event;        /* handle to idle event */
2075 2076 2077 2078 2079
@END


/* Send a message to a thread queue */
@REQ(send_message)
2080
    thread_id_t     id;        /* thread id */
2081
    int             type;      /* message type (see below) */
2082
    int             flags;     /* message flags (see below) */
2083
    user_handle_t   win;       /* window handle */
2084
    unsigned int    msg;       /* message code */
2085 2086
    lparam_t        wparam;    /* parameters */
    lparam_t        lparam;    /* parameters */
2087
    timeout_t       timeout;   /* timeout for reply */
2088
    VARARG(data,message_data); /* message data for sent messages */
2089
@END
2090

2091 2092 2093 2094
@REQ(post_quit_message)
    int             exit_code; /* exit code to return */
@END

2095 2096 2097 2098 2099 2100
enum message_type
{
    MSG_ASCII,          /* Ascii message (from SendMessageA) */
    MSG_UNICODE,        /* Unicode message (from SendMessageW) */
    MSG_NOTIFY,         /* notify message (from SendNotifyMessageW), always Unicode */
    MSG_CALLBACK,       /* callback message (from SendMessageCallbackW), always Unicode */
2101
    MSG_CALLBACK_RESULT,/* result of a callback message */
2102 2103
    MSG_OTHER_PROCESS,  /* sent from other process, may include vararg data, always Unicode */
    MSG_POSTED,         /* posted message (from PostMessageW), always Unicode */
2104
    MSG_HARDWARE,       /* hardware message */
2105 2106
    MSG_WINEVENT,       /* winevent message */
    MSG_HOOK_LL         /* low-level hardware hook */
2107
};
2108
#define SEND_MSG_ABORT_IF_HUNG  0x01
2109 2110


2111 2112 2113
/* Send a hardware message to a thread queue */
@REQ(send_hardware_message)
    user_handle_t   win;       /* window handle */
2114 2115
    hw_input_t      input;     /* input data */
    unsigned int    flags;     /* flags (see below) */
2116 2117
@REPLY
    int             wait;      /* do we need to wait for a reply? */
2118 2119 2120 2121
    int             prev_x;    /* previous cursor position */
    int             prev_y;
    int             new_x;     /* new cursor position */
    int             new_y;
2122
    VARARG(keystate,bytes);    /* global state array for all the keys */
2123
@END
2124
#define SEND_HWMSG_INJECTED    0x01
2125 2126


2127 2128
/* Get a message from the current queue */
@REQ(get_message)
2129
    unsigned int    flags;     /* PM_* flags */
2130
    user_handle_t   get_win;   /* window handle to get */
2131 2132
    unsigned int    get_first; /* first message code to get */
    unsigned int    get_last;  /* last message code to get */
2133
    unsigned int    hw_id;     /* id of the previous hardware message (or 0) */
2134 2135
    unsigned int    wake_mask; /* wakeup bits mask */
    unsigned int    changed_mask; /* changed bits mask */
2136
@REPLY
2137
    user_handle_t   win;       /* window handle */
2138
    unsigned int    msg;       /* message code */
2139 2140
    lparam_t        wparam;    /* parameters */
    lparam_t        lparam;    /* parameters */
2141
    int             type;      /* message type */
2142
    unsigned int    time;      /* message time */
2143
    unsigned int    active_hooks; /* active hooks bitmap */
2144
    data_size_t     total;     /* total size of extra data */
2145
    VARARG(data,message_data); /* message data for sent messages */
2146
@END
2147

2148 2149 2150 2151

/* Reply to a sent message */
@REQ(reply_message)
    int             remove;    /* should we remove the message? */
2152
    lparam_t        result;    /* message result */
2153
    VARARG(data,bytes);        /* message data for sent messages */
2154 2155 2156
@END


2157 2158
/* Accept the current hardware message */
@REQ(accept_hardware_message)
2159
    unsigned int    hw_id;     /* id of the hardware message */
2160 2161 2162 2163 2164
    int             remove;    /* should we remove the message? */
    user_handle_t   new_win;   /* new destination window for current message */
@END


2165 2166 2167 2168
/* Retrieve the reply for the last message sent */
@REQ(get_message_reply)
    int             cancel;    /* cancel message if not ready? */
@REPLY
2169
    lparam_t        result;    /* message result */
2170
    VARARG(data,bytes);        /* message data for sent messages */
2171 2172 2173 2174 2175
@END


/* Set a window timer */
@REQ(set_win_timer)
2176
    user_handle_t   win;       /* window handle */
2177 2178
    unsigned int    msg;       /* message to post */
    unsigned int    rate;      /* timer rate in ms */
2179 2180
    lparam_t        id;        /* timer id */
    lparam_t        lparam;    /* message lparam (callback proc) */
2181
@REPLY
2182
    lparam_t        id;        /* timer id */
2183 2184 2185 2186 2187
@END


/* Kill a window timer */
@REQ(kill_win_timer)
2188
    user_handle_t   win;       /* window handle */
2189
    lparam_t        id;        /* timer id */
2190
    unsigned int    msg;       /* message to post */
2191 2192 2193
@END


2194 2195 2196 2197 2198 2199 2200 2201
/* check if the thread owning the window is hung */
@REQ(is_window_hung)
    user_handle_t   win;       /* window handle */
@REPLY
    int is_hung;
@END


2202 2203
/* Retrieve info about a serial port */
@REQ(get_serial_info)
2204
    obj_handle_t handle;       /* handle to comm port */
2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216
@REPLY
    unsigned int readinterval;
    unsigned int readconst;
    unsigned int readmult;
    unsigned int writeconst;
    unsigned int writemult;
    unsigned int eventmask;
@END


/* Set info about a serial port */
@REQ(set_serial_info)
2217
    obj_handle_t handle;       /* handle to comm port */
2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229
    int          flags;        /* bitmask to set values (see below) */
    unsigned int readinterval;
    unsigned int readconst;
    unsigned int readmult;
    unsigned int writeconst;
    unsigned int writemult;
    unsigned int eventmask;
@END
#define SERIALINFO_SET_TIMEOUTS  0x01
#define SERIALINFO_SET_MASK      0x02


2230
/* Create an async I/O */
2231
@REQ(register_async)
2232
    int          type;          /* type of queue to look after */
2233
    async_data_t async;         /* async I/O parameters */
2234
    int          count;         /* count - usually # of bytes to be read/written */
2235 2236 2237 2238 2239 2240
@END
#define ASYNC_TYPE_READ  0x01
#define ASYNC_TYPE_WRITE 0x02
#define ASYNC_TYPE_WAIT  0x03


2241 2242 2243
/* Cancel all async op on a fd */
@REQ(cancel_async)
    obj_handle_t handle;        /* handle to comm port, socket or file */
2244 2245
    client_ptr_t iosb;          /* I/O status block (NULL=all) */
    int          only_thread;   /* cancel matching this thread */
2246 2247 2248
@END


2249 2250
/* Perform an ioctl on a file */
@REQ(ioctl)
2251
    ioctl_code_t   code;          /* ioctl code */
2252
    async_data_t   async;         /* async I/O parameters */
2253
    int            blocking;      /* whether it's a blocking ioctl */
2254 2255
    VARARG(in_data,bytes);        /* ioctl input data */
@REPLY
2256 2257
    obj_handle_t   wait;          /* handle to wait on for blocking ioctl */
    unsigned int   options;       /* device open options */
2258 2259 2260 2261
    VARARG(out_data,bytes);       /* ioctl output data */
@END


2262 2263 2264
/* Retrieve results of an async ioctl */
@REQ(get_ioctl_result)
    obj_handle_t   handle;        /* handle to the device */
2265
    client_ptr_t   user_arg;      /* user arg used to identify the request */
2266 2267 2268 2269 2270
@REPLY
    VARARG(out_data,bytes);       /* ioctl output data */
@END


2271 2272
/* Create a named pipe */
@REQ(create_named_pipe)
2273
    unsigned int   access;
2274
    unsigned int   attributes;   /* object attributes */
2275
    obj_handle_t   rootdir;      /* root directory */
2276
    unsigned int   options;
2277
    unsigned int   sharing;
2278 2279 2280
    unsigned int   maxinstances;
    unsigned int   outsize;
    unsigned int   insize;
2281
    timeout_t      timeout;
2282
    unsigned int   flags;
2283
    VARARG(name,unicode_str);    /* pipe name */
2284
@REPLY
2285
    obj_handle_t   handle;       /* handle to the pipe */
2286 2287
@END

2288 2289 2290 2291
/* flags in create_named_pipe and get_named_pipe_info */
#define NAMED_PIPE_MESSAGE_STREAM_WRITE 0x0001
#define NAMED_PIPE_MESSAGE_STREAM_READ  0x0002
#define NAMED_PIPE_NONBLOCKING_MODE     0x0004
2292
#define NAMED_PIPE_SERVER_END           0x8000
2293

2294

2295
@REQ(get_named_pipe_info)
2296
    obj_handle_t   handle;
2297 2298
@REPLY
    unsigned int   flags;
2299
    unsigned int   sharing;
2300
    unsigned int   maxinstances;
2301
    unsigned int   instances;
2302 2303 2304 2305
    unsigned int   outsize;
    unsigned int   insize;
@END

2306 2307 2308

/* Create a window */
@REQ(create_window)
2309 2310
    user_handle_t  parent;      /* parent window */
    user_handle_t  owner;       /* owner window */
2311
    atom_t         atom;        /* class atom */
2312
    mod_handle_t   instance;    /* module instance */
2313
    VARARG(class,unicode_str);  /* class name */
2314
@REPLY
2315
    user_handle_t  handle;      /* created window */
2316 2317
    user_handle_t  parent;      /* full handle of parent */
    user_handle_t  owner;       /* full handle of owner */
2318
    int            extra;       /* number of extra bytes */
2319
    client_ptr_t   class_ptr;   /* pointer to class in client address space */
2320 2321 2322 2323 2324 2325 2326 2327 2328
@END


/* Destroy a window */
@REQ(destroy_window)
    user_handle_t  handle;      /* handle to the window */
@END


2329 2330
/* Retrieve the desktop window for the current thread */
@REQ(get_desktop_window)
2331
    int            force;       /* force creation if it doesn't exist */
2332
@REPLY
2333 2334
    user_handle_t  top_window;  /* handle to the desktop window */
    user_handle_t  msg_window;  /* handle to the top-level HWND_MESSAGE parent */
2335 2336 2337
@END


2338 2339 2340 2341 2342 2343
/* Set a window owner */
@REQ(set_window_owner)
    user_handle_t  handle;      /* handle to the window */
    user_handle_t  owner;       /* new owner */
@REPLY
    user_handle_t  full_owner;  /* full handle of new owner */
2344
    user_handle_t  prev_owner;  /* full handle of previous owner */
2345 2346 2347
@END


2348 2349 2350 2351 2352
/* Get information from a window handle */
@REQ(get_window_info)
    user_handle_t  handle;      /* handle to the window */
@REPLY
    user_handle_t  full_handle; /* full 32-bit handle */
2353
    user_handle_t  last_active; /* last active popup */
2354 2355
    process_id_t   pid;         /* process owning the window */
    thread_id_t    tid;         /* thread owning the window */
2356
    atom_t         atom;        /* class atom */
2357
    int            is_unicode;  /* ANSI or unicode */
2358
@END
2359 2360


2361 2362
/* Set some information in a window */
@REQ(set_window_info)
2363 2364
    unsigned short flags;         /* flags for fields to set (see below) */
    short int      is_unicode;    /* ANSI or unicode */
2365
    user_handle_t  handle;        /* handle to the window */
2366 2367 2368
    unsigned int   style;         /* window style */
    unsigned int   ex_style;      /* window extended style */
    unsigned int   id;            /* window id */
2369
    mod_handle_t   instance;      /* creator instance */
2370
    lparam_t       user_data;     /* user-specific data */
2371
    int            extra_offset;  /* offset to set in extra bytes */
2372
    data_size_t    extra_size;    /* size to set in extra bytes */
2373
    lparam_t       extra_value;   /* value to set in extra bytes */
2374 2375 2376
@REPLY
    unsigned int   old_style;     /* old window style */
    unsigned int   old_ex_style;  /* old window extended style */
2377
    mod_handle_t   old_instance;  /* old creator instance */
2378 2379
    lparam_t       old_user_data; /* old user-specific data */
    lparam_t       old_extra_value; /* old value in extra bytes */
2380
    unsigned int   old_id;        /* old window id */
2381 2382 2383 2384 2385 2386
@END
#define SET_WIN_STYLE     0x01
#define SET_WIN_EXSTYLE   0x02
#define SET_WIN_ID        0x04
#define SET_WIN_INSTANCE  0x08
#define SET_WIN_USERDATA  0x10
2387
#define SET_WIN_EXTRA     0x20
2388
#define SET_WIN_UNICODE   0x40
2389 2390


2391 2392 2393 2394 2395 2396 2397 2398 2399 2400
/* Set the parent of a window */
@REQ(set_parent)
    user_handle_t  handle;      /* handle to the window */
    user_handle_t  parent;      /* handle to the parent */
@REPLY
    user_handle_t  old_parent;  /* old parent window */
    user_handle_t  full_parent; /* full handle of new parent */
@END


2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411
/* Get a list of the window parents, up to the root of the tree */
@REQ(get_window_parents)
    user_handle_t  handle;        /* handle to the window */
@REPLY
    int            count;         /* total count of parents */
    VARARG(parents,user_handles); /* parent handles */
@END


/* Get a list of the window children */
@REQ(get_window_children)
2412
    obj_handle_t   desktop;       /* handle to desktop */
2413
    user_handle_t  parent;        /* parent window */
2414
    atom_t         atom;          /* class atom for the listed children */
2415
    thread_id_t    tid;           /* thread owning the listed children */
2416
    VARARG(class,unicode_str);    /* class name */
2417 2418
@REPLY
    int            count;         /* total count of children */
2419
    VARARG(children,user_handles); /* children handles */
2420 2421 2422
@END


2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433
/* Get a list of the window children that contain a given point */
@REQ(get_window_children_from_point)
    user_handle_t  parent;        /* parent window */
    int            x;             /* point in parent coordinates */
    int            y;
@REPLY
    int            count;         /* total count of children */
    VARARG(children,user_handles); /* children handles */
@END


2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446
/* Get window tree information from a window handle */
@REQ(get_window_tree)
    user_handle_t  handle;        /* handle to the window */
@REPLY
    user_handle_t  parent;        /* parent window */
    user_handle_t  owner;         /* owner window */
    user_handle_t  next_sibling;  /* next sibling in Z-order */
    user_handle_t  prev_sibling;  /* prev sibling in Z-order */
    user_handle_t  first_sibling; /* first sibling in Z-order */
    user_handle_t  last_sibling;  /* last sibling in Z-order */
    user_handle_t  first_child;   /* first child */
    user_handle_t  last_child;    /* last child */
@END
2447

2448 2449
/* Set the position and Z order of a window */
@REQ(set_window_pos)
2450 2451
    unsigned short swp_flags;     /* SWP_* flags */
    unsigned short paint_flags;   /* paint flags (see below) */
2452
    user_handle_t  handle;        /* handle to the window */
2453
    user_handle_t  previous;      /* previous window in Z order */
2454 2455
    rectangle_t    window;        /* window rectangle (in parent coords) */
    rectangle_t    client;        /* client rectangle (in parent coords) */
2456
    VARARG(valid,rectangles);     /* valid rectangles from WM_NCCALCSIZE (in parent coords) */
2457 2458
@REPLY
    unsigned int   new_style;     /* new window style */
2459
    unsigned int   new_ex_style;  /* new window extended style */
2460
    user_handle_t  surface_win;   /* window that needs a surface update */
2461
@END
2462 2463
#define SET_WINPOS_PAINT_SURFACE 0x01  /* window has a paintable surface */
#define SET_WINPOS_PIXEL_FORMAT  0x02  /* window has a custom pixel format */
2464 2465 2466 2467

/* Get the window and client rectangles of a window */
@REQ(get_window_rectangles)
    user_handle_t  handle;        /* handle to the window */
2468
    int            relative;      /* coords relative to (see below) */
2469 2470
@REPLY
    rectangle_t    window;        /* window rectangle */
2471
    rectangle_t    visible;       /* visible part of the window rectangle */
2472 2473
    rectangle_t    client;        /* client rectangle */
@END
2474 2475 2476 2477 2478 2479 2480
enum coords_relative
{
    COORDS_CLIENT,   /* relative to client area */
    COORDS_WINDOW,   /* relative to whole window area */
    COORDS_PARENT,   /* relative to parent's client area */
    COORDS_SCREEN    /* relative to screen origin */
};
2481 2482


2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497
/* Get the window text */
@REQ(get_window_text)
    user_handle_t  handle;        /* handle to the window */
@REPLY
    VARARG(text,unicode_str);     /* window text */
@END


/* Set the window text */
@REQ(set_window_text)
    user_handle_t  handle;        /* handle to the window */
    VARARG(text,unicode_str);     /* window text */
@END


2498 2499 2500 2501 2502 2503 2504
/* Get the coordinates offset between two windows */
@REQ(get_windows_offset)
    user_handle_t  from;          /* handle to the first window */
    user_handle_t  to;            /* handle to the second window */
@REPLY
    int            x;             /* x coordinate offset */
    int            y;             /* y coordinate offset */
2505
    int            mirror;        /* whether to mirror the x coordinate */
2506 2507
@END

2508

2509 2510 2511 2512 2513
/* Get the visible region of a window */
@REQ(get_visible_region)
    user_handle_t  window;        /* handle to the window */
    unsigned int   flags;         /* DCX flags */
@REPLY
2514
    user_handle_t  top_win;       /* top window to clip against */
2515 2516
    rectangle_t    top_rect;      /* top window visible rect with screen coords */
    rectangle_t    win_rect;      /* window rect in screen coords */
2517
    unsigned int   paint_flags;   /* paint flags (from SET_WINPOS_* flags) */
2518
    data_size_t    total_size;    /* total size of the resulting region */
2519
    VARARG(region,rectangles);    /* list of rectangles for the region (in screen coords) */
2520 2521 2522
@END


2523 2524 2525 2526 2527 2528 2529 2530 2531 2532
/* Get the visible surface region of a window */
@REQ(get_surface_region)
    user_handle_t  window;        /* handle to the window */
@REPLY
    rectangle_t    visible_rect;  /* window visible rect in screen coords */
    data_size_t    total_size;    /* total size of the resulting region */
    VARARG(region,rectangles);    /* list of rectangles for the region (in screen coords) */
@END


2533 2534 2535 2536
/* Get the window region */
@REQ(get_window_region)
    user_handle_t  window;        /* handle to the window */
@REPLY
2537
    data_size_t    total_size;    /* total size of the resulting region */
2538
    VARARG(region,rectangles);    /* list of rectangles for the region (in window coords) */
2539 2540 2541 2542 2543 2544
@END


/* Set the window region */
@REQ(set_window_region)
    user_handle_t  window;        /* handle to the window */
2545
    int            redraw;        /* redraw the window? */
2546
    VARARG(region,rectangles);    /* list of rectangles for the region (in window coords) */
2547 2548 2549
@END


2550 2551 2552
/* Get the window update region */
@REQ(get_update_region)
    user_handle_t  window;        /* handle to the window */
2553
    user_handle_t  from_child;    /* child to start searching from */
2554 2555 2556 2557
    unsigned int   flags;         /* update flags (see below) */
@REPLY
    user_handle_t  child;         /* child to repaint (or window itself) */
    unsigned int   flags;         /* resulting update flags (see below) */
2558
    data_size_t    total_size;    /* total size of the resulting region */
2559
    VARARG(region,rectangles);    /* list of rectangles for the region (in screen coords) */
2560 2561 2562 2563 2564 2565 2566 2567
@END
#define UPDATE_NONCLIENT       0x01  /* get region for repainting non-client area */
#define UPDATE_ERASE           0x02  /* get region for erasing client area */
#define UPDATE_PAINT           0x04  /* get region for painting client area */
#define UPDATE_INTERNALPAINT   0x08  /* get region if internal paint is pending */
#define UPDATE_ALLCHILDREN     0x10  /* force repaint of all children */
#define UPDATE_NOCHILDREN      0x20  /* don't try to repaint any children */
#define UPDATE_NOREGION        0x40  /* don't return a region, only the flags */
2568
#define UPDATE_DELAYED_ERASE   0x80  /* still needs erase after BeginPaint */
2569 2570


2571 2572 2573
/* Update the z order of a window so that a given rectangle is fully visible */
@REQ(update_window_zorder)
    user_handle_t  window;        /* handle to the window */
2574
    rectangle_t    rect;          /* rectangle that must be visible (in client coords) */
2575 2576 2577
@END


2578 2579 2580 2581
/* Mark parts of a window as needing a redraw */
@REQ(redraw_window)
    user_handle_t  window;        /* handle to the window */
    unsigned int   flags;         /* RDW_* flags */
2582
    VARARG(region,rectangles);    /* list of rectangles for the region (in window coords) */
2583 2584 2585
@END


2586 2587 2588
/* Set a window property */
@REQ(set_window_property)
    user_handle_t  window;        /* handle to the window */
2589
    lparam_t       data;          /* data to store */
2590
    atom_t         atom;          /* property atom (if no name specified) */
2591
    VARARG(name,unicode_str);     /* property name */
2592 2593 2594 2595 2596 2597
@END


/* Remove a window property */
@REQ(remove_window_property)
    user_handle_t  window;        /* handle to the window */
2598 2599
    atom_t         atom;          /* property atom (if no name specified) */
    VARARG(name,unicode_str);     /* property name */
2600
@REPLY
2601
    lparam_t       data;          /* data stored in property */
2602 2603 2604 2605 2606 2607
@END


/* Get a window property */
@REQ(get_window_property)
    user_handle_t  window;        /* handle to the window */
2608 2609
    atom_t         atom;          /* property atom (if no name specified) */
    VARARG(name,unicode_str);     /* property name */
2610
@REPLY
2611
    lparam_t       data;          /* data stored in property */
2612 2613 2614 2615 2616 2617 2618
@END


/* Get the list of properties of a window */
@REQ(get_window_properties)
    user_handle_t  window;        /* handle to the window */
@REPLY
2619
    int            total;         /* total number of properties */
2620 2621
    VARARG(props,properties);     /* list of properties */
@END
2622 2623


2624 2625 2626 2627
/* Create a window station */
@REQ(create_winstation)
    unsigned int flags;           /* window station flags */
    unsigned int access;          /* wanted access rights */
2628
    unsigned int attributes;      /* object attributes */
2629 2630 2631 2632 2633 2634 2635 2636 2637
    VARARG(name,unicode_str);     /* object name */
@REPLY
    obj_handle_t handle;          /* handle to the window station */
@END


/* Open a handle to a window station */
@REQ(open_winstation)
    unsigned int access;          /* wanted access rights */
2638
    unsigned int attributes;      /* object attributes */
2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663
    VARARG(name,unicode_str);     /* object name */
@REPLY
    obj_handle_t handle;          /* handle to the window station */
@END


/* Close a window station */
@REQ(close_winstation)
    obj_handle_t handle;          /* handle to the window station */
@END


/* Get the process current window station */
@REQ(get_process_winstation)
@REPLY
    obj_handle_t handle;          /* handle to the window station */
@END


/* Set the process current window station */
@REQ(set_process_winstation)
    obj_handle_t handle;          /* handle to the window station */
@END


2664 2665 2666 2667 2668 2669 2670 2671 2672
/* Enumerate window stations */
@REQ(enum_winstation)
    unsigned int index;           /* current index */
@REPLY
    unsigned int next;            /* next index */
    VARARG(name,unicode_str);     /* window station name */
@END


2673 2674 2675 2676
/* Create a desktop */
@REQ(create_desktop)
    unsigned int flags;           /* desktop flags */
    unsigned int access;          /* wanted access rights */
2677
    unsigned int attributes;      /* object attributes */
2678 2679 2680 2681 2682 2683 2684 2685
    VARARG(name,unicode_str);     /* object name */
@REPLY
    obj_handle_t handle;          /* handle to the desktop */
@END


/* Open a handle to a desktop */
@REQ(open_desktop)
2686
    obj_handle_t winsta;          /* window station to open (null allowed) */
2687 2688
    unsigned int flags;           /* desktop flags */
    unsigned int access;          /* wanted access rights */
2689
    unsigned int attributes;      /* object attributes */
2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715
    VARARG(name,unicode_str);     /* object name */
@REPLY
    obj_handle_t handle;          /* handle to the desktop */
@END


/* Close a desktop */
@REQ(close_desktop)
    obj_handle_t handle;          /* handle to the desktop */
@END


/* Get the thread current desktop */
@REQ(get_thread_desktop)
    thread_id_t  tid;             /* thread id */
@REPLY
    obj_handle_t handle;          /* handle to the desktop */
@END


/* Set the thread current desktop */
@REQ(set_thread_desktop)
    obj_handle_t handle;          /* handle to the desktop */
@END


2716 2717 2718 2719 2720 2721 2722 2723 2724 2725
/* Enumerate desktops */
@REQ(enum_desktop)
    obj_handle_t winstation;      /* handle to the window station */
    unsigned int index;           /* current index */
@REPLY
    unsigned int next;            /* next index */
    VARARG(name,unicode_str);     /* window station name */
@END


2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738
/* Get/set information about a user object (window station or desktop) */
@REQ(set_user_object_info)
    obj_handle_t handle;          /* handle to the object */
    unsigned int flags;           /* information to set */
    unsigned int obj_flags;       /* new object flags */
@REPLY
    int          is_desktop;      /* is object a desktop? */
    unsigned int old_obj_flags;   /* old object flags */
    VARARG(name,unicode_str);     /* object name */
@END
#define SET_USER_OBJECT_FLAGS 1


2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761
/* Register a hotkey */
@REQ(register_hotkey)
    user_handle_t  window;        /* handle to the window */
    int            id;            /* hotkey identifier */
    unsigned int   flags;         /* modifier keys */
    unsigned int   vkey;          /* virtual key code */
@REPLY
    int            replaced;      /* did we replace an existing hotkey? */
    unsigned int   flags;         /* flags of replaced hotkey */
    unsigned int   vkey;          /* virtual key code of replaced hotkey */
@END


/* Unregister a hotkey */
@REQ(unregister_hotkey)
    user_handle_t  window;        /* handle to the window */
    int            id;            /* hotkey identifier */
@REPLY
    unsigned int   flags;         /* flags of removed hotkey */
    unsigned int   vkey;          /* virtual key code of removed hotkey */
@END


2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780
/* Attach (or detach) thread inputs */
@REQ(attach_thread_input)
    thread_id_t    tid_from;       /* thread to be attached */
    thread_id_t    tid_to;         /* thread to which tid_from should be attached */
    int            attach;         /* is it an attach? */
@END


/* Get input data for a given thread */
@REQ(get_thread_input)
    thread_id_t    tid;           /* id of thread */
@REPLY
    user_handle_t  focus;         /* handle to the focus window */
    user_handle_t  capture;       /* handle to the capture window */
    user_handle_t  active;        /* handle to the active window */
    user_handle_t  foreground;    /* handle to the global foreground window */
    user_handle_t  menu_owner;    /* handle to the menu owner */
    user_handle_t  move_size;     /* handle to the moving/resizing window */
    user_handle_t  caret;         /* handle to the caret window */
2781 2782
    user_handle_t  cursor;        /* handle to the cursor */
    int            show_count;    /* cursor show count */
2783 2784
    rectangle_t    rect;          /* caret rectangle */
@END
2785

2786 2787 2788 2789 2790 2791 2792 2793

/* Get the time of the last input event */
@REQ(get_last_input_time)
@REPLY
    unsigned int time;
@END


2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805
/* Retrieve queue keyboard state for a given thread */
@REQ(get_key_state)
    thread_id_t    tid;           /* id of thread */
    int            key;           /* optional key code or -1 */
@REPLY
    unsigned char  state;         /* state of specified key */
    VARARG(keystate,bytes);       /* state array for all the keys */
@END

/* Set queue keyboard state for a given thread */
@REQ(set_key_state)
    thread_id_t    tid;           /* id of thread */
2806
    int            async;         /* whether to change the async state too */
2807 2808 2809
    VARARG(keystate,bytes);       /* state array for all the keys */
@END

2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831
/* Set the system foreground window */
@REQ(set_foreground_window)
    user_handle_t  handle;        /* handle to the foreground window */
@REPLY
    user_handle_t  previous;      /* handle to the previous foreground window */
    int            send_msg_old;  /* whether we have to send a msg to the old window */
    int            send_msg_new;  /* whether we have to send a msg to the new window */
@END

/* Set the current thread focus window */
@REQ(set_focus_window)
    user_handle_t  handle;        /* handle to the focus window */
@REPLY
    user_handle_t  previous;      /* handle to the previous focus window */
@END

/* Set the current thread active window */
@REQ(set_active_window)
    user_handle_t  handle;        /* handle to the active window */
@REPLY
    user_handle_t  previous;      /* handle to the previous active window */
@END
2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842

/* Set the current thread capture window */
@REQ(set_capture_window)
    user_handle_t  handle;        /* handle to the capture window */
    unsigned int   flags;         /* capture flags (see below) */
@REPLY
    user_handle_t  previous;      /* handle to the previous capture window */
    user_handle_t  full_handle;   /* full 32-bit handle of new capture window */
@END
#define CAPTURE_MENU     0x01  /* capture is for a menu */
#define CAPTURE_MOVESIZE 0x02  /* capture is for moving/resizing */
2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874


/* Set the current thread caret window */
@REQ(set_caret_window)
    user_handle_t  handle;        /* handle to the caret window */
    int            width;         /* caret width */
    int            height;        /* caret height */
@REPLY
    user_handle_t  previous;      /* handle to the previous caret window */
    rectangle_t    old_rect;      /* previous caret rectangle */
    int            old_hide;      /* previous hide count */
    int            old_state;     /* previous caret state (1=on, 0=off) */
@END


/* Set the current thread caret information */
@REQ(set_caret_info)
    unsigned int   flags;         /* caret flags (see below) */
    user_handle_t  handle;        /* handle to the caret window */
    int            x;             /* caret x position */
    int            y;             /* caret y position */
    int            hide;          /* increment for hide count (can be negative to show it) */
    int            state;         /* caret state (1=on, 0=off, -1=toggle current state) */
@REPLY
    user_handle_t  full_handle;   /* handle to the current caret window */
    rectangle_t    old_rect;      /* previous caret rectangle */
    int            old_hide;      /* previous hide count */
    int            old_state;     /* previous caret state (1=on, 0=off) */
@END
#define SET_CARET_POS        0x01  /* set the caret position from x,y */
#define SET_CARET_HIDE       0x02  /* increment the caret hide count */
#define SET_CARET_STATE      0x04  /* set the caret on/off state */
2875 2876 2877 2878 2879


/* Set a window hook */
@REQ(set_hook)
    int            id;             /* id of the hook */
2880
    process_id_t   pid;            /* id of process to set the hook into */
2881
    thread_id_t    tid;            /* id of thread to set the hook into */
2882 2883
    int            event_min;
    int            event_max;
2884
    client_ptr_t   proc;           /* hook procedure */
2885
    int            flags;
2886
    int            unicode;        /* is it a unicode hook? */
2887
    VARARG(module,unicode_str);    /* module name */
2888 2889
@REPLY
    user_handle_t  handle;         /* handle to the hook */
2890
    unsigned int   active_hooks;   /* active hooks bitmap */
2891 2892 2893 2894 2895 2896
@END


/* Remove a window hook */
@REQ(remove_hook)
    user_handle_t  handle;         /* handle to the hook */
2897
    client_ptr_t   proc;           /* hook procedure if handle is 0 */
2898
    int            id;             /* id of the hook if handle is 0 */
2899 2900
@REPLY
    unsigned int   active_hooks;   /* active hooks bitmap */
2901 2902 2903 2904 2905 2906
@END


/* Start calling a hook chain */
@REQ(start_hook_chain)
    int            id;             /* id of the hook */
2907 2908 2909 2910
    int            event;          /* signalled event */
    user_handle_t  window;         /* handle to the event window */
    int            object_id;      /* object id for out of context winevent */
    int            child_id;       /* child id for out of context winevent */
2911 2912
@REPLY
    user_handle_t  handle;         /* handle to the next hook */
2913 2914
    process_id_t   pid;            /* process id for low-level keyboard/mouse hooks */
    thread_id_t    tid;            /* thread id for low-level keyboard/mouse hooks */
2915
    int            unicode;        /* is it a unicode hook? */
2916
    client_ptr_t   proc;           /* hook procedure */
2917
    unsigned int   active_hooks;   /* active hooks bitmap */
2918
    VARARG(module,unicode_str);    /* module name */
2919 2920 2921 2922 2923 2924 2925 2926 2927
@END


/* Finished calling a hook chain */
@REQ(finish_hook_chain)
    int            id;             /* id of the hook */
@END


2928 2929
/* Get the hook information */
@REQ(get_hook_info)
2930
    user_handle_t  handle;         /* handle to the current hook */
2931
    int            get_next;       /* do we want info about current or next hook? */
2932 2933 2934 2935
    int            event;          /* signalled event */
    user_handle_t  window;         /* handle to the event window */
    int            object_id;      /* object id for out of context winevent */
    int            child_id;       /* child id for out of context winevent */
2936
@REPLY
2937 2938
    user_handle_t  handle;         /* handle to the hook */
    int            id;             /* id of the hook */
2939 2940
    process_id_t   pid;            /* process id for low-level keyboard/mouse hooks */
    thread_id_t    tid;            /* thread id for low-level keyboard/mouse hooks */
2941
    client_ptr_t   proc;           /* hook procedure */
2942
    int            unicode;        /* is it a unicode hook? */
2943
    VARARG(module,unicode_str);    /* module name */
2944
@END
2945 2946


2947 2948 2949 2950 2951
/* Create a window class */
@REQ(create_class)
    int            local;          /* is it a local class? */
    atom_t         atom;           /* class atom */
    unsigned int   style;          /* class style */
2952
    mod_handle_t   instance;       /* module instance */
2953 2954
    int            extra;          /* number of extra class bytes */
    int            win_extra;      /* number of window extra bytes */
2955
    client_ptr_t   client_ptr;     /* pointer to class in client address space */
2956 2957 2958
    VARARG(name,unicode_str);      /* class name */
@REPLY
    atom_t         atom;           /* resulting class atom */
2959 2960 2961 2962 2963 2964
@END


/* Destroy a window class */
@REQ(destroy_class)
    atom_t         atom;           /* class atom */
2965
    mod_handle_t   instance;       /* module instance */
2966
    VARARG(name,unicode_str);      /* class name */
2967
@REPLY
2968
    client_ptr_t   client_ptr;     /* pointer to class in client address space */
2969 2970 2971 2972 2973 2974 2975 2976 2977 2978
@END


/* Set some information in a class */
@REQ(set_class_info)
    user_handle_t  window;         /* handle to the window */
    unsigned int   flags;          /* flags for info to set (see below) */
    atom_t         atom;           /* class atom */
    unsigned int   style;          /* class style */
    int            win_extra;      /* number of window extra bytes */
2979
    mod_handle_t   instance;       /* module instance */
2980
    int            extra_offset;   /* offset to set in extra bytes */
2981
    data_size_t    extra_size;     /* size to set in extra bytes */
2982
    lparam_t       extra_value;    /* value to set in extra bytes */
2983 2984 2985 2986 2987
@REPLY
    atom_t         old_atom;       /* previous class atom */
    unsigned int   old_style;      /* previous class style */
    int            old_extra;      /* previous number of class extra bytes */
    int            old_win_extra;  /* previous number of window extra bytes */
2988
    mod_handle_t   old_instance;   /* previous module instance */
2989
    lparam_t       old_extra_value; /* old value in extra bytes */
2990 2991 2992 2993 2994 2995 2996 2997
@END
#define SET_CLASS_ATOM      0x0001
#define SET_CLASS_STYLE     0x0002
#define SET_CLASS_WINEXTRA  0x0004
#define SET_CLASS_INSTANCE  0x0008
#define SET_CLASS_EXTRA     0x0010


2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020
/* Set/get clipboard information */
@REQ(set_clipboard_info)
    unsigned int   flags;       /* flags for fields to set (see below) */
    user_handle_t  clipboard;   /* clipboard window */
    user_handle_t  owner;       /* clipboard owner */
    user_handle_t  viewer;      /* first clipboard viewer */
    unsigned int   seqno;       /* change sequence number */
@REPLY
    unsigned int   flags;           /* status flags (see below) */
    user_handle_t  old_clipboard;   /* old clipboard window */
    user_handle_t  old_owner;       /* old clipboard owner */
    user_handle_t  old_viewer;      /* old clipboard viewer */
    unsigned int   seqno;           /* current sequence number */
@END

#define SET_CB_OPEN      0x001
#define SET_CB_OWNER     0x002
#define SET_CB_VIEWER    0x004
#define SET_CB_SEQNO     0x008
#define SET_CB_RELOWNER  0x010
#define SET_CB_CLOSE     0x020
#define CB_OPEN          0x040
#define CB_OWNER         0x080
3021
#define CB_PROCESS       0x100
3022 3023 3024 3025 3026


/* Open a security token */
@REQ(open_token)
    obj_handle_t   handle;    /* handle to the thread or process */
3027 3028
    unsigned int   access;    /* access rights to the new token */
    unsigned int   attributes;/* object attributes */
3029 3030 3031 3032 3033 3034
    unsigned int   flags;     /* flags (see below) */
@REPLY
    obj_handle_t   token;    /* handle to the token */
@END
#define OPEN_TOKEN_THREAD   1
#define OPEN_TOKEN_AS_SELF  2
3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052


/* Set/get the global windows */
@REQ(set_global_windows)
    unsigned int   flags;               /* flags for fields to set (see below) */
    user_handle_t  shell_window;        /* handle to the new shell window */
    user_handle_t  shell_listview;      /* handle to the new shell listview window */
    user_handle_t  progman_window;      /* handle to the new program manager window */
    user_handle_t  taskman_window;      /* handle to the new task manager window */
@REPLY
    user_handle_t  old_shell_window;    /* handle to the shell window */
    user_handle_t  old_shell_listview;  /* handle to the shell listview window */
    user_handle_t  old_progman_window;  /* handle to the new program manager window */
    user_handle_t  old_taskman_window;  /* handle to the new task manager window */
@END
#define SET_GLOBAL_SHELL_WINDOWS   0x01  /* set both main shell and listview windows */
#define SET_GLOBAL_PROGMAN_WINDOW  0x02
#define SET_GLOBAL_TASKMAN_WINDOW  0x04
3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072

/* Adjust the privileges held by a token */
@REQ(adjust_token_privileges)
    obj_handle_t  handle; /* handle to the token */
    int           disable_all; /* disable all privileges? */
    int           get_modified_state; /* get modified privileges? */
    VARARG(privileges,LUID_AND_ATTRIBUTES); /* privileges to enable/disable/remove */
@REPLY
    unsigned int  len; /* total length in bytes required to store token privileges */
    VARARG(privileges,LUID_AND_ATTRIBUTES); /* modified privileges */
@END

/* Retrieves the set of privileges held by or available to a token */
@REQ(get_token_privileges)
    obj_handle_t  handle; /* handle to the token */
@REPLY
    unsigned int  len; /* total length in bytes required to store token privileges */
    VARARG(privileges,LUID_AND_ATTRIBUTES); /* privileges held by or available to a token */
@END

3073 3074 3075 3076 3077 3078 3079 3080 3081 3082
/* Check the token has the required privileges */
@REQ(check_token_privileges)
    obj_handle_t  handle; /* handle to the token */
    int           all_required; /* are all the privileges required for the check to succeed? */
    VARARG(privileges,LUID_AND_ATTRIBUTES); /* privileges to check */
@REPLY
    int           has_privileges; /* does the token have the required privileges? */
    VARARG(privileges,LUID_AND_ATTRIBUTES); /* privileges held by or available to a token */
@END

3083
@REQ(duplicate_token)
3084 3085 3086 3087
    obj_handle_t  handle;        /* handle to the token to duplicate */
    unsigned int  access;        /* access rights to the new token */
    unsigned int  attributes;    /* object attributes */
    int           primary;       /* is the new token to be a primary one? */
3088 3089 3090 3091
    int           impersonation_level; /* impersonation level of the new token */
@REPLY
    obj_handle_t  new_handle; /* duplicated handle */
@END
Mike McCormack's avatar
Mike McCormack committed
3092

3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106
@REQ(access_check)
    obj_handle_t    handle; /* handle to the token */
    unsigned int    desired_access; /* desired access to the object */
    unsigned int    mapping_read; /* mapping from generic read to specific rights */
    unsigned int    mapping_write; /* mapping from generic write to specific rights */
    unsigned int    mapping_execute; /* mapping from generic execute to specific rights */
    unsigned int    mapping_all; /* mapping from generic all to specific rights */
    VARARG(sd,security_descriptor); /* security descriptor to check */
@REPLY
    unsigned int    access_granted; /* access rights actually granted */
    unsigned int    access_status; /* was access granted? */
    unsigned int    privileges_len; /* length needed to store privileges */
    VARARG(privileges,LUID_AND_ATTRIBUTES); /* privileges used during access check */
@END
Mike McCormack's avatar
Mike McCormack committed
3107

3108
@REQ(get_token_sid)
3109
    obj_handle_t    handle;       /* handle to the token */
3110
    unsigned int    which_sid;    /* which SID to retrieve from the token */
3111
@REPLY
3112 3113
    data_size_t     sid_len;      /* length needed to store sid */
    VARARG(sid,SID);              /* the sid specified by which_sid from the token */
3114 3115
@END

3116 3117 3118
@REQ(get_token_groups)
    obj_handle_t    handle;       /* handle to the token */
@REPLY
3119
    data_size_t     user_len;     /* length needed to store user */
3120
    VARARG(user,token_groups);    /* groups the token's user belongs to */
3121 3122
@END

3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134
@REQ(get_token_default_dacl)
    obj_handle_t    handle;     /* handle to the token */
@REPLY
    data_size_t     acl_len;    /* length needed to store access control list */
    VARARG(acl,ACL);            /* access control list */
@END

@REQ(set_token_default_dacl)
    obj_handle_t    handle;     /* handle to the token */
    VARARG(acl,ACL);            /* default dacl to set */
@END

3135 3136 3137 3138 3139 3140
@REQ(set_security_object)
    obj_handle_t    handle;       /* handle to the object */
    unsigned int    security_info; /* which parts of security descriptor to set */
    VARARG(sd,security_descriptor); /* security descriptor to set */
@END

3141 3142 3143 3144 3145 3146 3147 3148
@REQ(get_security_object)
    obj_handle_t    handle;       /* handle to the object */
    unsigned int    security_info; /* which parts of security descriptor to get */
@REPLY
    unsigned int    sd_len;         /* buffer size needed for sd */
    VARARG(sd,security_descriptor); /* retrieved security descriptor */
@END

Mike McCormack's avatar
Mike McCormack committed
3149 3150
/* Create a mailslot */
@REQ(create_mailslot)
3151 3152
    unsigned int   access;        /* wanted access rights */
    unsigned int   attributes;    /* object attributes */
3153
    obj_handle_t   rootdir;       /* root directory */
3154
    timeout_t      read_timeout;
3155
    unsigned int   max_msgsize;
Mike McCormack's avatar
Mike McCormack committed
3156 3157 3158 3159 3160 3161 3162 3163 3164
    VARARG(name,unicode_str);     /* mailslot name */
@REPLY
    obj_handle_t   handle;        /* handle to the mailslot */
@END


/* Set mailslot information */
@REQ(set_mailslot_info)
    obj_handle_t   handle;        /* handle to the mailslot */
3165
    timeout_t      read_timeout;
3166
    unsigned int   flags;
Mike McCormack's avatar
Mike McCormack committed
3167
@REPLY
3168
    timeout_t      read_timeout;
3169
    unsigned int   max_msgsize;
Mike McCormack's avatar
Mike McCormack committed
3170 3171
@END
#define MAILSLOT_SET_READ_TIMEOUT  1
3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193


/* Create a directory object */
@REQ(create_directory)
    unsigned int   access;        /* access flags */
    unsigned int   attributes;    /* object attributes */
    obj_handle_t   rootdir;       /* root directory */
    VARARG(directory_name,unicode_str); /* Directory name */
@REPLY
    obj_handle_t   handle;        /* handle to the directory */
@END


/* Open a directory object */
@REQ(open_directory)
    unsigned int   access;        /* access flags */
    unsigned int   attributes;    /* object attributes */
    obj_handle_t   rootdir;       /* root directory */
    VARARG(directory_name,unicode_str); /* Directory name */
@REPLY
    obj_handle_t   handle;        /* handle to the directory */
@END
3194 3195


3196 3197 3198 3199 3200
/* Get a directory entry by index */
@REQ(get_directory_entry)
    obj_handle_t   handle;             /* handle to the directory */
    unsigned int   index;              /* entry index */
@REPLY
3201
    data_size_t    name_len;           /* length of the entry name in bytes */
3202 3203 3204 3205 3206
    VARARG(name,unicode_str,name_len); /* entry name */
    VARARG(type,unicode_str);          /* entry type */
@END


3207 3208 3209 3210 3211
/* Create a symbolic link object */
@REQ(create_symlink)
    unsigned int   access;        /* access flags */
    unsigned int   attributes;    /* object attributes */
    obj_handle_t   rootdir;       /* root directory */
3212
    data_size_t    name_len;      /* length of the symlink name in bytes */
3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234
    VARARG(name,unicode_str,name_len); /* symlink name */
    VARARG(target_name,unicode_str);   /* target name */
@REPLY
    obj_handle_t   handle;        /* handle to the symlink */
@END


/* Open a symbolic link object */
@REQ(open_symlink)
    unsigned int   access;        /* access flags */
    unsigned int   attributes;    /* object attributes */
    obj_handle_t   rootdir;       /* root directory */
    VARARG(name,unicode_str);     /* symlink name */
@REPLY
    obj_handle_t   handle;        /* handle to the symlink */
@END


/* Query a symbolic link object */
@REQ(query_symlink)
    obj_handle_t   handle;        /* handle to the symlink */
@REPLY
3235
    data_size_t    total;         /* total needed size for name */
3236 3237
    VARARG(target_name,unicode_str); /* target name */
@END
3238 3239 3240 3241 3242 3243 3244 3245


/* Query basic object information */
@REQ(get_object_info)
    obj_handle_t   handle;        /* handle to the object */
@REPLY
    unsigned int   access;        /* granted access mask */
    unsigned int   ref_count;     /* object ref count */
3246 3247
    data_size_t    total;         /* total needed size for name */
    VARARG(name,unicode_str);     /* object name */
3248
@END
3249

3250 3251 3252 3253 3254 3255 3256

/* Unlink a named object */
@REQ(unlink_object)
    obj_handle_t   handle;        /* handle to the object */
@END


3257 3258 3259 3260 3261 3262
/* Query the impersonation level of an impersonation token */
@REQ(get_token_impersonation_level)
    obj_handle_t   handle;        /* handle to the object */
@REPLY
    int            impersonation_level; /* impersonation level of the impersonation token */
@END
3263 3264 3265 3266 3267 3268

/* Allocate a locally-unique identifier */
@REQ(allocate_locally_unique_id)
@REPLY
    luid_t         luid;
@END
3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284


/* Create a device manager */
@REQ(create_device_manager)
    unsigned int access;          /* wanted access rights */
    unsigned int attributes;      /* object attributes */
@REPLY
    obj_handle_t handle;          /* handle to the device */
@END


/* Create a device */
@REQ(create_device)
    unsigned int access;          /* wanted access rights */
    unsigned int attributes;      /* object attributes */
    obj_handle_t rootdir;         /* root directory */
3285
    client_ptr_t user_ptr;        /* opaque ptr for use by client */
3286
    obj_handle_t manager;         /* device manager */
3287 3288 3289 3290 3291 3292 3293 3294 3295 3296
    VARARG(name,unicode_str);     /* object name */
@REPLY
    obj_handle_t handle;          /* handle to the device */
@END


/* Delete a device */
@REQ(delete_device)
    obj_handle_t handle;          /* handle to the device */
@END
3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307


/* Retrieve the next pending device ioctl request */
@REQ(get_next_device_request)
    obj_handle_t manager;         /* handle to the device manager */
    obj_handle_t prev;            /* handle to the previous ioctl */
    unsigned int status;          /* status of the previous ioctl */
    VARARG(prev_data,bytes);      /* output data of the previous ioctl */
@REPLY
    obj_handle_t next;            /* handle to the next ioctl */
    ioctl_code_t code;            /* ioctl code */
3308
    client_ptr_t user_ptr;        /* opaque ptr for the device */
3309 3310
    process_id_t client_pid;      /* pid of process calling ioctl */
    thread_id_t  client_tid;      /* tid of thread calling ioctl */
3311 3312 3313 3314
    data_size_t  in_size;         /* total needed input size */
    data_size_t  out_size;        /* needed output size */
    VARARG(next_data,bytes);      /* input data of the next ioctl */
@END
3315 3316 3317 3318 3319 3320 3321


/* Make the current process a system process */
@REQ(make_process_system)
@REPLY
    obj_handle_t event;           /* event signaled when all user processes have exited */
@END
3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334


/* Get detailed fixed-size information about a token */
@REQ(get_token_statistics)
    obj_handle_t   handle;        /* handle to the object */
@REPLY
    luid_t         token_id;      /* locally-unique identifier of the token */
    luid_t         modified_id;   /* locally-unique identifier of the modified version of the token */
    int            primary;       /* is the token primary or impersonation? */
    int            impersonation_level; /* level of impersonation */
    int            group_count;   /* the number of groups the token is a member of */
    int            privilege_count; /* the number of privileges the token has */
@END
3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362


/* Create I/O completion port */
@REQ(create_completion)
    unsigned int access;          /* desired access to a port */
    unsigned int attributes;      /* object attributes */
    unsigned int concurrent;      /* max number of concurrent active threads */
    obj_handle_t rootdir;         /* root directory */
    VARARG(filename,string);      /* port name */
@REPLY
    obj_handle_t handle;          /* port handle */
@END


/* Open I/O completion port */
@REQ(open_completion)
    unsigned int access;          /* desired access to a port */
    unsigned int attributes;      /* object attributes */
    obj_handle_t rootdir;         /* root directory */
    VARARG(filename,string);      /* port name */
@REPLY
    obj_handle_t handle;          /* port handle */
@END


/* add completion to completion port */
@REQ(add_completion)
    obj_handle_t  handle;         /* port handle */
3363 3364
    apc_param_t   ckey;           /* completion key */
    apc_param_t   cvalue;         /* completion value */
3365
    apc_param_t   information;    /* IO_STATUS_BLOCK Information */
3366 3367 3368 3369 3370 3371 3372 3373
    unsigned int  status;         /* completion result */
@END


/* get completion from completion port queue */
@REQ(remove_completion)
    obj_handle_t handle;          /* port handle */
@REPLY
3374 3375
    apc_param_t   ckey;           /* completion key */
    apc_param_t   cvalue;         /* completion value */
3376
    apc_param_t   information;    /* IO_STATUS_BLOCK Information */
3377 3378 3379 3380 3381 3382 3383 3384 3385 3386
    unsigned int  status;         /* completion result */
@END


/* get completion queue depth */
@REQ(query_completion)
    obj_handle_t  handle;         /* port handle */
@REPLY
    unsigned int  depth;          /* completion queue depth */
@END
3387 3388 3389 3390 3391


/* associate object with completion port */
@REQ(set_completion_info)
    obj_handle_t  handle;         /* object handle */
3392
    apc_param_t   ckey;           /* completion key */
3393
    obj_handle_t  chandle;        /* port handle */
3394
@END
3395 3396 3397 3398 3399


/* check for associated completion and push msg */
@REQ(add_fd_completion)
    obj_handle_t   handle;        /* async' object */
3400
    apc_param_t    cvalue;        /* completion value */
3401
    apc_param_t    information;   /* IO_STATUS_BLOCK Information */
3402 3403
    unsigned int   status;        /* completion status */
@END
3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422


/* Retrieve layered info for a window */
@REQ(get_window_layered_info)
    user_handle_t  handle;        /* handle to the window */
@REPLY
    unsigned int   color_key;     /* color key */
    unsigned int   alpha;         /* alpha (0..255) */
    unsigned int   flags;         /* LWA_* flags */
@END


/* Set layered info for a window */
@REQ(set_window_layered_info)
    user_handle_t  handle;        /* handle to the window */
    unsigned int   color_key;     /* color key */
    unsigned int   alpha;         /* alpha (0..255) */
    unsigned int   flags;         /* LWA_* flags */
@END
3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435


/* Allocate an arbitrary user handle */
@REQ(alloc_user_handle)
@REPLY
    user_handle_t  handle;        /* allocated handle */
@END


/* Free an arbitrary user handle */
@REQ(free_user_handle)
    user_handle_t  handle;        /* handle to free*/
@END
3436 3437 3438 3439 3440 3441 3442


/* Set/get the current cursor */
@REQ(set_cursor)
    unsigned int   flags;         /* flags for fields to set (see below) */
    user_handle_t  handle;        /* handle to the cursor */
    int            show_count;    /* show count increment/decrement */
3443 3444
    int            x;             /* cursor position */
    int            y;
3445
    rectangle_t    clip;          /* cursor clip rectangle */
3446
    unsigned int   clip_msg;      /* message to post on cursor clip changes */
3447 3448 3449
@REPLY
    user_handle_t  prev_handle;   /* previous handle */
    int            prev_count;    /* previous show count */
3450 3451
    int            prev_x;        /* previous position */
    int            prev_y;
3452 3453
    int            new_x;         /* new position */
    int            new_y;
3454
    rectangle_t    new_clip;      /* new clip rectangle */
3455
    unsigned int   last_change;   /* time of last position change */
3456 3457 3458
@END
#define SET_CURSOR_HANDLE 0x01
#define SET_CURSOR_COUNT  0x02
3459
#define SET_CURSOR_POS    0x04
3460
#define SET_CURSOR_CLIP   0x08
3461
#define SET_CURSOR_NOCLIP 0x10
3462 3463


3464 3465 3466 3467 3468 3469
/* Modify the list of registered rawinput devices */
@REQ(update_rawinput_devices)
    VARARG(devices,rawinput_devices);
@END


3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480
/* Retrieve the suspended context of a thread */
@REQ(get_suspend_context)
@REPLY
    VARARG(context,context);   /* thread context */
@END


/* Store the suspend context of a thread */
@REQ(set_suspend_context)
    VARARG(context,context);   /* thread context */
@END