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.

88 lines
1.7 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. WordPerfect9_3.cpp
  5. Abstract:
  6. WORDPERFECT 9 - Mapping Network Drives from Open / Save / Save As Dialogs:
  7. Notes:
  8. This is an application specific shim.
  9. History:
  10. 02/21/2001 a-larrsh Created
  11. --*/
  12. #include "precomp.h"
  13. IMPLEMENT_SHIM_BEGIN(WordPerfect9_3)
  14. #include "ShimHookMacro.h"
  15. APIHOOK_ENUM_BEGIN
  16. APIHOOK_ENUM_ENTRY(SHGetSpecialFolderLocation)
  17. APIHOOK_ENUM_END
  18. // typedef HRESULT (WINAPI *_pfn_SHGetSpecialFolderLocation)(HWND hwndOwner, int nFolder, LPITEMIDLIST *ppidl);
  19. /*++
  20. Hook SHGetDesktopFolder to get the IShellFolder Interface Pointer.
  21. --*/
  22. HRESULT
  23. APIHOOK(SHGetSpecialFolderLocation)(
  24. HWND hwndOwner,
  25. int nFolder,
  26. LPITEMIDLIST *ppidl
  27. )
  28. {
  29. if (hwndOwner == NULL && nFolder == 0x11 && (*ppidl) == NULL)
  30. {
  31. DWORD dwReturn = WNetConnectionDialog(hwndOwner, RESOURCETYPE_DISK);
  32. switch(dwReturn)
  33. {
  34. case NO_ERROR:
  35. DPFN( eDbgLevelInfo, "Creating NETWORK CONNECTIONS dialog Successful");
  36. break;
  37. case ERROR_INVALID_PASSWORD:
  38. case ERROR_NO_NETWORK:
  39. case ERROR_EXTENDED_ERROR:
  40. DPFN( eDbgLevelWarning, "Creating NETWORK CONNECTIONS dialog Successful");
  41. break;
  42. case ERROR_NOT_ENOUGH_MEMORY:
  43. default:
  44. DPFN( eDbgLevelError, "Creating NETWORK CONNECTIONS dialog Failed");
  45. break;
  46. }
  47. return NOERROR;
  48. }
  49. else
  50. {
  51. return ORIGINAL_API(SHGetSpecialFolderLocation)(hwndOwner, nFolder, ppidl);
  52. }
  53. }
  54. /*++
  55. Register hooked functions
  56. --*/
  57. HOOK_BEGIN
  58. APIHOOK_ENTRY(SHELL32.DLL, SHGetSpecialFolderLocation)
  59. HOOK_END
  60. IMPLEMENT_SHIM_END