I Am End Function serial number For Pocket PC

I Am End Function serial number For Pocket PC

Postby HATHAL » Thu Nov 17, 2005 10:08 am

:D Hello All
I Am End Function serial number For Pocket PC
This Function Now works 100%
But Not (Emie) serial number
He is Identical Library Dll (SMSpec.DLL)
Thank For each Human He Aid Me
----------------
Regards, Hathal



// Serial number

#include "FWCE.ch"

function Main()

local oWnd
DEFINE WINDOW oWnd TITLE "Serial N?"

@ 2, 2 BUTTON "Serial N?" SIZE 80, 25 ACTION MsgInfo(SerialNumber(),str(len(SerialNumber()) ))

ACTIVATE WINDOW oWnd

return nil

#pragma BEGINDUMP

#include <hbapi.h>
#include <windows.h>
#include <uniqueid.h>

// Function serial number For Pocket PC
// vce source code
// by hathal
HB_FUNC( SERIALNUMBER )
{
DWORD dwOutBytes;
const int nBuffSize = 4096;;
char strDeviceInfo[200]="";
byte arrOutBuff[nBuffSize];
char strNextChar[20]="";
char SerialNo[18]="";
BOOL bRes = KernelIoControl(IOCTL_HAL_GET_DEVICEID,
0, 0, arrOutBuff, nBuffSize,
&dwOutBytes);
if (!bRes)
{
MessageBox( GetActiveWindow(),_T("could not retrieve serial number"),_T("Error"),0);
hb_retc("0");
}
for (unsigned int i = 0; i<dwOutBytes; i++)
{
sprintf(strNextChar,"%02X", arrOutBuff[i]);
strcat(strDeviceInfo,strNextChar);
}
memcpy(SerialNo, strDeviceInfo+40, 2);
memcpy(SerialNo+2, strDeviceInfo+45,9);
memcpy(SerialNo+11, strDeviceInfo+70,6);
memcpy(SerialNo+17, "\0",1);
hb_retc(SerialNo);
}
#pragma ENDDUMP :D :D :D
User avatar
HATHAL
 
Posts: 77
Joined: Tue Nov 15, 2005 3:38 pm
Location: The Kingdom Saudi Arabia -Riyadh

Postby josevalle » Thu Nov 17, 2005 12:02 pm

Hello

In my hp ipaq it says:

"could not retrieve serial number"

and after a message box with 13 in the heading
Jose Valle
Bilbao
Spain
User avatar
josevalle
 
Posts: 65
Joined: Fri Oct 14, 2005 6:20 pm
Location: Bilbao

Postby claudio.driussi » Thu Nov 17, 2005 3:11 pm

josevalle wrote:Hello

In my hp ipaq it says:
"could not retrieve serial number"
and after a message box with 13 in the heading


On my Acer N50 it give me an alphabumeric string
17 chars lenght.

Perhaps ipaq hardware don't implement seral number?

Try eVC4 demo called GetUUID, that do approximately
the same thing. If you like i can send it by e-mail.

Claudio.
User avatar
claudio.driussi
 
Posts: 18
Joined: Fri Nov 11, 2005 4:46 pm

View This Source

Postby HATHAL » Thu Nov 17, 2005 3:21 pm

Hello
Hp ipaq Not Support This Function
View This Source
I Am not testing
A sample code for iPAQ:

CString GetSerialNumber()
{
// Start CreateAssetFile.exe
PROCESS_INFORMATION pi;
if (!::CreateProcess(TEXT("\\windows\\CreateAssetFile.exe"),
NULL, NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi))
{
m_strCompaqIpaqId = _T("");
m_strErrorMessage += _T("Cannot run \\windows\\CreateAssetFile.exe file.");
return TEXT("");
}

// Wait until CreateAssetFile.exe will be finished
::WaitForSingleObject(pi.hProcess, INFINITE);

// Read data from cpqAssetData.dat file
HANDLE hInFile;
TCHAR strSN[65];
DWORD dwBytesRead;
hInFile = CreateFile(TEXT("\\windows\\cpqAssetData.dat"), GENERIC_READ,
FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);

if (hInFile == INVALID_HANDLE_VALUE) {
m_strCompaqIpaqId = _T("");
m_strErrorMessage += _T("Cannot read \\windows\\cpqAssetData.dat file.");
return TEXT("");
}

SetFilePointer(hInFile, 976, NULL, FILE_BEGIN);
memset(strSN, 0, 64 * sizeof(TCHAR));
ReadFile(hInFile, &strSN, 64, &dwBytesRead, NULL);
CloseHandle(hInFile);

return CString(strSN);
}

:)
User avatar
HATHAL
 
Posts: 77
Joined: Tue Nov 15, 2005 3:38 pm
Location: The Kingdom Saudi Arabia -Riyadh


Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 17 guests