Changeset 34357 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Nov 25, 2010 10:24:41 AM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 68120
- Location:
- trunk/src/VBox/Additions/WINNT
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Installer/InstallHelper/VBoxGuestInstallHelper.cpp
r34117 r34357 146 146 VBOXTRAYIPCHEADER hdr; 147 147 hdr.ulMsg = VBOXTRAYIPCMSGTYPE_SHOWBALLOONMSG; 148 hdr.cbBody = sizeof(VBOXTRAYIPCMSG_SHOWBALLOONMSG); 148 149 149 150 VBOXTRAYIPCMSG_SHOWBALLOONMSG msg; 150 HRESULT hr = VBoxPopString(msg.sz Body, sizeof(msg.szBody) / sizeof(TCHAR));151 HRESULT hr = VBoxPopString(msg.szContent, sizeof(msg.szContent) / sizeof(TCHAR)); 151 152 if (SUCCEEDED(hr)) 152 153 hr = VBoxPopString(msg.szTitle, sizeof(msg.szTitle) / sizeof(TCHAR)); -
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxIPC.cpp
r34117 r34357 26 26 #include <VBoxGuestInternal.h> 27 27 28 28 29 typedef struct _VBOXIPCCONTEXT 29 30 { … … 35 36 static VBOXIPCCONTEXT gCtx = {0}; 36 37 38 39 /** 40 * Reads an IPC message from a connected client, represented by the IPC 41 * context. 42 * 43 * @return IPRT status code. 44 * @param pCtx The IPC context. 45 * @param pMessage Buffer for receiving the message to be read. 46 * @param cbMessage Size (in bytes) of buffer for received message. 47 */ 37 48 int VBoxIPCReadMessage(PVBOXIPCCONTEXT pCtx, BYTE *pMessage, DWORD cbMessage) 38 49 { … … 57 68 } 58 69 70 /** 71 * Skips an IPC message by reading out the outstanding message 72 * body to discard it. 73 * 74 * @return IPRT status code. 75 * @param pCtx The IPC context. 76 * @param pHdr The header of message to skip. 77 */ 78 int VBoxIPCSkipMessage(PVBOXIPCCONTEXT pCtx, PVBOXTRAYIPCHEADER pHdr) 79 { 80 Assert(pHdr->cbBody); 81 BYTE *pbBuf = (BYTE*)RTMemAlloc(pHdr->cbBody); 82 if (!pbBuf) 83 return VERR_NO_MEMORY; 84 int rc = VBoxIPCReadMessage(pCtx, pbBuf, pHdr->cbBody); 85 RTMemFree(pbBuf); 86 return rc; 87 } 88 89 /** 90 * Writes an IPC message to the IPC context's client. 91 * 92 * @return IPRT status code. 93 * @param pCtx The IPC context. 94 * @param pMessage Pointer to message to send. 95 * @param cbMessage Size (in bytes) of message to send. 96 */ 59 97 int VBoxIPCWriteMessage(PVBOXIPCCONTEXT pCtx, BYTE *pMessage, DWORD cbMessage) 60 98 { … … 82 120 * 83 121 * @return IPRT status code. 84 * @param pCtx 85 * @param wParam 86 * @param lParam 122 * @param pCtx IPC context of the caller. 123 * @param wParam wParam of received IPC message. 124 * @param lParam lParam of received IPC message. 87 125 */ 88 126 int VBoxIPCMsgShowBalloonMsg(PVBOXIPCCONTEXT pCtx, UINT wParam, UINT lParam) … … 93 131 { 94 132 hlpShowBalloonTip(gInstance, gToolWindow, ID_TRAYICON, 95 msg.sz Body, msg.szTitle,133 msg.szContent, msg.szTitle, 96 134 msg.ulShowMS, msg.ulType); 97 135 } … … 99 137 } 100 138 139 /** 140 * Takes action to restart VBoxTray (this application). 141 * 142 * @return IPRT status code. 143 * @param pCtx IPC context of the caller. 144 * @param wParam wParam of received IPC message. 145 * @param lParam lParam of received IPC message. 146 */ 147 int VBoxIPCMsgRestart(PVBOXIPCCONTEXT pCtx, UINT wParam, UINT lParam) 148 { 149 return 0; 150 } 151 152 /** 153 * Initializes the IPC communication. 154 * 155 * @return IPRT status code. 156 * @param pEnv The IPC service's environment. 157 * @param ppInstance The instance pointer which refer to this object. 158 * @param pfStartThread Pointer to flag whether the IPC service can be started or not. 159 */ 101 160 int VBoxIPCInit(const VBOXSERVICEENV *pEnv, void **ppInstance, bool *pfStartThread) 102 161 { … … 203 262 if (SUCCEEDED(dwErr)) 204 263 { 264 Log(("VBoxTray: VBoxIPCThread: Received message %ld ...\n", hdr.ulMsg)); 205 265 switch (hdr.ulMsg) 206 266 { 267 case VBOXTRAYIPCMSGTYPE_QUIT: 268 fTerminate = true; 269 break; 270 271 case VBOXTRAYIPCMSGTYPE_RESTART: 272 rc = VBoxIPCMsgRestart(pCtx, hdr.wParam, hdr.lParam); 273 if (RT_SUCCESS(rc)) 274 fTerminate = true; 275 break; 276 207 277 case VBOXTRAYIPCMSGTYPE_SHOWBALLOONMSG: 208 278 rc = VBoxIPCMsgShowBalloonMsg(pCtx, hdr.wParam, hdr.lParam); 209 279 break; 210 280 211 /* Someone asked us to quit ... */212 case VBOXTRAYIPCMSGTYPE_QUIT:213 fTerminate = true;214 break;215 216 281 default: 282 /* Unknown message received, try to receive the body and 283 * just skip it. */ 284 Log(("VBoxTray: VBoxIPCThread: Unknown message %ld, skipping ...\n", hdr.ulMsg)); 285 if (hdr.cbBody) 286 rc = VBoxIPCSkipMessage(pCtx, &hdr); 217 287 break; 218 288 } … … 227 297 /* Sleep a bit to not eat too much CPU in case the above call always fails. */ 228 298 if (WaitForSingleObject(pCtx->pEnv->hStopEvent, 10) == WAIT_OBJECT_0) 229 {230 299 fTerminate = true; 231 break;232 }300 if (fTerminate) 301 Log(("VBoxTray: VBoxIPCThread: Terminating ...\n")); 233 302 } while (!fTerminate); 234 303 -
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxTrayMsg.h
r34117 r34357 26 26 /** Asks the IPC thread to quit. */ 27 27 VBOXTRAYIPCMSGTYPE_QUIT = 10, 28 /** TODO */ 28 /** Restarts VBoxTray. */ 29 VBOXTRAYIPCMSGTYPE_RESTART = 11, 30 /** Shows a balloon message in the tray area. */ 29 31 VBOXTRAYIPCMSGTYPE_SHOWBALLOONMSG = 100 30 32 }; … … 35 37 /** Message type. */ 36 38 ULONG ulMsg; 39 /** Size of message body 40 * (without this header). */ 41 ULONG cbBody; 37 42 /** User-supplied wParam. */ 38 43 ULONG wParam; … … 43 48 typedef struct _VBOXTRAYIPCMSG_SHOWBALLOONMSG 44 49 { 45 /** Message body. */46 TCHAR sz Body[256];47 /** Message body. */50 /** Message content. */ 51 TCHAR szContent[256]; 52 /** Message title. */ 48 53 TCHAR szTitle[64]; 49 54 /** Message type. */
Note:
See TracChangeset
for help on using the changeset viewer.