Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

vscode (use administrator) debug ," elevate.DoAsSystem" report bug #132

Open
introspection3 opened this issue Jul 12, 2024 · 3 comments
Open

Comments

@introspection3
Copy link

introspection3 commented Jul 12, 2024

  var tunDevice tun.Device
err := elevate.DoAsSystem(func() error {
	var err error
	tunDevice, err = tun.CreateTUNWithRequestedGUID(ifname, WintunGUID, mtu)
	if err != nil {
		return fmt.Errorf("create tun: %v", err)
	}
	return nil
})
if err != nil {
	return nil, fmt.Errorf("do as system: %v", err)
}

Exception has occurred: fatal error
Error getting throw reason: could not find symbol value for s
Stack:
0 0x000000000084a164 in runtime.winthrow
at D:/Go/src/runtime/signal_windows.go:349
1 0x000000000084a147 in runtime.lastcontinuehandler
at D:/Go/src/runtime/signal_windows.go:342
2 0x0000000000849d33 in runtime.sigtrampgo
at D:/Go/src/runtime/signal_windows.go:177
3 0x00007ff88a0740ba in ???
at ?:-1
4 0x0000000000868a8d in runtime.asmcgocall_landingpad
at D:/Go/src/runtime/asm_amd64.s:867
5 0x0000000000868b03 in runtime.asmcgocall
at D:/Go/src/runtime/asm_amd64.s:918
6 0x000000c000329500 in ???
at ?:-1
7 0x00000000007fa692 in runtime.cgocall
at D:/Go/src/runtime/cgocall.go:175
8 0x0000000000865bbd in syscall.SyscallN
at D:/Go/src/runtime/syscall_windows.go:544
9 0x00000000008657f5 in syscall.Syscall
at D:/Go/src/runtime/syscall_windows.go:482
10 0x0000000000ba538d in golang.org/x/sys/windows.CloseHandle
at C:/Users//go/pkg/mod/golang.org/x/[email protected]/windows/zsyscall_windows.go:1674
11 0x0000000000bb1c5f in golang.zx2c4.com/wireguard/windows/elevate.DoAsSystem
at C:/Users//go/pkg/mod/golang.zx2c4.com/wireguard/[email protected]/elevate/doas.go:98

     at  iface_windows.go:32
@introspection3
Copy link
Author

if we don't use elevate.DoAsSystem will be fine

@pymq
Copy link
Member

pymq commented Jul 14, 2024

Hi @introspection3, thanks for the report

I'm not too familiar with Windows, do you know any API to check if process is already run from admin user? Or is this some debug mode specific bug? Would you like to send a PR to fix this?

@introspection3
Copy link
Author

@pymq hi,dear sir,I don't know the reason ,maybe just because of " elevate.DoAsSystem " can't be used when vscode(has admin right)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants