Changeset 13868 in vbox for trunk/include/VBox
- Timestamp:
- Nov 5, 2008 2:34:45 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/hgcmsvc.h
r13378 r13868 34 34 #include <VBox/cdefs.h> 35 35 #include <VBox/types.h> 36 #include <VBox/err.h> 36 37 37 38 /** @todo proper comments. */ … … 103 104 } pointer; 104 105 } u; 106 #ifdef __cplusplus 107 /** Extract a uint32_t value from an HGCM parameter structure */ 108 int getUInt32 (uint32_t *u32) 109 { 110 int rc = VINF_SUCCESS; 111 if (type != VBOX_HGCM_SVC_PARM_64BIT) 112 rc = VERR_INVALID_PARAMETER; 113 if (RT_SUCCESS(rc)) 114 *u32 = u.uint32; 115 return rc; 116 } 117 118 /** Extract a uint64_t value from an HGCM parameter structure */ 119 int getUInt64 (uint64_t *u64) 120 { 121 int rc = VINF_SUCCESS; 122 if (type != VBOX_HGCM_SVC_PARM_64BIT) 123 rc = VERR_INVALID_PARAMETER; 124 if (RT_SUCCESS(rc)) 125 *u64 = u.uint64; 126 return rc; 127 } 128 129 /** Extract a pointer value from an HGCM parameter structure */ 130 int getPointer (void **ppv, uint32_t *pcb) 131 { 132 if (type == VBOX_HGCM_SVC_PARM_PTR) 133 { 134 *ppv = u.pointer.addr; 135 *pcb = u.pointer.size; 136 return VINF_SUCCESS; 137 } 138 139 return VERR_INVALID_PARAMETER; 140 } 141 142 /** Extract a constant pointer value from an HGCM parameter structure */ 143 int getPointer (const void **ppv, uint32_t *pcb) 144 { 145 if (type == VBOX_HGCM_SVC_PARM_PTR) 146 { 147 *ppv = u.pointer.addr; 148 *pcb = u.pointer.size; 149 return VINF_SUCCESS; 150 } 151 152 return VERR_INVALID_PARAMETER; 153 } 154 155 /** Set a uint32_t value to an HGCM parameter structure */ 156 void setUInt32(uint32_t u32) 157 { 158 type = VBOX_HGCM_SVC_PARM_32BIT; 159 u.uint32 = u32; 160 } 161 162 /** Set a uint64_t value to an HGCM parameter structure */ 163 void setUInt64(uint64_t u64) 164 { 165 type = VBOX_HGCM_SVC_PARM_64BIT; 166 u.uint64 = u64; 167 } 168 169 /** Set a pointer value to an HGCM parameter structure */ 170 void setPointer(void *pv, uint32_t cb) 171 { 172 type = VBOX_HGCM_SVC_PARM_PTR; 173 u.pointer.addr = pv; 174 u.pointer.size = cb; 175 } 176 177 VBOXHGCMSVCPARM() : type(VBOX_HGCM_SVC_PARM_INVALID) {} 178 #endif 105 179 } VBOXHGCMSVCPARM; 106 180
Note:
See TracChangeset
for help on using the changeset viewer.