Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Reading Serial number from PDA with eVB 3.0 ?

Posted on 2004-08-09
1
Medium Priority
?
830 Views
Last Modified: 2008-02-01
I am trying to get the serial number from my PDA (iPaq 3800) so I can hard code it in to my program so it will only run with my PDA.

I have obtained some code, but I don't know how to implement it in to my application in eVB 3.0.

Here is the code:

#include <WINIOCTL.H>

extern "C" __declspec(dllimport)
BOOL KernelIoControl(
  DWORD dwIoControlCode, LPVOID lpInBuf, DWORD nInBufSize,
  LPVOID lpOutBuf, DWORD nOutBufSize, LPDWORD lpBytesReturned
);

#define IOCTL_HAL_GET_DEVICEID CTL_CODE(FILE_DEVICE_HAL, 21, METHOD_BUFFERED, FILE_ANY_ACCESS)

CString GetSerialNumberFromKernelIoControl()
{
      DWORD dwOutBytes;
      const int nBuffSize = 4096;
      byte arrOutBuff[nBuffSize];

      BOOL bRes = ::KernelIoControl(IOCTL_HAL_GET_DEVICEID,
                                     0, 0, arrOutBuff, nBuffSize, &dwOutBytes);

      if (bRes) {
            CString strDeviceInfo;
            for (unsigned int i = 0; i<dwOutBytes; i++) {
                  CString strNextChar;
                  strNextChar.Format(TEXT("%02X"), arrOutBuff[i]);
                  strDeviceInfo += strNextChar;
            }
            CString strDeviceId =
                  strDeviceInfo.Mid(40,2) +
                  strDeviceInfo.Mid(45,9) +
                  strDeviceInfo.Mid(70,6);

            return strDeviceId;
      } else {
            return _T("");
      }
}


Thanks.
0
Comment
Question by:markh51
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 22

Accepted Solution

by:
DarkoLord earned 150 total points
ID: 11762235
Maybe this code helps: (its in vb.net)

http://forums.devbuzz.com/tm.asp?m=31761&p=1&tmode=1

Darko
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question