草庐IT

dll修复

全部标签

windows - 通过在 Go 中调用 Windows DLL 发送 ARP 请求不起作用

我正在尝试调用WindowsAPISendARP从Go在Windows上发送arp请求,但它总是返回1168,又名ERROR_NOT_FOUND,MSDN对此错误代码的描述:Elementnotfound.ThiserrorisreturnedonWindowsVistaifthetheSrcIpparameterdoesnotspecifyasourceIPv4addressonaninterfaceonthelocalcomputerortheINADDR_ANYIPaddress(anIPv4addressof0.0.0.0).但我在Windows7上,而且我确实指定了正确的源I

unit-testing - 如何修复测试用例中的 "missing type in composite literal"

我正在尝试为函数ReadField()编写测试代码,但我在定义测试用例时遇到了困难。它给出了一个错误“复合文字中缺少类型”。我相信这只是一些语法错误。我已经尝试在函数体之外定义结构体,但它仍然会给出相同的错误。ReadField(string,string,bool)(bool,string)funcTestReadField(t*testing.T){testCases:=[]struct{NamestringInputstruct{FirstStringstringSecondStringstringSomeBoolbool}Expectedstruct{IsValidboolMe

go - 在 Go 脚本中运行 'syntax error: A unknown token can’ 时如何修复 `exec.Command` t go here'

我正在尝试在我的Go脚本中使用osascript运行此AppleScript命令,但出现错误0:1:syntaxerror:Aunknowntokencan'tgohere.(-2740)。这是在终端中运行时效果很好的命令!/usr/bin/osascript-e'onrun{f,c}'-e'告诉应用程序“Finder”将(POSIX文件f作为别名)的注释设置为c'-eend"/Users/computerman/Desktop/testfile.png""Hello,World"我下面的Go脚本实际上输出了上面的字符串,我可以直接在终端中剪切和粘贴它并且它可以工作。但是,运行Go脚本

go - 如何修复 `can' t 在 helm 中的 _helpers.tpl 中评估类型接口(interface) {}` 中的字段 extraHosts

我正在尝试从_helpers.tpl中Helm的Umbrella图表中获取一些值但出于某种原因我收到错误executing"gluu.ldaplist"at:can'tevaluatefieldextraHostsintypeinterface{}这就是我想要做的。_helpers.ptl{{-define"gluu.ldaplist"-}}{{-$hosts:=.Values.ldap.extraHosts-}}{{-$genLdap:=dict"host"(printf"%s-%s".Release.Name.Values.ldapType)"port".Values.ldapPo

go - 如何修复 'constant x oveflows byte' 错误?

你好,我正在尝试用常量制作一个字节slice,但我收到了constantxoverflowsbyte错误。这是我的常量:const(Starttrame1=0x10AStarttrame2=0x10BStarttrame3=0X10CStarttrame4=0X10DStarttrame5=0X10EStarttrame6=0x10F)下面是我声明slice的方式:varstartValues=[6]byte{Starttrame1,Starttrame2,Startrame3,Starttrame4,Starttrame5,Starttrame6}每次构建时,我都会得到constan

linux - Golang,在Linux中加载Windows DLL

我们的vendor提供了可在Windows上运行的DLL。是否可以使用Go加载自定义xxx.dll文件并在Linux中使用其功能?像这样:https://github.com/golang/go/wiki/WindowsDLLs 最佳答案 简短的回答是“不”:当您“加载”动态链接库时,它不仅实际加载(如从文件中读取),而且链接到您的地址空间运行程序——通过操作系统提供的特殊方式(在基于Linux的系统上,至少在x86/amd64平台上是一个外部进程;在Windows上,它是一个内核设施,AFAIK)。换句话说,加载动态链接库涉及在您

go - 如何修复此导入?

main_test.gopackagemain_testimport("log""os""testing"".")funcTestMain(m*testing.M){a=main.App{}a.Init(os.Getenv("TEST_DB_USERNAME"),os.Getenv("TEST_DB_PASSWORD"),os.Getenv("TEST_DB_NAME"))ensureTableExists()code:=m.Run()clearTable()os.Exit(code)}应用程序去packagemainimport("database/sql""fmt""log""gi

go - 如何修复 Golang 中单值上下文错误的多值?

packagemainimport"fmt"funcmain(){fmt.Println("Enteranumber:")varaddendOneint=fmt.Scan()fmt.Println("Enteranothernumber:")varaddendTwoint=fmt.Scan()sum:=addendOne+addendTwofmt.Println(addendOne,"+",addendTwo,"=",sum)}这引发了一个错误:multiplevaluesinsingle-valuecontext.为什么会发生这种情况以及我们如何解决它?

go - 如何调用自定义dll文件中的函数

现在我得到了这样描述的函数intReadCard(char*room,char*gate,char*stime,char*guestname,char*guestid,char*lift,char*track1,char*track2,long*cardno,int*st,int*Breakfast);`这就是我做的room:=""gate:=""stime:=""guestname:=""guestid:=""lift:=""track1:=""track2:=""cardno:=int64(0)st:=int64(0)Breakfast:=int64(0)MAINDLL,_:=sy

go - 如何在我的 go 程序中删除 wpcap.dll 的需要?

我在我的程序中使用了gopacket。在Linux上,它运行完美。但是在Windows上,如果我之前没有安装WinPcap,整个程序就会崩溃。我的计划是检查是否安装了WinPcap,如果没有安装则通知用户他需要它才能使用100%的所有功能。但我还没有说到这一点。如果WinPcap不可用,我就不能使用gopacket。我的意思是......没有一行代码(=>崩溃)有人知道我该如何解决这个问题吗?我实际上不需要gopacket。我的计划是,如果安装了,很好,super!如果没有,不关心...做其他事情。但现在我有两个选择...完全删除gopacket或找到一种无需wpcap.dll即可启动