Skip to content
New issue

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

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

Already on GitHub? # to your account

Switch from sycall to windows #295

Merged
merged 1 commit into from
Aug 7, 2023
Merged

Conversation

helsaawy
Copy link
Contributor

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.

@helsaawy helsaawy requested a review from a team as a code owner July 24, 2023 18:40
oa.ObjectName = &ntPath
oa.Attributes = windows.OBJ_CASE_INSENSITIVE

// The security descriptor is only needed for the first pipe.
if first {
if sd != nil {
//todo: does `sdb` need to be allocated on the heap, or can go allocate it?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you figure this todo out?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, i wasn't able to track it down in the docs or code
i figured we can dig into it in the future, when we clean up the code paths here (and move most of the code to dedicated pkg/pipe dir?)

@katiewasnothere katiewasnothere self-assigned this Jul 24, 2023
@msscotb msscotb self-assigned this Jul 26, 2023
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.

Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants