-------------------------------
--擦除WinRAR使用痕迹
--
-------------------------------

tInitDef = {}

tInitDef[1] = {}
tInitDef[1]["gbT"]="擦除压缩工具软件运行痕迹"
tInitDef[1]["big5T"]="揽埃溃罽ㄣ硁ン笲︽勃格"
tInitDef[1]["enT"]="Compression Tools"
tInitDef[1]["Key"]=150000
tInitDef[1]["iNoMenu"]=0
tInitDef[1]["fInstalled"]="LuaInstalled0"
tInitDef[1]["fEraseOpt"]="LuaCleaner0"
tInitDef[1]["tEraseTable"]="tEraseTable0"
tInitDef[1]["iRoot"]=5
tInitDef[1]["iSecond"]=0
tInitDef[1]["iThird"]=0

tInitDef[2] = {}
tInitDef[2]["gbT"]="擦除WinRAR使用痕迹"
tInitDef[2]["big5T"]="揽埃WinRARㄏノ勃格"
tInitDef[2]["enT"]="WinRAR"
tInitDef[2]["Key"]=150100
tInitDef[2]["iNoMenu"]=1
tInitDef[2]["fInstalled"]="LuaInstalled"
tInitDef[2]["fEraseOpt"]="LuaCleaner"
tInitDef[2]["tEraseTable"]="tEraseTable"
tInitDef[2]["iRoot"]=5
tInitDef[2]["iSecond"]=1
tInitDef[2]["iThird"]=0

tInitDef[3] = {}
tInitDef[3]["gbT"]="擦除WinZip使用痕迹"
tInitDef[3]["big5T"]="揽埃WinZipㄏノ勃格"
tInitDef[3]["enT"]="WinZip"
tInitDef[3]["Key"]=150200
tInitDef[3]["iNoMenu"]=1
tInitDef[3]["fInstalled"]="LuaInstalled3"
tInitDef[3]["fEraseOpt"]="LuaCleaner3"
tInitDef[3]["tEraseTable"]="tEraseTable"
tInitDef[3]["iRoot"]=5
tInitDef[3]["iSecond"]=2
tInitDef[3]["iThird"]=0

tInitDef[4] = {}
tInitDef[4]["gbT"]="擦除7ZIP使用痕迹"
tInitDef[4]["big5T"]="揽埃7ZIPㄏノ勃格"
tInitDef[4]["enT"]="7ZIP"
tInitDef[4]["Key"]=150300
tInitDef[4]["iNoMenu"]=1
tInitDef[4]["fInstalled"]="LuaInstalled4"
tInitDef[4]["fEraseOpt"]="LuaCleaner4"
tInitDef[4]["tEraseTable"]="tEraseTable"
tInitDef[4]["iRoot"]=5
tInitDef[4]["iSecond"]=3
tInitDef[4]["iThird"]=0

HKEY_CLASSES_ROOT = 0x80000000
HKEY_CURRENT_USER = 0x80000001
HKEY_LOCAL_MACHINE = 0x80000002
HKEY_USERS = 0x80000003

  require "wyzl"

function LuaInstalled0()
	local bInstalled = 1
	return bInstalled
end;

function LuaCleaner0()
	tEraseTable0 = {};
end;

function LuaInstalled()

	local bInstalled = 0
	strName = os.RegQueryValueEx(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\WinRAR.exe", "")
	if(strName ~= nil) then
		if(WYZL.GetDirFileExists(strName) == true) then
			bInstalled = 1
		end		
	end
	
	--require "vcl"
	--if(bInstalled) then
	--VCL.ShowMessage("test");
	--end
		
	return bInstalled
end;


function LuaCleaner()

	strTitle ="擦除WinRAR使用痕迹"
	if(WYZL.GetLanguage() == 2) then
		strTitle="揽埃WinRARㄏノ勃格"
	elseif(WYZL.GetLanguage() == 3) then
		strTitle="WinRAR"
	end

	WYZL.PlugReset();
	
	sKey = "HKEY_CURRENT_USER\\Software\\WinRAR";
	sKeyPara = "\\ArcHistory,\\DialogEditHistory,\\Favorites,\\Favorites";
	WYZL.AddRegItem("DelRegKeyList",sKey,sKeyPara);
	
	sKeyPara = "\\General,LastFolder\\r\\n";
	sKeyPara = sKeyPara .. "\\Compression,deffolder\\r\\n";
	sKeyPara = sKeyPara .. "\\Paths,startfolder\\r\\n";
	sKeyPara = sKeyPara .. "\\Extraction,lastfolder\\r\\n";
	sKeyPara = sKeyPara .. "\\Extraction,deffolder\\r\\n";
	sKeyPara = sKeyPara .. "\\ArcHistory,all\\r\\n";
	sKeyPara = sKeyPara .. "\\General,LastFolder\\r\\n";
	WYZL.AddRegItem("DelRegValueListEx",sKey,sKeyPara);
	
	sKey = "HKEY_CURRENT_USER\\Software";
	sKeyPara = "\\WinRAR SFX,all\\r\\n";
	WYZL.AddRegItem("DelRegValueListEx",sKey,sKeyPara);

	tEraseTable = {};
	os.RegDeleteKey(HKEY_CURRENT_USER,"Software\\WinRAR\\ArcHistory");
	os.RegDeleteKey(HKEY_CURRENT_USER,"Software\\WinRAR\\DialogEditHistory");
	os.RegDeleteKey(HKEY_CURRENT_USER,"Software\\WinRAR\\Favorites");
	os.RegDeleteValue(HKEY_CURRENT_USER,"Software\\WinRAR\\General","LastFolder");
		
	nReturn = 0;
	if(WYZL.IsLoaded() == 1) then
		nReturn = WYZL.DoPlugErase(strTitle,-1,0);
	end

end;

function LuaInstalled3()

	local bInstalled = 0
	
	bRet = os.RegKeyExists(HKEY_CURRENT_USER,"Software\\Nico Mak Computing\\WinZip");
	
	--require "vcl"
	
	if(bRet) then
	--VCL.ShowMessage("test");
		bInstalled = 1;
	end
	
	return bInstalled
end;

function LuaCleaner3()

	tEraseTable = {};
	os.RegDeleteValue(HKEY_CURRENT_USER,"Software\\Nico Mak Computing\\WinZip\\directories","AddDir");
	os.RegDeleteValue(HKEY_CURRENT_USER,"Software\\Nico Mak Computing\\WinZip\\directories","DefDir");
	os.RegDeleteValue(HKEY_CURRENT_USER,"Software\\Nico Mak Computing\\WinZip\\directories","ExtractTo");
	os.RegDeleteValue(HKEY_CURRENT_USER,"Software\\Nico Mak Computing\\WinZip\\directories","ZipTemp");
	os.RegDeleteKey(HKEY_CURRENT_USER,"Software\\Nico Mak Computing\\WinZip\\extract");
	os.RegDeleteKey(HKEY_CURRENT_USER,"Software\\Nico Mak Computing\\WinZip\\filemenu");
	os.RegDeleteKey(HKEY_CURRENT_USER,"Software\\Nico Mak Computing\\WinZip\\select");
	os.RegDeleteValue(HKEY_CURRENT_USER,"Software\\Nico Mak Computing\\WinZip\\Programs","vviewer");
	os.RegDeleteKey(HKEY_CURRENT_USER,"Software\\Nico Mak Computing\\WinZip\\viewer");
	os.RegDeleteKey(HKEY_CURRENT_USER,"Software\\Nico Mak Computing\\WinZip\\WIZDIR");

end;

function LuaInstalled4()

	local bInstalled = 0
	strName = os.RegQueryValueEx(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\7zFM.exe", "")
	if(strName ~= nil) then
		if(WYZL.GetDirFileExists(strName) == true) then
			bInstalled = 1
		end		
	end
	return bInstalled
end;

function LuaCleaner4()

	strTitle ="擦除7-ZIP使用痕迹"
	if(WYZL.GetLanguage() == 2) then
		strTitle="揽埃7-ZIPㄏノ勃格"
	elseif(WYZL.GetLanguage() == 3) then
		strTitle="7-ZIP"
	end

	WYZL.PlugReset();
	
	--require "vcl"
	--VCL.ShowMessage(strTitle);
	
	sKey = "HKEY_CURRENT_USER\\Software\\7-ZIP";
	
	sKeyPara = "\\Compression\\ArcHistory,\\Extraction\\PathHistory,\\Compression\\Options";
	WYZL.AddRegItem("DelRegKeyList",sKey,sKeyPara);
	
	sKeyPara = "\\FM,CopyHistory,FolderHistory,PanelPath*\\r\\n";
	sKeyPara = sKeyPara .. "\\Compression,Archiver\\r\\n";
	sKeyPara = sKeyPara .. "\\Compression\\ArcHistory,all\\r\\n";
	sKeyPara = sKeyPara .. "\\FM\\Columns,all";
	WYZL.AddRegItem("DelRegValueListEx",sKey,sKeyPara);

	nReturn = 0;
	if(WYZL.IsLoaded() == 1) then
		nReturn = WYZL.DoPlugErase(strTitle,-1,0);
		
		--VCL.ShowMessage("結束");
	end
	
end;