d sub接口口键盘老熄灭

攻克Android软键盘的疑难杂症
在Activity中含有EditText时,我们常常在AndroidManifest.xml中为该Activity设置:windowSoftInputMode属性,其中最常用的值就是adjustResize和adjustPan。在此请思考几个问题:
adjustResize和adjustPan有什么区别?
adjustResize和adjustPan的应用场景有何差异?
当设置android:windowSoftInputMode后如何监听软键盘的弹起与隐藏?
在看到第三个问题的时候,有人会想:
干嘛要去监听软键盘的弹起呢?有什么用呢?
嗯哼,看到了吧:当键盘弹起来的时候在紧靠键盘上方的地方出现了一个自定义布局,点击笑脸就可以发送专属emoji表情,点击礼盒就可以发送福利。
当然,在键盘收起的时候这个布局也就不可见了。
除此以外,在其他不少场景也会有类似的UI设计。在这些情况下,我们都要监听键盘软键盘的弹起与隐藏。善良的童鞋会想:这个没难度呀,调用一下官方的API就行。很久以前,我也是这么想的。可是,事与愿违,官方文档中根本就没有提供检测软键盘状态的接口。
既然官方没有把这个API洗干净整整齐齐的摆在眼前,那我们就自己实现它。
adjustResize
在AndroidManifest.xml中为该Activity设置
android:windowSoftInputMode=”adjustResize”
该模式下系统会调整屏幕的大小以保证软键盘的显示空间。
举个例子:
屏幕的高为1920px,那么整个Activity的布局高度也为1920px。当设置该属性后点击界面中的EditText,此时弹出软键盘其高度为800px。为了完整地显示此软键盘,系统会调整Activity布局的高度为1920px-800px=1120px。
所以,此时的布局与原本的布局就发生了一些变化,比如:整体布局显示不完整,控件外观的变形,控件显示位置的错乱等等。这些现象都是因为原布局的高度变小所导致。
以下,再结合代码详细分析该情况。
import android.content.C import android.util.AttributeS import android.widget.RelativeL /** * 原创作者: * 谷哥的小弟 * * 博客地址: * http://blog.csdn.net/lfdfhl * */ public class RelativeLayoutSubClass extends RelativeLayout{ private OnSoftKeyboardListener mSoftKeyboardL public RelativeLayoutSubClass(Context context, AttributeSet attrs) { super(context, attrs); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); System.out.println("----& onMeasure"); } @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { super.onLayout(changed, l, t, r, b); mSoftKeyboardListener.onSoftKeyboardChange(); System.out.println("----& onLayout"); } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); System.out.println("----& onSizeChanged"); } public void setSoftKeyboardListener(OnSoftKeyboardListener listener){ mSoftKeyboardListener= } public interface OnSoftKeyboardListener{ public void onSoftKeyboardChange(); } }
我们将该自定义RelativeLayout作为Activity布局的根
&?xml version="1.0" encoding="utf-8"?& &cc.testsoftinputmode.RelativeLayoutSubClass xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/rootLayout" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context="cc.testsoftinputmode.MainActivity"& &RelativeLayout android:layout_width="match_parent" android:layout_height="200dp" android:layout_alignParentTop="true" android:background="#7fb80e"& &TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="浅绿色部分在屏幕顶部" android:textSize="25sp" android:layout_centerInParent="true" android:textColor="#843900"/& &/RelativeLayout& &EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:hint="这里是一个输入框" android:textSize="25sp" android:layout_centerInParent="true" android:textColor="#843900"/& &RelativeLayout android:layout_width="match_parent" android:layout_height="200dp" android:layout_alignParentBottom="true" android:background="#ffc20e"& &TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="浅黄色部分在屏幕底部" android:textSize="25sp" android:layout_centerInParent="true" android:textColor="#f05b72"/& &/RelativeLayout& &/cc.testsoftinputmode.RelativeLayoutSubClass&
效果如下:
点击EditText,弹出软键盘:
现象呢,我们已经看到了。我们再来瞅瞅当软键盘状态变化的时候RelativeLayoutSubClass中有哪些行为发生:
软键盘状态变化时会调用其onMeasure(),onLayout(),onSizeChanged()
在onSizeChanged()中可以确知软键盘状态变化前后布局宽高的数值
至此,发现一个关键点:onSizeChanged()
我们可以以此为切入点检测软键盘的状态变化,所以定义一个接口OnSoftKeyboardListener提供给Activity使用,具体代码如下:
import android.os.B import android.support.v7.app.AppCompatA /** * 原创作者: * 谷哥的小弟 * * 博客地址: * http://blog.csdn.net/lfdfhl * */ public class MainActivity extends AppCompatActivity { private RelativeLayoutSubClass mRootL private int screenH private int screenW p @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); init(); } private void init(){ screenHeight=getResources().getDisplayMetrics().heightP screenWidth=getResources().getDisplayMetrics().widthP threshold=screenHeight/3; mRootLayout= (RelativeLayoutSubClass) findViewById(R.id.rootLayout); mRootLayout.setSoftKeyboardListener(new RelativeLayoutSubClass.OnSoftKeyboardListener() { @Override public void onSoftKeyboardChange(int w, int h, int oldw, int oldh) { if (oldh-h&threshold){ System.out.println("----& 软键盘弹起"); }else if(h-oldh&threshold){ System.out.println("----& 软键盘收起"); } } }); } }
请注意onSoftKeyboardChange()的回调:
假若oldh-h大于屏幕高度的三分之一,则软键盘弹起
假若h-oldh大于屏幕高度的三分之一,则软键盘收起
当软键盘状态发生改变时,通过对Activity布局文件根Layout的onSizeChanged()判断软键盘的弹起或隐藏
在AndroidManifest.xml中为该Activity设置
android:windowSoftInputMode=”adjustPan”
该模式下系统会将界面中的内容自动移动从而使得焦点不被键盘覆盖,即用户能总是看到输入内容的部分
比如,还是刚才的那个布局,现在将其windowSoftInputMode设置为adjustPan再点击EditText,效果如下:
嗯哼,看到了吧:
为了避免软键盘弹起后遮挡EditText,系统将整个布局上移了,也就是我们常说的将布局顶上去了。
此时再来看看当软键盘状态变化的时候RelativeLayoutSubClass中有哪些行为发生:
软键盘状态变化时会调用其onMeasure(),onLayout()
onSizeChanged()并没有被调用
整个布局的高度也没有变化
哦噢,这时并没有执行onSizeChanged()方法,这也就说原本检测软键盘状态的方法在这就行不通了,得另辟蹊径了。
当软键盘弹起时,原布局中是不是有一部分被键盘完全遮挡了呢?
对吧,也就是说原布局的可视范围(更精确地说是可视高度)发生了变化:变得比以前小了。所以,我们可以以此为突破口,具体代码如下:
public boolean isSoftKeyboardShow(View rootView) { screenHeight=getResources().getDisplayMetrics().heightP screenWidth=getResources().getDisplayMetrics().widthP threshold=screenHeight/3; int rootViewBottom=rootView.getBottom(); Rect rect = new Rect(); rootView.getWindowVisibleDisplayFrame(rect); int visibleBottom=rect. int heightDiff = rootViewBottom - visibleB System.out.println("----& rootViewBottom="+rootViewBottom+",visibleBottom="+visibleBottom); System.out.println("----& heightDiff="+heightDiff+",threshold="+threshold); return heightDiff & }
获取根布局(RelativeLayoutSubClass)原本的高度
int rootViewBottom=rootView.getBottom();
获取当前根布局的可视高度
Rect rect = new Rect();
rootView.getWindowVisibleDisplayFrame(rect);
int visibleBottom=rect.
计算两者的差值
int heightDiff = rootViewBottom – visibleB
判断软键盘是否弹起
return heightDiff &
具体的方法是有了,那么该在哪里调用该方法呢?
其实,和之前的类似,只需在RelativeLayoutSubClass的onLayout()中执行即可。具体代码如下:
import android.content.C import android.util.AttributeS import android.widget.RelativeL /** * 原创作者: * 谷哥的小弟 * * 博客地址: * http://blog.csdn.net/lfdfhl * */ public class RelativeLayoutSubClass extends RelativeLayout{ private OnSoftKeyboardListener mSoftKeyboardL public RelativeLayoutSubClass(Context context, AttributeSet attrs) { super(context, attrs); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); System.out.println("----& onMeasure"); } @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { super.onLayout(changed, l, t, r, b); mSoftKeyboardListener.onSoftKeyboardChange(); System.out.println("----& onLayout"); } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); System.out.println("----& onSizeChanged"); } public void setSoftKeyboardListener(OnSoftKeyboardListener listener){ mSoftKeyboardListener= } public interface OnSoftKeyboardListener{ public void onSoftKeyboardChange(); } }
在对应的Activity中实现该Listener,具体代码如下:
import android.graphics.R import android.os.B import android.support.v7.app.AppCompatA import android.view.V /** * 原创作者: * 谷哥的小弟 * * 博客地址: * http://blog.csdn.net/lfdfhl * */ public class MainActivity extends AppCompatActivity{ private RelativeLayoutSubClass mRootL private int screenH private int screenW p @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); init(); } private void init(){ mRootLayout= (RelativeLayoutSubClass) findViewById(R.id.rootLayout); mRootLayout.setSoftKeyboardListener(new RelativeLayoutSubClass.OnSoftKeyboardListener() { @Override public void onSoftKeyboardChange() { boolean isShow=isSoftKeyboardShow(mRootLayout); System.out.println("----& isShow="+isShow); } }); } public boolean isSoftKeyboardShow(View rootView) { screenHeight=getResources().getDisplayMetrics().heightP screenWidth=getResources().getDisplayMetrics().widthP threshold=screenHeight/3; int rootViewBottom=rootView.getBottom(); Rect rect = new Rect(); rootView.getWindowVisibleDisplayFrame(rect); int visibleBottom=rect. int heightDiff = rootViewBottom - visibleB System.out.println("----& rootViewBottom="+rootViewBottom+",visibleBottom="+visibleBottom); System.out.println("----& heightDiff="+heightDiff+",threshold="+threshold); return heightDiff & } }
嗯哼,至此当windowSoftInputMode设置为adjustPan时软键盘的状态监听也得到了实现
转载请注明:>>
责任编辑:
声明:本文由入驻搜狐号的作者撰写,除搜狐官方账号外,观点仅代表作者本人,不代表搜狐立场。
今日搜狐热点VB 遥线程注入技术实现键盘拦截的例子(无DLL) - VB当前位置:& &&&VB 遥线程注入技术实现键盘拦截的例子(无DLL)VB 遥线程注入技术实现键盘拦截的例子(无DLL)www.MyException.Cn&&网友分享于:&&浏览:5次VB 远线程注入技术实现键盘拦截的例子(无DLL)
Option ExplicitPrivate Sub cmdLock_Click()If LockKeyboard(True) ThencmdLock.Enabled = FalsecmdUnLock.Enabled = TrueEnd IfEnd SubPrivate Sub cmdUnLock_Click()If LockKeyboard(False) ThencmdLock.Enabled = TruecmdUnLock.Enabled = FalseEnd IfEnd SubPrivate Sub Form_Load()Dim bIsLock As BooleanbIsLock = GetKeyboardStatecmdLock.Enabled = Not bIsLockcmdUnLock.Enabled = bIsLockEnd Sub
模块部分代码:
Option Explicit'是否包含处理其它键盘消息,True表示处理.#Const INC_OTHER_KEY = True'注意,以下所有双版本的API均声明成了 UNICODE 版。 并且许多地方与VB的API浏览器生成的代码有所不同。Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As LongPrivate Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Long, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As LongPrivate Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Long, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As LongPrivate Declare Function GlobalAddAtom Lib "kernel32" Alias "GlobalAddAtomW" (ByVal lpString As Long) As IntegerPrivate Declare Function GlobalDeleteAtom Lib "kernel32" (ByVal nAtom As Integer) As IntegerPrivate Declare Function GlobalFindAtom Lib "kernel32" Alias "GlobalFindAtomW" (ByVal lpString As Long) As IntegerPrivate Const TH32CS_SNAPPROCESS = 2Private Type PROCESSENTRY32WdwSize As LongcntUsage As Longh32ProcessID As Long ' // this processth32DefaultHeapID As Long 'h32ModuleID As Long ' // associated execntThreads As Long 'th32ParentProcessID As Long ' // this process's parent processpcPriClassBase As Long ' // Base priority of process's threadsdwFlags As Long 'szExeFile(1 To 260) As Integer ' // PathEnd TypePrivate Declare Function CreateToolhelp32Snapshot Lib "kernel32" (ByVal dwFlags As Long, ByVal th32ProcessID As Long) As LongPrivate Declare Function Process32First Lib "kernel32" Alias "Process32FirstW" (ByVal hSnapshot As Long, lpPE As PROCESSENTRY32W) As LongPrivate Declare Function Process32Next Lib "kernel32" Alias "Process32NextW" (ByVal hSnapshot As Long, lpPE As PROCESSENTRY32W) As LongPrivate Declare Function lstrcmpi Lib "kernel32" Alias "lstrcmpiW" (lpString1 As Integer, ByVal lpString2 As Long) As LongPrivate Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As LongPrivate Declare Function GetLastError Lib "kernel32" () As LongPrivate Type LUIDlowpart As Longhighpart As LongEnd TypePrivate Type LUID_AND_ATTRIBUTESpLuid As LUIDAttributes As LongEnd TypePrivate Type TOKEN_PRIVILEGESPrivilegeCount As LongPrivileges As LUID_AND_ATTRIBUTESEnd TypePrivate Const PROCESS_ALL_ACCESS As Long = &H1F0FFFPrivate Const TOKEN_QUERY As Long = &H8&Private Const TOKEN_ADJUST_PRIVILEGES As Long = &H20&Private Const SE_PRIVILEGE_ENABLED As Long = &H2Private Const SE_DEBUG_NAME As String = "SeDebugPrivilege"Private Declare Function GetCurrentProcess Lib "kernel32" () As LongPrivate Declare Function OpenProcessToken Lib "advapi32.dll" (ByVal ProcessHandle As Long, ByVal DesiredAccess As Long, TokenHandle As Long) As LongPrivate Declare Function LookupPrivilegeValue Lib "advapi32.dll" Alias "LookupPrivilegeValueW" (ByVal lpSystemName As Long, ByVal lpName As Long, lpLuid As LUID) As LongPrivate Declare Function AdjustTokenPrivileges Lib "advapi32.dll" (ByVal TokenHandle As Long, ByVal DisableAllPrivileges As Long, NewState As TOKEN_PRIVILEGES, ByVal BufferLength As Long, ByVal PrevState As Long, ByVal N As Long) As LongPrivate Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleW" (ByVal lpwModuleName As Long) As LongPrivate Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As LongPrivate Const MEM_COMMIT As Long = &H1000Private Const MEM_DECOMMIT As Long = &H4000Private Const PAGE_EXECUTE_READWRITE As Long = &H40Private Declare Function VirtualAllocEx Lib "kernel32" (ByVal ProcessHandle As Long, ByVal lpAddress As Long, ByVal dwSize As Long, ByVal flAllocationType As Long, ByVal flProtect As Long) As LongPrivate Declare Function VirtualFreeEx Lib "kernel32" (ByVal ProcessHandle As Long, ByVal lpAddress As Long, ByVal dwSize As Long, ByVal dwFreeType As Long) As LongPrivate Declare Function CreateRemoteThread Lib "kernel32" (ByVal hProcess As Long, ByVal lpThreadAttributes As Long, ByVal dwStackSize As Long, ByVal lpStartAddress As Long, ByVal lpParameter As Long, ByVal dwCreationFlags As Long, lpThreadId As Long) As LongPrivate Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As LongPrivate Declare Function GetExitCodeThread Lib "kernel32" (ByVal hThread As Long, lpExitCode As Long) As Long#If INC_OTHER_KEY ThenPrivate Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExW" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As LongPrivate Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As LongPrivate Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal nCode As Long, ByVal wParam As Long, lParam As Any) As Long#End IfPrivate Const ATOM_FLAG As String = "HookSysKey"Private Const SHELL_FALG As String = "Winlogon"Private Const SHELL_CODE_DWORDLEN = 317 '注入代码所占的双字数Private Const SHELL_CODE_LENGTH = (SHELL_CODE_DWORDLEN * 4) '字节数Private Const SHELL_FUNCOFFSET = &H8 '注入代码线程函数偏移量Private mlShellCode(SHELL_CODE_DWORDLEN - 1) As Long#If INC_OTHER_KEY ThenPrivate m_lHookID As Long '键盘钩子句柄Private Type KBDLLHOOKSTRUCTvkCode As LongscanCode As Longflags As Longtime As LongdwExtraInfo As LongEnd TypePrivate Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)#End If'============================================' 锁定/解锁键盘' 参数:布尔型,真表示锁定' 返回:布尔型, 真表示成功' 注意:非 Ctrl+Alt+Del 键使用普通钩子技术,因此' 程序在退出时注意要卸载钩子。'============================================Public Function LockKeyboard(ByVal bLock As Boolean) As BooleanDim lResult As LongDim lStrPtr As LongDim iAtom As IntegerlStrPtr = StrPtr(SHELL_FALG)iAtom = GlobalFindAtom(lStrPtr)If iAtom = 0 ThenlResult = InsertAsmCodeDebug.Assert lResult = 0If lResult Then Exit FunctionEnd IflStrPtr = StrPtr(ATOM_FLAG)iAtom = GlobalFindAtom(lStrPtr)If bLock Then#If INC_OTHER_KEY Then'强烈建议:使用了SetWindowsHookEx的话,请编译后再运行!m_lHookID = SetWindowsHookEx(13, AddressOf LowLevelKeyboardProc, App.hInstance, 0)#End IfIf iAtom = 0 Then iAtom = GlobalAddAtom(lStrPtr)LockKeyboard = (iAtom && 0)Debug.Assert LockKeyboardElse#If INC_OTHER_KEY ThenIf m_lHookID Then Call UnhookWindowsHookEx(m_lHookID)#End IfIf iAtom Then iAtom = GlobalDeleteAtom(iAtom)LockKeyboard = iAtom = 0End IfEnd FunctionPublic Function GetKeyboardState() As BooleanGetKeyboardState = GlobalFindAtom(StrPtr(ATOM_FLAG)) && 0End Function#If INC_OTHER_KEY ThenPrivate Function LowLevelKeyboardProc(ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As LongDim KBEvent As KBDLLHOOKSTRUCTIf nCode &= 0 Then'在这里可以加入实际的过滤条件CopyMemory KBEvent, ByVal lParam, 20& 'sizeof KBDLLHOOKSTRUCT=20'wParam = 消息,如WM_KEYDOWN, WM_KEYUP等Debug.Print Hex$(KBEvent.vkCode) 'VK_??? 定义的键码LowLevelKeyboardProc = 1 '1屏蔽,否则应调用CallNextHookExElseLowLevelKeyboardProc = CallNextHookEx(m_lHookID, nCode, wParam, lParam)End IfEnd Function#End If'----------------------------------------------' 远程线程插入函数' 功能:向 Winlogon 进程插入远程线程代码,并执行' 返回:0表示成功,非0表示标准的系统错误代号'----------------------------------------------Private Function InsertAsmCode() As LongConst WINLOGON As String = "Winlogon.exe"Dim hProcess As Long '远端进程句柄Dim hPId As Long '远端进程IDDim lResult As Long '一般返回变量Dim pToken As TOKEN_PRIVILEGESDim hToken As LongDim hRemoteThread As LongDim hRemoteThreadID As LongDim lDbResult(1) As LongDim lRemoteAddr As Long'------------------------------------'取winlogon进程ID'------------------------------------hPId = GetProcessIdFromName(WINLOGON)If hPId = 0 ThenInsertAsmCode = GetLastErrorDebug.Assert FalseExit FunctionEnd If'------------------------------------'提升本进程权限,以取得对winlogon进程操作的许可'------------------------------------lResult = OpenProcessToken(GetCurrentProcess(), _TOKEN_ADJUST_PRIVILEGES Or TOKEN_QUERY, _hToken)Debug.Assert lResultlResult = LookupPrivilegeValue(0, StrPtr(SE_DEBUG_NAME), pToken.Privileges.pLuid)Debug.Assert lResultpToken.PrivilegeCount = 1pToken.Privileges.Attributes = SE_PRIVILEGE_ENABLEDlResult = AdjustTokenPrivileges(hToken, False, pToken, Len(pToken), 0, 0)Debug.Assert lResult'------------------------------------'打开winlogon进程'------------------------------------hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, hPId)Debug.Assert hProcessIf hProcess Then'------------------------------------'初始注入代码'------------------------------------Call InitShellCode'------------------------------------'远端进程分配内存'------------------------------------lRemoteAddr = VirtualAllocEx(hProcess, 0, SHELL_CODE_LENGTH, MEM_COMMIT, PAGE_EXECUTE_READWRITE)Debug.Assert lRemoteAddr'------------------------------------'写入 shell 代码'------------------------------------If lRemoteAddr ThenInsertAsmCode = WriteProcessMemory(hProcess, lRemoteAddr, mlShellCode(0), SHELL_CODE_LENGTH, 0)ElseInsertAsmCode = GetLastErrorExit FunctionEnd If'------------------------------------'创建远程线程'------------------------------------hRemoteThread = CreateRemoteThread(hProcess, 0, 0, lRemoteAddr + SHELL_FUNCOFFSET, 0, 0, hRemoteThreadID)If hRemoteThread = 0 ThenInsertAsmCode = GetLastErrorDebug.Assert hRemoteThreadExit FunctionEnd If'------------------------------------'等待远程线程'------------------------------------Call WaitForSingleObject(hRemoteThread, -1)Call GetExitCodeThread(hRemoteThread, InsertAsmCode)Call CloseHandle(hRemoteThread)'------------------------------------'释放远端进程内存'------------------------------------Call VirtualFreeEx(hProcess, lRemoteAddr, SHELL_CODE_LENGTH, MEM_DECOMMIT)ElseInsertAsmCode = GetLastErrorEnd IfEnd Function'============================================' 初始线程代码'============================================Private Function InitShellCode() As LongConst kernel32 As String = "kernel32.dll"Dim hDll As Long'------------------------------------'提取注入代码所需的API函数'------------------------------------hDll = GetModuleHandle(StrPtr(kernel32)): Debug.Assert hDllmlShellCode(0) = GetProcAddress(hDll, "GetModuleHandleW")mlShellCode(1) = GetProcAddress(hDll, "GetProcAddress")'---------------------------' 以下代码由 MASM32 产生mlShellCode(2) = &HE853&mlShellCode(3) = &H815B0000mlShellCode(4) = &H40100EEBmlShellCode(5) = &H238E800mlShellCode(6) = &HC00B0000mlShellCode(7) = &H838D5075mlShellCode(8) = &H4010B0mlShellCode(9) = &HD093FF50mlShellCode(10) = &HF004013mlShellCode(11) = &HC00BC0B7mlShellCode(12) = &H683A75mlShellCode(13) = &H6A020000mlShellCode(14) = &H8D006A00mlShellCode(15) = &HmlShellCode(16) = &H93FF5000mlShellCode(17) = &H401090mlShellCode(18) = &H1874C00BmlShellCode(19) = &H10C2938DmlShellCode(20) = &H6A0040mlShellCode(21) = &H93FF5052mlShellCode(22) = &H401094mlShellCode(23) = &H474C00BmlShellCode(24) = &HAEB0AEBmlShellCode(25) = &H108C93FFmlShellCode(26) = &H2EB0040mlShellCode(27) = &HC25BC033mlShellCode(28) = &HFF8B0004mlShellCode(38) = &H410053mlShellCode(39) = &H200053mlShellCode(40) = &H690077mlShellCode(41) = &H64006EmlShellCode(42) = &H77006FmlShellCode(43) = &HFF8B0000mlShellCode(44) = &H690057mlShellCode(45) = &H6C006EmlShellCode(46) = &H67006FmlShellCode(47) = &H6E006FmlShellCode(48) = &H8B550000mlShellCode(49) = &HF0C481ECmlShellCode(50) = &H53FFFFFDmlShellCode(51) = &HE8&mlShellCode(52) = &HEB815B00mlShellCode(53) = &H4010D1mlShellCode(54) = &H10468mlShellCode(55) = &HF8858D00mlShellCode(56) = &H50FFFFFDmlShellCode(57) = &HFF0875FFmlShellCode(58) = &HmlShellCode(59) = &HF8858D00mlShellCode(60) = &H50FFFFFDmlShellCode(61) = &H1098838DmlShellCode(62) = &HFF500040mlShellCode(63) = &H40107C93mlShellCode(64) = &H75C00B00mlShellCode(65) = &H68406A69mlShellCode(66) = &H1000&mlShellCode(67) = &H7668&mlShellCode(68) = &HFF006A00mlShellCode(69) = &HmlShellCode(70) = &H74C00B00mlShellCode(71) = &HmlShellCode(72) = &HFFFFFDF0mlShellCode(73) = &H75FFFC6AmlShellCode(74) = &H8493FF08mlShellCode(75) = &H8D004010mlShellCode(76) = &HmlShellCode(77) = &HFC028900mlShellCode(78) = &HFDF0BD8BmlShellCode(79) = &H76B9FFFFmlShellCode(80) = &H8D000000mlShellCode(81) = &HmlShellCode(82) = &H8DA4F300mlShellCode(83) = &HmlShellCode(84) = &H93FF5000mlShellCode(85) = &H401078mlShellCode(86) = &HFDF0B5FFmlShellCode(87) = &HFC6AFFFFmlShellCode(88) = &HFF0875FFmlShellCode(89) = &HmlShellCode(90) = &HC0336100mlShellCode(91) = &HC03303EBmlShellCode(92) = &HC2C95B40mlShellCode(93) = &H6B0008mlShellCode(94) = &H720065mlShellCode(95) = &H65006EmlShellCode(96) = &H33006CmlShellCode(97) = &H2E0032mlShellCode(98) = &H6C0064mlShellCode(99) = &H6C&mlShellCode(100) = &H730075mlShellCode(101) = &H720065mlShellCode(102) = &H320033mlShellCode(103) = &H64002EmlShellCode(104) = &H6C006CmlShellCode(105) = &HmlShellCode(106) = &HmlShellCode(107) = &H6572466CmlShellCode(108) = &H6C470065mlShellCode(109) = &H6C61626FmlShellCode(110) = &H646E6946mlShellCode(111) = &H6D6F7441mlShellCode(112) = &H6C470057mlShellCode(113) = &H6C61626FmlShellCode(114) = &HmlShellCode(115) = &H576D6F74mlShellCode(116) = &H74736C00mlShellCode(117) = &H706D6372mlShellCode(118) = &H4F005769mlShellCode(119) = &H446E6570mlShellCode(120) = &H746B7365mlShellCode(121) = &H57706FmlShellCode(122) = &H6D756E45mlShellCode(123) = &H6B736544mlShellCode(124) = &H57706F74mlShellCode(125) = &H6F646E69mlShellCode(126) = &HmlShellCode(127) = &HmlShellCode(128) = &H776F646EmlShellCode(129) = &HmlShellCode(130) = &HmlShellCode(131) = &H6E695774color:
12345678910
12345678910
12345678910 上一篇:下一篇:文章评论相关解决方案 12345678910 Copyright & &&版权所有

我要回帖

更多关于 vga接口能用d sub 的文章

 

随机推荐