Announcement

Collapse
No announcement yet.

Dongle : Hardware lock, DLL function

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dongle : Hardware lock, DLL function

    hey guys...

    i wanna use a dongle in ams, but i dont know how can i use dll callback function with lock.dll file...

    here is the vb example (extracted from dongle documents)
    Code:
    Module HarwareLockFunctions
        Public Declare Function GetExpiryDateAndTime Lib "lock.dll" (ByRef Min As Byte, ByRef Hour As Byte, ByRef Day As Byte, ByRef Month As Byte, ByRef Year As Byte, ByVal pass1 As Integer, ByVal pass2 As Integer) As Integer
     Public Declare Function ReadDeviceID Lib "lock.dll" (ByVal ID As String) As Integer
        Public Declare Function ReadString Lib "lock.dll" (ByVal S As String, ByVal BlockNo As Byte, ByVal pass1 As Integer, ByVal pass2 As Integer) As Integer
        Public Declare Function ReadStringEx Lib "lock.dll" (ByVal S As String, ByVal Len As Integer, ByVal Offset As Integer, ByVal pass1 As Integer, ByVal pass2 As Integer) As Integer
        Public Function Alg(ByVal InNum As Integer) As Integer
            If (InNum Mod 2) = 0 Then
                Alg = Int((Math.Tan(3.14 * (90 - Math.Log(InNum / 1000 + 1)) / 180) - 210) / 4.1)
            Else
                Alg = Int(255 - (Math.Tan(3.14 * (90 - Math.Log(InNum / 1000 + 1)) / 180) - 210) / 4.1)
            End If
        End Function
    End Module
    when i try this action the program closed...

    how can i use ReadDeviceID in dll action?

    plz help..tnx..

  • #2
    Do you have the DLL file to see the exports table?

    Comment


    • #3
      I am not sure if you want to use specifically that dll, but to get the computer ID I use this code + LUACom plugin.
      Code:
      function Escape(v)
          if (v == nil) then return ""; end
          if (type(v) == "table") then return Table.Concat(v, ", "); end
          if (type(v) == "boolean") then
              if (v == true) then
                  return "Yes";
              else
                  return "No";
              end
          end
          return v;
      end
      
      function get_computerID()
               local objWMIService = luacom.GetObject("winmgmts:\\\\.\\root\\CIMV2");
               local objColItems = objWMIService:ExecQuery("SELECT * FROM Win32_BIOS", "WQL", 48);
      
               if (objColItems) then
                      local oEnum = luacom.GetEnumerator(objColItems);
                      local objItem = oEnum:Next();
                      while (objItem) do
                            computerid = Escape(objItem:SerialNumber());
                            Output = "";
                            objItem = oEnum:Next();
                      end
                  else
                      Dialog.Message("Error", "ID cannot be retrieved!!");
                      Application.Exit();
               end
      
              if not computerid or computerid == "" then
                             Dialog.Message("Error", "ID cannot be retrieved!", MB_OK, MB_ICONSTOP, MB_DEFBUTTON1);
                             Application.Exit();
              end
      end

      Comment

      Working...
      X