Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
MKCLOS
Core Development Platform
coreospackage
Merge requests
!44
Diskdetails changes
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
Diskdetails changes
DiskDetails_WMIC_RelativePath
into
master
Overview
0
Commits
1
Pipelines
0
Changes
2
Closed
Sandeep S. Shewalkar
requested to merge
DiskDetails_WMIC_RelativePath
into
master
7 years ago
Overview
0
Commits
1
Pipelines
0
Changes
2
Expand
wmic full path added in command
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
40724686
1 commit,
7 years ago
2 files
+
19
−
8
Expand all files
Preferences
File browser
List view
Tree view
Compare changes
Inline
Side-by-side
Show whitespace changes
Show one file at a time
Search (e.g. *.vue) (Ctrl+P)
diskdetailshelper/gopsutil/disk_windows.go
+
8
−
2
Options
@@ -4,6 +4,7 @@ package gopsutil
import
(
"bytes"
"os"
"regexp"
"unsafe"
@@ -23,6 +24,8 @@ var (
provGetVolumeInformation
=
Modkernel32
.
NewProc
(
"GetVolumeInformationW"
)
)
const
WMIC_RELATIVE_PATH
=
"
\\
System32
\\
wbem
\\
wmic"
var
(
FileFileCompression
=
int64
(
16
)
// 0x00000010
FileReadOnlyVolume
=
int64
(
524288
)
// 0x00080000
@@ -197,8 +200,10 @@ func GetDiskSerialNumber(name string) string {
serialNumberArray
:=
[]
string
{}
serialNumberMap
:=
make
(
map
[
string
]
bool
)
windowsDirPath
:=
os
.
Getenv
(
"SYSTEMROOT"
)
cmd1
:=
&
exec
.
Cmd
{}
cmd1
=
exec
.
Command
(
"wmic"
,
"path"
,
"win32_physicalmedia"
,
"get"
,
"SerialNumber"
)
cmd1
=
exec
.
Command
(
windowsDirPath
+
WMIC_RELATIVE_PATH
,
"path"
,
"win32_physicalmedia"
,
"get"
,
"SerialNumber"
)
var
out1
bytes
.
Buffer
cmd1
.
Stdout
=
&
out1
commandError
:=
cmd1
.
Run
()
@@ -217,7 +222,8 @@ func GetDiskSerialNumber(name string) string {
}
cmd2
:=
&
exec
.
Cmd
{}
cmd2
=
exec
.
Command
(
"wmic"
,
"diskdrive"
,
"get"
,
"serialnumber"
)
cmd2
=
exec
.
Command
(
windowsDirPath
+
WMIC_RELATIVE_PATH
,
"diskdrive"
,
"get"
,
"serialnumber"
)
var
out2
bytes
.
Buffer
cmd2
.
Stdout
=
&
out2
commandError
=
cmd2
.
Run
()
Menu
Explore
Projects
Groups
Topics
Snippets