awl icon indicating copy to clipboard operation
awl copied to clipboard

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

Open introspection3 opened this issue 1 year ago • 3 comments

  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 avatar Jul 12 '24 12:07 introspection3

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

introspection3 avatar Jul 12 '24 12:07 introspection3

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?

pymq avatar Jul 14 '24 10:07 pymq

@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)

introspection3 avatar Jul 16 '24 01:07 introspection3