Skip to content

Commit

Permalink
Use KEY_WOW64_64KEY to access MachineGuid (#7294)
Browse files Browse the repository at this point in the history
KEY_WOW64_64KEY on a 64-bit OS means that the registry access, no matter if it's a 32 or 64 bit process, will access the 64 bit registry view.

This fixes an issue where the Metricbeat windows-service metricset would not start if the 32-bit binary was used on a 64-bit machine. The flag will have no effect on 32-bit machines.
  • Loading branch information
andrewkroh authored and ruflin committed Jun 12, 2018
1 parent b3c5397 commit 434c567
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ https://github.com/elastic/beats/compare/v6.2.3...master[Check the HEAD diff]
- Add mapping for docker metrics per cpu. {pull}6843[6843]
- Ensure canonical naming for JMX beans is disabled in Jolokia module. {pull}7047[7047]
- Fix field mapping for the system process CPU ticks fields. {pull}7230[7230]
- Fix Windows service metricset when using a 32-bit binary on a 64-bit OS. {pull}7294[7294]

*Packetbeat*

Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/windows/service/service_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ func getMachineGUID() (string, error) {
const path = `SOFTWARE\Microsoft\Cryptography`
const name = "MachineGuid"

k, err := registry.OpenKey(key, path, registry.READ)
k, err := registry.OpenKey(key, path, registry.READ|registry.WOW64_64KEY)
if err != nil {
return "", errors.Wrapf(err, `failed to open HKLM\%v`, path)
}
Expand Down

0 comments on commit 434c567

Please sign in to comment.