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.

99 lines
2.7 KiB

  1. /*****************************************************************************
  2. *
  3. * fnd.c - Find ... On the Internet
  4. *
  5. *****************************************************************************/
  6. #include "fnd.h"
  7. /*****************************************************************************
  8. *
  9. * The sqiffle for this file.
  10. *
  11. *****************************************************************************/
  12. #define sqfl sqflDll
  13. /*****************************************************************************
  14. *
  15. * DllGetClassObject
  16. *
  17. * OLE entry point. Produces an IClassFactory for the indicated GUID.
  18. *
  19. *****************************************************************************/
  20. STDAPI
  21. DllGetClassObject(REFCLSID rclsid, RIID riid, PPV ppvObj)
  22. {
  23. HRESULT hres;
  24. EnterProc(DllGetClassObject, (_ "G", rclsid));
  25. if (IsEqualIID(rclsid, &CLSID_Fnd)) {
  26. hres = CFndFactory_New(riid, ppvObj);
  27. } else {
  28. *ppvObj = 0;
  29. hres = CLASS_E_CLASSNOTAVAILABLE;
  30. }
  31. ExitOleProcPpv(ppvObj);
  32. return hres;
  33. }
  34. /*****************************************************************************
  35. *
  36. * DllCanUnloadNow
  37. *
  38. * OLE entry point. Fail iff there are outstanding refs.
  39. *
  40. ;begin_internal
  41. * There is an unavoidable race condition between DllCanUnloadNow
  42. * and the creation of a new reference: Between the time we
  43. * return from DllCanUnloadNow() and the caller inspects the value,
  44. * another thread in the same process may decide to call
  45. * DllGetClassObject, thus suddenly creating an object in this DLL
  46. * when there previously was none.
  47. *
  48. * It is the caller's responsibility to prepare for this possibility;
  49. * there is nothing we can do about it.
  50. ;end_internal
  51. *
  52. *****************************************************************************/
  53. STDMETHODIMP
  54. DllCanUnloadNow(void)
  55. {
  56. SquirtSqflPtszV(sqfl, TEXT("DllCanUnloadNow() - g_cRef = %d"), g_cRef);
  57. return g_cRef ? S_FALSE : S_OK;
  58. }
  59. /*****************************************************************************
  60. *
  61. * Entry32
  62. *
  63. * DLL entry point.
  64. *
  65. *****************************************************************************/
  66. BOOL APIENTRY
  67. Entry32(HINSTANCE hinst, DWORD dwReason, LPVOID lpReserved)
  68. {
  69. switch (dwReason) {
  70. case DLL_PROCESS_ATTACH:
  71. g_hinst = hinst;
  72. DisableThreadLibraryCalls(hinst);
  73. #ifdef DEBUG
  74. sqflCur = GetProfileInt(TEXT("DEBUG"), TEXT("InetFind"), 0);
  75. SquirtSqflPtszV(sqfl, TEXT("LoadDll - InetFind"));
  76. #endif
  77. }
  78. return 1;
  79. }
  80. /*****************************************************************************
  81. *
  82. * The long-awaited CLSID
  83. *
  84. *****************************************************************************/
  85. #include <initguid.h>
  86. DEFINE_GUID(CLSID_Fnd, 0x37865980, 0x75d1, 0x11cf,
  87. 0xbf,0xc7,0x44,0x45,0x53,0x54,0,0);