// // We initialize the UART with interrupts suppressed so we don't // try to service the chip prematurely. // NTSTATUS CMiniportDMusUART::InitializeHardware(PINTERRUPTSYNC interruptSync,PUCHAR portBase) { PAGED_CODE(); NTSTATUS ntStatus; if (m_UseIRQ) { ntStatus = interruptSync->CallSynchronizedRoutine(InitMPU,PVOID(portBase)); } else { ntStatus = InitMPU(NULL,PVOID(portBase)); } if (NT_SUCCESS(ntStatus)) { // // Start the UART (this should trigger an interrupt). // ntStatus = ResetHardware(portBase); } else { _DbgPrintF(DEBUGLVL_TERSE,("*** InitMPU returned with ntStatus 0x%08x ***",ntStatus)); } m_fMPUInitialized = NT_SUCCESS(ntStatus); return ntStatus; }
int OnWindowEvent(WPARAM wParam, LPARAM lParam) { MessageWindowEventData* msgEvData = (MessageWindowEventData*)lParam; switch (msgEvData->uType) { case MSG_WINDOW_EVT_OPENING: g_hWindows.insert(PVOID(msgEvData->hContact)); SetSrmmIcon(msgEvData->hContact); break; case MSG_WINDOW_EVT_CLOSE: if (db_get_b(NULL, ModuleName, "SweepOnClose", 0)) { CriteriaStruct Criteria; Criteria.keep = KeepCriteria(db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)); Criteria.time = BuildCriteria(db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)); SweepHistoryFromContact(msgEvData->hContact, Criteria, TRUE); } for (int i = g_hWindows.getCount() - 1; i >= 0; i--) if (g_hWindows[i] == PVOID(msgEvData->hContact)) g_hWindows.remove(i); break; } return 0; }
STDMETHODIMP WaveStream::NonDelegatingQueryInterface(IN REFIID Interface,OUT PVOID *Object) { PAGED_CODE(); ASSERT(Object); if (IsEqualGUIDAligned(Interface,IID_IUnknown)) { *Object = PVOID(PUNKNOWN(PMINIPORTWAVERTSTREAM(this))); } else if (IsEqualGUIDAligned(Interface,IID_IMiniportWaveRTStream)) { *Object = PVOID(PMINIPORTWAVERTSTREAM(this)); } else if (IsEqualGUIDAligned(Interface,IID_IMiniportWaveRTStreamNotification)) { *Object = PVOID(PMINIPORTWAVERTSTREAMNOTIFICATION(this)); } else { *Object = NULL; } if (*Object) { PUNKNOWN(*Object)->AddRef(); return STATUS_SUCCESS; } return STATUS_INVALID_PARAMETER; }
int OnWindowEvent(WPARAM, LPARAM lParam) { MessageWindowEventData* msgEvData = (MessageWindowEventData*)lParam; switch (msgEvData->uType) { case MSG_WINDOW_EVT_OPENING: g_hWindows.insert(PVOID(msgEvData->hContact)); SetSrmmIcon(msgEvData->hContact); break; case MSG_WINDOW_EVT_CLOSE: if (db_get_b(NULL, ModuleName, "SweepOnClose", 0)) { CriteriaStruct Criteria; Criteria.keep = KeepCriteria(db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)); Criteria.time = BuildCriteria(db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)); SweepHistoryFromContact(msgEvData->hContact, Criteria, TRUE); } auto T = g_hWindows.rev_iter(); for (auto &it : T) if (it == PVOID(msgEvData->hContact)) g_hWindows.remove(T.indexOf(&it)); break; } return 0; }
//================================================================================================================================== NTSTATUS NTAPI CPortPinWavePci::QueryInterface( IN REFIID refiid, OUT PVOID* Output) { //DPRINT("CPortPinWavePci::QueryInterface entered\n"); if (IsEqualGUIDAligned(refiid, IID_IIrpTarget) || IsEqualGUIDAligned(refiid, IID_IUnknown)) { *Output = PVOID(PUNKNOWN((IIrpTarget*)this)); PUNKNOWN(*Output)->AddRef(); return STATUS_SUCCESS; } if (IsEqualGUIDAligned(refiid, IID_IServiceSink)) { *Output = PVOID(PSERVICESINK(this)); PUNKNOWN(*Output)->AddRef(); return STATUS_SUCCESS; } if (IsEqualGUIDAligned(refiid, IID_IPortWavePciStream)) { *Output = PVOID(PPORTWAVEPCISTREAM(this)); PUNKNOWN(*Output)->AddRef(); return STATUS_SUCCESS; } return STATUS_UNSUCCESSFUL; }
/* * Do a typical-of-something random I/O. Any serious application that * has a random I/O bottleneck is going to be smart enough to operate * in a page mode, and not stupidly pull individual words out at * odd offsets. To keep the cache from getting too clever, some * pages must be updated. However an application that updated each of * many random pages that it looked at is hard to imagine. * However, it would be wrong to put the update percentage in as a * parameter - the effect is too nonlinear. Need a profile * of what Oracle or Ingres or some such actually does. * Be warned - there is a *sharp* elbow in this curve - on a 1-MiB file, * most substantial unix systems show >2000 random I/Os per second - * obviously they've cached the whole thing and are just doing buffer * copies. */ int CFileOp::doseek(unsigned int where, bool update) { if (seek(where, SEEK_SET) == -1) return -1; if (read_block(PVOID(m_buf)) == -1) return -1; /* every so often, update a block */ if (update) { /* update this block */ /* touch a byte */ m_buf[where % m_chunk_size]--; if(seek(where, SEEK_SET) == -1) return io_error("lseek in doseek update"); if (write_block(PVOID(m_buf)) == -1) return -1; if(m_sync) { if(fsync(m_fd)) { fprintf(stderr, "Can't sync file.\n"); return -1; } } } /* update this block */ return 0; }
CMiniportWaveCyclic::NonDelegatingQueryInterface ( IN REFIID Interface, OUT PVOID * Object ) /*++ Routine Description: QueryInterface Arguments: Interface - GUID Object - interface pointer to be returned. Return Value: NT status code. --*/ { PAGED_CODE(); ASSERT(Object); if (IsEqualGUIDAligned(Interface, IID_IUnknown)) { *Object = PVOID(PUNKNOWN(PMINIPORTWAVECYCLIC(this))); } else if (IsEqualGUIDAligned(Interface, IID_IMiniport)) { *Object = PVOID(PMINIPORT(this)); } else if (IsEqualGUIDAligned(Interface, IID_IMiniportWaveCyclic)) { *Object = PVOID(PMINIPORTWAVECYCLIC(this)); } else if (IsEqualGUIDAligned(Interface, IID_IPinCount)) { *Object = PVOID(PPINCOUNT(this)); } else { *Object = NULL; } if (*Object) { // We reference the interface for the caller. PUNKNOWN(*Object)->AddRef(); return STATUS_SUCCESS; } return STATUS_INVALID_PARAMETER; } // NonDelegatingQueryInterface
NTSTATUS NTAPI CPortTopology::QueryInterface( IN REFIID refiid, OUT PVOID* Output) { UNICODE_STRING GuidString; DPRINT("IPortTopology_fnQueryInterface\n"); if (IsEqualGUIDAligned(refiid, IID_IPortTopology) || IsEqualGUIDAligned(refiid, IID_IPort) || IsEqualGUIDAligned(refiid, IID_IUnknown)) { *Output = PVOID(PUNKNOWN((IPortTopology*)this)); PUNKNOWN(*Output)->AddRef(); return STATUS_SUCCESS; } else if (IsEqualGUIDAligned(refiid, IID_IPortEvents)) { *Output = PVOID(PPORTEVENTS(this)); PUNKNOWN(*Output)->AddRef(); return STATUS_SUCCESS; } else if (IsEqualGUIDAligned(refiid, IID_ISubdevice)) { *Output = PVOID(PSUBDEVICE(this)); PUNKNOWN(*Output)->AddRef(); return STATUS_SUCCESS; } else if (IsEqualGUIDAligned(refiid, IID_IPortClsVersion)) { return NewPortClsVersion((PPORTCLSVERSION*)Output); } else if (IsEqualGUIDAligned(refiid, IID_IDrmPort) || IsEqualGUIDAligned(refiid, IID_IDrmPort2)) { return NewIDrmPort((PDRMPORT2*)Output); } else if (IsEqualGUIDAligned(refiid, IID_IUnregisterSubdevice)) { return NewIUnregisterSubdevice((PUNREGISTERSUBDEVICE*)Output); } else if (IsEqualGUIDAligned(refiid, IID_IUnregisterPhysicalConnection)) { return NewIUnregisterPhysicalConnection((PUNREGISTERPHYSICALCONNECTION*)Output); } if (RtlStringFromGUID(refiid, &GuidString) == STATUS_SUCCESS) { DPRINT1("IPortTopology_fnQueryInterface no interface!!! iface %S\n", GuidString.Buffer); RtlFreeUnicodeString(&GuidString); } return STATUS_UNSUCCESSFUL; }
//============================================================================= STDMETHODIMP CMiniportTopology::NonDelegatingQueryInterface ( IN REFIID Interface, OUT PVOID * Object ) /*++ Routine Description: QueryInterface for MiniportTopology Arguments: Interface - GUID of the interface Object - interface object to be returned. Return Value: NT status code. --*/ { PAGED_CODE(); ASSERT(Object); if (IsEqualGUIDAligned(Interface, IID_IUnknown)) { *Object = PVOID(PUNKNOWN(this)); } else if (IsEqualGUIDAligned(Interface, IID_IMiniport)) { *Object = PVOID(PMINIPORT(this)); } else if (IsEqualGUIDAligned(Interface, IID_IMiniportTopology)) { *Object = PVOID(PMINIPORTTOPOLOGY(this)); } else { *Object = NULL; } if (*Object) { // We reference the interface for the caller. PUNKNOWN(*Object)->AddRef(); return(STATUS_SUCCESS); } return(STATUS_INVALID_PARAMETER); } // NonDelegatingQueryInterface
CMiniportWaveCyclicStream::NonDelegatingQueryInterface ( IN REFIID Interface, OUT PVOID * Object ) /*++ Routine Description: QueryInterface Arguments: Interface - GUID Object - interface pointer to be returned Return Value: NT status code. --*/ { PAGED_CODE(); ASSERT(Object); if (IsEqualGUIDAligned(Interface, IID_IUnknown)) { *Object = PVOID(PUNKNOWN(PMINIPORTWAVECYCLICSTREAM(this))); } else if (IsEqualGUIDAligned(Interface, IID_IMiniportWaveCyclicStream)) { *Object = PVOID(PMINIPORTWAVECYCLICSTREAM(this)); } else if (IsEqualGUIDAligned(Interface, IID_IDmaChannel)) { *Object = PVOID(PDMACHANNEL(this)); } else { *Object = NULL; } if (*Object) { PUNKNOWN(*Object)->AddRef(); return STATUS_SUCCESS; } return STATUS_INVALID_PARAMETER; } // NonDelegatingQueryInterface
BOOL CSSolid::GetHandleInfo(SSHANDLEINFO *pInfo, SSHANDLE id) { // try vertices .. for(int i = 0; i < m_nVertices; i++) { if(m_Vertices[i].id != id) continue; // not this one pInfo->Type = shtVertex; pInfo->iIndex = i; pInfo->pData = PVOID(& m_Vertices[i]); pInfo->p2DHandle = & m_Vertices[i]; pInfo->pos = m_Vertices[i].pos; return TRUE; } // try edges .. for(i = 0; i < m_nEdges; i++) { if(m_Edges[i].id != id) continue; // not this one pInfo->Type = shtEdge; pInfo->iIndex = i; pInfo->pData = PVOID(& m_Edges[i]); pInfo->p2DHandle = & m_Edges[i]; pInfo->pos = m_Edges[i].ptCenter; return TRUE; } // try faces .. for(i = 0; i < m_nFaces; i++) { if(m_Faces[i].id != id) continue; // not this one pInfo->Type = shtFace; pInfo->iIndex = i; pInfo->pData = PVOID(& m_Faces[i]); pInfo->p2DHandle = & m_Faces[i]; pInfo->pos = m_Faces[i].ptCenter; return TRUE; } pInfo->Type = shtNothing; return FALSE; }
BOOLEAN HookByInline(ULONG target, ULONG myfake, char *pFunName) { kprintf("Inline Hooking %s from %X to %X\r\n", pFunName, target, myfake); if (!MmIsAddressValid(PVOID(target))) { kprintf("Target is not available\r\n"); return 1; } LONG mysrc,mydst; mysrc = target; mydst = myfake; HOOKINFO *pHI = (PHOOKINFO)kmalloc(sizeof(HOOKINFO)); if (pHI==NULL) { return FALSE; } #define JMPLEN 5 RtlZeroMemory(pHI, sizeof(HOOKINFO)); ULONG itmp=0; UCHAR JmpCode[JMPLEN]={0xe9,0,0,0,0}; itmp = mydst-mysrc-JMPLEN; *(PULONG)&JmpCode[1]= itmp; RtlCopyMemory(pHI->szOldCode, (PUCHAR)mysrc, JMPLEN); memcpy((PUCHAR)mysrc, JmpCode, JMPLEN); pHI->NewAddress = mydst; pHI->OldCodeSize = JMPLEN; pHI->OriAddress = mysrc; RtlCopyMemory(pHI->szFunName, pFunName, strlen(pFunName)); InsertTailList(&g_HookInfoListHead,&pHI->Next ); return 1; }
const HRESULT CDVBWorldSpecials::LockChannel(BYTE bySatellite, BOOL bHorizontal, unsigned long ulFrequency, BOOL bDvbS2) { Tuner_S_Param2 sTuneParam; ZeroMemory(&sTuneParam, sizeof(sTuneParam)); sTuneParam.GUID_ID = GUID_TUNER_S_LOCK; sTuneParam.frequency = ulFrequency * 1000; sTuneParam.symbol_rate = bDvbS2 ? 23303 : 21096; sTuneParam.lnb = 11200000; if (bySatellite == 1) // JCSAT-4 sTuneParam.b22k = true; else sTuneParam.b22k = false; sTuneParam.hv = bHorizontal ? LINEAR_H : LINEAR_V; sTuneParam.diseqcPort = DISEQC_PORT_A; sTuneParam.FEC = bDvbS2 ? BDA_BCC_RATE_3_5 : BDA_BCC_RATE_3_4; sTuneParam.Modulation = bDvbS2 ? DW_MOD_DVBS2_8PSK : DW_MOD_DVBS1_QPSK; sTuneParam.Burst = DW_BURST_UNDEFINED; DWORD dRet; HRESULT hr; hr = KsSynchronousDeviceControl(m_hTuner, IOCTL_KS_PROPERTY, PVOID(&sTuneParam), sizeof(sTuneParam), NULL, 0, &dRet); return hr; }
//----------------------------------------------------------------------------- // Purpose: // Input : pType - //----------------------------------------------------------------------------- PVOID CObjectProperties::GetEditObject(CRuntimeClass *pType) { //VPROF_BUDGET( "CObjectProperties::GetEditObject", "Object Properties" ); if (pType == RUNTIME_CLASS(editCMapClass)) { return PVOID((CMapClass*)&e_CMapClass); } else if (pType == RUNTIME_CLASS(editCEditGameClass)) { return PVOID((CEditGameClass*)&e_CEditGameClass); } Assert(0); return NULL; }
/***************************************************************************** * CMidiFilterFactory::NonDelegatingQueryInterface() ***************************************************************************** *//*! * @brief * Obtains an interface. * @details * This function works just like a COM QueryInterface call and is used if * the object is not being aggregated. * @param * Interface The GUID of the interface to be retrieved. * @param * Object Pointer to the location to store the retrieved interface object. * @return * Returns STATUS_SUCCESS if the interface is found. Otherwise, returns * STATUS_INVALID_PARAMETER. */ STDMETHODIMP CMidiFilterFactory:: NonDelegatingQueryInterface ( IN REFIID Interface, OUT PVOID * Object ) { PAGED_CODE(); ASSERT(Object); _DbgPrintF(DEBUGLVL_BLAB,("[CMidiFilterFactory::NonDelegatingQueryInterface]")); if (IsEqualGUIDAligned(Interface,IID_IUnknown)) { *Object = PVOID(PUNKNOWN(this)); } else { *Object = NULL; } if (*Object) { // // We reference the interface for the caller. // PUNKNOWN(*Object)->AddRef(); return STATUS_SUCCESS; } return STATUS_INVALID_PARAMETER; }
void CRunMapExpertDlg::InitSequenceList() { // add all the information from the CHammer object into // the dialog box .. CHammer *pApp = (CHammer*) AfxGetApp(); m_cCmdSequences.ResetContent(); // add the configurations into the list .. int iSize = pApp->m_CmdSequences.GetSize(); if(iSize == 0) { // add a default configuration CCommandSequence *pSeq = new CCommandSequence; strcpy(pSeq->m_szName, "Default"); ((CHammer*)AfxGetApp())->m_CmdSequences.Add(pSeq); iSize = 1; } for(int i = 0; i < iSize; i++) { CCommandSequence *pSeq = pApp->m_CmdSequences[i]; int iIndex = m_cCmdSequences.AddString(pSeq->m_szName); m_cCmdSequences.SetItemDataPtr(iIndex, PVOID(pSeq)); } m_pActiveSequence = NULL; m_cCmdSequences.SetCurSel(0); OnSelchangeConfigurations(); }
/***************************************************************************** * CUnknown::NonDelegatingQueryInterface() ***************************************************************************** * Obtains an interface. */ STDMETHODIMP CUnknown::NonDelegatingQueryInterface ( REFIID rIID, PVOID * ppVoid ) { ASSERT(ppVoid); if (IsEqualGUIDAligned(rIID,IID_IUnknown)) { *ppVoid = PVOID(PUNKNOWN(this)); } else { *ppVoid = NULL; } if (*ppVoid) { PUNKNOWN(*ppVoid)->AddRef(); return STATUS_SUCCESS; } return STATUS_INVALID_PARAMETER; }
HRESULT STDMETHODCALLTYPE CVPVBIConfig::QueryInterface( IN REFIID refiid, OUT PVOID* Output) { if (IsEqualGUID(refiid, IID_IUnknown)) { *Output = PVOID(this); reinterpret_cast<IUnknown*>(*Output)->AddRef(); return NOERROR; } if (IsEqualGUID(refiid, IID_IDistributorNotify)) { *Output = (IDistributorNotify*)(this); reinterpret_cast<IDistributorNotify*>(*Output)->AddRef(); return NOERROR; } if (IsEqualGUID(refiid, IID_IVPVBIConfig)) { *Output = (IVPConfig*)(this); reinterpret_cast<IVPConfig*>(*Output)->AddRef(); return NOERROR; } return E_NOINTERFACE; }
/***************************************************************************** * CUnknown::NonDelegatingQueryInterface() ***************************************************************************** * Obtains an interface. */ STDMETHODIMP_(HRESULT) CUnknown::NonDelegatingQueryInterface ( REFIID rIID, PVOID * ppVoid ) { ASSERT(ppVoid); if (IsEqualGUID(rIID,IID_IUnknown)) { *ppVoid = PVOID(PUNKNOWN(this)); } else { *ppVoid = NULL; } if (*ppVoid) { PUNKNOWN(*ppVoid)->AddRef(); return S_OK; } return E_INVALIDARG; }
static void initialize_signal_handler() { # ifdef NEED_OSX_MACH_HANDLER macosx_init_exception_handler(); # endif # ifdef NEED_SIGACTION { struct sigaction act, oact; memset(&act, 0, sizeof(sigaction)); act.sa_sigaction = fault_handler; sigemptyset(&act.sa_mask); /* In MzScheme, SIGCHLD or SIGINT handling may trigger a write barrier: */ sigaddset(&act.sa_mask, SIGINT); sigaddset(&act.sa_mask, SIGCHLD); act.sa_flags = SA_SIGINFO; sigaction(USE_SIGACTON_SIGNAL_KIND, &act, &oact); } # endif # ifdef NEED_SIGWIN { HMODULE hm; PVOID (WINAPI*aveh)(ULONG, gcPVECTORED_EXCEPTION_HANDLER); hm = LoadLibrary("kernel32.dll"); if (hm) aveh = (PVOID (WINAPI*)(ULONG, gcPVECTORED_EXCEPTION_HANDLER))GetProcAddress(hm, "AddVectoredExceptionHandler"); else aveh = NULL; if (aveh) aveh(TRUE, fault_handler); else generations_available = 0; } # endif }
const HRESULT CDVBWorldSpecials::LockChannel(const TuningParam *pTuningParm) { Tuner_S_Param2 sTuneParam; ZeroMemory(&sTuneParam, sizeof(sTuneParam)); sTuneParam.GUID_ID = GUID_TUNER_S_LOCK; sTuneParam.frequency = pTuningParm->Frequency; sTuneParam.symbol_rate = pTuningParm->Modulation->SymbolRate; switch (pTuningParm->Polarisation) { case BDA_POLARISATION_LINEAR_H: sTuneParam.hv = 1; break; case BDA_POLARISATION_LINEAR_V: default: sTuneParam.hv = 0; break; } if (pTuningParm->Antenna->LNBSwitch != -1) { sTuneParam.b22k = (pTuningParm->Antenna->LNBSwitch >= pTuningParm->Frequency); sTuneParam.lnb = sTuneParam.b22k ? pTuningParm->Antenna->HighOscillator : pTuningParm->Antenna->LowOscillator; } else { sTuneParam.lnb = pTuningParm->Antenna->HighOscillator; sTuneParam.b22k = !!pTuningParm->Antenna->Tone; } sTuneParam.Burst = DW_BURST_UNDEFINED; if (pTuningParm->Antenna->DiSEqC >= 1 && pTuningParm->Antenna->DiSEqC <= 4) { sTuneParam.diseqcPort = pTuningParm->Antenna->DiSEqC; } else { sTuneParam.diseqcPort = DISEQC_PORT_A; } sTuneParam.FEC = pTuningParm->Modulation->InnerFECRate; switch (pTuningParm->Modulation->Modulation) { case BDA_MOD_NBC_QPSK: case BDA_MOD_QPSK: sTuneParam.Modulation = DW_MOD_DVBS1_QPSK; break; case BDA_MOD_NBC_8PSK: case BDA_MOD_8PSK: sTuneParam.Modulation = DW_MOD_DVBS2_8PSK; break; default: if (sTuneParam.Modulation < 21) { sTuneParam.Modulation = DW_MOD_DVBS1_QPSK; } else if (sTuneParam.Modulation < 27) { sTuneParam.Modulation = DW_MOD_DVBS2_QPSK; } else { sTuneParam.Modulation = DW_MOD_DVBS2_8PSK; } break; } DWORD dRet; HRESULT hr; hr = KsSynchronousDeviceControl(m_hTuner, IOCTL_KS_PROPERTY, PVOID(&sTuneParam), sizeof(sTuneParam), NULL, 0, &dRet); return hr; }
static void initialize_signal_handler(GCTYPE *gc) { # ifdef NEED_OSX_MACH_HANDLER # if defined(MZ_USE_PLACES) && defined(MZ_PRECISE_GC) macosx_init_exception_handler(MASTERGC == 0); # else macosx_init_exception_handler(1); # endif # endif # ifdef NEED_SIGSTACK { stack_t ss; uintptr_t sz = 10*SIGSTKSZ; ss.ss_sp = malloc(sz); ss.ss_size = sz; ss.ss_flags = 0; sigaltstack(&ss, NULL); } # endif # ifdef NEED_SIGACTION { struct sigaction act, oact; memset(&act, 0, sizeof(act)); act.sa_sigaction = fault_handler; sigemptyset(&act.sa_mask); /* In Racket, SIGCHLD or SIGINT handling may trigger a write barrier: */ sigaddset(&act.sa_mask, SIGINT); sigaddset(&act.sa_mask, SIGCHLD); act.sa_flags = SA_SIGINFO; # ifdef NEED_SIGSTACK act.sa_flags |= SA_ONSTACK; # endif sigaction(USE_SIGACTON_SIGNAL_KIND, &act, &oact); # ifdef USE_ANOTHER_SIGACTON_SIGNAL_KIND sigaction(USE_ANOTHER_SIGACTON_SIGNAL_KIND, &act, &oact); # endif } # endif # ifdef NEED_SIGWIN { HMODULE hm; PVOID (WINAPI*aveh)(ULONG, gcPVECTORED_EXCEPTION_HANDLER); hm = LoadLibrary("kernel32.dll"); if (hm) aveh = (PVOID (WINAPI*)(ULONG, gcPVECTORED_EXCEPTION_HANDLER))GetProcAddress(hm, "AddVectoredExceptionHandler"); else aveh = NULL; if (aveh) aveh(TRUE, fault_handler); else /* older than Windows XP */ gc->generations_available = 0; } # endif }
void CRunMapExpertDlg::AddCommand(int iIndex, PCCOMMAND pCommand) { // add a command to the list at the index specified in iIndex (-1 to add // at end of list.) CString str; str.Format("%s %s", GetCmdString(pCommand), pCommand->szParms); iIndex = m_cCommandList.InsertString(iIndex, str); m_cCommandList.SetItemDataPtr(iIndex, PVOID(pCommand)); }
/***************************************************************************** * SynchronizedDMusMPUWrite() ***************************************************************************** * Writes outgoing MIDI data. */ NTSTATUS SynchronizedDMusMPUWrite ( IN PINTERRUPTSYNC InterruptSync, IN PVOID syncWriteContext ) { PSYNCWRITECONTEXT context; context = (PSYNCWRITECONTEXT)syncWriteContext; ASSERT(context->Miniport); ASSERT(context->PortBase); ASSERT(context->BufferAddress); ASSERT(context->Length); ASSERT(context->BytesRead); PUCHAR pChar = PUCHAR(context->BufferAddress); NTSTATUS ntStatus,readStatus; ntStatus = STATUS_SUCCESS; // // while we're not there yet, and // while we don't have to wait on an aligned byte (including 0) // (we never wait on a byte. Better to come back later) readStatus = DMusMPUInterruptServiceRoutine(InterruptSync,PVOID(context->Miniport)); while ( (*(context->BytesRead) < context->Length) && ( TryMPU(context->PortBase) || (*(context->BytesRead)%3) ) ) { ntStatus = WriteMPU(context->PortBase,DATA,*pChar); if (NT_SUCCESS(ntStatus)) { pChar++; *(context->BytesRead) = *(context->BytesRead) + 1; // readStatus = DMusMPUInterruptServiceRoutine(InterruptSync,PVOID(context->Miniport)); } else { _DbgPrintF(DEBUGLVL_TERSE,("SynchronizedDMusMPUWrite failed (0x%08x)",ntStatus)); break; } } readStatus = DMusMPUInterruptServiceRoutine(InterruptSync,PVOID(context->Miniport)); return ntStatus; }
LRESULT CALLBACK TrayHookProc(int nCode,WPARAM wParam ,LPARAM lParam) { CWPSTRUCT *pCWPS=(CWPSTRUCT*)lParam; { if(pCWPS->message == g_HD_Msg_GetIcon) { HIMAGELIST hImgLst=(HIMAGELIST)::SendMessage(pCWPS->hwnd,TB_GETIMAGELIST,0,0); HICON hIcon=::ImageList_GetIcon(hImgLst,int(pCWPS->wParam),ILD_NORMAL); if(hIcon == NULL) { DWORD dwErr = GetLastError(); //MessageBox(NULL,L"IS NULL",L"ISNULL",MB_OK); return 0; } // ICONINFO IInfo; // BOOL bRet = GetIconInfo(hIcon,&IInfo); DWORD HD_Pid=NULL; DWORD tid=::GetWindowThreadProcessId(hLV, &HD_Pid); HANDLE hProcess = ::OpenProcess(PROCESS_ALL_ACCESS |PROCESS_VM_OPERATION |PROCESS_VM_READ |PROCESS_VM_WRITE, FALSE, HD_Pid); if(hProcess != NULL) { // DWORD dwErr = GetLastError(); // MessageBox(NULL,L"ProIS NULL",L"proISNULL",MB_OK); // return 0; int iRet = WriteProcessMemory(hProcess,PVOID(pCWPS->lParam),&hIcon,sizeof(HICON),NULL); if(iRet == 0) { //MessageBox(NULL,L"IS 0",L"0",MB_OK); } CloseHandle(hProcess); } else { hTrayIcon_hook = hIcon; } return 0; } else { } return CallNextHookEx(hTrayHook,nCode,wParam,lParam); } return CallNextHookEx(hTrayHook,nCode,wParam,lParam); }
//----------------------------------------------------------------------------- // Purpose: // Input : pobj - // pType - //----------------------------------------------------------------------------- PVOID CObjectProperties::GetEditObjectFromMapObject(CMapClass *pobj, CRuntimeClass *pType) { //VPROF_BUDGET( "CObjectProperties::GetEditObjectFromMapObject", "Object Properties" ); if (pType == RUNTIME_CLASS(editCMapClass)) { return PVOID(pobj); } else if (pType == RUNTIME_CLASS(editCEditGameClass)) { if (pobj->IsMapClass(MAPCLASS_TYPE(CMapEntity))) { return PVOID((CEditGameClass*)((CMapEntity*)pobj)); } if (pobj->IsMapClass(MAPCLASS_TYPE(CMapWorld))) { return PVOID((CEditGameClass*)((CMapWorld*)pobj)); } } return NULL; }
BOOL CRunMapCfgDlg::OnInitDialog() { CDialog::OnInitDialog(); // add the configurations into the list int iSize = m_pApp->m_CmdSequences.GetSize(); for(int i = 0; i < iSize; i++) { CCommandSequence *pSeq = m_pApp->m_CmdSequences[i]; int iIndex = m_cConfigurations.AddString(pSeq->m_szName); m_cConfigurations.SetItemDataPtr(iIndex, PVOID(pSeq)); } return TRUE; }
BOOL CMapErrorsDlg::OnInitDialog() { CDialog::OnInitDialog(); // fill list with errors error3d * pError = Enum3dErrors(TRUE); while(pError) { m_cErrors.AddString(pError->pszReason); m_cErrors.SetItemDataPtr(m_cErrors.GetCount()-1, PVOID(pError)); pError = Enum3dErrors(); } return TRUE; }
const HRESULT CDVBWorldSpecials::Set22KHz(long nTone) { Tuner_S_Param2 sTuneParam ; ZeroMemory(&sTuneParam, sizeof(sTuneParam)); sTuneParam.GUID_ID = GUID_TUNER_S_LOCK ; sTuneParam.b22k = !!nTone; sTuneParam.Burst = DW_BURST_UNDEFINED; DWORD dRet ; HRESULT hr; hr = KsSynchronousDeviceControl(m_hTuner, IOCTL_KS_PROPERTY, PVOID(&sTuneParam), sizeof(sTuneParam), NULL, 0, &dRet); return hr; }
void CaptureDShow::deleteMediaType(AM_MEDIA_TYPE *mediaType) { if (!mediaType) return; if (mediaType->cbFormat != 0) { CoTaskMemFree(PVOID(mediaType->pbFormat)); mediaType->cbFormat = 0; mediaType->pbFormat = NULL; } if (mediaType->pUnk != NULL) { // pUnk should not be used. mediaType->pUnk->Release(); mediaType->pUnk = NULL; } CoTaskMemFree(mediaType); }