bool AddSeg(seg_t *seg) { FGLSectionLine &line = SectionLines[SectionLines.Reserve(1)]; bool firstline = loop->numlines == 0; if (ISDONE(seg-segs, processed_segs)) { // should never happen! DPrintf("Tried to add seg %d to Sections twice. Cannot create Sections.\n", seg-segs); return false; } SETDONE(seg-segs, processed_segs); section_for_segs[seg-segs] = Sections.Size()-1; line.start = seg->v1; line.end = seg->v2; line.sidedef = seg->sidedef; line.linedef = seg->linedef; line.refseg = seg; line.polysub = NULL; line.otherside = -1; if (loop->numlines == 0) { v1_l1 = seg->v1; v2_l1 = seg->v2; } loop->numlines++; return true; }
/*todo: sta based statistics need to be implemented in wlan driver*/ static int wapimib_get_stastats_from_driver(char* ifname, char* macaddr, struct ieee80211req_sta_stats* stats) { struct iwreq iwr; int sock = socket(AF_INET, SOCK_DGRAM, 0); if(sock<0) { return -1; } (void) memset(&iwr, 0, sizeof(iwr)); (void) strncpy(iwr.ifr_name, ifname, sizeof(iwr.ifr_name)); iwr.u.data.pointer = (void *) stats; iwr.u.data.length = sizeof(struct ieee80211req_sta_stats); memcpy(stats->is_u.macaddr, macaddr, 6); DPrintf("[WAPID]::get stastats from %s, chars %d, ioctl 0x%x: 0x%x\n", iwr.ifr_name, strlen(iwr.ifr_name),IEEE80211_IOCTL_STA_STATS, SIOCDEVPRIVATE); if (ioctl(sock, IEEE80211_IOCTL_STA_STATS, &iwr) < 0) { close(sock); return -1; } close(sock); return 0; }
bool CTXVirtQueue::PrepareBuffers() { auto NumBuffers = min(m_MaxBuffers, GetRingSize()); for (m_TotalDescriptors = 0; m_TotalDescriptors < NumBuffers; m_TotalDescriptors++) { auto TXDescr = new (m_Context->MiniportHandle) CTXDescriptor(); if (TXDescr == nullptr) { break; } if (!TXDescr->Create(m_DrvHandle, m_HeaderSize, m_SGTable, m_SGTableCapacity, m_Context->bUseIndirect ? true : false, m_Context->bAnyLayout ? true : false)) { CTXDescriptor::Destroy(TXDescr, m_Context->MiniportHandle); break; } m_Descriptors.Push(TXDescr); } m_FreeHWBuffers = m_TotalHWBuffers = NumBuffers; DPrintf(0, "[%s] available %d Tx descriptors\n", __FUNCTION__, m_TotalDescriptors); return m_TotalDescriptors > 0; }
void CParaNdisRX::PopulateQueue() { LIST_ENTRY TempList; TPassiveSpinLocker autoLock(m_Lock); InitializeListHead(&TempList); while (!IsListEmpty(&m_NetReceiveBuffers)) { pRxNetDescriptor pBufferDescriptor = (pRxNetDescriptor)RemoveHeadList(&m_NetReceiveBuffers); InsertTailList(&TempList, &pBufferDescriptor->listEntry); } m_NetNofReceiveBuffers = 0; while (!IsListEmpty(&TempList)) { pRxNetDescriptor pBufferDescriptor = (pRxNetDescriptor)RemoveHeadList(&TempList); if (AddRxBufferToQueue(pBufferDescriptor)) { InsertTailList(&m_NetReceiveBuffers, &pBufferDescriptor->listEntry); m_NetNofReceiveBuffers++; } else { /* TODO - NetMaxReceiveBuffers should take into account all queues */ DPrintf(0, "FAILED TO REUSE THE BUFFER!!!!\n"); ParaNdis_FreeRxBufferDescriptor(m_Context, pBufferDescriptor); m_Context->NetMaxReceiveBuffers--; } } m_Reinsert = true; }
int CParaNdisRX::PrepareReceiveBuffers() { int nRet = 0; UINT i; DEBUG_ENTRY(4); for (i = 0; i < m_Context->NetMaxReceiveBuffers; ++i) { pRxNetDescriptor pBuffersDescriptor = CreateRxDescriptorOnInit(); if (!pBuffersDescriptor) break; pBuffersDescriptor->Queue = this; if (!AddRxBufferToQueue(pBuffersDescriptor)) { ParaNdis_FreeRxBufferDescriptor(m_Context, pBuffersDescriptor); break; } InsertTailList(&m_NetReceiveBuffers, &pBuffersDescriptor->listEntry); m_NetNofReceiveBuffers++; } /* TODO - NetMaxReceiveBuffers should take into account all queues */ m_Context->NetMaxReceiveBuffers = m_NetNofReceiveBuffers; DPrintf(0, "[%s] MaxReceiveBuffers %d\n", __FUNCTION__, m_Context->NetMaxReceiveBuffers); m_Reinsert = true; return nRet; }
static VOID PostLinkState(PARANDIS_ADAPTER *pContext, NDIS_MEDIA_CONNECT_STATE connectState) { NDIS_STATUS_INDICATION indication; NDIS_LINK_STATE state; NdisZeroMemory(&state, sizeof(state)); state.Header.Revision = NDIS_LINK_STATE_REVISION_1; state.Header.Type = NDIS_OBJECT_TYPE_DEFAULT; state.Header.Size = NDIS_SIZEOF_LINK_STATE_REVISION_1; state.MediaConnectState = connectState; state.MediaDuplexState = MediaDuplexStateFull; state.RcvLinkSpeed = state.XmitLinkSpeed = connectState == MediaConnectStateConnected ? PARANDIS_MAXIMUM_RECEIVE_SPEED : NDIS_LINK_SPEED_UNKNOWN; state.PauseFunctions = NdisPauseFunctionsUnsupported; NdisZeroMemory(&indication, sizeof(indication)); indication.Header.Type = NDIS_OBJECT_TYPE_STATUS_INDICATION; indication.Header.Revision = NDIS_STATUS_INDICATION_REVISION_1; indication.Header.Size = NDIS_SIZEOF_STATUS_INDICATION_REVISION_1; indication.SourceHandle = pContext->MiniportHandle; indication.StatusCode = NDIS_STATUS_LINK_STATE; indication.StatusBuffer = &state; indication.StatusBufferSize = sizeof(state); DPrintf(0, ("Indicating %s\n", ConnectStateName(connectState))); ParaNdis_DebugHistory(pContext, hopConnectIndication, NULL, connectState, 0, 0); NdisMIndicateStatusEx(pContext->MiniportHandle , &indication); }
static NDIS_STATUS ReadGlobalConfigurationEntry(NDIS_HANDLE cfg, const char *_name, PULONG pValue) { NDIS_STATUS status; PNDIS_CONFIGURATION_PARAMETER pParam = NULL; NDIS_STRING name = {0}; const char *statusName; NDIS_PARAMETER_TYPE ParameterType = NdisParameterInteger; NdisInitializeString(&name, (PUCHAR)_name); #pragma warning(push) #pragma warning(disable:6102) NdisReadConfiguration( &status, &pParam, cfg, &name, ParameterType); if (status == NDIS_STATUS_SUCCESS) { *pValue = pParam->ParameterData.IntegerData; statusName = "value"; } else { statusName = "nothing"; } #pragma warning(pop) DPrintf(2, ("[%s] %s read for %s - 0x%x\n", __FUNCTION__, statusName, _name, *pValue)); if (name.Buffer) NdisFreeString(name); return status; }
int CParaNdisRX::PrepareReceiveBuffers() { UINT i; DEBUG_ENTRY(4); NdisZeroMemory(m_ReservedRxBufferMemory, sizeof(m_ReservedRxBufferMemory)); m_RxBufferIndex = 0; m_RxBufferOffset = 0; for (i = 0; i < m_Context->NetMaxReceiveBuffers; ++i) { pRxNetDescriptor pBuffersDescriptor = CreateRxDescriptorOnInit(); if (!pBuffersDescriptor) break; pBuffersDescriptor->Queue = this; if (!AddRxBufferToQueue(pBuffersDescriptor)) { ParaNdis_FreeRxBufferDescriptor(m_Context, pBuffersDescriptor); break; } InsertTailList(&m_NetReceiveBuffers, &pBuffersDescriptor->listEntry); m_NetNofReceiveBuffers++; } /* TODO - NetMaxReceiveBuffers should take into account all queues */ m_Context->NetMaxReceiveBuffers = m_NetNofReceiveBuffers; DPrintf(0, ("[%s] MaxReceiveBuffers %d\n", __FUNCTION__, m_Context->NetMaxReceiveBuffers)); m_Reinsert = true; m_VirtQueue.Kick(); return m_NetNofReceiveBuffers; }
XMISong::XMISong (FileReader &reader, EMidiDevice type, const char *args) : MIDIStreamer(type, args), MusHeader(0), Songs(0) { SongLen = reader.GetLength(); MusHeader = new uint8_t[SongLen]; if (reader.Read(MusHeader, SongLen) != SongLen) return; // Find all the songs in this file. NumSongs = FindXMIDforms(MusHeader, SongLen, NULL); if (NumSongs == 0) { return; } // XMIDI files are played with a constant 120 Hz clock rate. While the // song may contain tempo events, these are vestigial remnants from the // original MIDI file that were not removed by the converter and should // be ignored. // // We can use any combination of Division and Tempo values that work out // to be 120 Hz. Division = 60; InitialTempo = 500000; Songs = new TrackInfo[NumSongs]; memset(Songs, 0, sizeof(*Songs) * NumSongs); FindXMIDforms(MusHeader, SongLen, Songs); CurrSong = Songs; DPrintf(DMSG_SPAMMY, "XMI song count: %d\n", NumSongs); }
bool PClass::ReadAllFields(FSerializer &ar, void *addr) const { bool readsomething = false; bool foundsomething = false; const char *key; key = ar.GetKey(); if (strcmp(key, "classtype")) { // this does not represent a DObject Printf(TEXTCOLOR_RED "trying to read user variables but got a non-object (first key is '%s')", key); ar.mErrors++; return false; } while ((key = ar.GetKey())) { if (strncmp(key, "class:", 6)) { // We have read all user variable blocks. break; } foundsomething = true; PClass *type = PClass::FindClass(key + 6); if (type != nullptr) { // Only read it if the type is related to this one. if (IsDescendantOf(type)) { if (ar.BeginObject(nullptr)) { readsomething |= type->VMType->Symbols.ReadFields(ar, addr, type->TypeName.GetChars()); ar.EndObject(); } } else { DPrintf(DMSG_ERROR, "Unknown superclass %s of class %s\n", type->TypeName.GetChars(), TypeName.GetChars()); } } else { DPrintf(DMSG_ERROR, "Unknown superclass %s of class %s\n", key+6, TypeName.GetChars()); } } return readsomething || !foundsomething; }
/* The notify function used when creating a virt queue, common to both modern * and legacy (the difference is in how vq->priv is set up). */ bool vp_notify(struct virtqueue *vq) { /* we write the queue's selector into the notification register to * signal the other end */ iowrite16(vq->vdev, (unsigned short)vq->index, vq->priv); DPrintf(0, ("virtio: vp_notify vq->index = %x\n", vq->index)); return true; }
NDIS_STATUS ParaNdis_ConfigureMSIXVectors(PARANDIS_ADAPTER *pContext) { NDIS_STATUS status = NDIS_STATUS_RESOURCES; UINT i; PIO_INTERRUPT_MESSAGE_INFO pTable = pContext->pMSIXInfoTable; if (pTable && pTable->MessageCount) { status = NDIS_STATUS_SUCCESS; DPrintf(0, ("[%s] Using MSIX interrupts (%d messages, irql %d)\n", __FUNCTION__, pTable->MessageCount, pTable->UnifiedIrql)); for (i = 0; i < pContext->pMSIXInfoTable->MessageCount; ++i) { DPrintf(0, ("[%s] MSIX message%d=%08X=>%I64X\n", __FUNCTION__, i, pTable->MessageInfo[i].MessageData, pTable->MessageInfo[i].MessageAddress)); } for (UINT j = 0; j < pContext->nPathBundles && status == NDIS_STATUS_SUCCESS; ++j) { status = pContext->pPathBundles[j].rxPath.SetupMessageIndex(2 * u16(j) + 1); status = pContext->pPathBundles[j].txPath.SetupMessageIndex(2 * u16(j)); DPrintf(0, ("[%s] Using messages %u/%u for RX/TX queue %u\n", __FUNCTION__, pContext->pPathBundles[j].rxPath.getMessageIndex(), pContext->pPathBundles[j].txPath.getMessageIndex(), j)); } if (status == NDIS_STATUS_SUCCESS && pContext->bCXPathCreated) { /* We need own vector for control queue. If one is not available, fail the initialization */ if (pContext->nPathBundles * 2 > pTable->MessageCount - 1) { DPrintf(0, ("[%s] Not enough vectors for control queue!\n", __FUNCTION__)); status = NDIS_STATUS_RESOURCES; } else { status = pContext->CXPath.SetupMessageIndex(2 * u16(pContext->nPathBundles)); DPrintf(0, ("[%s] Using message %u for controls\n", __FUNCTION__, pContext->CXPath.getMessageIndex())); } } } DEBUG_EXIT_STATUS(0, status); return status; }
void CM_ProcessRecData (DATA_StructType *msg) { static uint8_t size; switch (msg->count-1){ case QIZHI1: if(msg->byte[QIZHI1] != COM_QIZHI1){ CM_ClearCount (msg); DPrintf ("error1\r\n"); } break; case QIZHI2: if(msg->byte[QIZHI2] != COM_QIZHI2){ CM_ClearCount (msg); DPrintf ("error2\r\n"); } break; case MAINPCB: if(msg->byte[MAINPCB] != COM_MAINPCB){ CM_ClearCount (msg); DPrintf ("error3\r\n"); } break; case SLPCB: if(msg->byte[SLPCB] != COM_SLPCB){ CM_ClearCount (msg); DPrintf ("error4\r\n"); } break; case SIZE: size = msg->byte[SIZE]; break; case CMD: if(size != 0){ size --; } break; default: if(size != 0){ size --; }else{ CM_SetSuccess(msg); } break; } }
/********************************************************** NDIS required procedure of OID SET Just passes all the supported oids to common set procedure Return value: NDIS_STATUS as returned from set procedure NDIS_STATUS_NOT_SUPPORTED if support not defined in the table ***********************************************************/ NDIS_STATUS ParaNdis5_SetOID(IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_OID Oid, IN PVOID InformationBuffer, IN ULONG InformationBufferLength, OUT PULONG BytesRead, OUT PULONG BytesNeeded) { NDIS_STATUS status = NDIS_STATUS_NOT_SUPPORTED; tOidWhatToDo Rules; PARANDIS_ADAPTER *pContext = (PARANDIS_ADAPTER *)MiniportAdapterContext; tOidDesc _oid; ParaNdis_GetOidSupportRules(Oid, &Rules, OidsDB); _oid.ulToDoFlags = Rules.Flags; *BytesRead = 0; *BytesNeeded = 0; ParaNdis_DebugHistory(pContext, hopOidRequest, NULL, Oid, 1, 1); DPrintf(Rules.nEntryLevel, ("[%s], id 0x%X(%s) of %d", __FUNCTION__, Oid, Rules.name, InformationBufferLength)); _oid.Oid = Oid; _oid.InformationBuffer = InformationBuffer; _oid.InformationBufferLength = InformationBufferLength; _oid.pBytesNeeded = BytesNeeded; _oid.pBytesRead = BytesRead; _oid.pBytesWritten = BytesRead; if (pContext->bSurprizeRemoved) status = NDIS_STATUS_NOT_ACCEPTED; else if (Rules.Flags & ohfSet) { if (Rules.OidSetProc) status = Rules.OidSetProc(pContext, &_oid); else { DPrintf(0, ("[%s] ERROR in OID redirection table", __FUNCTION__)); status = NDIS_STATUS_INVALID_OID; } } ParaNdis_DebugHistory(pContext, hopOidRequest, NULL, Oid, status, 0); if (status != NDIS_STATUS_PENDING) { DPrintf((status != NDIS_STATUS_SUCCESS) ? Rules.nExitFailLevel : Rules.nExitOKLevel, ("[%s] , id 0x%X(%s) (%X), read %d, needed %d", __FUNCTION__, Rules.oid, Rules.name, status, *BytesRead, *BytesNeeded)); } return status; }
static void *vring_get_buf(struct virtqueue *_vq, unsigned int *len) { struct vring_virtqueue *vq = to_vvq(_vq); void *ret; struct vring_used_elem *u; unsigned int i; if (!more_used(vq)) { DPrintf(4, ("No more buffers in queue: last_used_idx %d vring.used->idx %d\n", vq->last_used_idx, vq->vring.used->idx)); return NULL; } /* Only get used array entries after they have been exposed by host. */ rmb(); u = &vq->vring.used->ring[vq->last_used_idx % vq->vring.num]; i = u->id; *len = u->len; DPrintf(4, ("%s>>> id %d, len %d\n", __FUNCTION__, i, *len) ); if (i >= vq->vring.num) { DPrintf(0, ("id %u out of range\n", i) ); return NULL; } if (!vq->data[i]) { DPrintf(0, ("id %u is not a head!\n", i) ); return NULL; } /* detach_buf clears data, so grab it now. */ ret = vq->data[i]; detach_buf(vq, i); ++vq->last_used_idx; if (!(vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT)) { *vq->vring.vring_last_used_ptr = vq->last_used_idx; mb(); } return ret; }
VOID ParaNdis_Resume(PARANDIS_ADAPTER *pContext) { DPrintf(0, ("[%s] %s\n", __FUNCTION__, pContext->bFastSuspendInProcess ? " Resuming TX and RX" : "(nothing to do)")); if (pContext->bFastSuspendInProcess) { ParaNdis6_SendPauseRestart(pContext, FALSE, NULL); ParaNdis6_ReceivePauseRestart(pContext, FALSE, NULL); } }
int FPlayList::Advance () { if (++Position >= Songs.Size()) { Position = 0; } DPrintf (DMSG_NOTIFY, "Playlist advanced to song %d\n", Position); return Position; }
int FPlayList::Backup () { if (Position-- == 0) { Position = Songs.Size() - 1; } DPrintf (DMSG_NOTIFY, "Playlist backed up to song %d\n", Position); return Position; }
/*解除链路验证*/ int sta_deauth(u8 *addr, int reason_code, apdata_info *pap) { struct ieee80211req_mlme mlme; DPrintf("[WAPID]:: deauth STA("MACSTR")\n", MAC2STR(addr)); mlme.im_op = IEEE80211_MLME_DEAUTH; mlme.im_reason = reason_code; memcpy(mlme.im_macaddr, addr, WLAN_ADDR_LEN); return set80211priv(pap, IEEE80211_IOCTL_SETMLME, &mlme, sizeof(mlme)); }
SystemWrapper::library_t *SystemWrapper::GetLibrary(char *name) { char fixedname[MAX_PATH]; Q_strlcpy(fixedname, name); COM_FixSlashes(fixedname); library_t *lib = (library_t *)m_Libraries.GetFirst(); while (lib) { if (Q_stricmp(lib->name, name) == 0) { return lib; } lib = (library_t *)m_Libraries.GetNext(); } lib = (library_t *)Mem_Malloc(sizeof(library_t)); if (!lib) { DPrintf("ERROR! System::GetLibrary: out of memory (%s).\n", name); return nullptr; } Q_snprintf(lib->name, sizeof(lib->name), "%s." LIBRARY_PREFIX, fixedname); FS_GetLocalCopy(lib->name); lib->handle = (CSysModule *)Sys_LoadModule(lib->name); if (!lib->handle) { DPrintf("ERROR! System::GetLibrary: coulnd't load library (%s).\n", lib->name); Mem_Free(lib); return nullptr; } lib->createInterfaceFn = (CreateInterfaceFn)Sys_GetFactory(lib->handle); if (!lib->createInterfaceFn) { DPrintf("ERROR! System::GetLibrary: coulnd't get object factory(%s).\n", lib->name); Mem_Free(lib); return nullptr; } m_Libraries.Add(lib); DPrintf("Loaded library %s.\n", lib->name); return lib; }
void ParaNdis_DebugInitialize(PVOID DriverObject,PVOID RegistryPath) { NDIS_STRING usRegister, usDeregister, usPrint; PVOID pr, pd; BOOLEAN res; WPP_INIT_TRACING(DriverObject, RegistryPath); NdisAllocateSpinLock(&CrashLock); KeInitializeCallbackRecord(&CallbackRecord); ParaNdis_PrepareBugCheckData(); NdisInitUnicodeString(&usPrint, L"vDbgPrintEx"); NdisInitUnicodeString(&usRegister, L"KeRegisterBugCheckReasonCallback"); NdisInitUnicodeString(&usDeregister, L"KeDeregisterBugCheckReasonCallback"); pd = MmGetSystemRoutineAddress(&usPrint); if (pd) PrintProcedure = (vDbgPrintExType)pd; pr = MmGetSystemRoutineAddress(&usRegister); pd = MmGetSystemRoutineAddress(&usDeregister); if (pr && pd) { BugCheckRegisterCallback = (KeRegisterBugCheckReasonCallbackType)pr; BugCheckDeregisterCallback = (KeDeregisterBugCheckReasonCallbackType)pd; } res = BugCheckRegisterCallback(&CallbackRecord, ParaNdis_OnBugCheck, KbCallbackSecondaryDumpData, "NetKvm"); DPrintf(0, ("[%s] Crash callback %sregistered", __FUNCTION__, res ? "" : "NOT ")); #ifdef OVERRIDE_DEBUG_BREAK if (sizeof(PVOID) == sizeof(ULONG)) { UCHAR replace[5] = {0xe9,0,0,0,0}; ULONG replacement; NDIS_STRING usDbgBreakPointName; NdisInitUnicodeString(&usDbgBreakPointName, L"DbgBreakPoint"); pDbgBreakPoint = (PUCHAR)MmGetSystemRoutineAddress(&usDbgBreakPointName); if (pDbgBreakPoint) { DPrintf(0, ("Replacing original BP handler at %p", pDbgBreakPoint)); replacement = RtlPointerToOffset(pDbgBreakPoint + 5, AnotherDbgBreak); RtlCopyMemory(replace + 1, &replacement, sizeof(replacement)); RtlCopyMemory(DbgBreakPointChunk, pDbgBreakPoint, sizeof(DbgBreakPointChunk)); RtlCopyMemory(pDbgBreakPoint, replace, sizeof(replace)); } } #endif }
void GetXferSegment (const ADAPTER_PTR HA, IO_REQ_PTR Req, SegmentDescr *SGDescr, U32 Offset, BOOLEAN DemandPhysicalAddr) { TRACE(4, ("GetXferSegment(): Offset = %d\n", Offset)); TRACE(4, ("GetXferSegment(): Non-S/G request, ReqDataCount = %d\n", ReqDataCount(Req))); if (Offset < ReqDataCount(Req)) { // Make sure we don't over run SGDescr->SegmentLength = ReqDataCount(Req) - Offset; SGDescr->SegmentPtr = (U32)ReqDataPtr(Req) + Offset; } else { SGDescr->SegmentLength = 0; // No data left SGDescr->SegmentPtr = 0; BreakPoint(HA); } TRACE(4, ("GetXferSegment(): %d bytes remain in segment at %08x (offset %d)\n", SGDescr->SegmentLength, SGDescr->SegmentPtr, Offset)); SGDescr->Flags.IsPhysical = FALSE; if (DemandPhysicalAddr) { if (ReqState(Req).InternalRequest) { TRACE(5, ("GetXferSegment(): Mapping internal request\n")); MapToPhysical(HA, SGDescr); } else { ULONG Size = SGDescr->SegmentLength; SGDescr->SegmentPtr = (U32)ScsiPortConvertPhysicalAddressToUlong( ScsiPortGetPhysicalAddress(HA, Req, (PVOID)((U32)ReqDataPtr(Req) + Offset) /*(SGDescr->SegmentPtr)*/, &Size)); if (Size < SGDescr->SegmentLength) SGDescr->SegmentLength = Size; DEBUG(5, { if (SGDescr->SegmentLength < (ReqDataCount(Req) - Offset)) DPrintf("Segment length is %d out of %d\n", SGDescr->SegmentLength, ReqDataCount(Req) - Offset);}); SGDescr->Flags.IsPhysical = TRUE; TRACE(5, ("GetXferSegment(): Mapped to 0x%lx for %lu bytes\n", SGDescr->SegmentPtr, Size)); } }
/*保存证书状态*/ int save_cert_status(char *fileconfig, char *cert_flag) { int res = 0; res = !save_global_conf(SEP_EQUAL,fileconfig,"", "CERT_STATUS",cert_flag); if(res != 0) { DPrintf("open file %s error\n", fileconfig); } return res; }
/********************************************************** NDIS required procedure of OID QUERY Just passes all the supported oids to common query procedure Return value: NDIS_STATUS as returned from common code NDIS_STATUS_NOT_SUPPORTED if suppressed in the table ***********************************************************/ NDIS_STATUS ParaNdis5_QueryOID(IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_OID Oid, IN PVOID InformationBuffer, IN ULONG InformationBufferLength, OUT PULONG BytesWritten, OUT PULONG BytesNeeded) { NDIS_STATUS status = NDIS_STATUS_NOT_SUPPORTED; int debugLevel; tOidWhatToDo Rules; PARANDIS_ADAPTER *pContext = (PARANDIS_ADAPTER *)MiniportAdapterContext; tOidDesc _oid; ParaNdis_GetOidSupportRules(Oid, &Rules, OidsDB); _oid.ulToDoFlags = Rules.Flags; *BytesWritten = 0; *BytesNeeded = 0; ParaNdis_DebugHistory(pContext, hopOidRequest, NULL, Oid, 0, 1); DPrintf(Rules.nEntryLevel, ("[%s], id 0x%X(%s) of %d", __FUNCTION__, Oid, Rules.name, InformationBufferLength)); _oid.Oid = Oid; _oid.InformationBuffer = InformationBuffer; _oid.InformationBufferLength = InformationBufferLength; _oid.pBytesNeeded = BytesNeeded; _oid.pBytesRead = BytesWritten; _oid.pBytesWritten = BytesWritten; if (pContext->bSurprizeRemoved) status = NDIS_STATUS_NOT_ACCEPTED; else if (Rules.Flags & ohfQuery) status = ParaNdis_OidQuery(pContext, &_oid); ParaNdis_DebugHistory(pContext, hopOidRequest, NULL, Oid, status, 0); DPrintf((status != NDIS_STATUS_SUCCESS) ? Rules.nExitFailLevel : Rules.nExitOKLevel, ("[%s] , id 0x%X(%s) (%X), written %d, needed %d", __FUNCTION__, Rules.oid, Rules.name, status, *BytesWritten, *BytesNeeded)); return status; }
static VOID MiniportEnableMSIInterrupt( IN PVOID MiniportInterruptContext, IN ULONG MessageId ) { PARANDIS_ADAPTER *pContext = (PARANDIS_ADAPTER *)MiniportInterruptContext; ULONG interruptSource = MessageToInterruptSource(pContext, MessageId); DPrintf(0, ("[%s] (Message %d)\n", __FUNCTION__, MessageId)); ParaNdis_VirtIOEnableIrqSynchronized(pContext, interruptSource); }
static BOOL APIENTRY SetVSync( int vsync ) { #if defined (__APPLE__) DPrintf(TEXTCOLOR_CYAN "Vertical synchronization is turned %s\n", vsync > 0 ? "on" : "off"); return kCGLNoError == CGLSetParameter( CGLGetCurrentContext(), kCGLCPSwapInterval, &vsync ); #else // !__APPLE__ // empty placeholder return false; #endif // __APPLE__ }
VOID ParaNdis_OnBugCheck( IN KBUGCHECK_CALLBACK_REASON Reason, IN PKBUGCHECK_REASON_CALLBACK_RECORD Record, IN OUT PVOID ReasonSpecificData, IN ULONG ReasonSpecificDataLength ) { KBUGCHECK_SECONDARY_DUMP_DATA *pDump = (KBUGCHECK_SECONDARY_DUMP_DATA *)ReasonSpecificData; UNREFERENCED_PARAMETER(Record); if (KbCallbackSecondaryDumpData == Reason && ReasonSpecificDataLength >= sizeof(*pDump)) { ULONG dumpSize = sizeof(BugCheckData.Location); if (!pDump->OutBuffer) { UINT nSaved; nSaved = FillDataOnBugCheck(); if (pDump->InBufferLength >= dumpSize) { pDump->OutBuffer = pDump->InBuffer; pDump->OutBufferLength = dumpSize; } else { pDump->OutBuffer = &BugCheckData.Location; pDump->OutBufferLength = dumpSize; bNative = FALSE; } DPrintf(0, ("[%s] system buffer of %d, saving data for %d NIC\n", __FUNCTION__,pDump->InBufferLength, nSaved)); DPrintf(0, ("[%s] using %s buffer\n", __FUNCTION__, bNative ? "native" : "own")); } else if (pDump->OutBuffer == pDump->InBuffer) { RtlCopyMemory(&pDump->Guid, &ParaNdis_CrashGuid, sizeof(pDump->Guid)); RtlCopyMemory(pDump->InBuffer, &BugCheckData.Location, dumpSize); pDump->OutBufferLength = dumpSize; DPrintf(0, ("[%s] written %d to %p\n", __FUNCTION__, (ULONG)BugCheckData.Location.Size, (UINT_PTR)BugCheckData.Location.Address )); DPrintf(0, ("[%s] dump data (%d) at %p\n", __FUNCTION__, pDump->OutBufferLength, pDump->OutBuffer)); } } }
static NDIS_STATUS ParaNdis6x_DirectOidRequest(IN NDIS_HANDLE miniportAdapterContext, IN PNDIS_OID_REQUEST OidRequest) { NDIS_STATUS status = NDIS_STATUS_NOT_SUPPORTED; PARANDIS_ADAPTER *pContext = (PARANDIS_ADAPTER *)miniportAdapterContext; if (pContext->bSurprizeRemoved) status = NDIS_STATUS_NOT_ACCEPTED; DPrintf(1, ("[%s] came %s\n", __FUNCTION__, ParaNdis_OidName(OidRequest->DATA.SET_INFORMATION.Oid))); return status; }
static void WaitHaltEvent(PARANDIS_ADAPTER *pContext, const char *Reason) { UINT ms = 5000; if (!NdisWaitEvent(&pContext->HaltEvent, 1)) { while (!NdisWaitEvent(&pContext->HaltEvent, ms)) { DPrintf(0, ("[%s]", __FUNCTION__)); } } }
void I_LoadSound (struct sfxinfo_struct *sfx) { if (!sound_initialized) return; if (!sfx->data) { DPrintf ("loading sound \"%s\" (%d)\n", sfx->name, sfx->lumpnum); getsfx (sfx); } }