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.

77 lines
1.3 KiB

  1. /*++
  2. Copyright (c) 2002 Microsoft Corporation
  3. Module Name:
  4. CUASAppHack.cpp
  5. Abstract:
  6. This shim communicates with CUAS to pass AppHack information down to
  7. msctf.dll.
  8. Notes:
  9. This is a general purpose shim, but must be customized via the command
  10. line.
  11. History:
  12. 05/10/2002 yutakas Created
  13. --*/
  14. #include "precomp.h"
  15. IMPLEMENT_SHIM_BEGIN(CUASAppFix)
  16. #include "ShimHookMacro.h"
  17. APIHOOK_ENUM_BEGIN
  18. APIHOOK_ENUM_END
  19. typedef HRESULT (*PFNCUASAPPFIX)(LPCSTR lpCommandLine);
  20. VOID CUASAppFix(LPCSTR lpCommandLine)
  21. {
  22. if (!lpCommandLine) {
  23. LOGN(eDbgLevelError, "CUASAppFix requires a command line");
  24. return;
  25. }
  26. PFNCUASAPPFIX pfn;
  27. HMODULE hMod = LoadLibrary(TEXT("msctf.dll"));
  28. if (hMod) {
  29. pfn = (PFNCUASAPPFIX) GetProcAddress(hMod, "TF_CUASAppFix");
  30. if (pfn) {
  31. LOGN(eDbgLevelInfo, "Running CUASAppFix with %S", lpCommandLine);
  32. pfn(lpCommandLine);
  33. }
  34. }
  35. }
  36. BOOL
  37. NOTIFY_FUNCTION(
  38. DWORD fdwReason
  39. )
  40. {
  41. if (fdwReason == SHIM_STATIC_DLLS_INITIALIZED) {
  42. CUASAppFix(COMMAND_LINE);
  43. }
  44. return TRUE;
  45. }
  46. /*++
  47. Register hooked functions
  48. --*/
  49. HOOK_BEGIN
  50. CALL_NOTIFY_FUNCTION
  51. HOOK_END
  52. IMPLEMENT_SHIM_END