Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/130.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 防病毒软件一直将我的项目检测为病毒_C++_Directx_Virus - Fatal编程技术网

C++ 防病毒软件一直将我的项目检测为病毒

C++ 防病毒软件一直将我的项目检测为病毒,c++,directx,virus,C++,Directx,Virus,早上好,我正在尝试为我的游戏创建框架,使编码对我来说更容易。 我刚刚创建了一个函数来添加对象,但在我创建了创建索引缓冲区的部分之后,反病毒一直告诉我:“发现了病毒:Win32:Evo gen[Susp]”,我不知道为什么。 加载对象的函数代码: HRESULT Framework::AddObject(Object* obj){ std::vector<short> indices; std::vector<VertexType> vertices;

早上好,我正在尝试为我的游戏创建框架,使编码对我来说更容易。 我刚刚创建了一个函数来添加对象,但在我创建了创建索引缓冲区的部分之后,反病毒一直告诉我:“发现了病毒:Win32:Evo gen[Susp]”,我不知道为什么。 加载对象的函数代码:

HRESULT Framework::AddObject(Object* obj){
    std::vector<short> indices;
    std::vector<VertexType> vertices;
    obj->GetData(indices,vertices);
    IDirect3DVertexBuffer9* cVBuffer;
    IDirect3DIndexBuffer9* cIBuffer;
    int at=vertexBuffers.size();
    vertexBuffers.push_back(cVBuffer);
    indexBuffers.push_back(cIBuffer);
    unsigned int sOfVerts=vertices.size()*sizeof VertexType;
    unsigned int sOfIndices=indices.size()*sizeof(short);
    vCount.push_back(vertices.size());
    iCount.push_back(indices.size());
    HRESULT hr=device->GetDevice()->CreateVertexBuffer(sOfVerts,0,D3DFVF_VertexType,D3DPOOL_DEFAULT,&vertexBuffers[at],NULL);
    if(FAILED(hr)){
        EndWithError("Failed to load object",hr);
        return hr;
    } else {
        void* p_vertices;
        hr=vertexBuffers[at]->Lock(0,sOfVerts,(void**)&p_vertices,0);
        if(FAILED(hr)){
            EndWithError("Failed to lock buffer",hr);
            return hr;
        } else {
            applog<<"Successfuly created VertexBuffer for object "<<obj->GetClass()<<"["<<at<<"], vertices size: "<<sOfVerts<<", vertices count: "<<vertices.size()<<std::endl;
            memcpy(p_vertices,&vertices[0],sOfVerts);
            vertexBuffers[at]->Unlock();
        }
    }
    hr=device->GetDevice()->CreateIndexBuffer(sOfIndices,D3DUSAGE_WRITEONLY,D3DFMT_INDEX16,D3DPOOL_MANAGED,&indexBuffers[at],NULL);
    if(FAILED(hr)){
        EndWithError("Failed to load indices",hr);
        return hr;
    } else {
        void* p_indices;
        hr=indexBuffers[at]->Lock(0,sOfIndices,(void**)&p_indices,0);
        if(FAILED(hr)){
            EndWithError("Failed to lock index buffer",hr);
            return hr;
        } else {
            memcpy(p_indices,&indices[0],sOfIndices);
            indexBuffers[at]->Unlock();            
        }
    }
    return S_OK;
}
//device->GetDevice() - returns IDirect3DDevice9*
//obj->GetData(vector<int>& indices,vector<VertexType>& vertices); //gets vertices and indices
//obj->GetClass() const; - returns name of class of object, because Object is base class for another objects
HRESULT框架::AddObject(Object*obj){
std::向量指数;
向量顶点;
obj->GetData(索引、顶点);
IDirect3DVertexBuffer9*cVBuffer;
IDirect3DIndexBuffer9*cIBuffer;
int at=vertexBuffers.size();
顶点缓冲区。推回(cVBuffer);
indexBuffers.推回(cIBuffer);
unsigned int sOfVerts=顶点。size()*sizeof VertexType;
unsigned int sofinders=index.size()*sizeof(short);
vCount.push_back(顶点.size());
iCount.push_back(index.size());
HRESULT hr=device->GetDevice()->CreateVertexBuffer(sOfVerts,0,D3DFVF_VertexType,D3DPOOL_DEFAULT,&vertexBuffers[at],NULL);
如果(失败(小时)){
EndWithError(“加载对象失败”,hr);
返回人力资源;
}否则{
void*p_顶点;
hr=顶点缓冲区[at]->锁(0,sOfVerts,(void**)和p_顶点,0);
如果(失败(小时)){
EndWithError(“锁定缓冲区失败”,hr);
返回人力资源;
}否则{
applogenedscene();
}
dev->Present(空,空,空,空);
}
}
有谁能告诉我原因是什么,为什么反病毒会将其检测为病毒以及如何修复它吗?

反病毒软件使用“启发式”(高级猜测的花哨词!)来检测“坏模式”。这听起来像是“假阳性”

正确的解决方法是将问题报告给AV提供商,让他们发布一个新版本的“检测”,该版本不会错误地检测到有效代码。然而,除非你有一个非常好的AV提供商,否则在接下来的几周内你不太可能从中看到很多东西

因此,实际的解决方案通常是要么完全移除AV,要么用不同的产品替换它[顺便说一句,这两种情况都很棘手,因为AV软件往往很难卸载-当然,有很好的理由,你不会希望第一个病毒攻击你的机器来卸载你的AV软件-这意味着有时候AV卸载本身并没有卸载它应该卸载的所有东西]


有时候仅仅关闭“实时扫描”就足够了。

问题解决了。它几乎与索引缓冲区无关。 原因是2个未关闭的输出文件流


无论如何,感谢大家!我至少学到了一些新的东西。

也许你的计算机上有一个病毒正在感染系统上的所有可执行文件…这是唯一一个被检测为病毒的病毒?是的,这是唯一一个,当我在dev->GetDevice()->CreateIndexBuffer(…)中评论该部分时返回S_OK;它没有检测到病毒。可能UB。几乎和鼻腔守护程序一样好。我不认为这个问题应该被否决。这是真的,但是如果……我不想让我的游戏在将来成为私有的,而是公开的。我会告诉所有其他人卸载他们的抗病毒软件吗?那么你需要说服AV提供商,你的游戏e应该被列为“白名单”,以检测它认为你做错了什么。当然,你的代码可能会在这两者之间发生一些变化,所以这可能不是问题。防病毒会因此发出警告?!?
void Framework::RenderFrame(){
    IDirect3DDevice9* dev=device->GetDevice();
    if(dev!=NULL){
        dev->Clear(0,NULL,D3DCLEAR_TARGET,D3DCOLOR_XRGB(32,32,64),1.0f,0);
        if(SUCCEEDED(dev->BeginScene())){
            for(unsigned int i=0;i<vertexBuffers.size();i++){
                IDirect3DDevice9* dev=device->GetDevice();
                dev->SetStreamSource( 0, vertexBuffers[i], 0, sizeof( VertexType ) );
                dev->SetFVF( D3DFVF_VertexType );
                dev->SetIndices(indexBuffers[i]);
                //dev->DrawPrimitive( D3DPT_TRIANGLELIST, 0, 1 );
                dev->DrawIndexedPrimitive(D3DPT_TRIANGLELIST,0,0,vCount[i],0,iCount[i]/3);
            }
            dev->EndScene();
        }
        dev->Present(NULL,NULL,NULL,NULL);
    }
}