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.

97 lines
2.1 KiB

  1. /*++
  2. Copyright (c) 2002 Microsoft Corporation
  3. Module Name:
  4. WordPerfectPresentation10.cpp
  5. Abstract:
  6. WordPerfect 2002 Presentation 10 expects WNetAddConnection to return ERROR_BAD_NET_NAME.
  7. The API is returning either ERROR_BAD_NETPATH or ERROR_NO_NET_OR_BAD_PATH
  8. Notes:
  9. This is an app specific shim.
  10. History:
  11. 09/20/2002 robkenny Created
  12. --*/
  13. #include "precomp.h"
  14. IMPLEMENT_SHIM_BEGIN(WordPerfectPresentation10)
  15. #include "ShimHookMacro.h"
  16. APIHOOK_ENUM_BEGIN
  17. APIHOOK_ENUM_ENTRY(WNetAddConnectionA)
  18. APIHOOK_ENUM_ENTRY(WNetAddConnectionW)
  19. APIHOOK_ENUM_END
  20. typedef DWORD (*_pfn_WNetAddConnectionA)(LPCSTR lpRemoteName, LPCSTR lpPassword, LPCSTR lpLocalName);
  21. typedef DWORD (*_pfn_WNetAddConnectionW)(LPCWSTR lpRemoteName, LPCWSTR lpPassword, LPCWSTR lpLocalName);
  22. /*++
  23. Error code ERROR_BAD_NET_NAME has been replaced with error ERROR_NO_NET_OR_BAD_PATH
  24. --*/
  25. DWORD
  26. APIHOOK(WNetAddConnectionA)(
  27. LPCSTR lpRemoteName, // network device name
  28. LPCSTR lpPassword, // password
  29. LPCSTR lpLocalName // local device name
  30. )
  31. {
  32. DWORD dwError = ORIGINAL_API(WNetAddConnectionA)(lpRemoteName, lpPassword, lpLocalName);
  33. if (dwError == ERROR_BAD_NETPATH || dwError == ERROR_NO_NET_OR_BAD_PATH)
  34. {
  35. dwError = ERROR_BAD_NET_NAME;
  36. }
  37. return dwError;
  38. }
  39. /*++
  40. Error code ERROR_BAD_NET_NAME has been replaced with error ERROR_NO_NET_OR_BAD_PATH
  41. --*/
  42. DWORD
  43. APIHOOK(WNetAddConnectionW)(
  44. LPCWSTR lpRemoteName, // network device name
  45. LPCWSTR lpPassword, // password
  46. LPCWSTR lpLocalName // local device name
  47. )
  48. {
  49. DWORD dwError = ORIGINAL_API(WNetAddConnectionW)(lpRemoteName, lpPassword, lpLocalName);
  50. if (dwError == ERROR_BAD_NETPATH || dwError == ERROR_NO_NET_OR_BAD_PATH)
  51. {
  52. dwError = ERROR_BAD_NET_NAME;
  53. }
  54. return dwError;
  55. }
  56. /*++
  57. Register hooked functions
  58. --*/
  59. HOOK_BEGIN
  60. APIHOOK_ENTRY(MPR.DLL, WNetAddConnectionA)
  61. APIHOOK_ENTRY(MPR.DLL, WNetAddConnectionW)
  62. HOOK_END
  63. IMPLEMENT_SHIM_END