1.cè¯è¨å¦ä½å¾å°ç£çååºå称
2.authorwareå¦ä½è·å硬çID
3.Cè¯è¨ è·å硬çç©çå·
cè¯è¨å¦ä½å¾å°ç£çååºå称
代ç å¦ä¸ï¼VS亲æµï¼å¯ä»¥è¿è¡ï¼ç»ä½ 注éçå¾æ¸ æ¥äºï¼ä¸æçå°æ¹å¯ä»¥é®æã
#include <windows.h>
#include <stdio.h>
int main()
{
int DSLength = GetLogicalDriveStrings(0,硬盘源码猫咪后院源码NULL);
//éè¿GetLogicalDriveStrings()å½æ°è·åææ驱å¨å¨å符串信æ¯é¿åº¦ã
char* DStr = new char[DSLength];//ç¨è·åçé¿åº¦å¨å åºå建ä¸ä¸ªcé£æ ¼çå符串æ°ç»
GetLogicalDriveStrings(DSLength,(LPTSTR)DStr);
//éè¿GetLogicalDriveStringså°å符串信æ¯å¤å¶å°å åºæ°ç»ä¸,å ¶ä¸ä¿åäºææ驱å¨å¨çä¿¡æ¯ã
int DType;
int si=0;
for(int i=0;i<DSLength/4;++i)
//为äºæ¾ç¤ºæ¯ä¸ªé©±å¨å¨çç¶æï¼åéè¿å¾ªç¯è¾åºå®ç°ï¼ç±äºDStrå é¨ä¿åçæ°æ®æ¯A:\NULLB:\NULLC:\NULLï¼è¿æ ·çä¿¡æ¯ï¼æ以DSLength/4å¯ä»¥è·å¾å ·ä½å¤§å¾ªç¯èå´
{
char dir[3]={ DStr[si],':','\\'};
//cout<<dir;
DType = GetDriveType((LPCWSTR)DStr+i*4);
//GetDriveTypeå½æ°ï¼å¯ä»¥è·å驱å¨å¨ç±»åï¼åæ°ä¸ºé©±å¨å¨çæ ¹ç®å½
if(DType == DRIVE_FIXED)
{
printf("%c",*dir);
printf("硬ç\n");
}
si+=4;
}
system("pause");//
return 1;
}
authorwareå¦ä½è·å硬çID
C++硬件ç¼ç¨ä¸å¦ä¸ä»£ç å¯ä»¥è·å¾ç¡¬çID,ä½ æ³æ³å¨ä½ çè¿ä¸ªå¤åªä½å¼å软件è½ä¸è½æ··åC++ç¼ç¨:include #include #include #include #include char *GetAscii(unsigned int inData[], int offStart, int offEnd);int main(void){ unsigned intdiskData[];/* Disk data*/unsigned intoffset;/* Disk data offset*/intloop;intnumDrv;/* Number of IDE hard drives*/union REGSregisters;unsigned intbiosCyl[2];/* Cylinders, Heads, Sectors */unsigned intbiosHead[2];unsigned intbiosSec [2];numDrv = peekb(0x, 0x);/* BIOS Data area, Number of Hard disks */for (loop = 0; loop < numDrv; loop++){ while (inp(0xf7) .= 0x);/* Wait for controller not busy*/outp(0xf6, (loop == 0 ? 0xa0 : 0xb0));/* Get first/second drive*/outp(0xf7, 0xec);/* Get drive info data*/while (inp(0x1f7) .= 0x);/* Wait for data ready*/for (offset = 0; offset .= ; offset++) /* Read "sector"*/diskData[offset] = inpw(0x1f0);/* Get BIOS drive info */registers.ah = 0x;/* Get drive info*/registers.dl = 0x + loop; /* Drive is H for Disk 0, H for Disk 1 */int(0x, ?isters, ?isters);if (.registers.cflag)/* All OK if carry not set */{ biosHead[loop] = registers.dh + 1;/* Heads are from 0 */biosSec[loop]= registers.cl & 0x3f;/* sec is bits 5 - 0 *//* +1 because starts from 0 and +1 for FDISK leaving one out */biosCyl[loop]= ((regiå¸æå¯¹ä½ æ帮å©ã
è®°å¾é纳å
Cè¯è¨ è·å硬çç©çå·
è·åç大å¤æ°æ¯ç£çåºåå·èå·²
ç©çå·ä¸å®¹æè·å
å¯ä»¥åèä¸
//
å°±äºé»è¾åºåå·èè¨
ææVBæ¹åæCçï¼å¯ä»¥åèä¸ï¼
#include
#include
main()
{
DWORD
VolumeSerialNumber;
char
VolumeName[];
GetVolumeInformation(
"c:\\
",
VolumeName,,
&VolumeSerialNumber,
NULL,NULL,NULL,
);
printf("cççå·æ ï¼%s
\n",VolumeName);
printf("cççåºåå·ï¼%ld
\n",VolumeSerialNumber);
}