Skip to content

Commit

Permalink
Fix merge errors
Browse files Browse the repository at this point in the history
  • Loading branch information
buzzer-re committed Jul 25, 2023
1 parent c64343b commit e14c48e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 28 deletions.
27 changes: 4 additions & 23 deletions Shinigami/Ichigo/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ BOOL Utils::SaveToFile(const wchar_t* filename, Memory* data, BOOL Paginate)
{
HANDLE hFile = CreateFileW(filename, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
BOOL success = TRUE;

if (hFile == INVALID_HANDLE_VALUE) {
return false;
}
Expand All @@ -15,29 +15,11 @@ BOOL Utils::SaveToFile(const wchar_t* filename, Memory* data, BOOL Paginate)
DWORD OldProt;

VirtualProtect(data->Addr, data->Size, PAGE_READWRITE, &OldProt);

success = WriteFile(hFile, data->Addr, data->Size, &BytesWritten, NULL) && (BytesWritten == data->Size);

VirtualProtect(data->Addr, data->Size, OldProt, &OldProt);

if (Paginate)
{
// Write based on the VirtualQuery output
MEMORY_BASIC_INFORMATION mbi;
DWORD Written = 0;
while (Written < data->Size)
{
VirtualQuery(data->Addr + Written, &mbi, sizeof(mbi));
WriteFile(hFile, data->Addr + Written, mbi.RegionSize, &BytesWritten, NULL);
Written += BytesWritten;
}
}
else
{
success = WriteFile(hFile, data->Addr, data->Size, &BytesWritten, NULL) && (BytesWritten == data->Size);
}


CloseHandle(hFile);

return TRUE;
Expand Down Expand Up @@ -66,7 +48,7 @@ std::wstring Utils::BuildFilenameFromProcessName(const wchar_t* suffix)
// Get filename
//
wchar_t* exeName = PathFindFileNameW(exePath);

//
// Get the . pos
//
Expand All @@ -92,6 +74,5 @@ MEM_ERROR Utils::IsReadWritable(ULONG_PTR* Address)
return INVALID_MEMORY_AREA;
}

return (MEM_ERROR) (mbi.Protect == PAGE_EXECUTE_READWRITE || mbi.Protect == PAGE_READWRITE);
return (MEM_ERROR)(mbi.Protect == PAGE_EXECUTE_READWRITE || mbi.Protect == PAGE_READWRITE);
}

8 changes: 7 additions & 1 deletion Shinigami/Shinigami/Shinigami.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@ int main(int argc, char** argv)
#ifdef _WIN64
if (PE.Is32Bit())
{
std::cerr << "Please use Shinigami 32-bit to execute this file\n";
std::cerr << "Please use Shinigami 32-bit to execute this file!\n";
return EXIT_FAILURE;
}
#else
if (!PE.Is32Bit())
{
std::cerr << "Please use Shinigami 64-bit to execute this file!\n";
return EXIT_FAILURE;
}
#endif
Expand Down
7 changes: 3 additions & 4 deletions Shinigami/Shinigami/ShinigamiArguments.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@ class ShinigamiArguments {
std::wstring TargetExecutableName;
std::wstring WorkDirectory;
std::wstring OutputDirectory;
<<<<<<< HEAD
std::wstring ExportedFunction;
std::vector<std::wstring> TargetArguments;

// Ichigo arguments that will be sent to the injected code
private:
=======
std::vector<std::wstring> TargetArguments;
IchigoArguments IchiArguments;

// Ichigo arguments that will be sent to the injected code
};

0 comments on commit e14c48e

Please sign in to comment.