如何用c#做一个pe获取硬盘信息失败物理id 并且修改 物理id 的程序 求代码 可加分

系统底层 【求助】求驱动中获取硬盘物理序列号代码 [文字模式]
- 看雪安全论坛
查看完整版本 : 系统底层
Maggle如题,最好是C的.或是给我指点一下思路.
还有就是哪位帮我看看下面这段代码,是在网上找的,说是可以得到硬盘序列号
可我在驱动中添加这个函数,调用时却得不到,谁能给我指点一下,谢谢
void GetDiskNumber()
while(inp(0x1F7)!=0x50);
controller
outp(0x1F6, 0xA0);
first/second
outp(0x1F7, 0xEC);
while(inp(0x1F7) != 0x58);
for(dd_off = 0;dd_off!=256;dd_off++)
dd[dd_off] = inpw(0x1F0);
DbgPrint(&The
%s \n&,getascii(dd,10,19));
*getascii(unsigned
in_data[],
off_start,
ret_val[255];
for(loop = off_start, loop1 = 0; loop &=off_ loop++)
ret_val[loop1++] =(char)(in_data[loop]/256);
ret_val[loop1++]=(char)(in_data[loop]%256);
ret_val[loop1]=' ';
return(ret_val);
arabinp和outp都是直接访问I/O端口的操作, 在DOS/Win95下还行, NT/2000/XP以后就没戏了.
machoman如果是IDE 硬盘,如果代码中的思路没错,有可能可以得到。
如果是sata 硬盘,这段代码肯定无法得到序列号。
驱动中获得序列号,最好还是发送IOCTL_更稳定,好像有个开源的获得序列号的app,下移到驱动中就满好的,你可以找一找。
Maggle多谢两位老兄,我考虑下发IRP吧,如果可以得到,我会考虑贴份代码.
再次感谢...
pengmo网上有代码的搜索 disk32 scsi和sata硬盘都可以得到 不过有的硬盘是没号的
MaggleDiskId32是应用层的代码,调用DeviceIoControl,发送IOCTL_就可以了
可我想在内核过滤驱动中得到硬盘物理序列号
我写了如下程序,就是把DiskId32改成驱动版的了
#include &ntifs.h&
#include &ntddscsi.h&
#include &ntdddisk.h&
#include &stdio.h&
#include &..\DiskID.h&
char IdOutCmd [sizeof (SENDCMDOUTPARAMS) + IDENTIFY_BUFFER_SIZE - 1];
IN PDRIVER_OBJECT
DriverObject
BOOLEAN getDiskID( PDEVICE_OBJECT DeviceObject )
PSRB_IO_CONTROL srbC
controlCode = 0;
PIRP irp2;
IO_STATUS_BLOCK ioS
PSENDCMDINPARAMS cmdInP
ULONG drive = 0;
SENDCMDINPARAMS
memset (&scip, 0, sizeof(scip));
memset (IdOutCmd, 0, sizeof(IdOutCmd));
scip.cBufferSize = IDENTIFY_BUFFER_SIZE;
scip.irDriveRegs.bFeaturesReg = 0;
scip.irDriveRegs.bSectorCountReg = 1;
scip.irDriveRegs.bSectorNumberReg = 1;
scip.irDriveRegs.bCylLowReg = 0;
scip.irDriveRegs.bCylHighReg = 0;
// Compute the drive number.
scip.irDriveRegs.bDriveHeadReg = 0xA0 | (((UCHAR)drive & 1) && 4);
// The command can either be IDE identify or ATAPI identify.
scip.irDriveRegs.bCommandReg = IDE_ATA_IDENTIFY;
scip.bDriveNumber = (UCHAR)
scip.cBufferSize = IDENTIFY_BUFFER_SIZE;
// Copy the IOCTL parameters to the srb control buffer area.
irp2 = IoBuildDeviceIoControlRequest(DFP_RECEIVE_DRIVE_DATA,
DeviceObject,
sizeof(SENDCMDINPARAMS) - 1,
sizeof(SENDCMDOUTPARAMS) + IDENTIFY_BUFFER_SIZE - 1,
&ioStatus);
if (irp2 == NULL) {
DbgPrint(&Build DeviceIoControl Error \n&);
return FALSE;
// Call the port driver with the request and wait for it to complete.
status = IoCallDriver(DeviceObject, irp2);
if (status == STATUS_PENDING) {
KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
status = ioStatus.S
// Copy the data received into the output buffer. Since the status buffer
// contains error information also, always perform this copy. IO will will
// either pass this back to the app, or zero it, in case of error.
if (NT_SUCCESS(status)) {
ULONG diskdata [256];
int ijk = 0;
USHORT *pIdSector = (USHORT *)
((PSENDCMDOUTPARAMS) IdOutCmd) -& bB
DbgPrint(&successs in read disk id \n&);
for (ijk = 0; ijk & 256; ijk++)
diskdata [ijk] = pIdSector [ijk];
PrintIdeInfo (drive, diskdata);
IoCompleteRequest( irp2,IO_NO_INCREMENT );
return TRUE;
DbgPrint(&get disk id error\n&);
return FALSE;
DriverEntry( IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPath )
UNICODE_STRING DeviceN
PFILE_OBJECT FileObject = NULL;
PDEVICE_OBJECT DeviceObject = NULL;
RtlInitUnicodeString( &DeviceName,L&\\Device\\ScsiPort0& );
IoGetDeviceObjectPointer( &DeviceName,FILE_ALL_ACCESS,&FileObject,&DeviceObject );
DriverObject-&DriverUnload = MyU
if( NULL == DeviceObject )
DbgPrint(& Error get Disk DeviceObject \n& );
return STATUS_SUCCESS;
if( FALSE == getDiskID( DeviceObject ) )
DbgPrint(& Get DiskID ERROR \n&);
return STATUS_SUCCESS;
DbgPrint(& read Success \n& );
return STATUS_SUCCESS;
void PrintIdeInfo (int drive, ULONG diskdata [256])
char string1 [1024];
strcpy (string1, ConvertToString (diskdata, 10, 19));
DbgPrint(&DiskID %s \n&,ConvertToString (diskdata, 10, 19));
char *ConvertToString (ULONG diskdata [256], int firstIndex, int lastIndex)
static char string [1024];
int index = 0;
int position = 0;
each integer has two characters stored in it backwards
for (index = firstI index &= lastI index++)
get high byte for 1st character
string [position] = (char) (diskdata [index] / 256);
position++;
get low byte for 2nd character
string [position] = (char) (diskdata [index] % 256);
position++;
end the string
string [position] = '\0';
cut off the trailing blanks
for (index = position - 1; index & 0 && ' ' == string [index]; index--)
string [index] = '\0';
读取硬盘ID的时候总是不成功,是在下发IRP的时候有问题,应该是这句
status = IoCallDriver(DeviceObject, irp2);
if (status == STATUS_PENDING) {
KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
status = ioStatus.S
ioStatus.Status不是STATUS_SUCCESS;
请问各位,怎么设置物理设备对象才能让这段代码发送成功啊???
RtlInitUnicodeString( &DeviceName,L&\\Device\\ScsiPort0& );
IoGetDeviceObjectPointer( &DeviceName,FILE_ALL_ACCESS,&FileObject,&DeviceObject );
这个方法得到的设备对象正确吗?求获得硬盘序列号(物理)的方法
[问题点数:200分,无满意结帖,结帖人canserly]
求获得硬盘序列号(物理)的方法
[问题点数:200分,无满意结帖,结帖人canserly]
不显示删除回复
显示所有回复
显示星级回复
显示得分回复
只显示楼主
相关帖子推荐:
2010年 总版技术专家分年内排行榜第一2009年 总版技术专家分年内排行榜第一
2011年 总版技术专家分年内排行榜第二
本帖子已过去太久远了,不再提供回复功能。下载频道 - CSDN.NET
下载频道&硬盘,使用时间检测软件
上传者:baidu_&&&&| 上传时间:&&&&| 下载0次
1.按下P键进行硬盘的选择,默认是第二主盘。
2.按F4进入操作界面。第一第二项分别是扫描的启示和结束位置,用空格键进行操作用回车确认。
3.第三项是修复的读写方式。用左右键可以选择。左按两次,是进行擦除操作。左按一次...
硬盘串号修改软件。。。。。。。。。。。。。。。。。。。。。
功能模块(DLL):
支持硬盘,目录操作,上传,下载.
控制台(CMD命令)
远程屏幕操作
远程摄像头查看
压力测试(cc攻击)
参考此源代码必须要有C语言,windows sdk编程,socket编程基础
源代码目录列表:
Exe_screen 屏幕监控程序,客户端根据...
硬盘安装助手
win7硬盘安装工具资源下载
硬盘终结者_破坏硬盘的东东
类似于cih。呵呵。不许做坏事~
获取硬盘序列号
获取cpu序列号
生成机器码
生成注册码
硬盘再生器(HDD Regenerator)V2.0汉化绿化注册版
硬盘用来存储资料之前的第一个步骤就是 Low Level Format 硬盘低级格式化,它是将识别信号、交错化、磁扇大小等参数写入磁盘表面。ATA 以及 SCSI介面硬盘,在出厂前已经完成低级格式化,并且将一些提高硬盘性能的参数一齐写入磁...
可以修改物理硬盘的工具,本人亲测很好用,可以修改电脑的物理ID ,同时求一个BIOS ID修改工具
一款简单实用的查看硬盘信息小工具,包括硬盘序列号。
超好用的硬盘安装系统工具,请和本人的文档配合使用谢谢
专业硬盘助手,可以修复硬盘,进行分区。可以很好的管理你的硬盘。
很好用,破解版!恢复硬盘数据很方便,本人已亲自试验过,恢复的还行,大家试试!
很好的硬盘分区管理工具,绿色版的.本人一直使用它来进行硬盘格式转换
获取硬盘ID号
并可以加密码软件,保护软件安全性能。}

我要回帖

更多关于 硬盘物理坏道修复 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信