Skip to content

Commit

Permalink
Merge pull request #7 from Microland/master
Browse files Browse the repository at this point in the history
Contribution from Microland
  • Loading branch information
iamacarpet committed Feb 21, 2019
2 parents b20aa59 + 492c9fd commit b69c326
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 19 deletions.
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 @@ -8,7 +8,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 @@ -8,7 +8,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 @@ -11,7 +11,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 @@ -6,8 +6,7 @@ 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 @@ -42,15 +41,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 @@ -13,7 +13,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 @@ -9,7 +9,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 @@ -9,7 +9,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

0 comments on commit b69c326

Please sign in to comment.