Add GetExePath func.
This commit is contained in:
@@ -34,3 +34,10 @@ type Service interface {
|
|||||||
LogWarning(format string, a ...interface{}) error
|
LogWarning(format string, a ...interface{}) error
|
||||||
LogInfo(format string, a ...interface{}) error
|
LogInfo(format string, a ...interface{}) error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns the full path of the running executable
|
||||||
|
// as reported by the system. Includes the executable
|
||||||
|
// image name.
|
||||||
|
func GetExePath() (exePath string, err error) {
|
||||||
|
return getExePath()
|
||||||
|
}
|
||||||
|
|||||||
@@ -104,6 +104,10 @@ func (ws *windowsService) LogInfo(format string, a ...interface{}) error {
|
|||||||
return writeToEventLog(ws.name, fmt.Sprintf(format, a ...), levelInfo)
|
return writeToEventLog(ws.name, fmt.Sprintf(format, a ...), levelInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getExePath() (exePath string, err error) {
|
||||||
|
return getModuleFileName()
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
advapi = syscall.MustLoadDLL("advapi32.dll")
|
advapi = syscall.MustLoadDLL("advapi32.dll")
|
||||||
kernel = syscall.MustLoadDLL("kernel32.dll")
|
kernel = syscall.MustLoadDLL("kernel32.dll")
|
||||||
|
|||||||
Reference in New Issue
Block a user