• 免杀加密 前4K程序


        #include "stdafx.h"  
        #include<windows.h>  
          
        void Decrypt4k(TCHAR *str)  
        {    
            HANDLE hFile = CreateFile(str, GENERIC_READ|GENERIC_WRITE , 0, NULL,OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);  
          
            if (hFile==NULL||hFile==INVALID_HANDLE_VALUE)  
            {  
                OutputDebugString(_T("release_con_file CreateFile Error"));  
                return ;  
            }  
          
            DWORD filesize=4096;    
          
            char* buffer=new char[4096];  
            DWORD readsize;    
            ReadFile(hFile,buffer,filesize,&readsize,NULL);    
          
            for(int i=0;i<4096;i++)  
            {  
                buffer[i]=buffer[i]-1;    
                printf("%d
    ",buffer[i]);  
            }  
          
          
            SetFilePointer(hFile, 0, NULL, FILE_BEGIN);  
          
          
            DWORD dw_size;  
            WriteFile(hFile,buffer,filesize,&dw_size,0);  
          
          
            delete[] buffer; // 注意是delete[] 而不是 delete    
            CloseHandle(hFile); // 关闭句柄。    
          
        }  
          
        void Encryption4k(TCHAR* str)    
        {    
            HANDLE hFile = CreateFile(str, GENERIC_READ|GENERIC_WRITE , 0, NULL,OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);  
          
            if (hFile==NULL||hFile==INVALID_HANDLE_VALUE)  
            {  
                OutputDebugString(_T("release_con_file CreateFile Error"));  
                return ;  
            }  
          
            DWORD filesize=4096;    
          
            char* buffer=new char[4096];  
            DWORD readsize;    
            ReadFile(hFile,buffer,filesize,&readsize,NULL);    
          
            for(int i=0;i<4096;i++)  
            {  
                buffer[i]=buffer[i]+1;    
                printf("%d
    ",buffer[i]);  
            }  
          
          
            SetFilePointer(hFile, 0, NULL, FILE_BEGIN);  
          
          
            DWORD dw_size;  
            WriteFile(hFile,buffer,filesize,&dw_size,0);  
          
          
            delete[] buffer; // 注意是delete[] 而不是 delete    
            CloseHandle(hFile); // 关闭句柄。    
              
        }  
          
        int _tmain(int argc, _TCHAR* argv[])  
        {  
            Encryption4k(_T("c:\Test.exe"));  
          
            return 0;  
        }  
    
  • 相关阅读:
    定位IO瓶颈的方法,iowait低,IO就没有到瓶颈?
    10分钟检查自己的系统性能数据
    netperf使用指南
    如何看内核源码
    xxx
    os.path 模块
    目前中国智能语音产业的格局、现状
    NLP-python 自然语言处理01
    15本经典金融投资著作
    写给步入工作的自己
  • 原文地址:https://www.cnblogs.com/xuandi/p/7161558.html
Copyright © 2020-2023  润新知