首页
社区
课程
招聘
[原创]初步实现系统级拦截应用程序取硬盘物理序列号
发表于: 2006-11-29 12:09 56522

[原创]初步实现系统级拦截应用程序取硬盘物理序列号

2006-11-29 12:09
56522
收藏
免费 7
支持
分享
最新回复 (65)
雪    币: 325
活跃值: (97)
能力值: ( LV13,RANK:530 )
在线值:
发帖
回帖
粉丝
26
驱动虽然好是好~~
不过问题也比较显著~~就是全部进程都拦截了
  会造成用户本身的一切正版软件无法正常使用~
所以我觉得不太好 而且需要Admin权限。
一般还是用RIng3 注入方式
2006-12-2 13:25
0
雪    币: 201
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
27
那位大侠通过了就放上来给大家玩玩. 看看效果怎么样.
2006-12-2 14:08
0
雪    币: 217
活跃值: (28)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
28
很好的文章,学习。
2006-12-3 05:20
0
雪    币: 201
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
29
强烈支持高人把编过的发出来用用.
2006-12-4 10:18
0
雪    币: 427
活跃值: (412)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
30
测试了几个壳好像无效
2006-12-4 14:53
0
雪    币: 214
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
31
好文章!!!!!
2006-12-4 15:27
0
雪    币: 201
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
32
我一运行就是蓝屏啊,没有办法。
2006-12-5 12:58
0
雪    币: 314
活跃值: (15)
能力值: ( LV12,RANK:410 )
在线值:
发帖
回帖
粉丝
33
看来得换招了
2006-12-5 14:45
0
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
34
好文,学习中。。
2006-12-6 11:06
0
雪    币: 201
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
35
不错啊
好好学习了
2006-12-6 12:31
0
雪    币: 201
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
36
一运行就蓝屏啊。怎么办有什么解决方法
2006-12-6 12:45
0
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
37
好东西,顶一下。。好好学习
2006-12-6 23:47
0
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
38
我试过,非常成功,有一个问题,如果 win98 应该怎么做,

ps:我傻傻的去尝试去掉version检查,在98 Copy *.sys 在driver 目录,一运行,连LoadDeviceDriver都不能通过。
:P
2006-12-15 00:28
0
雪    币: 238
活跃值: (326)
能力值: ( LV12,RANK:450 )
在线值:
发帖
回帖
粉丝
39
对于文中的某些地方做一些解释,希望能给那些想学驱动的朋友有一些帮助。


2、拦截系统的ZwDeviceIoControlFile,并判断入口参数中的IoControlCode ,只有某几个特定的值用来取序列号的,
目前在所有的程序中取硬盘序列号的,我只发现两个值,一个是0x7c088,另外一个是什么忘了。


这里所指的两个数应该是 0x7C088 和 0x4D008:
第一个数 0x7C088 是对应 SMART drive(ATA) 硬盘接口,这个数在NTDDK 的 ntdddisk.h 中定义:
//
// IOCTL support for SMART drive fault prediction.
//

#define SMART_RCV_DRIVE_DATA            CTL_CODE(IOCTL_DISK_BASE, 0x0022, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)

所以原文中对应的语句改成如下形式比较容易理解:
    if((SMART_RCV_DRIVE_DATA ==IoControlCode) && OutputBufferLength >DISK_SERIAL_BUFF_LENGTH){
        PUCHAR Locate = IsSubString(OutputBuffer,__DiskSerial,OutputBufferLength,DISK_SERIAL_BUFF_LENGTH);
        if(Locate){
            UCHAR i;
            for(i=0;i<20;i++){
                Locate[i]= __ChangeTo[i];
            }
        }
    }

在DDK中对 SMART_RCV_DRIVE_DATA 的解释如下:
SMART_RCV_DRIVE_DATA
Operation
Returns the ATA-2 identify data, the SMART thresholds, or the SMART attributes for the device. This IOCTL must be handled by drivers that support SMART.

Input
The buffer at Irp->AssociatedIrp.SystemBuffer contains a SENDCMDINPARAMS structure that describes the request being sent to the device. The irDriveRegs.bCommandReg member specifies ID_CMD when identify data is requested and SMART_CMD when SMART data is requested. If SMART data is requested, the irDriveRegs.bFeaturesReg member specifies either READ_ATTRIBUTES or READ_THRESHOLDS.

Parameters.DeviceIoControl.InputBufferLength specifies the size in bytes of the input buffer, which must be >= (sizeof(SENDCMDINPARAMS) ? 1).

Parameters.DeviceIoControl.OutputBufferLength specifies the size in bytes of the output buffer, which must be >= (sizeof(SENDCMDOUTPARAMS) ? 1 + 512).

Output
The driver returns the SENDCMDOUTPARAMS structure and a 512-byte buffer of drive data to the buffer at Irp->AssociatedIrp.SystemBuffer.

I/O Status Block
The driver sets the Information field to (sizeof(SENDCMDOUTPARAMS) ? 1 + 512) when it sets the Status field to STATUS_SUCCESS. Otherwise, the driver sets the Information field to zero and the Status field to possibly STATUS_INVALID_PARAMETER or STATUS_INSUFFICIENT_RESOURCES.

第二个数0x4D008 对应 SCSI 接口的硬盘,这个数在NTDDK 的 ntddscsi.h 中定义:
//
// NtDeviceIoControlFile IoControlCode values for this device.
//
// Warning:  Remember that the low two bits of the code specify how the
//           buffers are passed to the driver!
//

#define IOCTL_SCSI_MINIPORT             CTL_CODE(IOCTL_SCSI_BASE, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)

在NTDDK中对 IOCTL_SCSI_MINIPORT 的解释如下:
IOCTL_SCSI_MINIPORT
Operation
Sends a special control function to an HBA-specific miniport driver. Results vary, depending on the particular miniport driver to which this request is forwarded. If the caller specifies a nonzero Length, either the input or output buffer must be at least (sizeof(SRB_IO_CONTROL) + DataBufferLength)).

Input
The buffer at Irp->AssociatedIrp.SystemBuffer must contain an SRB_IO_CONTROL structure. Parameters.DeviceIoControl.InputBufferLength indicates the size in bytes of the buffer, which must be at least sizeof (SRB_IO_CONTROL), with additional storage for data if the Length field is nonzero.

Output
An updated SRB_IO_CONTROL structure is returned to the buffer at Irp->AssociatedIrp.SystemBuffer.

I/O Status Block
The Information field contains the number of bytes returned in the output buffer. The Status field indicates the results of the operation.

2006-12-16 12:43
1
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
nsd
40
强啊,学习!!!
2006-12-17 18:03
0
雪    币: 205
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
41
这个帖子强~ 天天破呀脱呀的没这个有意思
2006-12-20 13:09
0
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
42
楼主好文, 我收了. 可惜还没见有兄弟放出通用性的东东呢.

有金山游侠,游戏专家之类的软件, 我想, 能不能通过这些软件来锁定硬盘序列号呢?

正版软件运行时会读取硬盘物理序列号对不对? 游戏专家从内存中找到相应字节,然后修改锁定成已有注册文件的硬盘序列号.

以上, 因为手头暂时没有可试的软件, 所以未能肯定是不是好用.
2006-12-25 14:33
0
雪    币: 214
活跃值: (70)
能力值: ( LV6,RANK:90 )
在线值:
发帖
回帖
粉丝
43
好像0x74080也可以的.
2006-12-25 18:52
0
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
44
好文!学习中,对我有用,谢谢
2006-12-30 10:22
0
雪    币: 116
活跃值: (41)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
45
请问 为什么我的机子一运行就会蓝屏呢?
是不是与CPU有关
我是AMD3800+双核的机子
谢谢
2007-1-23 14:11
0
雪    币: 116
活跃值: (41)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
46
UP 路过的回答一下 谢了
2007-1-23 16:51
0
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
47
这个问题很有意义!!

关注中!!
2007-1-23 19:05
0
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
48
这里有个软件,大家可以参考。http://bbs.txwm.com/dispbbs.asp?BoardID=33&ID=412900
但有个问题,在win98里运行没有问题。在W2000和XP下也可以运行,但如果进行其他操作例如打开“我的电脑”诸如此类的话会出错,自动注销。不知是何原因,望指教。
2007-1-23 22:18
0
雪    币: 4441
活跃值: (805)
能力值: ( LV3,RANK:30 )
在线值:
发帖
回帖
粉丝
49
菜鸟,看不太懂
2007-1-23 22:36
0
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
50
很有创意!技术上可行!
2007-1-25 22:15
0
游客
登录 | 注册 方可回帖
返回
//