Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contribution from Microland #7

Merged
merged 10 commits into from
Feb 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added git
Empty file.
Empty file added master
Empty file.
2 changes: 1 addition & 1 deletion process.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"syscall"
"unsafe"

so "github.com/iamacarpet/go-win64api/shared"
so "github.com/Microland/go-win64api/shared"
)

// Windows API functions
Expand Down
2 changes: 1 addition & 1 deletion services.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"time"
"unsafe"

so "github.com/iamacarpet/go-win64api/shared"
so "github.com/Microland/go-win64api/shared"
"golang.org/x/sys/windows"
"golang.org/x/sys/windows/svc"
"golang.org/x/sys/windows/svc/mgr"
Expand Down
2 changes: 1 addition & 1 deletion sessions.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"syscall"
"unsafe"

so "github.com/iamacarpet/go-win64api/shared"
so "github.com/Microland/go-win64api/shared"
)

var (
Expand Down
54 changes: 47 additions & 7 deletions shared/software.go
Original file line number Diff line number Diff line change
@@ -1,23 +1,63 @@
package shared

import (

)

type Software struct {
DisplayName string `json:"displayName"`
DisplayVersion string `json:"displayVersion"`
Arch string `json:"arch"`
R_DisplayName string `json:"displayName"`
R_DisplayVersion string `json:"displayVersion"`
R_Arch string `json:"arch"`
R_Pub string `json:"publisher"`
R_InsDate string `json:"installDate"`
R_ESize uint64 `json:"estimatedSize"`
R_Contact string `json:"Contact"`
R_HelpLink string `json:"HelpLink"`
R_InstallSource string `json:"InstallSource"`
R_VersionMajor uint64 `json:"VersionMajor"`
R_VersionMinor uint64 `json:"VersionMinor"`
}

func (s *Software) Name() (string) {
return s.DisplayName
return s.R_DisplayName
}

func (s *Software) Version() (string) {
return s.DisplayVersion
return s.R_DisplayVersion
}

func (s *Software) Architecture() (string) {
return s.Arch
return s.R_Arch
}

func (s *Software) Publisher() (string) {
return s.R_Pub
}

func (s *Software) InstallDate() (string) {
return s.R_InsDate
}

func (s *Software) EstimatedSize() (uint64) {
return s.R_ESize
}

func (s *Software) Contact() (string) {
return s.R_Contact
}

func (s *Software) HelpLink() (string) {
return s.R_HelpLink
}

func (s *Software) InstallSource() (string) {
return s.R_InstallSource
}

func (s *Software) VersionMajor() (uint64) {
return s.R_VersionMajor
}

func (s *Software) VersionMinor() (uint64) {
return s.R_VersionMinor
}
56 changes: 50 additions & 6 deletions software.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ package winapi
import (
"fmt"
"golang.org/x/sys/windows/registry"

so "github.com/iamacarpet/go-win64api/shared"
so "github.com/Microland/go-win64api/shared"
)

func InstalledSoftwareList() ([]so.Software, error) {
Expand Down Expand Up @@ -40,15 +39,60 @@ func getSoftwareList(baseKey string, arch string) ([]so.Software, error) {
return nil, fmt.Errorf("Error reading from registry (subkey %s): %s", sw, err.Error())
}

dn, _, err := sk.GetStringValue("DisplayName")
if err == nil {
swv := so.Software{DisplayName: dn, Arch: arch}
dn, _, err := sk.GetStringValue("DisplayName")
if err == nil {
swv := so.Software{R_DisplayName: dn, R_Arch: arch}

dv, _, err := sk.GetStringValue("DisplayVersion")
if err == nil {
swv.DisplayVersion = dv
swv.R_DisplayVersion = dv
}

pub, _, err := sk.GetStringValue("Publisher")
if err == nil {
swv.R_Pub = pub
}

id, _, err := sk.GetStringValue("InstallDate")
if err == nil {
swv.R_InsDate = id
}

es, _, err := sk.GetIntegerValue("EstimatedSize")
if err == nil {
swv.R_ESize = es
}

cont, _, err := sk.GetStringValue("Contact")
if err == nil {
swv.R_Contact = cont
}

hlp, _, err := sk.GetStringValue("HelpLink")
if err == nil {
swv.R_HelpLink = hlp
}

isource, _, err := sk.GetStringValue("InstallSource")
if err == nil {
swv.R_InstallSource = isource
}

mver, _, err := sk.GetIntegerValue("VersionMajor")
if err == nil {
swv.R_VersionMajor = mver
}

mnver, _, err := sk.GetIntegerValue("VersionMinor")
if err == nil {
swv.R_VersionMinor = mnver
}



//fmt.Errorf("Error reading subkey list from registry: %s", err.Error())


swList = append(swList, swv)
}
}
Expand Down
2 changes: 1 addition & 1 deletion sysinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
ole "github.com/go-ole/go-ole"
"github.com/go-ole/go-ole/oleutil"

so "github.com/iamacarpet/go-win64api/shared"
so "github.com/Microland/go-win64api/shared"
)

func GetSystemProfile() (so.Hardware, so.OperatingSystem, so.Memory, []so.Disk, []so.Network, error) {
Expand Down
2 changes: 1 addition & 1 deletion users.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"time"
"unsafe"

so "github.com/iamacarpet/go-win64api/shared"
so "github.com/Microland/go-win64api/shared"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion winupdate.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
ole "github.com/go-ole/go-ole"
"github.com/go-ole/go-ole/oleutil"

so "github.com/iamacarpet/go-win64api/shared"
so "github.com/Microland/go-win64api/shared"
)

var updateResultStatus []string = []string{
Expand Down