Changeset 85694 in vbox for trunk/src/VBox/Additions/WINNT/VBoxTray
- Timestamp:
- Aug 11, 2020 4:30:25 PM (4 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/VBoxTray
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDnD.cpp
r85472 r85694 91 91 92 92 VBoxDnDWnd::VBoxDnDWnd(void) 93 : hThread(NIL_RTTHREAD),94 m EventSem(NIL_RTSEMEVENT),95 hWnd(NULL),96 dndLstActionsAllowed(VBOX_DND_ACTION_IGNORE),97 m fMouseButtonDown(false),93 : m_hThread(NIL_RTTHREAD), 94 m_EvtSem(NIL_RTSEMEVENT), 95 m_hWnd(NULL), 96 m_lstActionsAllowed(VBOX_DND_ACTION_IGNORE), 97 m_fMouseButtonDown(false), 98 98 #ifdef VBOX_WITH_DRAG_AND_DROP_GH 99 pDropTarget(NULL),99 m_pDropTarget(NULL), 100 100 #endif 101 m Mode(Unknown),102 m State(Uninitialized)103 { 104 RT_ZERO( startupInfo);101 m_enmMode(Unknown), 102 m_enmState(Uninitialized) 103 { 104 RT_ZERO(m_startupInfo); 105 105 106 106 LogFlowFunc(("Supported formats:\n")); … … 109 109 { 110 110 LogFlowFunc(("\t%s\n", arrEntries[i].c_str())); 111 this-> lstFmtSup.append(arrEntries[i]);111 this->m_lstFmtSup.append(arrEntries[i]); 112 112 } 113 113 } … … 129 129 130 130 /* Save the context. */ 131 this-> pCtx = a_pCtx;132 133 int rc = RTSemEventCreate(&m EventSem);131 this->m_pCtx = a_pCtx; 132 133 int rc = RTSemEventCreate(&m_EvtSem); 134 134 if (RT_SUCCESS(rc)) 135 rc = RTCritSectInit(&m CritSect);135 rc = RTCritSectInit(&m_CritSect); 136 136 137 137 if (RT_SUCCESS(rc)) 138 138 { 139 139 /* Message pump thread for our proxy window. */ 140 rc = RTThreadCreate(& hThread, VBoxDnDWnd::Thread, this,140 rc = RTThreadCreate(&m_hThread, VBoxDnDWnd::Thread, this, 141 141 0, RTTHREADTYPE_MSG_PUMP, RTTHREADFLAGS_WAITABLE, 142 142 "dndwnd"); /** @todo Include ID if there's more than one proxy window. */ 143 143 if (RT_SUCCESS(rc)) 144 144 { 145 int rc2 = RTThreadUserWait( hThread, 30 * 1000 /* Timeout in ms */);145 int rc2 = RTThreadUserWait(m_hThread, 30 * 1000 /* Timeout in ms */); 146 146 AssertRC(rc2); 147 147 … … 164 164 void VBoxDnDWnd::Destroy(void) 165 165 { 166 if ( hThread != NIL_RTTHREAD)166 if (m_hThread != NIL_RTTHREAD) 167 167 { 168 168 int rcThread = VERR_WRONG_ORDER; 169 int rc = RTThreadWait( hThread, 60 * 1000 /* Timeout in ms */, &rcThread);169 int rc = RTThreadWait(m_hThread, 60 * 1000 /* Timeout in ms */, &rcThread); 170 170 LogFlowFunc(("Waiting for thread resulted in %Rrc (thread exited with %Rrc)\n", 171 171 rc, rcThread)); … … 175 175 Reset(); 176 176 177 RTCritSectDelete(&m CritSect);178 if (m EventSem != NIL_RTSEMEVENT)179 { 180 RTSemEventDestroy(m EventSem);181 m EventSem = NIL_RTSEMEVENT;182 } 183 184 if ( pCtx->wndClass != 0)185 { 186 UnregisterClass(VBOX_DND_WND_CLASS, pCtx->pEnv->hInstance);187 pCtx->wndClass = 0;177 RTCritSectDelete(&m_CritSect); 178 if (m_EvtSem != NIL_RTSEMEVENT) 179 { 180 RTSemEventDestroy(m_EvtSem); 181 m_EvtSem = NIL_RTSEMEVENT; 182 } 183 184 if (m_pCtx->wndClass != 0) 185 { 186 UnregisterClass(VBOX_DND_WND_CLASS, m_pCtx->pEnv->hInstance); 187 m_pCtx->wndClass = 0; 188 188 } 189 189 … … 199 199 * is using the thread. 200 200 */ 201 /*static*/ DECLCALLBACK(int) VBoxDnDWnd::Thread(RTTHREAD hThread, void *pvUser)201 /*static*/ DECLCALLBACK(int) VBoxDnDWnd::Thread(RTTHREAD m_hThread, void *pvUser) 202 202 { 203 203 AssertPtrReturn(pvUser, VERR_INVALID_POINTER); … … 208 208 AssertPtr(pThis); 209 209 210 PVBOXDNDCONTEXT pCtx = pThis->pCtx;211 AssertPtr( pCtx);212 AssertPtr( pCtx->pEnv);210 PVBOXDNDCONTEXT m_pCtx = pThis->m_pCtx; 211 AssertPtr(m_pCtx); 212 AssertPtr(m_pCtx->pEnv); 213 213 214 214 int rc = VINF_SUCCESS; 215 215 216 AssertPtr( pCtx->pEnv);217 HINSTANCE hInstance = pCtx->pEnv->hInstance;216 AssertPtr(m_pCtx->pEnv); 217 HINSTANCE hInstance = m_pCtx->pEnv->hInstance; 218 218 Assert(hInstance != 0); 219 219 … … 250 250 dwStyle |= WS_VISIBLE; /* Make the window visible. */ 251 251 #endif 252 pThis-> hWnd = CreateWindowEx(dwExStyle,252 pThis->m_hWnd = CreateWindowEx(dwExStyle, 253 253 VBOX_DND_WND_CLASS, VBOX_DND_WND_CLASS, 254 254 dwStyle, … … 259 259 #endif 260 260 hInstance, pThis /* lParm */); 261 if (!pThis-> hWnd)261 if (!pThis->m_hWnd) 262 262 { 263 263 DWORD dwErr = GetLastError(); … … 268 268 { 269 269 #ifndef VBOX_DND_DEBUG_WND 270 SetWindowPos(pThis-> hWnd, HWND_TOPMOST, -200, -200, 0, 0,270 SetWindowPos(pThis->m_hWnd, HWND_TOPMOST, -200, -200, 0, 0, 271 271 SWP_NOACTIVATE | SWP_HIDEWINDOW 272 272 | SWP_NOCOPYBITS | SWP_NOREDRAW | SWP_NOSIZE); 273 LogFlowFunc(("Proxy window created, hWnd=0x%x\n", pThis-> hWnd));273 LogFlowFunc(("Proxy window created, hWnd=0x%x\n", pThis->m_hWnd)); 274 274 #else 275 LogFlowFunc(("Debug proxy window created, hWnd=0x%x\n", pThis-> hWnd));275 LogFlowFunc(("Debug proxy window created, hWnd=0x%x\n", pThis->m_hWnd)); 276 276 277 277 /* … … 282 282 me.cbSize = sizeof(TRACKMOUSEEVENT); 283 283 me.dwFlags = TME_HOVER | TME_LEAVE | TME_NONCLIENT; 284 me.hwndTrack = pThis-> hWnd;284 me.hwndTrack = pThis->m_hWnd; 285 285 BOOL fRc = TrackMouseEvent(&me); 286 286 Assert(fRc); … … 303 303 304 304 if (RT_SUCCESS(rc)) 305 pCtx->fStarted = true; /* Set started indicator on success. */306 307 int rc2 = RTThreadUserSignal( hThread);305 m_pCtx->fStarted = true; /* Set started indicator on success. */ 306 307 int rc2 = RTThreadUserSignal(m_hThread); 308 308 bool fSignalled = RT_SUCCESS(rc2); 309 309 … … 322 322 Assert(fRet >= 0); 323 323 324 if (ASMAtomicReadBool(& pCtx->fShutdown))324 if (ASMAtomicReadBool(&m_pCtx->fShutdown)) 325 325 fShutdown = true; 326 326 … … 344 344 if (!fSignalled) 345 345 { 346 rc2 = RTThreadUserSignal( hThread);346 rc2 = RTThreadUserSignal(m_hThread); 347 347 AssertRC(rc2); 348 348 } … … 425 425 { 426 426 LogFlowThisFunc(("WM_LBUTTONDOWN\n")); 427 m fMouseButtonDown = true;427 m_fMouseButtonDown = true; 428 428 return 0; 429 429 } … … 432 432 { 433 433 LogFlowThisFunc(("WM_LBUTTONUP\n")); 434 m fMouseButtonDown = false;434 m_fMouseButtonDown = false; 435 435 436 436 /* As the mouse button was released, Hide the proxy window again. … … 454 454 { 455 455 LogFlowThisFunc(("WM_MOUSEMOVE: mfMouseButtonDown=%RTbool, mMode=%ld, mState=%ld\n", 456 m fMouseButtonDown, mMode,mState));456 m_fMouseButtonDown, m_enmMode, m_enmState)); 457 457 #ifdef DEBUG_andy 458 458 POINT p; … … 461 461 #endif 462 462 int rc = VINF_SUCCESS; 463 if (m Mode == HG) /* Host to guest. */463 if (m_enmMode == HG) /* Host to guest. */ 464 464 { 465 465 /* Dragging not started yet? Kick it off ... */ 466 if ( m fMouseButtonDown467 && (m State != Dragging))466 if ( m_fMouseButtonDown 467 && (m_enmState != Dragging)) 468 468 { 469 m State = Dragging;469 m_enmState = Dragging; 470 470 #if 0 471 471 /* Delay hiding the proxy window a bit when debugging, to see … … 476 476 477 477 LogFlowThisFunc(("Starting drag and drop: dndLstActionsAllowed=0x%x, dwOKEffects=0x%x ...\n", 478 dndLstActionsAllowed,startupInfo.dwOKEffects));479 480 AssertPtr( startupInfo.pDataObject);481 AssertPtr( startupInfo.pDropSource);478 m_lstActionsAllowed, m_startupInfo.dwOKEffects)); 479 480 AssertPtr(m_startupInfo.pDataObject); 481 AssertPtr(m_startupInfo.pDropSource); 482 482 DWORD dwEffect; 483 HRESULT hr = DoDragDrop( startupInfo.pDataObject,startupInfo.pDropSource,484 startupInfo.dwOKEffects, &dwEffect);483 HRESULT hr = DoDragDrop(m_startupInfo.pDataObject, m_startupInfo.pDropSource, 484 m_startupInfo.dwOKEffects, &dwEffect); 485 485 LogFlowThisFunc(("hr=%Rhrc, dwEffect=%RI32\n", hr, dwEffect)); 486 486 switch (hr) 487 487 { 488 488 case DRAGDROP_S_DROP: 489 m State = Dropped;489 m_enmState = Dropped; 490 490 break; 491 491 492 492 case DRAGDROP_S_CANCEL: 493 m State = Canceled;493 m_enmState = Canceled; 494 494 break; 495 495 496 496 default: 497 497 LogFlowThisFunc(("Drag and drop failed with %Rhrc\n", hr)); 498 m State = Canceled;498 m_enmState = Canceled; 499 499 rc = VERR_GENERAL_FAILURE; /** @todo Find a better status code. */ 500 500 break; 501 501 } 502 502 503 int rc2 = RTCritSectEnter(&m CritSect);503 int rc2 = RTCritSectEnter(&m_CritSect); 504 504 if (RT_SUCCESS(rc2)) 505 505 { 506 startupInfo.pDropSource->Release();507 startupInfo.pDataObject->Release();508 509 RT_ZERO( startupInfo);510 511 rc2 = RTCritSectLeave(&m CritSect);506 m_startupInfo.pDropSource->Release(); 507 m_startupInfo.pDataObject->Release(); 508 509 RT_ZERO(m_startupInfo); 510 511 rc2 = RTCritSectLeave(&m_CritSect); 512 512 if (RT_SUCCESS(rc)) 513 513 rc = rc2; 514 514 } 515 515 516 m Mode = Unknown;516 m_enmMode = Unknown; 517 517 } 518 518 } 519 else if (m Mode == GH) /* Guest to host. */519 else if (m_enmMode == GH) /* Guest to host. */ 520 520 { 521 521 /* Starting here VBoxDnDDropTarget should … … 527 527 528 528 LogFlowThisFunc(("WM_MOUSEMOVE: mMode=%ld, mState=%ld, rc=%Rrc\n", 529 m Mode,mState, rc));529 m_enmMode, m_enmState, rc)); 530 530 return 0; 531 531 } … … 674 674 int VBoxDnDWnd::RegisterAsDropTarget(void) 675 675 { 676 if ( pDropTarget) /* Already registered as drop target? */676 if (m_pDropTarget) /* Already registered as drop target? */ 677 677 return VINF_SUCCESS; 678 678 … … 680 680 try 681 681 { 682 pDropTarget = new VBoxDnDDropTarget(this /* pParent */);683 HRESULT hr = CoLockObjectExternal( pDropTarget, TRUE /* fLock */,682 m_pDropTarget = new VBoxDnDDropTarget(this /* pParent */); 683 HRESULT hr = CoLockObjectExternal(m_pDropTarget, TRUE /* fLock */, 684 684 FALSE /* fLastUnlockReleases */); 685 685 if (SUCCEEDED(hr)) 686 hr = RegisterDragDrop( hWnd,pDropTarget);686 hr = RegisterDragDrop(m_hWnd, m_pDropTarget); 687 687 688 688 if (FAILED(hr)) … … 715 715 LogFlowFuncEnter(); 716 716 717 if (! pDropTarget) /* No drop target? Bail out. */717 if (!m_pDropTarget) /* No drop target? Bail out. */ 718 718 return VINF_SUCCESS; 719 719 720 HRESULT hr = RevokeDragDrop( hWnd);720 HRESULT hr = RevokeDragDrop(m_hWnd); 721 721 if (SUCCEEDED(hr)) 722 hr = CoLockObjectExternal( pDropTarget, FALSE /* fLock */,722 hr = CoLockObjectExternal(m_pDropTarget, FALSE /* fLock */, 723 723 TRUE /* fLastUnlockReleases */); 724 724 if (SUCCEEDED(hr)) 725 725 { 726 ULONG cRefs = pDropTarget->Release();726 ULONG cRefs = m_pDropTarget->Release(); 727 727 Assert(cRefs == 0); NOREF(cRefs); 728 pDropTarget = NULL;728 m_pDropTarget = NULL; 729 729 } 730 730 … … 745 745 { 746 746 LogFlowFuncEnter(); 747 int rc = VbglR3DnDConnect(&m DnDCtx);747 int rc = VbglR3DnDConnect(&m_cmdCtx); 748 748 if (RT_FAILURE(rc)) 749 749 { … … 752 752 } 753 753 754 LogFlowThisFunc(("Client ID=%RU32, rc=%Rrc\n", m DnDCtx.uClientID, rc));754 LogFlowThisFunc(("Client ID=%RU32, rc=%Rrc\n", m_cmdCtx.uClientID, rc)); 755 755 return rc; 756 756 } … … 761 761 void VBoxDnDWnd::OnDestroy(void) 762 762 { 763 DestroyWindow( hWnd);764 765 VbglR3DnDDisconnect(&m DnDCtx);763 DestroyWindow(m_hWnd); 764 765 VbglR3DnDDisconnect(&m_cmdCtx); 766 766 LogFlowThisFuncLeave(); 767 767 } … … 774 774 int VBoxDnDWnd::Abort(void) 775 775 { 776 LogFlowThisFunc(("mMode=%ld, mState=%RU32\n", m Mode,mState));776 LogFlowThisFunc(("mMode=%ld, mState=%RU32\n", m_enmMode, m_enmState)); 777 777 LogRel(("DnD: Drag and drop operation aborted\n")); 778 778 779 int rc = RTCritSectEnter(&m CritSect);779 int rc = RTCritSectEnter(&m_CritSect); 780 780 if (RT_SUCCESS(rc)) 781 781 { 782 if ( startupInfo.pDataObject)783 startupInfo.pDataObject->Abort();784 785 RTCritSectLeave(&m CritSect);782 if (m_startupInfo.pDataObject) 783 m_startupInfo.pDataObject->Abort(); 784 785 RTCritSectLeave(&m_CritSect); 786 786 } 787 787 … … 805 805 int VBoxDnDWnd::OnHgEnter(const RTCList<RTCString> &a_lstFormats, VBOXDNDACTIONLIST a_fDndLstActionsAllowed) 806 806 { 807 if (m Mode == GH) /* Wrong mode? Bail out. */807 if (m_enmMode == GH) /* Wrong mode? Bail out. */ 808 808 return VERR_WRONG_ORDER; 809 809 … … 826 826 { 827 827 /* Save all allowed actions. */ 828 this-> dndLstActionsAllowed = a_fDndLstActionsAllowed;828 this->m_lstActionsAllowed = a_fDndLstActionsAllowed; 829 829 830 830 /* 831 831 * Check if reported formats from host are compatible with this client. 832 832 */ 833 size_t cFormatsSup = this-> lstFmtSup.size();833 size_t cFormatsSup = this->m_lstFmtSup.size(); 834 834 ULONG cFormatsActive = 0; 835 835 … … 844 844 { 845 845 bool fSupported = false; 846 for (size_t a = 0; a < this-> lstFmtSup.size(); a++)846 for (size_t a = 0; a < this->m_lstFmtSup.size(); a++) 847 847 { 848 848 const char *pszFormat = a_lstFormats.at(i).c_str(); 849 LogFlowThisFunc(("\t\"%s\" <=> \"%s\"\n", this-> lstFmtSup.at(a).c_str(), pszFormat));850 851 fSupported = RTStrICmp(this-> lstFmtSup.at(a).c_str(), pszFormat) == 0;849 LogFlowThisFunc(("\t\"%s\" <=> \"%s\"\n", this->m_lstFmtSup.at(a).c_str(), pszFormat)); 850 851 fSupported = RTStrICmp(this->m_lstFmtSup.at(a).c_str(), pszFormat) == 0; 852 852 if (fSupported) 853 853 { 854 this-> lstFmtActive.append(a_lstFormats.at(i));854 this->m_lstFmtActive.append(a_lstFormats.at(i)); 855 855 856 856 /** @todo Put this into a \#define / struct. */ … … 900 900 LogRel2(("DnD: %RU32 supported formats found:\n", cFormatsActive)); 901 901 for (size_t i = 0; i < cFormatsActive; i++) 902 LogRel2(("DnD: \t%s\n", this-> lstFmtActive.at(i).c_str()));902 LogRel2(("DnD: \t%s\n", this->m_lstFmtActive.at(i).c_str())); 903 903 } 904 904 else … … 910 910 911 911 /* Translate our drop actions into allowed Windows drop effects. */ 912 startupInfo.dwOKEffects = DROPEFFECT_NONE;912 m_startupInfo.dwOKEffects = DROPEFFECT_NONE; 913 913 if (a_fDndLstActionsAllowed) 914 914 { 915 915 if (a_fDndLstActionsAllowed & VBOX_DND_ACTION_COPY) 916 startupInfo.dwOKEffects |= DROPEFFECT_COPY;916 m_startupInfo.dwOKEffects |= DROPEFFECT_COPY; 917 917 if (a_fDndLstActionsAllowed & VBOX_DND_ACTION_MOVE) 918 startupInfo.dwOKEffects |= DROPEFFECT_MOVE;918 m_startupInfo.dwOKEffects |= DROPEFFECT_MOVE; 919 919 if (a_fDndLstActionsAllowed & VBOX_DND_ACTION_LINK) 920 startupInfo.dwOKEffects |= DROPEFFECT_LINK;921 } 922 923 LogRel2(("DnD: Supported drop actions: 0x%x\n", startupInfo.dwOKEffects));924 925 startupInfo.pDropSource = new VBoxDnDDropSource(this);926 startupInfo.pDataObject = new VBoxDnDDataObject(pFormatEtc, pStgMeds, cFormatsActive);920 m_startupInfo.dwOKEffects |= DROPEFFECT_LINK; 921 } 922 923 LogRel2(("DnD: Supported drop actions: 0x%x\n", m_startupInfo.dwOKEffects)); 924 925 m_startupInfo.pDropSource = new VBoxDnDDropSource(this); 926 m_startupInfo.pDataObject = new VBoxDnDDataObject(pFormatEtc, pStgMeds, cFormatsActive); 927 927 928 928 if (pFormatEtc) … … 961 961 962 962 uint32_t uActionNotify = VBOX_DND_ACTION_IGNORE; 963 if (m Mode == HG)963 if (m_enmMode == HG) 964 964 { 965 965 LogFlowThisFunc(("u32xPos=%RU32, u32yPos=%RU32, dndAction=0x%x\n", … … 969 969 970 970 if (RT_SUCCESS(rc)) 971 rc = RTCritSectEnter(&m CritSect);971 rc = RTCritSectEnter(&m_CritSect); 972 972 if (RT_SUCCESS(rc)) 973 973 { 974 if ( (Dragging == m State)975 && startupInfo.pDropSource)976 uActionNotify = startupInfo.pDropSource->GetCurrentAction();977 978 RTCritSectLeave(&m CritSect);974 if ( (Dragging == m_enmState) 975 && m_startupInfo.pDropSource) 976 uActionNotify = m_startupInfo.pDropSource->GetCurrentAction(); 977 978 RTCritSectLeave(&m_CritSect); 979 979 } 980 980 } … … 984 984 if (RT_SUCCESS(rc)) 985 985 { 986 rc = VbglR3DnDHGSendAckOp(&m DnDCtx, uActionNotify);986 rc = VbglR3DnDHGSendAckOp(&m_cmdCtx, uActionNotify); 987 987 if (RT_FAILURE(rc)) 988 988 LogFlowThisFunc(("Acknowledging operation failed with rc=%Rrc\n", rc)); … … 1001 1001 int VBoxDnDWnd::OnHgLeave(void) 1002 1002 { 1003 if (m Mode == GH) /* Wrong mode? Bail out. */1003 if (m_enmMode == GH) /* Wrong mode? Bail out. */ 1004 1004 return VERR_WRONG_ORDER; 1005 1005 … … 1018 1018 int VBoxDnDWnd::OnHgDrop(void) 1019 1019 { 1020 if (m Mode == GH)1020 if (m_enmMode == GH) 1021 1021 return VERR_WRONG_ORDER; 1022 1022 1023 LogFlowThisFunc(("mMode=%ld, mState=%RU32\n", m Mode,mState));1023 LogFlowThisFunc(("mMode=%ld, mState=%RU32\n", m_enmMode, m_enmState)); 1024 1024 1025 1025 int rc = VINF_SUCCESS; 1026 if (m State == Dragging)1027 { 1028 if ( lstFmtActive.size() >= 1)1026 if (m_enmState == Dragging) 1027 { 1028 if (m_lstFmtActive.size() >= 1) 1029 1029 { 1030 1030 /** @todo What to do when multiple formats are available? */ 1031 m FormatRequested =lstFmtActive.at(0);1032 1033 rc = RTCritSectEnter(&m CritSect);1031 m_strFmtReq = m_lstFmtActive.at(0); 1032 1033 rc = RTCritSectEnter(&m_CritSect); 1034 1034 if (RT_SUCCESS(rc)) 1035 1035 { 1036 if ( startupInfo.pDataObject)1037 startupInfo.pDataObject->SetStatus(VBoxDnDDataObject::Dropping);1036 if (m_startupInfo.pDataObject) 1037 m_startupInfo.pDataObject->SetStatus(VBoxDnDDataObject::Status_Dropping); 1038 1038 else 1039 1039 rc = VERR_NOT_FOUND; 1040 1040 1041 RTCritSectLeave(&m CritSect);1041 RTCritSectLeave(&m_CritSect); 1042 1042 } 1043 1043 1044 1044 if (RT_SUCCESS(rc)) 1045 1045 { 1046 LogRel(("DnD: Requesting data as '%s' ...\n", m FormatRequested.c_str()));1047 rc = VbglR3DnDHGSendReqData(&m DnDCtx, mFormatRequested.c_str());1046 LogRel(("DnD: Requesting data as '%s' ...\n", m_strFmtReq.c_str())); 1047 rc = VbglR3DnDHGSendReqData(&m_cmdCtx, m_strFmtReq.c_str()); 1048 1048 if (RT_FAILURE(rc)) 1049 1049 LogFlowThisFunc(("Requesting data failed with rc=%Rrc\n", rc)); … … 1068 1068 int VBoxDnDWnd::OnHgDataReceive(PVBGLR3GUESTDNDMETADATA pMeta) 1069 1069 { 1070 LogFlowThisFunc(("mState=%ld, enmMetaType=%RU32\n", m State, pMeta->enmType));1071 1072 int rc = RTCritSectEnter(&m CritSect);1070 LogFlowThisFunc(("mState=%ld, enmMetaType=%RU32\n", m_enmState, pMeta->enmType)); 1071 1072 int rc = RTCritSectEnter(&m_CritSect); 1073 1073 if (RT_SUCCESS(rc)) 1074 1074 { 1075 m State = Dropped;1076 1077 if ( startupInfo.pDataObject)1075 m_enmState = Dropped; 1076 1077 if (m_startupInfo.pDataObject) 1078 1078 { 1079 1079 switch (pMeta->enmType) … … 1084 1084 AssertBreakStmt(pMeta->u.Raw.cbMeta, rc = VERR_INVALID_PARAMETER); 1085 1085 1086 rc = startupInfo.pDataObject->Signal(mFormatRequested, pMeta->u.Raw.pvMeta, pMeta->u.Raw.cbMeta);1086 rc = m_startupInfo.pDataObject->Signal(m_strFmtReq, pMeta->u.Raw.pvMeta, pMeta->u.Raw.cbMeta); 1087 1087 break; 1088 1088 } … … 1100 1100 if (RT_SUCCESS(rc)) 1101 1101 { 1102 rc = startupInfo.pDataObject->Signal(mFormatRequested, pszBuf, cbBuf);1102 rc = m_startupInfo.pDataObject->Signal(m_strFmtReq, pszBuf, cbBuf); 1103 1103 RTStrFree(pszBuf); 1104 1104 } … … 1118 1118 rc = rc2; 1119 1119 1120 RTCritSectLeave(&m CritSect);1120 RTCritSectLeave(&m_CritSect); 1121 1121 } 1122 1122 … … 1160 1160 int VBoxDnDWnd::OnGhIsDnDPending(void) 1161 1161 { 1162 LogFlowThisFunc(("mMode=%ld, mState=%ld\n", m Mode,mState));1163 1164 if (m Mode == Unknown)1162 LogFlowThisFunc(("mMode=%ld, mState=%ld\n", m_enmMode, m_enmState)); 1163 1164 if (m_enmMode == Unknown) 1165 1165 setMode(GH); 1166 1166 1167 if (m Mode != GH)1167 if (m_enmMode != GH) 1168 1168 return VERR_WRONG_ORDER; 1169 1169 1170 if (m State == Uninitialized)1170 if (m_enmState == Uninitialized) 1171 1171 { 1172 1172 /* Nothing to do here yet. */ 1173 m State = Initialized;1173 m_enmState = Initialized; 1174 1174 } 1175 1175 1176 1176 int rc; 1177 if (m State == Initialized)1177 if (m_enmState == Initialized) 1178 1178 { 1179 1179 /* Check if the VM session has changed and reconnect to the HGCM service if necessary. */ … … 1195 1195 * own drop target (for the host). 1196 1196 */ 1197 m State = Dragging;1197 m_enmState = Dragging; 1198 1198 } 1199 1199 } … … 1213 1213 1214 1214 if ( RT_SUCCESS(rc) 1215 && m State == Dragging)1215 && m_enmState == Dragging) 1216 1216 { 1217 1217 /** @todo Put this block into a function! */ 1218 1218 POINT p; 1219 1219 GetCursorPos(&p); 1220 ClientToScreen( hWnd, &p);1220 ClientToScreen(m_hWnd, &p); 1221 1221 #ifdef DEBUG_andy 1222 1222 LogFlowThisFunc(("Client to screen curX=%ld, curY=%ld\n", p.x, p.y)); … … 1243 1243 VBOXDNDACTION dndActionDefault = VBOX_DND_ACTION_IGNORE; 1244 1244 1245 AssertPtr( pDropTarget);1246 RTCString strFormats = pDropTarget->Formats();1245 AssertPtr(m_pDropTarget); 1246 RTCString strFormats = m_pDropTarget->Formats(); 1247 1247 if (!strFormats.isEmpty()) 1248 1248 { … … 1250 1250 1251 1251 LogFlowFunc(("Acknowledging pDropTarget=0x%p, dndActionDefault=0x%x, dndLstActionsAllowed=0x%x, strFormats=%s\n", 1252 pDropTarget, dndActionDefault, dndLstActionsAllowed, strFormats.c_str()));1252 m_pDropTarget, dndActionDefault, m_lstActionsAllowed, strFormats.c_str())); 1253 1253 } 1254 1254 else … … 1259 1259 1260 1260 /** @todo Support more than one action at a time. */ 1261 dndLstActionsAllowed = dndActionDefault;1262 1263 int rc2 = VbglR3DnDGHSendAckPending(&m DnDCtx,1264 dndActionDefault, dndLstActionsAllowed,1261 m_lstActionsAllowed = dndActionDefault; 1262 1263 int rc2 = VbglR3DnDGHSendAckPending(&m_cmdCtx, 1264 dndActionDefault, m_lstActionsAllowed, 1265 1265 strFormats.c_str(), (uint32_t)strFormats.length() + 1 /* Include termination */); 1266 1266 if (RT_FAILURE(rc2)) … … 1316 1316 1317 1317 LogFlowThisFunc(("mMode=%ld, mState=%ld, pDropTarget=0x%p, strFormat=%s, dndActionDefault=0x%x\n", 1318 m Mode, mState,pDropTarget, strFormat.c_str(), dndActionDefault));1318 m_enmMode, m_enmState, m_pDropTarget, strFormat.c_str(), dndActionDefault)); 1319 1319 int rc; 1320 if (m Mode == GH)1321 { 1322 if (m State == Dragging)1323 { 1324 AssertPtr( pDropTarget);1325 rc = pDropTarget->WaitForDrop(5 * 1000 /* 5s timeout */);1320 if (m_enmMode == GH) 1321 { 1322 if (m_enmState == Dragging) 1323 { 1324 AssertPtr(m_pDropTarget); 1325 rc = m_pDropTarget->WaitForDrop(5 * 1000 /* 5s timeout */); 1326 1326 1327 1327 Reset(); 1328 1328 } 1329 else if (m State == Dropped)1329 else if (m_enmState == Dropped) 1330 1330 { 1331 1331 rc = VINF_SUCCESS; … … 1337 1337 { 1338 1338 /** @todo Respect uDefAction. */ 1339 void *pvData = pDropTarget->DataMutableRaw();1340 uint32_t cbData = (uint32_t) pDropTarget->DataSize();1341 Assert(cbData == pDropTarget->DataSize());1339 void *pvData = m_pDropTarget->DataMutableRaw(); 1340 uint32_t cbData = (uint32_t)m_pDropTarget->DataSize(); 1341 Assert(cbData == m_pDropTarget->DataSize()); 1342 1342 1343 1343 if ( pvData 1344 1344 && cbData) 1345 1345 { 1346 rc = VbglR3DnDGHSendData(&m DnDCtx, strFormat.c_str(), pvData, cbData);1346 rc = VbglR3DnDGHSendData(&m_cmdCtx, strFormat.c_str(), pvData, cbData); 1347 1347 LogFlowFunc(("Sent pvData=0x%p, cbData=%RU32, rc=%Rrc\n", pvData, cbData, rc)); 1348 1348 } … … 1361 1361 * not wait for the data it expects from the guest. 1362 1362 */ 1363 int rc2 = VbglR3DnDGHSendError(&m DnDCtx, rc);1363 int rc2 = VbglR3DnDGHSendError(&m_cmdCtx, rc); 1364 1364 AssertRC(rc2); 1365 1365 } … … 1373 1373 { 1374 1374 LogFlowFunc(("Posting message %u\n")); 1375 BOOL fRc = ::PostMessage( hWnd, uMsg, wParam, lParam);1375 BOOL fRc = ::PostMessage(m_hWnd, uMsg, wParam, lParam); 1376 1376 Assert(fRc); NOREF(fRc); 1377 1377 } … … 1389 1389 AssertPtrReturn(pEvent, VERR_INVALID_POINTER); 1390 1390 1391 BOOL fRc = ::PostMessage( hWnd, WM_VBOXTRAY_DND_MESSAGE,1391 BOOL fRc = ::PostMessage(m_hWnd, WM_VBOXTRAY_DND_MESSAGE, 1392 1392 0 /* wParm */, (LPARAM)pEvent /* lParm */); 1393 1393 if (!fRc) … … 1424 1424 int rc = VbglR3GetSessionId(&uSessionID); 1425 1425 if ( RT_SUCCESS(rc) 1426 && uSessionID != m DnDCtx.uSessionID)1426 && uSessionID != m_cmdCtx.uSessionID) 1427 1427 { 1428 1428 LogFlowThisFunc(("VM session has changed to %RU64\n", uSessionID)); 1429 1429 1430 rc = VbglR3DnDDisconnect(&m DnDCtx);1430 rc = VbglR3DnDDisconnect(&m_cmdCtx); 1431 1431 AssertRC(rc); 1432 1432 1433 rc = VbglR3DnDConnect(&m DnDCtx);1433 rc = VbglR3DnDConnect(&m_cmdCtx); 1434 1434 AssertRC(rc); 1435 1435 } … … 1449 1449 LogFlowFunc(("\n")); 1450 1450 #endif 1451 ShowWindow( hWnd, SW_HIDE);1451 ShowWindow(m_hWnd, SW_HIDE); 1452 1452 1453 1453 return VINF_SUCCESS; … … 1496 1496 if (RT_SUCCESS(rc)) 1497 1497 { 1498 LONG lStyle = GetWindowLong( hWnd, GWL_STYLE);1499 SetWindowLong( hWnd, GWL_STYLE,1498 LONG lStyle = GetWindowLong(m_hWnd, GWL_STYLE); 1499 SetWindowLong(m_hWnd, GWL_STYLE, 1500 1500 lStyle & ~(WS_CAPTION | WS_THICKFRAME)); 1501 LONG lExStyle = GetWindowLong( hWnd, GWL_EXSTYLE);1502 SetWindowLong( hWnd, GWL_EXSTYLE,1501 LONG lExStyle = GetWindowLong(m_hWnd, GWL_EXSTYLE); 1502 SetWindowLong(m_hWnd, GWL_EXSTYLE, 1503 1503 lExStyle & ~( WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE 1504 1504 | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE)); 1505 1505 1506 fRc = SetWindowPos( hWnd, HWND_TOPMOST,1506 fRc = SetWindowPos(m_hWnd, HWND_TOPMOST, 1507 1507 r.left, 1508 1508 r.top, … … 1614 1614 { 1615 1615 LogFlowThisFunc(("Resetting, old mMode=%ld, mState=%ld\n", 1616 m Mode,mState));1616 m_enmMode, m_enmState)); 1617 1617 1618 1618 /* … … 1622 1622 */ 1623 1623 1624 this-> lstFmtActive.clear();1625 this-> dndLstActionsAllowed = VBOX_DND_ACTION_IGNORE;1624 this->m_lstFmtActive.clear(); 1625 this->m_lstActionsAllowed = VBOX_DND_ACTION_IGNORE; 1626 1626 1627 1627 int rc2 = setMode(Unknown); … … 1640 1640 { 1641 1641 LogFlowThisFunc(("Old mode=%ld, new mode=%ld\n", 1642 m Mode, enmMode));1643 1644 m Mode = enmMode;1645 m State = Initialized;1642 m_enmMode, enmMode)); 1643 1644 m_enmMode = enmMode; 1645 m_enmState = Initialized; 1646 1646 1647 1647 return VINF_SUCCESS; -
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDnD.h
r85681 r85694 38 38 enum Status 39 39 { 40 Uninitialized = 0, 41 Initialized, 42 Dropping, 43 Dropped, 44 Aborted 40 Status_Uninitialized = 0, 41 Status_Initialized, 42 Status_Dropping, 43 Status_Dropped, 44 Status_Aborted, 45 Status_32Bit_Hack = 0x7fffffff 45 46 }; 46 47 … … 79 80 80 81 bool LookupFormatEtc(LPFORMATETC pFormatEtc, ULONG *puIndex); 81 static HGLOBAL MemDup(HGLOBAL hMemSource);82 82 void RegisterFormat(LPFORMATETC pFormatEtc, CLIPFORMAT clipFormat, TYMED tyMed = TYMED_HGLOBAL, 83 83 LONG lindex = -1, DWORD dwAspect = DVASPECT_CONTENT, DVTARGETDEVICE *pTargetDevice = NULL); 84 84 85 85 /** Current drag and drop status. */ 86 Status m Status;86 Status m_enmStatus; 87 87 /** Internal reference count of this object. */ 88 LONG m RefCount;88 LONG m_cRefs; 89 89 /** Number of native formats registered. This can be a different number than supplied with m_lstFormats. */ 90 ULONG m cFormats;90 ULONG m_cFormats; 91 91 /** Array of registered FORMATETC structs. Matches m_cFormats. */ 92 LPFORMATETC m pFormatEtc;92 LPFORMATETC m_paFormatEtc; 93 93 /** Array of registered STGMEDIUM structs. Matches m_cFormats. */ 94 LPSTGMEDIUM m pStgMedium;94 LPSTGMEDIUM m_paStgMedium; 95 95 /** Event semaphore used for waiting on status changes. */ 96 RTSEMEVENT m EventDropped;96 RTSEMEVENT m_EvtDropped; 97 97 /** Format of currently retrieved data. */ 98 RTCString m strFormat;98 RTCString m_strFormat; 99 99 /** The retrieved data as a raw buffer. */ 100 void *m pvData;100 void *m_pvData; 101 101 /** Raw buffer size (in bytes). */ 102 size_t m cbData;102 size_t m_cbData; 103 103 }; 104 104 … … 115 115 public: 116 116 117 VBOXDNDACTION GetCurrentAction(void) { return m DnDActionCurrent; }117 VBOXDNDACTION GetCurrentAction(void) { return m_enmActionCurrent; } 118 118 119 119 public: /* IUnknown methods. */ … … 131 131 132 132 /** Reference count of this object. */ 133 LONG m RefCount;133 LONG m_cRefs; 134 134 /** Pointer to parent proxy window. */ 135 VBoxDnDWnd *m pWndParent;135 VBoxDnDWnd *m_pWndParent; 136 136 /** Current drag effect. */ 137 DWORD m dwCurEffect;137 DWORD m_dwCurEffect; 138 138 /** Current action to perform on the host. */ 139 VBOXDNDACTION m DnDActionCurrent;139 VBOXDNDACTION m_enmActionCurrent; 140 140 }; 141 141 … … 172 172 173 173 /** Returns the data as mutable raw. Use with caution! */ 174 void *DataMutableRaw(void) const { return m pvData; }174 void *DataMutableRaw(void) const { return m_pvData; } 175 175 176 176 /** Returns the data size (in bytes). */ 177 size_t DataSize(void) const { return m cbData; }177 size_t DataSize(void) const { return m_cbData; } 178 178 179 179 RTCString Formats(void) const; … … 183 183 184 184 /** Reference count of this object. */ 185 LONG m RefCount;185 LONG m_cRefs; 186 186 /** Pointer to parent proxy window. */ 187 VBoxDnDWnd *m pWndParent;187 VBoxDnDWnd *m_pWndParent; 188 188 /** Current drop effect. */ 189 DWORD m dwCurEffect;189 DWORD m_dwCurEffect; 190 190 /** Copy of the data object's current FORMATETC struct. 191 191 * Note: We don't keep the pointer of the DVTARGETDEVICE here! */ 192 FORMATETC m FormatEtc;193 /** Stringified data object's format s string. */194 RTCString m strFormats;192 FORMATETC m_FormatEtc; 193 /** Stringified data object's format currently in use. */ 194 RTCString m_strFormat; 195 195 /** Pointer to actual format data. */ 196 void *m pvData;196 void *m_pvData; 197 197 /** Size (in bytes) of format data. */ 198 size_t m cbData;198 size_t m_cbData; 199 199 /** Event for waiting on the "drop" event. */ 200 RTSEMEVENT hEventDrop;200 RTSEMEVENT m_EvtDrop; 201 201 /** Result of the drop event. */ 202 int m DroppedRc;202 int m_rcDropped; 203 203 }; 204 204 … … 232 232 233 233 /** Reference count of this object. */ 234 LONG m_ lRefCount;234 LONG m_cRefs; 235 235 /** Current index for format iteration. */ 236 ULONG m_ nIndex;236 ULONG m_uIdxCur; 237 237 /** Number of format this object contains. */ 238 ULONG m_ nNumFormats;239 /** Array of FORMATETC formats this object contains. Matches m_ nNumFormats. */240 LPFORMATETC m_p FormatEtc;238 ULONG m_cFormats; 239 /** Array of FORMATETC formats this object contains. Matches m_cFormats. */ 240 LPFORMATETC m_paFormatEtc; 241 241 }; 242 242 … … 343 343 344 344 /** The window's thread for the native message pump and OLE context. */ 345 static DECLCALLBACK(int) Thread(RTTHREAD hThread, void *pvUser);345 static DECLCALLBACK(int) Thread(RTTHREAD m_hThread, void *pvUser); 346 346 347 347 public: … … 366 366 367 367 /* Host -> Guest */ 368 int OnHgEnter(const RTCList<RTCString> &formats, VBOXDNDACTIONLIST dndLstActionsAllowed);368 int OnHgEnter(const RTCList<RTCString> &formats, VBOXDNDACTIONLIST m_lstActionsAllowed); 369 369 int OnHgMove(uint32_t u32xPos, uint32_t u32yPos, VBOXDNDACTION dndAction); 370 370 int OnHgDrop(void); … … 396 396 397 397 /** Pointer to DnD context. */ 398 PVBOXDNDCONTEXT pCtx;398 PVBOXDNDCONTEXT m_pCtx; 399 399 /** The proxy window's main thread for processing 400 400 * window messages. */ 401 RTTHREAD hThread;401 RTTHREAD m_hThread; 402 402 /** Critical section to serialize access. */ 403 RTCRITSECT m CritSect;403 RTCRITSECT m_CritSect; 404 404 /** Event semaphore to wait for new DnD events. */ 405 RTSEMEVENT m EventSem;405 RTSEMEVENT m_EvtSem; 406 406 #ifdef RT_OS_WINDOWS 407 407 /** The window's handle. */ 408 HWND hWnd;408 HWND m_hWnd; 409 409 /** List of allowed MIME types this 410 410 * client can handle. Make this a per-instance 411 411 * property so that we can selectively allow/forbid 412 412 * certain types later on runtime. */ 413 RTCList<RTCString> lstFmtSup;413 RTCList<RTCString> m_lstFmtSup; 414 414 /** List of formats for the current 415 415 * drag'n drop operation. */ 416 RTCList<RTCString> lstFmtActive;416 RTCList<RTCString> m_lstFmtActive; 417 417 /** List of all current drag'n drop actions allowed. */ 418 VBOXDNDACTIONLIST dndLstActionsAllowed;418 VBOXDNDACTIONLIST m_lstActionsAllowed; 419 419 /** The startup information required 420 420 * for the actual DoDragDrop() call. */ 421 VBOXDNDSTARTUPINFO startupInfo;421 VBOXDNDSTARTUPINFO m_startupInfo; 422 422 /** Is the left mouse button being pressed 423 423 * currently while being in this window? */ 424 bool m fMouseButtonDown;424 bool m_fMouseButtonDown; 425 425 # ifdef VBOX_WITH_DRAG_AND_DROP_GH 426 426 /** Pointer to IDropTarget implementation for 427 427 * guest -> host support. */ 428 VBoxDnDDropTarget * pDropTarget;428 VBoxDnDDropTarget *m_pDropTarget; 429 429 # endif /* VBOX_WITH_DRAG_AND_DROP_GH */ 430 430 #else /* !RT_OS_WINDOWS */ … … 433 433 434 434 /** The window's own DnD context. */ 435 VBGLR3GUESTDNDCMDCTX m DnDCtx;435 VBGLR3GUESTDNDCMDCTX m_cmdCtx; 436 436 /** The current operation mode. */ 437 Mode m Mode;437 Mode m_enmMode; 438 438 /** The current state. */ 439 State m State;439 State m_enmState; 440 440 /** Format being requested. */ 441 RTCString m FormatRequested;441 RTCString m_strFmtReq; 442 442 }; 443 443 -
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDnDDataObject.cpp
r85681 r85694 42 42 43 43 VBoxDnDDataObject::VBoxDnDDataObject(LPFORMATETC pFormatEtc, LPSTGMEDIUM pStgMed, ULONG cFormats) 44 : m Status(Uninitialized),45 m RefCount(1),46 m cFormats(0),47 m pvData(NULL),48 m cbData(0)44 : m_enmStatus(Status_Uninitialized), 45 m_cRefs(1), 46 m_cFormats(0), 47 m_pvData(NULL), 48 m_cbData(0) 49 49 { 50 50 HRESULT hr; … … 55 55 try 56 56 { 57 m pFormatEtc = new FORMATETC[cAllFormats];58 RT_BZERO(m pFormatEtc, sizeof(FORMATETC) * cAllFormats);59 m pStgMedium = new STGMEDIUM[cAllFormats];60 RT_BZERO(m pStgMedium, sizeof(STGMEDIUM) * cAllFormats);57 m_paFormatEtc = new FORMATETC[cAllFormats]; 58 RT_BZERO(m_paFormatEtc, sizeof(FORMATETC) * cAllFormats); 59 m_paStgMedium = new STGMEDIUM[cAllFormats]; 60 RT_BZERO(m_paStgMedium, sizeof(STGMEDIUM) * cAllFormats); 61 61 62 62 /* … … 73 73 LogFlowFunc(("Format %RU32: cfFormat=%RI16, tyMed=%RU32, dwAspect=%RU32\n", 74 74 i, pFormatEtc[i].cfFormat, pFormatEtc[i].tymed, pFormatEtc[i].dwAspect)); 75 m pFormatEtc[i] = pFormatEtc[i];76 m pStgMedium[i] = pStgMed[i];75 m_paFormatEtc[i] = pFormatEtc[i]; 76 m_paStgMedium[i] = pStgMed[i]; 77 77 } 78 78 } … … 87 87 if (SUCCEEDED(hr)) 88 88 { 89 int rc2 = RTSemEventCreate(&m EventDropped);89 int rc2 = RTSemEventCreate(&m_EvtDropped); 90 90 AssertRC(rc2); 91 91 … … 115 115 RegisterClipboardFormat(CFSTR_SHELLIDLISTOFFSET)); 116 116 #endif 117 m cFormats = cFormats;118 m Status =Initialized;117 m_cFormats = cFormats; 118 m_enmStatus = Status_Initialized; 119 119 } 120 120 … … 124 124 VBoxDnDDataObject::~VBoxDnDDataObject(void) 125 125 { 126 if (m pFormatEtc)127 delete[] m pFormatEtc;128 129 if (m pStgMedium)130 delete[] m pStgMedium;131 132 if (m pvData)133 RTMemFree(m pvData);134 135 LogFlowFunc(("mRefCount=%RI32\n", m RefCount));126 if (m_paFormatEtc) 127 delete[] m_paFormatEtc; 128 129 if (m_paStgMedium) 130 delete[] m_paStgMedium; 131 132 if (m_pvData) 133 RTMemFree(m_pvData); 134 135 LogFlowFunc(("mRefCount=%RI32\n", m_cRefs)); 136 136 } 137 137 … … 142 142 STDMETHODIMP_(ULONG) VBoxDnDDataObject::AddRef(void) 143 143 { 144 return InterlockedIncrement(&m RefCount);144 return InterlockedIncrement(&m_cRefs); 145 145 } 146 146 147 147 STDMETHODIMP_(ULONG) VBoxDnDDataObject::Release(void) 148 148 { 149 LONG lCount = InterlockedDecrement(&m RefCount);149 LONG lCount = InterlockedDecrement(&m_cRefs); 150 150 if (lCount == 0) 151 151 { … … 181 181 if (!LookupFormatEtc(pFormatEtc, &lIndex)) /* Format supported? */ 182 182 return DV_E_FORMATETC; 183 if (lIndex >= m cFormats) /* Paranoia. */183 if (lIndex >= m_cFormats) /* Paranoia. */ 184 184 return DV_E_FORMATETC; 185 185 186 LPFORMATETC pThisFormat = &m pFormatEtc[lIndex];186 LPFORMATETC pThisFormat = &m_paFormatEtc[lIndex]; 187 187 AssertPtr(pThisFormat); 188 188 189 LPSTGMEDIUM pThisMedium = &m pStgMedium[lIndex];189 LPSTGMEDIUM pThisMedium = &m_paStgMedium[lIndex]; 190 190 AssertPtr(pThisMedium); 191 191 … … 194 194 HRESULT hr = DV_E_FORMATETC; /* Play safe. */ 195 195 196 LogFlowFunc(("mStatus=%ld\n", m Status));197 if (m Status ==Dropping)196 LogFlowFunc(("mStatus=%ld\n", m_enmStatus)); 197 if (m_enmStatus == Status_Dropping) 198 198 { 199 199 LogRel2(("DnD: Waiting for drop event ...\n")); 200 int rc2 = RTSemEventWait(m EventDropped, RT_INDEFINITE_WAIT);201 LogFlowFunc(("rc2=%Rrc, mStatus=%ld\n", rc2, m Status)); RT_NOREF(rc2);202 } 203 204 if (m Status ==Dropped)200 int rc2 = RTSemEventWait(m_EvtDropped, RT_INDEFINITE_WAIT); 201 LogFlowFunc(("rc2=%Rrc, mStatus=%ld\n", rc2, m_enmStatus)); RT_NOREF(rc2); 202 } 203 204 if (m_enmStatus == Status_Dropped) 205 205 { 206 206 LogRel2(("DnD: Drop event received\n")); … … 209 209 pThisFormat->tymed, pThisFormat->dwAspect)); 210 210 LogRel3(("DnD: Got strFormat=%s, pvData=%p, cbData=%RU32\n", 211 m strFormat.c_str(), mpvData, mcbData));211 m_strFormat.c_str(), m_pvData, m_cbData)); 212 212 213 213 /* … … 220 220 * URI list handling. 221 221 */ 222 if (DnDMIMEHasFileURLs(m strFormat.c_str(), RTSTR_MAX))222 if (DnDMIMEHasFileURLs(m_strFormat.c_str(), RTSTR_MAX)) 223 223 { 224 224 char **papszFiles; 225 225 size_t cFiles; 226 int rc = RTStrSplit((const char *)m pvData, mcbData, DND_PATH_SEPARATOR, &papszFiles, &cFiles);226 int rc = RTStrSplit((const char *)m_pvData, m_cbData, DND_PATH_SEPARATOR, &papszFiles, &cFiles); 227 227 if ( RT_SUCCESS(rc) 228 228 && cFiles) … … 263 263 && (pFormatEtc->cfFormat == CF_TEXT)) 264 264 { 265 pMedium->hGlobal = GlobalAlloc(GHND, m cbData + 1);265 pMedium->hGlobal = GlobalAlloc(GHND, m_cbData + 1); 266 266 if (pMedium->hGlobal) 267 267 { 268 268 char *pcDst = (char *)GlobalLock(pMedium->hGlobal); 269 memcpy(pcDst, m pvData, mcbData);270 pcDst[m cbData] = '\0';269 memcpy(pcDst, m_pvData, m_cbData); 270 pcDst[m_cbData] = '\0'; 271 271 GlobalUnlock(pMedium->hGlobal); 272 272 … … 356 356 * Plain text handling. 357 357 */ 358 else if ( m strFormat.equalsIgnoreCase("text/plain")359 || m strFormat.equalsIgnoreCase("text/html")360 || m strFormat.equalsIgnoreCase("text/plain;charset=utf-8")361 || m strFormat.equalsIgnoreCase("text/plain;charset=utf-16")362 || m strFormat.equalsIgnoreCase("text/richtext")363 || m strFormat.equalsIgnoreCase("UTF8_STRING")364 || m strFormat.equalsIgnoreCase("TEXT")365 || m strFormat.equalsIgnoreCase("STRING"))358 else if ( m_strFormat.equalsIgnoreCase("text/plain") 359 || m_strFormat.equalsIgnoreCase("text/html") 360 || m_strFormat.equalsIgnoreCase("text/plain;charset=utf-8") 361 || m_strFormat.equalsIgnoreCase("text/plain;charset=utf-16") 362 || m_strFormat.equalsIgnoreCase("text/richtext") 363 || m_strFormat.equalsIgnoreCase("UTF8_STRING") 364 || m_strFormat.equalsIgnoreCase("TEXT") 365 || m_strFormat.equalsIgnoreCase("STRING")) 366 366 { 367 pMedium->hGlobal = GlobalAlloc(GHND, m cbData + 1);367 pMedium->hGlobal = GlobalAlloc(GHND, m_cbData + 1); 368 368 if (pMedium->hGlobal) 369 369 { 370 370 char *pcDst = (char *)GlobalLock(pMedium->hGlobal); 371 memcpy(pcDst, m pvData, mcbData);372 pcDst[m cbData] = '\0';371 memcpy(pcDst, m_pvData, m_cbData); 372 pcDst[m_cbData] = '\0'; 373 373 GlobalUnlock(pMedium->hGlobal); 374 374 … … 377 377 } 378 378 else 379 LogRel(("DnD: Error: Format '%s' not implemented\n", m strFormat.c_str()));379 LogRel(("DnD: Error: Format '%s' not implemented\n", m_strFormat.c_str())); 380 380 } 381 381 … … 401 401 402 402 if (hr == DV_E_FORMATETC) 403 LogRel(("DnD: Error handling format '%s' (%RU32 bytes)\n", m strFormat.c_str(), mcbData));403 LogRel(("DnD: Error handling format '%s' (%RU32 bytes)\n", m_strFormat.c_str(), m_cbData)); 404 404 405 405 LogFlowFunc(("hr=%Rhrc\n", hr)); … … 438 438 STDMETHODIMP VBoxDnDDataObject::EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC **ppEnumFormatEtc) 439 439 { 440 LogFlowFunc(("dwDirection=%RI32, mcFormats=%RI32, mpFormatEtc=%p\n", dwDirection, m cFormats, mpFormatEtc));440 LogFlowFunc(("dwDirection=%RI32, mcFormats=%RI32, mpFormatEtc=%p\n", dwDirection, m_cFormats, m_paFormatEtc)); 441 441 442 442 HRESULT hr; 443 443 if (dwDirection == DATADIR_GET) 444 hr = VBoxDnDEnumFormatEtc::CreateEnumFormatEtc(m cFormats, mpFormatEtc, ppEnumFormatEtc);444 hr = VBoxDnDEnumFormatEtc::CreateEnumFormatEtc(m_cFormats, m_paFormatEtc, ppEnumFormatEtc); 445 445 else 446 446 hr = E_NOTIMPL; … … 480 480 { 481 481 LogFlowFunc(("Aborting ...\n")); 482 m Status =Aborted;483 return RTSemEventSignal(m EventDropped);482 m_enmStatus = Status_Aborted; 483 return RTSemEventSignal(m_EvtDropped); 484 484 } 485 485 … … 585 585 /* puIndex is optional. */ 586 586 587 for (ULONG i = 0; i < m cFormats; i++)588 { 589 if( (pFormatEtc->tymed & m pFormatEtc[i].tymed)590 && pFormatEtc->cfFormat == m pFormatEtc[i].cfFormat591 && pFormatEtc->dwAspect == m pFormatEtc[i].dwAspect)587 for (ULONG i = 0; i < m_cFormats; i++) 588 { 589 if( (pFormatEtc->tymed & m_paFormatEtc[i].tymed) 590 && pFormatEtc->cfFormat == m_paFormatEtc[i].cfFormat 591 && pFormatEtc->dwAspect == m_paFormatEtc[i].dwAspect) 592 592 { 593 593 LogRel3(("DnD: Format found: tyMed=%RI32, cfFormat=%RI16, sFormats=%s, dwAspect=%RI32, ulIndex=%RU32\n", 594 pFormatEtc->tymed, pFormatEtc->cfFormat, VBoxDnDDataObject::ClipboardFormatToString(m pFormatEtc[i].cfFormat),594 pFormatEtc->tymed, pFormatEtc->cfFormat, VBoxDnDDataObject::ClipboardFormatToString(m_paFormatEtc[i].cfFormat), 595 595 pFormatEtc->dwAspect, i)); 596 596 if (puIndex) … … 605 605 606 606 return false; 607 }608 609 /* static */610 HGLOBAL VBoxDnDDataObject::MemDup(HGLOBAL hMemSource)611 {612 DWORD dwLen = GlobalSize(hMemSource);613 AssertReturn(dwLen, NULL);614 PVOID pvSource = GlobalLock(hMemSource);615 if (pvSource)616 {617 PVOID pvDest = GlobalAlloc(GMEM_FIXED, dwLen);618 if (pvDest)619 memcpy(pvDest, pvSource, dwLen);620 621 GlobalUnlock(hMemSource);622 return pvDest;623 }624 625 return NULL;626 607 } 627 608 … … 660 641 { 661 642 LogFlowFunc(("Setting status to %ld\n", status)); 662 m Status = status;643 m_enmStatus = status; 663 644 } 664 645 … … 678 659 if (cbData) 679 660 { 680 m pvData = RTMemAlloc(cbData);681 if (m pvData)661 m_pvData = RTMemAlloc(cbData); 662 if (m_pvData) 682 663 { 683 memcpy(m pvData, pvData, cbData);684 m cbData = cbData;664 memcpy(m_pvData, pvData, cbData); 665 m_cbData = cbData; 685 666 rc = VINF_SUCCESS; 686 667 } … … 693 674 if (RT_SUCCESS(rc)) 694 675 { 695 m Status =Dropped;696 m strFormat = strFormat;676 m_enmStatus = Status_Dropped; 677 m_strFormat = strFormat; 697 678 } 698 679 else 699 680 { 700 m Status =Aborted;681 m_enmStatus = Status_Aborted; 701 682 } 702 683 … … 704 685 LogRel2(("DnD: Signalling drop event\n")); 705 686 706 int rc2 = RTSemEventSignal(m EventDropped);687 int rc2 = RTSemEventSignal(m_EvtDropped); 707 688 if (RT_SUCCESS(rc)) 708 689 rc = rc2; 709 690 710 LogFunc(("mStatus=%RU32, rc=%Rrc\n", m Status, rc));691 LogFunc(("mStatus=%RU32, rc=%Rrc\n", m_enmStatus, rc)); 711 692 return rc; 712 693 } -
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDnDDropSource.cpp
r82968 r85694 34 34 35 35 VBoxDnDDropSource::VBoxDnDDropSource(VBoxDnDWnd *pParent) 36 : m RefCount(1),37 m pWndParent(pParent),38 m dwCurEffect(0),39 m DnDActionCurrent(VBOX_DND_ACTION_IGNORE)36 : m_cRefs(1), 37 m_pWndParent(pParent), 38 m_dwCurEffect(0), 39 m_enmActionCurrent(VBOX_DND_ACTION_IGNORE) 40 40 { 41 41 LogFlowFuncEnter(); … … 44 44 VBoxDnDDropSource::~VBoxDnDDropSource(void) 45 45 { 46 LogFlowFunc(("mRefCount=%RI32\n", m RefCount));46 LogFlowFunc(("mRefCount=%RI32\n", m_cRefs)); 47 47 } 48 48 … … 53 53 STDMETHODIMP_(ULONG) VBoxDnDDropSource::AddRef(void) 54 54 { 55 return InterlockedIncrement(&m RefCount);55 return InterlockedIncrement(&m_cRefs); 56 56 } 57 57 58 58 STDMETHODIMP_(ULONG) VBoxDnDDropSource::Release(void) 59 59 { 60 LONG lCount = InterlockedDecrement(&m RefCount);60 LONG lCount = InterlockedDecrement(&m_cRefs); 61 61 if (lCount == 0) 62 62 { … … 98 98 #if 1 99 99 LogFlowFunc(("fEscapePressed=%RTbool, dwKeyState=0x%x, mdwCurEffect=%RI32, mDnDActionCurrent=%RU32\n", 100 fEscapePressed, dwKeyState, m dwCurEffect, mDnDActionCurrent));100 fEscapePressed, dwKeyState, m_dwCurEffect, m_enmActionCurrent)); 101 101 #endif 102 102 … … 104 104 if (fEscapePressed) 105 105 { 106 m dwCurEffect = 0;107 m DnDActionCurrent = VBOX_DND_ACTION_IGNORE;106 m_dwCurEffect = 0; 107 m_enmActionCurrent = VBOX_DND_ACTION_IGNORE; 108 108 109 109 LogFlowFunc(("Canceled\n")); … … 145 145 } 146 146 147 m dwCurEffect = dwEffect;148 m DnDActionCurrent = uAction;147 m_dwCurEffect = dwEffect; 148 m_enmActionCurrent = uAction; 149 149 150 150 return DRAGDROP_S_USEDEFAULTCURSORS; -
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDnDDropTarget.cpp
r85681 r85694 36 36 37 37 VBoxDnDDropTarget::VBoxDnDDropTarget(VBoxDnDWnd *pParent) 38 : m RefCount(1),39 m pWndParent(pParent),40 m dwCurEffect(0),41 m pvData(NULL),42 m cbData(0),43 hEventDrop(NIL_RTSEMEVENT)44 { 45 int rc = RTSemEventCreate(& hEventDrop);38 : m_cRefs(1), 39 m_pWndParent(pParent), 40 m_dwCurEffect(0), 41 m_pvData(NULL), 42 m_cbData(0), 43 m_EvtDrop(NIL_RTSEMEVENT) 44 { 45 int rc = RTSemEventCreate(&m_EvtDrop); 46 46 LogFlowFunc(("rc=%Rrc\n", rc)); NOREF(rc); 47 47 } … … 51 51 reset(); 52 52 53 int rc2 = RTSemEventDestroy( hEventDrop);53 int rc2 = RTSemEventDestroy(m_EvtDrop); 54 54 AssertRC(rc2); 55 55 56 LogFlowFunc(("rc=%Rrc, mRefCount=%RI32\n", rc2, m RefCount));56 LogFlowFunc(("rc=%Rrc, mRefCount=%RI32\n", rc2, m_cRefs)); 57 57 } 58 58 … … 63 63 STDMETHODIMP_(ULONG) VBoxDnDDropTarget::AddRef(void) 64 64 { 65 return InterlockedIncrement(&m RefCount);65 return InterlockedIncrement(&m_cRefs); 66 66 } 67 67 68 68 STDMETHODIMP_(ULONG) VBoxDnDDropTarget::Release(void) 69 69 { 70 LONG lCount = InterlockedDecrement(&m RefCount);70 LONG lCount = InterlockedDecrement(&m_cRefs); 71 71 if (lCount == 0) 72 72 { … … 158 158 if (hr == S_OK) 159 159 { 160 m strFormats= "text/uri-list";160 m_strFormat = "text/uri-list"; 161 161 } 162 162 else … … 170 170 if (hr == S_OK) 171 171 { 172 m strFormats= "text/plain;charset=utf-8";172 m_strFormat = "text/plain;charset=utf-8"; 173 173 } 174 174 else … … 180 180 if (hr == S_OK) 181 181 { 182 m strFormats= "text/plain;charset=utf-8";182 m_strFormat = "text/plain;charset=utf-8"; 183 183 } 184 184 else … … 202 202 * use this for comparrison and stuff. */ 203 203 /** @todo The DVTARGETDEVICE member only is a shallow copy for now! */ 204 memcpy(&m FormatEtc, &fmtEtc, sizeof(FORMATETC));204 memcpy(&m_FormatEtc, &fmtEtc, sizeof(FORMATETC)); 205 205 206 206 /* Which drop effect we're going to use? */ … … 229 229 230 230 LogFlowFunc(("Returning mstrFormats=%s, cfFormat=%RI16, pdwEffect=%ld, hr=%Rhrc\n", 231 m strFormats.c_str(), fmtEtc.cfFormat, *pdwEffect, hr));231 m_strFormat.c_str(), fmtEtc.cfFormat, *pdwEffect, hr)); 232 232 return hr; 233 233 } … … 240 240 #ifdef DEBUG_andy 241 241 LogFlowFunc(("cfFormat=%RI16, grfKeyState=0x%x, x=%ld, y=%ld\n", 242 m FormatEtc.cfFormat, grfKeyState, pt.x, pt.y));242 m_FormatEtc.cfFormat, grfKeyState, pt.x, pt.y)); 243 243 #endif 244 244 245 if (m FormatEtc.cfFormat)245 if (m_FormatEtc.cfFormat) 246 246 { 247 247 /* Note: pt is not used since we don't need to differentiate within our … … 263 263 { 264 264 #ifdef DEBUG_andy 265 LogFlowFunc(("cfFormat=%RI16\n", m FormatEtc.cfFormat));265 LogFlowFunc(("cfFormat=%RI16\n", m_FormatEtc.cfFormat)); 266 266 #endif 267 267 268 if (m pWndParent)269 m pWndParent->Hide();268 if (m_pWndParent) 269 m_pWndParent->Hide(); 270 270 271 271 return S_OK; … … 279 279 280 280 LogFlowFunc(("mFormatEtc.cfFormat=%RI16 (%s), pDataObject=0x%p, grfKeyState=0x%x, x=%ld, y=%ld\n", 281 m FormatEtc.cfFormat, VBoxDnDDataObject::ClipboardFormatToString(mFormatEtc.cfFormat),281 m_FormatEtc.cfFormat, VBoxDnDDataObject::ClipboardFormatToString(m_FormatEtc.cfFormat), 282 282 pDataObject, grfKeyState, pt.x, pt.y)); 283 283 284 284 HRESULT hr = S_OK; 285 285 286 if (m FormatEtc.cfFormat) /* Did we get a supported format yet? */286 if (m_FormatEtc.cfFormat) /* Did we get a supported format yet? */ 287 287 { 288 288 /* Make sure the data object's data format is still valid. */ 289 hr = pDataObject->QueryGetData(&m FormatEtc);289 hr = pDataObject->QueryGetData(&m_FormatEtc); 290 290 AssertMsg(SUCCEEDED(hr), 291 291 ("Data format changed to invalid between DragEnter() and Drop(), cfFormat=%RI16 (%s), hr=%Rhrc\n", 292 m FormatEtc.cfFormat, VBoxDnDDataObject::ClipboardFormatToString(mFormatEtc.cfFormat), hr));292 m_FormatEtc.cfFormat, VBoxDnDDataObject::ClipboardFormatToString(m_FormatEtc.cfFormat), hr)); 293 293 } 294 294 … … 298 298 { 299 299 STGMEDIUM stgMed; 300 hr = pDataObject->GetData(&m FormatEtc, &stgMed);300 hr = pDataObject->GetData(&m_FormatEtc, &stgMed); 301 301 if (SUCCEEDED(hr)) 302 302 { … … 307 307 PVOID pvData = NULL; /** @todo Put this in an own union? */ 308 308 309 switch (m FormatEtc.tymed)309 switch (m_FormatEtc.tymed) 310 310 { 311 311 case TYMED_HGLOBAL: … … 322 322 default: 323 323 AssertMsgFailed(("Storage medium type %RI32 supported\n", 324 m FormatEtc.tymed));324 m_FormatEtc.tymed)); 325 325 rc = VERR_NOT_SUPPORTED; 326 326 hr = DV_E_TYMED; /* Set special hr for OLE. */ … … 334 334 * based on the storage medium type. 335 335 */ 336 switch (m FormatEtc.cfFormat)336 switch (m_FormatEtc.cfFormat) 337 337 { 338 338 case CF_TEXT: … … 344 344 345 345 LogRel(("DnD: Got %zu bytes of %s\n", cbSize, 346 m FormatEtc.cfFormat == CF_TEXT346 m_FormatEtc.cfFormat == CF_TEXT 347 347 ? "ANSI text" : "Unicode text")); 348 348 if (cbSize) … … 350 350 char *pszText = NULL; 351 351 352 rc = m FormatEtc.cfFormat == CF_TEXT352 rc = m_FormatEtc.cfFormat == CF_TEXT 353 353 /* ANSI codepage -> UTF-8 */ 354 354 ? RTStrCurrentCPToUtf8(&pszText, (char *)pvData) … … 362 362 size_t cbText = strlen(pszText) + 1; /* Include termination. */ 363 363 364 m pvData = RTMemDup((void *)pszText, cbText);365 m cbData = cbText;364 m_pvData = RTMemDup((void *)pszText, cbText); 365 m_cbData = cbText; 366 366 367 367 RTStrFree(pszText); … … 499 499 cFiles, cchFiles, cbFiles, pszFiles)); 500 500 501 m pvData = pszFiles;502 m cbData = cbFiles;501 m_pvData = pszFiles; 502 m_cbData = cbFiles; 503 503 } 504 504 else … … 516 516 /* Note: Should not happen due to the checks done in DragEnter(). */ 517 517 AssertMsgFailed(("Format of type %RI16 (%s) not supported\n", 518 m FormatEtc.cfFormat, VBoxDnDDataObject::ClipboardFormatToString(mFormatEtc.cfFormat)));518 m_FormatEtc.cfFormat, VBoxDnDDataObject::ClipboardFormatToString(m_FormatEtc.cfFormat))); 519 519 hr = DV_E_CLIPFORMAT; /* Set special hr for OLE. */ 520 520 break; … … 524 524 * Third stage: Unlock + release access to the storage medium again. 525 525 */ 526 switch (m FormatEtc.tymed)526 switch (m_FormatEtc.tymed) 527 527 { 528 528 case TYMED_HGLOBAL: … … 540 540 541 541 /* Signal waiters. */ 542 m DroppedRc= rc;543 RTSemEventSignal( hEventDrop);542 m_rcDropped = rc; 543 RTSemEventSignal(m_EvtDrop); 544 544 } 545 545 } … … 554 554 *pdwEffect = DROPEFFECT_NONE; 555 555 556 if (m pWndParent)557 m pWndParent->Hide();556 if (m_pWndParent) 557 m_pWndParent->Hide(); 558 558 559 559 LogFlowFunc(("Returning with hr=%Rhrc (%Rrc), mFormatEtc.cfFormat=%RI16 (%s), *pdwEffect=%RI32\n", 560 hr, rc, m FormatEtc.cfFormat, VBoxDnDDataObject::ClipboardFormatToString(mFormatEtc.cfFormat),560 hr, rc, m_FormatEtc.cfFormat, VBoxDnDDataObject::ClipboardFormatToString(m_FormatEtc.cfFormat), 561 561 *pdwEffect)); 562 562 … … 607 607 LogFlowFuncEnter(); 608 608 609 if (m pvData)610 { 611 RTMemFree(m pvData);612 m pvData = NULL;613 } 614 615 m cbData = 0;616 617 RT_ZERO(m FormatEtc);618 m strFormats= "";609 if (m_pvData) 610 { 611 RTMemFree(m_pvData); 612 m_pvData = NULL; 613 } 614 615 m_cbData = 0; 616 617 RT_ZERO(m_FormatEtc); 618 m_strFormat = ""; 619 619 } 620 620 … … 626 626 RTCString VBoxDnDDropTarget::Formats(void) const 627 627 { 628 return m strFormats;628 return m_strFormat; 629 629 } 630 630 … … 639 639 LogFlowFunc(("msTimeout=%RU32\n", msTimeout)); 640 640 641 int rc = RTSemEventWait( hEventDrop, msTimeout);641 int rc = RTSemEventWait(m_EvtDrop, msTimeout); 642 642 if (RT_SUCCESS(rc)) 643 rc = m DroppedRc;643 rc = m_rcDropped; 644 644 645 645 LogFlowFuncLeaveRC(rc); -
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDnDEnumFormat.cpp
r82968 r85694 32 32 33 33 VBoxDnDEnumFormatEtc::VBoxDnDEnumFormatEtc(LPFORMATETC pFormatEtc, ULONG cFormats) 34 : m_ lRefCount(1),35 m_ nIndex(0)34 : m_cRefs(1), 35 m_uIdxCur(0) 36 36 { 37 37 HRESULT hr; … … 40 40 { 41 41 LogFlowFunc(("pFormatEtc=%p, cFormats=%RU32\n", pFormatEtc, cFormats)); 42 m_p FormatEtc = new FORMATETC[cFormats];42 m_paFormatEtc = new FORMATETC[cFormats]; 43 43 44 44 for (ULONG i = 0; i < cFormats; i++) … … 47 47 i, pFormatEtc[i].cfFormat, VBoxDnDDataObject::ClipboardFormatToString(pFormatEtc[i].cfFormat), 48 48 pFormatEtc[i].tymed, pFormatEtc[i].dwAspect)); 49 VBoxDnDEnumFormatEtc::CopyFormat(&m_p FormatEtc[i], &pFormatEtc[i]);49 VBoxDnDEnumFormatEtc::CopyFormat(&m_paFormatEtc[i], &pFormatEtc[i]); 50 50 } 51 51 52 m_ nNumFormats = cFormats;52 m_cFormats = cFormats; 53 53 hr = S_OK; 54 54 } … … 63 63 VBoxDnDEnumFormatEtc::~VBoxDnDEnumFormatEtc(void) 64 64 { 65 if (m_p FormatEtc)65 if (m_paFormatEtc) 66 66 { 67 for (ULONG i = 0; i < m_ nNumFormats; i++)67 for (ULONG i = 0; i < m_cFormats; i++) 68 68 { 69 if(m_p FormatEtc[i].ptd)70 CoTaskMemFree(m_p FormatEtc[i].ptd);69 if(m_paFormatEtc[i].ptd) 70 CoTaskMemFree(m_paFormatEtc[i].ptd); 71 71 } 72 72 73 delete[] m_p FormatEtc;74 m_p FormatEtc = NULL;73 delete[] m_paFormatEtc; 74 m_paFormatEtc = NULL; 75 75 } 76 76 77 LogFlowFunc(("m_lRefCount=%RI32\n", m_ lRefCount));77 LogFlowFunc(("m_lRefCount=%RI32\n", m_cRefs)); 78 78 } 79 79 … … 84 84 STDMETHODIMP_(ULONG) VBoxDnDEnumFormatEtc::AddRef(void) 85 85 { 86 return InterlockedIncrement(&m_ lRefCount);86 return InterlockedIncrement(&m_cRefs); 87 87 } 88 88 89 89 STDMETHODIMP_(ULONG) VBoxDnDEnumFormatEtc::Release(void) 90 90 { 91 LONG lCount = InterlockedDecrement(&m_ lRefCount);91 LONG lCount = InterlockedDecrement(&m_cRefs); 92 92 if (lCount == 0) 93 93 { … … 120 120 return E_INVALIDARG; 121 121 122 while ( m_ nIndex < m_nNumFormats122 while ( m_uIdxCur < m_cFormats 123 123 && ulCopied < cFormats) 124 124 { 125 125 VBoxDnDEnumFormatEtc::CopyFormat(&pFormatEtc[ulCopied], 126 &m_p FormatEtc[m_nIndex]);126 &m_paFormatEtc[m_uIdxCur]); 127 127 ulCopied++; 128 m_ nIndex++;128 m_uIdxCur++; 129 129 } 130 130 … … 137 137 STDMETHODIMP VBoxDnDEnumFormatEtc::Skip(ULONG cFormats) 138 138 { 139 m_ nIndex+= cFormats;140 return (m_ nIndex <= m_nNumFormats) ? S_OK : S_FALSE;139 m_uIdxCur += cFormats; 140 return (m_uIdxCur <= m_cFormats) ? S_OK : S_FALSE; 141 141 } 142 142 143 143 STDMETHODIMP VBoxDnDEnumFormatEtc::Reset(void) 144 144 { 145 m_ nIndex= 0;145 m_uIdxCur = 0; 146 146 return S_OK; 147 147 } … … 150 150 { 151 151 HRESULT hResult = 152 CreateEnumFormatEtc(m_ nNumFormats, m_pFormatEtc, ppEnumFormatEtc);152 CreateEnumFormatEtc(m_cFormats, m_paFormatEtc, ppEnumFormatEtc); 153 153 154 154 if (hResult == S_OK) 155 ((VBoxDnDEnumFormatEtc *) *ppEnumFormatEtc)->m_ nIndex = m_nIndex;155 ((VBoxDnDEnumFormatEtc *) *ppEnumFormatEtc)->m_uIdxCur = m_uIdxCur; 156 156 157 157 return hResult;
Note:
See TracChangeset
for help on using the changeset viewer.