/* 获得IDE硬盘C的序列号 *//* Hard Disk Serial Number */,今天小编就来聊一聊关于t450怎么进bios设置固态硬盘启动?接下来我们就一起去研究一下吧!

t450怎么进bios设置固态硬盘启动(TC2.0源文件获得IDE硬盘C的序列号)

t450怎么进bios设置固态硬盘启动

/* 获得IDE硬盘C的序列号 */

/* Hard Disk Serial Number */

# include <stdio.h>

# include <stdlib.h>

# include <dos.h>

# include <conio.h>

# include <string.h>

char *getascii (unsigned int in_data [],int off_start,int off_end);

void main(void)

{

unsigned int dd[256];

/* 磁盘数据 */

unsigned int dd_off;

/* 磁盘数据偏移地址 */

while(inp(0x1F7)!=0x50)

/* 等待控制 */

outp(0x1F6,0xA0);

/* 得到磁盘信息 */

outp(0x1F7,0xEC);

/* 得到磁盘数据信息 */

while(inp(0x1F7)!=0x58)

/* 等待数据 */

for(dd_off=0;dd_off!=256;dd_off )

/* 读磁盘扇区 */

dd [dd_off]=inpw(0x1F0);

printf("The Serial Number Hard Disk [C] is %s",getascii(dd,10,19));

}

char *getascii (unsigned int in_data [],int off_start,int off_end)

{

static char ret_val [255];

int loop,loop1;

for(loop=off_start,loop1=0;loop<=off_end;loop )

{

ret_val[loop1 ]=(char)(in_data[loop]/256);

/* 得到高位地址字节 */

ret_val[loop1 ]=(char)(in_data[loop]%6);

/* 得到低位地址字节 */

}

ret_val[loop]='\0';

/* 确认以'0'结束 */

return(ret_val);

}

,