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

Give a more user friendly message when plugin program file does not e… #2730

Merged
merged 3 commits into from Dec 21, 2019

Conversation

@celeron533
Copy link
Collaborator

celeron533 commented Dec 14, 2019

Please follow the guide below

  • You will be asked some questions, please read them carefully and answer honestly

  • Put an x into all the boxes [ ] relevant to your pull request (like that [x])

  • Use Preview tab to see how your pull request will actually look like

  • Searched for similar pull requests

  • Compiled the code with Visual Studio

  • Require translation update

  • Require document update (readme.md, wikipage, etc)

What is the purpose of your pull request?

  • Bug fix
  • Improvement
  • New feature

Description of your pull request and other information

At least gives a hint to user to check whether the plugin program file exists on file system.

catch (System.ComponentModel.Win32Exception ex)
{
// do not use File.Exists(...), it can not handle the scenarios when the plugin file is in system environment path.
if ((uint)ex.ErrorCode == 0x80004005) // file not found

This comment has been minimized.

Copy link
@studentmain

studentmain Dec 15, 2019

Collaborator

FYI: #2729

This comment has been minimized.

Copy link
@celeron533

This comment has been minimized.

Copy link
@celeron533

celeron533 Dec 16, 2019

Author Collaborator

But it is uncommon to see "The specified executable is not a valid application for this OS platform." error. Only when run 64 bit program on 32 bit platform. or just have the bad image.

This comment has been minimized.

Copy link
@studentmain

studentmain Dec 16, 2019

Collaborator

Yes, it's uncommon, but there is😥. Just check if it is FileNotFound, if not, throw error with (or without) native error code so we won't misleading user.

This comment has been minimized.

Copy link
@celeron533

celeron533 Dec 16, 2019

Author Collaborator

Personally prefer to use current implementation to keep everything simple.

This comment has been minimized.

Copy link
@studentmain

studentmain Dec 16, 2019

Collaborator

Copy paste from here
https://docs.microsoft.com/zh-cn/windows/win32/seccrypto/common-hresult-values?redirectedfrom=MSDN

Name Description Value
S_OK Operation successful 0x00000000
E_ABORT Operation aborted 0x80004004
E_ACCESSDENIED General access denied error 0x80070005
E_FAIL Unspecified failure 0x80004005
...... ...... .......

Seems we should use native error code...

@celeron533 celeron533 force-pushed the celeron533:plugin_not_found branch from 95f18f5 to e44cc54 Dec 21, 2019
@celeron533 celeron533 merged commit 39ad6fc into shadowsocks:master Dec 21, 2019
1 check passed
1 check passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.