bool ServiceUtil::is_exist(const tstring& name) { bool bReturn = false; do { scoped_scmgr_handle hSCMgr(GENERIC_READ); if (!hSCMgr.valid()) { break; } DWORD dwNeededBytes = 0; DWORD dwReturnedSerivice = 0; DWORD dwResumeEntryNum = 0; if (EnumServicesStatusEx(hSCMgr.get(), SC_ENUM_PROCESS_INFO, SERVICE_DRIVER | SERVICE_WIN32, SERVICE_STATE_ALL, NULL, 0, &dwNeededBytes, &dwReturnedSerivice, &dwResumeEntryNum, NULL)) { ErrorLog("EnumServicesStatusEx success while query needed bytes"); break; } CLastErrorFormat e; if (ERROR_MORE_DATA != e.code()) { ErrorLogLastErrEx(e, "EnumServicesStatusEx error code is not ERROR_MORE_DATA while query needed bytes"); break; } boost::scoped_array<BYTE> lpData(new BYTE[dwNeededBytes]); memset(lpData.get(), 0, dwNeededBytes); if (!EnumServicesStatusEx(hSCMgr.get(), SC_ENUM_PROCESS_INFO, SERVICE_DRIVER | SERVICE_WIN32, SERVICE_STATE_ALL, lpData.get(), dwNeededBytes, &dwNeededBytes, &dwReturnedSerivice, &dwResumeEntryNum, NULL)) { ErrorLogLastErr("EnumServicesStatusEx fail"); break; } ENUM_SERVICE_STATUS_PROCESS *lpServiceStatus = reinterpret_cast<ENUM_SERVICE_STATUS_PROCESS *>(lpData.get()); for (DWORD dwServiceIndex = 0; dwServiceIndex != dwReturnedSerivice; ++dwServiceIndex) { tstring cur_name = lpServiceStatus[dwServiceIndex].lpServiceName; if (boost::algorithm::iequals(cur_name, name)) { bReturn = true; break; } } } while (false); return bReturn; }
int LoadPattern::recvSelf(int cTag, Channel &theChannel, FEM_ObjectBroker &theBroker) { // get my current database tag // NOTE - dbTag equals 0 if not sending to a database OR has not yet been sent int myDbTag = this->getDbTag(); // into an ID we place all info needed to determine state of LoadPattern int numNod, numEle, numSPs; ID lpData(11); if (theChannel.recvID(myDbTag, cTag, lpData) < 0) { opserr << "LoadPattern::recvSelf - channel failed to recv the initial ID\n"; return -1; } isConstant = lpData(7); this->setTag(lpData(10)); if (isConstant == 0) { // we must recv the load factor in a Vector Vector data(2); if (theChannel.recvVector(myDbTag, cTag, data) < 0) { opserr << "LoadPattern::recvSelf - channel failed to recv the Vector\n"; return -2; } loadFactor = data(0); scaleFactor = data(1); } // read data about the time series if (lpData(8) != -1) { if (theSeries == 0) { theSeries = theBroker.getNewTimeSeries(lpData(8)); } else if (theSeries->getClassTag() != lpData(8)) { delete theSeries; theSeries = theBroker.getNewTimeSeries(lpData(8)); } if (theSeries == 0) { opserr << "LoadPattern::recvSelf - failed to create TimeSeries\n"; return -3; } theSeries->setDbTag(lpData(9)); if (theSeries->recvSelf(cTag, theChannel, theBroker) < 0) { opserr << "LoadPattern::recvSelf - the TimeSeries failed to recv\n"; return -3; } } /* if (theChannel.isDatastore() == 1) { static ID theLastSendTag(1); if (theChannel.recvID(myDbTag,0,theLastSendTag) == 0) lastGeoSendTag = theLastSendTag(0); } */ if (lastChannel != theChannel.getTag() || currentGeoTag != lpData(0) || theChannel.isDatastore() == 0) { // clear out the all the components in the current load pattern this->clearAll(); lastChannel = theChannel.getTag(); currentGeoTag = lpData(0); numNod = lpData(1); numEle = lpData(2); numSPs = lpData(3); dbNod = lpData(4); dbEle = lpData(5); dbSPs = lpData(6); // // now we rebuild the nodal loads // // first get the information from the domainData about the nodes if (numNod != 0) { ID nodeData(2*numNod); // now receive the ID about the nodes, class tag and dbTags if (theChannel.recvID(dbNod, currentGeoTag, nodeData) < 0) { opserr << "LoadPAttern::recvSelf - channel failed to recv the NodalLoad ID\n"; return -2; } // now for each NodalLoad we 1) get a new node of the correct type from the ObjectBroker // 2) ensure the node exists and set it's dbTag, 3) we invoke recvSelf on this new // blank node and 4) add this node to the domain int loc = 0; for (int i=0; i<numNod; i++) { int classTag = nodeData(loc); int dbTag = nodeData(loc+1); NodalLoad *theNode = theBroker.getNewNodalLoad(classTag); if (theNode == 0) { opserr << "LoadPattern::recv - cannot create NodalLoad with classTag " << classTag << endln; return -2; } theNode->setDbTag(dbTag); if (theNode->recvSelf(cTag, theChannel, theBroker) < 0) { opserr << "LoadPattern::recvSelf - NodalLoad with dbTag " << dbTag << " failed in recvSelf\n"; return -2; } if (this->addNodalLoad(theNode) == false) { opserr << "LoadPattern::recvSelf - failed adding NodalLoad tagged " << theNode->getTag() << " into LP!\n"; return -3; } loc+=2; } } // // now we rebuild the ElementalLoads .. same as NodalLoads above .. see comments above // if (numEle != 0) { ID eleData(2*numEle); if (theChannel.recvID(dbEle, currentGeoTag, eleData) < 0) { opserr << "LoadPattern::recvSelf - channel failed to recv the EleLoad ID\n"; return -2; } int loc = 0; for (int i=0; i<numEle; i++) { int classTag = eleData(loc); int dbTag = eleData(loc+1); ElementalLoad *theEle = theBroker.getNewElementalLoad(classTag); if (theEle == 0) { opserr << "LoadPattern::recv - cannot create ElementalLoad with classTag " << classTag << endln; return -2; } theEle->setDbTag(dbTag); if (theEle->recvSelf(cTag, theChannel, theBroker) < 0) { opserr << "LoadPattern::recvSelf - Ele with dbTag " << dbTag << " failed in recvSelf\n"; return -2; } if (this->addElementalLoad(theEle) == false) { opserr << "LoadPattern::recvSelf - could not add Ele with tag " << theEle->getTag() << " into LP!\n"; return -3; } loc+=2; } } // // now we rebuild the SP_Constraints .. same as nodes above .. see above if can't understand!! // if (numSPs != 0) { ID spData(2*numSPs); if (theChannel.recvID(dbSPs, currentGeoTag, spData) < 0) { opserr << "LoadPattern::recvSelf - channel failed to recv the SP_Constraints ID\n"; return -2; } int loc = 0; for (int i=0; i<numSPs; i++) { int classTag = spData(loc); int dbTag = spData(loc+1); SP_Constraint *theSP = theBroker.getNewSP(classTag); if (theSP == 0) { opserr << "LoadPattern::recv - cannot create SP_Constraint with classTag " << classTag << endln; return -2; } theSP->setDbTag(dbTag); if (theSP->recvSelf(cTag, theChannel, theBroker) < 0) { opserr << "LoadPattern::recvSelf - SP_Constraint with dbTag " << dbTag << " failed in recvSelf\n"; return -2; } if (this->addSP_Constraint(theSP) == false) { opserr << "LoadPattern::recvSelf - could not add SP_Constraint with tag " << theSP->getTag() << " into LP!\n"; return -3; } loc+=2; } } // now set the load pattern db count currentGeoTag = lpData(0); lastGeoSendTag = currentGeoTag; } else { if (theSeries != 0) if (theSeries->recvSelf(cTag, theChannel, theBroker) < 0) { opserr << "LoadPattern::recvSelf - the TimeSeries failed to recv\n"; return -3; } NodalLoad *theNode; NodalLoadIter &theNodes = this->getNodalLoads(); while ((theNode = theNodes()) != 0) { if (theNode->recvSelf(cTag, theChannel, theBroker) < 0) { opserr << "LoadPattern::recvSelf - node with tag " << theNode->getTag() << " failed in recvSelf\n"; return -7; } } ElementalLoad *theEle; ElementalLoadIter &theElements = this->getElementalLoads(); while ((theEle = theElements()) != 0) { if (theEle->recvSelf(cTag, theChannel, theBroker) < 0) { opserr << "LoadPattern::recvSelf - element with tag " << theEle->getTag() << " failed in recvSelf\n"; return -8; } } SP_Constraint *theSP; SP_ConstraintIter &theSPs = this->getSPs(); while ((theSP = theSPs()) != 0) { if (theSP->recvSelf(cTag, theChannel, theBroker) < 0) { opserr << "LoadPattern::recvSelf - SP_Constraint tagged " << theSP->getTag() << " failed recvSelf\n"; return -9; } } } // if we get here we are successfull return 0; }
int LoadPattern::sendSelf(int cTag, Channel &theChannel) { // get my current database tag // NOTE - dbTag equals 0 if not sending to a database OR has not yet been sent int myDbTag = this->getDbTag(); // into an ID we place all info needed to determine state of LoadPattern int numNodLd, numEleLd, numSPs; ID lpData(11); numNodLd = theNodalLoads->getNumComponents(); numEleLd = theElementalLoads->getNumComponents(); numSPs = theSPs->getNumComponents(); lpData(10) = this->getTag(); lpData(0) = currentGeoTag; lpData(1) = numNodLd; lpData(2) = numEleLd; lpData(3) = numSPs; if (dbNod == 0) { dbNod = theChannel.getDbTag(); dbEle = theChannel.getDbTag(); dbSPs = theChannel.getDbTag(); } lpData(4) = dbNod; lpData(5) = dbEle; lpData(6) = dbSPs; lpData(7) = isConstant; if (theSeries != 0) { int dbtag = theSeries->getDbTag(); int classtag = theSeries->getClassTag(); if (dbtag == 0) { dbtag = theChannel.getDbTag(); theSeries->setDbTag(dbtag); } lpData(8) = classtag; lpData(9) = dbtag; } else lpData(8) = -1; // see if we can save sending the vector containing just the load factor // will happen in parallel if sending the loadPattern .. not in database if (theChannel.sendID(myDbTag, cTag, lpData) < 0) { opserr << "LoadPattern::sendSelf - channel failed to send the initial ID\n"; return -1; } if (isConstant == 0) { Vector data(2); data(0) = loadFactor; data(1) = scaleFactor; if (theChannel.sendVector(myDbTag, cTag, data) < 0) { opserr << "LoadPattern::sendSelf - channel failed to send the Vector\n"; return -2; } } if (theSeries != 0) if (theSeries->sendSelf(cTag, theChannel) < 0) { opserr << "LoadPattern::sendSelf - the TimeSeries failed to send\n"; return -3; } // now check if data defining the objects in the LoadPAttern needs to be sent // NOTE THIS APPROACH MAY NEED TO CHANGE FOR VERY LARGE PROBLEMS IF CHANNEL CANNOT // HANDLE VERY LARGE ID OBJECTS. /* if (theChannel.isDatastore() == 1) { static ID theLastSendTag(1); if (theChannel.recvID(myDbTag,0,theLastSendTag) == 0) lastGeoSendTag = theLastSendTag(0); else lastGeoSendTag = -1; } */ if (lastChannel != theChannel.getTag() || lastGeoSendTag != currentGeoTag || theChannel.isDatastore() == 0) { lastChannel = theChannel.getTag(); // // into an ID we are gonna place the class and db tags for each node so can rebuild // this ID we then send to the channel // // create the ID and get the node iter if (numNodLd != 0) { ID nodeData(numNodLd*2); NodalLoad *theNode; NodalLoadIter &theNodes = this->getNodalLoads(); int loc =0; // loop over nodes in domain adding their classTag and dbTag to the ID while ((theNode = theNodes()) != 0) { nodeData(loc) = theNode->getClassTag(); int dbTag = theNode->getDbTag(); // if dbTag still 0 get one from Channel; // if this tag != 0 set the dbTag in node if (dbTag == 0 && myDbTag != 0) {// go get a new tag and setDbTag in ele if this not 0 dbTag = theChannel.getDbTag(); if (dbTag != 0) theNode->setDbTag(dbTag); } nodeData(loc+1) = dbTag; loc+=2; } // now send the ID if (theChannel.sendID(dbNod, currentGeoTag, nodeData) < 0) { opserr << "LoadPattern::sendSelf - channel failed to send the NodalLoads ID\n"; return -4; } } // we do the same for elemental loads as we did for nodal loads above .. see comments above! if (numEleLd != 0) { ID elementData(numEleLd*2); ElementalLoad *theEle; ElementalLoadIter &theElements = this->getElementalLoads(); int loc = 0; while ((theEle = theElements()) != 0) { elementData(loc) = theEle->getClassTag(); int dbTag = theEle->getDbTag(); if (dbTag == 0 && myDbTag != 0) {// go get a new tag and setDbTag in ele if this not 0 dbTag = theChannel.getDbTag(); if (dbTag != 0) theEle->setDbTag(dbTag); } elementData(loc+1) = dbTag; loc+=2; } // now send the ID if (theChannel.sendID(dbEle, currentGeoTag, elementData) < 0) { opserr << "Domain::send - channel failed to send the element ID\n"; return -5; } } // we do the same for SP_Constraints as for NodalLoads above .. see comments above! if (numSPs != 0) { ID spData(numSPs*2); SP_Constraint *theSP; SP_ConstraintIter &theSPs = this->getSPs(); int loc = 0; while ((theSP = theSPs()) != 0) { spData(loc) = theSP->getClassTag(); int dbTag = theSP->getDbTag(); if (dbTag == 0 && myDbTag != 0) {// go get a new tag and setDbTag in ele if this not 0 dbTag = theChannel.getDbTag(); if (dbTag != 0) theSP->setDbTag(dbTag); } spData(loc+1) = dbTag; loc+=2; } if (theChannel.sendID(dbSPs, currentGeoTag, spData) < 0) { opserr << "LoadPAttern::sendSelf - channel failed sending SP_Constraint ID\n"; return -6; } } // set the lst send db tag so we don't have to do all that again lastGeoSendTag = currentGeoTag; if (theChannel.isDatastore() == 1) { static ID theLastSendTag(1); theLastSendTag(0) = lastGeoSendTag; theChannel.sendID(myDbTag,0, theLastSendTag); } } // now we invoke sendSelf on all the NodalLoads, ElementalLoads and SP_Constraints // which have been added to the LoadCase NodalLoad *theNode; NodalLoadIter &theNodes = this->getNodalLoads(); while ((theNode = theNodes()) != 0) { if (theNode->sendSelf(cTag, theChannel) < 0) { opserr << "LoadPattern::sendSelf - node with tag " << theNode->getTag() << " failed in sendSelf\n"; return -7; } } ElementalLoad *theEle; ElementalLoadIter &theElements = this->getElementalLoads(); while ((theEle = theElements()) != 0) { if (theEle->sendSelf(cTag, theChannel) < 0) { opserr << "LoadPattern::sendSelf - element with tag " << theEle->getTag() << " failed in sendSelf\n"; return -8; } } SP_Constraint *theSP; SP_ConstraintIter &theSPs = this->getSPs(); while ((theSP = theSPs()) != 0) { if (theSP->sendSelf(cTag, theChannel) < 0) { opserr << "LoadPattern::sendSelf - SP_Constraint: " << *theSP << " failed sendSelf\n"; return -9; } } // if we get here we are successfull return 0; }
int MeshRegion::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker) { // get my current database tag // NOTE - dbTag equals 0 if not sending to a database OR has not yet been sent int myDbTag = this->getDbTag(); // into an ID we place all info needed to determine state of MeshRegion ID lpData(6); if (theChannel.recvID(myDbTag, commitTag, lpData) < 0) { opserr << "MeshRegion::recvSelf - channel failed to recv the initial ID\n"; return -1; } // only recv the nodes & ele if not current if (currentGeoTag != lpData(0)) { currentGeoTag = lpData(0); this->setTag(lpData(1)); int numEle = lpData(2); int numNod = lpData(3); if (theNodes != 0) { delete theNodes; theNodes = 0; } if (theElements != 0) { delete theElements; theElements = 0; } if (numEle != 0) theElements = new ID(numEle); if (numNod != 0) theNodes = new ID(numNod); if (numNod != 0) if (theChannel.recvID(dbNod, currentGeoTag, *theNodes) < 0) { opserr << "MeshRegion::sendSelf - channel failed to recv the nodes\n"; return -1; } if (numEle != 0) if (theChannel.recvID(dbEle, currentGeoTag, *theElements) < 0) { opserr << "MeshRegion::sendSelf - channel failed to recv the elements\n"; return -1; } Vector dData(4); if (theChannel.sendVector(dbEle, currentGeoTag, dData) < 0) { opserr << "MeshRegion::sendSelf - channel failed to send the elements\n"; return -1; } alphaM = dData(0); betaK = dData(1); betaK0 = dData(2); betaKc = dData(3); } this->setRayleighDampingFactors(alphaM, betaK, betaK0, betaKc); return 0; }
int MeshRegion::sendSelf(int commitTag, Channel &theChannel) { // get my current database tag // NOTE - dbTag equals 0 if not sending to a database OR has not yet been sent int myDbTag = this->getDbTag(); // into an ID we place all info needed to determine state of LoadPattern ID lpData(6); lpData(0) = currentGeoTag; lpData(1) = this->getTag(); int numEle= theElements->Size(); int numNod = theNodes->Size(); lpData(2) = numEle; lpData(3) = numNod; if (dbNod == 0) { dbNod = theChannel.getDbTag(); dbEle = theChannel.getDbTag(); } lpData(4) = dbNod; lpData(5) = dbEle; if (theChannel.sendID(myDbTag, commitTag, lpData) < 0) { opserr << "MeshRegion::sendSelf - channel failed to send the initial ID\n"; return -1; } // now check if data defining the objects in the LoadPAttern needs to be sent // NOTE THIS APPROACH MAY NEED TO CHANGE FOR VERY LARGE PROBLEMS IF CHANNEL CANNOT // HANDLE VERY LARGE ID OBJECTS. if (lastGeoSendTag != currentGeoTag) { if (numNod != 0) if (theChannel.sendID(dbNod, currentGeoTag, *theNodes) < 0) { opserr << "MeshRegion::sendSelf - channel failed to send the nodes\n"; return -1; } if (numEle != 0) if (theChannel.sendID(dbEle, currentGeoTag, *theElements) < 0) { opserr << "MeshRegion::sendSelf - channel failed to send the elements\n"; return -1; } Vector dData(4); dData(0) = alphaM; dData(1) = betaK; dData(2) = betaK0; dData(3) = betaKc; if (theChannel.sendVector(dbEle, currentGeoTag, dData) < 0) { opserr << "MeshRegion::sendSelf - channel failed to send the elements\n"; return -1; } // set the lst send db tag so we don't have to send them again unless they change lastGeoSendTag = currentGeoTag; } return 0; }
BOOL CDDStatic::OnRenderGlobalData(LPFORMATETC lpFormatEtc, HGLOBAL* phGlobal) { pws_os::Trace(L"CDDStatic::OnRenderGlobalData: %s; ci == %p\n", lpFormatEtc->cfFormat == CF_UNICODETEXT ? L"CF_UNICODETEXT" : L"CF_TEXT", m_pci); if (lpFormatEtc->cfFormat != CF_UNICODETEXT && lpFormatEtc->cfFormat != CF_TEXT) return FALSE; if (m_hgDataTXT != NULL) { pws_os::Trace(L"CDDStatic::OnRenderGlobalData - Unlock/Free m_hgDataTXT\n"); GlobalUnlock(m_hgDataTXT); GlobalFree(m_hgDataTXT); m_hgDataTXT = NULL; } if (m_hgDataUTXT != NULL) { pws_os::Trace(L"CDDStatic::OnRenderGlobalData - Unlock/Free m_hgDataUTXT\n"); GlobalUnlock(m_hgDataUTXT); GlobalFree(m_hgDataUTXT); m_hgDataUTXT = NULL; } StringX cs_dragdata; if (m_pci == NULL) { if (m_groupname.empty()) { pws_os::Trace(L"CDDStatic::OnRenderGlobalData - mpci == NULL\n"); return FALSE; } else { cs_dragdata = m_groupname; } } else { // m_pci != NULL const CItemData *pci(m_pci); // Handle shortcut or alias if ((m_nID == IDC_STATIC_DRAGPASSWORD && pci->IsAlias()) || (pci->IsShortcut() && (m_nID != IDC_STATIC_DRAGGROUP && m_nID != IDC_STATIC_DRAGTITLE && m_nID != IDC_STATIC_DRAGUSER))) { pci = app.GetMainDlg()->GetBaseEntry(pci); } cs_dragdata = GetData(pci); if (cs_dragdata.empty() && m_nID != IDC_STATIC_DRAGAUTO) return FALSE; } const size_t ilen = cs_dragdata.length(); if (ilen == 0 && m_nID != IDC_STATIC_DRAGAUTO) { // Nothing to do - why were we even called??? return FALSE; } DWORD dwBufLen; LPSTR lpszA(NULL); LPWSTR lpszW(NULL); if (lpFormatEtc->cfFormat == CF_UNICODETEXT) { // So is requested data! dwBufLen = (DWORD)((ilen + 1) * sizeof(wchar_t)); lpszW = new WCHAR[ilen + 1]; //pws_os::Trace(L"lpszW allocated %p, size %d\n", lpszW, dwBufLen); if (ilen == 0) { lpszW[ilen] = L'\0'; } else { (void) wcsncpy_s(lpszW, ilen + 1, cs_dragdata.c_str(), ilen); } } else { // They want it in ASCII - use lpszW temporarily if (ilen == 0) { dwBufLen = 1; lpszA = new char[dwBufLen]; lpszA = '\0'; } else { lpszW = const_cast<LPWSTR>(cs_dragdata.c_str()); dwBufLen = WideCharToMultiByte(CP_ACP, 0, lpszW, -1, NULL, 0, NULL, NULL); ASSERT(dwBufLen != 0); lpszA = new char[dwBufLen]; pws_os::Trace(L"lpszA allocated %p, size %d\n", lpszA, dwBufLen); WideCharToMultiByte(CP_ACP, 0, lpszW, -1, lpszA, dwBufLen, NULL, NULL); lpszW = NULL; } } LPVOID lpData(NULL); LPVOID lpDataBuffer; HGLOBAL *phgData; if (lpFormatEtc->cfFormat == CF_UNICODETEXT) { lpDataBuffer = (LPVOID)lpszW; phgData = &m_hgDataUTXT; } else { lpDataBuffer = (LPVOID)lpszA; phgData = &m_hgDataTXT; } BOOL retval(FALSE); if (*phGlobal == NULL) { //pws_os::Trace(L"CDDStatic::OnRenderGlobalData - Alloc global memory\n"); *phgData = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, dwBufLen); ASSERT(*phgData != NULL); if (*phgData == NULL) goto bad_return; lpData = GlobalLock(*phgData); ASSERT(lpData != NULL); if (lpData == NULL) goto bad_return; // Copy data memcpy(lpData, lpDataBuffer, dwBufLen); *phGlobal = *phgData; retval = TRUE; } else { pws_os::Trace(L"CDDStatic::OnRenderGlobalData - *phGlobal NOT NULL!\n"); SIZE_T inSize = GlobalSize(*phGlobal); SIZE_T ourSize = GlobalSize(*phgData); if (inSize < ourSize) { // Pre-allocated space too small. Not allowed to increase it - FAIL pws_os::Trace(L"CDDStatic::OnRenderGlobalData - NOT enough room - FAIL\n"); } else { // Enough room - copy our data into supplied area pws_os::Trace(L"CDDStatic::OnRenderGlobalData - enough room - copy our data\n"); LPVOID pInGlobalLock = GlobalLock(*phGlobal); ASSERT(pInGlobalLock != NULL); if (pInGlobalLock == NULL) goto bad_return; memcpy(pInGlobalLock, lpDataBuffer, ourSize); GlobalUnlock(*phGlobal); retval = TRUE; } } bad_return: // Finished with buffer - trash it trashMemory(lpDataBuffer, dwBufLen); // Free the strings (only one is actually in use) //pws_os::Trace(L"lpszA freed %p\n", lpszA); delete[] lpszA; //pws_os::Trace(L"lpszW freed %p\n", lpszW); delete[] lpszW; // Since lpDataBuffer pointed to one of the above - just zero the pointer lpDataBuffer = NULL; // If retval == TRUE, recipient is responsible for freeing the global memory // if D&D succeeds (see after StartDragging in OnMouseMove) if (retval == FALSE) { pws_os::Trace(L"CDDStatic::OnRenderGlobalData - returning FALSE!\n"); if (lpData != NULL) { GlobalFree(*phgData); *phgData = NULL; } } else { pws_os::Trace(L"CDDStatic::OnRenderGlobalData - D&D Data:"); if (lpFormatEtc->cfFormat == CF_UNICODETEXT) { pws_os::Trace(L"\"%ls\"\n", (LPWSTR)lpData); // data is Unicode } else { pws_os::Trace(L"\"%hs\"\n", (LPSTR)lpData); // data is NOT Unicode } } // Unlock our buffer if (lpData != NULL) GlobalUnlock(*phgData); return retval; }