Guest User

Untitled

a guest
Dec 18th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. int SetDeviceData(HANDLE handle,const char *TableName, const char *Data, const char *Options)
  2.  
  3. from ctypes import cdll
  4. import ctypes
  5.  
  6.  
  7. params = b"protocol=TCP,ipaddress=192.168.100.178,port=4370,timeout=2000,passwd="
  8.  
  9. zk = cdll.LoadLibrary("C:/Windows/System32/plcommpro.dll")
  10. conv = ctypes.create_string_buffer(params)
  11. handler = zk.Connect(conv)
  12.  
  13. print(handler)
  14.  
  15. zk.SetDeviceData.argtypes = ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p
  16.  
  17. table = b"user"
  18. data = b"Pin=1234ttPassword=1tName=Test"
  19. options = b''
  20.  
  21. p_table = ctypes.create_string_buffer(table)
  22. str_buf = ctypes.create_string_buffer(data)
  23. opt_buf = ctypes.create_string_buffer(options)
  24.  
  25. ret = zk.SetDeviceData(handler, p_table, str_buf, opt_buf)
  26.  
  27. table = "user"
  28. data = "Pin=19999tCardNo=13375401tPassword=1rnPin=2tCardNo=14128058tPassword=1"
  29. p_table = create_string_buffer(table)
  30. str_buf = create_string_buffer(data)
  31. ret = self.commpro.SetDeviceData(self.hcommpro, p_table, str_buf, "")
Add Comment
Please, Sign In to add comment