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.

58 lines
1.2 KiB

  1. #include "priv.h"
  2. #define INITGUID
  3. #include <initguid.h>
  4. #include <shlguid.h>
  5. #include "cryptmnu.h"
  6. DWORD g_DllRefCount;
  7. HINSTANCE g_hinst;
  8. extern "C" {
  9. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) ;
  10. }
  11. STDAPI DllCanUnloadNow(void);
  12. STDAPI DllGetClassObject(REFCLSID rclsid,REFIID riid,LPVOID *ppv);
  13. BOOL WINAPI
  14. DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) {
  15. switch(dwReason) {
  16. case DLL_PROCESS_ATTACH:
  17. DisableThreadLibraryCalls(hInstance);
  18. g_hinst = hInstance;
  19. break;
  20. case DLL_PROCESS_DETACH:
  21. break;
  22. case DLL_THREAD_ATTACH:
  23. break;
  24. case DLL_THREAD_DETACH:
  25. break;
  26. }
  27. return(TRUE);
  28. }
  29. STDAPI
  30. DllCanUnloadNow(void) {
  31. return(g_DllRefCount ? S_FALSE : S_OK);
  32. }
  33. STDAPI
  34. DllGetClassObject(REFCLSID rclsid,REFIID riid,LPVOID *ppv) {
  35. HRESULT hr;
  36. *ppv = NULL;
  37. if (!IsEqualCLSID(rclsid,CLSID_CryptMenu)) {
  38. return(CLASS_E_CLASSNOTAVAILABLE);
  39. }
  40. CCryptMenuClassFactory *pCF = new CCryptMenuClassFactory();
  41. if (!pCF) {
  42. return(E_OUTOFMEMORY);
  43. }
  44. hr = pCF->QueryInterface(riid,ppv);
  45. pCF->Release();
  46. return(hr);
  47. }