Where ever possible, use golang.org/x/sys/windows instead of syscall (which has been deprecated since go1.11).
Using windows.LocalFree requires using unsafe.Pointer, which ensures that the Go garbage collector does not try to free memory pre-maturely if it was previously declared as a pointer.
Since syscall.Handle is part of API for vhd package, it was left unchanged.
For security descriptor functions, switch to using windows.SECURITY_DESCRIPTOR to avoid unnecessary byte manipulation and panics due to missing input validation and error checking.
Where ever possible, use
golang.org/x/sys/windows
instead ofsyscall
(which has been deprecated since go1.11).Using
windows.LocalFree
requires usingunsafe.Pointer
, which ensures that the Go garbage collector does not try to free memory pre-maturely if it was previously declared as a pointer.Since
syscall.Handle
is part of API forvhd
package, it was left unchanged.For security descriptor functions, switch to using
windows.SECURITY_DESCRIPTOR
to avoid unnecessary byte manipulation and panics due to missing input validation and error checking.