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.1 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. --*/
  12. #include <ldrp.h>
  13. #include <ntos.h>
  14. VOID
  15. LdrpRelocateStartContext (
  16. IN PCONTEXT Context,
  17. IN LONG_PTR Diff
  18. )
  19. /*++
  20. Routine Description:
  21. This routine adjustss the initial function address to correspond to the
  22. an executable that has just been relocated.
  23. Arguments:
  24. Context - Supplies a pointer to a context record.
  25. Diff - Supplies the difference from the based address to the relocated
  26. address.
  27. Return Value:
  28. None.
  29. --*/
  30. {
  31. Context->Rcx += Diff;
  32. }
  33. VOID
  34. LdrpCorReplaceStartContext (
  35. IN PCONTEXT Context
  36. )
  37. /*++
  38. Routine Description:
  39. This routine replaces the initial function address in the specified context
  40. record.
  41. Arguments:
  42. Context - Supplies a pointer to a context record.
  43. Return Value:
  44. None.
  45. --*/
  46. {
  47. Context->Rcx = (ULONG64)CorExeMain;
  48. }