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.

53 lines
1.1 KiB

  1. #include "stdinc.h"
  2. FARPROC
  3. WINAPI
  4. SxApwGetKernel32ProcAddress(
  5. PCSTR pszProcName
  6. )
  7. {
  8. static HMODULE hmodKernel32;
  9. if (hmodKernel32 == NULL)
  10. {
  11. hmodKernel32 = GetModuleHandleW(L"Kernel32.dll");
  12. if (hmodKernel32 == NULL)
  13. return NULL;
  14. }
  15. return GetProcAddress(hmodKernel32, pszProcName);
  16. }
  17. BOOL
  18. WINAPI
  19. SxApwActivateActCtx(
  20. HANDLE hActCtx,
  21. ULONG_PTR *lpCookie
  22. )
  23. {
  24. typedef BOOL (WINAPI* PFN)(HANDLE hActCtx, ULONG_PTR *lpCookie);
  25. static PFN pfn;
  26. if (pfn == NULL)
  27. {
  28. pfn = reinterpret_cast<PFN>(SxApwGetKernel32ProcAddress("ActivateActCtx"));
  29. if (pfn == NULL)
  30. return FALSE;
  31. }
  32. return pfn(hActCtx, lpCookie);
  33. }
  34. BOOL
  35. WINAPI
  36. SxApwDeactivateActCtx(
  37. DWORD dwFlags,
  38. ULONG_PTR ulCookie
  39. )
  40. {
  41. typedef BOOL (WINAPI* PFN)(DWORD dwFlags, ULONG_PTR ulCookie);
  42. static PFN pfn;
  43. if (pfn == NULL)
  44. {
  45. pfn = reinterpret_cast<PFN>(SxApwGetKernel32ProcAddress("DeactivateActCtx"));
  46. if (pfn == NULL)
  47. return FALSE;
  48. }
  49. return pfn(dwFlags, ulCookie);
  50. }