Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Get serial number different for PPC2003 than WM5/5

Posted on 2009-07-01
2
Medium Priority
?
565 Views
Last Modified: 2013-12-27
I use the following code to get the serial number for my WM5/6 devices:

typedef int (__cdecl *MYPROC)(LPBYTE, DWORD, DWORD, LPBYTE, DWORD *);

MYPROC ProcAdd;

// Attemp to load aygshell.dll
HMODULE hLib = LoadLibrary(_T("coredll.dll"));
if (hLib)
{            
      ProcAdd = (MYPROC)GetProcAddress(hLib, _T("GetDeviceUniqueID"));

      if(ProcAdd)
      {

                   HRESULT hr = NOERROR;      
                    const GUID     bApplicationData1  = { 0x8d552bd1, 0xe232, 0x4107, { 0xb7,  
                             0x2d, 0x38, 0xb6, 0xa4, 0x72, 0x64, 0x39 } };
               const DWORD    cbApplicationData1 = sizeof (bApplicationData1);

       // Buffers to hold the two device IDs we are going to generate
      BYTE                g_bDeviceID1[GETDEVICEUNIQUEID_V1_OUTPUT];
      // Lengths of the returned device IDs
      DWORD               g_cbDeviceID1;

      g_cbDeviceID1 = GETDEVICEUNIQUEID_V1_OUTPUT;
      hr = ProcAdd (reinterpret_cast<LPBYTE>(const_cast<LPGUID>
                            &bApplicationData1)), cbApplicationData1,GETDEVICEUNIQUEID_V1,
                                 g_bDeviceID1,
                                 &g_cbDeviceID1);

      TCHAR        szDeviceID[(GETDEVICEUNIQUEID_V1_OUTPUT * 2) + 1];
            
      if (SUCCEEDED (DeviceID2String (g_bDeviceID1, g_cbDeviceID1, szDeviceID,
                                                                                                    ARRAYSIZE (szDeviceID))))
      {
            sSerialNo = szDeviceID;
      }
                  
}
else
{
      AfxMessageBox(_T("GetSerialNumber Error: ProcAdd NULL"));
      sSerialNo.Empty();

}

CloseHandle(hLib);

This works fine in WM5/6 but in PPC2003 it fails here:
ProcAdd = (MYPROC)GetProcAddress(hLib, _T("GetDeviceUniqueID"));
if(ProcAdd)
{
    blah blah
}

Why is this and how can I go about it?

Thanks
0
Comment
Question by:Wanting2LearnMan
[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
  • 2
2 Comments
 
LVL 33

Accepted Solution

by:
pgnatyuk earned 2000 total points
ID: 24760380
You can retrieve the same data by using KernelIOControl API with IOCTL_HAL_GET_DEVICEID. PPC2003 does have the privilliged mode, so it is possible to call such API without any problem:
http://msdn.microsoft.com/en-us/library/aa446562.aspx
http://msdn.microsoft.com/en-us/library/ms880643.aspx
 http://forum.soft32.com/pda/device-id-unique-device-ftopict53543.html
 Other tricks about the subject:
1. GetDeviceCaps - you can retrieve OEM info and use it.
2. Phone number or IMEI if it is phone enabled PDA.
3. You can retrieve the serial number of the SD-card.
4. You can generate yourself a unique number and save on a persistent storage.
 
0
 
LVL 33

Assisted Solution

by:pgnatyuk
pgnatyuk earned 2000 total points
ID: 24784132
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I recently asked a question (http://www.experts-exchange.com/Programming/Smartphones/Android/Q_28684946.html) about Computer Inventory applications for Mobile Devices.  I was specifically interested in an app I could use on my android phone.  The be…
A short article about problems I had with the new location API and permissions in Marshmallow
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Suggested Courses

705 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