1

Konu: Vb.net Mobile Cihazlarda Id alma

Öncelikle Herkese Merhabalar
El Terminalinde cihaz Id aldırmak için araştırmalarım sonucunda şöyle bi elimde şöyle bi kod var

SQL
Declare FUNCTION KernelIoControl Lib "CoreDll.dll" _

(ByVal dwIoControlCode AS Int32, _
ByVal lpInBuf AS IntPtr, _
ByVal nInBufSize AS Int32, _
ByVal lpOutBuf() AS Byte, _
ByVal nOutBufSize AS Int32, _
ByRef lpBytesReturned AS Int32) AS BOOLEAN
 
    Private Shared METHOD_BUFFERED AS Int32 = 0
    Private Shared FILE_ANY_ACCESS AS Int32 = 0
    Private Shared FILE_DEVICE_HAL AS Int32 = &H101
 
    Private Const ERROR_NOT_SUPPORTED AS Int32 = &H32
    Private Const ERROR_INSUFFICIENT_BUFFER AS Int32 = &H7A
 
    Private Shared IOCTL_HAL_GET_DEVICEID AS Int32 = _
        (&H10000 * FILE_DEVICE_HAL) OR (&H4000 * FILE_ANY_ACCESS) _
        OR (&H4 * 21) OR METHOD_BUFFERED
 
    Private Shared FUNCTION GetDeviceID() AS String
 
        ' Initialize the output buffer to the size of a
        '
Win32 DEVICE_ID structure
        Dim outbuff(19) AS Byte
        Dim dwOutBytes AS Int32
        Dim done AS BOOLEAN = False
 
        Dim nBuffSize AS Int32 = outbuff.Length
 
        ' Set DEVICEID.dwSize to size of buffer.  Some platforms look at
        '
this FIELD rather than the nOutBufSize param of KernelIoControl
        ' when determining if the buffer is large enough.
        BitConverter.GetBytes(nBuffSize).CopyTo(outbuff, 0)
        dwOutBytes = 0
 
        '
Loop until the device ID IS retrieved OR an error occurs.
        While NOT done
            IF KernelIoControl(IOCTL_HAL_GET_DEVICEID, IntPtr.Zero, _
                0, outbuff, nBuffSize, dwOutBytes) Then
                done = True
            Else
                Dim errnum AS Integer = Marshal.GetLastWin32Error()
                SELECT Case errnum
                    Case ERROR_NOT_SUPPORTED
                        Throw New NotSupportedException( _
                            "IOCTL_HAL_GET_DEVICEID is not supported on this device", _
                            New Win32Exception(errnum))
 
                    Case ERROR_INSUFFICIENT_BUFFER
 
                        ' The buffer is not big enough for the data.  The
                        '
required size IS IN the first 4 bytes of the output
                        ' buffer (DEVICE_ID.dwSize).
                        nBuffSize = BitConverter.ToInt32(outbuff, 0)
                        outbuff = New Byte(nBuffSize) {}
 
                        '
SET DEVICEID.dwSize TO size of buffer.  Some
                        ' platforms look at this field rather than the
                        '
nOutBufSize param of KernelIoControl when
                        ' determining if the buffer is large enough.
                        BitConverter.GetBytes(nBuffSize).CopyTo(outbuff, 0)
 
                    Case Else
                        Throw New Win32Exception(errnum, "Unexpected error")
                End Select
            End If
        End While
 
        '
Copy the elements of the DEVICE_ID structure.
        Dim dwPresetIDOffset AS Int32 = BitConverter.ToInt32(outbuff, &H4)
        Dim dwPresetIDSize AS Int32 = BitConverter.ToInt32(outbuff, &H8)
        Dim dwPlatformIDOffset AS Int32 = BitConverter.ToInt32(outbuff, &HC)
        Dim dwPlatformIDSize AS Int32 = BitConverter.ToInt32(outbuff, &H10)
        Dim sb AS New StringBuilder
        Dim i AS Integer
 
        FOR i = dwPresetIDOffset TO (dwPresetIDOffset + dwPresetIDSize) - 1
            sb.Append(String.Format("{0:X2}", outbuff(i)))
        Next i
 
        sb.Append("-")
 
        FOR i = dwPlatformIDOffset TO (dwPlatformIDOffset + dwPlatformIDSize) - 1
            sb.Append(String.Format("{0:X2}", outbuff(i)))
        Next i
 
        RETURN sb.ToString()
    End FUNCTION


Fakat bu kodla alınan numara iki cihazdada aynı sonucu veriyor.Bildiğim kadarı ile bu id numaralarının değişik olması gerekiyor.Bu Konuda Bilgisi olan arkadaşlardan yardımcı olurlarsa sevinirim.
Şimdiden ilgilenen herkese teşekkürler.

2

Re: Vb.net Mobile Cihazlarda Id alma

hiç boşuna uğraşma. bizim çok satan bir el terminali programımız ve arkadaş neleri denese sonuç alamadı. cpu serino bazı aletlerde okunuyor, bazılarında okunamıyor. ethernet serino ise cradle'a takınca okunamaz hale geliyor. eğer windows mobile 7 'yi el terminallerinde de kullanmaya başlarlarsa o zaman çözülür bu mevzu ancak.

Haksızlıklar karşısında susanlar, dilsiz şeytanlardır!
www.metinemre.com

3

Re: Vb.net Mobile Cihazlarda Id alma

Peki Siz Ne Hangi yoldan Çözümü önerirsiniz?

4

Re: Vb.net Mobile Cihazlarda Id alma

bizimkilerin çözüm bulamadığını söylemiştim, yani önerim yok... smile

Haksızlıklar karşısında susanlar, dilsiz şeytanlardır!
www.metinemre.com

5

Re: Vb.net Mobile Cihazlarda Id alma

Peki Siz Demiştiniz bu arkadaşlar bu yazılımı çok satıyolar diye yazılımın lisans güvenliğine dikkate almadan çok satmaları konusunu anlayamadın metin bey ben?:D