MCPcopy Create free account
hub / github.com/1401199262/MemoryVirtualization / main

Function main

Virtualization.cpp:97–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95
96
97int main()
98{
99 WCHAR title[64];
100 _snwprintf_s(title, sizeof(title), L"PID: %lx", GetCurrentProcessId());
101 SetConsoleTitleW(title);
102
103 Init();
104 hidemem = AllocateHiddenMemory(NULL, 1,
105 [](DWORD64 lpAddress, size_t _Size) {
106 for (int i = 0; i < _Size; i++)
107 {
108 ((char*)lpAddress)[i] += (char)6;
109 ((char*)lpAddress)[i] = ((char*)lpAddress)[i] ^ 'a';
110 }
111 },
112 [](DWORD64 lpAddress, size_t _Size) {
113 for (int i = 0; i < _Size; i++)
114 {
115 ((char*)lpAddress)[i] = ((char*)lpAddress)[i] ^ 'a';
116 ((char*)lpAddress)[i] -= (char)6;
117 }
118 });
119
120 std::thread ReadThread1(ReadThreadProc2);
121 std::thread ReadThread2(ReadThreadProc3);
122
123 //BOOL MessageBoxState = TRUE;
124
125 while (1)
126 {
127 printf("Allocated %llx\n\n", hidemem);
128
129 ULONGLONG tick = GetTickCount64();
130
131 //R/W ==========================================================================================
132 //m.lock();
133 *(DWORD64*)hidemem += 1;
134 printf("ReadWriteTime %llu ms Data:%llx\n", GetTickCount64() - tick, *(DWORD64*)hidemem);
135 //m.unlock();
136 //R/W ==========================================================================================
137
138 //Execute =======================================================================================
139 //tick = GetTickCount64(); 请查看当前文件头部的锁
140 //m.lock();
141 //if (ExecuteHiddenMemory())
142 // printf("ExecuteTime %llu ms \n", GetTickCount64() - tick);
143 //else
144 // printf("Execute Failed\n");
145 //m.unlock();
146 //Execute =======================================================================================
147
148
149 //SEH ===========================================================================================
150 tick = GetTickCount64();
151 //m.lock();
152 if(CheckSEH())
153 printf("Support SEH %llu ms\n", GetTickCount64() - tick);
154 //m.unlock();

Callers

nothing calls this directly

Calls 4

InitFunction · 0.85
AllocateHiddenMemoryFunction · 0.85
CheckSEHFunction · 0.85
FreeHiddenMemoryFunction · 0.85

Tested by

no test coverage detected