脚本开发,脚本学习,辅助软件,各种工具软件

访问密码统一为:3158

查看: 1605|回复: 0

【升级】易语言文件解锁(关闭句柄法)

[复制链接]

83

主题

83

帖子

450

积分

龆年(髫年)

Rank: 3Rank: 3

积分
450
发表于 2020-5-15 14:38:20 | 显示全部楼层 |阅读模式


前言正文
  • 对于怎么枚举文件句柄,上一帖子对此有介绍,核心代码大概如下:如果 (ZwQueryObject (handle, #ObjectTypeInformation, unicode, 0, size) ≠ #STATUS_INVALID_HANDLE )  ' 只要不是无效的,为什么,详细看下面的注释' 参数' Handle' 对象的一个句柄来获取信息。' ObjectInformationClass' 指定一个OBJECT_INFORMATION_CLASS返回值的类型决定了信息在ObjectInformation缓冲区。' ObjectInformation' 一个指向caller-allocated缓冲接收请求的信息。' ObjectInformationLength' 指定的大小,以字节为单位,ObjectInformation缓冲区。' ReturnLength' 一个指向变量的指针,接收的大小,以字节为单位,请求的关键信息。如果NtQueryObject STATUS_SUCCESS返回,返回的变量包含的数据量。如果NtQueryObject返回STATUS_BUFFER_OVERFLOW或STATUS_BUFFER_TOO_SMALL,您可以使用变量的值来确定所需的缓冲区大小。' 返回值' NtQueryObject返回STATUS_SUCCESS或适当的错误状态。可能的错误状态码包括以下:' 返回代码 描述' STATUS_ACCESS_DENIED' 有足够的权限来执行该cha询。' STATUS_INVALID_HANDLE' 提供对象句柄无效。' STATUS_INFO_LENGTH_MISMATCH' 信息长度不足以容纳数据。unicode = 取空白字节集 (size)ZwQueryObject (handle, #ObjectTypeInformation, unicode, size, 0)  ' 读取信息的unicode文本RtlUnicodeStringToAnsiString (ansi, unicode, 真)  ' 编码转换' RtlUnicodeStringToAnsiString例程将给定Unicode字符串转换成一个ANSI字符串。str = 指针到文本 (ansi.Buffer)' RtlFreeAnsiString常规版本存储由RtlUnicodeStringToAnsiString分配。' 参数' AnsiString' 指针ANSI字符串缓冲区由RtlUnicodeStringToAnsiString以前分配的。RtlFreeAnsiString (ansi)str = “无法获取”  ' 无效的怎么获取……返回 (str)
  • 这一次呢更新了一个RemoteCloseHandle,大概的原理是什么呢?
  • L6B1HK_}FT_]4~{ZT3.png
  • 同时也采用了一些比较骚的方法,这种方法的限制较多,但是对于32位进程就很有效果。
  • H073DWI0{TM1I8TJ0U)$W(H.png
  • BVTC6I~PZ8IKUU%N}ARKOLH.png
  • 2NA83@UP]9[~YRPQ[F33UQ9.png
  • NtClose在MSDN的大概介绍
    1. NtClose is a generic routine that operates on any type of object.2. Closing an open object handle causes that handle to become invalid. The system also decrements the handle count for the object and checks whether the object can be deleted. The system does not actually delete the object until all of the object's handles are closed and no referenced pointers remain.3. A driver must close every handle that it opens as soon as the handle is no longer required. Kernel handles, which are those that are opened by a system thread or by specifying the OBJ_KERNEL_HANDLE flag, can be closed only when the previous processor mode is KernelMode. This requirement applies both to system threads and to dispatch routines for IRPs that were issued from kernel mode. (For more information about the previous processor mode, see ExGetPreviousMode.) For example, a handle that NtCreateKey returns to a DriverEntry routine cannot subsequently be closed by the same driver's dispatch routines. A DriverEntry routine runs in a system process, whereas dispatch routines usually run either in the context of the thread issuing the current I/O request, or, for lower-level drivers, in an arbitrary thread context.4. A nonkernel handle can be closed only if one of two conditions is met: The previous processor mode is KernelMode, or the calling thread has sufficient permission to close the handle. An example of the latter occurs when the calling thread is the one that created the handle.5. Callers of NtClose should not assume that this routine automatically waits for all I/O to complete prior to returning.1. NtClose是一个在任何类型的对象上运行的通用例程。2. 关闭打开的对象句柄会导致该句柄无效。系统还会减少对象的句柄计数,并检查是否可以删除该对象。在关闭所有对象的句柄并且不保留引用的指针之前,系统实际上不会删除该对象。3. 一旦不再需要句柄,驱动程序必须关闭它打开的每个句柄。内核句柄是由系统线程打开或通过指定OBJ_KERNEL_HANDLE标志的句柄,只有在先前的处理器模式为KernelMode时才能关闭。此要求适用于系统线程和分配从内核模式发出的IRP的例程。 (有关先前处理器模式的更多信息,请参阅ExGetPreviousMode。)例如,NtCreateKey返回到DriverEntry例程的句柄随后不能由相同的驱动程序的调度例程关闭。 DriverEntry例程在系统进程中运行,而调度例程通常在发出当前I / O请求的线程的上下文中运行,或者对于较低级别的驱动程序在任意线程上下文中运行。4. 只有满足以下两个条件之一时,才能关闭非内核句柄:先前的处理器模式是KernelMode,或者调用线程有足够的权限来关闭句柄。当调用线程是创建句柄的线程时,会发生后者的示例。5. NtClose的调用者不应该假设此例程在返回之前自动等待所有I / O完成。
    • 增加命令
    增加命令
    备注
    参数

    RemoteCloseHandle1远程关闭句柄,基本通吃ProcessId和Handle
    RemoteCloseHandle2NtClose法,不支持64位进程!ProcessId和Handle


    下载链接:
https://t00y.com/file/20110282-443565693




上一篇:EXUI 图片查看软件(组件自适应)
下一篇:一款自绘的超级列表框开源了···
3Q4T网,编程学习交流基地。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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