start
using system;
using system.collections.generic;
using system.componentmodel;
using system.data;
using system.drawing;
using system.linq;
using system.text;
using system.windows.forms;
using system.io;
using system.security.cryptography;
using microsoft.win32;
namespace encryptexe
private
,0catch }//
選擇要加密或解密的檔案
private
void button1_click(object sender, eventargs e)
//加密exe檔案
private
void button2_click(object sender, eventargs e);}
if (strpwd.length == 7);}
if (strpwd.length >= 8);}
filestream fstream = new filestream(textbox1.text, filemode.open, fileaccess.read);
filestream newfstream = new filestream(textbox1.text + "
.mrexe
", filemode.openorcreate, fileaccess.write);
newfstream.setlength((long)0);
byte buffer = new
byte[0x400];
int minnum = 0;
long length = fstream.length;
int maxnum = (int)(length / ((long)0x400));
des mydes = new descryptoserviceprovider();
cryptostream cstream = new cryptostream(newfstream, mydes.createencryptor(btrkey, btrkey), cryptostreammode.write);
while (minnum < length)
cstream.close();
newfstream.close();
fstream.close();
file.delete(textbox1.text);
messagebox.show("
使用口令加密可執行檔案成功!
", "
資訊提示
", messageboxbuttons.ok, messageboxicon.information);}//
解密exe檔案
private
void button3_click(object sender, eventargs e);}
if (strpwd.length == 7);}
if (strpwd.length >= 8);}
fstream = new filestream(textbox1.text, filemode.open, fileaccess.read);
string strnewfile = textbox1.text.substring(0, textbox1.text.length - 6);
newfstream = new filestream(strnewfile, filemode.openorcreate, fileaccess.write);
newfstream.setlength((long)0);
byte buffer = new
byte[0x400];
int minnum = 0;
long length = fstream.length;
int maxnum = (int)(length / ((long)0x400));
des mydes = new descryptoserviceprovider();
cstream = new cryptostream(newfstream, mydes.createdecryptor(btrkey, btrkey), cryptostreammode.write);
while (minnum < length)
cstream.close();
fstream.close();
newfstream.close();
file.delete(textbox1.text);
system.diagnostics.process.start(strnewfile);
}catch
}finally}//
建立快捷選單
public
static
void filemenu(string strpath, string strname)
catch}}
}namespace encryptexe
base.dispose(disposing);
}#region windows 窗體設計器生成的**
//////
設計器支援所需的方法 - 不要
///使用**編輯器修改此方法的內容。
///private
void initializecomponent()
#endregion
private system.windows.forms.button button3;
private system.windows.forms.button button2;
private system.windows.forms.groupbox groupbox1;
private system.windows.forms.label label1;
private system.windows.forms.textbox textbox1;
private system.windows.forms.button button1;
private system.windows.forms.label label3;
private system.windows.forms.label label2;
private system.windows.forms.textbox textbox2;
private system.windows.forms.openfiledialog openfiledialog1;}}
url:
linux 執行可執行檔案
1 首先,需要了解一下a.out這個目標檔案。a.out在linux下是elf executable linkable format 檔案格式,該目標檔案由乙個檔案頭 段 資料段 已初始化 從定位資訊區 符號表及符號名字字串構成,如下左圖所示,經過鏈結後生成執行檔案如下右圖所示,需要說明的是1 bs...
API函式執行可執行檔案
shellexecute hwnd hwnd,父視窗控制代碼 lpcstr lpoperation,操作型別 lpcstr lpfile,要進行操作的檔案或路徑 lpcstr lpparameters,當lpoperation為 explore 時指定要傳遞的引數,通常設為null lpcstr l...
Linux下執行可執行檔案
我們通常會為計算機配置環境變數 path,echo path 檢視當前的環境變數包含的目錄。這些目錄下的可執行檔案就無需輸入完整路徑來執行,直接輸入命令就行,我們shell中常使用的一些linux命令,例如man,cat等的目錄都被包含在該path目錄中,所以直接在shell中輸入這些命令就可以。即...