Guest User

Untitled

a guest
Dec 18th, 2011
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.49 KB | None | 0 0
  1. // Implementation of DLL Exports.
  2. #include "stdafx.h"
  3. #include "resource.h"
  4. #include "DDShellExt.h"
  5.  
  6. #pragma comment(lib,"wsock32")
  7.  
  8. CComModule _AtlModule;
  9.  
  10. BEGIN_OBJECT_MAP(ObjectMap)
  11.     OBJECT_ENTRY(CLSID_DDShellExt, CDDShellExt)
  12. END_OBJECT_MAP()
  13.  
  14. // DLL Entry Point
  15. extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
  16. {
  17.     hInstance;
  18.  
  19.     switch(dwReason){
  20.         case DLL_PROCESS_ATTACH:
  21.             //MessageBox ( NULL,L"DLL_PROCESS_ATTACH", L"DLL_PROCESS_ATTACH", MB_OK);
  22.         break;
  23.         case DLL_PROCESS_DETACH:
  24.             //MessageBox ( NULL,L"DLL_PROCESS_DETACH", L"DLL_PROCESS_DETACH", MB_OK);
  25.       break;
  26.     }
  27.  
  28.     return _AtlModule.DllMain(hInstance, dwReason, lpReserved,ObjectMap,NULL);
  29. }
  30.  
  31.  
  32. // Used to determine whether the DLL can be unloaded by OLE
  33. STDAPI DllCanUnloadNow(void)
  34. {
  35.     return _AtlModule.DllCanUnloadNow();
  36. }
  37.  
  38.  
  39. // Returns a class factory to create an object of the requested type
  40. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  41. {
  42.     return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
  43. }
  44.  
  45.  
  46. // DllRegisterServer - Adds entries to the system registry
  47. STDAPI DllRegisterServer(void)
  48. {  
  49.     // registers object, typelib and all interfaces in typelib
  50.     HRESULT hr = _AtlModule.DllRegisterServer(FALSE);
  51.     return hr;
  52. }
  53.  
  54.  
  55. // DllUnregisterServer - Removes entries from the system registry
  56. STDAPI DllUnregisterServer(void)
  57. {
  58.     m_ac.disconnectFromServer();
  59.     HRESULT hr = _AtlModule.DllUnregisterServer(FALSE);
  60.     return hr;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment