-------------------------------
--一些计算机安全的基本设置
--
-------------------------------

tInitDef = {}

tInitDef[1] = {}
tInitDef[1]["gbT"]="禁止建立空连接"
tInitDef[1]["big5T"]="窽ゎミ硈钡"
tInitDef[1]["enT"]="Prohibits the establishment of air link"
tInitDef[1]["Key"]=100001
tInitDef[1]["fGetState"]="GetSettingState"
tInitDef[1]["fSetState"]="SetSettingState"

tInitDef[2] = {}
tInitDef[2]["gbT"]="关闭445端口"
tInitDef[2]["big5T"]="闽超445狠"
tInitDef[2]["enT"]="Close Port 445"
tInitDef[2]["Key"]=100002
tInitDef[2]["fGetState"]="GetSettingState"
tInitDef[2]["fSetState"]="SetSettingState"

tInitDef[3] = {}
tInitDef[3]["gbT"]="禁止远程修改注册表"
tInitDef[3]["big5T"]="窽ゎ环祘э猔"
tInitDef[3]["enT"]="Remote modify the registry to prohibit"
tInitDef[3]["Key"]=100003
tInitDef[3]["fGetState"]="GetSettingState"
tInitDef[3]["fSetState"]="SetSettingState"

tInitDef[4] = {}
tInitDef[4]["gbT"]="禁止系统默认管理共享"
tInitDef[4]["big5T"]="窽ゎ╰参纐粄恨瞶ㄉ"
tInitDef[4]["enT"]="Prevents the system from the default administrative shares"
tInitDef[4]["Key"]=100004
tInitDef[4]["fGetState"]="GetSettingState"
tInitDef[4]["fSetState"]="SetSettingState"

tInitDef[5] = {}
tInitDef[5]["gbT"]="禁止IE中自动完成Web地址"
tInitDef[5]["big5T"]="窽ゎIEい笆ЧΘWeb"
tInitDef[5]["enT"]="Prohibition of IE auto-complete Web addresses in"
tInitDef[5]["Key"]=100005
tInitDef[5]["fGetState"]="GetSettingState"
tInitDef[5]["fSetState"]="SetSettingState"

tInitDef[6] = {}
tInitDef[6]["gbT"]="禁止IE中自动完成表单功能"
tInitDef[6]["big5T"]="窽ゎIEい笆ЧΘ虫"
tInitDef[6]["enT"]="Prohibition of IE in the auto-complete forms feature"
tInitDef[6]["Key"]=100006
tInitDef[6]["fGetState"]="GetSettingState"
tInitDef[6]["fSetState"]="SetSettingState"

tInitDef[7] = {}
tInitDef[7]["gbT"]="禁止IE中自动完成表单的用户名和密码"
tInitDef[7]["big5T"]="窽ゎIEい笆ЧΘ虫ノめ㎝盞絏"
tInitDef[7]["enT"]="Prohibit IE auto-complete forms for user name and password"
tInitDef[7]["Key"]=100007
tInitDef[7]["fGetState"]="GetSettingState"
tInitDef[7]["fSetState"]="SetSettingState"

tInitDef[8] = {}
tInitDef[8]["gbT"]="禁止密码缓存"
tInitDef[8]["big5T"]="窽ゎ盞絏絯"
tInitDef[8]["enT"]="Prohibition password cach"
tInitDef[8]["Key"]=100008
tInitDef[8]["fGetState"]="GetSettingState"
tInitDef[8]["fSetState"]="SetSettingState"

tInitDef[9] = {}
--tInitDef[9]["gbT"]="关机时擦除系统的页面文件"
--tInitDef[9]["big5T"]="闽诀揽埃╰参ゅン"
--tInitDef[9]["enT"]="Shutdown erase the system page file"
--tInitDef[9]["Key"]=100009
--tInitDef[9]["fGetState"]="GetSettingState"
--tInitDef[9]["fSetState"]="SetSettingState"

tInitDef[10] = {}
tInitDef[10]["gbT"]="禁止Dr.Watson调试程序"
tInitDef[10]["big5T"]="窽ゎDr.Watson秸刚祘"
tInitDef[10]["enT"]="Prohibition Dr.Watson debugger"
tInitDef[10]["Key"]=100010
tInitDef[10]["fGetState"]="GetSettingState"
tInitDef[10]["fSetState"]="SetSettingState"

tInitDef[11] = {}
tInitDef[11]["gbT"]="禁止系统产生Thumbs.db文件"
tInitDef[11]["big5T"]="窽ゎ╰参玻ネThumbs.dbゅン"
tInitDef[11]["enT"]="Prohibit the system to produce Thumbs.db file"
tInitDef[11]["Key"]=100011
tInitDef[11]["fGetState"]="GetSettingState"
tInitDef[11]["fSetState"]="SetSettingState"

tInitDef[12] = {}
tInitDef[12]["gbT"]="禁止系统记录使用历史功能"
tInitDef[12]["big5T"]="窽ゎ╰参癘魁ㄏノ菌"
tInitDef[12]["enT"]="Prohibit the system historical function"
tInitDef[12]["Key"]=100012
tInitDef[12]["fGetState"]="GetSettingState"
tInitDef[12]["fSetState"]="SetSettingState"

tInitDef[13] = {}
tInitDef[13]["gbT"]="禁止最近访问文件列表功能"
tInitDef[13]["big5T"]="窽ゎ程砐拜ゅン"
tInitDef[13]["enT"]="Prohibit the recent visited file list function"
tInitDef[13]["Key"]=100013
tInitDef[13]["fGetState"]="GetSettingState"
tInitDef[13]["fSetState"]="SetSettingState"

tInitDef[14] = {}
tInitDef[14]["gbT"]="隐藏NTFS文件的使用时间"
tInitDef[14]["big5T"]="留旅NTFSゅンㄏノ丁"
tInitDef[14]["enT"]="Hidden NTFS file usage time"
tInitDef[14]["Key"]=100014
tInitDef[14]["fGetState"]="GetSettingState"
tInitDef[14]["fSetState"]="SetSettingState"

tInitDef[15] = {}
tInitDef[15]["gbT"]="禁止DumpFile的产生"
tInitDef[15]["big5T"]="窽ゎDumpFile玻ネ"
tInitDef[15]["enT"]="Prohibit the production DumpFile"
tInitDef[15]["Key"]=100015
tInitDef[15]["fGetState"]="GetSettingState"
tInitDef[15]["fSetState"]="SetSettingState"

tInitDef[16] = {}
tInitDef[16]["gbT"]="禁用XP系统的自动播放"
tInitDef[16]["big5T"]="窽ノXP╰参笆冀"
tInitDef[16]["enT"]="Disable XP System Autoplay"
tInitDef[16]["Key"]=100016
tInitDef[16]["fGetState"]="GetSettingState"
tInitDef[16]["fSetState"]="SetSettingState"

tInitDef[17] = {}
tInitDef[17]["gbT"]="锁定自动运行的MountPoints2子键"
tInitDef[17]["big5T"]="玛﹚笆笲︽MountPoints2龄"
tInitDef[17]["enT"]="Lock the MountPoints2 Automatical subkey"
tInitDef[17]["Key"]=100017
tInitDef[17]["fGetState"]="GetSettingState"
tInitDef[17]["fSetState"]="SetSettingState"

tInitDef[18] = {}
tInitDef[18]["gbT"]="禁止系统通知区域写该注册表子键权限"
tInitDef[18]["big5T"]="窽ゎ╰参硄跋办糶赣猔龄舦"
tInitDef[18]["enT"]="Prevents the system notification area to write registry subkey"
tInitDef[18]["Key"]=100018
tInitDef[18]["fGetState"]="GetSettingState"
tInitDef[18]["fSetState"]="SetSettingState"

tInitDef[19] = {}
tInitDef[19]["gbT"]="锁定系统菜单排序记录"
tInitDef[19]["big5T"]="玛﹚╰参垫虫逼癘魁"
tInitDef[19]["enT"]="Locking system menu to sort records"
tInitDef[19]["Key"]=100019
tInitDef[19]["fGetState"]="GetSettingState"
tInitDef[19]["fSetState"]="SetSettingState"

tInitDef[20] = {}
tInitDef[20]["gbT"]="锁定文件查找记录"
tInitDef[20]["big5T"]="玛﹚ゅン琩т癘魁"
tInitDef[20]["enT"]="Lock the Find-files Record"
tInitDef[20]["Key"]=100020
tInitDef[20]["fGetState"]="GetSettingState"
tInitDef[20]["fSetState"]="SetSettingState"

tInitDef[21] = {}
tInitDef[21]["gbT"]="关闭DOS虚拟机"
tInitDef[21]["big5T"]="闽超DOS店览诀"
tInitDef[21]["enT"]="Close Dos VDM"
tInitDef[21]["Key"]=100021
tInitDef[21]["fGetState"]="GetSettingState"
tInitDef[21]["fSetState"]="SetSettingState"


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

require "wyzl"
require "vcl"

function GetSettingState(iSetOpt)
	local bState = 0
	
	if(iSetOpt == 100001) then -- 禁止建立空连接
		bReturn,dwValue = WYZL.RegReadDword(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\Lsa","RestrictAnonymous", 0);
		--VCL.ShowMessage(tostring(bReturn) .. "test" .. tostring(dwValue));
		if(bReturn == 1) then
			if(dwValue ==1) then
				bState = 1;
				--VCL.ShowMessage("test");
			end
		end
	
	elseif(iSetOpt == 100002) then -- 关闭445端口
		bReturn,dwValue = WYZL.RegReadDword(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\NetBT\\Parameters","SMBDeviceEnabled", 1);
		if(bReturn == 1) then
			if(dwValue ==0) then
				bState = 1;
				--VCL.ShowMessage("test");
			end
		end
	
	elseif(iSetOpt == 100003) then -- 禁止远程修改注册表
		bReturn,dwValue = WYZL.RegReadDword(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\SecurePipeServers\\winreg","RemoteRegAccess", 0);
		if(bReturn == 1) then
			if(dwValue ==1) then
				bState = 1;
				--VCL.ShowMessage("test");
			end
		end
	
	elseif(iSetOpt == 100004) then -- 禁止系统默认管理共享
		bReturn,dwValue = WYZL.RegReadDword(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\lanmanserver\\parameters","AutoShareServer", 1);
		bReturn2,dwValue2 = WYZL.RegReadDword(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\lanmanserver\\parameters","AutoShareWks", 1);
		if(bReturn == 1 and bReturn2 == 1) then
			if(dwValue ==0 and dwValue2 == 0) then
				bState = 1;
				--VCL.ShowMessage("test");
			end
		end
	
	elseif(iSetOpt == 100005) then -- 禁止IE中自动完成Web地址
		bReturn,sValue = WYZL.RegReadString(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\AutoComplete","AutoSuggest", "yes");
		if(bReturn == 1) then
			if(sValue == "no") then
				bState = 1;
				--VCL.ShowMessage("test100005");
			end
		end
	
	elseif(iSetOpt == 100006) then --禁止IE中自动完成表单功能
		bReturn,sValue = WYZL.RegReadString(HKEY_CURRENT_USER,"Software\\Microsoft\\Internet Explorer\\Main","Use FormSuggest", "yes");
		if(bReturn == 1) then
			if(sValue == "no") then
				bState = 1;
				--VCL.ShowMessage("test100006");
			end
		end
	
	elseif(iSetOpt == 100007) then -- 禁止IE中自动完成表单的用户名和密码
		bReturn,sValue = WYZL.RegReadString(HKEY_CURRENT_USER,"Software\\Microsoft\\Internet Explorer\\Main","FormSuggest Passwords", "yes");
		if(bReturn == 1) then
			if(sValue == "no") then
				bState = 1;
				--VCL.ShowMessage("test100007");
			end
		end
	
	elseif(iSetOpt == 100008) then -- 禁止密码缓存
		bReturn,dwValue = WYZL.RegReadDword(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\policies\\network","DisablePwdCaching", 0);
		if(bReturn == 1) then
			if(dwValue ==1) then
				bState = 1;
				--VCL.ShowMessage("test");
			end
		end
	
	elseif(iSetOpt == 100009) then -- 关机时擦除系统的页面文件
		bReturn,dwValue = WYZL.RegReadDword(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management","ClearPageFileAtShutdown", 0);
		if(bReturn == 1) then
			if(dwValue ==1) then
				bState = 1;
				--VCL.ShowMessage("test");
			end
		end
	
	elseif(iSetOpt == 100010) then -- 禁止Dr. Watson调试程序
		bReturn,dwValue = WYZL.RegReadDword(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug","Auto", 1);
		if(bReturn == 1) then
			if(dwValue ==0) then
				bState = 1;
				--VCL.ShowMessage("test");
			end
		end
	
	elseif(iSetOpt == 100011) then -- 禁止系统产生Thumbs.db文件
		bReturn,dwValue = WYZL.RegReadDword(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced","DisableThumbnailCache", 0);
		if(bReturn == 1) then
			if(dwValue ==1) then
				bState = 1;
				--VCL.ShowMessage("test");
			end
		end
	
	elseif(iSetOpt == 100012) then -- 禁止系统记录使用历史功能
		bReturn,dwValue = WYZL.RegReadDword(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer","NoRecentDocsHistory", 0);
		if(bReturn == 1) then
			if(dwValue ==1) then
				bState = 1;
				--VCL.ShowMessage("test");
			end
		end
	
	elseif(iSetOpt == 100013) then -- 禁止最近访问文件列表功能
		bReturn,dwValue = WYZL.RegReadDword(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\ComDlg32","NoFileMru", 0);
		if(bReturn == 1) then
			if(dwValue ==1) then
				bState = 1;
				--VCL.ShowMessage("test");
			end
		end
	
	elseif(iSetOpt == 100014) then -- 隐藏文件的使用时间
		bReturn,dwValue = WYZL.RegReadDword(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\FileSystem","NtfsDisableLastAccessUpdate", 0);
		if(bReturn == 1) then
			if(dwValue ==1) then
				bState = 1;
				--VCL.ShowMessage("test");
			end
		end
	
	elseif(iSetOpt == 100015) then -- 禁止Dump File的产生
		bState = 1;
		bReturn,dwValue = WYZL.RegReadDword(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\CrashControl","CrashDumpEnabled", 2);
		if(bReturn == 1) then
			if(dwValue ==2) then
				bState = 0;
				--VCL.ShowMessage("test");
			end
		end
		bReturn2,dwValue2 = WYZL.RegReadDword(HKEY_LOCAL_MACHINE,"SYSTEM\\ControlSet001\\Control\\CrashControl","CrashDumpEnabled", 2);
		if(bReturn2 == 1) then
			if(dwValue2 ==2) then
				bState = 0;
				--VCL.ShowMessage("test");
			end
		end
	
	elseif(iSetOpt == 100016) then -- 禁用XP系统的自动播放
		bReturn,dwValue = WYZL.RegReadDword(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer","NoDriveTypeAutoRun", 145);
		if(bReturn == 1) then
			if(dwValue ==255) then
				bState = 1;
				--VCL.ShowMessage("test");
			end
		end
	
	elseif(iSetOpt == 100017) then -- 锁定自动运行的MountPoints2子键
		--sMsg = string.format("%ssubinacl.exe /subkeyreg HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MountPoints2 /deny=%s=SC /deny=everyone=SC",WYZL.GetAppDir(),sUserName);
		--VCL.ShowMessage(sMsg);
		bReturn,dwValue = WYZL.RegReadDword(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MountPoints2","", 0);
		if(bReturn == 1) then
				bState = 0;
				--VCL.ShowMessage("test");
	  else
	      bState = 1;
		end
	
	elseif(iSetOpt == 100018) then -- 禁止系统通知区域写该注册表子键权限
	  sKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\TrayNotify";
		bReturn,sValue = WYZL.RegReadString(HKEY_CURRENT_USER,sKey,"test", "");
		if(bReturn == 1) then
		  bReturn2 = WYZL.RegWriteString(HKEY_CURRENT_USER,sKey,"test", "");
			if(bReturn2 ==1) then
				WYZL.RegDeleteValue(HKEY_CURRENT_USER,sKey,"test");
				bState = 0;
				--VCL.ShowMessage("test");
			else
				bState = 1;
			end
		else
			bState = 1;
		end
	
	elseif(iSetOpt == 100019) then -- 锁定系统菜单排序记录
	  sKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MenuOrder";
		bReturn,sValue = WYZL.RegReadString(HKEY_CURRENT_USER,sKey,"test", "");
		if(bReturn == 1) then
		  bReturn2 = WYZL.RegWriteString(HKEY_CURRENT_USER,sKey,"test", "");
			if(bReturn2 ==1) then
				WYZL.RegDeleteValue(HKEY_CURRENT_USER,sKey,"test");
				bState = 0;
				--VCL.ShowMessage("test");
			else
				bState = 1;
			end
		else
			bState = 1;
		end
	
	elseif(iSetOpt == 100020) then -- 锁定文件查找记录
	  sKey = "Software\\Microsoft\\Search Assistant\\ACMru\\5603";
		bReturn = WYZL.RegSetKey(HKEY_CURRENT_USER,sKey,0);
		if(bReturn == 1) then
		  bReturn2 = WYZL.RegWriteString(HKEY_CURRENT_USER,sKey,"test", "");
			if(bReturn2 ==1) then
				WYZL.RegDeleteValue(HKEY_CURRENT_USER,sKey,"test");
				bState = 0;
				--VCL.ShowMessage("test100020-0");
			else
				--VCL.ShowMessage("test100020-1");
				bState = 1;
			end
		else
			--VCL.ShowMessage("test100020-2");
			bState = 1;
		end
		
	elseif(iSetOpt == 100021) then -- 关闭DOS虚拟机
		bReturn,dwValue = WYZL.RegReadDword(HKEY_LOCAL_MACHINE,"SOFTWARE\\Policies\\Microsoft\\Windows\\AppCompat","VDMDisallowed", 0);
		if(bReturn == 1) then
				if(dwValue == 1) then
					bState = 1;
				else 
					bState = 0;
				end
				--VCL.ShowMessage("test");
	  else
	      bState = 0;
		end
		
		if(bState == 1) then
			bReturn,dwValue = WYZL.RegReadDword(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\WOW","DisallowedPolicyDefault", 0);
			if(bReturn == 1) then
					if(dwValue == 1) then
						bState = 1;
					else 
						bState = 0;
					end
					--VCL.ShowMessage("test");
		  else
		      bState = 0;
			end
		end
	end
	
	return bState;
end;

function SetSettingState(iSetOpt,nCheck)
	local bState = 1
	
	local nValue = 0;
	local sValue = "";
	
	sUserName = WYZL.GetUserName();
	if(sUserName == nil) then
		sUserName = "Administrator";
	end
	
	if(iSetOpt == 100001) then -- 禁止建立空连接
	  if(nCheck == 1) then
	  	nValue = 1;
	  else
	  	nValue = 0;
	  end 
		bReturn = WYZL.RegWriteDword(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\Lsa","RestrictAnonymous", nValue);
		--VCL.ShowMessage(tostring(bReturn) .. "test");
	
	elseif(iSetOpt == 100002) then -- 关闭445端口
	  if(nCheck == 1) then
	  	nValue = 0;
	  else
	  	nValue = 1;
	  end 
		bReturn = WYZL.RegWriteDword(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\NetBT\\Parameters","SMBDeviceEnabled", nValue);
	
	elseif(iSetOpt == 100003) then -- 禁止远程修改注册表
	  if(nCheck == 1) then
	  	nValue = 1;
	  else
	  	nValue = 0;
	  end 
		bReturn = WYZL.RegWriteDword(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\SecurePipeServers\\winreg","RemoteRegAccess", nCheck);
	
	elseif(iSetOpt == 100004) then -- 禁止系统默认管理共享
	  if(nCheck == 1) then
	  	nValue = 0;
	  else
	  	nValue = 1;
	  end 
		bReturn = WYZL.RegWriteDword(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\lanmanserver\\parameters","AutoShareServer", nValue);
		bReturn2 = WYZL.RegWriteDword(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\lanmanserver\\parameters","AutoShareWks", nValue);
	
	elseif(iSetOpt == 100005) then -- 禁止IE中自动完成Web地址
	  if(nCheck == 1) then
	  	sValue = "no";
	  else
	  	sValue = "yes";
	  end 
	  --VCL.ShowMessage(sValue);
		bReturn = WYZL.RegWriteString(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\AutoComplete","AutoSuggest", sValue);
	
	elseif(iSetOpt == 100006) then -- 禁止IE中自动完成表单功能
	  if(nCheck == 1) then
	  	sValue = "no";
	  else
	  	sValue = "yes";
	  end 
		bReturn = WYZL.RegWriteString(HKEY_CURRENT_USER,"Software\\Microsoft\\Internet Explorer\\Main","Use FormSuggest", sValue);
	
	elseif(iSetOpt == 100007) then -- 禁止IE中自动完成表单的用户名和密码
	  if(nCheck == 1) then
	  	sValue = "no";
	  else
	  	sValue = "yes";
	  end 
		bReturn = WYZL.RegWriteString(HKEY_CURRENT_USER,"Software\\Microsoft\\Internet Explorer\\Main","FormSuggest Passwords", sValue);
	
	elseif(iSetOpt == 100008) then -- 禁止密码缓存
	  if(nCheck == 1) then
	  	nValue = 1;
	  else
	  	nValue = 0;
	  end 
		bReturn = WYZL.RegWriteDword(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\policies\\network","DisablePwdCaching", nValue);
	
	elseif(iSetOpt == 100009) then -- 关机时擦除系统的页面文件
	  if(nCheck == 1) then
	  	nValue = 1;
	  else
	  	nValue = 0;
	  end 
		bReturn = WYZL.RegWriteDword(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management","ClearPageFileAtShutdown", nValue);
	
	elseif(iSetOpt == 100010) then -- 禁止Dr. Watson调试程序
	  if(nCheck == 1) then
	  	nValue = 0;
	  else
	  	nValue = 1;
	  end 
		bReturn = WYZL.RegWriteDword(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug","Auto", nValue);
	
	elseif(iSetOpt == 100011) then -- 禁止系统产生Thumbs.db文件
	  if(nCheck == 1) then
	  	nValue = 1;
	  else
	  	nValue = 0;
	  end 
		bReturn = WYZL.RegWriteDword(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced","DisableThumbnailCache", nValue);
	
	elseif(iSetOpt == 100012) then -- 禁止系统记录使用历史功能
	  if(nCheck == 1) then
	  	nValue = 1;
	  else
	  	nValue = 0;
	  end 
		bReturn = WYZL.RegWriteDword(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer","NoRecentDocsHistory", nValue);
	
	elseif(iSetOpt == 100013) then -- 禁止最近访问文件列表功能
	  if(nCheck == 1) then
	  	nValue = 1;
	  else
	  	nValue = 0;
	  end 
		bReturn = WYZL.RegWriteDword(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\ComDlg32","NoFileMru", nValue);
	
	elseif(iSetOpt == 100014) then -- 隐藏文件的使用时间
	  if(nCheck == 1) then
	  	nValue = 1;
	  else
	  	nValue = 0;
	  end 
		bReturn = WYZL.RegWriteDword(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\FileSystem","NtfsDisableLastAccessUpdate", nValue);
	elseif(iSetOpt == 100015) then -- 禁止Dump File的产生
	  if(nCheck == 1) then
	  	nValue = 0;
	  else
	  	nValue = 2;
	  end 
		bReturn = WYZL.RegWriteDword(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\CrashControl","CrashDumpEnabled", nValue);
		bReturn2 = WYZL.RegWriteDword(HKEY_LOCAL_MACHINE,"SYSTEM\\ControlSet001\\Control\\CrashControl","CrashDumpEnabled", nValue);
	
	elseif(iSetOpt == 100016) then -- 禁用XP系统的自动播放
	  if(nCheck == 1) then
	  	nValue = 255;
	  else
	  	nValue = 145;
	  end 
		bReturn,dwValue = WYZL.RegWriteDword(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer","NoDriveTypeAutoRun", nValue);
	
	elseif(iSetOpt == 100017) then -- 锁定自动运行的MountPoints2子键
		sKey2 = "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MountPoints2";
		if(nCheck == 1) then
	  	sValue = string.format("%ssubinacl.exe /subkeyreg %s /deny=%s=SC /deny=everyone=SC",WYZL.GetAppDir(),sKey2,sUserName);
		  --VCL.ShowMessage(sValue);
	  else
	  	sValue = string.format("%ssubinacl.exe /subkeyreg %s /Grant=%s=f /Grant=everyone=f",WYZL.GetAppDir(),sKey2,sUserName);
	  end 
	  
		WYZL.WinExec(sValue, 0);
		WYZL.Sleep(500);
	
	elseif(iSetOpt == 100018) then -- 禁止系统通知区域写该注册表子键权限
	  sKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\TrayNotify";
	  sKey2="HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\TrayNotify";
	  if(nCheck == 1) then
	  	WYZL.RegDeleteValue(HKEY_CURRENT_USER,sKey,"IconStreams");
	  	WYZL.RegDeleteValue(HKEY_CURRENT_USER,sKey,"PastIconsStream");
			sValue = string.format("%ssubinacl.exe /subkeyreg %s /deny=%s=SC /deny=everyone=SC",WYZL.GetAppDir(),sKey2,sUserName);
	  else
			sValue = string.format("%ssubinacl.exe /subkeyreg %s /Grant=%s=f /Grant=everyone=f",WYZL.GetAppDir(),sKey2,sUserName);
	  end
	  
		WYZL.WinExec(sValue, 0);
		WYZL.Sleep(500);
	
	elseif(iSetOpt == 100019) then -- 锁定系统菜单排序记录
	  sKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MenuOrder";
	  sKey2 = "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MenuOrder";
		if(nCheck == 1) then
	  	sValue = string.format("%ssubinacl.exe /subkeyreg %s /deny=%s=SC /deny=everyone=SC",WYZL.GetAppDir(),sKey2,sUserName);
		  --VCL.ShowMessage(sValue);
	  else
	  	sValue = string.format("%ssubinacl.exe /subkeyreg %s /Grant=%s=f /Grant=everyone=f",WYZL.GetAppDir(),sKey2,sUserName);
	  end 
	  
		WYZL.WinExec(sValue, 0);
		WYZL.Sleep(500);
	
	elseif(iSetOpt == 100020) then -- 锁定文件查找记录
	  sKey = "Software\\Microsoft\\Search Assistant\\ACMru\\5603";
	  sKey2 = "HKEY_CURRENT_USER\\Software\\Microsoft\\Search Assistant\\ACMru\\5603";
	  WYZL.RegSetKey(HKEY_CURRENT_USER,sKey,1);
		if(nCheck == 1) then
	  	sValue = string.format("%ssubinacl.exe /subkeyreg \"%s\" /deny=%s=SC  /deny=everyone=SC",WYZL.GetAppDir(),sKey2,sUserName);
	  else
	  	sValue = string.format("%ssubinacl.exe /subkeyreg \"%s\" /Grant=%s=f /Grant=everyone=f",WYZL.GetAppDir(),sKey2,sUserName);
	  end 
		  --VCL.ShowMessage(sValue);
	  
		WYZL.WinExec(sValue, 0);
		WYZL.Sleep(500);
		
	elseif(iSetOpt == 100021) then -- 关闭DOS虚拟机
	  if(nCheck == 1) then
	  	nValue = 1;
	  else
	  	nValue = 0;
	  end 
		bReturn = WYZL.RegWriteDword(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Control\\WOW","DisallowedPolicyDefault", nValue);
		bReturn = WYZL.RegWriteDword(HKEY_LOCAL_MACHINE,"SOFTWARE\\Policies\\Microsoft\\Windows\\AppCompat","VDMDisallowed", nValue);
	end
	
	return bState
end;
