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.9 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. Module Name:
  4. ProAtlas2000.cpp
  5. Abstract:
  6. This application has an uninstallation program, PAtls2kUninst.exe. The uninstallation
  7. program will generate a temp file DEL??.TMP in %temp% dircetory. It will call
  8. CreateProcessA to start the DEL??.TMP. The DEL??.TMP will wait for the end of
  9. PAtls2kUninst.exe. Due to the quick return of CreateProcessA call, the
  10. PAtls2kUninst.exe ends before DEL??.TMP starts to wait. The DEL??.TMP quits because
  11. it cannot find PAtls2kUninst.exe. The uninstallation cannot be completed. This fix is to
  12. hook CreateProcessA to delay the return of the function for 3 seconds.
  13. History:
  14. 04/09/2001 zhongyl Created
  15. --*/
  16. #include "precomp.h"
  17. IMPLEMENT_SHIM_BEGIN(ProAtlas2000)
  18. #include "ShimHookMacro.h"
  19. //
  20. // Add APIs that you wish to hook to this macro construction.
  21. //
  22. APIHOOK_ENUM_BEGIN
  23. APIHOOK_ENUM_ENTRY(CreateProcessA)
  24. APIHOOK_ENUM_END
  25. BOOL
  26. APIHOOK(CreateProcessA)(
  27. LPSTR lpszImageName,
  28. LPSTR lpszCmdLine,
  29. LPSECURITY_ATTRIBUTES lpsaProcess,
  30. LPSECURITY_ATTRIBUTES lpsaThread,
  31. BOOL fInheritHandles,
  32. DWORD fdwCreate,
  33. LPVOID lpvEnvironment,
  34. LPSTR lpszCurDir,
  35. LPSTARTUPINFOA lpsiStartInfo,
  36. LPPROCESS_INFORMATION lppiProcInfo
  37. )
  38. {
  39. BOOL bReturn=TRUE;
  40. bReturn = ORIGINAL_API(CreateProcessA)(lpszImageName, lpszCmdLine, lpsaProcess, lpsaThread, fInheritHandles, fdwCreate, lpvEnvironment, lpszCurDir, lpsiStartInfo, lppiProcInfo);
  41. Sleep(5000);
  42. return bReturn;
  43. }
  44. /*++
  45. Register hooked functions
  46. --*/
  47. HOOK_BEGIN
  48. //
  49. // Add APIs that you wish to hook here. All API prototypes
  50. // must be declared in Hooks\inc\ShimProto.h. Compiler errors
  51. // will result if you forget to add them.
  52. //
  53. APIHOOK_ENTRY(KERNEL32.DLL, CreateProcessA)
  54. HOOK_END
  55. IMPLEMENT_SHIM_END