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.

63 lines
974 B

  1. //+-------------------------------------------------------------------
  2. //
  3. // File: rpcsrv.cxx
  4. //
  5. // Contents: This file contins the DLL entry points
  6. // DllGetClassObject
  7. // DllCanUnloadNow
  8. //
  9. // Classes:
  10. //
  11. // History: 30-Nov-92 Rickhi Created
  12. //
  13. //---------------------------------------------------------------------
  14. #include <windows.h>
  15. #include <ole2.h>
  16. #include <rpccf.hxx>
  17. ULONG gUsage = 0;
  18. extern "C" BOOL WINAPI DllMain(HANDLE hDll,
  19. DWORD dwReason,
  20. LPVOID pvReserved)
  21. {
  22. return TRUE;
  23. }
  24. void GlobalRefs(BOOL fAddRef)
  25. {
  26. if (fAddRef)
  27. {
  28. gUsage++;
  29. }
  30. else
  31. {
  32. gUsage--;
  33. }
  34. }
  35. STDAPI DllCanUnloadNow(void)
  36. {
  37. return (gUsage == 0);
  38. }
  39. STDAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void FAR* FAR* ppv)
  40. {
  41. if (IsEqualCLSID(clsid, CLSID_RpcTest))
  42. {
  43. *ppv = (void *)(IClassFactory *) new CRpcTestClassFactory();
  44. }
  45. else
  46. {
  47. return E_UNEXPECTED;
  48. }
  49. return S_OK;
  50. }