<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          WinCE獲取SD卡序列號(hào)

          作者: 時(shí)間:2016-09-12 來源:網(wǎng)絡(luò) 收藏

          {

          BOOL bRes = FALSE;

          PSTORAGE_IDENTIFICATION pStoreInfo = NULL;

          HANDLE hDisk = INVALID_HANDLE_VALUE;

          __try

          {

          //The buffer for storing data

          const DWORD BUFFER_SIZE = 300;

          //Allocate the size for the struct

          pStoreInfo = (PSTORAGE_IDENTIFICATION) new BYTE[BUFFER_SIZE];

          if(pStoreInfo == NULL)

          {

          __leave;

          }

          //Open the driver

          hDisk = CreateFile(strDiskName.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);

          if(hDisk == INVALID_HANDLE_VALUE)

          {

          __leave;

          }

          //Get the ID from the driver

          DWORD dwBytesRet = 0;

          if (DeviceIoControl(hDisk, IOCTL_DISK_GET_STORAGEID, NULL, 0, pStoreInfo, BUFFER_SIZE, dwBytesRet, NULL) == FALSE)

          {

          __leave;

          }

          //Get the manufacture ID

          if (pStoreInfo->dwManufactureIDOffset != 0)

          {

          char *pManufactureID = reinterpret_cast(pStoreInfo) + pStoreInfo->dwManufactureIDOffset;

          if(pStoreInfo->dwSerialNumOffset != 0)

          {

          strManufactureID.assign(pManufactureID,pStoreInfo->dwSerialNumOffset - pStoreInfo->dwManufactureIDOffset);

          }

          else

          {

          strManufactureID = pManufactureID;

          }

          }

          if(pStoreInfo->dwSerialNumOffset != 0)

          {

          char *pSerialNum = reinterpret_cast(pStoreInfo) + pStoreInfo->dwSerialNumOffset;

          strSerialNum = pSerialNum;

          }

          bRes = TRUE;

          }

          __finally

          {

          if(pStoreInfo != NULL)

          {

          delete []pStoreInfo;

          }

          if(hDisk != INVALID_HANDLE_VALUE)

          {

          CloseHandle(hDisk);

          }

          }

          return bRes;

          }


          上一頁(yè) 1 2 下一頁(yè)

          關(guān)鍵詞:

          評(píng)論


          相關(guān)推薦

          技術(shù)專區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();