|
@@ -30,10 +30,10 @@ type HisApiController struct {
|
30
|
30
|
}
|
31
|
31
|
|
32
|
32
|
var (
|
33
|
|
- DllTestDef, _ = syscall.LoadDLL("SSCard.dll")
|
34
|
|
- add, _ = DllTestDef.FindProc("Init")
|
35
|
|
- ReadCardBas, _ = DllTestDef.FindProc("ReadCardBas")
|
36
|
|
- ReadIDCardBas, _ = DllTestDef.FindProc("ReadSFZ")
|
|
33
|
+ DllTestDef, LoadDllErr = syscall.LoadDLL("SSCard.dll")
|
|
34
|
+ add, FindPErr = DllTestDef.FindProc("Init")
|
|
35
|
+ ReadCardBas, FindPErr2 = DllTestDef.FindProc("ReadCardBas")
|
|
36
|
+ ReadIDCardBas, FindPErr3 = DllTestDef.FindProc("ReadSFZ")
|
37
|
37
|
)
|
38
|
38
|
|
39
|
39
|
func HisManagerApiRegistRouters() {
|
|
@@ -157,8 +157,9 @@ func (c *HisApiController) Sscard() {
|
157
|
157
|
if r == 0 {
|
158
|
158
|
switch id_card_type {
|
159
|
159
|
case 1:
|
160
|
|
- fmt.Println(ReadCardBas)
|
161
|
160
|
basStr, err := GetBasBaseInfo()
|
|
161
|
+ defer syscall.FreeLibrary(DllTestDef)
|
|
162
|
+
|
162
|
163
|
if err != nil {
|
163
|
164
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
|
164
|
165
|
return
|
|
@@ -344,19 +345,15 @@ func (c *HisApiController) Sscard() {
|
344
|
345
|
}
|
345
|
346
|
}
|
346
|
347
|
func GetBasBaseInfo() (jsonStr string, err error) {
|
347
|
|
- str := make([]byte, 256)
|
348
|
|
- str1 := make([]byte, 256)
|
349
|
|
- user32, _ := syscall.LoadLibrary("SSCard.dll")
|
350
|
|
- messageBox, _ := syscall.GetProcAddress(user32, "ReadCardBas")
|
351
|
|
- defer syscall.FreeLibrary(user32)
|
352
|
|
- r, _, _ := syscall.Syscall9(messageBox,
|
353
|
|
- 4,
|
354
|
|
- 0,
|
355
|
|
- (uintptr)(unsafe.Pointer(&str[0])),
|
356
|
|
- (uintptr)(unsafe.Pointer(&str1[0])),
|
357
|
|
- 0x00000003,
|
358
|
|
- 0, 0, 0, 0)
|
|
348
|
+ //handle := syscall.MustLoadDLL("SSCard.dll")
|
|
349
|
+
|
|
350
|
+ str := make([]byte, 1024)
|
|
351
|
+ str1 := make([]byte, 1024)
|
|
352
|
+ r, _, _ := ReadCardBas.Call((uintptr)(unsafe.Pointer(&str[0])), IntPtr(1024), (uintptr)(unsafe.Pointer(&str1[0])), IntPtr(1024))
|
|
353
|
+
|
359
|
354
|
fmt.Println(r)
|
|
355
|
+ fmt.Println(string(str))
|
|
356
|
+
|
360
|
357
|
return string(str), nil
|
361
|
358
|
}
|
362
|
359
|
|
|
@@ -2700,6 +2697,18 @@ func RemoveRepeatedCode(arr []string) (newArr []string) {
|
2700
|
2697
|
return
|
2701
|
2698
|
}
|
2702
|
2699
|
|
2703
|
|
-func StrPtr2(s string) uintptr {
|
2704
|
|
- return uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(s)))
|
|
2700
|
+func ShowMessage1(caption, text string, style uintptr) (result int) {
|
|
2701
|
+ user32, _ := syscall.LoadLibrary("SSCard.dll")
|
|
2702
|
+ messageBox, _ := syscall.GetProcAddress(user32, "MessageBoxW")
|
|
2703
|
+ defer syscall.FreeLibrary(user32)
|
|
2704
|
+
|
|
2705
|
+ ret, _, _ := syscall.Syscall9(messageBox,
|
|
2706
|
+ 4,
|
|
2707
|
+ 0,
|
|
2708
|
+ StrPtr(text),
|
|
2709
|
+ StrPtr(caption),
|
|
2710
|
+ style,
|
|
2711
|
+ 0, 0, 0, 0, 0)
|
|
2712
|
+ result = int(ret)
|
|
2713
|
+ return
|
2705
|
2714
|
}
|