VirtualBox

Changeset 82526 in vbox


Ignore:
Timestamp:
Dec 9, 2019 9:48:53 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
135388
Message:

SharedClipboardSvc,Vbgl: Started looking over the host message handling, adding missing locking and fixing docs. bugref:9437

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/include/VBox/HostServices/VBoxClipboardSvc.h

    r82525 r82526  
    7373/** @} */
    7474
     75
    7576/** @name VBOX_SHCL_HOST_FN_XXX - The service functions which are callable by host.
    7677 * @note These are not sacred and can be modified at will as long as all host
     
    8687/** Run headless on the host, i.e. do not touch the host clipboard. */
    8788#define VBOX_SHCL_HOST_FN_SET_HEADLESS       3
     89
    8890/** Reports cancellation of the current operation to the guest.
    8991 * @since   6.1 - still a todo  */
     
    106108/** @} */
    107109
     110
    108111/** @name VBOX_SHCL_HOST_MSG_XXX - The host messages for the guest.
    109112 * @{
    110113 */
    111 /** Asks the client to quit / terminate. */
    112 #define VBOX_SHCL_HOST_MSG_QUIT                              1
    113 /** Reads (simple) data from the guest. */
    114 #define VBOX_SHCL_HOST_MSG_READ_DATA                         2
     114/** Returned only when the HGCM client session is closed (by different thread).
     115 *
     116 * This can require no futher host interaction has session has been closed.
     117 */
     118#define VBOX_SHCL_HOST_MSG_QUIT                             1
     119/** Request data for a specific format from the guest.
     120 *
     121 * This takes one parameter (in addition to the message number), a 32-bit
     122 * format bit (VBOX_SHCL_FMT_XXX).  The guest will respond by issuing a
     123 * VBOX_SHCL_GUEST_F_DATA_WRITE.
     124 */
     125#define VBOX_SHCL_HOST_MSG_READ_DATA                        2
    115126/** Reports available clipboard format from host to the guest.
    116127 *  Formerly known as VBOX_SHCL_HOST_MSG_REPORT_FORMATS. */
    117 #define VBOX_SHCL_HOST_MSG_FORMATS_REPORT                    3
     128#define VBOX_SHCL_HOST_MSG_FORMATS_REPORT                   3
     129/** Message PEEK or GET operation was canceled, try again.
     130 * @since   6.1.0
     131 */
     132#define VBOX_SHCL_HOST_MSG_CANCELED                         4
    118133
    119134/** Sends a transfer status to the guest side.
    120  *
    121  * @retval  VINF_SUCCESS on success.
    122  * @retval  VERR_INVALID_CLIENT_ID
    123  * @retval  VERR_WRONG_PARAMETER_COUNT
    124  * @retval  VERR_WRONG_PARAMETER_TYPE
    125  * @since   6.1
     135 * @since   6.1.?
    126136 */
    127137#define VBOX_SHCL_HOST_MSG_TRANSFER_STATUS                   50
    128138/** Reads the root list header from the guest.
    129  *
    130  * @retval  VINF_SUCCESS on success.
    131  * @retval  VERR_INVALID_CLIENT_ID
    132  * @retval  VERR_WRONG_PARAMETER_COUNT
    133  * @retval  VERR_WRONG_PARAMETER_TYPE
    134  * @since   6.1
     139 * @since   6.1.?
    135140 */
    136141#define VBOX_SHCL_HOST_MSG_TRANSFER_ROOT_LIST_HDR_READ       51
    137142/** Writes the root list header to the guest.
    138  *
    139  * @retval  VINF_SUCCESS on success.
    140  * @retval  VERR_INVALID_CLIENT_ID
    141  * @retval  VERR_WRONG_PARAMETER_COUNT
    142  * @retval  VERR_WRONG_PARAMETER_TYPE
    143  * @since   6.1
     143 * @since   6.1.?
    144144 */
    145145#define VBOX_SHCL_HOST_MSG_TRANSFER_ROOT_LIST_HDR_WRITE      52
    146146/** Reads a root list entry from the guest.
    147  *
    148  * @retval  VINF_SUCCESS on success.
    149  * @retval  VERR_INVALID_CLIENT_ID
    150  * @retval  VERR_WRONG_PARAMETER_COUNT
    151  * @retval  VERR_WRONG_PARAMETER_TYPE
    152  * @since   6.1
     147 * @since   6.1.?
    153148 */
    154149#define VBOX_SHCL_HOST_MSG_TRANSFER_ROOT_LIST_ENTRY_READ     53
    155150/** Writes a root list entry to the guest.
    156  *
    157  * @retval  VINF_SUCCESS on success.
    158  * @retval  VERR_INVALID_CLIENT_ID
    159  * @retval  VERR_WRONG_PARAMETER_COUNT
    160  * @retval  VERR_WRONG_PARAMETER_TYPE
    161  * @since   6.1
     151 * @since   6.1.?
    162152 */
    163153#define VBOX_SHCL_HOST_MSG_TRANSFER_ROOT_LIST_ENTRY_WRITE    54
    164154/** Open a transfer list on the guest side.
    165  *
    166  * @retval  VINF_SUCCESS on success.
    167  * @retval  VERR_INVALID_CLIENT_ID
    168  * @retval  VERR_WRONG_PARAMETER_COUNT
    169  * @retval  VERR_WRONG_PARAMETER_TYPE
    170  * @since   6.1
     155 * @since   6.1.?
    171156 */
    172157#define VBOX_SHCL_HOST_MSG_TRANSFER_LIST_OPEN                55
    173158/** Closes a formerly opened transfer list on the guest side.
    174  *
    175  * @retval  VINF_SUCCESS on success.
    176  * @retval  VERR_INVALID_CLIENT_ID
    177  * @retval  VERR_WRONG_PARAMETER_COUNT
    178  * @retval  VERR_WRONG_PARAMETER_TYPE
    179  * @since   6.1
     159 * @since   6.1.?
    180160 */
    181161#define VBOX_SHCL_HOST_MSG_TRANSFER_LIST_CLOSE               56
    182162/** Reads a list header from the guest.
    183  *
    184  * @retval  VINF_SUCCESS on success.
    185  * @retval  VERR_INVALID_CLIENT_ID
    186  * @retval  VERR_WRONG_PARAMETER_COUNT
    187  * @retval  VERR_WRONG_PARAMETER_TYPE
    188  * @since   6.1
     163 * @since   6.1.?
    189164 */
    190165#define VBOX_SHCL_HOST_MSG_TRANSFER_LIST_HDR_READ            57
    191166/** Writes a list header to the guest.
    192  *
    193  * @retval  VINF_SUCCESS on success.
    194  * @retval  VERR_INVALID_CLIENT_ID
    195  * @retval  VERR_WRONG_PARAMETER_COUNT
    196  * @retval  VERR_WRONG_PARAMETER_TYPE
    197  * @since   6.1
     167 * @since   6.1.?
    198168 */
    199169#define VBOX_SHCL_HOST_MSG_TRANSFER_LIST_HDR_WRITE           58
    200170/** Reads a list entry from the guest.
    201  *
    202  * @retval  VINF_SUCCESS on success.
    203  * @retval  VERR_INVALID_CLIENT_ID
    204  * @retval  VERR_WRONG_PARAMETER_COUNT
    205  * @retval  VERR_WRONG_PARAMETER_TYPE
    206  * @since   6.1
     171 * @since   6.1.?
    207172 */
    208173#define VBOX_SHCL_HOST_MSG_TRANSFER_LIST_ENTRY_READ          59
    209174/** Writes a list entry to the guest.
    210  *
    211  * @retval  VINF_SUCCESS on success.
    212  * @retval  VERR_INVALID_CLIENT_ID
    213  * @retval  VERR_WRONG_PARAMETER_COUNT
    214  * @retval  VERR_WRONG_PARAMETER_TYPE
    215  * @since   6.1
     175 * @since   6.1.?
    216176 */
    217177#define VBOX_SHCL_HOST_MSG_TRANSFER_LIST_ENTRY_WRITE         60
    218178/** Open a transfer object on the guest side.
    219  *
    220  * @retval  VINF_SUCCESS on success.
    221  * @retval  VERR_INVALID_CLIENT_ID
    222  * @retval  VERR_WRONG_PARAMETER_COUNT
    223  * @retval  VERR_WRONG_PARAMETER_TYPE
    224  * @since   6.1
     179 * @since   6.1.?
    225180 */
    226181#define VBOX_SHCL_HOST_MSG_TRANSFER_OBJ_OPEN                 61
    227182/** Closes a formerly opened transfer object on the guest side.
    228  *
    229  * @retval  VINF_SUCCESS on success.
    230  * @retval  VERR_INVALID_CLIENT_ID
    231  * @retval  VERR_WRONG_PARAMETER_COUNT
    232  * @retval  VERR_WRONG_PARAMETER_TYPE
    233  * @since   6.1
     183 * @since   6.1.?
    234184 */
    235185#define VBOX_SHCL_HOST_MSG_TRANSFER_OBJ_CLOSE                62
    236186/** Reads from an object on the guest side.
    237  *
    238  * @retval  VINF_SUCCESS on success.
    239  * @retval  VERR_INVALID_CLIENT_ID
    240  * @retval  VERR_WRONG_PARAMETER_COUNT
    241  * @retval  VERR_WRONG_PARAMETER_TYPE
    242  * @since   6.1
     187 * @since   6.1.?
    243188 */
    244189#define VBOX_SHCL_HOST_MSG_TRANSFER_OBJ_READ                 63
    245190/** Writes to an object on the guest side.
    246  *
    247  * @retval  VINF_SUCCESS on success.
    248  * @retval  VERR_INVALID_CLIENT_ID
    249  * @retval  VERR_WRONG_PARAMETER_COUNT
    250  * @retval  VERR_WRONG_PARAMETER_TYPE
    251  * @since   6.1
     191 * @since   6.1.?
    252192 */
    253193#define VBOX_SHCL_HOST_MSG_TRANSFER_OBJ_WRITE                64
    254194/** Indicates that the host has canceled a transfer.
    255  *
    256  * @retval  VINF_SUCCESS on success.
    257  * @retval  VERR_INVALID_CLIENT_ID
    258  * @retval  VERR_WRONG_PARAMETER_COUNT
    259  * @retval  VERR_WRONG_PARAMETER_TYPE
    260  * @since   6.1
     195 * @since   6.1.?
    261196 */
    262197#define VBOX_SHCL_HOST_MSG_TRANSFER_CANCEL                   65
    263198/** Indicates that the an unrecoverable error on the host occurred.
    264  *
    265  * @retval  VINF_SUCCESS on success.
    266  * @retval  VERR_INVALID_CLIENT_ID
    267  * @retval  VERR_WRONG_PARAMETER_COUNT
    268  * @retval  VERR_WRONG_PARAMETER_TYPE
    269  * @since   6.1
     199 * @since   6.1.?
    270200 */
    271201#define VBOX_SHCL_HOST_MSG_TRANSFER_ERROR                    66
    272202/** @} */
    273203
     204
    274205/** @name VBOX_SHCL_GUEST_FN_XXX - The service functions which are called by guest.
    275206 * @{
     
    278209 *
    279210 * @deprecated Replaced by VBOX_SHCL_GUEST_FN_MSG_PEEK_WAIT,
    280  *             VBOX_SHCL_GUEST_FN_MSG_GET, VBOX_SHCL_GUEST_FN_CANCEL.
    281  */
    282 #define VBOX_SHCL_GUEST_FN_GET_HOST_MSG_OLD       1
     211 *             VBOX_SHCL_GUEST_FN_MSG_GET, VBOX_SHCL_GUEST_FN_MSG_CANCEL.
     212 * @since   1.3.2
     213 */
     214#define VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT         1
    283215/** Sends a list of available formats to the host.
    284216 *
     
    299231 * @retval  VERR_NOT_SUPPORTED if all the formats are unsupported, host
    300232 *          clipboard will be empty.
    301  */
    302 #define VBOX_SHCL_GUEST_FN_REPORT_FORMATS         2
     233 * @since   1.3.2
     234 */
     235#define VBOX_SHCL_GUEST_FN_REPORT_FORMATS           2
    303236/** Reads data in specified format from the host.
    304237 *
     
    320253 * @retval  VERR_WRONG_PARAMETER_COUNT
    321254 * @retval  VERR_WRONG_PARAMETER_TYPE
    322  */
    323 #define VBOX_SHCL_GUEST_FN_DATA_READ              3
     255 * @since   1.3.2
     256 */
     257#define VBOX_SHCL_GUEST_FN_DATA_READ                3
    324258/** Writes requested data to the host.
    325259 *
     
    340274 * @retval  VERR_WRONG_PARAMETER_TYPE
    341275 * @retval  VERR_INVALID_CONTEXT if the context ID didn't match up.
    342  */
    343 #define VBOX_SHCL_GUEST_FN_DATA_WRITE             4
     276 * @since   1.3.2
     277 */
     278#define VBOX_SHCL_GUEST_FN_DATA_WRITE               4
    344279
    345280/** This is a left-over from the 6.1 dev cycle and will always fail.
     
    353288 * @since   6.1
    354289 */
    355 #define VBOX_SHCL_GUEST_FN_CONNECT                5
     290#define VBOX_SHCL_GUEST_FN_CONNECT                  5
    356291/** Report guest side feature flags and retrieve the host ones.
    357292 *
     
    364299 * @retval  VERR_WRONG_PARAMETER_COUNT
    365300 * @retval  VERR_WRONG_PARAMETER_TYPE
    366  * @since   6.1
    367  */
    368 #define VBOX_SHCL_GUEST_FN_REPORT_FEATURES        6
     301 * @since   6.1.0
     302 */
     303#define VBOX_SHCL_GUEST_FN_REPORT_FEATURES          6
    369304/** Query the host ones feature masks.
    370305 *
     
    377312 * @retval  VERR_WRONG_PARAMETER_COUNT
    378313 * @retval  VERR_WRONG_PARAMETER_TYPE
    379  * @since   6.1
    380  */
    381 #define VBOX_SHCL_GUEST_FN_QUERY_FEATURES         7
     314 * @since   6.1.0
     315 */
     316#define VBOX_SHCL_GUEST_FN_QUERY_FEATURES           7
    382317/** Peeks at the next message, returning immediately.
    383318 *
    384  * @retval  VINF_SUCCESS on success.
    385  * @retval  VERR_INVALID_CLIENT_ID
    386  * @retval  VERR_WRONG_PARAMETER_COUNT
    387  * @retval  VERR_WRONG_PARAMETER_TYPE
    388  * @since   6.1
    389  * @todo r=bird: Either s/_FN_(MSG_)/_MSG_/ or  s/_FN_(MSG_)/_FN_/, the place
    390  *       you copied these from used _MSG_ instead of _FN_ in the general prefix.
    391  */
    392 #define VBOX_SHCL_GUEST_FN_MSG_PEEK_NOWAIT        8
     319 * Returns two 32-bit parameters, first is the message ID and the second the
     320 * parameter count.  May optionally return additional 32-bit parameters with the
     321 * sizes of respective message parameters.  To distinguish buffer sizes from
     322 * integer parameters, the latter gets their sizes inverted (uint32_t is ~4U,
     323 * uint64_t is ~8U).
     324 *
     325 * Does also support the VM restore checking as in VBOX_SHCL_GUEST_FN_MSG_PEEK_WAIT
     326 * (64-bit param \# 0), see documentation there.
     327 *
     328 * @retval  VINF_SUCCESS if a message was pending and is being returned.
     329 * @retval  VERR_TRY_AGAIN if no message pending.
     330 * @retval  VERR_VM_RESTORED if first parameter is a non-zero 64-bit value that
     331 *          does not match VbglR3GetSessionId() any more.  The new value is
     332 *          returned.
     333 * @retval  VERR_INVALID_CLIENT_ID
     334 * @retval  VERR_WRONG_PARAMETER_COUNT
     335 * @retval  VERR_WRONG_PARAMETER_TYPE
     336 * @since   6.1.0
     337 */
     338#define VBOX_SHCL_GUEST_FN_MSG_PEEK_NOWAIT          8
    393339/** Peeks at the next message, waiting for one to arrive.
    394340 *
    395  * @retval  VINF_SUCCESS on success.
    396  * @retval  VERR_INVALID_CLIENT_ID
    397  * @retval  VERR_WRONG_PARAMETER_COUNT
    398  * @retval  VERR_WRONG_PARAMETER_TYPE
    399  * @since   6.1
    400  */
    401 #define VBOX_SHCL_GUEST_FN_MSG_PEEK_WAIT          9
     341 * Returns two 32-bit parameters, first is the message ID and the second the
     342 * parameter count.  May optionally return additional 32-bit parameters with the
     343 * sizes of respective message parameters.  To distinguish buffer sizes from
     344 * integer parameters, the latter gets their sizes inverted (uint32_t is ~4U,
     345 * uint64_t is ~8U).
     346 *
     347 * To facilitate VM restore checking, the first parameter can be a 64-bit
     348 * integer holding the VbglR3GetSessionId() value the guest knowns.  The
     349 * function will then check this before going to sleep and return
     350 * VERR_VM_RESTORED if it doesn't match, same thing happens when the VM is
     351 * restored.
     352 *
     353 * @retval  VINF_SUCCESS if info about an pending message is being returned.
     354 * @retval  VINF_TRY_AGAIN and message set to VBOX_SHCL_HOST_MSG_CANCELED if
     355 *          cancelled by VBOX_SHCL_GUEST_FN_MSG_CANCEL.
     356 * @retval  VERR_RESOURCE_BUSY if another thread already made a waiting call.
     357 * @retval  VERR_VM_RESTORED if first parameter is a non-zero 64-bit value that
     358 *          does not match VbglR3GetSessionId() any more.  The new value is
     359 *          returned.
     360 * @retval  VERR_INVALID_CLIENT_ID
     361 * @retval  VERR_WRONG_PARAMETER_COUNT
     362 * @retval  VERR_WRONG_PARAMETER_TYPE
     363 * @note    This replaces VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT.
     364 * @since   6.1.0
     365 */
     366#define VBOX_SHCL_GUEST_FN_MSG_PEEK_WAIT            9
    402367/** Gets the next message, returning immediately.
    403368 *
    404  * @retval  VINF_SUCCESS on success.
    405  * @retval  VERR_INVALID_CLIENT_ID
    406  * @retval  VERR_WRONG_PARAMETER_COUNT
    407  * @retval  VERR_WRONG_PARAMETER_TYPE
    408  * @since   6.1
    409  */
    410 #define VBOX_SHCL_GUEST_FN_MSG_GET                10
     369 * All parameters are specific to the message being retrieved, however if the
     370 * first one is an integer value it shall be an input parameter holding the
     371 * ID of the message being retrieved.  While it would be nice to add a separate
     372 * parameter for this purpose, this is done so because the code was liften from
     373 * Guest Controls which had backwards compatibilities to consider and we just
     374 * kept it like that.
     375 *
     376 * @retval  VINF_SUCCESS if message retrieved and removed from the pending queue.
     377 * @retval  VERR_TRY_AGAIN if no message pending.
     378 * @retval  VERR_MISMATCH if the incoming message ID does not match the pending.
     379 * @retval  VERR_BUFFER_OVERFLOW if a parmeter buffer is too small.  The buffer
     380 *          size was updated to reflect the required size.
     381 * @retval  VERR_INVALID_CLIENT_ID
     382 * @retval  VERR_WRONG_PARAMETER_COUNT
     383 * @retval  VERR_WRONG_PARAMETER_TYPE
     384 * @note    This replaces VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT.
     385 * @since   6.1.0
     386 */
     387#define VBOX_SHCL_GUEST_FN_MSG_GET                  10
     388/** Cancels pending calls for this client session.
     389 *
     390 * This should be used if a VBOX_SHCL_GUEST_FN__MSG_PEEK_WAIT or
     391 * VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT call gets interrupted on the client end,
     392 * so as to prevent being rebuffed with VERR_RESOURCE_BUSY when restarting the
     393 * call.
     394 *
     395 * @retval  VINF_SUCCESS if cancelled any calls.
     396 * @retval  VWRN_NOT_FOUND if no callers.
     397 * @retval  VERR_INVALID_CLIENT_ID
     398 * @retval  VERR_WRONG_PARAMETER_COUNT
     399 * @since   6.1.0
     400 */
     401#define VBOX_SHCL_GUEST_FN_MSG_CANCEL               26
     402
    411403/** Replies to a function from the host.
    412404 *
     
    415407 * @retval  VERR_WRONG_PARAMETER_COUNT
    416408 * @retval  VERR_WRONG_PARAMETER_TYPE
    417  * @since   6.1
     409 * @since   6.1.x
    418410 */
    419411#define VBOX_SHCL_GUEST_FN_REPLY                  11
     
    424416 * @retval  VERR_WRONG_PARAMETER_COUNT
    425417 * @retval  VERR_WRONG_PARAMETER_TYPE
    426  * @since   6.1
     418 * @since   6.1.x
    427419 */
    428420#define VBOX_SHCL_GUEST_FN_ROOT_LIST_HDR_READ     12
     
    433425 * @retval  VERR_WRONG_PARAMETER_COUNT
    434426 * @retval  VERR_WRONG_PARAMETER_TYPE
    435  * @since   6.1
     427 * @since   6.1.x
    436428 */
    437429#define VBOX_SHCL_GUEST_FN_ROOT_LIST_HDR_WRITE    13
     
    442434 * @retval  VERR_WRONG_PARAMETER_COUNT
    443435 * @retval  VERR_WRONG_PARAMETER_TYPE
    444  * @since   6.1
     436 * @since   6.1.x
    445437 */
    446438#define VBOX_SHCL_GUEST_FN_ROOT_LIST_ENTRY_READ   14
     
    451443 * @retval  VERR_WRONG_PARAMETER_COUNT
    452444 * @retval  VERR_WRONG_PARAMETER_TYPE
    453  * @since   6.1
     445 * @since   6.1.x
    454446 */
    455447#define VBOX_SHCL_GUEST_FN_ROOT_LIST_ENTRY_WRITE  15
     
    460452 * @retval  VERR_WRONG_PARAMETER_COUNT
    461453 * @retval  VERR_WRONG_PARAMETER_TYPE
    462  * @since   6.1
     454 * @since   6.1.x
    463455 */
    464456#define VBOX_SHCL_GUEST_FN_LIST_OPEN              16
     
    469461 * @retval  VERR_WRONG_PARAMETER_COUNT
    470462 * @retval  VERR_WRONG_PARAMETER_TYPE
    471  * @since   6.1
     463 * @since   6.1.x
    472464 */
    473465#define VBOX_SHCL_GUEST_FN_LIST_CLOSE             17
     
    478470 * @retval  VERR_WRONG_PARAMETER_COUNT
    479471 * @retval  VERR_WRONG_PARAMETER_TYPE
    480  * @since   6.1
     472 * @since   6.1.x
    481473 */
    482474#define VBOX_SHCL_GUEST_FN_LIST_HDR_READ          18
     
    487479 * @retval  VERR_WRONG_PARAMETER_COUNT
    488480 * @retval  VERR_WRONG_PARAMETER_TYPE
    489  * @since   6.1
     481 * @since   6.1.x
    490482 */
    491483#define VBOX_SHCL_GUEST_FN_LIST_HDR_WRITE         19
     
    496488 * @retval  VERR_WRONG_PARAMETER_COUNT
    497489 * @retval  VERR_WRONG_PARAMETER_TYPE
    498  * @since   6.1
     490 * @since   6.1.x
    499491 */
    500492#define VBOX_SHCL_GUEST_FN_LIST_ENTRY_READ        20
     
    505497 * @retval  VERR_WRONG_PARAMETER_COUNT
    506498 * @retval  VERR_WRONG_PARAMETER_TYPE
    507  * @since   6.1
     499 * @since   6.1.x
    508500 */
    509501#define VBOX_SHCL_GUEST_FN_LIST_ENTRY_WRITE       21
     
    514506 * @retval  VERR_WRONG_PARAMETER_COUNT
    515507 * @retval  VERR_WRONG_PARAMETER_TYPE
    516  * @since   6.1
     508 * @since   6.1.x
    517509 */
    518510#define VBOX_SHCL_GUEST_FN_OBJ_OPEN               22
     
    523515 * @retval  VERR_WRONG_PARAMETER_COUNT
    524516 * @retval  VERR_WRONG_PARAMETER_TYPE
    525  * @since   6.1
     517 * @since   6.1.x
    526518 */
    527519#define VBOX_SHCL_GUEST_FN_OBJ_CLOSE              23
     
    532524 * @retval  VERR_WRONG_PARAMETER_COUNT
    533525 * @retval  VERR_WRONG_PARAMETER_TYPE
    534  * @since   6.1
     526 * @since   6.1.x
    535527 */
    536528#define VBOX_SHCL_GUEST_FN_OBJ_READ               24
     
    541533 * @retval  VERR_WRONG_PARAMETER_COUNT
    542534 * @retval  VERR_WRONG_PARAMETER_TYPE
    543  * @since   6.1
     535 * @since   6.1.x
    544536 */
    545537#define VBOX_SHCL_GUEST_FN_OBJ_WRITE              25
    546 /** Reports cancellation of the current operation to the host.
    547  *
    548  * @retval  VINF_SUCCESS on success.
    549  * @retval  VERR_INVALID_CLIENT_ID
    550  * @retval  VERR_WRONG_PARAMETER_COUNT
    551  * @retval  VERR_WRONG_PARAMETER_TYPE
    552  * @since   6.1
    553  */
    554 #define VBOX_SHCL_GUEST_FN_CANCEL                 26
    555538/** Reports an error to the host.
     539 *
     540 * @todo r=bird: Smells like GUEST_MSG_SKIP
    556541 *
    557542 * @retval  VINF_SUCCESS on success.
     
    598583/** The guest can handle context IDs where applicable. */
    599584#define VBOX_SHCL_GF_0_CONTEXT_ID                 RT_BIT_64(0)
     585/** The guest can copy & paste files and directories.
     586 * @since 6.1.?  */
     587#define VBOX_SHCL_GF_0_TRANSFERS                  RT_BIT_64(1)
    600588/** Bit that must be set in the 2nd parameter, will be cleared if the host reponds
    601589 * correctly (old hosts might not). */
     
    611599 *  message handling functions. */
    612600#define VBOX_SHCL_HF_0_CONTEXT_ID                 RT_BIT_64(0)
     601/** The host can copy & paste files and directories.
     602 * @since 6.1.? */
     603#define VBOX_SHCL_HF_0_TRANSFERS                  RT_BIT_64(1)
    613604/** @} */
    614605
  • TabularUnified trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibClipboard.cpp

    r82525 r82526  
    333333
    334334    VBGL_HGCM_HDR_INIT(&Msg.hdr, idClient,
    335                        VBOX_SHCL_GUEST_FN_GET_HOST_MSG_OLD, VBOX_SHCL_CPARMS_GET_HOST_MSG_OLD);
     335                       VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, VBOX_SHCL_CPARMS_GET_HOST_MSG_OLD);
    336336
    337337    VbglHGCMParmUInt32Set(&Msg.msg, 0);
     
    515515    if (rc == VERR_INTERRUPTED)
    516516    {
    517         VBGL_HGCM_HDR_INIT(&Msg.Hdr, pCtx->idClient, VBOX_SHCL_GUEST_FN_CANCEL, 0);
     517        VBGL_HGCM_HDR_INIT(&Msg.Hdr, pCtx->idClient, VBOX_SHCL_GUEST_FN_MSG_CANCEL, 0);
    518518        int rc2 = VbglR3HGCMCall(&Msg.Hdr, sizeof(Msg.Hdr));
    519519        AssertRC(rc2);
     
    532532
    533533#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
     534
    534535/**
    535536 * Reads a root list header from the host.
     
    22582259    return rc;
    22592260}
     2261
    22602262#endif /* VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS */
    22612263
  • TabularUnified trunk/src/VBox/GuestHost/SharedClipboard/clipboard-common.cpp

    r82513 r82526  
    893893    switch (uMsg)
    894894    {
    895         RT_CASE_RET_STR(VBOX_SHCL_GUEST_FN_GET_HOST_MSG_OLD);
     895        RT_CASE_RET_STR(VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT);
    896896        RT_CASE_RET_STR(VBOX_SHCL_GUEST_FN_REPORT_FORMATS);
    897897        RT_CASE_RET_STR(VBOX_SHCL_GUEST_FN_DATA_READ);
     
    903903        RT_CASE_RET_STR(VBOX_SHCL_GUEST_FN_MSG_PEEK_WAIT);
    904904        RT_CASE_RET_STR(VBOX_SHCL_GUEST_FN_MSG_GET);
     905        RT_CASE_RET_STR(VBOX_SHCL_GUEST_FN_MSG_CANCEL);
    905906        RT_CASE_RET_STR(VBOX_SHCL_GUEST_FN_REPLY);
    906907        RT_CASE_RET_STR(VBOX_SHCL_GUEST_FN_ROOT_LIST_HDR_READ);
     
    918919        RT_CASE_RET_STR(VBOX_SHCL_GUEST_FN_OBJ_READ);
    919920        RT_CASE_RET_STR(VBOX_SHCL_GUEST_FN_OBJ_WRITE);
    920         RT_CASE_RET_STR(VBOX_SHCL_GUEST_FN_CANCEL);
    921921        RT_CASE_RET_STR(VBOX_SHCL_GUEST_FN_ERROR);
    922922    }
  • TabularUnified trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-internal.h

    r82506 r82526  
    146146    RTCList<SHCLCLIENTMSG *> queueMsg;
    147147    /** The client's own event source.
    148      *  Needed for events which are not bound to a specific transfer.
    149      * @todo r=bird: s/Events/EventSrc/ !!  */
    150     SHCLEVENTSOURCE          Events;
     148     *  Needed for events which are not bound to a specific transfer. */
     149    SHCLEVENTSOURCE          EventSrc;
    151150#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
    152151    /** Transfer contextdata. */
     
    221220void shClSvcMsgSetPeekReturn(PSHCLCLIENTMSG pMsg, PVBOXHGCMSVCPARM paDstParms, uint32_t cDstParms);
    222221int shClSvcMsgAdd(PSHCLCLIENT pClient, PSHCLCLIENTMSG pMsg, bool fAppend);
    223 int shClSvcMsgPeek(PSHCLCLIENT pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[], bool fWait);
    224 int shClSvcMsgGet(PSHCLCLIENT pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
    225222
    226223int shClSvcClientInit(PSHCLCLIENT pClient, uint32_t uClientID);
  • TabularUnified trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-transfers.cpp

    r82479 r82526  
    752752        case VBOX_SHCL_GUEST_FN_REPLY:
    753753            RT_FALL_THROUGH();
    754         case VBOX_SHCL_GUEST_FN_CANCEL:
     754        case VBOX_SHCL_GUEST_FN_MSG_CANCEL:
    755755            RT_FALL_THROUGH();
    756756        case VBOX_SHCL_GUEST_FN_ERROR:
  • TabularUnified trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-win.cpp

    r82513 r82526  
    189189    {
    190190        PSHCLEVENTPAYLOAD pPayload;
    191         rc = ShClEventWait(&pCtx->pClient->Events, uEvent, 30 * 1000, &pPayload);
     191        rc = ShClEventWait(&pCtx->pClient->EventSrc, uEvent, 30 * 1000, &pPayload);
    192192        if (RT_SUCCESS(rc))
    193193        {
     
    196196
    197197            /* Detach the payload, as the caller then will own the data. */
    198             ShClEventPayloadDetach(&pCtx->pClient->Events, uEvent);
     198            ShClEventPayloadDetach(&pCtx->pClient->EventSrc, uEvent);
    199199            /**
    200200             * @todo r=bird: The payload has already been detached,
     
    204204        }
    205205
    206         ShClEventUnregister(&pCtx->pClient->Events, uEvent);
     206        ShClEventUnregister(&pCtx->pClient->EventSrc, uEvent);
    207207    }
    208208
  • TabularUnified trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-x11.cpp

    r82480 r82526  
    194194    if (pReq)
    195195    {
    196         const SHCLEVENTID uEvent = ShClEventIDGenerate(&pClient->Events);
     196        const SHCLEVENTID uEvent = ShClEventIDGenerate(&pClient->EventSrc);
    197197
    198198        pReq->pv        = pData->pvData;
     
    201201        pReq->uEvent    = uEvent;
    202202
    203         rc = ShClEventRegister(&pClient->Events, uEvent);
     203        rc = ShClEventRegister(&pClient->EventSrc, uEvent);
    204204        if (RT_SUCCESS(rc))
    205205        {
     
    208208            {
    209209                PSHCLEVENTPAYLOAD pPayload;
    210                 rc = ShClEventWait(&pClient->Events, uEvent, 30 * 1000, &pPayload);
     210                rc = ShClEventWait(&pClient->EventSrc, uEvent, 30 * 1000, &pPayload);
    211211                if (RT_SUCCESS(rc))
    212212                {
     
    218218            }
    219219
    220             ShClEventUnregister(&pClient->Events, uEvent);
     220            ShClEventUnregister(&pClient->EventSrc, uEvent);
    221221        }
    222222    }
     
    304304        }
    305305
    306         rc2 = ShClEventSignal(&pCtx->pClient->Events, pReq->uEvent, pPayload);
     306        rc2 = ShClEventSignal(&pCtx->pClient->EventSrc, pReq->uEvent, pPayload);
    307307        AssertRC(rc2);
    308308    }
     
    356356        {
    357357            PSHCLEVENTPAYLOAD pPayload;
    358             rc = ShClEventWait(&pCtx->pClient->Events, uEvent, 30 * 1000, &pPayload);
     358            rc = ShClEventWait(&pCtx->pClient->EventSrc, uEvent, 30 * 1000, &pPayload);
    359359            if (RT_SUCCESS(rc))
    360360            {
     
    363363
    364364                /* Detach the payload, as the caller then will own the data. */
    365                 ShClEventPayloadDetach(&pCtx->pClient->Events, uEvent);
     365                ShClEventPayloadDetach(&pCtx->pClient->EventSrc, uEvent);
    366366            }
    367367
    368             ShClEventUnregister(&pCtx->pClient->Events, uEvent);
     368            ShClEventUnregister(&pCtx->pClient->EventSrc, uEvent);
    369369        }
    370370    }
     
    399399    LogFlowFuncEnter();
    400400
    401     SHCLEVENTID uEvent = ShClEventIDGenerate(&pClient->Events);
    402 
    403     int rc = ShClEventRegister(&pClient->Events, uEvent);
     401    SHCLEVENTID uEvent = ShClEventIDGenerate(&pClient->EventSrc);
     402
     403    int rc = ShClEventRegister(&pClient->EventSrc, uEvent);
    404404    if (RT_SUCCESS(rc))
    405405    {
     
    414414                /* X supplies the data asynchronously, so we need to wait for data to arrive first. */
    415415                PSHCLEVENTPAYLOAD pPayload;
    416                 rc = ShClEventWait(&pClient->Events, uEvent, 30 * 1000, &pPayload);
     416                rc = ShClEventWait(&pClient->EventSrc, uEvent, 30 * 1000, &pPayload);
    417417                if (RT_SUCCESS(rc))
    418418                {
     
    423423        }
    424424
    425         ShClEventUnregister(&pClient->Events, uEvent);
     425        ShClEventUnregister(&pClient->EventSrc, uEvent);
    426426    }
    427427
  • TabularUnified trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc.cpp

    r82525 r82526  
    5252 *
    5353 * There are currently four messages defined.  The first is
    54  * VBOX_SHCL_GUEST_FN_MSG_GET / VBOX_SHCL_GUEST_FN_GET_HOST_MSG_OLD, which waits
     54 * VBOX_SHCL_GUEST_FN_MSG_GET / VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, which waits
    5555 * for a message from the host.  If a host message is sent while the guest is
    5656 * not waiting, it will be queued until the guest requests it.  The host code
     
    7878 * Since VBox 6.1 a newer protocol (v1) has been established to also support
    7979 * file transfers. This protocol uses a (per-client) message queue instead
    80  * (see VBOX_SHCL_GUEST_FN_GET_HOST_MSG_OLD vs. VBOX_SHCL_GUEST_FN_GET_HOST_MSG).
     80 * (see VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT vs. VBOX_SHCL_GUEST_FN_GET_HOST_MSG).
    8181 *
    8282 * To distinguish the old (legacy) or new(er) protocol, the VBOX_SHCL_GUEST_FN_CONNECT
     
    295295/** Host feature mask (VBOX_SHCL_HF_0_XXX) for VBOX_SHCL_GUEST_FN_REPORT_FEATURES
    296296 * and VBOX_SHCL_GUEST_FN_QUERY_FEATURES. */
    297 static uint64_t const g_fHostFeatures0 = VBOX_SHCL_HF_0_CONTEXT_ID;
     297static uint64_t const g_fHostFeatures0 = VBOX_SHCL_HF_0_CONTEXT_ID
     298#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
     299                                       | VBOX_SHCL_HF_0_TRANSFERS
     300#endif
     301                                       ;
    298302
    299303
     
    449453
    450454/**
    451  * Sets the VBOX_SHCL_GUEST_FN_GET_HOST_MSG_OLD return parameters.
     455 * Sets the VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT return parameters.
    452456 *
    453457 * This function does the necessary translation between the legacy protocol (<= VBox 6.0) and the new protocols (>= VBox 6.1),
     
    587591    {
    588592        /* Create the client's own event source. */
    589         rc = ShClEventSourceCreate(&pClient->Events, 0 /* ID, ignored */);
     593        rc = ShClEventSourceCreate(&pClient->EventSrc, 0 /* ID, ignored */);
    590594        if (RT_SUCCESS(rc))
    591595        {
    592             LogFlowFunc(("[Client %RU32] Using event source %RU32\n", uClientID, pClient->Events.uID));
     596            LogFlowFunc(("[Client %RU32] Using event source %RU32\n", uClientID, pClient->EventSrc.uID));
    593597
    594598            /* Reset the client state. */
     
    621625
    622626    /* Make sure to send a quit message to the guest so that it can terminate gracefully. */
     627    RTCritSectEnter(&pClient->CritSect);
    623628    if (pClient->Pending.uType)
    624629    {
    625         if (pClient->Pending.cParms >= 2)
    626         {
     630        if (pClient->Pending.cParms > 1)
    627631            HGCMSvcSetU32(&pClient->Pending.paParms[0], VBOX_SHCL_HOST_MSG_QUIT);
     632        if (pClient->Pending.cParms > 2)
    628633            HGCMSvcSetU32(&pClient->Pending.paParms[1], 0);
    629         }
    630634        g_pHelpers->pfnCallComplete(pClient->Pending.hHandle, VINF_SUCCESS);
    631         pClient->Pending.uType = 0;
    632     }
    633 
    634     ShClEventSourceDestroy(&pClient->Events);
     635        pClient->Pending.uType   = 0;
     636        pClient->Pending.cParms  = 0;
     637        pClient->Pending.hHandle = NULL;
     638        pClient->Pending.paParms = NULL;
     639    }
     640    RTCritSectLeave(&pClient->CritSect);
     641
     642    ShClEventSourceDestroy(&pClient->EventSrc);
    635643
    636644    shClSvcClientStateDestroy(&pClient->State);
     
    666674
    667675    /* Reset event source. */
    668     ShClEventSourceReset(&pClient->Events);
     676    ShClEventSourceReset(&pClient->EventSrc);
    669677
    670678    /* Reset pending state. */
     
    772780 * @param   fWait       Set if we should wait for a message, clear if to return
    773781 *                      immediately.
    774  */
    775 int shClSvcMsgPeek(PSHCLCLIENT pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[],
    776                    bool fWait)
     782 *
     783 * @note    Caller takes and leave the client's critical section.
     784 */
     785static int shClSvcClientMsgPeek(PSHCLCLIENT pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[], bool fWait)
    777786{
    778787    /*
     
    851860
    852861/**
    853  * Implements VBOX_SHCL_GUEST_FN_GET_HOST_MSG_OLD.
     862 * Implements VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT.
    854863 *
    855864 * @returns VBox status code.
     
    861870 * @param   cParms      Number of parameters.
    862871 * @param   paParms     Array of parameters.
    863  */
    864 int shClSvcMsgGetOld(PSHCLCLIENT pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
     872 *
     873 * @note    Caller takes and leave the client's critical section.
     874 */
     875static int shClSvcClientMsgOldGet(PSHCLCLIENT pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
    865876{
    866877    int rc;
     
    910921            pClient->Pending.cParms  = cParms;
    911922            pClient->Pending.paParms = paParms;
    912             pClient->Pending.uType   = VBOX_SHCL_GUEST_FN_GET_HOST_MSG_OLD;
     923            pClient->Pending.uType   = VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT;
    913924
    914925            rc = VINF_HGCM_ASYNC_EXECUTE; /* The caller must not complete it. */
     
    939950 * @param   cParms       Number of parameters.
    940951 * @param   paParms      Array of parameters.
    941  */
    942 int shClSvcMsgGet(PSHCLCLIENT pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
     952 *
     953 * @note    Called from within pClient->CritSect.
     954 */
     955static int shClSvcClientMsgGet(PSHCLCLIENT pClient, VBOXHGCMCALLHANDLE hCall, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
    943956{
    944957    /*
     
    10481061
    10491062/**
     1063 * Implements VBOX_SHCL_GUEST_FN_MSG_GET.
     1064 *
     1065 * @returns VBox status code.
     1066 * @retval  VINF_SUCCESS if message retrieved and removed from the pending queue.
     1067 * @retval  VERR_TRY_AGAIN if no message pending.
     1068 * @retval  VERR_MISMATCH if the incoming message ID does not match the pending.
     1069 * @retval  VINF_HGCM_ASYNC_EXECUTE if message was completed already.
     1070 *
     1071 * @param   pClient      The client state.
     1072 * @param   cParms       Number of parameters.
     1073 *
     1074 * @note    Called from within pClient->CritSect.
     1075 */
     1076static int shClSvcClientMsgCancel(PSHCLCLIENT pClient, uint32_t cParms)
     1077{
     1078    /*
     1079     * Validate the request.
     1080     */
     1081    ASSERT_GUEST_MSG_RETURN(cParms == 0, ("cParms=%u!\n", cParms), VERR_WRONG_PARAMETER_COUNT);
     1082
     1083    /*
     1084     * Execute.
     1085     */
     1086    if (pClient->Pending.uType != 0)
     1087    {
     1088        LogFlowFunc(("[Client %RU32] Cancelling waiting thread, isPending=%d, pendingNumParms=%RU32, m_idSession=%x\n",
     1089                     pClient->State.uClientID, pClient->Pending.uType, pClient->Pending.cParms, pClient->State.uSessionID));
     1090
     1091        /*
     1092         * The PEEK call is simple: At least two parameters, all set to zero before sleeping.
     1093         */
     1094        int rcComplete;
     1095        if (pClient->Pending.uType == VBOX_SHCL_GUEST_FN_MSG_PEEK_WAIT)
     1096        {
     1097            Assert(pClient->Pending.cParms >= 2);
     1098            HGCMSvcSetU32(&pClient->Pending.paParms[0], VBOX_SHCL_HOST_MSG_CANCELED);
     1099            rcComplete = VINF_TRY_AGAIN;
     1100        }
     1101        /*
     1102         * The MSG_OLD call is complicated, though we're
     1103         * generally here to wake up someone who is peeking and have two parameters.
     1104         * If there aren't two parameters, fail the call.
     1105         */
     1106        else
     1107        {
     1108            Assert(pClient->Pending.uType == VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT);
     1109            if (pClient->Pending.cParms > 0)
     1110                HGCMSvcSetU32(&pClient->Pending.paParms[0], VBOX_SHCL_HOST_MSG_CANCELED);
     1111            if (pClient->Pending.cParms > 1)
     1112                HGCMSvcSetU32(&pClient->Pending.paParms[1], 0);
     1113            rcComplete = pClient->Pending.cParms == 2 ? VINF_SUCCESS : VERR_TRY_AGAIN;
     1114        }
     1115
     1116        g_pHelpers->pfnCallComplete(pClient->Pending.hHandle, rcComplete);
     1117
     1118        pClient->Pending.hHandle    = NULL;
     1119        pClient->Pending.paParms    = NULL;
     1120        pClient->Pending.cParms     = 0;
     1121        pClient->Pending.uType      = 0;
     1122        return VINF_SUCCESS;
     1123    }
     1124    return VWRN_NOT_FOUND;
     1125}
     1126
     1127
     1128/**
    10501129 * Wakes up a pending client (i.e. waiting for new messages).
    10511130 *
     
    10811160                    fDonePending = true;
    10821161                }
    1083                 else if (pClient->Pending.uType == VBOX_SHCL_GUEST_FN_GET_HOST_MSG_OLD) /* Legacy, Guest Additions < 6.1. */
     1162                else if (pClient->Pending.uType == VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT) /* Legacy, Guest Additions < 6.1. */
    10841163                {
    10851164                    bool fRemove;
     
    11321211 * @param   puEvent             Event ID for waiting for new data. Optional.
    11331212 */
    1134 int ShClSvcDataReadRequest(PSHCLCLIENT pClient, PSHCLDATAREQ pDataReq,
    1135                            PSHCLEVENTID puEvent)
     1213int ShClSvcDataReadRequest(PSHCLCLIENT pClient, PSHCLDATAREQ pDataReq, PSHCLEVENTID puEvent)
    11361214{
    11371215    AssertPtrReturn(pClient,  VERR_INVALID_POINTER);
     
    11471225    if (pMsgReadData)
    11481226    {
    1149         const SHCLEVENTID uEvent = ShClEventIDGenerate(&pClient->Events);
     1227        const SHCLEVENTID uEvent = ShClEventIDGenerate(&pClient->EventSrc);
    11501228
    11511229        LogFlowFunc(("uFmt=0x%x\n", pDataReq->uFmt));
    11521230
    11531231        HGCMSvcSetU64(&pMsgReadData->paParms[0], VBOX_SHCL_CONTEXTID_MAKE(pClient->State.uSessionID,
    1154                                                                           pClient->Events.uID, uEvent));
     1232                                                                          pClient->EventSrc.uID, uEvent));
    11551233        HGCMSvcSetU32(&pMsgReadData->paParms[1], 0 /* fFlags */);
    11561234        HGCMSvcSetU32(&pMsgReadData->paParms[2], pDataReq->uFmt);
     
    11601238        if (RT_SUCCESS(rc))
    11611239        {
    1162             rc = ShClEventRegister(&pClient->Events, uEvent);
     1240            rc = ShClEventRegister(&pClient->EventSrc, uEvent);
    11631241            if (RT_SUCCESS(rc))
    11641242            {
     
    11701248                }
    11711249                else
    1172                     ShClEventUnregister(&pClient->Events, uEvent);
     1250                    ShClEventUnregister(&pClient->EventSrc, uEvent);
    11731251            }
    11741252        }
     
    11951273        /* Older Guest Additions (<= VBox 6.0) did not have any context ID handling, so we ASSUME that the last event registered
    11961274         * is the one we want to handle (as this all was a synchronous protocol anyway). */
    1197         uEvent = ShClEventGetLast(&pClient->Events);
     1275        uEvent = ShClEventGetLast(&pClient->EventSrc);
    11981276    }
    11991277    else
     
    12081286    if (RT_SUCCESS(rc))
    12091287    {
    1210         rc = ShClEventSignal(&pClient->Events, uEvent, pPayload);
     1288        rc = ShClEventSignal(&pClient->EventSrc, uEvent, pPayload);
    12111289        if (RT_FAILURE(rc))
    12121290            ShClPayloadFree(pPayload);
     
    12531331    if (pMsg)
    12541332    {
    1255         const SHCLEVENTID uEvent = ShClEventIDGenerate(&pClient->Events);
     1333        const SHCLEVENTID uEvent = ShClEventIDGenerate(&pClient->EventSrc);
    12561334
    12571335        HGCMSvcSetU64(&pMsg->paParms[0], VBOX_SHCL_CONTEXTID_MAKE(pClient->State.uSessionID,
    1258                                                                   pClient->Events.uID, uEvent));
     1336                                                                  pClient->EventSrc.uID, uEvent));
    12591337        HGCMSvcSetU32(&pMsg->paParms[1], fFormats);
    12601338        HGCMSvcSetU32(&pMsg->paParms[2], fFlags);
     
    12951373 * Handles the VBOX_SHCL_GUEST_FN_REPORT_FORMATS message from the guest.
    12961374 */
    1297 static int shClSvcGuestReportFormats(PSHCLCLIENT pClient, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
     1375static int shClSvcClientReportFormats(PSHCLCLIENT pClient, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
    12981376{
    12991377    /*
     
    13901468 * Handles the VBOX_SHCL_GUEST_FN_DATA_READ message from the guest.
    13911469 */
    1392 static int shClSvcGetDataRead(PSHCLCLIENT pClient, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
     1470static int shClSvcClientReadData(PSHCLCLIENT pClient, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
    13931471{
    13941472    LogFlowFuncEnter();
     
    15521630}
    15531631
    1554 int shClSvcGetDataWrite(PSHCLCLIENT pClient, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
     1632int shClSvcClientWriteData(PSHCLCLIENT pClient, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
    15551633{
    15561634    LogFlowFuncEnter();
     
    15911669        ASSERT_GUEST_RETURN(paParms[iParm].type == VBOX_HGCM_SVC_PARM_64BIT, VERR_WRONG_PARAMETER_TYPE);
    15921670        cmdCtx.uContextID = paParms[iParm].u.uint64;
    1593         uint64_t const idCtxExpected = VBOX_SHCL_CONTEXTID_MAKE(pClient->State.uSessionID, pClient->Events.uID,
     1671        uint64_t const idCtxExpected = VBOX_SHCL_CONTEXTID_MAKE(pClient->State.uSessionID, pClient->EventSrc.uID,
    15941672                                                                VBOX_SHCL_CONTEXTID_GET_EVENT(cmdCtx.uContextID));
    15951673        ASSERT_GUEST_MSG_RETURN(cmdCtx.uContextID == idCtxExpected,
     
    16761754 * @param   pRc                 Where to store the received error code.
    16771755 */
    1678 static int shClSvcGetError(uint32_t cParms, VBOXHGCMSVCPARM paParms[], int *pRc)
     1756static int shClSvcClientError(uint32_t cParms, VBOXHGCMSVCPARM paParms[], int *pRc)
    16791757{
    16801758    AssertPtrReturn(paParms, VERR_INVALID_PARAMETER);
     
    18231901{
    18241902    RT_NOREF(u32ClientID, pvClient, tsArrival);
    1825 
    1826     int rc = VINF_SUCCESS;
    1827 
    18281903    PSHCLCLIENT pClient = (PSHCLCLIENT)pvClient;
    18291904    AssertPtr(pClient);
    18301905
     1906#ifdef LOG_ENABLED
    18311907    LogFunc(("u32ClientID=%RU32, fn=%RU32 (%s), cParms=%RU32, paParms=%p\n",
    18321908             u32ClientID, u32Function, ShClGuestMsgToStr(u32Function), cParms, paParms));
    1833 
    1834 #ifdef LOG_ENABLED
    18351909    for (uint32_t i = 0; i < cParms; i++)
    18361910    {
     
    18381912        LogFunc(("    paParms[%d]: type %RU32 - value %RU32\n", i, paParms[i].type, paParms[i].u.uint32));
    18391913    }
    1840 #endif
    1841 
    18421914    LogFunc(("Client state: fFlags=0x%x, fGuestFeatures0=0x%x, fGuestFeatures1=0x%x\n",
    18431915             pClient->State.fFlags, pClient->State.fGuestFeatures0, pClient->State.fGuestFeatures1));
    1844 
     1916#endif
     1917
     1918    int rc;
    18451919    switch (u32Function)
    18461920    {
    1847         case VBOX_SHCL_GUEST_FN_GET_HOST_MSG_OLD:
    1848             rc = shClSvcMsgGetOld(pClient, callHandle, cParms, paParms);
     1921        case VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT:
     1922            RTCritSectEnter(&pClient->CritSect);
     1923            rc = shClSvcClientMsgOldGet(pClient, callHandle, cParms, paParms);
     1924            RTCritSectLeave(&pClient->CritSect);
    18491925            break;
    18501926
     
    18631939
    18641940        case VBOX_SHCL_GUEST_FN_MSG_PEEK_NOWAIT:
    1865             rc = shClSvcMsgPeek(pClient, callHandle, cParms, paParms, false /*fWait*/);
     1941            RTCritSectEnter(&pClient->CritSect);
     1942            rc = shClSvcClientMsgPeek(pClient, callHandle, cParms, paParms, false /*fWait*/);
     1943            RTCritSectLeave(&pClient->CritSect);
    18661944            break;
    18671945
    18681946        case VBOX_SHCL_GUEST_FN_MSG_PEEK_WAIT:
    1869             rc = shClSvcMsgPeek(pClient, callHandle, cParms, paParms, true /*fWait*/);
     1947            RTCritSectEnter(&pClient->CritSect);
     1948            rc = shClSvcClientMsgPeek(pClient, callHandle, cParms, paParms, true /*fWait*/);
     1949            RTCritSectLeave(&pClient->CritSect);
    18701950            break;
    18711951
    18721952        case VBOX_SHCL_GUEST_FN_MSG_GET:
    1873             rc = shClSvcMsgGet(pClient, callHandle, cParms, paParms);
     1953            RTCritSectEnter(&pClient->CritSect);
     1954            rc = shClSvcClientMsgGet(pClient, callHandle, cParms, paParms);
     1955            RTCritSectLeave(&pClient->CritSect);
    18741956            break;
    18751957
     1958        case VBOX_SHCL_GUEST_FN_MSG_CANCEL:
     1959            RTCritSectEnter(&pClient->CritSect);
     1960            rc = shClSvcClientMsgCancel(pClient, cParms);
     1961            RTCritSectLeave(&pClient->CritSect);
     1962            break;
     1963
    18761964        case VBOX_SHCL_GUEST_FN_REPORT_FORMATS:
    1877             rc = shClSvcGuestReportFormats(pClient, cParms, paParms);
     1965            rc = shClSvcClientReportFormats(pClient, cParms, paParms);
    18781966            break;
    18791967
    18801968        case VBOX_SHCL_GUEST_FN_DATA_READ:
    1881             rc = shClSvcGetDataRead(pClient, cParms, paParms);
     1969            rc = shClSvcClientReadData(pClient, cParms, paParms);
    18821970            break;
    18831971
    18841972        case VBOX_SHCL_GUEST_FN_DATA_WRITE:
    1885             rc = shClSvcGetDataWrite(pClient, cParms, paParms);
     1973            rc = shClSvcClientWriteData(pClient, cParms, paParms);
    18861974            break;
    18871975
    1888         case VBOX_SHCL_GUEST_FN_CANCEL:
    1889         {
    1890             LogRel2(("Shared Clipboard: Operation canceled by guest side\n"));
    1891 
    1892             /** @todo r=bird: What on earth is this?   The only user of this message
    1893              * (VBOX_SHCL_GUEST_FN_CANCEL) is VbglR3ClipboardMsgPeekWait(), where it was
    1894              * copied over from guest control.  What happens here is _nothing_ like what it
    1895              * expects to happen.  See GstCtrlService::clientMsgCancel for a reference.
    1896              */
    1897 
    1898             /* Reset client state and start over. */
    1899             shclSvcClientStateReset(&pClient->State);
    1900 #ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
    1901             shClSvcClientTransfersReset(pClient);
    1902 #endif
    1903             /** @todo Do we need to do anything else here? */
    1904             break;
    1905         }
    1906 
    19071976        case VBOX_SHCL_GUEST_FN_ERROR:
    19081977        {
    19091978            int rcGuest;
    1910             rc = shClSvcGetError(cParms,paParms, &rcGuest);
     1979            rc = shClSvcClientError(cParms,paParms, &rcGuest);
    19111980            if (RT_SUCCESS(rc))
    19121981            {
     
    19251994        {
    19261995#ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS
    1927             if (u32Function <= VBOX_SHCL_GUEST_FN_LAST)
     1996            if (   u32Function <= VBOX_SHCL_GUEST_FN_LAST
     1997                && (pClient->State.fGuestFeatures0 &  VBOX_SHCL_GF_0_CONTEXT_ID) )
    19281998            {
    19291999                if (g_fTransferMode & VBOX_SHCL_TRANSFER_MODE_ENABLED)
  • TabularUnified trunk/src/VBox/HostServices/SharedClipboard/testcase/tstClipboardServiceHost.cpp

    r82447 r82526  
    139139}
    140140
    141 /* Does testing of VBOX_SHCL_GUEST_FN_GET_HOST_MSG_OLD, needed for providing compatibility to older Guest Additions clients. */
     141/* Does testing of VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, needed for providing compatibility to older Guest Additions clients. */
    142142static void testGetHostMsgOld(void)
    143143{
     
    147147    int rc;
    148148
    149     RTTestISub("Setting up VBOX_SHCL_GUEST_FN_GET_HOST_MSG_OLD test");
     149    RTTestISub("Setting up VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT test");
    150150    rc = setupTable(&table);
    151151    RTTESTI_CHECK_MSG_RETV(RT_SUCCESS(rc), ("rc=%Rrc\n", rc));
     
    163163    call.rc = VERR_TRY_AGAIN;
    164164    table.pfnConnect(NULL, 1 /* clientId */, &g_Client, 0, 0);
    165     table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_GET_HOST_MSG_OLD, 2, parms, 0);
     165    table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, 2, parms, 0);
    166166    RTTESTI_CHECK_RC(call.rc, VERR_TRY_AGAIN);  /* This should get updated only when the guest call completes. */
    167167    testMsgAddReadData(&g_Client, VBOX_SHCL_FMT_UNICODETEXT);
     
    170170    RTTESTI_CHECK_RC_OK(call.rc);
    171171    call.rc = VERR_TRY_AGAIN;
    172     table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_GET_HOST_MSG_OLD, 2, parms, 0);
     172    table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, 2, parms, 0);
    173173    RTTESTI_CHECK_RC(call.rc, VERR_TRY_AGAIN);  /* This call should not complete yet. */
    174174
     
    179179    HGCMSvcSetU32(&parms[1], 0);
    180180    call.rc = VERR_TRY_AGAIN;
    181     table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_GET_HOST_MSG_OLD, 2, parms, 0);
     181    table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, 2, parms, 0);
    182182    RTTESTI_CHECK(parms[0].u.uint32 == VBOX_SHCL_HOST_MSG_READ_DATA);
    183183    RTTESTI_CHECK(parms[1].u.uint32 == VBOX_SHCL_FMT_HTML);
    184184    RTTESTI_CHECK_RC_OK(call.rc);
    185185    call.rc = VERR_TRY_AGAIN;
    186     table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_GET_HOST_MSG_OLD, 2, parms, 0);
     186    table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, 2, parms, 0);
    187187    RTTESTI_CHECK_RC(call.rc, VERR_TRY_AGAIN);  /* This call should not complete yet. */
    188188
     
    192192    HGCMSvcSetU32(&parms[1], 0);
    193193    call.rc = VERR_TRY_AGAIN;
    194     table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_GET_HOST_MSG_OLD, 2, parms, 0);
     194    table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, 2, parms, 0);
    195195    RTTESTI_CHECK_RC(call.rc, VERR_TRY_AGAIN);  /* This should get updated only when the guest call completes. */
    196196    testMsgAddReadData(&g_Client, VBOX_SHCL_FMT_UNICODETEXT | VBOX_SHCL_FMT_HTML);
     
    199199    RTTESTI_CHECK_RC_OK(call.rc);
    200200    call.rc = VERR_TRY_AGAIN;
    201     table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_GET_HOST_MSG_OLD, 2, parms, 0);
     201    table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, 2, parms, 0);
    202202    RTTESTI_CHECK(parms[0].u.uint32 == VBOX_SHCL_HOST_MSG_READ_DATA);
    203203    RTTESTI_CHECK(parms[1].u.uint32 == VBOX_SHCL_FMT_HTML);
    204204    RTTESTI_CHECK_RC_OK(call.rc);
    205205    call.rc = VERR_TRY_AGAIN;
    206     table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_GET_HOST_MSG_OLD, 2, parms, 0);
     206    table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, 2, parms, 0);
    207207    RTTESTI_CHECK_RC(call.rc, VERR_TRY_AGAIN);  /* This call should not complete yet. */
    208208
     
    213213    HGCMSvcSetU32(&parms[1], 0);
    214214    call.rc = VERR_TRY_AGAIN;
    215     table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_GET_HOST_MSG_OLD, 2, parms, 0);
     215    table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, 2, parms, 0);
    216216    RTTESTI_CHECK(parms[0].u.uint32 == VBOX_SHCL_HOST_MSG_READ_DATA);
    217217    RTTESTI_CHECK(parms[1].u.uint32 == VBOX_SHCL_FMT_UNICODETEXT);
    218218    RTTESTI_CHECK_RC_OK(call.rc);
    219219    call.rc = VERR_TRY_AGAIN;
    220     table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_GET_HOST_MSG_OLD, 2, parms, 0);
     220    table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, 2, parms, 0);
    221221    RTTESTI_CHECK(parms[0].u.uint32 == VBOX_SHCL_HOST_MSG_READ_DATA);
    222222    RTTESTI_CHECK(parms[1].u.uint32 == VBOX_SHCL_FMT_HTML);
    223223    RTTESTI_CHECK_RC_OK(call.rc);
    224224    call.rc = VERR_TRY_AGAIN;
    225     table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_GET_HOST_MSG_OLD, 2, parms, 0);
     225    table.pfnCall(NULL, &call, 1 /* clientId */, &g_Client, VBOX_SHCL_GUEST_FN_MSG_OLD_GET_WAIT, 2, parms, 0);
    226226    RTTESTI_CHECK_RC(call.rc, VERR_TRY_AGAIN);  /* This call should not complete yet. */
    227227    table.pfnDisconnect(NULL, 1 /* clientId */, &g_Client);
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette