ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/Daodan/src/Daodan_Patch.c
(Generate patch)

Comparing Daodan/src/Daodan_Patch.c (file contents):
Revision 350 by rossy, Tue Jun 9 12:00:41 2009 UTC vs.
Revision 351 by rossy, Sat Jun 13 01:13:36 2009 UTC

# Line 1 | Line 1
1   #include "Daodan_Patch.h"
2   #include <windows.h>
3 + #include <stdlib.h>
4   #include <string.h>
5  
6   bool DDrPatch_MakeJump(void* from, void* to)
# Line 99 | Line 100 | bool DDrPatch_StrDup(int* dest, const ch
100                  return true;
101          }
102          else
103 +                return false;
104 + }
105 +
106 + bool DDrPatch_NOOP(char* dest, unsigned int length)
107 + {
108 +        DWORD oldp;
109 +        
110 +        if (VirtualProtect(dest, length, PAGE_EXECUTE_READWRITE, &oldp))
111 +        {
112 +                memset(dest, 0x90, length);
113 +                VirtualProtect(dest, length, oldp, &oldp);
114 +                return true;
115 +        }
116 +        else
117                  return false;
118   }

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)