Changeset 17858 in vbox for trunk/src/VBox/Additions/common/VBoxGuestLib
- Timestamp:
- Mar 13, 2009 9:51:35 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3Lib.cpp
r17196 r17858 78 78 79 79 80 static int vbglR3Init(char *pszDeviceName); 81 82 /** 83 * Open the VBox R3 Guest Library. This should be called by system daemons 84 * and processes. 85 */ 80 86 VBGLR3DECL(int) VbglR3Init(void) 87 { 88 return vbglR3Init(VBOXGUEST_DEVICE_NAME); 89 } 90 91 /** 92 * Open the VBox R3 Guest Library. Equivalent to VbglR3Init, but for user 93 * session processes. 94 */ 95 VBGLR3DECL(int) VbglR3InitUser(void) 96 { 97 return vbglR3Init(VBOXGUEST_USER_DEVICE_NAME); 98 } 99 100 /** 101 * Implementation of VbglR3Init and VbglR3InitUser 102 */ 103 int vbglR3Init(char *pszDeviceName) 81 104 { 82 105 uint32_t cInits = ASMAtomicIncU32(&g_cInits); … … 115 138 * and possible some other bits not availble thru iprt/file.h. 116 139 */ 117 HANDLE hFile = CreateFile( VBOXGUEST_DEVICE_NAME,140 HANDLE hFile = CreateFile(pszDeviceName, 118 141 GENERIC_READ | GENERIC_WRITE, 119 142 FILE_SHARE_READ | FILE_SHARE_WRITE, … … 135 158 HFILE hf = NULLHANDLE; 136 159 ULONG ulAction = 0; 137 APIRET rc = DosOpen((PCSZ) VBOXGUEST_DEVICE_NAME, &hf, &ulAction, 0, FILE_NORMAL,160 APIRET rc = DosOpen((PCSZ)pszDeviceName, &hf, &ulAction, 0, FILE_NORMAL, 138 161 OPEN_ACTION_OPEN_IF_EXISTS, 139 162 OPEN_FLAGS_FAIL_ON_ERROR | OPEN_FLAGS_NOINHERIT | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE, … … 188 211 # endif 189 212 int rc; 190 char szDevice[sizeof(VBOXGUEST_DEVICE_NAME) + 16]; 213 char szDevice[RT_MAX(sizeof(VBOXGUEST_DEVICE_NAME), 214 sizeof(VBOXGUEST_USER_DEVICE_NAME)) + 16]; 191 215 for (unsigned iUnit = 0; iUnit < 1024; iUnit++) 192 216 { 193 RTStrPrintf(szDevice, sizeof(szDevice), VBOXGUEST_DEVICE_NAME"%d", iUnit);217 RTStrPrintf(szDevice, sizeof(szDevice), pszDeviceName "%d", iUnit); 194 218 # if defined(VBOX_VBGLR3_XFREE86) 195 219 File = xf86open(szDevice, XF86_O_RDWR); … … 214 238 215 239 #elif defined(VBOX_VBGLR3_XFREE86) && !defined(RT_OS_FREEBSD) 216 int File = xf86open( VBOXGUEST_DEVICE_NAME, XF86_O_RDWR);240 int File = xf86open(pszDeviceName, XF86_O_RDWR); 217 241 if (File == -1) 218 242 return VERR_OPEN_FAILED; … … 223 247 /* The default implemenation. (linux, solaris) */ 224 248 RTFILE File; 225 int rc = RTFileOpen(&File, VBOXGUEST_DEVICE_NAME, RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);249 int rc = RTFileOpen(&File, pszDeviceName, RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE); 226 250 if (RT_FAILURE(rc)) 227 251 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.