Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.1 KiB

  1. #include "stdafx.h"
  2. #define RAS_BOGUS_AUTHFAILCODE_1 84
  3. #define RAS_BOGUS_AUTHFAILCODE_2 74389484
  4. DWORD RasErrorToIDS(DWORD dwErr)
  5. {
  6. //DWORD ev;
  7. if(dwErr==RAS_BOGUS_AUTHFAILCODE_1 || dwErr==RAS_BOGUS_AUTHFAILCODE_2)
  8. {
  9. // DebugTrace(("RAS returned bogus AUTH error code %08x. Munging...\r\n", dwErr));
  10. return IDS_PPPRANDOMFAILURE;
  11. }
  12. if((dwErr>=653 && dwErr<=663) || (dwErr==667) || (dwErr>=669 && dwErr<=675))
  13. {
  14. OutputDebugString(TEXT("Got random RAS MEDIA error!\r\n"));
  15. return IDS_MEDIAINIERROR;
  16. }
  17. switch(dwErr)
  18. {
  19. default:
  20. return IDS_PPPRANDOMFAILURE;
  21. case SUCCESS:
  22. return 0;
  23. case ERROR_DOWNLOAD_NOT_FOUND:
  24. return IDS_DOWNLOAD_NOT_FOUND;
  25. case ERROR_DOWNLOADIDNT:
  26. return IDS_CANTDOWNLOAD;
  27. case ERROR_LINE_BUSY:
  28. return IDS_PHONEBUSY;
  29. case ERROR_NO_ANSWER:
  30. return IDS_NOANSWER;
  31. case ERROR_VOICE_ANSWER:
  32. case ERROR_NO_CARRIER:
  33. return IDS_RASNOCARRIER;
  34. case ERROR_NO_DIALTONE:
  35. return IDS_NODIALTONE;
  36. case ERROR_HARDWARE_FAILURE: // modem turned off
  37. case ERROR_PORT_ALREADY_OPEN: // procomm/hypertrm/RAS has COM port
  38. case ERROR_PORT_OR_DEVICE: // got this when hypertrm had the device open -- jmazner
  39. return IDS_NODEVICE;
  40. case ERROR_USER_DISCONNECTION:
  41. return IDS_USERCANCELEDDIAL;
  42. case ERROR_BUFFER_INVALID: // bad/empty rasdilap struct
  43. case ERROR_BUFFER_TOO_SMALL: // ditto?
  44. case ERROR_CANNOT_FIND_PHONEBOOK_ENTRY: // if connectoid name in registry is wrong
  45. return IDS_TCPINSTALLERROR;
  46. case ERROR_AUTHENTICATION_FAILURE: // get this on actual CHAP reject
  47. return IDS_PPPRANDOMFAILURE;
  48. case ERROR_PPP_TIMEOUT: // get this on CHAP timeout
  49. return IDS_TIMEOUT;
  50. case ERROR_REMOTE_DISCONNECTION: // Ascend drops connection on auth-fail
  51. return IDS_PPPRANDOMFAILURE;
  52. case ERROR_AUTH_INTERNAL: // got this on random POP failure
  53. case ERROR_PROTOCOL_NOT_CONFIGURED: // get this if LCP fails
  54. case ERROR_PPP_NO_PROTOCOLS_CONFIGURED: // get this if IPCP addr download gives garbage
  55. return IDS_PPPRANDOMFAILURE;
  56. case ERROR_USERCANCEL:
  57. return IDS_USERCANCELEDDIAL;
  58. }
  59. return (DWORD)(-1);
  60. }