Changeset 10476 in vbox for trunk/src/VBox/Additions/common/VBoxGuestLib
- Timestamp:
- Jul 10, 2008 4:09:21 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3Lib.cpp
r9140 r10476 61 61 #ifdef VBOX_VBGLR3_XFREE86 62 62 static int g_File = -1; 63 #elif defined(RT_OS_WINDOWS) 64 static HANDLE g_hFile = INVALID_HANDLE_VALUE; 63 65 #else 64 66 static RTFILE g_File = NIL_RTFILE; … … 85 87 * processed calling us more than once. 86 88 */ 87 #ifndef VBOX_VBGLR3_XFREE86 89 #ifndef RT_OS_WINDOWS 90 #ifndef VBOX_VBGLR3_XFREE86 88 91 if (g_File == NIL_RTFILE) 89 #else92 #else 90 93 if (g_File == -1) 91 #endif94 #endif 92 95 return VERR_INTERNAL_ERROR; 96 #else 97 if (g_hFile == NULL) 98 return VERR_INTERNAL_ERROR; 99 #endif 93 100 return VINF_SUCCESS; 94 101 } 95 #ifndef VBOX_VBGLR3_XFREE86 96 if (g_File != NIL_RTFILE) 97 #else 98 if (g_File != -1) 99 #endif 102 103 #ifndef RT_OS_WINDOWS 104 #ifndef VBOX_VBGLR3_XFREE86 105 if (g_File != NIL_RTFILE) 106 #else 107 if (g_File != -1) 108 #endif 109 return VERR_INTERNAL_ERROR; 110 #else 111 if (g_hFile != INVALID_HANDLE_VALUE) 100 112 return VERR_INTERNAL_ERROR; 113 #endif 101 114 102 115 #if defined(RT_OS_OS2) … … 192 205 g_File = File; 193 206 194 #else 195 /* the default implemenation. (linux, solaris) */ 207 #elif defined(RT_OS_WINDOWS) 208 209 /* 210 * Open a handle to the shadow device. 211 */ 212 g_hFile = CreateFile(VBOXGUEST_DEVICE_NAME, 213 GENERIC_READ | GENERIC_WRITE, 214 FILE_SHARE_READ | FILE_SHARE_WRITE, 215 NULL, 216 OPEN_EXISTING, 217 FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, 218 NULL); 219 220 if (g_hFile == INVALID_HANDLE_VALUE) 221 return VERR_OPEN_FAILED; 222 223 #else 224 225 /* The default implemenation. (linux, solaris) */ 196 226 RTFILE File; 197 227 int rc = RTFileOpen(&File, VBOXGUEST_DEVICE_NAME, RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE); … … 223 253 if (cInits > 0) 224 254 return; 225 #ifndef VBOX_VBGLR3_XFREE86 226 AssertReturnVoid(!cInits); 227 RTFILE File = g_File; 228 g_File = NIL_RTFILE; 229 AssertReturnVoid(File != NIL_RTFILE); 230 231 #else 232 int File = g_File; 233 g_File = -1; 234 if (File == -1) 235 return; 255 #ifndef RT_OS_WINDOWS 256 #ifndef VBOX_VBGLR3_XFREE86 257 AssertReturnVoid(!cInits); 258 RTFILE File = g_File; 259 g_File = NIL_RTFILE; 260 AssertReturnVoid(File != NIL_RTFILE); 261 #else 262 int File = g_File; 263 g_File = -1; 264 if (File == -1) 265 return; 266 #endif 267 #else 268 /* Nothing to do here yet. */ 269 236 270 #endif 237 271 … … 243 277 xf86close(File); 244 278 File = -1; 279 280 #elif defined(RT_OS_WINDOWS) 281 if (INVALID_HANDLE_VALUE != g_hFile) 282 { 283 CloseHandle (g_hFile); 284 g_hFile = INVALID_HANDLE_VALUE; 285 } 245 286 246 287 #else … … 293 334 return VINF_SUCCESS; 294 335 336 #elif defined(RT_OS_WINDOWS) 337 338 DWORD cbReturned = 0; 339 if (FALSE == DeviceIoControl(g_hFile, iFunction, pvData, cbData, 340 pvData, cbData, &cbReturned, NULL)) 341 return GetLastError(); /* @todo Add better error lookup. */ 342 343 return VINF_SUCCESS; 344 295 345 #elif defined(VBOX_VBGLR3_XFREE86) 296 346 /* PORTME - This is preferred over the RTFileIOCtl variant below, just be careful with the (int). */
Note:
See TracChangeset
for help on using the changeset viewer.