VOID RemoveMessagesFromBuyThreadQueue(CONTENT_PARTNER_THREAD_CONTEXT* pThreadCtx) { BUY_CONTEXT* pBuyCtx = NULL; MSG msg = {0}; while( PeekMessage( &msg, NULL, pThreadCtx->buyThreadContext.msgBuy, pThreadCtx->buyThreadContext.msgBuy, PM_REMOVE ) ) { ATLTRACE2("%x: RemoveMessagesFromBuyThreadQueue: PeekMessage in cleanup retrieved message to buy.\n", GetCurrentThreadId()); pBuyCtx = reinterpret_cast<BUY_CONTEXT*>(msg.lParam); if(NULL != pBuyCtx) { if(NULL != pBuyCtx->cookie) { pBuyCtx->pIStream->Release(); pBuyCtx->pIStream = NULL; } delete pBuyCtx; pBuyCtx = NULL; } } // while PeekMessage }
static void GetRestrictions(ULONG cRestrictions, const VARIANT *rgRestrictions, PWSTR tableName) { //if (cRestrictions >= 3 && V_VT(&rgRestrictions[2]) == VT_BSTR && V_BSTR(&rgRestrictions[2]) != NULL) //{ // CW2A constraint(V_BSTR(&rgRestrictions[2])); // ATLTRACE2("\tConstraint Name = %s\n", (LPSTR)constraint); // strncpy(constraint, constraintName, 127); // constraint[127] = '\0'; //} if (cRestrictions >= 5 && V_VT(&rgRestrictions[5]) == VT_BSTR && V_BSTR(&rgRestrictions[5]) != NULL) { ATLTRACE2(L"\tTable Name = %s\n", V_BSTR(&rgRestrictions[5])); wcsncpy(tableName, V_BSTR(&rgRestrictions[5]), 127); tableName[127] = '\0'; // ensure zero-terminated string } //if (cRestrictions >= 6 && V_VT(&rgRestrictions[5]) == VT_BSTR && V_BSTR(&rgRestrictions[5]) != NULL) //{ // CW2A column_name(V_BSTR(&rgRestrictions[5])); // ATLTRACE2("\tColumn Name = %s\n", (LPSTR)column_name); //} }
HRESULT STDMETHODCALLTYPE CMMNotificationClient::OnDeviceAdded(LPCWSTR pwstrDeviceId) { // _PrintDeviceName(pwstrDeviceId); manager->notifyDeviceAddedListeners(pwstrDeviceId); ATLTRACE2(" -->Added device\n"); return S_OK; };
STDMETHODIMP CDelay::Process(ULONG ulSize, BYTE *pData, REFERENCE_TIME refTimeStart, DWORD dwFlags) { if (dwFlags &= ~DMO_INPLACE_ZERO) return E_INVALIDARG; if (!pData) { return E_POINTER; } ATLTRACE2(atlTraceGeneral, 3, "Process: %d bytes. Time stamp: %f\n", ulSize, RefTime2Double(refTimeStart)); LockIt lock(this); if (!InputTypeSet(0) || !OutputTypeSet(0)) { return DMO_E_TYPE_NOT_SET; } // Make sure all streams have media types set and resources are allocated HRESULT hr = AllocateStreamingResources(); if (SUCCEEDED(hr)) hr = DoProcessOutput(pData, pData, ulSize / m_pWave->nBlockAlign); return hr; // If this DMO supported an effect tail, it would return S_FALSE until // the tail was processed. See IMediaObjectInPlace::Process documentation. }
VOID RemoveMessagesFromDownloadThreadQueue(CONTENT_PARTNER_THREAD_CONTEXT* pThreadCtx) { DOWNLOAD_BATCH_CONTEXT* pBatchCtx = NULL; MSG msg = {0}; while( PeekMessage( &msg, NULL, pThreadCtx->downloadThreadContext.msgDownloadBatch, pThreadCtx->downloadThreadContext.msgDownloadBatch, PM_REMOVE ) ) { ATLTRACE2("%x: RemoveMessagesFromDownloadThreadQueue: PeekMessage in cleanup retrieved message to download a batch.\n", GetCurrentThreadId()); pBatchCtx = reinterpret_cast<DOWNLOAD_BATCH_CONTEXT*>(msg.lParam); if(NULL != pBatchCtx) { if(NULL != pBatchCtx->pIStream) { pBatchCtx->pIStream->Release(); pBatchCtx->pIStream = NULL; } delete pBatchCtx; pBatchCtx = NULL; } } // while PeekMessage }
VOID RemoveMessagesFromListThreadQueue(CONTENT_PARTNER_THREAD_CONTEXT* pThreadCtx) { LIST_CONTEXT* pListCtx = NULL; MSG msg = {0}; while( PeekMessage( &msg, NULL, pThreadCtx->listThreadContext.msgGetListContents, pThreadCtx->listThreadContext.msgGetListContents, PM_REMOVE ) ) { ATLTRACE2("%x: RemoveMessagesFromListThreadQueue: PeekMessage in cleanup retrieved a get-list-contents message.\n", GetCurrentThreadId()); pListCtx = reinterpret_cast<LIST_CONTEXT*>(msg.lParam); if(NULL != pListCtx) { SysFreeString(pListCtx->location); // OK to pass NULL. VariantClear( &(pListCtx->context) ); SysFreeString(pListCtx->bstrListType); SysFreeString(pListCtx->bstrParams); delete pListCtx; pListCtx = NULL; } } // while PeekMessage }
HRESULT CDelay::InternalProcessInput(DWORD dwInputStreamIndex, IMediaBuffer *pBuffer, DWORD dwFlags, REFERENCE_TIME rtTimestamp, REFERENCE_TIME rtTimelength) { _ASSERTE(m_pBuffer == NULL); HRESULT hr = pBuffer->GetBufferAndLength(&m_pbInputData, &m_cbInputLength); if (FAILED(hr)) { return hr; } ATLTRACE2(atlTraceGeneral, 3, "Process Input: %d bytes. Time stamp: %f/%f\n", m_cbInputLength, RefTime2Double(rtTimestamp), RefTime2Double(rtTimelength)); if (m_cbInputLength <= 0) return E_FAIL; m_pBuffer = pBuffer; if (dwFlags & DMO_INPUT_DATA_BUFFERF_TIME) { m_bValidTime = true; m_rtTimestamp = rtTimestamp; } else { m_bValidTime = false; } return S_OK; }
void CDonutView::OnMultiDlImages(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/) { ATLTRACE2( atlTraceGeneral, 4, _T("CDonutView::OnMultiDlImages\n") ); if ( _ToggleFlag(ID_DLCTL_DLIMAGES, DLCTL_DLIMAGES) ) _LightRefresh(); }
CMultipleResult::~CMultipleResult() { ATLTRACE2(atlTraceDBProvider, 2, _T("CMultipleResult::~CMultipleResult()\n")); this->GetSessionPtr()->AutoCommit(NULL); if(m_spUnkSite) GetSessionPtr()->RegisterTxnCallback(this, false); }
HRESULT STDMETHODCALLTYPE CMMNotificationClient::OnDeviceStateChanged( LPCWSTR pwstrDeviceId, DWORD dwNewState) { char *pszState = "?????"; // _PrintDeviceName(pwstrDeviceId); switch (dwNewState) { case DEVICE_STATE_ACTIVE: pszState = "ACTIVE"; break; case DEVICE_STATE_DISABLED: pszState = "DISABLED"; break; case DEVICE_STATE_NOTPRESENT: pszState = "NOTPRESENT"; break; case DEVICE_STATE_UNPLUGGED: pszState = "UNPLUGGED"; break; } ATLTRACE2(" -->New device state is DEVICE_STATE_%s (0x%8.8x)\n", pszState, dwNewState); return S_OK; }
void CComSafeArray::Create(VARTYPE vtSrc, DWORD dwDims, SAFEARRAYBOUND *rgsabound) { ATLASSERT(dwDims > 0); ATLASSERT(rgsabound != NULL); // Validate the VARTYPE for SafeArrayCreate call ATLASSERT( !(vtSrc & VT_ARRAY) ); ATLASSERT( !(vtSrc & VT_BYREF) ); ATLASSERT( !(vtSrc & VT_VECTOR) ); ATLASSERT(vtSrc != VT_EMPTY); ATLASSERT(vtSrc != VT_NULL); // Free up old safe array if necessary Clear(); ATLTRY( parray = ::SafeArrayCreate(vtSrc, dwDims, rgsabound) ); if (parray == NULL) { ATLTRACE2(atlTraceDBProvider, 0, "CComSafeArray::Create Error : OOM\n"); return; } vt = unsigned short (vtSrc | VT_ARRAY); m_dwDims = dwDims; m_dwElementSize = GetElemSize(); }
VOID RemoveMessagesFromSendMessageThreadQueue(CONTENT_PARTNER_THREAD_CONTEXT* pThreadCtx) { SEND_MESSAGE_CONTEXT* pSendMsgCtx = NULL; MSG msg = {0}; while( PeekMessage( &msg, NULL, pThreadCtx->sendMessageThreadContext.msgSendMessage, pThreadCtx->sendMessageThreadContext.msgSendMessage, PM_REMOVE ) ) { ATLTRACE2("%x: RemoveMessagesFromSendMessageThreadQueue: PeekMessage in cleanup retrieved a send-message message.\n", GetCurrentThreadId()); pSendMsgCtx = reinterpret_cast<SEND_MESSAGE_CONTEXT*>(msg.lParam); if(NULL != pSendMsgCtx) { SysFreeString(pSendMsgCtx->bstrMsg); // OK to pass NULL. SysFreeString(pSendMsgCtx->bstrParam); delete pSendMsgCtx; pSendMsgCtx = NULL; } } // while PeekMessage }
const FileStatusCacheEntry * GitFolderStatus::GetCachedItem(const CTGitPath& filepath) { sCacheKey.assign(filepath.GetWinPath()); FileStatusMap::const_iterator iter; const FileStatusCacheEntry *retVal; if(m_mostRecentPath.IsEquivalentTo(CTGitPath(sCacheKey.c_str()))) { // We've hit the same result as we were asked for last time ATLTRACE2(_T("fast cache hit for %s\n"), filepath); retVal = m_mostRecentStatus; } else if ((iter = m_cache.find(sCacheKey)) != m_cache.end()) { ATLTRACE2(_T("cache found for %s\n"), filepath); retVal = &iter->second; m_mostRecentStatus = retVal; m_mostRecentPath = CTGitPath(sCacheKey.c_str()); } else { retVal = NULL; } if(retVal != NULL) { // We found something in a cache - check that the cache is not timed-out or force-invalidated DWORD now = GetTickCount(); if ((now >= m_TimeStamp)&&((now - m_TimeStamp) > GetTimeoutValue())) { // Cache is timed-out ATLTRACE("Cache timed-out\n"); ClearCache(); retVal = NULL; } else if(WaitForSingleObject(m_hInvalidationEvent, 0) == WAIT_OBJECT_0) { // TortoiseProc has just done something which has invalidated the cache ATLTRACE("Cache invalidated\n"); ClearCache(); retVal = NULL; } return retVal; } return NULL; }
CAccelerator::CAccelerator() : m_hAccel(NULL), m_hAdditionalAccel(NULL), m_pEntriesTable(new stAccelEntry[ACCEL_COUNT]), m_pAccelTable(new ACCEL[ACCEL_COUNT]) { ATLTRACE2(atlTraceGeneral, 0, "Accelerator: Accelerator table contains %d items\n", ACCEL_COUNT); }
HRESULT STDMETHODCALLTYPE C[!output Safe_root]::DownloadTrackComplete( HRESULT hrResult, ULONG contentID, BSTR /*downloadTrackParam*/) { if(FAILED(hrResult)) { ATLTRACE2("%x: DownloadTrackComplete: Windows Media Player failed to download track %d.\n", GetCurrentThreadId(), contentID); ++g.totalDownloadFailures; } else { ATLTRACE2("%x: DownloadTrackComplete: Windows Media Player has completed the download for track %d.\n", GetCurrentThreadId(), contentID); } return S_OK; } // DownloadTrackComplete
// a macro that outputs the message to the Debug console if a debug build void DEBUGOUT(const char * fmt, ...) { #if _DEBUG va_list ap; va_start(ap, fmt); ATLTRACE2(fmt, ap); ATLTRACE("\n"); va_end(ap); #endif }
static void GetRestrictions(ULONG cRestrictions, const VARIANT *rgRestrictions, PWSTR table_name, PWSTR column_name) { // restriction이 없다고 항상 cRestrictions==0은 아니다. // 따라서 vt!=VT_EMPTY인지 등도 검사해줘야 한다. if(cRestrictions>=3 && V_VT(&rgRestrictions[2])==VT_BSTR && V_BSTR(&rgRestrictions[2])!=NULL) { // TABLE_NAME restriction wcsncpy(table_name, V_BSTR(&rgRestrictions[2]), 1023); ATLTRACE2(L"\tTable Name = %s\n", V_BSTR(&rgRestrictions[2])); table_name[1023] = 0; // ensure zero-terminated string } if(cRestrictions>=4 && V_VT(&rgRestrictions[3])==VT_BSTR && V_BSTR(&rgRestrictions[3])!=NULL) { // COLUMN_NAME restriction wcsncpy(column_name, V_BSTR(&rgRestrictions[3]), 1023); ATLTRACE2("\tColumn Name = %s\n", V_BSTR(&rgRestrictions[3])); column_name[1023] = 0; // ensure zero-terminated string } }
// この関数もMtlWin.hの中で浮いていたので隔離した // もしかしたら作ったの自分かも HWND _CreateSimpleReBarCtrl(HWND hWndParent, DWORD dwStyle, UINT nID) { // Ensure style combinations for proper rebar painting if (dwStyle & CCS_NODIVIDER && dwStyle & WS_BORDER) dwStyle &= ~WS_BORDER; else if ( !(dwStyle & WS_BORDER) && !(dwStyle & CCS_NODIVIDER) ) dwStyle |= CCS_NODIVIDER; // Create rebar window HWND hWndReBar = ::CreateWindowEx( 0, REBARCLASSNAME, NULL, dwStyle, 0, 0, 100, 100, hWndParent, (HMENU) LongToHandle(nID), _Module.GetModuleInstance(), NULL ); if (hWndReBar == NULL) { ATLTRACE2( atlTraceUI, 0, _T("Failed to create rebar.\n") ); return NULL; } // Initialize and send the REBARINFO structure REBARINFO rbi; rbi.cbSize = sizeof (REBARINFO); rbi.fMask = 0; if ( !::SendMessage(hWndReBar, RB_SETBARINFO, 0, (LPARAM) &rbi) ) { ATLTRACE2( atlTraceUI, 0, _T("Failed to initialize rebar.\n") ); ::DestroyWindow(hWndReBar); return NULL; } return hWndReBar; }
LUALIB_API void luaX_showtable(lua_State* L, int ix, const char* label/* = 0*/) { lua_checkstack(L, 6); if (lua_istable(L, ix)) { ATLTRACE2("%s:: Contents of table at index %i.\n", label, ix); int aix = ix; if (aix < 0) aix = lua_gettop(L) + aix + 1; lua_pushnil(L); while (lua_next(L, aix) != 0) { const char* ke = luaC_pushdstring(L, -2, 20); const char* vl = luaC_pushdstring(L, -2, 40); ATLTRACE2("++ Key: %s; Value: %s.\n", ke, vl); lua_pop(L, 3); } } else { ATLTRACE2("%s:: Value at index %i is not a table.\n", label, ix); } }
static void GetRestrictions(ULONG cRestrictions, const VARIANT *rgRestrictions, PWSTR view_name) { // restriction이 없다고 항상 cRestrictions==0은 아니다. // 따라서 vt!=VT_EMPTY인지 등도 검사해줘야 한다. if(cRestrictions>=3 && V_VT(&rgRestrictions[2])==VT_BSTR && V_BSTR(&rgRestrictions[2])!=NULL) { // TABLE_NAME restriction ATLTRACE2(L"\tView Name = %s\n", V_BSTR(&rgRestrictions[2])); wcsncpy(view_name, V_BSTR(&rgRestrictions[2]), 255); view_name[255] = 0; // ensure zero-terminated string } }
void GetInstalledBoardInfo(short *ids, short *len) { short cnt=0; int MaxBoards=0; // Maximum number of boards UL will support. char BoardName[BOARDNAMELEN]; _ASSERT(ids); cbGetConfig(GLOBALINFO,0,0,GINUMBOARDS,&MaxBoards); ATLTRACE2(MCC_UL_CALL,3,"cbGetConfig (GLOBALINFO,0,0,GINUMBOARDS, &MaxBoards); result: MaxBoards=%d\n",MaxBoards); for (int i=0; i<MaxBoards; i++) { // Just use this call to determine if board num is valid. if (!cbGetBoardName(i,BoardName)) { ATLTRACE2(MCC_UL_CALL,3,"cbGetBoardName (i = %d,BoardName); result: BoardName=%s\n",i,BoardName); ids[cnt++]=i; } } *len=cnt; }
// id is the BoardNumber void EnumSubsystems(short id, bool *ai, bool *ao, bool *dio) { // The following information, for now, is only used to determine // what subsytems the HW supports. int ADchans; // Number of A/D chans. int DAchans; // Number of D/A chans. int DIOdevs; // Number of Digital IO devices on board. // Determine the capability of each board, AIn, AOut, DIO cbGetConfig(BOARDINFO, id, 0, BINUMADCHANS, &ADchans); ATLTRACE2(MCC_UL_CALL,3,"cbGetConfig (BOARDINFO,id = %d,0,BINUMADCHANS, &ADchans); result: ADchans=%d\n",id,ADchans); if (ADchans) *ai=true; cbGetConfig(BOARDINFO, id, 0, BINUMDACHANS, &DAchans); ATLTRACE2(MCC_UL_CALL,3,"cbGetConfig (BOARDINFO,id = %d,0,BINUMDACHANS, &DAchans); result: DAchans=%d\n",id,DAchans); if (DAchans) *ao=true; cbGetConfig(BOARDINFO, id, 0, BIDINUMDEVS, &DIOdevs); ATLTRACE2(MCC_UL_CALL,3,"cbGetConfig (BOARDINFO,id = %d,0,BIDINUMDEVS, &DIOdevs); result: DIOdevs=%d\n",id,DIOdevs); if (DIOdevs) *dio=true; }
SocketAccepter::SocketAccepter(SocketEventHandle *eventHandle):SocketHandle(eventHandle,NULL) { DWORD bytes = 0; GUID acceptex_guid = WSAID_ACCEPTEX; if (WSAIoctl(socket_,SIO_GET_EXTENSION_FUNCTION_POINTER, &acceptex_guid,sizeof(acceptex_guid), &fnAcceptEx_,sizeof(fnAcceptEx_), &bytes,NULL,NULL) == SOCKET_ERROR) { ATLTRACE2("failed to load AcceptEx: %d\n", WSAGetLastError()); } }
DBSTATUS CSRViewColumnUsage::GetDBStatus(CSimpleRow *pRow, ATLCOLUMNINFO *pInfo) { ATLTRACE2(atlTraceDBProvider, 3, "CSRViewColumnUsage::GetDBStatus\n"); switch(pInfo->iOrdinal) { case 3: // VIEW_NAME case 6: // TABLE_NAME case 7: // COLUMN_NAME return DBSTATUS_S_OK; default: return DBSTATUS_S_ISNULL; } }
CComBSTR CbDevice::GetErrMsg(short code) { char ErrMsg[ERRSTRLEN+16]; strcpy(ErrMsg,"MCC: "); cbGetErrMsg((short)code,ErrMsg+strlen(ErrMsg)); ATLTRACE2(MCC_UL_CALL,3,"cbGetErrMsg(code = %d,ErrMsg); result: ErrMsg=%s\n",code,ErrMsg); // Allocate memory and copy input retVal. The Detach is required // so that the memory will not be freed. We need the string to be // returned to the 'engine'. return ErrMsg; }
HRESULT STDMETHODCALLTYPE C[!output Safe_root]::InvokeCommand( DWORD dwCommandID, BSTR /*location*/, VARIANT* /*pLocationContext*/, BSTR /*itemLocation*/, ULONG /*cItemIDs*/, ULONG* /*rgItemIDs*/) { ATLTRACE2("%x InvokeCommand: dwCommandID = %d.\n", GetCurrentThreadId(), dwCommandID); // ToDo: Execute the context menu command specified by dwCommandID. return S_OK; }
static void GetRestrictions(ULONG cRestrictions, const VARIANT *rgRestrictions, char *table_name) { // restriction이 없다고 항상 cRestrictions==0은 아니다. // 따라서 vt!=VT_EMPTY인지 등도 검사해줘야 한다. if(cRestrictions>=3 && V_VT(&rgRestrictions[2])==VT_BSTR && V_BSTR(&rgRestrictions[2])!=NULL) { // TABLE_NAME restriction CW2A name(V_BSTR(&rgRestrictions[2])); ATLTRACE2("\tTable Name = %s\n", (LPSTR)name); strncpy(table_name, name, 255); table_name[255] = 0; // ensure zero-terminated string } }
void PerformanceMonitor::BlockShutdown() { if (block_) return; block_ = true; if (!SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_AWAYMODE_REQUIRED) && !SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED)) ATLTRACE2(L"Failed to set thread execution state.\n"); CString text; text.LoadString(IDS_NETWORK_ACTIVE); ShutdownBlockReasonCreate(message_window_, text); }
/* ---------------------------------------------------------------------------- * 栞 Method / request */ SHIORI_API HGLOBAL __cdecl request(HGLOBAL hGlobal_request, long& len) { AutoGrobalFree autoFree(hGlobal_request); ATLTRACE2(_T("[SHIORI::request]\n")); ByteArray res; bool rc = api->Request((const BYTE*) hGlobal_request, len, res); if (!rc) { CreateBatRequestResponse(res ,"SHIOLINK2 API return false"); } // 応答情報の作成 HGLOBAL hRES =GlobalAlloc(GMEM_FIXED ,res.GetCount()); CopyMemory(hRES ,res.GetData() ,res.GetCount()); len =(long)res.GetCount(); return hRES; }
HRESULT STDMETHODCALLTYPE CMMNotificationClient::OnPropertyValueChanged( LPCWSTR pwstrDeviceId, const PROPERTYKEY key) { // _PrintDeviceName(pwstrDeviceId); ATLTRACE2(" -->Changed device property " "{%8.8x-%4.4x-%4.4x-%2.2x%2.2x-%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x}#%d\n", key.fmtid.Data1, key.fmtid.Data2, key.fmtid.Data3, key.fmtid.Data4[0], key.fmtid.Data4[1], key.fmtid.Data4[2], key.fmtid.Data4[3], key.fmtid.Data4[4], key.fmtid.Data4[5], key.fmtid.Data4[6], key.fmtid.Data4[7], key.pid); return S_OK; }