|
@@ -14,6 +14,7 @@ import (
|
14
|
14
|
"github.com/shopspring/decimal"
|
15
|
15
|
"io"
|
16
|
16
|
"io/ioutil"
|
|
17
|
+ "log"
|
17
|
18
|
"math/rand"
|
18
|
19
|
"net/http"
|
19
|
20
|
"os"
|
|
@@ -346,14 +347,27 @@ func (c *HisApiController) Sscard() {
|
346
|
347
|
func GetBasBaseInfo() (jsonStr string, err error) {
|
347
|
348
|
//handle := syscall.MustLoadDLL("SSCard.dll")
|
348
|
349
|
|
349
|
|
- str := make([]byte, 1024)
|
350
|
|
- str1 := make([]byte, 1024)
|
351
|
|
- r, _, _ := ReadCardBas.Call((uintptr)(unsafe.Pointer(&str[0])), IntPtr(0), (uintptr)(unsafe.Pointer(&str1[0])), IntPtr(0))
|
|
350
|
+ h, e := syscall.LoadLibrary("SSCard.dll") //Make sure this DLL follows Golang machine bit architecture (64-bit in my case)
|
|
351
|
+ if e != nil {
|
|
352
|
+ log.Fatal(e)
|
|
353
|
+ }
|
|
354
|
+ defer syscall.FreeLibrary(h)
|
|
355
|
+ proc, e := syscall.GetProcAddress(h, "ReadCardBas") //One of the functions in the DLL
|
|
356
|
+ if e != nil {
|
|
357
|
+ log.Fatal(e)
|
|
358
|
+ }
|
352
|
359
|
|
353
|
|
- fmt.Println(r)
|
354
|
|
- fmt.Println(string(str))
|
|
360
|
+ n, _, _ := syscall.Syscall9(uintptr(proc), 0, 2, 2, 2, 2, 0, 0, 0, 0, 0) //Pay attention to the positioning of the parameter
|
|
361
|
+ fmt.Printf("Hello dll function returns %d\n", n)
|
355
|
362
|
|
356
|
|
- return string(str), nil
|
|
363
|
+ //str := make([]byte, 1024)
|
|
364
|
+ //str1 := make([]byte, 1024)
|
|
365
|
+ //r, _, _ := ReadCardBas.Call((uintptr)(unsafe.Pointer(&str[0])), IntPtr(0), (uintptr)(unsafe.Pointer(&str1[0])), IntPtr(0))
|
|
366
|
+ //
|
|
367
|
+ //fmt.Println(r)
|
|
368
|
+ //fmt.Println(string(str))
|
|
369
|
+ //
|
|
370
|
+ //return string(str), nil
|
357
|
371
|
}
|
358
|
372
|
|
359
|
373
|
func GetSFZBaseInfo() (jsonStr string, err error) {
|