亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? gethardsoftinfo.cpp

?? 讀取硬盤id的源程序(vc++),很好用
?? CPP
字號:

////----------------------------------------------// File : GetHardSoftInfo.cpp//// Content : for displaying the details of hard drives in //// Author : 06/11/2000  Lynn McGuire  written with many contributions from others,//                            IDE drives only under Windows NT/2K and 9X,//                            maybe SCSI drives later//// Fix Bug : 06/06/2003 NieHuawen(nie173@sohu.com)//// Content : Replant to Class////-------------------------------------------------
#include "stdafx.h"
#include "GetHardSoftInfo.h"

CGetMachineInfo::CGetMachineInfo(void)
{
	OSVERSIONINFO version;	memset (&version, 0, sizeof (version));	version.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);	GetVersionEx (&version);	if (version.dwPlatformId == VER_PLATFORM_WIN32_NT)//nt	{
     ReadPhysicalDriveInNT();
	}
	if(version.dwPlatformId==VER_PLATFORM_WIN32_WINDOWS)//9x
	{
		ReadDrivePortsInWin9X();
	}
}
BOOL CGetMachineInfo::ReturnInfo(int drive, DWORD diskdata [256])
{
	char string1 [1024];   __int64 sectors = 0;   __int64 bytes = 0;      //  copy the hard drive serial number to the buffer   strcpy (string1, ConvertToString (diskdata, 10, 19));   if (0 == HardDriveSerialNumber [0] &&            //  serial number must be alphanumeric            //  (but there can be leading spaces on IBM drives)       (isalnum (string1 [0]) || isalnum (string1 [19])))      strcpy (HardDriveSerialNumber, string1);//#ifdef PRINTING_TO_CONSOLE_ALLOWED   switch (drive / 2)   {      case 0: str_HardDesk_Form ="Primary Controller";              break;      case 1: str_HardDesk_Form ="Secondary Controller";              break;      case 2: str_HardDesk_Form ="Tertiary Controller";              break;      case 3: str_HardDesk_Form ="Quaternary Controller";              break;   }//MessageBox(NULL,str_HardDesk_Form,NULL,NULL);   switch (drive % 2)   {      case 0: str_Controller ="Master drive";              break;      case 1: str_Controller ="Slave drive";              break;   }   str_DN_Modol =CString(ConvertToString (diskdata, 27, 46));     str_DN_Serial =CString(ConvertToString (diskdata, 10, 19));   str_DN_ControllerRevision =CString(ConvertToString (diskdata, 23, 26));   str_HardDeskBufferSize.Format("%u", diskdata [21] * 512);   printf ("Drive Type________________________: ");   if (diskdata [0] & 0x0080)      str_HardDeskType ="Removable";   else if (diskdata [0] & 0x0040)      str_HardDeskType ="Fixed";   else str_HardDeskType ="Unknown";           		//  calculate size based on 28 bit or 48 bit addressing		//  48 bit addressing is reflected by bit 10 of word 83	if (diskdata [83] & 0x400) 		sectors = diskdata [103] * 65536I64 * 65536I64 * 65536I64 + 					diskdata [102] * 65536I64 * 65536I64 + 					diskdata [101] * 65536I64 + 					diskdata [100];	else		sectors = diskdata [61] * 65536 + diskdata [60];		//  there are 512 bytes in a sector	bytes = sectors * 512;	str_HardDeskSize.Format("%I64d",bytes);return 1;
}
//conversion to char 
char *CGetMachineInfo::ConvertToString(DWORD 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 = firstIndex; index <= lastIndex; 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';   return string;
}
//
 CGetMachineInfo::DoIDENTIFY(HANDLE hPhysicalDriveIOCTL, PSENDCMDINPARAMS pSCIP,                 PSENDCMDOUTPARAMS pSCOP, BYTE bIDCmd, BYTE bDriveNum,                 PDWORD lpcbBytesReturned)
{
 // Set up data structures for IDENTIFY command.   pSCIP -> cBufferSize = IDENTIFY_BUFFER_SIZE;   pSCIP -> irDriveRegs.bFeaturesReg = 0;   pSCIP -> irDriveRegs.bSectorCountReg = 1;   pSCIP -> irDriveRegs.bSectorNumberReg = 1;   pSCIP -> irDriveRegs.bCylLowReg = 0;   pSCIP -> irDriveRegs.bCylHighReg = 0;      // Compute the drive number.   pSCIP -> irDriveRegs.bDriveHeadReg = 0xA0 | ((bDriveNum & 1) << 4);      // The command can either be IDE identify or ATAPI identify.   pSCIP -> irDriveRegs.bCommandReg = bIDCmd;   pSCIP -> bDriveNumber = bDriveNum;   pSCIP -> cBufferSize = IDENTIFY_BUFFER_SIZE;   return( DeviceIoControl (hPhysicalDriveIOCTL, DFP_RECEIVE_DRIVE_DATA,               (LPVOID) pSCIP,               sizeof(SENDCMDINPARAMS) - 1,               (LPVOID) pSCOP,               sizeof(SENDCMDOUTPARAMS) + IDENTIFY_BUFFER_SIZE - 1,               lpcbBytesReturned, NULL) );
}
//
int CGetMachineInfo::ReadPhysicalDriveInNT(void)
{
	int done = FALSE;   int drive = 0;   for (drive = 0; drive < MAX_IDE_DRIVES; drive++)   {      HANDLE hPhysicalDriveIOCTL = 0;         //  Try to get a handle to PhysicalDrive IOCTL, report failure         //  and exit if can't.      char driveName [256];      sprintf (driveName, "\\\\.\\PhysicalDrive%d", drive);         //  Windows NT, Windows 2000, must have admin rights      hPhysicalDriveIOCTL = CreateFile (driveName,                               GENERIC_READ | GENERIC_WRITE,                                FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,                               OPEN_EXISTING, 0, NULL);      // if (hPhysicalDriveIOCTL == INVALID_HANDLE_VALUE)      //    printf ("Unable to open physical drive %d, error code: 0x%lX\n",      //            drive, GetLastError ());      if (hPhysicalDriveIOCTL != INVALID_HANDLE_VALUE)      {         GETVERSIONOUTPARAMS VersionParams;         DWORD               cbBytesReturned = 0;            // Get the version, etc of PhysicalDrive IOCTL         memset ((void*) &VersionParams, 0, sizeof(VersionParams));         if ( ! DeviceIoControl (hPhysicalDriveIOCTL, DFP_GET_VERSION,                   NULL,                    0,                   &VersionParams,                   sizeof(VersionParams),                   &cbBytesReturned, NULL) )         {                     // printf ("DFP_GET_VERSION failed for drive %d\n", i);            // continue;         }            // If there is a IDE device at number "i" issue commands            // to the device         if (VersionParams.bIDEDeviceMap > 0)         {            BYTE             bIDCmd = 0;   // IDE or ATAPI IDENTIFY cmd            SENDCMDINPARAMS  scip;            //SENDCMDOUTPARAMS OutCmd;			BYTE IdOutCmd [sizeof (SENDCMDOUTPARAMS) + IDENTIFY_BUFFER_SIZE - 1];			// Now, get the ID sector for all IDE devices in the system.               // If the device is ATAPI use the IDE_ATAPI_IDENTIFY command,               // otherwise use the IDE_ATA_IDENTIFY command            bIDCmd = (VersionParams.bIDEDeviceMap >> drive & 0x10) ? \                      IDE_ATAPI_IDENTIFY : IDE_ATA_IDENTIFY;            memset (&scip, 0, sizeof(scip));            memset (IdOutCmd, 0, sizeof(IdOutCmd));            if ( DoIDENTIFY (hPhysicalDriveIOCTL,                        &scip,                        (PSENDCMDOUTPARAMS)&IdOutCmd,                        (BYTE) bIDCmd,                       (BYTE) drive,                       &cbBytesReturned))            {               DWORD diskdata [256];               int ijk = 0;               USHORT *pIdSector = (USHORT *)                             ((PSENDCMDOUTPARAMS) IdOutCmd) -> bBuffer;               for (ijk = 0; ijk < 256; ijk++)                  diskdata [ijk] = pIdSector [ijk];               ReturnInfo (drive, diskdata);               done = TRUE;            }	    }         CloseHandle (hPhysicalDriveIOCTL);      }   }   return done;
}
//
int CGetMachineInfo::ReadDrivePortsInWin9X(void)
{
	int done = FALSE;   HANDLE VxDHandle = 0;   pt_IdeDInfo pOutBufVxD = 0;   DWORD lpBytesReturned = 0;		//  set the thread priority high so that we get exclusive access to the diskSetPriorityClass (GetCurrentProcess (), REALTIME_PRIORITY_CLASS);	      // 1. Make an output buffer for the VxD   rt_IdeDInfo info;   pOutBufVxD = &info;      // *****************      // KLUDGE WARNING!!!      // HAVE to zero out the buffer space for the IDE information!      // If this is NOT done then garbage could be in the memory      // locations indicating if a disk exists or not.   ZeroMemory (&info, sizeof(info));      // 1. Try to load the VxD       //  must use the short file name path to open a VXD file   //char StartupDirectory [2048];   //char shortFileNamePath [2048];   //char *p = NULL;   //char vxd [2048];      //  get the directory that the exe was started from   //GetModuleFileName (hInst, (LPSTR) StartupDirectory, sizeof (StartupDirectory));      //  cut the exe name from string   //p = &(StartupDirectory [strlen (StartupDirectory) - 1]);   //while (p >= StartupDirectory && *p && '\\' != *p) p--;   //*p = '\0';      //GetShortPathName (StartupDirectory, shortFileNamePath, 2048);   //sprintf (vxd, "\\\\.\\%s\\IDE21201.VXD", shortFileNamePath);   //VxDHandle = CreateFile (vxd, 0, 0, 0,   //               0, FILE_FLAG_DELETE_ON_CLOSE, 0);      VxDHandle = CreateFile ("\\\\.\\IDE21201.VXD", 0, 0, 0,							0, FILE_FLAG_DELETE_ON_CLOSE, 0);   if (VxDHandle != INVALID_HANDLE_VALUE)   {         // 2. Run VxD function      DeviceIoControl (VxDHandle, m_cVxDFunctionIdesDInfo,					0, 0, pOutBufVxD, sizeof(pt_IdeDInfo), &lpBytesReturned, 0);         // 3. Unload VxD      CloseHandle (VxDHandle);   }   else		MessageBox (NULL, "ERROR: Could not open IDE21201.VXD file", 					TITLE, MB_ICONSTOP);      // 4. Translate and store data   unsigned long int i = 0;   for (i=0; i<8; i++)   {      if((pOutBufVxD->DiskExists[i]) && (pOutBufVxD->IDEExists[i/2]))      {			DWORD diskinfo [256];			for (int j = 0; j < 256; j++) 				diskinfo [j] = pOutBufVxD -> DisksRawInfo [i * 256 + j];            // process the information for this buffer		   ReturnInfo (i, diskinfo);			done = TRUE;      }   }		//  reset the thread priority back to normal   // SetThreadPriority (GetCurrentThread(), THREAD_PRIORITY_NORMAL);   SetPriorityClass (GetCurrentProcess (), NORMAL_PRIORITY_CLASS);   return done;
}
//
int CGetMachineInfo::ReadIdeDriveAsScsiDriveInNT(void)
{
	int done = FALSE;   int controller = 0;   for (controller = 0; controller < 2; controller++)   {      HANDLE hScsiDriveIOCTL = 0;      char   driveName [256];         //  Try to get a handle to PhysicalDrive IOCTL, report failure         //  and exit if can't.      sprintf (driveName, "\\\\.\\Scsi%d:", controller);         //  Windows NT, Windows 2000, any rights should do      hScsiDriveIOCTL = CreateFile (driveName,                               GENERIC_READ | GENERIC_WRITE,                                FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,                               OPEN_EXISTING, 0, NULL);      // if (hScsiDriveIOCTL == INVALID_HANDLE_VALUE)      //    printf ("Unable to open SCSI controller %d, error code: 0x%lX\n",      //            controller, GetLastError ());      if (hScsiDriveIOCTL != INVALID_HANDLE_VALUE)      {         int drive = 0;         for (drive = 0; drive < 2; drive++)         {            char buffer [sizeof (SRB_IO_CONTROL) + SENDIDLENGTH];            SRB_IO_CONTROL *p = (SRB_IO_CONTROL *) buffer;            SENDCMDINPARAMS *pin =                   (SENDCMDINPARAMS *) (buffer + sizeof (SRB_IO_CONTROL));            DWORD dummy;               memset (buffer, 0, sizeof (buffer));            p -> HeaderLength = sizeof (SRB_IO_CONTROL);            p -> Timeout = 10000;            p -> Length = SENDIDLENGTH;            p -> ControlCode = IOCTL_SCSI_MINIPORT_IDENTIFY;            strncpy ((char *) p -> Signature, "SCSIDISK", 8);              pin -> irDriveRegs.bCommandReg = IDE_ATA_IDENTIFY;            pin -> bDriveNumber = drive;            if (DeviceIoControl (hScsiDriveIOCTL, IOCTL_SCSI_MINIPORT,                                  buffer,                                 sizeof (SRB_IO_CONTROL) +                                         sizeof (SENDCMDINPARAMS) - 1,                                 buffer,                                 sizeof (SRB_IO_CONTROL) + SENDIDLENGTH,                                 &dummy, NULL))            {               SENDCMDOUTPARAMS *pOut =                    (SENDCMDOUTPARAMS *) (buffer + sizeof (SRB_IO_CONTROL));               IDSECTOR *pId = (IDSECTOR *) (pOut -> bBuffer);               if (pId -> sModelNumber [0])               {                  DWORD diskdata [256];                  int ijk = 0;                  USHORT *pIdSector = (USHORT *) pId;                            for (ijk = 0; ijk < 256; ijk++)                     diskdata [ijk] = pIdSector [ijk];                  ReturnInfo (controller * 2 + drive, diskdata);                  done = TRUE;               }            }         }         CloseHandle (hScsiDriveIOCTL);      }   }   return done;
}
//

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲情趣在线观看| 成人精品免费网站| www.视频一区| 日韩手机在线导航| 一个色妞综合视频在线观看| 激情伊人五月天久久综合| 欧美午夜宅男影院| 日韩一区欧美小说| 国产一区二区伦理片| 欧美精品丝袜中出| 亚洲精品伦理在线| jlzzjlzz国产精品久久| 欧美xxx久久| 日韩国产在线一| 欧美性videosxxxxx| 中文字幕欧美三区| 久草中文综合在线| 欧美日韩精品一区二区三区四区 | 精品伦理精品一区| 午夜精品久久久久久久99水蜜桃| 成人app在线观看| 中文字幕不卡在线播放| 激情综合一区二区三区| 91精品国产综合久久精品性色| 亚洲欧美国产三级| 色综合久久88色综合天天免费| 国产精品美女一区二区| 高清在线观看日韩| 欧美激情一区二区三区全黄| 国产传媒欧美日韩成人| 久久久不卡网国产精品二区| 国内精品第一页| 久久久亚洲综合| 久久电影网站中文字幕| 欧美成人猛片aaaaaaa| 精东粉嫩av免费一区二区三区| 日韩视频中午一区| 国产精品一线二线三线| 日本一区二区成人在线| 成人av资源下载| 亚洲视频免费在线| 欧美日韩一区二区电影| 青青草原综合久久大伊人精品| 欧美一区二区不卡视频| 久久99久久久欧美国产| 久久久精品免费观看| 福利91精品一区二区三区| 国产精品乱码一区二三区小蝌蚪| 成人国产在线观看| 亚洲第一二三四区| 欧美成人vps| 国产成人午夜电影网| 国产精品乱人伦| 欧美日韩色一区| 麻豆91在线播放| 国产精品久久久久永久免费观看 | 91老师片黄在线观看| 亚洲国产一二三| 日韩精品中文字幕在线不卡尤物| 国产福利一区在线| 亚洲激情图片qvod| 精品乱码亚洲一区二区不卡| 99久久精品久久久久久清纯| 爽好多水快深点欧美视频| 精品国产乱码久久久久久免费 | 欧美综合一区二区三区| 精品影视av免费| 亚洲乱码日产精品bd| 日韩精品一区国产麻豆| 99re8在线精品视频免费播放| 全国精品久久少妇| 亚洲人吸女人奶水| 精品少妇一区二区三区在线播放| 99久久99久久综合| 九九**精品视频免费播放| 亚洲女同一区二区| 精品久久五月天| 欧美人与z0zoxxxx视频| 99久久久精品| 国产成人午夜99999| 亚洲国产成人91porn| 国产精品天天看| 精品国产伦一区二区三区观看方式| 91精品福利视频| 国产白丝网站精品污在线入口| 亚洲电影在线播放| 亚洲婷婷综合色高清在线| 久久精品亚洲精品国产欧美kt∨ | 91一区二区在线| 激情小说亚洲一区| 日韩精品一二三区| 亚洲自拍另类综合| 国产精品久久久久久久久免费桃花 | 91老师片黄在线观看| 国产精品羞羞答答xxdd| 视频一区二区欧美| 一区二区三区四区不卡视频| 亚洲国产高清aⅴ视频| 久久蜜桃av一区二区天堂 | 成人欧美一区二区三区小说| 26uuu亚洲综合色| 日韩欧美综合一区| 91精品久久久久久蜜臀| 欧洲在线/亚洲| 欧美亚洲动漫另类| 91久久精品日日躁夜夜躁欧美| jiyouzz国产精品久久| 成人av网站免费观看| 国产成人精品影视| 成人午夜短视频| 成人激情小说网站| 丁香五精品蜜臀久久久久99网站| 国产一区二区三区免费在线观看| 久草中文综合在线| 国产高清在线观看免费不卡| 国产成人精品亚洲日本在线桃色 | 国产精品久久久久影院色老大| 国产亚洲1区2区3区| 久久精品网站免费观看| 久久久久久亚洲综合影院红桃| 精品1区2区在线观看| 久久色视频免费观看| 久久丝袜美腿综合| 国产精品国产三级国产aⅴ入口| 亚洲欧美区自拍先锋| 一区二区三区在线观看动漫| 亚洲午夜久久久久久久久电影院| 一区二区三区在线视频免费| 午夜不卡av在线| 麻豆精品视频在线| 国产成人av电影在线| 91女神在线视频| 欧美三区在线观看| 日韩欧美在线1卡| 欧美国产一区二区在线观看| 亚洲丝袜制服诱惑| 性欧美疯狂xxxxbbbb| 久久激五月天综合精品| 国产不卡高清在线观看视频| 91久久线看在观草草青青| 在线播放亚洲一区| 久久综合中文字幕| 亚洲视频每日更新| 麻豆精品一区二区| 91啦中文在线观看| 日韩精品一区二区三区中文不卡| 久久精品一区二区三区四区| 夜夜嗨av一区二区三区| 日本成人在线看| 成人午夜私人影院| 欧美日韩国产免费一区二区| 精品国产一区二区在线观看| 亚洲猫色日本管| 狠狠网亚洲精品| 欧美日韩一卡二卡三卡| 久久精品亚洲乱码伦伦中文 | 中文字幕亚洲综合久久菠萝蜜| 亚洲va国产天堂va久久en| 国产一区在线观看视频| 91麻豆国产精品久久| 日韩精品一区二区三区在线播放| 亚洲免费观看高清完整| 精品午夜一区二区三区在线观看| 在线一区二区三区四区五区| 久久久国产精华| 欧美aaa在线| 在线观看网站黄不卡| 国产女主播在线一区二区| 日日噜噜夜夜狠狠视频欧美人| 国产黄色成人av| 欧美一区二区三区四区久久 | 日本一区二区免费在线观看视频| 亚洲一区二区视频在线| 国产成a人亚洲精品| 91精品福利在线一区二区三区 | 欧美在线播放高清精品| 中文字幕第一页久久| 国产米奇在线777精品观看| 欧美精品在线观看一区二区| 亚洲免费av高清| 91小视频在线免费看| 国产日本欧美一区二区| 经典一区二区三区| 日韩一级免费观看| 日韩精品一二区| 91精品国产福利| 日本大胆欧美人术艺术动态| 欧美综合色免费| 亚洲已满18点击进入久久| 色综合一区二区| 一区二区三区日本| 91捆绑美女网站| 亚洲精品国产a久久久久久 | 夜夜嗨av一区二区三区网页| 色噜噜狠狠色综合中国| 亚洲激情自拍视频| 欧美日韩一级视频| 日韩av电影免费观看高清完整版 | 一区二区三区四区精品在线视频 | 久久青草国产手机看片福利盒子|