static NTSTATUS drv_cleanup(PDEVICE_OBJECT device, PIRP irp) { setfilter(NULL); SetRanges(NULL, 0); SetRanges(NULL, 1); #ifndef USE_FIXED_LIST FreeAllocatedBanList(); #endif DestroyNotificationQueue(&g_internal->queue); irp->IoStatus.Status=STATUS_SUCCESS; irp->IoStatus.Information=0; IoCompleteRequest(irp, IO_NO_INCREMENT); return STATUS_SUCCESS; }
static NTSTATUS drv_cleanup(PDEVICE_OBJECT device, PIRP irp) { DbgPrint("pbfilter: > Entering drv_cleanup()\n"); setfilter(NULL); SetRanges(NULL, 0); SetRanges(NULL, 1); DestroyNotificationQueue(&g_internal->queue); irp->IoStatus.Status=STATUS_SUCCESS; irp->IoStatus.Information=0; IoCompleteRequest(irp, IO_NO_INCREMENT); DbgPrint("pbfilter: < Leaving drv_cleanup()\n"); return STATUS_SUCCESS; }
static NTSTATUS drv_control(PDEVICE_OBJECT device, PIRP irp) { PIO_STACK_LOCATION irpstack; ULONG controlcode; NTSTATUS status; irp->IoStatus.Status=STATUS_SUCCESS; irp->IoStatus.Information=0; irpstack=IoGetCurrentIrpStackLocation(irp); controlcode=irpstack->Parameters.DeviceIoControl.IoControlCode; switch(controlcode) { case IOCTL_PEERGUARDIAN_HOOK: if(irp->AssociatedIrp.SystemBuffer!=NULL && irpstack->Parameters.DeviceIoControl.InputBufferLength==sizeof(int)) { int *hook=(int*)irp->AssociatedIrp.SystemBuffer; setfilter((*hook)?filter_cb:NULL); } else irp->IoStatus.Status=STATUS_INVALID_PARAMETER; break; case IOCTL_PEERGUARDIAN_HTTP: if(irp->AssociatedIrp.SystemBuffer!=NULL && irpstack->Parameters.DeviceIoControl.InputBufferLength==sizeof(int)) { g_internal->blockhttp=*((int*)irp->AssociatedIrp.SystemBuffer); } else irp->IoStatus.Status=STATUS_INVALID_PARAMETER; break; case IOCTL_PEERGUARDIAN_SETRANGES: { PGRANGES *ranges; ULONG inputlen; ranges = irp->AssociatedIrp.SystemBuffer; inputlen = irpstack->Parameters.DeviceIoControl.InputBufferLength; if(inputlen >= offsetof(PGRANGES, ranges[0]) && inputlen >= offsetof(PGRANGES, ranges[ranges->count])) { SetRanges(ranges, ranges->block); } else { irp->IoStatus.Status = STATUS_INVALID_PARAMETER; } } break; case IOCTL_PEERGUARDIAN_GETNOTIFICATION: return Notification_Recieve(&g_internal->queue, irp); case IOCTL_PEERGUARDIAN_CONNECTION_LIMIT: if(irp->AssociatedIrp.SystemBuffer!=NULL && irpstack->Parameters.DeviceIoControl.InputBufferLength==sizeof(int)) { g_internal->f_cons_last_received_IP_count_limit=*((int*)irp->AssociatedIrp.SystemBuffer); } else irp->IoStatus.Status=STATUS_INVALID_PARAMETER; break; case IOCTL_PEERGUARDIAN_SET_PORT: if(irp->AssociatedIrp.SystemBuffer!=NULL && irpstack->Parameters.DeviceIoControl.InputBufferLength==sizeof(int)) { int param = *((int*)irp->AssociatedIrp.SystemBuffer); char openstatus = (char)(0xFF & param); unsigned short portnumber = param >> 16; if( portnumber == 0 || openstatus == 0) irp->IoStatus.Status=STATUS_INVALID_PARAMETER; g_internal->f_port_open_ports[ portnumber ] = openstatus - 1; } else irp->IoStatus.Status=STATUS_INVALID_PARAMETER;
void mglCanvas::DefaultPlotParam() { /* NOTE: following variables and mutex will not be changed by DefaultPlotParam() long InUse; ///< Smart pointer (number of users) mglFont *fnt; ///< Class for printing vector text int Quality; ///< Quality of plot (0x0-pure, 0x1-fast; 0x2-fine; 0x4 - low memory) int Width; ///< Width of the image int Height; ///< Height of the image int Depth; ///< Depth of the image int CurFrameId; ///< Number of automaticle created frames GifFileType *gif;*/ SetDrawReg(1,1,0); Perspective(0); memcpy(mgl_mask_val, mgl_mask_def, 16*sizeof(uint64_t)); // should be > 16*8 ax.Clear(); ay.Clear(); az.Clear(); ac.Clear(); mgl_clear_fft(); DefMaskAn=0; ResetMask(); SetTickRotate(true); SetTickSkip(true); SetWarn(mglWarnNone,""); mglGlobalMess = ""; ObjId = -1; HighId = INT_MIN; SetFunc(0,0); CutOff(0); Ternary(0); Stop=false; event_cb = NULL; event_par=NULL; SetRanges(mglPoint(-1,-1,-1,-1), mglPoint(1,1,1,1)); SetOrigin(NAN,NAN,NAN,NAN); SetBarWidth(0.7); SetMarkSize(1); SetArrowSize(1); SetAlphaDef(0.5); FontDef[0]=0; SetTranspType(0); SetMeshNum(0); // NOTE: default MeshNum=0 SetRotatedText(true); CurrPal = 0; SetLegendMarks(); SetFontSize(4); SetTuneTicks(3); SetAmbient(); SetDiffuse(); clr(MGL_DISABLE_SCALE); clr(MGL_USE_GMTIME); clr(MGL_NOSUBTICKS); SetDifLight(false); SetReduceAcc(false); SetDefScheme(MGL_DEF_SCH); SetPalette(MGL_DEF_PAL); SetPenPal("k-1"); Alpha(false); stack.clear(); Restore(); DefColor('k'); SetPlotFactor(0); InPlot(0,1,0,1,false); SetTickLen(0); SetCut(true); AdjustTicks("xyzc",true); Clf('w'); for(int i=0;i<10;i++) { AddLight(i, mglPoint(0,0,1)); Light(i,false); } Light(0,true); Light(false); SetDifLight(true); }
// JoystickInputStreamImpl(IDirectInputDevice2* pdid, HWND hwnd) : JoystickInputStreamImpl(IDirectInputDevice7* pdid, HWND hwnd) : // mdvalley: DInput7 m_pdid(pdid), m_bFocus(false), m_vvalueObject(5) { DDCall(m_pdid->GetCapabilities(&m_didc)); DDCall(m_pdid->GetDeviceInfo(&m_didi)); // // Enumerate the buttons and values // DDCall(m_pdid->EnumObjects(StaticEnumObjectsCallback, this, DIDFT_ALL)); // // Remove any holes in the value vector // int index; int countValues = m_vvalueObject.GetCount(); index = 0; while (index < countValues) { if (m_vvalueObject[index] == NULL) { if (index != countValues - 1) { m_vvalueObject.Set(index, m_vvalueObject[countValues - 1]); } countValues--; m_vvalueObject.SetCount(countValues); } else { index++; } } // // Build the data format // int countButtons = m_vbuttonObject.GetCount(); m_sizeData = NextMultipleOf(4, countValues * 4 + countButtons * 1); DIDataFormat didf; didf.dwObjSize = sizeof(DIOBJECTDATAFORMAT); didf.dwFlags = 0; didf.dwDataSize = m_sizeData; didf.dwNumObjs = countValues + countButtons; DIObjectDataFormat* pdiodf = new DIObjectDataFormat[didf.dwNumObjs]; didf.rgodf = pdiodf; for (index = 0; index < countValues; index++) { ValueDDInputObject* pobject = m_vvalueObject[index]; DIOBJECTDATAFORMAT& diodf = didf.rgodf[index]; diodf.pguid = (GUID*)&(pobject->GetGUID()); diodf.dwOfs = index * 4; diodf.dwType = pobject->GetDWType(); diodf.dwFlags = DIDOI_ASPECTPOSITION; } for (index = 0; index < countButtons; index++) { ButtonDDInputObject* pobject = m_vbuttonObject[index]; DIOBJECTDATAFORMAT& diodf = didf.rgodf[countValues + index]; diodf.pguid = (GUID*)&(pobject->GetGUID()); diodf.dwOfs = countValues * 4 + index; diodf.dwType = pobject->GetDWType(); diodf.dwFlags = DIDOI_ASPECTPOSITION; } DDCall(m_pdid->SetDataFormat(&didf)); delete pdiodf; // // Allocate a data receptical // m_pbyteData = new BYTE[m_sizeData]; // // We only need joystick input when we are in the foreground // DDCall(m_pdid->SetCooperativeLevel(hwnd, DISCL_EXCLUSIVE | DISCL_FOREGROUND)); // // Set ranges // SetRanges(); }
void ConstructDDFAttributes::SetFromNode(DataNode *parentNode) { if(parentNode == 0) return; DataNode *searchNode = parentNode->GetNode("ConstructDDFAttributes"); if(searchNode == 0) return; DataNode *node; if((node = searchNode->GetNode("ddfName")) != 0) SetDdfName(node->AsString()); if((node = searchNode->GetNode("varnames")) != 0) SetVarnames(node->AsStringVector()); if((node = searchNode->GetNode("ranges")) != 0) SetRanges(node->AsDoubleVector()); if((node = searchNode->GetNode("codomainName")) != 0) SetCodomainName(node->AsString()); if((node = searchNode->GetNode("statisticalOperator")) != 0) { // Allow enums to be int or string in the config file if(node->GetNodeType() == INT_NODE) { int ival = node->AsInt(); if(ival >= 0 && ival < 10) SetStatisticalOperator(StatisticalOperator(ival)); } else if(node->GetNodeType() == STRING_NODE) { StatisticalOperator value; if(StatisticalOperator_FromString(node->AsString(), value)) SetStatisticalOperator(value); } } if((node = searchNode->GetNode("percentile")) != 0) SetPercentile(node->AsDouble()); if((node = searchNode->GetNode("undefinedValue")) != 0) SetUndefinedValue(node->AsDouble()); if((node = searchNode->GetNode("binningScheme")) != 0) { // Allow enums to be int or string in the config file if(node->GetNodeType() == INT_NODE) { int ival = node->AsInt(); if(ival >= 0 && ival < 2) SetBinningScheme(BinningScheme(ival)); } else if(node->GetNodeType() == STRING_NODE) { BinningScheme value; if(BinningScheme_FromString(node->AsString(), value)) SetBinningScheme(value); } } if((node = searchNode->GetNode("numSamples")) != 0) SetNumSamples(node->AsIntVector()); if((node = searchNode->GetNode("overTime")) != 0) SetOverTime(node->AsBool()); if((node = searchNode->GetNode("timeStart")) != 0) SetTimeStart(node->AsInt()); if((node = searchNode->GetNode("timeEnd")) != 0) SetTimeEnd(node->AsInt()); if((node = searchNode->GetNode("timeStride")) != 0) SetTimeStride(node->AsInt()); }
void Draw(const char* pairName, const char* canvasName, std::vector<CorrelationFunction> &plots, bool isIdentical) { unsigned int i, k; int canvasNumber1 = -1, canvasNumber2 = 0; TLegend *hHKMlegend, *EPOSlegend; TCanvas *canv = new TCanvas(canvasName, canvasName, 1300, 2000); if(isIdentical) canv->Divide(2,4); else canv->Divide(2,5); // // hHKM // hHKMlegend = new TLegend(legendX1, legendY1, legendX2, legendY2); k = 0; canv->cd(++++canvasNumber1); for(i = 0 ; i < plots.size(); ++i) if(plots[i].model.compare("hHKM") == 0) { DrawSinglePlot(plots[i].cf1D, (std::string(pairName) + std::string(" - hHKM - 1D;q_{inv} (GeV/c);C(q_{inv})")).c_str(), k); SetRanges(plots[i].cf1D, canvasName, "1D"); hHKMlegend->AddEntry(plots[i].cf1D, plots[i].centrality.c_str(),"P"); } if(plots.size() > 0) { hHKMlegend->Draw(); hHKMlegend->SetFillColor(0); } k = 0; canv->cd(++++canvasNumber1); for(i = 0 ; i < plots.size(); ++i) if(plots[i].model.compare("hHKM") == 0) { DrawSinglePlot(plots[i].cfSH00, (std::string(pairName) + std::string(" - hHKM - Spherical Harmonics;k* (GeV/c);#RgothicC^{0}_{0}")).c_str(), k); SetRanges(plots[i].cfSH00, canvasName, "SH00"); } if(!isIdentical) { k = 0; canv->cd(++++canvasNumber1); for(i = 0 ; i < plots.size(); ++i) if(plots[i].model.compare("hHKM") == 0) { DrawSinglePlot(plots[i].cfSH11, (std::string(pairName) + std::string(" - hHKM - Spherical Harmonics;k* (GeV/c);#RgothicC^{1}_{1}")).c_str(), k); SetRanges(plots[i].cfSH11, canvasName, "SH11"); } } k = 0; canv->cd(++++canvasNumber1); for(i = 0 ; i < plots.size(); ++i) if(plots[i].model.compare("hHKM") == 0) { DrawSinglePlot(plots[i].cfSH20, (std::string(pairName) + std::string(" - hHKM - Spherical Harmonics;k* (GeV/c);#RgothicC^{0}_{2}")).c_str(), k); SetRanges(plots[i].cfSH20, canvasName, "SH20"); } k = 0; canv->cd(++++canvasNumber1); for(i = 0 ; i < plots.size(); ++i) if(plots[i].model.compare("hHKM") == 0) { DrawSinglePlot(plots[i].cfSH22, (std::string(pairName) + std::string(" - hHKM - Spherical Harmonics;k* (GeV/c);#RgothicC^{2}_{2}")).c_str(), k); SetRanges(plots[i].cfSH22, canvasName, "SH22"); } // // EPOS // EPOSlegend = new TLegend(legendX1, legendY1, legendX2, legendY2); k = 0; canv->cd(++++canvasNumber2); for(i = 0 ; i < plots.size(); ++i) if(plots[i].model.compare("EPOS") == 0) { DrawSinglePlot(plots[i].cf1D, (std::string(pairName) + std::string(" - EPOS - 1D;q_{inv} (GeV/c);C(q_{inv})")).c_str(), k); SetRanges(plots[i].cf1D, canvasName, "1D"); EPOSlegend->AddEntry(plots[i].cf1D, plots[i].centrality.c_str(),"P"); } if(plots.size() > 0) { EPOSlegend->Draw(); EPOSlegend->SetFillColor(0); } k = 0; canv->cd(++++canvasNumber2); for(i = 0 ; i < plots.size(); ++i) if(plots[i].model.compare("EPOS") == 0) { DrawSinglePlot(plots[i].cfSH00, (std::string(pairName) + std::string(" - EPOS - Spherical Harmonics;k* (GeV/c);#RgothicC^{0}_{0}")).c_str(), k); SetRanges(plots[i].cfSH00, canvasName, "SH00"); } if(!isIdentical) { k = 0; canv->cd(++++canvasNumber2); for(i = 0 ; i < plots.size(); ++i) if(plots[i].model.compare("EPOS") == 0) { DrawSinglePlot(plots[i].cfSH11, (std::string(pairName) + std::string(" - EPOS - Spherical Harmonics;k* (GeV/c);#RgothicC^{1}_{1}")).c_str(), k); SetRanges(plots[i].cfSH11, canvasName, "SH11"); } } k = 0; canv->cd(++++canvasNumber2); for(i = 0 ; i < plots.size(); ++i) if(plots[i].model.compare("EPOS") == 0) { DrawSinglePlot(plots[i].cfSH20, (std::string(pairName) + std::string(" - EPOS - Spherical Harmonics;k* (GeV/c);#RgothicC^{0}_{2}")).c_str(), k); SetRanges(plots[i].cfSH20, canvasName, "SH20"); } k = 0; canv->cd(++++canvasNumber2); for(i = 0 ; i < plots.size(); ++i) if(plots[i].model.compare("EPOS") == 0) { DrawSinglePlot(plots[i].cfSH22, (std::string(pairName) + std::string(" - EPOS - Spherical Harmonics;k* (GeV/c);#RgothicC^{2}_{2}")).c_str(), k); SetRanges(plots[i].cfSH22, canvasName, "SH22"); } canv->SaveAs((std::string(canvasName)+std::string(".eps")).c_str()); canv->SaveAs((std::string(canvasName)+std::string(".png")).c_str()); canv->SaveAs((std::string(canvasName)+std::string(".root")).c_str()); }
static NTSTATUS drv_control(PDEVICE_OBJECT device, PIRP irp) { PIO_STACK_LOCATION irpstack; ULONG controlcode; NTSTATUS status; irp->IoStatus.Status=STATUS_SUCCESS; irp->IoStatus.Information=0; irpstack=IoGetCurrentIrpStackLocation(irp); controlcode=irpstack->Parameters.DeviceIoControl.IoControlCode; switch(controlcode) { case IOCTL_PEERBLOCK_HOOK: DbgPrint("pbfilter: > IOCTL_PEERBLOCK_HOOK\n"); if(irp->AssociatedIrp.SystemBuffer!=NULL && irpstack->Parameters.DeviceIoControl.InputBufferLength==sizeof(int)) { int *hook=(int*)irp->AssociatedIrp.SystemBuffer; DbgPrint("pbfilter: setting filter...\n"); setfilter((*hook)?filter_cb:NULL); DbgPrint("pbfilter: ...filter set\n"); } else { DbgPrint("pbfilter: * ERROR: invalid parameter\n"); irp->IoStatus.Status=STATUS_INVALID_PARAMETER; } DbgPrint("pbfilter: < IOCTL_PEERBLOCK_HOOK\n"); break; case IOCTL_PEERBLOCK_SETRANGES: { PBRANGES *ranges; ULONG inputlen; DbgPrint("pbfilter: > IOCTL_PEERBLOCK_SETRANGES\n"); ranges = irp->AssociatedIrp.SystemBuffer; inputlen = irpstack->Parameters.DeviceIoControl.InputBufferLength; if(inputlen >= offsetof(PBRANGES, ranges[0]) && inputlen >= offsetof(PBRANGES, ranges[ranges->count])) { DbgPrint("pbfilter: calling SetRanges()\n"); SetRanges(ranges, ranges->block); } else { DbgPrint("pbfilter: * Error: STATUS_INVALID_PARAMETER\n"); irp->IoStatus.Status = STATUS_INVALID_PARAMETER; } DbgPrint("pbfilter: < IOCTL_PEERBLOCK_SETRANGES\n"); } break; case IOCTL_PEERBLOCK_GETNOTIFICATION: return Notification_Recieve(&g_internal->queue, irp); case IOCTL_PEERBLOCK_SETDESTINATIONPORTS: { USHORT *ports; ULONG count; DbgPrint("pbfilter: > IOCTL_PEERBLOCK_SETDESTINATIONPORTS\n"); ports = irp->AssociatedIrp.SystemBuffer; count = irpstack->Parameters.DeviceIoControl.InputBufferLength; SetDestinationPorts(ports, (USHORT) (count / sizeof(USHORT))); DbgPrint("pbfilter: < IOCTL_PEERBLOCK_SETDESTINATIONPORTS\n"); } break; case IOCTL_PEERBLOCK_SETSOURCEPORTS: { USHORT *ports; ULONG count; DbgPrint("pbfilter: > IOCTL_PEERBLOCK_SETSOURCEPORTS\n"); ports = irp->AssociatedIrp.SystemBuffer; count = irpstack->Parameters.DeviceIoControl.InputBufferLength; SetSourcePorts(ports, (USHORT) (count / sizeof(USHORT))); DbgPrint("pbfilter: < IOCTL_PEERBLOCK_SETSOURCEPORTS\n"); } break; default: DbgPrint("pbfilter: * ERROR: invalid parameter for IOCTL!\n"); irp->IoStatus.Status=STATUS_INVALID_PARAMETER; } status=irp->IoStatus.Status; IoCompleteRequest(irp, IO_NO_INCREMENT); return status; }