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

Fix not exist WebProxy property #3

Closed
wants to merge 1 commit into from

Conversation

re3turn
Copy link
Contributor

@re3turn re3turn commented Jun 23, 2022

Signed-off-by: re3turn re3turn@gmail.com

The WebProxy property may not exist on the EC2 instance and GetProperty() fails.

PS C:/Users/re3turn/GolandProjects/wsus/windowsupdate/examples> .\install_updates.exe
panic: Exception occurred. (<nil>)

goroutine 1 [running]:
main.main()
        C:/Users/re3turn/GolandProjects/wsus/windowsupdate/examples/install_updates/main.go:24 +0x194

Signed-off-by: re3turn <re3turn@gmail.com>
@re3turn re3turn force-pushed the develop/fix_WebProxy branch from 2c5971c to b8da109 Compare June 23, 2022 06:09
@ceshihao
Copy link
Owner

ceshihao commented Jun 23, 2022

Signed-off-by: re3turn re3turn@gmail.com

The WebProxy property may not exist on the EC2 instance and GetProperty() fails.

PS C:/Users/re3turn/GolandProjects/wsus/windowsupdate/examples> .\install_updates.exe
panic: Exception occurred. (<nil>)

goroutine 1 [running]:
main.main()
        C:/Users/re3turn/GolandProjects/wsus/windowsupdate/examples/install_updates/main.go:24 +0x194

Cloud you please provide more info? I can not reproduce it on my OS.

If WebProxy not exists, it should be nil rather than an error.
Does Windows EC2 instance have any difference?

@ceshihao ceshihao self-requested a review June 23, 2022 07:22
@re3turn
Copy link
Contributor Author

re3turn commented Jun 23, 2022

  • OS: Windows Server 2019 Datacenter
  • Version: 10.0.17763

It always fails with my OS.
However, a local Windows OS will succeed.

@ceshihao
Copy link
Owner

  • OS: Windows Server 2019 Datacenter
  • Version: 10.0.17763

It always fails with my OS. However, a local Windows OS will succeed.

I try to reproduce the issue on such an OS. But it works.
Can you provide more information about the panic?

Edition: Windows Server 2019 Datacenter
Version: 1809
OS Build: 17763.2928

@re3turn
Copy link
Contributor Author

re3turn commented Jun 23, 2022

Why is that?
My Windows instance is on an Amazon VPC.
It fails for all Windows instances on the VPC.

@ceshihao
Copy link
Owner

@re3turn
Try to debug on WebProxy

$objSession = New-Object -ComObject "Microsoft.Update.Session"
$objSession.WebProxy

I reproduce the issue on aws EC2. WebProxy is nil.

However, on my Windows OS, WebProxy is

Address            : 
BypassList         : System.__ComObject
BypassProxyOnLocal : False
ReadOnly           : False
UserName           : 
AutoDetect         : True

I think it should be a bug on function toIDispatchErr() which does not handle nil correctly.
Could you please help to fix it?

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

Successfully merging this pull request may close these issues.

2 participants