Changeset 47234 in vbox for trunk/src/VBox/Additions/WINNT/VBoxTray
- Timestamp:
- Jul 18, 2013 3:36:30 PM (11 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/VBoxTray
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxIPC.cpp
r47232 r47234 295 295 rc = RTLocalIpcSessionRead(hSession, &ipcHdr, sizeof(ipcHdr), 296 296 NULL /* Exact read, blocking */); 297 bool fRejected = false; 298 if (RT_SUCCESS(rc)) 299 fRejected = ipcHdr.uMagic != VBOXTRAY_IPC_HDR_MAGIC; 300 297 301 if (RT_SUCCESS(rc)) 298 302 { … … 313 317 default: 314 318 { 315 static int s_cRejectedCmds = 0; 316 if (++s_cRejectedCmds <= 3) 317 { 318 LogRelFunc(("Session %p: Received unknown command %RU32 (%RU32 bytes), rejecting (%RU32/3)\n", 319 pThis, ipcHdr.uMsgType, ipcHdr.uMsgLen, s_cRejectedCmds + 1)); 320 if (ipcHdr.uMsgLen) 321 { 322 /* Get and discard payload data. */ 323 size_t cbRead; 324 uint8_t devNull[_1K]; 325 while (ipcHdr.uMsgLen) 326 { 327 rc = RTLocalIpcSessionRead(hSession, &devNull, sizeof(devNull), &cbRead); 328 if (RT_FAILURE(rc)) 329 break; 330 AssertRelease(cbRead <= ipcHdr.uMsgLen); 331 ipcHdr.uMsgLen -= (uint32_t)cbRead; 332 } 333 } 334 } 335 else 336 rc = VERR_INVALID_PARAMETER; /* Enough fun, bail out. */ 319 /* Unknown command, reject. */ 320 fRejected = true; 337 321 break; 338 322 } 339 340 if (RT_FAILURE(rc))341 LogFunc(("Session %p: Handling command %RU32 failed with rc=%Rrc\n",342 pThis, ipcHdr.uMsgType, rc));343 323 } 324 325 if (RT_FAILURE(rc)) 326 LogFunc(("Session %p: Handling command %RU32 failed with rc=%Rrc\n", 327 pThis, ipcHdr.uMsgType, rc)); 328 } 329 330 if (fRejected) 331 { 332 static int s_cRejectedCmds = 0; 333 if (++s_cRejectedCmds <= 3) 334 { 335 LogRelFunc(("Session %p: Received invalid/unknown command %RU32 (%RU32 bytes), rejecting (%RU32/3)\n", 336 pThis, ipcHdr.uMsgType, ipcHdr.uMsgLen, s_cRejectedCmds + 1)); 337 if (ipcHdr.uMsgLen) 338 { 339 /* Get and discard payload data. */ 340 size_t cbRead; 341 uint8_t devNull[_1K]; 342 while (ipcHdr.uMsgLen) 343 { 344 rc = RTLocalIpcSessionRead(hSession, &devNull, sizeof(devNull), &cbRead); 345 if (RT_FAILURE(rc)) 346 break; 347 AssertRelease(cbRead <= ipcHdr.uMsgLen); 348 ipcHdr.uMsgLen -= (uint32_t)cbRead; 349 } 350 } 351 } 352 else 353 rc = VERR_INVALID_PARAMETER; /* Enough fun, bail out. */ 344 354 } 345 355 } -
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxTrayMsg.h
r47232 r47234 19 19 #define ___VBOXTRAY_MSG_H 20 20 21 /** The IPC pipe's prefix. Will be followed by the 22 * username VBoxTray runs under. */ 21 23 #define VBOXTRAY_IPC_PIPE_PREFIX "VBoxTrayIPC-" 24 /** The IPC header's magic. */ 25 #define VBOXTRAY_IPC_HDR_MAGIC 0x19840804 22 26 23 27 enum VBOXTRAYIPCMSGTYPE … … 37 41 typedef struct VBOXTRAYIPCHEADER 38 42 { 39 /** @todo Add magic? */ 43 /** The header's magic. */ 44 uint32_t uMagic; 40 45 /** Header version, must be 0 by now. */ 41 46 uint32_t uHdrVersion;
Note:
See TracChangeset
for help on using the changeset viewer.