csx 3 年之前
父節點
當前提交
69770f115c
共有 1 個文件被更改,包括 19 次插入14 次删除
  1. 19 14
      controllers/his_api_controller.go

+ 19 - 14
controllers/his_api_controller.go 查看文件

@@ -1,6 +1,7 @@
1 1
 package controllers
2 2
 
3 3
 import (
4
+	"C"
4 5
 	"archive/zip"
5 6
 	"bytes"
6 7
 	"encoding/json"
@@ -346,29 +347,33 @@ func GetBasBaseInfo() (jsonStr string, err error) {
346 347
 	handle := syscall.NewLazyDLL("SSCard.dll")
347 348
 	ReadCardBas := handle.NewProc("ReadCardBas")
348 349
 
349
-	str := make([]byte, 256)
350
-	str1 := make([]byte, 256)
350
+	var str2 [1024]C.char
351
+	var str3 [1024]C.char
352
+
353
+	//str := make([]byte, 256)
354
+	//str1 := make([]byte, 256)
351 355
 
352 356
 	//sssssswwwww
353 357
 	//a := 256
354 358
 
355
-	r, _, _ := ReadCardBas.Call((uintptr)(unsafe.Pointer(&str[0])), 1024, (uintptr)(unsafe.Pointer(&str1[0])), 1024)
356
-
357
-	p := (*byte)(unsafe.Pointer(r))
359
+	r, _, _ := ReadCardBas.Call(&str2, 1024, &str3, 1024)
360
+	fmt.Println(r)
361
+	//p := (*byte)(unsafe.Pointer(r))
358 362
 	// define a slice to fill with the p string
359 363
 	//data := make([]byte, 0)
360 364
 
361 365
 	// loop until find '\0'
362
-	if *p != 0 {
363
-		return string(str), nil
364
-
365
-		//data = append(data, *p)        // append 1 byte
366
-		//r += unsafe.Sizeof(byte(0))    // move r to next byte
367
-		//p = (*byte)(unsafe.Pointer(r)) // get the byte value
368
-	} else {
369
-		return "", nil
366
+	//if *p != 0 {
367
+	//
368
+	//	//data = append(data, *p)        // append 1 byte
369
+	//	//r += unsafe.Sizeof(byte(0))    // move r to next byte
370
+	//	//p = (*byte)(unsafe.Pointer(r)) // get the byte value
371
+	//} else {
372
+	//	return "", nil
373
+	//
374
+	//}
370 375
 
371
-	}
376
+	return "", nil
372 377
 
373 378
 }
374 379