Source code of Windows XP (NT5)
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.

107 lines
2.9 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1999-2000 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // GlobalFuncs.cpp
  7. //
  8. // Description:
  9. // Contains the definitions of a few unrelated global functions
  10. //
  11. // Maintained By:
  12. // Vij Vasu (Vvasu) 08-MAR-2000
  13. //
  14. //////////////////////////////////////////////////////////////////////////////
  15. //////////////////////////////////////////////////////////////////////////////
  16. // Include Files
  17. //////////////////////////////////////////////////////////////////////////////
  18. // The precompiled header.
  19. #include "pch.h"
  20. // For setupapi functions and constants.
  21. #include <setupapi.h>
  22. // Needed by Dll.h
  23. #include "CFactory.h"
  24. // For g_hInstance
  25. #include "Dll.h"
  26. //////////////////////////////////////////////////////////////////////////////
  27. //++
  28. //
  29. // UINT
  30. // g_GenericSetupQueueCallback
  31. //
  32. // Description:
  33. // A generic callback used by SetupAPI file operations.
  34. //
  35. // Arguments:
  36. // pvContextIn
  37. // Context used by this function. Ignored.
  38. //
  39. // uiNotificationIn
  40. // The type of notification being sent.
  41. //
  42. // uiParam1In
  43. // uiParam2In
  44. // Additional notification information.
  45. //
  46. //
  47. // Return Value:
  48. // During the SPFILENOTIFY_DELETEERROR notification, FILEOP_SKIP is returned
  49. // if the file does not exist. Otherwise, FILEOP_ABORT is returned.
  50. //
  51. // FILEOP_DOIT is returned in all other cases.
  52. //
  53. // Exceptions Thrown:
  54. // None
  55. //
  56. //--
  57. //////////////////////////////////////////////////////////////////////////////
  58. UINT
  59. CALLBACK
  60. g_GenericSetupQueueCallback(
  61. PVOID // pvContextIn // context used by the callback routine
  62. , UINT uiNotificationIn // queue notification
  63. , UINT_PTR uiParam1In // additional notification information
  64. , UINT_PTR // uiParam2In // additional notification information
  65. )
  66. {
  67. BCATraceScope( "" );
  68. UINT uiRetVal = FILEOP_DOIT;
  69. switch( uiNotificationIn )
  70. {
  71. case SPFILENOTIFY_DELETEERROR:
  72. {
  73. // For this notification uiParam1In is a pointer to a FILEPATHS structure.
  74. FILEPATHS * pfFilePaths = reinterpret_cast< FILEPATHS * >( uiParam1In );
  75. if ( pfFilePaths->Win32Error == ERROR_FILE_NOT_FOUND )
  76. {
  77. // If the file to be deleted was not found, just skip it.
  78. uiRetVal = FILEOP_SKIP;
  79. } // if: the file to be deleted does not exist.
  80. else
  81. {
  82. BCATraceMsg2(
  83. "g_GenericSetupQueueCallback() => Error %#08x has occurred while deleting a file '%s'. Aborting."
  84. , pfFilePaths->Win32Error
  85. , pfFilePaths->Target
  86. );
  87. uiRetVal = FILEOP_ABORT;
  88. } // else: some other error occurred.
  89. }
  90. break;
  91. }
  92. return uiRetVal;
  93. } //*** g_GenericSetupQueueCallback()