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.

54 lines
1.5 KiB

  1. #include "stdafx.h"
  2. #include "systray.h"
  3. #include <cscuiext.h>
  4. ///////////////////////////////////////////////////////////////////////////////
  5. // CSC_CheckEnable
  6. typedef BOOL (WINAPI* PFNCSCMSGPROCESS)(LPMSG);
  7. static HWND g_hWndCSC = NULL;
  8. static HMODULE g_hCSCUIDll = NULL;
  9. static PFNCSCMSGPROCESS g_pfnMsgProcess = NULL;
  10. BOOL CSC_CheckEnable(HWND hWnd, BOOL bSvcEnabled)
  11. {
  12. if ((g_hWndCSC && IsWindow(g_hWndCSC) && !bSvcEnabled) ||
  13. (((!g_hWndCSC) || !IsWindow(g_hWndCSC)) && bSvcEnabled))
  14. {
  15. if (!g_hCSCUIDll)
  16. g_hCSCUIDll = LoadLibrary(TEXT("cscui.dll"));
  17. if (g_hCSCUIDll)
  18. {
  19. PFNCSCUIINITIALIZE pfn = (PFNCSCUIINITIALIZE)GetProcAddress(g_hCSCUIDll, "CSCUIInitialize");
  20. g_pfnMsgProcess = (PFNCSCMSGPROCESS)GetProcAddress(g_hCSCUIDll, "CSCUIMsgProcess");
  21. if (pfn)
  22. {
  23. DWORD dwFlags = CI_INITIALIZE | CI_CREATEWINDOW;
  24. if (!bSvcEnabled)
  25. dwFlags = CI_TERMINATE | CI_DESTROYWINDOW;
  26. g_hWndCSC = (*pfn)(NULL, dwFlags);
  27. }
  28. }
  29. if (g_hCSCUIDll && !bSvcEnabled)
  30. {
  31. FreeLibrary(g_hCSCUIDll);
  32. g_hCSCUIDll = NULL;
  33. g_pfnMsgProcess = NULL;
  34. }
  35. }
  36. return(TRUE);
  37. }
  38. BOOL CSC_MsgProcess(LPMSG pMsg)
  39. {
  40. if (g_pfnMsgProcess)
  41. return (*g_pfnMsgProcess)(pMsg);
  42. return FALSE;
  43. }