意思也就是说一个变量Str在安装的时候初始化为空串,在使用中可以对变量Str变量进行赋值,然后存储在Exe或DLL文件中,以后再使用Str变量的值就是赋值过的变量,请大家帮我一把很急!!!!!!问题解决再送200分

解决方案 »

  1.   

    没想到什么好的办法。
    为什么不用配置文件ini
    程序启动时读入,退出时写配置文件.
      

  2.   

    用INI文件或写入注册表比较好
      

  3.   

    搂上理解得不错 你要想放在 运行程序本身 死了这条心吧  蠕虫并不是对文件进行了修改
    他是检测文件运行时自动启动自己 这牵扯地层地址的跳转  如果直接对程序修改的话(debug调试除外)会造成程序不能运行用ini 或者其他文件 可以
      

  4.   

    运行时生成自身的备份,并修改备份中相应的数据,数据在文件中的偏移只能你自己去定位了,运行结束后删除原来的文件,并把备份文件改成原来的文件名!
    可以用批处理文件来完成这个任务  BatchFileName := ExtractFilePath(ParamStr(0)) + '_changeme.bat';  AssignFile(BatchFile, BatchFileName);
      Rewrite(BatchFile);  Writeln(BatchFile, ':try');
      Writeln(BatchFile, 'del "' + ParamStr(0) + '"');
      Writeln(BatchFile, 'ren "' + ExtractFilePath(ParamStr(0)) + '_backfile.dat" "' + ParamStr(0) + '"');  Writeln(BatchFile,
        'if exist "' + ParamStr(0) + '"' + ' goto try');
      Writeln(BatchFile, 'del %0');
      CloseFile(BatchFile);  FillChar(StartUpInfo, SizeOf(StartUpInfo), $00);
      StartUpInfo.dwFlags := STARTF_USESHOWWINDOW;
      StartUpInfo.wShowWindow := SW_HIDE;  if CreateProcess(nil, PChar(BatchFileName), nil, nil,
        False, IDLE_PRIORITY_CLASS, nil, nil, StartUpInfo,
        ProcessInfo) then
      begin
        CloseHandle(ProcessInfo.hThread);
        CloseHandle(ProcessInfo.hProcess);
      end;
      

  5.   

    学习……收藏……!
    在程序运行时修改自身,如果可行的话,那就不用配置INI文件或注册表了。如果记录程序的运行次数更好。