VirtualBox

source: vbox/trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxCalls.c@ 30829

Last change on this file since 30829 was 28800, checked in by vboxsync, 15 years ago

Automated rebranding to Oracle copyright/license strings via filemuncher

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 21.5 KB
Line 
1/* $Revision: 28800 $ */
2/** @file
3 * VBoxGuestLibR0 - Central calls.
4 */
5
6/*
7 * Copyright (C) 2006-2007 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27/* Entire file is ifdef'ed with !VBGL_VBOXGUEST */
28#ifndef VBGL_VBOXGUEST
29
30#ifdef RT_OS_LINUX
31# include "VBoxCalls.h"
32# define DbgPrint RTAssertMsg2Weak
33#else
34# include "VBoxCalls.h"
35#endif
36#include <iprt/time.h>
37#include <iprt/mem.h>
38#include <iprt/path.h>
39#include <iprt/string.h>
40
41#define SHFL_CPARMS_SET_UTF8 0
42
43#define VBOX_INIT_CALL(a, b, c) \
44 (a)->result = VINF_SUCCESS; \
45 (a)->u32ClientID = (c)->ulClientID; \
46 (a)->u32Function = SHFL_FN_##b; \
47 (a)->cParms = SHFL_CPARMS_##b
48
49#ifndef RT_OS_WINDOWS
50# define RtlZeroMemory(a, b) memset (a, 0, b)
51#endif
52
53
54DECLVBGL(int) vboxInit (void)
55{
56 int rc = VINF_SUCCESS;
57
58 rc = VbglInit ();
59 return rc;
60}
61
62DECLVBGL(void) vboxUninit (void)
63{
64 VbglTerminate ();
65}
66
67DECLVBGL(int) vboxConnect (PVBSFCLIENT pClient)
68{
69 int rc = VINF_SUCCESS;
70
71 VBoxGuestHGCMConnectInfo data;
72
73 RtlZeroMemory (&data, sizeof (VBoxGuestHGCMConnectInfo));
74
75 pClient->handle = NULL;
76
77 data.result = VINF_SUCCESS;
78 data.Loc.type = VMMDevHGCMLoc_LocalHost_Existing;
79 strcpy (data.Loc.u.host.achName, "VBoxSharedFolders");
80
81 rc = VbglHGCMConnect (&pClient->handle, &data);
82
83/* Log(("VBOXSF: VBoxSF::vboxConnect: VbglHGCMConnect rc = %#x, result = %#x\n",
84 rc, data.result));
85*/
86 if (RT_SUCCESS (rc))
87 {
88 rc = data.result;
89 }
90
91 if (RT_SUCCESS (rc))
92 {
93 pClient->ulClientID = data.u32ClientID;
94 }
95 return rc;
96}
97
98DECLVBGL(void) vboxDisconnect (PVBSFCLIENT pClient)
99{
100 int rc;
101
102 VBoxGuestHGCMDisconnectInfo data;
103
104 if (pClient->handle == NULL)
105 return; /* not connected */
106
107 RtlZeroMemory (&data, sizeof (VBoxGuestHGCMDisconnectInfo));
108
109 data.result = VINF_SUCCESS;
110 data.u32ClientID = pClient->ulClientID;
111
112 rc = VbglHGCMDisconnect (pClient->handle, &data);
113/* Log(("VBOXSF: VBoxSF::vboxDisconnect: "
114 "VbglHGCMDisconnect rc = %#x, result = %#x\n", rc, data.result));
115*/
116 return;
117}
118
119DECLVBGL(int) vboxCallQueryMappings (PVBSFCLIENT pClient, SHFLMAPPING paMappings[],
120 uint32_t *pcMappings)
121{
122 int rc = VINF_SUCCESS;
123
124 VBoxSFQueryMappings data;
125
126 VBOX_INIT_CALL(&data.callInfo, QUERY_MAPPINGS, pClient);
127
128 data.flags.type = VMMDevHGCMParmType_32bit;
129 data.flags.u.value32 = SHFL_MF_UCS2;
130
131 data.numberOfMappings.type = VMMDevHGCMParmType_32bit;
132 data.numberOfMappings.u.value32 = *pcMappings;
133
134 data.mappings.type = VMMDevHGCMParmType_LinAddr;
135 data.mappings.u.Pointer.size = sizeof (SHFLMAPPING) * *pcMappings;
136 data.mappings.u.Pointer.u.linearAddr = (uintptr_t)&paMappings[0];
137
138/* Log(("VBOXSF: in ifs difference %d\n",
139 (char *)&data.flags.type - (char *)&data.callInfo.cParms));
140*/
141 rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
142
143/*
144 Log(("VBOXSF: VBoxSF::vboxCallQueryMappings: "
145 "VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result));
146*/
147 if (RT_SUCCESS (rc))
148 {
149 rc = data.callInfo.result;
150 }
151
152 if (RT_SUCCESS (rc))
153 {
154 *pcMappings = data.numberOfMappings.u.value32;
155 }
156
157 return rc;
158}
159
160DECLVBGL(int) vboxCallQueryMapName (PVBSFCLIENT pClient, SHFLROOT root, SHFLSTRING *pString, uint32_t size)
161{
162 int rc = VINF_SUCCESS;
163
164 VBoxSFQueryMapName data;
165
166 VBOX_INIT_CALL(&data.callInfo, QUERY_MAP_NAME, pClient);
167
168 data.root.type = VMMDevHGCMParmType_32bit;
169 data.root.u.value32 = root;
170
171 data.name.type = VMMDevHGCMParmType_LinAddr;
172 data.name.u.Pointer.size = size;
173 data.name.u.Pointer.u.linearAddr = (uintptr_t)pString;
174
175 rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
176
177/* Log(("VBOXSF: VBoxSF::vboxCallQueryMapName: "
178 "VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result));
179*/
180 if (RT_SUCCESS (rc))
181 {
182 rc = data.callInfo.result;
183 }
184
185 return rc;
186}
187
188DECLVBGL(int) vboxCallMapFolder(PVBSFCLIENT pClient, PSHFLSTRING szFolderName,
189 PVBSFMAP pMap)
190{
191 int rc = VINF_SUCCESS;
192
193 VBoxSFMapFolder data;
194
195 VBOX_INIT_CALL(&data.callInfo, MAP_FOLDER, pClient);
196
197 data.path.type = VMMDevHGCMParmType_LinAddr;
198 data.path.u.Pointer.size = ShflStringSizeOfBuffer (szFolderName);
199 data.path.u.Pointer.u.linearAddr = (uintptr_t)szFolderName;
200
201 data.root.type = VMMDevHGCMParmType_32bit;
202 data.root.u.value32 = 0;
203
204 data.delimiter.type = VMMDevHGCMParmType_32bit;
205 data.delimiter.u.value32 = RTPATH_DELIMITER;
206
207 data.fCaseSensitive.type = VMMDevHGCMParmType_32bit;
208#if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
209 data.fCaseSensitive.u.value32 = 0;
210#else
211 data.fCaseSensitive.u.value32 = 1;
212#endif
213
214 rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
215
216/* Log(("VBOXSF: VBoxSF::vboxCallMapFolder: "
217 "VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result));
218*/
219 if (RT_SUCCESS (rc))
220 {
221 pMap->root = data.root.u.value32;
222 rc = data.callInfo.result;
223 }
224 else
225 if (rc == VERR_NOT_IMPLEMENTED)
226 {
227 /* try the legacy interface too; temporary to assure backwards compatibility */
228 VBoxSFMapFolder_Old data;
229
230 VBOX_INIT_CALL(&data.callInfo, MAP_FOLDER_OLD, pClient);
231
232 data.path.type = VMMDevHGCMParmType_LinAddr;
233 data.path.u.Pointer.size = ShflStringSizeOfBuffer (szFolderName);
234 data.path.u.Pointer.u.linearAddr = (uintptr_t)szFolderName;
235
236 data.root.type = VMMDevHGCMParmType_32bit;
237 data.root.u.value32 = 0;
238
239 data.delimiter.type = VMMDevHGCMParmType_32bit;
240 data.delimiter.u.value32 = RTPATH_DELIMITER;
241
242 rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
243
244 if (RT_SUCCESS (rc))
245 {
246 pMap->root = data.root.u.value32;
247 rc = data.callInfo.result;
248 }
249 }
250 return rc;
251}
252
253DECLVBGL(int) vboxCallUnmapFolder(PVBSFCLIENT pClient, PVBSFMAP pMap)
254{
255 int rc = VINF_SUCCESS;
256
257 VBoxSFUnmapFolder data;
258
259 VBOX_INIT_CALL(&data.callInfo, UNMAP_FOLDER, pClient);
260
261 data.root.type = VMMDevHGCMParmType_32bit;
262 data.root.u.value32 = pMap->root;
263
264 rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
265
266/* Log(("VBOXSF: VBoxSF::vboxCallUnmapFolder: "
267 "VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result));
268*/
269 if (RT_SUCCESS (rc))
270 {
271 rc = data.callInfo.result;
272 }
273 return rc;
274}
275
276DECLVBGL(int) vboxCallCreate (PVBSFCLIENT pClient, PVBSFMAP pMap,
277 PSHFLSTRING pParsedPath, PSHFLCREATEPARMS pCreateParms)
278{
279 /** @todo copy buffers to physical or mapped memory. */
280 int rc = VINF_SUCCESS;
281
282 VBoxSFCreate data;
283
284 VBOX_INIT_CALL(&data.callInfo, CREATE, pClient);
285
286 data.root.type = VMMDevHGCMParmType_32bit;
287 data.root.u.value32 = pMap->root;
288
289 data.path.type = VMMDevHGCMParmType_LinAddr;
290 data.path.u.Pointer.size = ShflStringSizeOfBuffer (pParsedPath);
291 data.path.u.Pointer.u.linearAddr = (uintptr_t)pParsedPath;
292
293 data.parms.type = VMMDevHGCMParmType_LinAddr;
294 data.parms.u.Pointer.size = sizeof (SHFLCREATEPARMS);
295 data.parms.u.Pointer.u.linearAddr = (uintptr_t)pCreateParms;
296
297 rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
298
299/* Log(("VBOXSF: VBoxSF::vboxCallCreate: "
300 "VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result));
301*/
302 if (RT_SUCCESS (rc))
303 {
304 rc = data.callInfo.result;
305 }
306 return rc;
307}
308
309DECLVBGL(int) vboxCallClose (PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE Handle)
310{
311 int rc = VINF_SUCCESS;
312
313 VBoxSFClose data;
314
315 VBOX_INIT_CALL(&data.callInfo, CLOSE, pClient);
316
317 data.root.type = VMMDevHGCMParmType_32bit;
318 data.root.u.value32 = pMap->root;
319
320 data.handle.type = VMMDevHGCMParmType_64bit;
321 data.handle.u.value64 = Handle;
322
323 rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
324
325/* Log(("VBOXSF: VBoxSF::vboxCallClose: "
326 "VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result));
327*/
328 if (RT_SUCCESS (rc))
329 {
330 rc = data.callInfo.result;
331 }
332
333 return rc;
334}
335
336DECLVBGL(int) vboxCallRemove (PVBSFCLIENT pClient, PVBSFMAP pMap,
337 PSHFLSTRING pParsedPath, uint32_t flags)
338{
339 int rc = VINF_SUCCESS;
340
341 VBoxSFRemove data;
342
343 VBOX_INIT_CALL(&data.callInfo, REMOVE, pClient);
344
345 data.root.type = VMMDevHGCMParmType_32bit;
346 data.root.u.value32 = pMap->root;
347
348 data.path.type = VMMDevHGCMParmType_LinAddr_In;
349 data.path.u.Pointer.size = ShflStringSizeOfBuffer (pParsedPath);
350 data.path.u.Pointer.u.linearAddr = (uintptr_t)pParsedPath;
351
352 data.flags.type = VMMDevHGCMParmType_32bit;
353 data.flags.u.value32 = flags;
354
355 rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
356
357/* Log(("VBOXSF: VBoxSF::vboxCallRemove: "
358 "VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result));
359*/
360 if (RT_SUCCESS (rc))
361 {
362 rc = data.callInfo.result;
363 }
364
365 return rc;
366}
367
368DECLVBGL(int) vboxCallRename (PVBSFCLIENT pClient, PVBSFMAP pMap,
369 PSHFLSTRING pSrcPath, PSHFLSTRING pDestPath, uint32_t flags)
370{
371 int rc = VINF_SUCCESS;
372
373 VBoxSFRename data;
374
375 VBOX_INIT_CALL(&data.callInfo, RENAME, pClient);
376
377 data.root.type = VMMDevHGCMParmType_32bit;
378 data.root.u.value32 = pMap->root;
379
380 data.src.type = VMMDevHGCMParmType_LinAddr_In;
381 data.src.u.Pointer.size = ShflStringSizeOfBuffer (pSrcPath);
382 data.src.u.Pointer.u.linearAddr = (uintptr_t)pSrcPath;
383
384 data.dest.type = VMMDevHGCMParmType_LinAddr_In;
385 data.dest.u.Pointer.size = ShflStringSizeOfBuffer (pDestPath);
386 data.dest.u.Pointer.u.linearAddr = (uintptr_t)pDestPath;
387
388 data.flags.type = VMMDevHGCMParmType_32bit;
389 data.flags.u.value32 = flags;
390
391 rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
392
393/* Log(("VBOXSF: VBoxSF::vboxCallRename: "
394 "VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result));
395*/
396 if (RT_SUCCESS (rc))
397 {
398 rc = data.callInfo.result;
399 }
400 return rc;
401}
402
403DECLVBGL(int) vboxCallRead(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile,
404 uint64_t offset, uint32_t *pcbBuffer, uint8_t *pBuffer, bool fLocked)
405{
406 int rc = VINF_SUCCESS;
407
408 VBoxSFRead data;
409
410 VBOX_INIT_CALL(&data.callInfo, READ, pClient);
411
412 data.root.type = VMMDevHGCMParmType_32bit;
413 data.root.u.value32 = pMap->root;
414
415 data.handle.type = VMMDevHGCMParmType_64bit;
416 data.handle.u.value64 = hFile;
417 data.offset.type = VMMDevHGCMParmType_64bit;
418 data.offset.u.value64 = offset;
419 data.cb.type = VMMDevHGCMParmType_32bit;
420 data.cb.u.value32 = *pcbBuffer;
421 data.buffer.type = (fLocked) ? VMMDevHGCMParmType_LinAddr_Locked_Out : VMMDevHGCMParmType_LinAddr_Out;
422 data.buffer.u.Pointer.size = *pcbBuffer;
423 data.buffer.u.Pointer.u.linearAddr = (uintptr_t)pBuffer;
424
425 rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
426
427/* Log(("VBOXSF: VBoxSF::vboxCallRead: "
428 "VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result));
429*/
430 if (RT_SUCCESS (rc))
431 {
432 rc = data.callInfo.result;
433 *pcbBuffer = data.cb.u.value32;
434 }
435 return rc;
436}
437
438DECLVBGL(int) vboxCallWrite(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile,
439 uint64_t offset, uint32_t *pcbBuffer, uint8_t *pBuffer, bool fLocked)
440{
441 int rc = VINF_SUCCESS;
442
443 VBoxSFWrite data;
444
445 VBOX_INIT_CALL(&data.callInfo, WRITE, pClient);
446
447 data.root.type = VMMDevHGCMParmType_32bit;
448 data.root.u.value32 = pMap->root;
449
450 data.handle.type = VMMDevHGCMParmType_64bit;
451 data.handle.u.value64 = hFile;
452 data.offset.type = VMMDevHGCMParmType_64bit;
453 data.offset.u.value64 = offset;
454 data.cb.type = VMMDevHGCMParmType_32bit;
455 data.cb.u.value32 = *pcbBuffer;
456 data.buffer.type = (fLocked) ? VMMDevHGCMParmType_LinAddr_Locked_In : VMMDevHGCMParmType_LinAddr_In;
457 data.buffer.u.Pointer.size = *pcbBuffer;
458 data.buffer.u.Pointer.u.linearAddr = (uintptr_t)pBuffer;
459
460 rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
461
462/* Log(("VBOXSF: VBoxSF::vboxCallWrite: "
463 "VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result));
464*/
465 if (RT_SUCCESS (rc))
466 {
467 rc = data.callInfo.result;
468 *pcbBuffer = data.cb.u.value32;
469 }
470 return rc;
471}
472
473DECLVBGL(int) VbglR0SfWritePhysCont(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile, uint64_t offset, uint32_t *pcbBuffer, RTCCPHYS PhysBuffer)
474{
475 uint32_t cbToWrite = *pcbBuffer;
476 uint32_t cPages = RT_ALIGN_32((PhysBuffer & PAGE_OFFSET_MASK) + cbToWrite, PAGE_SIZE) >> PAGE_SHIFT;
477 uint32_t cbData = sizeof(VBoxSFWrite) + RT_UOFFSETOF(HGCMPageListInfo, aPages[cPages]);
478 VBoxSFWrite *pData = (VBoxSFWrite *)RTMemTmpAlloc(cbData);
479 HGCMPageListInfo *pPgLst = (HGCMPageListInfo *)(pData + 1);
480 uint32_t iPage;
481 int rc;
482
483 if (RT_UNLIKELY(!pData))
484 return VERR_NO_TMP_MEMORY;
485
486 VBOX_INIT_CALL(&pData->callInfo, WRITE, pClient);
487
488 pData->root.type = VMMDevHGCMParmType_32bit;
489 pData->root.u.value32 = pMap->root;
490
491 pData->handle.type = VMMDevHGCMParmType_64bit;
492 pData->handle.u.value64 = hFile;
493 pData->offset.type = VMMDevHGCMParmType_64bit;
494 pData->offset.u.value64 = offset;
495 pData->cb.type = VMMDevHGCMParmType_32bit;
496 pData->cb.u.value32 = cbToWrite;
497 pData->buffer.type = VMMDevHGCMParmType_PageList;
498 pData->buffer.u.PageList.size = cbToWrite;
499 pData->buffer.u.PageList.offset = sizeof(VBoxSFWrite);
500
501 pPgLst->flags = VBOX_HGCM_F_PARM_DIRECTION_TO_HOST;
502 pPgLst->offFirstPage = PhysBuffer & PAGE_OFFSET_MASK;
503 pPgLst->cPages = cPages;
504 PhysBuffer &= ~(RTCCPHYS)PAGE_OFFSET_MASK;
505 for (iPage = 0; iPage < cPages; iPage++, PhysBuffer += PAGE_SIZE)
506 pPgLst->aPages[iPage] = PhysBuffer;
507
508 rc = VbglHGCMCall (pClient->handle, &pData->callInfo, cbData);
509 if (RT_SUCCESS (rc))
510 {
511 rc = pData->callInfo.result;
512 *pcbBuffer = pData->cb.u.value32;
513 }
514
515 RTMemTmpFree(pData);
516 return rc;
517
518}
519
520DECLVBGL(int) vboxCallFlush(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile)
521{
522 int rc = VINF_SUCCESS;
523
524 VBoxSFFlush data;
525
526 VBOX_INIT_CALL(&data.callInfo, FLUSH, pClient);
527
528 data.root.type = VMMDevHGCMParmType_32bit;
529 data.root.u.value32 = pMap->root;
530
531 data.handle.type = VMMDevHGCMParmType_64bit;
532 data.handle.u.value64 = hFile;
533
534 rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
535
536/* Log(("VBOXSF: VBoxSF::vboxCallFlush: "
537 "VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result));
538*/
539 if (RT_SUCCESS (rc))
540 {
541 rc = data.callInfo.result;
542 }
543 return rc;
544}
545
546DECLVBGL(int) vboxCallDirInfo (
547 PVBSFCLIENT pClient,
548 PVBSFMAP pMap,
549 SHFLHANDLE hFile,
550 PSHFLSTRING ParsedPath,
551 uint32_t flags,
552 uint32_t index,
553 uint32_t *pcbBuffer,
554 PSHFLDIRINFO pBuffer,
555 uint32_t *pcFiles)
556{
557 int rc = VINF_SUCCESS;
558
559 VBoxSFList data;
560
561 VBOX_INIT_CALL(&data.callInfo, LIST, pClient);
562
563 data.root.type = VMMDevHGCMParmType_32bit;
564 data.root.u.value32 = pMap->root;
565
566 data.handle.type = VMMDevHGCMParmType_64bit;
567 data.handle.u.value64 = hFile;
568 data.flags.type = VMMDevHGCMParmType_32bit;
569 data.flags.u.value32 = flags;
570 data.cb.type = VMMDevHGCMParmType_32bit;
571 data.cb.u.value32 = *pcbBuffer;
572 data.path.type = VMMDevHGCMParmType_LinAddr_In;
573 data.path.u.Pointer.size =
574 (ParsedPath) ? ShflStringSizeOfBuffer(ParsedPath) : 0;
575 data.path.u.Pointer.u.linearAddr = (uintptr_t) ParsedPath;
576
577 data.buffer.type = VMMDevHGCMParmType_LinAddr_Out;
578 data.buffer.u.Pointer.size = *pcbBuffer;
579 data.buffer.u.Pointer.u.linearAddr = (uintptr_t)pBuffer;
580
581 data.resumePoint.type = VMMDevHGCMParmType_32bit;
582 data.resumePoint.u.value32 = index;
583 data.cFiles.type = VMMDevHGCMParmType_32bit;
584 data.cFiles.u.value32 = 0; /* out parameters only */
585
586 rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
587
588/* Log(("VBOXSF: VBoxSF::vboxCallDirInfo: "
589 "VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result));
590*/
591 if (RT_SUCCESS (rc))
592 {
593 rc = data.callInfo.result;
594 }
595 *pcbBuffer = data.cb.u.value32;
596 *pcFiles = data.cFiles.u.value32;
597 return rc;
598}
599
600DECLVBGL(int) vboxCallFSInfo(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile,
601 uint32_t flags, uint32_t *pcbBuffer, PSHFLDIRINFO pBuffer)
602{
603 int rc = VINF_SUCCESS;
604
605 VBoxSFInformation data;
606
607 VBOX_INIT_CALL(&data.callInfo, INFORMATION, pClient);
608
609 data.root.type = VMMDevHGCMParmType_32bit;
610 data.root.u.value32 = pMap->root;
611
612 data.handle.type = VMMDevHGCMParmType_64bit;
613 data.handle.u.value64 = hFile;
614 data.flags.type = VMMDevHGCMParmType_32bit;
615 data.flags.u.value32 = flags;
616 data.cb.type = VMMDevHGCMParmType_32bit;
617 data.cb.u.value32 = *pcbBuffer;
618 data.info.type = VMMDevHGCMParmType_LinAddr;
619 data.info.u.Pointer.size = *pcbBuffer;
620 data.info.u.Pointer.u.linearAddr = (uintptr_t)pBuffer;
621
622 rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
623
624/* Log(("VBOXSF: VBoxSF::vboxCallFileInfo: "
625 "VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result));
626*/
627 if (RT_SUCCESS (rc))
628 {
629 rc = data.callInfo.result;
630 *pcbBuffer = data.cb.u.value32;
631 }
632 return rc;
633}
634
635DECLVBGL(int) vboxCallLock(PVBSFCLIENT pClient, PVBSFMAP pMap, SHFLHANDLE hFile,
636 uint64_t offset, uint64_t cbSize, uint32_t fLock)
637{
638 int rc = VINF_SUCCESS;
639
640 VBoxSFLock data;
641
642 VBOX_INIT_CALL(&data.callInfo, LOCK, pClient);
643
644 data.root.type = VMMDevHGCMParmType_32bit;
645 data.root.u.value32 = pMap->root;
646
647 data.handle.type = VMMDevHGCMParmType_64bit;
648 data.handle.u.value64 = hFile;
649 data.offset.type = VMMDevHGCMParmType_64bit;
650 data.offset.u.value64 = offset;
651 data.length.type = VMMDevHGCMParmType_64bit;
652 data.length.u.value64 = cbSize;
653
654 data.flags.type = VMMDevHGCMParmType_32bit;
655 data.flags.u.value32 = fLock;
656
657 rc = VbglHGCMCall (pClient->handle, &data.callInfo, sizeof (data));
658
659/* Log(("VBOXSF: VBoxSF::vboxCallLock: "
660 "VbglHGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.result));
661*/
662 if (RT_SUCCESS (rc))
663 {
664 rc = data.callInfo.result;
665 }
666 return rc;
667}
668
669DECLVBGL(int) vboxCallSetUtf8 (PVBSFCLIENT pClient)
670{
671 int rc = VINF_SUCCESS;
672
673 VBoxGuestHGCMCallInfo callInfo;
674
675 VBOX_INIT_CALL (&callInfo, SET_UTF8, pClient);
676 rc = VbglHGCMCall (pClient->handle, &callInfo, sizeof (callInfo));
677 if (RT_SUCCESS (rc))
678 {
679 rc = callInfo.result;
680 }
681 return rc;
682}
683
684#endif /* !VBGL_VBOXGUEST */
Note: See TracBrowser for help on using the repository browser.

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