protocol.def 60.8 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 22
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23 24 25 26 27 28 29 30 31 32
 */

@HEADER  /* start of C declarations */

#include <stdlib.h>
#include <time.h>
#include "winbase.h"

struct request_header
{
33 34 35
    int          req;          /* request code */
    size_t       request_size; /* request variable part size */
    size_t       reply_size;   /* reply variable part maximum size */
36 37 38 39
};

struct reply_header
{
40 41
    unsigned int error;        /* error result */
    size_t       reply_size;   /* reply variable part size */
42 43 44 45 46 47 48 49 50
};

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

51
typedef int obj_handle_t;
52
typedef unsigned short atom_t;
53
typedef unsigned int user_handle_t;
54

55 56 57 58
#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 */


59 60 61 62 63 64 65 66
/* definitions of the event data depending on the event code */
struct debug_event_exception
{
    EXCEPTION_RECORD record;   /* exception record */
    int              first;    /* first chance exception? */
};
struct debug_event_create_thread
{
67 68 69
    obj_handle_t handle;     /* handle to the new thread */
    void        *teb;        /* thread teb (in debugged process address space) */
    void        *start;      /* thread startup routine */
70 71 72
};
struct debug_event_create_process
{
73 74 75 76 77 78 79 80 81 82
    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 */
    void        *base;       /* base of executable image */
    int          dbg_offset; /* offset of debug info in file */
    int          dbg_size;   /* size of debug info */
    void        *teb;        /* thread teb (in debugged process address space) */
    void        *start;      /* thread startup routine */
    void        *name;       /* image name (optional) */
    int          unicode;    /* is it Unicode? */
83 84 85
};
struct debug_event_exit
{
86
    int          exit_code;  /* thread or process exit code */
87 88 89
};
struct debug_event_load_dll
{
90 91 92 93 94 95
    obj_handle_t handle;     /* file handle for the dll */
    void        *base;       /* base address of the dll */
    int          dbg_offset; /* offset of debug info in file */
    int          dbg_size;   /* size of debug info */
    void        *name;       /* image name (optional) */
    int          unicode;    /* is it Unicode? */
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 135 136 137 138 139 140 141 142 143 144
};
struct debug_event_unload_dll
{
    void       *base;       /* base address of the dll */
};
struct debug_event_output_string
{
    void       *string;     /* string to display (in debugged process address space) */
    int         unicode;    /* is it Unicode? */
    int         length;     /* string length */
};
struct debug_event_rip_info
{
    int         error;      /* ??? */
    int         type;       /* ??? */
};
union debug_event_data
{
    struct debug_event_exception      exception;
    struct debug_event_create_thread  create_thread;
    struct debug_event_create_process create_process;
    struct debug_event_exit           exit;
    struct debug_event_load_dll       load_dll;
    struct debug_event_unload_dll     unload_dll;
    struct debug_event_output_string  output_string;
    struct debug_event_rip_info       rip_info;
};

/* debug event data */
typedef struct
{
    int                      code;   /* event code */
    union debug_event_data   info;   /* event information */
} debug_event_t;

/* structure used in sending an fd from client to server */
struct send_fd
{
    void  *tid;  /* thread id */
    int    fd;   /* file descriptor on client-side */
};

/* structure sent by the server on the wait fifo */
struct wake_up_reply
{
    void *cookie;    /* magic cookie that was passed in select_request */
    int   signaled;  /* wait result */
};

145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
/* structure for process startup info */
typedef struct
{
    size_t       size;         /* size of this structure */
    size_t       filename_len; /* length of filename */
    size_t       cmdline_len;  /* length of cmd line */
    size_t       desktop_len;  /* length of desktop name */
    size_t       title_len;    /* length of title */
    int          x;            /* window position */
    int          y;
    int          cx;           /* window size */
    int          cy;
    int          x_chars;      /* console size */
    int          y_chars;
    int          attribute;    /* console attributes */
    int          cmd_show;     /* main window show mode */
    unsigned int flags;        /* info flags */
    /* char filename[...]; */
    /* char cmdline[...]; */
    /* char desktop[...]; */
    /* char title[...]; */
} startup_info_t;

168 169 170 171 172
/* structure returned in the list of window properties */
typedef struct
{
    atom_t         atom;     /* property atom */
    short          string;   /* was atom a string originally? */
173
    obj_handle_t   handle;   /* handle stored in property */
174 175
} property_data_t;

176 177 178 179 180 181 182 183 184
/* structure to specify window rectangles */
typedef struct
{
    int  left;
    int  top;
    int  right;
    int  bottom;
} rectangle_t;

185 186 187 188 189 190 191
/* structure for console char/attribute info */
typedef struct
{
    WCHAR          ch;
    unsigned short attr;
} char_info_t;

192 193 194 195 196 197
/****************************************************************/
/* Request declarations */

/* Create a new process from the context of the parent */
@REQ(new_process)
    int          inherit_all;  /* inherit all handles from parent */
198
    int          use_handles;  /* use stdio handles */
199
    int          create_flags; /* creation flags */
200 201 202 203
    obj_handle_t exe_file;     /* file handle for main exe */
    obj_handle_t hstdin;       /* handle for stdin */
    obj_handle_t hstdout;      /* handle for stdout */
    obj_handle_t hstderr;      /* handle for stderr */
204
    VARARG(info,startup_info); /* startup information */
205
@REPLY
206
    obj_handle_t info;         /* new process info handle */
207 208 209 210 211
@END


/* Retrieve information about a newly started process */
@REQ(get_new_process_info)
212
    obj_handle_t info;         /* info handle returned from new_process_request */
213 214 215 216
    int          pinherit;     /* process handle inherit flag */
    int          tinherit;     /* thread handle inherit flag */
@REPLY
    void*        pid;          /* process id */
217
    obj_handle_t phandle;      /* process handle (in the current process) */
218
    void*        tid;          /* thread id */
219
    obj_handle_t thandle;      /* thread handle (in the current process) */
220
    int          success;      /* did the process start successfully? */
221 222 223 224 225 226 227 228 229 230
@END


/* Create a new thread from the context of the parent */
@REQ(new_thread)
    int          suspend;      /* new thread should be suspended on creation */
    int          inherit;      /* inherit flag */
    int          request_fd;   /* fd for request pipe */
@REPLY
    void*        tid;          /* thread id */
231
    obj_handle_t handle;       /* thread handle (in the current process) */
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247
@END


/* Signal that we are finished booting on the client side */
@REQ(boot_done)
    int          debug_level;  /* new debug level */
@END


/* Initialize a process; called from the new process context */
@REQ(init_process)
    void*        ldt_copy;     /* addr of LDT copy */
    int          ppid;         /* parent Unix pid */
@REPLY
    int          create_flags; /* creation flags */
    unsigned int server_start; /* server start time (GetTickCount) */
248
    size_t       info_size;    /* total size of startup info */
249 250 251 252
    obj_handle_t exe_file;     /* file handle for main exe */
    obj_handle_t hstdin;       /* handle for stdin */
    obj_handle_t hstdout;      /* handle for stdout */
    obj_handle_t hstderr;      /* handle for stderr */
253 254 255 256 257 258 259
@END


/* Retrieve the new process startup info */
@REQ(get_startup_info)
@REPLY
    VARARG(info,startup_info); /* startup information */
260 261 262 263 264 265
@END


/* Signal the end of the process initialization */
@REQ(init_process_done)
    void*        module;       /* main module base address */
266
    size_t       module_size;  /* main module size */
267 268
    void*        entry;        /* process entry point */
    void*        name;         /* ptr to ptr to name (in process addr space) */
269
    obj_handle_t exe_file;     /* file handle for main exe */
270
    int          gui;          /* is it a GUI process? */
271
    VARARG(filename,string);   /* file name of main exe */
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293
@REPLY
    int          debugged;     /* being debugged? */
@END


/* Initialize a thread; called from the child after fork()/clone() */
@REQ(init_thread)
    int          unix_pid;     /* Unix pid of new thread */
    void*        teb;          /* TEB of new thread (in thread address space) */
    void*        entry;        /* thread entry point (in thread address space) */
    int          reply_fd;     /* fd for reply pipe */
    int          wait_fd;      /* fd for blocking calls pipe */
@REPLY
    void*        pid;          /* process id of the new thread's process */
    void*        tid;          /* thread id of the new thread */
    int          boot;         /* is this the boot thread? */
    int          version;      /* protocol version */
@END


/* Terminate a process */
@REQ(terminate_process)
294
    obj_handle_t handle;       /* process handle to terminate */
295 296 297 298 299 300 301 302
    int          exit_code;    /* process exit code */
@REPLY
    int          self;         /* suicide? */
@END


/* Terminate a thread */
@REQ(terminate_thread)
303
    obj_handle_t handle;       /* thread handle to terminate */
304 305 306 307 308 309 310 311 312
    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)
313
    obj_handle_t handle;           /* process handle */
314 315 316 317 318 319 320 321 322 323 324 325
@REPLY
    void*        pid;              /* server process id */
    int          debugged;         /* debugged? */
    int          exit_code;        /* process exit code */
    int          priority;         /* priority class */
    int          process_affinity; /* process affinity mask */
    int          system_affinity;  /* system affinity mask */
@END


/* Set a process informations */
@REQ(set_process_info)
326
    obj_handle_t handle;       /* process handle */
327 328 329 330 331 332 333 334 335 336
    int          mask;         /* setting mask (see below) */
    int          priority;     /* priority class */
    int          affinity;     /* affinity mask */
@END
#define SET_PROCESS_INFO_PRIORITY 0x01
#define SET_PROCESS_INFO_AFFINITY 0x02


/* Retrieve information about a thread */
@REQ(get_thread_info)
337
    obj_handle_t handle;       /* thread handle */
338 339 340 341 342 343 344 345 346 347 348
    void*        tid_in;       /* thread id (optional) */
@REPLY
    void*        tid;          /* server thread id */
    void*        teb;          /* thread teb pointer */
    int          exit_code;    /* thread exit code */
    int          priority;     /* thread priority level */
@END


/* Set a thread informations */
@REQ(set_thread_info)
349
    obj_handle_t handle;       /* thread handle */
350 351 352 353 354 355 356 357 358 359
    int          mask;         /* setting mask (see below) */
    int          priority;     /* priority class */
    int          affinity;     /* affinity mask */
@END
#define SET_THREAD_INFO_PRIORITY 0x01
#define SET_THREAD_INFO_AFFINITY 0x02


/* Suspend a thread */
@REQ(suspend_thread)
360
    obj_handle_t handle;       /* thread handle */
361 362 363 364 365 366 367
@REPLY
    int          count;        /* new suspend count */
@END


/* Resume a thread */
@REQ(resume_thread)
368
    obj_handle_t handle;       /* thread handle */
369 370 371 372 373 374 375
@REPLY
    int          count;        /* new suspend count */
@END


/* Notify the server that a dll has been loaded */
@REQ(load_dll)
376
    obj_handle_t handle;       /* file handle */
377
    void*        base;         /* base address */
378
    size_t       size;         /* dll size */
379 380 381
    int          dbg_offset;   /* debug info offset */
    int          dbg_size;     /* debug info size */
    void*        name;         /* ptr to ptr to name (in process addr space) */
382
    VARARG(filename,string);   /* file name of dll */
383 384 385 386 387 388 389 390 391 392 393
@END


/* Notify the server that a dll is being unloaded */
@REQ(unload_dll)
    void*        base;         /* base address */
@END


/* Queue an APC for a thread */
@REQ(queue_apc)
394
    obj_handle_t handle;       /* thread handle */
395 396 397 398 399 400 401 402 403 404 405 406 407 408
    int          user;         /* user or system apc? */
    void*        func;         /* function to call */
    void*        param;        /* param for function to call */
@END


/* Get next APC to call */
@REQ(get_apc)
    int          alertable;    /* is thread alertable? */
@REPLY
    void*        func;         /* function to call */
    int          type;         /* function type */
    VARARG(args,ptrs);         /* function arguments */
@END
409
enum apc_type { APC_NONE, APC_USER, APC_TIMER, APC_ASYNC, APC_ASYNC_IO };
410 411 412 413


/* Close a handle for the current process */
@REQ(close_handle)
414
    obj_handle_t handle;       /* handle to close */
415 416 417 418 419 420 421
@REPLY
    int          fd;           /* associated fd to close */
@END


/* Set a handle information */
@REQ(set_handle_info)
422
    obj_handle_t handle;       /* handle we are interested in */
423 424 425 426 427 428 429 430 431 432 433
    int          flags;        /* new handle flags */
    int          mask;         /* mask for flags to set */
    int          fd;           /* file descriptor or -1 */
@REPLY
    int          old_flags;    /* old flag value */
    int          cur_fd;       /* current file descriptor */
@END


/* Duplicate a handle */
@REQ(dup_handle)
434 435 436
    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 */
437 438 439 440
    unsigned int access;       /* wanted access rights */
    int          inherit;      /* inherit flag */
    int          options;      /* duplicate options (see below) */
@REPLY
441
    obj_handle_t handle;       /* duplicated handle in dst process */
442 443 444 445 446 447 448 449 450 451 452 453 454
    int          fd;           /* associated fd to close */
@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)
    void*        pid;          /* process id to open */
    unsigned int access;       /* wanted access rights */
    int          inherit;      /* inherit flag */
@REPLY
455
    obj_handle_t handle;       /* handle to the process */
456 457 458
@END


459 460 461 462 463 464
/* Open a handle to a thread */
@REQ(open_thread)
    void*        tid;          /* thread id to open */
    unsigned int access;       /* wanted access rights */
    int          inherit;      /* inherit flag */
@REPLY
465
    obj_handle_t handle;       /* handle to the thread */
466 467 468
@END


469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489
/* Wait for handles */
@REQ(select)
    int          flags;        /* wait flags (see below) */
    void*        cookie;       /* magic cookie to return to client */
    int          sec;          /* absolute timeout */
    int          usec;         /* absolute timeout */
    VARARG(handles,handles);   /* handles to select on */
@END
#define SELECT_ALL           1
#define SELECT_ALERTABLE     2
#define SELECT_INTERRUPTIBLE 4
#define SELECT_TIMEOUT       8


/* Create an event */
@REQ(create_event)
    int          manual_reset;  /* manual reset event */
    int          initial_state; /* initial state of the event */
    int          inherit;       /* inherit flag */
    VARARG(name,unicode_str);   /* object name */
@REPLY
490
    obj_handle_t handle;        /* handle to the event */
491 492 493 494
@END

/* Event operation */
@REQ(event_op)
495
    obj_handle_t  handle;       /* handle to event */
496 497 498 499 500 501 502 503 504 505 506
    int           op;           /* event operation (see below) */
@END
enum event_op { PULSE_EVENT, SET_EVENT, RESET_EVENT };


/* Open an event */
@REQ(open_event)
    unsigned int access;        /* wanted access rights */
    int          inherit;       /* inherit flag */
    VARARG(name,unicode_str);   /* object name */
@REPLY
507
    obj_handle_t handle;        /* handle to the event */
508 509 510 511 512 513 514 515 516
@END


/* Create a mutex */
@REQ(create_mutex)
    int          owned;         /* initially owned? */
    int          inherit;       /* inherit flag */
    VARARG(name,unicode_str);   /* object name */
@REPLY
517
    obj_handle_t handle;        /* handle to the mutex */
518 519 520 521 522
@END


/* Release a mutex */
@REQ(release_mutex)
523
    obj_handle_t handle;        /* handle to the mutex */
524 525 526 527 528 529 530 531 532
@END


/* Open a mutex */
@REQ(open_mutex)
    unsigned int access;        /* wanted access rights */
    int          inherit;       /* inherit flag */
    VARARG(name,unicode_str);   /* object name */
@REPLY
533
    obj_handle_t handle;        /* handle to the mutex */
534 535 536 537 538 539 540 541 542 543
@END


/* Create a semaphore */
@REQ(create_semaphore)
    unsigned int initial;       /* initial count */
    unsigned int max;           /* maximum count */
    int          inherit;       /* inherit flag */
    VARARG(name,unicode_str);   /* object name */
@REPLY
544
    obj_handle_t handle;        /* handle to the semaphore */
545 546 547 548 549
@END


/* Release a semaphore */
@REQ(release_semaphore)
550
    obj_handle_t handle;        /* handle to the semaphore */
551 552 553 554 555 556 557 558 559 560 561 562
    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 */
    int          inherit;       /* inherit flag */
    VARARG(name,unicode_str);   /* object name */
@REPLY
563
    obj_handle_t handle;        /* handle to the semaphore */
564 565 566 567 568 569 570 571 572 573
@END


/* Create a file */
@REQ(create_file)
    unsigned int access;        /* wanted access rights */
    int          inherit;       /* inherit flag */
    unsigned int sharing;       /* sharing flags */
    int          create;        /* file create action */
    unsigned int attrs;         /* file attributes for creation */
574
    int          drive_type;    /* type of drive the file is on */
575 576
    VARARG(filename,string);    /* file name */
@REPLY
577
    obj_handle_t handle;        /* handle to the file */
578 579 580 581 582 583
@END


/* Allocate a file handle for a Unix fd */
@REQ(alloc_file_handle)
    unsigned int access;        /* wanted access rights */
584
    int          inherit;       /* inherit flag */
585 586
    int          fd;            /* file descriptor on the client side */
@REPLY
587
    obj_handle_t handle;        /* handle to the file */
588 589 590 591 592
@END


/* Get a Unix fd to access a file */
@REQ(get_handle_fd)
593
    obj_handle_t handle;        /* handle to the file */
594 595 596
    unsigned int access;        /* wanted access rights */
@REPLY
    int          fd;            /* file descriptor */
597 598
    int          type;          /* the type of file (see below) */
    int          flags;         /* file read/write flags (see below) */
599
@END
600 601 602 603
enum fd_type
{
    FD_TYPE_INVALID,
    FD_TYPE_DEFAULT,
604
    FD_TYPE_CONSOLE,
605
    FD_TYPE_SOCKET,
606
    FD_TYPE_SMB
607
};
608 609 610 611
#define FD_FLAG_OVERLAPPED         0x01
#define FD_FLAG_TIMEOUT            0x02
#define FD_FLAG_RECV_SHUTDOWN      0x04
#define FD_FLAG_SEND_SHUTDOWN      0x08
612 613 614

/* Set a file current position */
@REQ(set_file_pointer)
615
    obj_handle_t handle;        /* handle to the file */
616 617 618 619 620 621 622 623 624 625 626
    int          low;           /* position low word */
    int          high;          /* position high word */
    int          whence;        /* whence to seek */
@REPLY
    int          new_low;       /* new position low word */
    int          new_high;      /* new position high word */
@END


/* Truncate (or extend) a file */
@REQ(truncate_file)
627
    obj_handle_t handle;        /* handle to the file */
628 629 630 631 632
@END


/* Set a file access and modification times */
@REQ(set_file_time)
633
    obj_handle_t handle;        /* handle to the file */
634 635 636 637 638 639 640
    time_t       access_time;   /* last access time */
    time_t       write_time;    /* last write time */
@END


/* Flush a file buffers */
@REQ(flush_file)
641
    obj_handle_t handle;        /* handle to the file */
642 643 644 645 646
@END


/* Get information about a file */
@REQ(get_file_info)
647
    obj_handle_t handle;        /* handle to the file */
648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663
@REPLY
    int          type;          /* file type */
    int          attr;          /* file attributes */
    time_t       access_time;   /* last access time */
    time_t       write_time;    /* last write time */
    int          size_high;     /* file size */
    int          size_low;      /* file size */
    int          links;         /* number of links */
    int          index_high;    /* unique index */
    int          index_low;     /* unique index */
    unsigned int serial;        /* volume serial number */
@END


/* Lock a region of a file */
@REQ(lock_file)
664
    obj_handle_t handle;        /* handle to the file */
665 666 667 668 669 670 671 672 673
    unsigned int offset_low;    /* offset of start of lock */
    unsigned int offset_high;   /* offset of start of lock */
    unsigned int count_low;     /* count of bytes to lock */
    unsigned int count_high;    /* count of bytes to lock */
@END


/* Unlock a region of a file */
@REQ(unlock_file)
674
    obj_handle_t handle;        /* handle to the file */
675 676 677 678 679 680 681 682 683 684 685
    unsigned int offset_low;    /* offset of start of unlock */
    unsigned int offset_high;   /* offset of start of unlock */
    unsigned int count_low;     /* count of bytes to unlock */
    unsigned int count_high;    /* count of bytes to unlock */
@END


/* Create an anonymous pipe */
@REQ(create_pipe)
    int          inherit;       /* inherit flag */
@REPLY
686 687
    obj_handle_t handle_read;   /* handle to the read-side of the pipe */
    obj_handle_t handle_write;  /* handle to the write-side of the pipe */
688 689 690 691 692 693 694 695 696 697
@END


/* Create a socket */
@REQ(create_socket)
    unsigned int access;        /* wanted access rights */
    int          inherit;       /* inherit flag */
    int          family;        /* family, see socket manpage */
    int          type;          /* type, see socket manpage */
    int          protocol;      /* protocol, see socket manpage */
698
    unsigned int flags;         /* socket flags */
699
@REPLY
700
    obj_handle_t handle;        /* handle to the new socket */
701 702 703 704 705
@END


/* Accept a socket */
@REQ(accept_socket)
706
    obj_handle_t lhandle;       /* handle to the listening socket */
707 708 709
    unsigned int access;        /* wanted access rights */
    int          inherit;       /* inherit flag */
@REPLY
710
    obj_handle_t handle;        /* handle to the new socket */
711 712 713 714 715
@END


/* Set socket event parameters */
@REQ(set_socket_event)
716
    obj_handle_t  handle;        /* handle to the socket */
717
    unsigned int  mask;          /* event mask */
718
    obj_handle_t  event;         /* event object */
719 720
    user_handle_t window;        /* window to send the message to */
    unsigned int  msg;           /* message to send */
721 722 723 724 725
@END


/* Get socket event parameters */
@REQ(get_socket_event)
726
    obj_handle_t handle;        /* handle to the socket */
727
    int          service;       /* clear pending? */
728
    obj_handle_t c_event;       /* event to clear */
729 730 731 732 733 734 735 736 737 738
@REPLY
    unsigned int mask;          /* event mask */
    unsigned int pmask;         /* pending events */
    unsigned int state;         /* status bits */
    VARARG(errors,ints);        /* event errors */
@END


/* Reenable pending socket events */
@REQ(enable_socket_event)
739
    obj_handle_t handle;        /* handle to the socket */
740 741 742 743 744
    unsigned int mask;          /* events to re-enable */
    unsigned int sstate;        /* status bits to set */
    unsigned int cstate;        /* status bits to clear */
@END

745
@REQ(set_socket_deferred)
746 747
    obj_handle_t handle;        /* handle to the socket */
    obj_handle_t deferred;      /* handle to the socket for which accept() is deferred */
748
@END
749

750
/* Allocate a console (only used by a console renderer) */
751 752 753
@REQ(alloc_console)
    unsigned int access;        /* wanted access rights */
    int          inherit;       /* inherit flag */
754
    void*        pid;           /* pid of process which shall be attached to the console */
755
@REPLY
756 757
    obj_handle_t handle_in;     /* handle to console input */
    obj_handle_t event;         /* handle to renderer events change notification */
758 759 760 761 762 763 764 765
@END


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


766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811
#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)
812
    obj_handle_t handle;        /* handle to console input events */
813 814 815 816 817
@REPLY
    VARARG(data,bytes);         /* the various console_renderer_events */
@END


818 819
/* Open a handle to the process console */
@REQ(open_console)
820 821
    int          from;          /* 0 (resp 1) input (resp output) of current process console */
                                /* otherwise console_in handle to get active screen buffer? */
822 823
    unsigned int access;        /* wanted access rights */
    int          inherit;       /* inherit flag */
824
    int          share;         /* share mask (only for output handles) */
825
@REPLY
826
    obj_handle_t handle;        /* handle to the console */
827 828 829 830 831
@END


/* Get a console mode (input or output) */
@REQ(get_console_mode)
832
    obj_handle_t handle;        /* handle to the console */
833 834 835 836 837 838 839
@REPLY
    int          mode;          /* console mode */
@END


/* Set a console mode (input or output) */
@REQ(set_console_mode)
840
    obj_handle_t handle;        /* handle to the console */
841 842 843 844
    int          mode;          /* console mode */
@END


845 846
/* Set info about a console (input only) */
@REQ(set_console_input_info)
847
    obj_handle_t handle;        /* handle to console input, or 0 for process' console */
848
    int          mask;          /* setting mask (see below) */
849
    obj_handle_t active_sb;     /* active screen buffer */
850 851 852 853 854 855 856 857 858 859 860 861
    int          history_mode;  /* whether we duplicate lines in history */
    int          history_size;  /* number of lines in history */
    VARARG(title,unicode_str);  /* console title */
@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


/* Get info about a console (input only) */
@REQ(get_console_input_info)
862
    obj_handle_t handle;        /* handle to console input, or 0 for process' console */
863 864 865 866 867 868 869 870 871 872
@REPLY
    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 */
    VARARG(title,unicode_str);  /* console title */
@END


/* appends a string to console's history */
@REQ(append_console_input_history)
873
    obj_handle_t handle;        /* handle to console input, or 0 for process' console */
874 875 876 877 878 879
    VARARG(line,unicode_str);   /* line to add */
@END


/* appends a string to console's history */
@REQ(get_console_input_history)
880
    obj_handle_t handle;        /* handle to console input, or 0 for process' console */
881 882
    int          index;         /* index to get line from */
@REPLY
883
    int          total;         /* total length of line in Unicode chars */
884 885 886 887 888 889
    VARARG(line,unicode_str);   /* line to add */
@END


/* creates a new screen buffer on process' console */
@REQ(create_console_output)
890
    obj_handle_t handle_in;     /* handle to console input, or 0 for process' console */
891 892 893 894
    int          access;        /* wanted access rights */
    int          share;         /* sharing credentials */
    int          inherit;       /* inherit flag */
@REPLY
895
    obj_handle_t handle_out;    /* handle to the screen buffer */
896 897 898
@END


899
/* Set info about a console (output only) */
900
@REQ(set_console_output_info)
901
    obj_handle_t handle;        /* handle to the console */
902
    int          mask;          /* setting mask (see below) */
903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923
    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 */
    short int    win_top;       /* the rect area is expressed withing the */
    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

924 925

/* Get info about a console (output only) */
926
@REQ(get_console_output_info)
927
    obj_handle_t handle;        /* handle to the console */
928
@REPLY
929 930 931 932 933 934 935 936 937 938 939 940 941
    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 */
    short int    win_top;       /* the rect area is expressed withing the */
    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;
942 943 944 945
@END

/* Add input records to a console input queue */
@REQ(write_console_input)
946
    obj_handle_t handle;        /* handle to the console input */
947 948 949 950 951
    VARARG(rec,input_records);  /* input records */
@REPLY
    int          written;       /* number of records written */
@END

952

953 954
/* Fetch input records from a console input queue */
@REQ(read_console_input)
955
    obj_handle_t handle;        /* handle to the console input */
956 957 958 959 960 961 962
    int          flush;         /* flush the retrieved records from the queue? */
@REPLY
    int          read;          /* number of records read */
    VARARG(rec,input_records);  /* input records */
@END


963 964
/* write data (chars and/or attributes) in a screen buffer */
@REQ(write_console_output)
965
    obj_handle_t handle;        /* handle to the console output */
966 967 968 969
    int          x;             /* position where to start writing */
    int          y;
    int          mode;          /* char info (see below) */
    int          wrap;          /* wrap around at end of line? */
970 971
    VARARG(data,bytes);         /* info to write */
@REPLY
972 973 974
    int          written;       /* number of char infos actually written */
    int          width;         /* width of screen buffer */
    int          height;        /* height of screen buffer */
975
@END
976 977 978 979 980 981 982
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 */
};
983 984


985 986
/* fill a screen buffer with constant data (chars and/or attributes) */
@REQ(fill_console_output)
987
    obj_handle_t handle;        /* handle to the console output */
988 989 990 991 992 993 994 995 996 997 998 999
    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 */
1000
@REQ(read_console_output)
1001
    obj_handle_t handle;        /* handle to the console output */
1002 1003 1004 1005
    int          x;             /* position (x,y) where to start reading */
    int          y;
    int          mode;          /* char info mode */
    int          wrap;          /* wrap around at end of line? */
1006
@REPLY
1007 1008
    int          width;         /* width of screen buffer */
    int          height;        /* height of screen buffer */
1009 1010 1011
    VARARG(data,bytes);
@END

1012

1013 1014
/* move a rect (of data) in screen buffer content */
@REQ(move_console_output)
1015
    obj_handle_t handle;        /* handle to the console output */
1016 1017 1018 1019 1020 1021 1022 1023 1024
    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


1025 1026 1027 1028 1029 1030 1031
/* Sends a signal to a process group */
@REQ(send_console_signal)
    int          signal;        /* the signal to send */
    void*        group_id;      /* the group to send the signal to */
@END


1032 1033 1034 1035 1036
/* Create a change notification */
@REQ(create_change_notification)
    int          subtree;       /* watch all the subtree */
    int          filter;        /* notification filter */
@REPLY
1037
    obj_handle_t handle;        /* handle to the change notification */
1038 1039 1040 1041 1042 1043 1044 1045 1046
@END


/* Create a file mapping */
@REQ(create_mapping)
    int          size_high;     /* mapping size */
    int          size_low;      /* mapping size */
    int          protect;       /* protection flags (see below) */
    int          inherit;       /* inherit flag */
1047
    obj_handle_t file_handle;   /* file handle */
1048 1049
    VARARG(name,unicode_str);   /* object name */
@REPLY
1050
    obj_handle_t handle;        /* handle to the mapping */
1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068
@END
/* protection flags */
#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
#define VPROT_IMAGE      0x80


/* Open a mapping */
@REQ(open_mapping)
    unsigned int access;        /* wanted access rights */
    int          inherit;       /* inherit flag */
    VARARG(name,unicode_str);   /* object name */
@REPLY
1069
    obj_handle_t handle;        /* handle to the mapping */
1070 1071 1072 1073 1074
@END


/* Get information about a file mapping */
@REQ(get_mapping_info)
1075
    obj_handle_t handle;        /* handle to the mapping */
1076 1077 1078 1079 1080 1081
@REPLY
    int          size_high;     /* mapping size */
    int          size_low;      /* mapping size */
    int          protect;       /* protection flags */
    int          header_size;   /* header size (for VPROT_IMAGE mapping) */
    void*        base;          /* default base addr (for VPROT_IMAGE mapping) */
1082
    obj_handle_t shared_file;   /* shared mapping file handle */
1083
    int          shared_size;   /* shared mapping size */
1084
    int          drive_type;    /* type of drive the file is on */
1085 1086 1087 1088 1089 1090 1091 1092 1093
@END


/* Create a device */
@REQ(create_device)
    unsigned int access;        /* wanted access rights */
    int          inherit;       /* inherit flag */
    int          id;            /* client private id */
@REPLY
1094
    obj_handle_t handle;        /* handle to the device */
1095 1096 1097 1098 1099 1100 1101 1102 1103
@END


/* Create a snapshot */
@REQ(create_snapshot)
    int          inherit;       /* inherit flag */
    int          flags;         /* snapshot flags (TH32CS_*) */
    void*        pid;           /* process id */
@REPLY
1104
    obj_handle_t handle;        /* handle to the snapshot */
1105 1106 1107 1108 1109
@END


/* Get the next process from a snapshot */
@REQ(next_process)
1110
    obj_handle_t handle;        /* handle to the snapshot */
1111 1112 1113 1114
    int          reset;         /* reset snapshot position? */
@REPLY
    int          count;         /* process usage count */
    void*        pid;           /* process id */
1115 1116 1117
    void*        ppid;          /* parent process id */
    void*        heap;          /* heap base */
    void*        module;        /* main module */
1118 1119
    int          threads;       /* number of threads */
    int          priority;      /* process priority */
1120
    VARARG(filename,string);    /* file name of main exe */
1121 1122 1123 1124 1125
@END


/* Get the next thread from a snapshot */
@REQ(next_thread)
1126
    obj_handle_t handle;        /* handle to the snapshot */
1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138
    int          reset;         /* reset snapshot position? */
@REPLY
    int          count;         /* thread usage count */
    void*        pid;           /* process id */
    void*        tid;           /* thread id */
    int          base_pri;      /* base priority */
    int          delta_pri;     /* delta priority */
@END


/* Get the next module from a snapshot */
@REQ(next_module)
1139
    obj_handle_t handle;        /* handle to the snapshot */
1140 1141 1142 1143
    int          reset;         /* reset snapshot position? */
@REPLY
    void*        pid;           /* process id */
    void*        base;          /* module base address */
1144 1145
    size_t       size;          /* module size */
    VARARG(filename,string);    /* file name of module */
1146 1147 1148 1149 1150 1151 1152 1153 1154
@END


/* Wait for a debug event */
@REQ(wait_debug_event)
    int           get_handle;  /* should we alloc a handle for waiting? */
@REPLY
    void*         pid;         /* process id */
    void*         tid;         /* thread id */
1155
    obj_handle_t  wait;        /* wait handle if no event ready */
1156 1157 1158 1159 1160 1161 1162 1163 1164
    VARARG(event,debug_event); /* debug event data */
@END


/* Queue an exception event */
@REQ(queue_exception_event)
    int              first;    /* first chance exception? */
    VARARG(record,exc_event);  /* thread context followed by exception record */
@REPLY
1165
    obj_handle_t     handle;   /* handle to the queued event */
1166 1167 1168 1169 1170
@END


/* Retrieve the status of an exception event */
@REQ(get_exception_status)
1171
    obj_handle_t     handle;   /* handle to the queued event */
1172
@REPLY
1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193
    int              status;   /* event continuation status */
    VARARG(context,context);   /* modified thread context */
@END


/* Send an output string to the debugger */
@REQ(output_debug_string)
    void*         string;      /* string to display (in debugged process address space) */
    int           unicode;     /* is it Unicode? */
    int           length;      /* string length */
@END


/* Continue a debug event */
@REQ(continue_debug_event)
    void*        pid;          /* process id to continue */
    void*        tid;          /* thread id to continue */
    int          status;       /* continuation status */
@END


1194
/* Start/stop debugging an existing process */
1195 1196
@REQ(debug_process)
    void*        pid;          /* id of the process to debug */
1197 1198 1199 1200
    int          attach;       /* 1=attaching / 0=detaching from the process */
@END


1201 1202
/* Simulate a breakpoint in a process */
@REQ(debug_break)
1203
    obj_handle_t handle;       /* process handle */
1204 1205 1206 1207 1208
@REPLY
    int          self;         /* was it the caller itself? */
@END


1209 1210 1211
/* Set debugger kill on exit flag */
@REQ(set_debugger_kill_on_exit)
    int          kill_on_exit;  /* 0=detach/1=kill debuggee when debugger dies */
1212 1213 1214 1215 1216
@END


/* Read data from a process address space */
@REQ(read_process_memory)
1217
    obj_handle_t handle;       /* process handle */
1218
    void*        addr;         /* addr to read from */
1219 1220 1221 1222 1223 1224 1225
@REPLY
    VARARG(data,bytes);        /* result data */
@END


/* Write data to a process address space */
@REQ(write_process_memory)
1226
    obj_handle_t handle;       /* process handle */
1227 1228 1229
    void*        addr;         /* addr to write to (must be int-aligned) */
    unsigned int first_mask;   /* mask for first word */
    unsigned int last_mask;    /* mask for last word */
1230
    VARARG(data,bytes);        /* data to write */
1231 1232 1233 1234 1235
@END


/* Create a registry key */
@REQ(create_key)
1236
    obj_handle_t parent;       /* handle to the parent key */
1237 1238 1239
    unsigned int access;       /* desired access rights */
    unsigned int options;      /* creation options */
    time_t       modif;        /* last modification time */
1240 1241 1242
    size_t       namelen;      /* length of key name in bytes */
    VARARG(name,unicode_str,namelen);  /* key name */
    VARARG(class,unicode_str);         /* class name */
1243
@REPLY
1244
    obj_handle_t hkey;         /* handle to the created key */
1245 1246 1247 1248 1249
    int          created;      /* has it been newly created? */
@END

/* Open a registry key */
@REQ(open_key)
1250
    obj_handle_t parent;       /* handle to the parent key */
1251 1252 1253
    unsigned int access;       /* desired access rights */
    VARARG(name,unicode_str);  /* key name */
@REPLY
1254
    obj_handle_t hkey;         /* handle to the open key */
1255 1256 1257 1258 1259
@END


/* Delete a registry key */
@REQ(delete_key)
1260
    obj_handle_t hkey;         /* handle to the key */
1261 1262 1263 1264 1265
@END


/* Enumerate registry subkeys */
@REQ(enum_key)
1266
    obj_handle_t hkey;         /* handle to registry key */
1267
    int          index;        /* index of subkey (or -1 for current key) */
1268
    int          info_class;   /* requested information class */
1269 1270 1271 1272 1273 1274 1275 1276
@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 */
    time_t       modif;        /* last modification time */
1277 1278 1279 1280
    size_t       total;        /* total length needed for full name and class */
    size_t       namelen;      /* length of key name in bytes */
    VARARG(name,unicode_str,namelen);  /* key name */
    VARARG(class,unicode_str);         /* class name */
1281 1282 1283 1284 1285
@END


/* Set a value of a registry key */
@REQ(set_key_value)
1286
    obj_handle_t hkey;         /* handle to registry key */
1287
    int          type;         /* value type */
1288 1289 1290
    size_t       namelen;      /* length of value name in bytes */
    VARARG(name,unicode_str,namelen);  /* value name */
    VARARG(data,bytes);                /* value data */
1291 1292 1293 1294 1295
@END


/* Retrieve the value of a registry key */
@REQ(get_key_value)
1296
    obj_handle_t hkey;         /* handle to registry key */
1297
    VARARG(name,unicode_str);  /* value name */
1298 1299
@REPLY
    int          type;         /* value type */
1300
    size_t       total;        /* total length needed for data */
1301 1302 1303 1304 1305 1306
    VARARG(data,bytes);        /* value data */
@END


/* Enumerate a value of a registry key */
@REQ(enum_key_value)
1307
    obj_handle_t hkey;         /* handle to registry key */
1308
    int          index;        /* value index */
1309
    int          info_class;   /* requested information class */
1310 1311
@REPLY
    int          type;         /* value type */
1312 1313 1314 1315
    size_t       total;        /* total length needed for full name and data */
    size_t       namelen;      /* length of value name in bytes */
    VARARG(name,unicode_str,namelen);  /* value name */
    VARARG(data,bytes);                /* value data */
1316 1317 1318 1319 1320
@END


/* Delete a value of a registry key */
@REQ(delete_key_value)
1321
    obj_handle_t hkey;         /* handle to registry key */
1322 1323 1324 1325 1326 1327
    VARARG(name,unicode_str);  /* value name */
@END


/* Load a registry branch from a file */
@REQ(load_registry)
1328 1329
    obj_handle_t hkey;         /* root key to load to */
    obj_handle_t file;         /* file to load from */
1330 1331 1332 1333 1334 1335
    VARARG(name,unicode_str);  /* subkey name */
@END


/* Save a registry branch to a file */
@REQ(save_registry)
1336 1337
    obj_handle_t hkey;         /* key to save */
    obj_handle_t file;         /* file to save to */
1338 1339 1340 1341 1342
@END


/* Save a registry branch at server exit */
@REQ(save_registry_atexit)
1343
    obj_handle_t hkey;         /* key to save */
1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361
    VARARG(file,string);       /* file to save to */
@END


/* Set the current and saving level for the registry */
@REQ(set_registry_levels)
    int          current;      /* new current level */
    int          saving;       /* new saving level */
    int          period;       /* duration between periodic saves (milliseconds) */
@END


/* Create a waitable timer */
@REQ(create_timer)
    int          inherit;       /* inherit flag */
    int          manual;        /* manual reset */
    VARARG(name,unicode_str);   /* object name */
@REPLY
1362
    obj_handle_t handle;        /* handle to the timer */
1363 1364 1365 1366 1367 1368 1369 1370 1371
@END


/* Open a waitable timer */
@REQ(open_timer)
    unsigned int access;        /* wanted access rights */
    int          inherit;       /* inherit flag */
    VARARG(name,unicode_str);   /* object name */
@REPLY
1372
    obj_handle_t handle;        /* handle to the timer */
1373 1374 1375 1376
@END

/* Set a waitable timer */
@REQ(set_timer)
1377
    obj_handle_t handle;        /* handle to the timer */
1378 1379 1380 1381 1382 1383 1384 1385 1386
    int          sec;           /* next expiration absolute time */
    int          usec;          /* next expiration absolute time */
    int          period;        /* timer period in ms */
    void*        callback;      /* callback function */
    void*        arg;           /* callback argument */
@END

/* Cancel a waitable timer */
@REQ(cancel_timer)
1387
    obj_handle_t handle;        /* handle to the timer */
1388 1389 1390 1391 1392
@END


/* Retrieve the current context of a thread */
@REQ(get_thread_context)
1393
    obj_handle_t handle;       /* thread handle */
1394 1395 1396 1397 1398 1399 1400 1401
    unsigned int flags;        /* context flags */
@REPLY
    VARARG(context,context);   /* thread context */
@END


/* Set the current context of a thread */
@REQ(set_thread_context)
1402
    obj_handle_t handle;       /* thread handle */
1403 1404 1405 1406 1407 1408 1409
    unsigned int flags;        /* context flags */
    VARARG(context,context);   /* thread context */
@END


/* Fetch a selector entry for a thread */
@REQ(get_selector_entry)
1410
    obj_handle_t  handle;      /* thread handle */
1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423
    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)
    int           local;       /* is atom in local process table? */
    VARARG(name,unicode_str);  /* atom name */
@REPLY
1424
    atom_t        atom;        /* resulting atom */
1425 1426 1427 1428 1429
@END


/* Delete an atom */
@REQ(delete_atom)
1430
    atom_t        atom;        /* atom handle */
1431 1432 1433 1434 1435 1436 1437 1438 1439
    int           local;       /* is atom in local process table? */
@END


/* Find an atom */
@REQ(find_atom)
    int          local;        /* is atom in local process table? */
    VARARG(name,unicode_str);  /* atom name */
@REPLY
1440
    atom_t       atom;         /* atom handle */
1441 1442 1443 1444 1445
@END


/* Get an atom name */
@REQ(get_atom_name)
1446
    atom_t       atom;         /* atom handle */
1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462
    int          local;        /* is atom in local process table? */
@REPLY
    int          count;        /* atom lock count */
    VARARG(name,unicode_str);  /* atom name */
@END


/* Init the process atom table */
@REQ(init_atom_table)
    int          entries;      /* number of entries */
@END


/* Get the message queue of the current thread */
@REQ(get_msg_queue)
@REPLY
1463
    obj_handle_t handle;       /* handle to the queue */
1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488
@END


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


/* Wait for a process to start waiting on input */
@REQ(wait_input_idle)
1489
    obj_handle_t handle;       /* process handle */
1490 1491
    int          timeout;      /* timeout */
@REPLY
1492
    obj_handle_t event;        /* handle to idle event */
1493 1494 1495 1496 1497 1498
@END


/* Send a message to a thread queue */
@REQ(send_message)
    void*           id;        /* thread id */
1499
    int             type;      /* message type (see below) */
1500
    user_handle_t   win;       /* window handle */
1501 1502 1503
    unsigned int    msg;       /* message code */
    unsigned int    wparam;    /* parameters */
    unsigned int    lparam;    /* parameters */
1504 1505
    int             x;         /* x position */
    int             y;         /* y position */
1506 1507
    unsigned int    time;      /* message time */
    unsigned int    info;      /* extra info */
1508 1509
    int             timeout;   /* timeout for reply */
    VARARG(data,bytes);        /* message data for sent messages */
1510
@END
1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522

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 */
    MSG_OTHER_PROCESS,  /* sent from other process, may include vararg data, always Unicode */
    MSG_POSTED,         /* posted message (from PostMessageW), always Unicode */
    MSG_HARDWARE_RAW,   /* raw hardware message */
    MSG_HARDWARE_COOKED /* cooked hardware message */
};
1523 1524 1525 1526 1527


/* Get a message from the current queue */
@REQ(get_message)
    int             flags;     /* see below */
1528
    user_handle_t   get_win;   /* window handle to get */
1529 1530 1531 1532
    unsigned int    get_first; /* first message code to get */
    unsigned int    get_last;  /* last message code to get */
@REPLY
    int             type;      /* message type */
1533
    user_handle_t   win;       /* window handle */
1534 1535 1536
    unsigned int    msg;       /* message code */
    unsigned int    wparam;    /* parameters */
    unsigned int    lparam;    /* parameters */
1537 1538
    int             x;         /* x position */
    int             y;         /* y position */
1539 1540
    unsigned int    time;      /* message time */
    unsigned int    info;      /* extra info */
1541
    size_t          total;     /* total size of extra data */
1542
    VARARG(data,bytes);        /* message data for sent messages */
1543 1544 1545 1546 1547 1548 1549 1550 1551
@END
#define GET_MSG_REMOVE      1  /* remove the message */
#define GET_MSG_SENT_ONLY   2  /* only get sent messages */
#define GET_MSG_REMOVE_LAST 4  /* remove last message returned before checking for a new one */

/* Reply to a sent message */
@REQ(reply_message)
    unsigned int    result;    /* message result */
    int             remove;    /* should we remove the message? */
1552
    VARARG(data,bytes);        /* message data for sent messages */
1553 1554 1555 1556 1557 1558 1559 1560
@END


/* Retrieve the reply for the last message sent */
@REQ(get_message_reply)
    int             cancel;    /* cancel message if not ready? */
@REPLY
    unsigned int    result;    /* message result */
1561
    VARARG(data,bytes);        /* message data for sent messages */
1562 1563 1564 1565 1566
@END


/* Set a window timer */
@REQ(set_win_timer)
1567
    user_handle_t   win;       /* window handle */
1568 1569 1570 1571 1572 1573 1574 1575 1576
    unsigned int    msg;       /* message to post */
    unsigned int    id;        /* timer id */
    unsigned int    rate;      /* timer rate in ms */
    unsigned int    lparam;    /* message lparam (callback proc) */
@END


/* Kill a window timer */
@REQ(kill_win_timer)
1577
    user_handle_t   win;       /* window handle */
1578 1579 1580 1581 1582 1583 1584 1585 1586
    unsigned int    msg;       /* message to post */
    unsigned int    id;        /* timer id */
@END


/* Open a serial port */
@REQ(create_serial)
    unsigned int access;       /* wanted access rights */
    int          inherit;      /* inherit flag */
1587
    unsigned int attributes;   /* eg. FILE_FLAG_OVERLAPPED */
1588 1589 1590
    unsigned int sharing;      /* sharing flags */
    VARARG(name,string);       /* file name */
@REPLY
1591
    obj_handle_t handle;       /* handle to the port */
1592 1593 1594 1595 1596
@END


/* Retrieve info about a serial port */
@REQ(get_serial_info)
1597
    obj_handle_t handle;       /* handle to comm port */
1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610
@REPLY
    unsigned int readinterval;
    unsigned int readconst;
    unsigned int readmult;
    unsigned int writeconst;
    unsigned int writemult;
    unsigned int eventmask;
    unsigned int commerror;
@END


/* Set info about a serial port */
@REQ(set_serial_info)
1611
    obj_handle_t handle;       /* handle to comm port */
1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625
    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;
    unsigned int commerror;
@END
#define SERIALINFO_SET_TIMEOUTS  0x01
#define SERIALINFO_SET_MASK      0x02
#define SERIALINFO_SET_ERROR     0x04


1626
/* Create / reschedule an async I/O */
1627
@REQ(register_async)
1628
    obj_handle_t handle;  /* handle to comm port, socket or file */
1629
    int          type;
1630 1631 1632
    void*        overlapped;
    int          count;
    unsigned int status;
1633
@END
1634
#define ASYNC_TYPE_NONE  0x00
1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647
#define ASYNC_TYPE_READ  0x01
#define ASYNC_TYPE_WRITE 0x02
#define ASYNC_TYPE_WAIT  0x03


/* Create a named pipe */
@REQ(create_named_pipe)
    unsigned int   openmode;
    unsigned int   pipemode;
    unsigned int   maxinstances;
    unsigned int   outsize;
    unsigned int   insize;
    unsigned int   timeout;
1648
    VARARG(name,unicode_str);    /* pipe name */
1649
@REPLY
1650
    obj_handle_t   handle;       /* handle to the pipe */
1651 1652 1653 1654 1655 1656
@END


/* Open an existing named pipe */
@REQ(open_named_pipe)
    unsigned int   access;
1657
    VARARG(name,unicode_str);    /* pipe name */
1658
@REPLY
1659
    obj_handle_t   handle;       /* handle to the pipe */
1660 1661 1662 1663 1664
@END


/* Connect to a named pipe */
@REQ(connect_named_pipe)
1665
    obj_handle_t   handle;
1666 1667
    void*          overlapped;
    void*          func;
1668
@END
1669 1670 1671 1672 1673


/* Wait for a named pipe */
@REQ(wait_named_pipe)
    unsigned int   timeout;
1674 1675
    void*          overlapped;
    void*          func;
1676
    VARARG(name,unicode_str);    /* pipe name */
1677 1678 1679 1680 1681
@END


/* Disconnect a named pipe */
@REQ(disconnect_named_pipe)
1682
    obj_handle_t   handle;
1683
@END
1684

1685

1686
@REQ(get_named_pipe_info)
1687
    obj_handle_t   handle;
1688 1689 1690 1691 1692 1693 1694
@REPLY
    unsigned int   flags;
    unsigned int   maxinstances;
    unsigned int   outsize;
    unsigned int   insize;
@END

1695

1696 1697 1698 1699 1700 1701 1702
@REQ(create_smb)
    int            fd;
    unsigned int   tree_id;
    unsigned int   user_id;
    unsigned int   file_id;
    unsigned int   dialect;
@REPLY
1703
    obj_handle_t   handle;
1704 1705 1706 1707
@END


@REQ(get_smb_info)
1708
    obj_handle_t   handle;
1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720
    unsigned int   flags;
    unsigned int   offset;
@REPLY
    unsigned int   tree_id;
    unsigned int   user_id;
    unsigned int   dialect;
    unsigned int   file_id;
    unsigned int   offset;
@END
#define SMBINFO_SET_OFFSET    0x01


1721 1722
/* Create a window */
@REQ(create_window)
1723 1724
    user_handle_t  parent;      /* parent window */
    user_handle_t  owner;       /* owner window */
1725
    atom_t         atom;        /* class atom */
1726
@REPLY
1727
    user_handle_t  handle;      /* created window */
1728 1729 1730 1731 1732 1733 1734 1735 1736
@END


/* Link a window into the tree */
@REQ(link_window)
    user_handle_t  handle;      /* handle to the window */
    user_handle_t  parent;      /* handle to the parent */
    user_handle_t  previous;    /* previous child in Z-order */
@REPLY
1737
    user_handle_t  full_parent; /* full handle of new parent */
1738 1739 1740 1741 1742 1743 1744 1745 1746
@END


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


1747 1748 1749 1750 1751 1752 1753 1754 1755
/* 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 */
@END


1756 1757 1758 1759 1760 1761 1762
/* 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 */
    void*          pid;         /* process owning the window */
    void*          tid;         /* thread owning the window */
1763
    atom_t         atom;        /* class atom */
1764
@END
1765 1766


1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789
/* Set some information in a window */
@REQ(set_window_info)
    user_handle_t  handle;        /* handle to the window */
    unsigned int   flags;         /* flags for fields to set (see below) */
    unsigned int   style;         /* window style */
    unsigned int   ex_style;      /* window extended style */
    unsigned int   id;            /* window id */
    void*          instance;      /* creator instance */
    void*          user_data;     /* user-specific data */
@REPLY
    unsigned int   old_style;     /* old window style */
    unsigned int   old_ex_style;  /* old window extended style */
    unsigned int   old_id;        /* old window id */
    void*          old_instance;  /* old creator instance */
    void*          old_user_data; /* old user-specific data */
@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


1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801
/* 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)
    user_handle_t  parent;        /* parent window */
1802
    atom_t         atom;          /* class atom for the listed children */
1803
    void*          tid;           /* thread owning the listed children */
1804 1805
@REPLY
    int            count;         /* total count of children */
1806
    VARARG(children,user_handles); /* children handles */
1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822
@END


/* 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
1823

1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840
/* Set the window and client rectangles of a window */
@REQ(set_window_rectangles)
    user_handle_t  handle;        /* handle to the window */
    rectangle_t    window;        /* window rectangle */
    rectangle_t    client;        /* client rectangle */
@END


/* Get the window and client rectangles of a window */
@REQ(get_window_rectangles)
    user_handle_t  handle;        /* handle to the window */
@REPLY
    rectangle_t    window;        /* window rectangle */
    rectangle_t    client;        /* client rectangle */
@END


1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862
/* 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


/* Increment the window paint count */
@REQ(inc_window_paint_count)
    user_handle_t  handle;        /* handle to the window */
    int             incr;         /* increment (can be negative) */
@END


1863 1864 1865 1866 1867 1868 1869 1870 1871
/* 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 */
@END

1872 1873 1874 1875 1876 1877

/* Set a window property */
@REQ(set_window_property)
    user_handle_t  window;        /* handle to the window */
    atom_t         atom;          /* property atom (high-word set if it was a string) */
    int            string;        /* was atom a string originally? */
1878
    obj_handle_t   handle;        /* handle to store */
1879 1880 1881 1882 1883 1884 1885 1886
@END


/* Remove a window property */
@REQ(remove_window_property)
    user_handle_t  window;        /* handle to the window */
    atom_t         atom;          /* property atom */
@REPLY
1887
    obj_handle_t   handle;        /* handle stored in property */
1888 1889 1890 1891 1892 1893 1894 1895
@END


/* Get a window property */
@REQ(get_window_property)
    user_handle_t  window;        /* handle to the window */
    atom_t         atom;          /* property atom */
@REPLY
1896
    obj_handle_t   handle;        /* handle stored in property */
1897 1898 1899 1900 1901 1902 1903
@END


/* Get the list of properties of a window */
@REQ(get_window_properties)
    user_handle_t  window;        /* handle to the window */
@REPLY
1904
    int            total;         /* total number of properties */
1905 1906
    VARARG(props,properties);     /* list of properties */
@END