Wanting2LearnMan
asked on
Get serial number different for PPC2003 than WM5/5
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.dl l"));
if (hLib)
{
ProcAdd = (MYPROC)GetProcAddress(hLi b, _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[GETDEVICEUNIQ UEID_V1_OU TPUT];
// Lengths of the returned device IDs
DWORD g_cbDeviceID1;
g_cbDeviceID1 = GETDEVICEUNIQUEID_V1_OUTPU T;
hr = ProcAdd (reinterpret_cast<LPBYTE>( const_cast <LPGUID>
&bApplicationData1)), cbApplicationData1,GETDEVI CEUNIQUEID _V1,
g_bDeviceID1,
&g_cbDeviceID1);
TCHAR szDeviceID[(GETDEVICEUNIQU EID_V1_OUT PUT * 2) + 1];
if (SUCCEEDED (DeviceID2String (g_bDeviceID1, g_cbDeviceID1, szDeviceID,
ARRAYSIZE (szDeviceID))))
{
sSerialNo = szDeviceID;
}
}
else
{
AfxMessageBox(_T("GetSeria lNumber Error: ProcAdd NULL"));
sSerialNo.Empty();
}
CloseHandle(hLib);
This works fine in WM5/6 but in PPC2003 it fails here:
ProcAdd = (MYPROC)GetProcAddress(hLi b, _T("GetDeviceUniqueID"));
if(ProcAdd)
{
blah blah
}
Why is this and how can I go about it?
Thanks
typedef int (__cdecl *MYPROC)(LPBYTE, DWORD, DWORD, LPBYTE, DWORD *);
MYPROC ProcAdd;
// Attemp to load aygshell.dll
HMODULE hLib = LoadLibrary(_T("coredll.dl
if (hLib)
{
ProcAdd = (MYPROC)GetProcAddress(hLi
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[GETDEVICEUNIQ
// Lengths of the returned device IDs
DWORD g_cbDeviceID1;
g_cbDeviceID1 = GETDEVICEUNIQUEID_V1_OUTPU
hr = ProcAdd (reinterpret_cast<LPBYTE>(
&bApplicationData1)), cbApplicationData1,GETDEVI
g_bDeviceID1,
&g_cbDeviceID1);
TCHAR szDeviceID[(GETDEVICEUNIQU
if (SUCCEEDED (DeviceID2String (g_bDeviceID1, g_cbDeviceID1, szDeviceID,
ARRAYSIZE (szDeviceID))))
{
sSerialNo = szDeviceID;
}
}
else
{
AfxMessageBox(_T("GetSeria
sSerialNo.Empty();
}
CloseHandle(hLib);
This works fine in WM5/6 but in PPC2003 it fails here:
ProcAdd = (MYPROC)GetProcAddress(hLi
if(ProcAdd)
{
blah blah
}
Why is this and how can I go about it?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.