设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1711|回复: 1
打印 上一主题 下一主题

[已经解决] 有关屏蔽F12重启问题

[复制链接]

Lv4.逐梦者

梦石
0
星屑
19284
在线时间
3074 小时
注册时间
2013-1-11
帖子
1288
跳转到指定楼层
1
发表于 2017-7-11 22:08:35 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
搜了一下论坛,好像没发现有关VX屏蔽F12的资料。。
求屏蔽F12的方法,或者exe、dll

Lv4.逐梦者

送快递的水表员

梦石
10
星屑
4792
在线时间
3303 小时
注册时间
2012-6-27
帖子
7160

开拓者贵宾

来自 2楼
发表于 2017-7-11 22:43:51 | 只看该作者
https://rpg.blue/forum.php?mod=viewthread&tid=393909
——来自水区某触手的黑科技
只弄F12的话这么设置脚本,插入到Main前。

  1. unless defined?(KeyFusion)  
  2.   #--------------------------------------------------------------------------
  3.   # ● 紫苏前辈的获取窗口句柄
  4.   #    部分细节已修改
  5.   #--------------------------------------------------------------------------
  6.   module Kernel
  7.     #--------------------------------------------------------------------------
  8.     # ● 需要的 Windows API 函数
  9.     #--------------------------------------------------------------------------
  10.     GetWindowThreadProcessId = Win32API.new("user32", "GetWindowThreadProcessId", "LP", "L")
  11.     GetWindow = Win32API.new("user32", "GetWindow", "LL", "L")
  12.     GetClassName = Win32API.new("user32", "GetClassName", "LPL", "L")
  13.     GetCurrentThreadId = Win32API.new("kernel32", "GetCurrentThreadId", "V", "L")
  14.     GetForegroundWindow = Win32API.new("user32", "GetForegroundWindow", "V", "L")
  15.     #--------------------------------------------------------------------------
  16.     # ● 获取窗口句柄
  17.     #--------------------------------------------------------------------------
  18.     def hwnd
  19.       # 获取调用线程(RM 的主线程)的进程标识
  20.       threadID = GetCurrentThreadId.call
  21.       # 获取 Z 次序中最靠前的窗口
  22.       hWnd = GetWindow.call(GetForegroundWindow.call, 0)
  23.       # 枚举所有窗口
  24.       while hWnd != 0
  25.         # 如果创建该窗口的线程标识匹配本线程标识
  26.         if threadID == GetWindowThreadProcessId.call(hWnd, 0)
  27.           # 分配一个 11 个字节的缓冲区
  28.           className = " " * 12                         # ●
  29.           # 获取该窗口的类名
  30.           GetClassName.call(hWnd, className, 12)       # ●
  31.           # 如果匹配 RGSS Player 则跳出循环
  32.           break if className[0, 11] == "RGSS Player"
  33.         end
  34.         # 获取下一个窗口
  35.         hWnd = GetWindow.call(hWnd, 2)
  36.       end
  37.       return hWnd
  38.     end
  39.   end
  40.   #--------------------------------------------------------------------------
  41.   # ● KeyFusion主要模块
  42.   #    晴兰,保留所有权利
  43.   #--------------------------------------------------------------------------

  44.   module KeyFusion
  45.     module SAFX
  46.       extend self
  47.       private
  48.       def defapi(a, b)
  49.         a, b = a.to_s, b.to_s
  50.         define_method b do |*args|
  51.           Win32API.new(a, b, args.map{"L"}, "L").call(*args.map{|x| ptr(x)})
  52.         end
  53.         private b
  54.       end

  55.       def ptr(a)
  56.         case a
  57.         when Integer then a
  58.         when String  then [a].pack("p").unpack("L").first
  59.         end
  60.       end

  61.       {
  62.         :Kernel32 => %w{RtlMoveMemory LoadLibrary GetProcAddress VirtualProtect GlobalAlloc GlobalFree},
  63.         :User32   => %w{SendMessage}
  64.       }.each{|k, v|
  65.         v.each{|x|
  66.            defapi k, x
  67.         }
  68.       }

  69.       def readmem(a, b)
  70.         buf = "\0" * b
  71.         RtlMoveMemory buf, ptr(a), b
  72.         buf
  73.       end

  74.       def writemem(a, b, c)
  75.         RtlMoveMemory ptr(a), c, b
  76.       end

  77.       def funcaddr(a, b)
  78.         GetProcAddress(LoadLibrary(a + "\0"), b + "\0")
  79.       end

  80.       def malloc(n)
  81.         GlobalAlloc 0, n
  82.       end

  83.       def free(ptr)
  84.         GlobalFree ptr
  85.       end

  86.       def sendMsg(h, m, w, l)
  87.         SendMessage h, m, w, l
  88.       end

  89.       def code(*c)
  90.         c.inject([]){|a, b|
  91.           b.to_s(16)
  92.           if b >= -256 && b <= 256
  93.             a + [b % 256]
  94.           else
  95.             a + [b].pack("L").unpack("C*")            
  96.           end
  97.         }.pack("C*")
  98.       end

  99.       def getpriv(addr, len)
  100.         VirtualProtect addr, len, 0x40, "RGBA"
  101.       end


  102.       class FuncHook
  103.         include SAFX
  104.         def initialize(addr)
  105.           @codeaddr    = malloc 10
  106.           @old         = addr
  107.           @tramp       = code 0x55, 0x8b, 0xec, 0xe9, (@old + 5) - (@codeaddr + 8)
  108.           writemem @codeaddr, @tramp.length, @tramp
  109.           @newcode     = yield @codeaddr
  110.           @newaddr     = ptr(@newcode)
  111.           getpriv addr, 5
  112.           writemem addr, 5, code(0xe9, (@newaddr - (@old + 5)))
  113.         end
  114.       end

  115.       class MsgHook
  116.         include SAFX
  117.         extend SAFX
  118.         defapi 'user32', 'SetWindowsHookEx'
  119.         defapi 'kernel32', 'GetCurrentThreadId'
  120.         defapi 'user32', 'GetWindowLong'
  121.         defapi 'user32', 'SetWindowLong'
  122.         WH_GETMESSAGE = 3
  123.         def initialize
  124.           thehwnd   = hwnd
  125.           u      = funcaddr 'user32', 'CallWindowProcA'
  126.           @old   = GetWindowLong thehwnd, -4
  127.           [url=home.php?mod=space&uid=10413]@code[/url]  = yield @old, u
  128.           SetWindowLong thehwnd, -4, @code
  129.         end
  130.       end
  131.     end

  132.     extend SAFX

  133.     KEY_ENABLE              = 0
  134.     KEY_DISABLE             = 1
  135.     KEY_PRESSONCE_ENABLE    = 2
  136.     KEY_PRESSONCE_DISABLE   = 3
  137.     KEY_PRESSALWAYS         = 4


  138.     KeyTable     = malloc 256
  139.     writemem KeyTable, 256, "\0"*256
  140.     GKS          = funcaddr('user32', 'GetKeyState')
  141.     KeyHook = SAFX::FuncHook.new(GKS) do |origin|
  142.       code 0x55, 0x8b, 0xec,
  143.            0xba, KeyTable,
  144.            0x8b, 0105, 0x8,
  145.            0x33, 0311,
  146.            0x8a, 0014, 0002,
  147.            0x83, 0371, KEY_PRESSALWAYS, 0x75, 9,  0xb8, 0x8000, 0xc9, 0xc2, 0x4, 0x00,
  148.            0x83, 0371, KEY_DISABLE,     0x75, 6,  0x31, 0xc0, 0xc9, 0xc2, 0x4, 0x00,
  149.            0x83, 0371, KEY_ENABLE,      0x75, 14, 0xff, 0165, 0x8, 0xb8, origin, 0xff, 0320, 0xc9, 0xc2, 0x4, 0x00,
  150.            0x83, 0371, KEY_PRESSONCE_ENABLE,
  151.            0x75, 16, 0xc7, 0004, 0002, 0,0,0,0, 0xb8, 0x8000, 0xc9,0xc2,0x4, 0x00,
  152.            0x83, 0371, KEY_PRESSONCE_DISABLE,
  153.            0x75, 16, 0xc7, 0004, 0002, 1,0,0,0, 0xb8, 0x8000, 0xc9,0xc2,0x4, 0x00,
  154.            0x33, 0300, 0xc9,0xc2, 0x4, 0x00
  155.   end
  156.     GAKS   = funcaddr('user32', 'GetAsyncKeyState')
  157.     AKeyHook = SAFX::FuncHook.new(GAKS) do |origin|
  158.       code 0x55, 0x8b, 0xec,
  159.            0xba, KeyTable,
  160.            0x8b, 0105, 0x8,
  161.            0x33, 0311,
  162.            0x8a, 0014, 0002,
  163.            0x83, 0371, KEY_PRESSALWAYS, 0x75, 9,  0xb8, 0x8000, 0xc9, 0xc2, 0x4, 0x00,
  164.            0x83, 0371, KEY_DISABLE,     0x75, 6,  0x31, 0xc0, 0xc9, 0xc2, 0x4, 0x00,
  165.            0x83, 0371, KEY_ENABLE,      0x75, 14, 0xff, 0165, 0x8, 0xb8, origin, 0xff, 0320, 0xc9, 0xc2, 0x4, 0x00,
  166.            0x83, 0371, KEY_PRESSONCE_ENABLE,
  167.            0x75, 16, 0xc7, 0004, 0002, 0,0,0,0, 0xb8, 0x8000, 0xc9,0xc2,0x4, 0x00,
  168.            0x83, 0371, KEY_PRESSONCE_DISABLE,
  169.            0x75, 16, 0xc7, 0004, 0002, 1,0,0,0, 0xb8, 0x8000, 0xc9,0xc2,0x4, 0x00,
  170.            0x33, 0300, 0xc9,0xc2, 0x4, 0x00
  171.     end      

  172.     KEY_LOCKWINDOW_NOLOCK   = 0
  173.     KEY_LOCKWINDOW_LOCK = 1

  174.     LOCKWINDOW = malloc 16
  175.     writemem LOCKWINDOW, 16, "\0"*16
  176.     ProcHook = SAFX::MsgHook.new do |origin, callproc|
  177.       code(0x55, 0x8b, 0xec,
  178.            0x8b, 0105, 12,
  179.            0xba, LOCKWINDOW,
  180.            0x33, 0311,
  181.            0x8a, 0012,
  182.            0x83, 0371, KEY_LOCKWINDOW_NOLOCK,
  183.            0x74, 14,
  184.            0x81, 0370, 0x111,
  185.            0x75, 6,
  186.            0x33, 0300, 0xc9, 0xc2, 0x10, 0x00,
  187.            0xff, 0165, 20,
  188.            0xff, 0165, 16,
  189.            0xff, 0165, 12,
  190.            0xff, 0165, 8,
  191.            0x68, origin,
  192.            0xb8, callproc,
  193.            0xff, 0320,
  194.            0xc9, 0xc2, 0x10, 0x00)
  195.     end




  196.     def self.setState(key, state)
  197.       writemem KeyTable + key, 1, [state].pack("C")
  198.     end

  199.     def self.getState(key)
  200.       readmem(KeyTable + key, 1).unpack("C").first
  201.     end

  202.     def self.lockWindow(opt)
  203.       if opt
  204.         writemem LOCKWINDOW, 1, [KEY_LOCKWINDOW_LOCK].pack("C")
  205.       else
  206.         writemem LOCKWINDOW, 1, [KEY_LOCKWINDOW_NOLOCK].pack("C")
  207.       end
  208.     end

  209.     VK_F12   = 0x7B
  210.     def self.reset
  211.       r = getState VK_F12
  212.       case r
  213.       when KEY_ENABLE
  214.         KeyFusion.setState VK_F12, KEY_PRESSONCE_ENABLE
  215.       when KEY_DISABLE
  216.         KeyFusion.setState VK_F12, KEY_PRESSONCE_DISABLE
  217.       end
  218.     end



  219.     def self.toggleFullScreen
  220.        sendMsg hwnd, 0x111, 40002, 1
  221.        sendMsg hwnd, 0x111, 0x7d3, 0
  222.     end
  223.   end

  224. end
  225. VK_F12 = 0x7B
  226. KeyFusion.setState VK_F12, KeyFusion::KEY_DISABLE #禁止对F12的处理
复制代码

评分

参与人数 3星屑 +180 +1 收起 理由
冰冷水藍 + 1 精品文章
怪蜀黍 + 150 认可答案
张咚咚 + 30 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-26 21:11

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表