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.

78 lines
1.0 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. ldrctx.c
  5. Abstract:
  6. This module contains support for relocating executables.
  7. Author:
  8. Landy Wang (landyw) 8-Jul-1998
  9. Environment:
  10. User Mode only
  11. Revision History:
  12. --*/
  13. #include <ntos.h>
  14. #include <ldrp.h>
  15. VOID
  16. LdrpRelocateStartContext (
  17. IN PCONTEXT Context,
  18. IN LONG_PTR Diff
  19. )
  20. /*++
  21. Routine Description:
  22. This routine relocates the start context to mesh with the
  23. executable that has just been relocated.
  24. Arguments:
  25. Context - Supplies a context that needs editing.
  26. Diff - Supplies the difference from the based address to the relocated
  27. address.
  28. Return Value:
  29. None.
  30. --*/
  31. {
  32. Context->Eax += (ULONG)Diff;
  33. }
  34. VOID
  35. LdrpCorReplaceStartContext (
  36. IN PCONTEXT Context
  37. )
  38. /*++
  39. Routine Description:
  40. This routine replaces the initial address to run by one in mscoree.dll.
  41. Arguments:
  42. Context - Supplies a context that needs editing.
  43. Return Value:
  44. None.
  45. --*/
  46. {
  47. Context->Eax = (ULONG)CorExeMain;
  48. }