aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mousmain.c2
-rw-r--r--sfmain.c2
-rw-r--r--sftsr.c47
-rw-r--r--vbox.h13
-rw-r--r--vboxdev.h16
-rw-r--r--vboxhgcm.h48
-rw-r--r--vboxshfl.h411
7 files changed, 268 insertions, 271 deletions
diff --git a/mousmain.c b/mousmain.c
index c6d2e96..e86a192 100644
--- a/mousmain.c
+++ b/mousmain.c
@@ -98,8 +98,6 @@ static int set_virtualbox_integration(LPTSRDATA data, bool enable)
return err;
}
- printf("Found VirtualBox device at IO 0x%x\n", data->vb.iobase);
-
err = vbox_init_buffer(&data->vb);
if (err) {
fprintf(stderr, "Cannot lock buffer used for VirtualBox communication, err=%d\n", err);
diff --git a/sfmain.c b/sfmain.c
index 32a48b4..d49f823 100644
--- a/sfmain.c
+++ b/sfmain.c
@@ -353,8 +353,6 @@ static int configure_driver(LPTSRDATA data)
return -1;
}
- printf("Found VirtualBox device at IO 0x%x\n", data->vb.iobase);
-
err = vbox_init_buffer(&data->vb);
if (err) {
fprintf(stderr, "Cannot lock buffer used for VirtualBox communication, err=%ld\n", err);
diff --git a/sftsr.c b/sftsr.c
index 6c4c99e..0e86930 100644
--- a/sftsr.c
+++ b/sftsr.c
@@ -135,7 +135,7 @@ static void set_dos_err(union INTPACK __far *r, int err)
r->x.ax = err;
}
-static int vbox_err_to_dos(int32_t err)
+static int vbox_err_to_dos(vboxerr err)
{
switch (err) {
case VINF_SUCCESS:
@@ -156,12 +156,15 @@ static int vbox_err_to_dos(int32_t err)
return DOS_ERROR_TOO_MANY_OPEN_FILES;
case VERR_WRITE_PROTECT:
return DOS_ERROR_WRITE_PROTECT;
+ case VERR_NOT_A_DIRECTORY:
+ case VERR_DIR_NOT_EMPTY: // Behavior seen in real DOS
+ return DOS_ERROR_PATH_NOT_FOUND;
default:
return DOS_ERROR_GEN_FAILURE;
}
}
-static void set_vbox_err(union INTPACK __far *r, int32_t err)
+static void set_vbox_err(union INTPACK __far *r, vboxerr err)
{
dlog_print("->vbox error ");
if (err < INT16_MIN || err > INT16_MAX) {
@@ -325,7 +328,7 @@ static void handle_create_open_ex(union INTPACK __far *r)
unsigned int action, mode;
unsigned openfile;
bool save_result;
- int32_t err;
+ vboxerr err;
switch (r->h.al) {
case DOS_FN_CREATE:
@@ -446,7 +449,7 @@ static void handle_close(union INTPACK __far *r)
{
DOSSFT __far *sft = MK_FP(r->x.es, r->x.di);
unsigned openfile = get_sft_openfile_index(sft);
- int32_t err;
+ vboxerr err;
dlog_print("handle_close openfile=");
dlog_printu(openfile);
@@ -479,7 +482,7 @@ static void handle_read(union INTPACK __far *r)
uint8_t __far *buffer = data.dossda->cur_dta;
unsigned long offset = sft->f_pos;
unsigned bytes = r->x.cx;
- int32_t err;
+ vboxerr err;
dlog_print("handle_read openfile=");
dlog_printu(openfile);
@@ -518,7 +521,7 @@ static void handle_write(union INTPACK __far *r)
uint8_t __far *buffer = data.dossda->cur_dta;
unsigned long offset = sft->f_pos;
unsigned bytes = r->x.cx;
- int32_t err;
+ vboxerr err;
dlog_print("handle_write openfile=");
dlog_printu(openfile);
@@ -562,7 +565,7 @@ static void handle_lock(union INTPACK __far *r)
unsigned flags = (unlock ? SHFL_LOCK_CANCEL : SHFL_LOCK_EXCLUSIVE)
| SHFL_LOCK_WAIT | SHFL_LOCK_PARTIAL;
DOSLOCK __far *ops = MK_FP(r->x.ds, r->x.dx);
- int32_t err;
+ vboxerr err;
dlog_print("handle_lock ");
if (unlock) dlog_print("unlock");
@@ -585,7 +588,7 @@ static void handle_lock(union INTPACK __far *r)
static void handle_close_all(union INTPACK __far *r)
{
- int32_t err;
+ vboxerr err;
unsigned i;
dlog_puts("handle_close_all");
@@ -612,7 +615,7 @@ static void handle_delete(union INTPACK __far *r)
const char __far *path = data.dossda->fn1;
int drive = drive_letter_to_index(path[0]);
SHFLROOT root = data.drives[drive].root;
- int32_t err;
+ vboxerr err;
dlog_print("handle_delete ");
dlog_fprint(path);
@@ -638,7 +641,7 @@ static void handle_rename(union INTPACK __far *r)
const char __far *dst = data.dossda->fn2;
int dstdrive = drive_letter_to_index(dst[0]);
SHFLROOT root = data.drives[srcdrive].root;
- int32_t err;
+ vboxerr err;
dlog_print("handle_rename ");
dlog_fprint(src);
@@ -675,7 +678,7 @@ static void handle_getattr(union INTPACK __far *r)
const char __far *path = data.dossda->fn1;
int drive = drive_letter_to_index(path[0]);
SHFLROOT root = data.drives[drive].root;
- int32_t err;
+ vboxerr err;
dlog_print("handle_getattr ");
dlog_fprint(path);
@@ -709,9 +712,9 @@ static void handle_getattr(union INTPACK __far *r)
}
-static int32_t open_search_dir(SHFLROOT root, const char __far *path)
+static vboxerr open_search_dir(SHFLROOT root, const char __far *path)
{
- int32_t err;
+ vboxerr err;
dlog_puts("open_search_dir");
@@ -752,7 +755,7 @@ static int32_t open_search_dir(SHFLROOT root, const char __far *path)
static void close_search_dir()
{
- int32_t err;
+ vboxerr err;
if (data.files[SEARCH_DIR_FILE].root == SHFL_ROOT_NIL) {
// Already closed
@@ -776,10 +779,10 @@ static inline bool is_search_dir_open()
}
/** Simulates a directory entry with the current volume label. */
-static int32_t find_volume_label(SHFLROOT root)
+static vboxerr find_volume_label(SHFLROOT root)
{
DOSDIR __far *found_file = &data.dossda->found_file;
- int32_t err;
+ vboxerr err;
shflstring_clear(&shflstr.shflstr);
@@ -803,10 +806,10 @@ static int32_t find_volume_label(SHFLROOT root)
}
/** Gets and fills in the next directory entry from VirtualBox. */
-static int32_t find_next_from_vbox(uint8_t search_attr)
+static vboxerr find_next_from_vbox(uint8_t search_attr)
{
DOSDIR __far *found_file = &data.dossda->found_file;
- int32_t err;
+ vboxerr err;
if (!is_search_dir_open()) {
dlog_puts("find_next called, but no opendir handle");
@@ -870,7 +873,7 @@ static void handle_find(union INTPACK __far *r)
SHFLROOT root = data.drives[drive].root;
DOSDIR __far *found_file = &data.dossda->found_file;
uint8_t search_attr;
- int32_t err;
+ vboxerr err;
if (r->h.al == DOS_FN_FIND_FIRST) {
search_attr = data.dossda->search_attr;
@@ -952,7 +955,7 @@ static void handle_chdir(union INTPACK __far *r)
const char __far *path = data.dossda->fn1;
int drive = drive_letter_to_index(path[0]);
SHFLROOT root = data.drives[drive].root;
- int32_t err;
+ vboxerr err;
dlog_print("handle_chdir to ");
dlog_fprint(path);
@@ -995,7 +998,7 @@ static void handle_mkdir(union INTPACK __far *r)
const char __far *path = data.dossda->fn1;
int drive = drive_letter_to_index(path[0]);
SHFLROOT root = data.drives[drive].root;
- int32_t err;
+ vboxerr err;
dlog_print("handle_mkdir ");
dlog_fprint(path);
@@ -1035,7 +1038,7 @@ static void handle_rmdir(union INTPACK __far *r)
const char __far *path = data.dossda->fn1;
int drive = drive_letter_to_index(path[0]);
SHFLROOT root = data.drives[drive].root;
- int32_t err;
+ vboxerr err;
dlog_print("handle_rmdir ");
dlog_fprint(path);
diff --git a/vbox.h b/vbox.h
index 64e0c37..6a1e66c 100644
--- a/vbox.h
+++ b/vbox.h
@@ -40,8 +40,11 @@ typedef struct vboxcomm {
char buf[VBOX_BUFFER_SIZE];
VDSDDS dds;
} vboxcomm_t;
+typedef vboxcomm_t * PVBOXCOMM;
typedef vboxcomm_t __far * LPVBOXCOMM;
+typedef int32_t vboxerr;
+
/** Actually send a request to the VirtualBox VMM device.
* @param addr 32-bit physical address containing the VMMDevRequest struct.
*/
@@ -79,7 +82,7 @@ static void vbox_init_req(VMMDevRequestHeader __far *hdr, VMMDevRequestType type
/** Lets VirtualBox know that there are VirtualBox Guest Additions on this guest.
* @param osType os installed on this guest. */
-static int32_t vbox_report_guest_info(LPVBOXCOMM vb, uint32_t osType)
+static vboxerr vbox_report_guest_info(LPVBOXCOMM vb, uint32_t osType)
{
VMMDevReportGuestInfo __far *req = (void __far *) vb->buf;
@@ -93,7 +96,7 @@ static int32_t vbox_report_guest_info(LPVBOXCOMM vb, uint32_t osType)
}
/** Tells VirtualBox whether we want absolute mouse information or not. */
-static int32_t vbox_set_mouse(LPVBOXCOMM vb, bool absolute, bool pointer)
+static vboxerr vbox_set_mouse(LPVBOXCOMM vb, bool absolute, bool pointer)
{
VMMDevReqMouseStatus __far *req = (void __far *) vb->buf;
@@ -109,7 +112,7 @@ static int32_t vbox_set_mouse(LPVBOXCOMM vb, bool absolute, bool pointer)
/** Gets the current absolute mouse position from VirtualBox.
* @param abs false if user has disabled mouse integration in VirtualBox,
* in which case we should fallback to PS/2 relative events. */
-static int32_t vbox_get_mouse(LPVBOXCOMM vb, bool __far *abs,
+static vboxerr vbox_get_mouse(LPVBOXCOMM vb, bool __far *abs,
uint16_t __far *xpos, uint16_t __far *ypos)
{
VMMDevReqMouseStatus __far *req = (void __far *) vb->buf;
@@ -126,7 +129,7 @@ static int32_t vbox_get_mouse(LPVBOXCOMM vb, bool __far *abs,
}
/** Asks the host to render the mouse cursor for us. */
-static int32_t vbox_set_pointer_visible(LPVBOXCOMM vb, bool visible)
+static vboxerr vbox_set_pointer_visible(LPVBOXCOMM vb, bool visible)
{
VMMDevReqMousePointer __far *req = (void __far *) vb->buf;
@@ -147,7 +150,7 @@ static inline unsigned vbox_req_mouse_pointer_size(unsigned width, unsigned heig
return MAX(sizeof(VMMDevReqMousePointer), 24 + 20 + data_size);
}
-static int32_t vbox_idle(LPVBOXCOMM vb)
+static vboxerr vbox_idle(LPVBOXCOMM vb)
{
VMMDevReqIdle __far *req = (void __far *) vb->buf;
diff --git a/vboxdev.h b/vboxdev.h
index 062c9dc..c2bf5a3 100644
--- a/vboxdev.h
+++ b/vboxdev.h
@@ -1412,6 +1412,22 @@ typedef struct _SHFLDIRINFO
#define SHFL_LIST_RETURN_ONE 1
#define SHFL_LIST_RESTART 2
+/** Mask of Set/Get bit. */
+#define SHFL_INFO_MODE_MASK (0x1)
+/** Get information */
+#define SHFL_INFO_GET (0x0)
+/** Set information */
+#define SHFL_INFO_SET (0x1)
+
+/** Get name of the object. */
+#define SHFL_INFO_NAME (0x2)
+/** Set size of object (extend/trucate); only applies to file objects */
+#define SHFL_INFO_SIZE (0x4)
+/** Get/Set file object info. */
+#define SHFL_INFO_FILE (0x8)
+/** Get volume information. */
+#define SHFL_INFO_VOLUME (0x10)
+
#define SHFL_REMOVE_FILE (0x1)
#define SHFL_REMOVE_DIR (0x2)
#define SHFL_REMOVE_SYMLINK (0x4)
diff --git a/vboxhgcm.h b/vboxhgcm.h
index 3ccfa28..b97a4ec 100644
--- a/vboxhgcm.h
+++ b/vboxhgcm.h
@@ -34,7 +34,7 @@ static void vbox_hgcm_wait(VMMDevHGCMRequestHeader __far * req)
}
}
-static int32_t vbox_hgcm_connect_existing(LPVBOXCOMM vb, const char *service, hgcm_client_id_t __far *client_id)
+static vboxerr vbox_hgcm_connect_existing(LPVBOXCOMM vb, const char *service, hgcm_client_id_t __far *client_id)
{
VMMDevHGCMConnect __far *req = (void __far *) vb->buf;
@@ -57,7 +57,7 @@ static int32_t vbox_hgcm_connect_existing(LPVBOXCOMM vb, const char *service, hg
return req->header.result;
}
-static int32_t vbox_hgcm_disconnect(LPVBOXCOMM vb, hgcm_client_id_t client_id)
+static vboxerr vbox_hgcm_disconnect(LPVBOXCOMM vb, hgcm_client_id_t client_id)
{
VMMDevHGCMDisconnect __far *req = (void __far *) vb->buf;
@@ -75,7 +75,7 @@ static int32_t vbox_hgcm_disconnect(LPVBOXCOMM vb, hgcm_client_id_t client_id)
return req->header.result;
}
-static inline void vbox_hgcm_init_call(VMMDevHGCMCall __far *req, hgcm_client_id_t client_id, uint32_t function, unsigned narg)
+static void vbox_hgcm_init_call(VMMDevHGCMCall __far *req, hgcm_client_id_t client_id, uint32_t function, unsigned narg)
{
vbox_init_req(&req->header.header, VMMDevReq_HGCMCall32, sizeof(VMMDevHGCMCall) + (narg * sizeof(HGCMFunctionParameter)));
req->u32ClientID = client_id;
@@ -83,4 +83,46 @@ static inline void vbox_hgcm_init_call(VMMDevHGCMCall __far *req, hgcm_client_id
req->cParms = narg;
}
+static vboxerr vbox_hgcm_do_call_sync(LPVBOXCOMM vb, VMMDevHGCMCall __far *req)
+{
+ vbox_send_request(vb->iobase, vb->dds.physicalAddress);
+
+ if (req->header.header.rc < 0) {
+ return req->header.header.rc;
+ } else if (req->header.header.rc == VINF_HGCM_ASYNC_EXECUTE) {
+ vbox_hgcm_wait(&req->header);
+ }
+
+ return 0;
+}
+
+static void vbox_hgcm_set_parameter_uint32(VMMDevHGCMCall __far *req, unsigned arg, uint32_t value)
+{
+ req->aParms[arg].type = VMMDevHGCMParmType_32bit;
+ req->aParms[arg].u.value32 = value;
+}
+
+static inline uint32_t vbox_hgcm_get_parameter_uint32(VMMDevHGCMCall __far *req, unsigned arg)
+{
+ return req->aParms[arg].u.value32;
+}
+
+static void vbox_hgcm_set_parameter_uint64(VMMDevHGCMCall __far *req, unsigned arg, uint64_t value)
+{
+ req->aParms[arg].type = VMMDevHGCMParmType_64bit;
+ req->aParms[arg].u.value64 = value;
+}
+
+static inline uint64_t vbox_hgcm_get_parameter_uint64(VMMDevHGCMCall __far *req, unsigned arg)
+{
+ return req->aParms[arg].u.value64;
+}
+
+static void vbox_hgcm_set_parameter_pointer(VMMDevHGCMCall __far *req, unsigned arg, unsigned size, void __far *ptr)
+{
+ req->aParms[arg].type = VMMDevHGCMParmType_LinAddr;
+ req->aParms[arg].u.LinAddr.cb = size;
+ req->aParms[arg].u.LinAddr.uAddr = linear_addr(ptr);
+}
+
#endif // VBOXHGCM_H
diff --git a/vboxshfl.h b/vboxshfl.h
index 36cd818..9be37c8 100644
--- a/vboxshfl.h
+++ b/vboxshfl.h
@@ -69,457 +69,394 @@ static void shflstring_strncpy(SHFLSTRING *str, const char __far *src, unsigned
str->ach[str->u16Length] = '\0';
}
-static int32_t vbox_shfl_query_mappings(LPVBOXCOMM vb, hgcm_client_id_t client_id, uint32_t flags, unsigned __far *num_maps, SHFLMAPPING __far *maps)
+static inline void vbox_hgcm_set_parameter_shflroot(VMMDevHGCMCall __far *req, unsigned arg, SHFLROOT root)
{
- VMMDevHGCMCall __far *req = (void __far *) vb->buf;
- vbox_hgcm_init_call(req, client_id, SHFL_FN_QUERY_MAPPINGS, 3);
+ vbox_hgcm_set_parameter_uint32(req, arg, root);
+}
- req->aParms[0].type = VMMDevHGCMParmType_32bit;
- req->aParms[0].u.value32 = flags;
+static inline void vbox_hgcm_set_parameter_shflhandle(VMMDevHGCMCall __far *req, unsigned arg, SHFLHANDLE handle)
+{
+ vbox_hgcm_set_parameter_uint64(req, arg, handle);
+}
- req->aParms[1].type = VMMDevHGCMParmType_32bit;
- req->aParms[1].u.value32 = *num_maps;
+static void vbox_hgcm_set_parameter_shflstring(VMMDevHGCMCall __far *req, unsigned arg, const SHFLSTRING *str)
+{
+ vbox_hgcm_set_parameter_pointer(req, arg, shflstring_size_with_buf(str), str);
+}
+
+static vboxerr vbox_shfl_query_mappings(LPVBOXCOMM vb, hgcm_client_id_t client_id, uint32_t flags, unsigned __far *num_maps, SHFLMAPPING __far *maps)
+{
+ VMMDevHGCMCall __far *req = (void __far *) vb->buf;
+ vboxerr err;
- req->aParms[2].type = VMMDevHGCMParmType_LinAddr;
- req->aParms[2].u.Pointer.size = sizeof(SHFLMAPPING) * *num_maps;
- req->aParms[2].u.Pointer.u.linearAddr = linear_addr(maps);
+ vbox_hgcm_init_call(req, client_id, SHFL_FN_QUERY_MAPPINGS, 3);
- vbox_send_request(vb->iobase, vb->dds.physicalAddress);
+ vbox_hgcm_set_parameter_uint32(req, 0, flags);
+ vbox_hgcm_set_parameter_uint32(req, 1, *num_maps);
+ vbox_hgcm_set_parameter_pointer(req, 2, sizeof(SHFLMAPPING) * *num_maps, maps);
- if (req->header.header.rc < 0) {
- return req->header.header.rc;
- } else if (req->header.header.rc == VINF_HGCM_ASYNC_EXECUTE) {
- vbox_hgcm_wait(&req->header);
- }
+ if ((err = vbox_hgcm_do_call_sync(vb, req)) < 0)
+ return err;
- *num_maps = req->aParms[1].u.value32;
+ *num_maps = vbox_hgcm_get_parameter_uint32(req, 1);
return req->header.result;
}
-static int32_t vbox_shfl_query_map_name(LPVBOXCOMM vb, hgcm_client_id_t client_id, SHFLROOT root, SHFLSTRING *name)
+static vboxerr vbox_shfl_query_map_name(LPVBOXCOMM vb, hgcm_client_id_t client_id, SHFLROOT root, SHFLSTRING *name)
{
VMMDevHGCMCall __far *req = (void __far *) vb->buf;
- vbox_hgcm_init_call(req, client_id, SHFL_FN_QUERY_MAP_NAME, 2);
-
- req->aParms[0].type = VMMDevHGCMParmType_32bit;
- req->aParms[0].u.value32 = root;
+ vboxerr err;
- req->aParms[1].type = VMMDevHGCMParmType_LinAddr;
- req->aParms[1].u.Pointer.size = shflstring_size_with_buf(name);
- req->aParms[1].u.Pointer.u.linearAddr = linear_addr(name);
+ vbox_hgcm_init_call(req, client_id, SHFL_FN_QUERY_MAP_NAME, 2);
- vbox_send_request(vb->iobase, vb->dds.physicalAddress);
+ vbox_hgcm_set_parameter_shflroot(req, 0, root);
+ vbox_hgcm_set_parameter_shflstring(req, 1, name);
- if (req->header.header.rc < 0) {
- return req->header.header.rc;
- } else if (req->header.header.rc == VINF_HGCM_ASYNC_EXECUTE) {
- vbox_hgcm_wait(&req->header);
- }
+ if ((err = vbox_hgcm_do_call_sync(vb, req)) < 0)
+ return err;
return req->header.result;
}
-static int32_t vbox_shfl_map_folder(LPVBOXCOMM vb, hgcm_client_id_t client_id, const SHFLSTRING *name, SHFLROOT *root)
+static vboxerr vbox_shfl_map_folder(LPVBOXCOMM vb, hgcm_client_id_t client_id, const SHFLSTRING *name, SHFLROOT *root)
{
VMMDevHGCMCall __far *req = (void __far *) vb->buf;
+ vboxerr err;
+
vbox_hgcm_init_call(req, client_id, SHFL_FN_MAP_FOLDER, 4);
// arg 0 in shflstring "name"
- req->aParms[0].type = VMMDevHGCMParmType_LinAddr;
- req->aParms[0].u.Pointer.size = shflstring_size_with_buf(name);
- req->aParms[0].u.Pointer.u.linearAddr = linear_addr(name);
+ vbox_hgcm_set_parameter_pointer(req, 0, shflstring_size_with_buf(name), name);
// arg 1 out uint32 "root"
- req->aParms[1].type = VMMDevHGCMParmType_32bit;
- req->aParms[1].u.value32 = *root;
+ vbox_hgcm_set_parameter_uint32(req, 1, 0);
// arg 2 in uint32 "delimiter"
- req->aParms[2].type = VMMDevHGCMParmType_32bit;
- req->aParms[2].u.value32 = '\\';
+ vbox_hgcm_set_parameter_uint32(req, 2, '\\');
// arg 3 in uint32 "caseSensitive"
- req->aParms[3].type = VMMDevHGCMParmType_32bit;
- req->aParms[3].u.value32 = 0;
+ vbox_hgcm_set_parameter_uint32(req, 3, 0);
- vbox_send_request(vb->iobase, vb->dds.physicalAddress);
+ if ((err = vbox_hgcm_do_call_sync(vb, req)) < 0)
+ return err;
- if (req->header.header.rc < 0) {
- return req->header.header.rc;
- } else if (req->header.header.rc == VINF_HGCM_ASYNC_EXECUTE) {
- vbox_hgcm_wait(&req->header);
- }
-
- *root = req->aParms[1].u.value32;
+ *root = vbox_hgcm_get_parameter_uint32(req, 1);
return req->header.result;
}
-static int32_t vbox_shfl_unmap_folder(LPVBOXCOMM vb, hgcm_client_id_t client_id, SHFLROOT root)
+static vboxerr vbox_shfl_unmap_folder(LPVBOXCOMM vb, hgcm_client_id_t client_id, SHFLROOT root)
{
VMMDevHGCMCall __far *req = (void __far *) vb->buf;
+ vboxerr err;
+
vbox_hgcm_init_call(req, client_id, SHFL_FN_UNMAP_FOLDER, 1);
// arg 0 in uint32 "root"
- req->aParms[0].type = VMMDevHGCMParmType_32bit;
- req->aParms[0].u.value32 = root;
+ vbox_hgcm_set_parameter_shflroot(req, 0, root);
- vbox_send_request(vb->iobase, vb->dds.physicalAddress);
-
- if (req->header.header.rc < 0) {
- return req->header.header.rc;
- } else if (req->header.header.rc == VINF_HGCM_ASYNC_EXECUTE) {
- vbox_hgcm_wait(&req->header);
- }
+ if (err = vbox_hgcm_do_call_sync(vb, req))
+ return err;
return req->header.result;
}
-static int32_t vbox_shfl_open(LPVBOXCOMM vb, hgcm_client_id_t client_id, SHFLROOT root, const SHFLSTRING *name, SHFLCREATEPARMS *parms)
+static vboxerr vbox_shfl_open(LPVBOXCOMM vb, hgcm_client_id_t client_id, SHFLROOT root, const SHFLSTRING *name, SHFLCREATEPARMS *parms)
{
VMMDevHGCMCall __far *req = (void __far *) vb->buf;
+ vboxerr err;
+
vbox_hgcm_init_call(req, client_id, SHFL_FN_CREATE, 3);
// arg 0 in uint32 "root"
- req->aParms[0].type = VMMDevHGCMParmType_32bit;
- req->aParms[0].u.value32 = root;
+ vbox_hgcm_set_parameter_shflroot(req, 0, root);
// arg 1 in shflstring "name"
- req->aParms[1].type = VMMDevHGCMParmType_LinAddr;
- req->aParms[1].u.Pointer.size = shflstring_size_with_buf(name);
- req->aParms[1].u.Pointer.u.linearAddr = linear_addr(name);
+ vbox_hgcm_set_parameter_shflstring(req, 1, name);
// arg 2 in shflcreateparms "parms"
- req->aParms[2].type = VMMDevHGCMParmType_LinAddr;
- req->aParms[2].u.Pointer.size = sizeof(SHFLCREATEPARMS);
- req->aParms[2].u.Pointer.u.linearAddr = linear_addr(parms);
+ vbox_hgcm_set_parameter_pointer(req, 2, sizeof(SHFLCREATEPARMS), parms);
- vbox_send_request(vb->iobase, vb->dds.physicalAddress);
-
- if (req->header.header.rc < 0) {
- return req->header.header.rc;
- } else if (req->header.header.rc == VINF_HGCM_ASYNC_EXECUTE) {
- vbox_hgcm_wait(&req->header);
- }
+ if ((err = vbox_hgcm_do_call_sync(vb, req)) < 0)
+ return err;
return req->header.result;
}
-static int32_t vbox_shfl_close(LPVBOXCOMM vb, hgcm_client_id_t client_id, SHFLROOT root, SHFLHANDLE handle)
+static vboxerr vbox_shfl_close(LPVBOXCOMM vb, hgcm_client_id_t client_id, SHFLROOT root, SHFLHANDLE handle)
{
VMMDevHGCMCall __far *req = (void __far *) vb->buf;
+ vboxerr err;
+
vbox_hgcm_init_call(req, client_id, SHFL_FN_CLOSE, 2);
// arg 0 in uint32 "root"
- req->aParms[0].type = VMMDevHGCMParmType_32bit;
- req->aParms[0].u.value32 = root;
+ vbox_hgcm_set_parameter_shflroot(req, 0, root);
// arg 1 in uint64 "handle"
- req->aParms[1].type = VMMDevHGCMParmType_64bit;
- req->aParms[1].u.value64 = handle;
+ vbox_hgcm_set_parameter_shflhandle(req, 1, handle);
- vbox_send_request(vb->iobase, vb->dds.physicalAddress);
-
- if (req->header.header.rc < 0) {
- return req->header.header.rc;
- } else if (req->header.header.rc == VINF_HGCM_ASYNC_EXECUTE) {
- vbox_hgcm_wait(&req->header);
- }
+ if ((err = vbox_hgcm_do_call_sync(vb, req)) < 0)
+ return err;
return req->header.result;
}
-static int32_t vbox_shfl_read(LPVBOXCOMM vb, hgcm_client_id_t client_id, SHFLROOT root, SHFLHANDLE handle,
+static vboxerr vbox_shfl_read(LPVBOXCOMM vb, hgcm_client_id_t client_id, SHFLROOT root, SHFLHANDLE handle,
unsigned long offset, unsigned __far *size, void __far *buffer)
{
VMMDevHGCMCall __far *req = (void __far *) vb->buf;
+ vboxerr err;
+
vbox_hgcm_init_call(req, client_id, SHFL_FN_READ, 5);
// arg 0 in uint32 "root"
- req->aParms[0].type = VMMDevHGCMParmType_32bit;
- req->aParms[0].u.value32 = root;
+ vbox_hgcm_set_parameter_shflroot(req, 0, root);
// arg 1 in uint64 "handle"
- req->aParms[1].type = VMMDevHGCMParmType_64bit;
- req->aParms[1].u.value64 = handle;
+ vbox_hgcm_set_parameter_shflhandle(req, 1, handle);
// arg 2 in uint64 "offset"
- req->aParms[2].type = VMMDevHGCMParmType_64bit;
- req->aParms[2].u.value64 = offset;
+ vbox_hgcm_set_parameter_uint64(req, 2, offset);
// arg 3 inout uint32 "size"
- req->aParms[3].type = VMMDevHGCMParmType_32bit;
- req->aParms[3].u.value32 = *size;
+ vbox_hgcm_set_parameter_uint32(req, 3, *size);
// arg 4 out void "buffer"
- req->aParms[4].type = VMMDevHGCMParmType_LinAddr;
- req->aParms[4].u.Pointer.size = *size;
- req->aParms[4].u.Pointer.u.linearAddr = linear_addr(buffer);
+ vbox_hgcm_set_parameter_pointer(req, 4, *size, buffer);
- vbox_send_request(vb->iobase, vb->dds.physicalAddress);
-
- if (req->header.header.rc < 0) {
- return req->header.header.rc;
- } else if (req->header.header.rc == VINF_HGCM_ASYNC_EXECUTE) {
- vbox_hgcm_wait(&req->header);
- }
+ if ((err = vbox_hgcm_do_call_sync(vb, req)) < 0)
+ return err;
- *size = req->aParms[3].u.value32;
+ *size = vbox_hgcm_get_parameter_uint32(req, 3);
return req->header.result;
}
-static int32_t vbox_shfl_write(LPVBOXCOMM vb, hgcm_client_id_t client_id, SHFLROOT root, SHFLHANDLE handle,
+static vboxerr vbox_shfl_write(LPVBOXCOMM vb, hgcm_client_id_t client_id, SHFLROOT root, SHFLHANDLE handle,
unsigned long offset, unsigned __far *size, void __far *buffer)
{
VMMDevHGCMCall __far *req = (void __far *) vb->buf;
+ vboxerr err;
+
vbox_hgcm_init_call(req, client_id, SHFL_FN_WRITE, 5);
// arg 0 in uint32 "root"
- req->aParms[0].type = VMMDevHGCMParmType_32bit;
- req->aParms[0].u.value32 = root;
+ vbox_hgcm_set_parameter_shflroot(req, 0, root);
// arg 1 in uint64 "handle"
- req->aParms[1].type = VMMDevHGCMParmType_64bit;
- req->aParms[1].u.value64 = handle;
+ vbox_hgcm_set_parameter_shflhandle(req, 1, handle);
// arg 2 in uint64 "offset"
- req->aParms[2].type = VMMDevHGCMParmType_64bit;
- req->aParms[2].u.value64 = offset;
+ vbox_hgcm_set_parameter_uint64(req, 2, offset);
// arg 3 inout uint32 "size"
- req->aParms[3].type = VMMDevHGCMParmType_32bit;
- req->aParms[3].u.value32 = *size;
+ vbox_hgcm_set_parameter_uint32(req, 3, *size);
// arg 4 in void "buffer"
- req->aParms[4].type = VMMDevHGCMParmType_LinAddr;
- req->aParms[4].u.Pointer.size = *size;
- req->aParms[4].u.Pointer.u.linearAddr = linear_addr(buffer);
-
- vbox_send_request(vb->iobase, vb->dds.physicalAddress);
+ vbox_hgcm_set_parameter_pointer(req, 4, *size, buffer);
- if (req->header.header.rc < 0) {
- return req->header.header.rc;
- } else if (req->header.header.rc == VINF_HGCM_ASYNC_EXECUTE) {
- vbox_hgcm_wait(&req->header);
- }
+ if ((err = vbox_hgcm_do_call_sync(vb, req)) < 0)
+ return err;
- *size = req->aParms[3].u.value32;
+ *size = vbox_hgcm_get_parameter_uint32(req, 3);
return req->header.result;
}
-static int32_t vbox_shfl_lock(LPVBOXCOMM vb, hgcm_client_id_t client_id, SHFLROOT root, SHFLHANDLE handle,
+static vboxerr vbox_shfl_lock(LPVBOXCOMM vb, hgcm_client_id_t client_id, SHFLROOT root, SHFLHANDLE handle,
unsigned long offset, unsigned long length, unsigned flags)
{
VMMDevHGCMCall __far *req = (void __far *) vb->buf;
+ vboxerr err;
+
vbox_hgcm_init_call(req, client_id, SHFL_FN_LOCK, 5);
// arg 0 in uint32 "root"
- req->aParms[0].type = VMMDevHGCMParmType_32bit;
- req->aParms[0].u.value32 = root;
+ vbox_hgcm_set_parameter_shflroot(req, 0, root);
// arg 1 in uint64 "handle"
- req->aParms[1].type = VMMDevHGCMParmType_64bit;
- req->aParms[1].u.value64 = handle;
+ vbox_hgcm_set_parameter_shflhandle(req, 1, handle);
// arg 2 in uint64 "offset"
- req->aParms[2].type = VMMDevHGCMParmType_64bit;
- req->aParms[2].u.value64 = offset;
+ vbox_hgcm_set_parameter_uint64(req, 2, offset);
- // arg 3 inout uint64 "length"
- req->aParms[3].type = VMMDevHGCMParmType_64bit;
- req->aParms[3].u.value64 = length;
+ // arg 3 in uint64 "length"
+ vbox_hgcm_set_parameter_uint64(req, 3, length);
// arg 4 in uint32 "flags"
- req->aParms[4].type = VMMDevHGCMParmType_32bit;
- req->aParms[4].u.value32 = flags;
+ vbox_hgcm_set_parameter_uint32(req, 4, flags);
- vbox_send_request(vb->iobase, vb->dds.physicalAddress);
-
- if (req->header.header.rc < 0) {
- return req->header.header.rc;
- } else if (req->header.header.rc == VINF_HGCM_ASYNC_EXECUTE) {
- vbox_hgcm_wait(&req->header);
- }
+ if ((err = vbox_hgcm_do_call_sync(vb, req)) < 0)
+ return err;
return req->header.result;
}
-static int32_t vbox_shfl_list(LPVBOXCOMM vb, hgcm_client_id_t client_id, SHFLROOT root, SHFLHANDLE handle,
+static vboxerr vbox_shfl_list(LPVBOXCOMM vb, hgcm_client_id_t client_id, SHFLROOT root, SHFLHANDLE handle,
unsigned flags, unsigned __far *size, const SHFLSTRING *path, SHFLDIRINFO *dirinfo, unsigned __far *resume, unsigned __far *count)
{
VMMDevHGCMCall __far *req = (void __far *) vb->buf;
+ vboxerr err;
+
vbox_hgcm_init_call(req, client_id, SHFL_FN_LIST, 8);
// arg 0 in uint32 "root"
- req->aParms[0].type = VMMDevHGCMParmType_32bit;
- req->aParms[0].u.value32 = root;
+ vbox_hgcm_set_parameter_shflroot(req, 0, root);
// arg 1 in uint64 "handle"
- req->aParms[1].type = VMMDevHGCMParmType_64bit;
- req->aParms[1].u.value64 = handle;
+ vbox_hgcm_set_parameter_shflhandle(req, 1, handle);
// arg 2 in uint32 "flags"
- req->aParms[2].type = VMMDevHGCMParmType_32bit;
- req->aParms[2].u.value32 = flags;
+ vbox_hgcm_set_parameter_uint32(req, 2, flags);
// arg 3 inout uint32 "size"
- req->aParms[3].type = VMMDevHGCMParmType_32bit;
- req->aParms[3].u.value32 = *size;
+ vbox_hgcm_set_parameter_uint32(req, 3, *size);
// arg 4 in shflstring "path"
- req->aParms[4].type = VMMDevHGCMParmType_LinAddr;
- req->aParms[4].u.Pointer.size = shflstring_size_optional_in(path);
- req->aParms[4].u.Pointer.u.linearAddr = linear_addr(path);
+ vbox_hgcm_set_parameter_pointer(req, 4, shflstring_size_optional_in(path), path);
// arg 5 out void "dirinfo"
- req->aParms[5].type = VMMDevHGCMParmType_LinAddr;
- req->aParms[5].u.Pointer.size = *size;
- req->aParms[5].u.Pointer.u.linearAddr = linear_addr(dirinfo);
+ vbox_hgcm_set_parameter_pointer(req, 5, *size, dirinfo);
// arg 6 inout uint32 "resume_point"
- req->aParms[6].type = VMMDevHGCMParmType_32bit;
- req->aParms[6].u.value32 = *resume;
+ vbox_hgcm_set_parameter_uint32(req, 6, *resume);
// arg 7 out uint32 "count"
- req->aParms[7].type = VMMDevHGCMParmType_32bit;
- req->aParms[7].u.value32 = 0;
+ vbox_hgcm_set_parameter_uint32(req, 7, 0);
- vbox_send_request(vb->iobase, vb->dds.physicalAddress);
+ if ((err = vbox_hgcm_do_call_sync(vb, req)) < 0)
+ return err;
- if (req->header.header.rc < 0) {
- return req->header.header.rc;
- } else if (req->header.header.rc == VINF_HGCM_ASYNC_EXECUTE) {
- vbox_hgcm_wait(&req->header);
- }
+ *size = vbox_hgcm_get_parameter_uint32(req, 3);
+ *resume = vbox_hgcm_get_parameter_uint32(req, 6);
+ *count = vbox_hgcm_get_parameter_uint32(req, 7);
+
+ return req->header.result;
+}
+
+static vboxerr vbox_shfl_info(LPVBOXCOMM vb, hgcm_client_id_t client_id, SHFLROOT root, SHFLHANDLE handle,
+ unsigned flags, unsigned __far *size, void __far *buffer)
+{
+ VMMDevHGCMCall __far *req = (void __far *) vb->buf;
+ vboxerr err;
+
+ vbox_hgcm_init_call(req, client_id, SHFL_FN_INFORMATION, 5);
+
+ // arg 0 in uint32 "root"
+ vbox_hgcm_set_parameter_shflroot(req, 0, root);
+
+ // arg 1 in uint64 "handle"
+ vbox_hgcm_set_parameter_shflhandle(req, 1, handle);
+
+ // arg 2 in uint32 "flags"
+ vbox_hgcm_set_parameter_uint32(req, 2, flags);
- *size = req->aParms[3].u.value32;
- *resume = req->aParms[6].u.value32;
- *count = req->aParms[7].u.value32;
+ // arg 3 inout uint32 "size"
+ vbox_hgcm_set_parameter_uint32(req, 3, *size);
+
+ // arg 4 in void "buffer"
+ vbox_hgcm_set_parameter_pointer(req, 4, *size, buffer);
+
+ if ((err = vbox_hgcm_do_call_sync(vb, req)) < 0)
+ return err;
+
+ *size = vbox_hgcm_get_parameter_uint32(req, 3);
return req->header.result;
}
-static int32_t vbox_shfl_remove(LPVBOXCOMM vb, hgcm_client_id_t client_id, SHFLROOT root,
+static vboxerr vbox_shfl_remove(LPVBOXCOMM vb, hgcm_client_id_t client_id, SHFLROOT root,
const SHFLSTRING *path, unsigned flags)
{
VMMDevHGCMCall __far *req = (void __far *) vb->buf;
+ vboxerr err;
+
vbox_hgcm_init_call(req, client_id, SHFL_FN_REMOVE, 3);
// arg 0 in uint32 "root"
- req->aParms[0].type = VMMDevHGCMParmType_32bit;
- req->aParms[0].u.value32 = root;
+ vbox_hgcm_set_parameter_shflroot(req, 0, root);
// arg 1 in shflstring "path"
- req->aParms[1].type = VMMDevHGCMParmType_LinAddr;
- req->aParms[1].u.Pointer.size = shflstring_size_with_buf(path);
- req->aParms[1].u.Pointer.u.linearAddr = linear_addr(path);
+ vbox_hgcm_set_parameter_shflstring(req, 1, path);
// arg 2 in uint32 "flags"
- req->aParms[2].type = VMMDevHGCMParmType_32bit;
- req->aParms[2].u.value32 = flags;
-
- vbox_send_request(vb->iobase, vb->dds.physicalAddress);
+ vbox_hgcm_set_parameter_uint32(req, 2, flags);
- if (req->header.header.rc < 0) {
- return req->header.header.rc;
- } else if (req->header.header.rc == VINF_HGCM_ASYNC_EXECUTE) {
- vbox_hgcm_wait(&req->header);
- }
+ if ((err = vbox_hgcm_do_call_sync(vb, req)) < 0)
+ return err;
return req->header.result;
}
-static int32_t vbox_shfl_rename(LPVBOXCOMM vb, hgcm_client_id_t client_id, SHFLROOT root,
+static vboxerr vbox_shfl_rename(LPVBOXCOMM vb, hgcm_client_id_t client_id, SHFLROOT root,
const SHFLSTRING *src, const SHFLSTRING *dst, unsigned flags)
{
VMMDevHGCMCall __far *req = (void __far *) vb->buf;
+ vboxerr err;
+
vbox_hgcm_init_call(req, client_id, SHFL_FN_RENAME, 4);
// arg 0 in uint32 "root"
- req->aParms[0].type = VMMDevHGCMParmType_32bit;
- req->aParms[0].u.value32 = root;
+ vbox_hgcm_set_parameter_shflroot(req, 0, root);
// arg 1 in shflstring "src"
- req->aParms[1].type = VMMDevHGCMParmType_LinAddr;
- req->aParms[1].u.Pointer.size = shflstring_size_with_buf(src);
- req->aParms[1].u.Pointer.u.linearAddr = linear_addr(src);
+ vbox_hgcm_set_parameter_shflstring(req, 1, src);
// arg 2 in shflstring "dst"
- req->aParms[2].type = VMMDevHGCMParmType_LinAddr;
- req->aParms[2].u.Pointer.size = shflstring_size_with_buf(dst);
- req->aParms[2].u.Pointer.u.linearAddr = linear_addr(dst);
+ vbox_hgcm_set_parameter_shflstring(req, 2, dst);
// arg 3 in uint32 "flags"
- req->aParms[3].type = VMMDevHGCMParmType_32bit;
- req->aParms[3].u.value32 = flags;
+ vbox_hgcm_set_parameter_uint32(req, 3, flags);
- vbox_send_request(vb->iobase, vb->dds.physicalAddress);
-
- if (req->header.header.rc < 0) {
- return req->header.header.rc;
- } else if (req->header.header.rc == VINF_HGCM_ASYNC_EXECUTE) {
- vbox_hgcm_wait(&req->header);
- }
+ if ((err = vbox_hgcm_do_call_sync(vb, req)) < 0)
+ return err;
return req->header.result;
}
-static int32_t vbox_shfl_set_utf8(LPVBOXCOMM vb, hgcm_client_id_t client_id)
+static vboxerr vbox_shfl_set_utf8(LPVBOXCOMM vb, hgcm_client_id_t client_id)
{
VMMDevHGCMCall __far *req = (void __far *) vb->buf;
- vbox_hgcm_init_call(req, client_id, SHFL_FN_SET_UTF8, 0);
+ vboxerr err;
- vbox_send_request(vb->iobase, vb->dds.physicalAddress);
+ vbox_hgcm_init_call(req, client_id, SHFL_FN_SET_UTF8, 0);
- if (req->header.header.rc < 0) {
- return req->header.header.rc;
- } else if (req->header.header.rc == VINF_HGCM_ASYNC_EXECUTE) {
- vbox_hgcm_wait(&req->header);
- }
+ if ((err = vbox_hgcm_do_call_sync(vb, req)) < 0)
+ return err;
return req->header.result;
}
-static int32_t vbox_shfl_query_map_info(LPVBOXCOMM vb, hgcm_client_id_t client_id, SHFLROOT root,
+static vboxerr vbox_shfl_query_map_info(LPVBOXCOMM vb, hgcm_client_id_t client_id, SHFLROOT root,
SHFLSTRING *name, SHFLSTRING *mountPoint, unsigned *flags, unsigned *version)
{
VMMDevHGCMCall __far *req = (void __far *) vb->buf;
+ vboxerr err;
+
vbox_hgcm_init_call(req, client_id, SHFL_FN_QUERY_MAP_INFO, 5);
// arg 0 in uint32 "root"
- req->aParms[0].type = VMMDevHGCMParmType_32bit;
- req->aParms[0].u.value32 = root;
+ vbox_hgcm_set_parameter_shflroot(req, 0, root);
// arg 1 inout shflstring "name"
- req->aParms[1].type = VMMDevHGCMParmType_LinAddr;
- req->aParms[1].u.Pointer.size = shflstring_size_with_buf(name);
- req->aParms[1].u.Pointer.u.linearAddr = linear_addr(name);
+ vbox_hgcm_set_parameter_shflstring(req, 1, name);
// arg 2 inout shflstring "mountPoint"
- req->aParms[2].type = VMMDevHGCMParmType_LinAddr;
- req->aParms[2].u.Pointer.size = shflstring_size_with_buf(mountPoint);
- req->aParms[2].u.Pointer.u.linearAddr = linear_addr(mountPoint);
+ vbox_hgcm_set_parameter_shflstring(req, 2, mountPoint);
// arg 3 inout uint64 "flags"
- req->aParms[3].type = VMMDevHGCMParmType_64bit;
- req->aParms[3].u.value64 = *flags;
+ vbox_hgcm_set_parameter_uint64(req, 3, *flags);
// arg 4 out uint32 "version"
- req->aParms[4].type = VMMDevHGCMParmType_32bit;
- req->aParms[4].u.value32 = *version;
+ vbox_hgcm_set_parameter_uint32(req, 4, 0);
- vbox_send_request(vb->iobase, vb->dds.physicalAddress);
-
- if (req->header.header.rc < 0) {
- return req->header.header.rc;
- } else if (req->header.header.rc == VINF_HGCM_ASYNC_EXECUTE) {
- vbox_hgcm_wait(&req->header);
- }
+ if ((err = vbox_hgcm_do_call_sync(vb, req)) < 0)
+ return err;
- *flags = req->aParms[3].u.value64;
- *version = req->aParms[4].u.value32;
+ *flags = vbox_hgcm_get_parameter_uint64(req, 3);
+ *version = vbox_hgcm_get_parameter_uint32(req, 4);
return req->header.result;
}