Skip to content

Commit

Permalink
add define for enabling windows 7 workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
moonshadow565 committed Nov 1, 2022
1 parent 1daf507 commit e565bfb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
6 changes: 6 additions & 0 deletions cslol-tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ project(cslol-tools LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

option(CSLOL_TRASH_PC_SUPPORT "Support trash PCs running windows 7" OFF)

add_subdirectory(dep)

add_library(cslol-lib STATIC
Expand Down Expand Up @@ -67,6 +69,10 @@ if (WIN32)
)
endif()

if (CSLOL_TRASH_PC_SUPPORT)
target_compile_definitions(cslol-lib PRIVATE -DCSLOL_TRASH_PC_SUPPORT)
endif()

target_compile_definitions(cslol-lib PUBLIC -D_CRT_SECURE_NO_WARNINGS) # lmao, fuck off
target_link_libraries(cslol-lib PUBLIC fmt fmtlog)
target_link_libraries(cslol-lib PRIVATE libdeflate zstd xxhash miniz)
Expand Down
14 changes: 12 additions & 2 deletions cslol-tools/lib/lol/patcher/utility/process_win32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# include <tlhelp32.h>
// do not reorder
# define last_error() std::error_code((int)GetLastError(), std::system_category())
# define hassert(...) \
if (auto hres = __VA_ARGS__; FAILED(hres)) _com_issue_error(hres);

namespace {
static inline constexpr DWORD PROCESS_NEEDED_ACCESS =
Expand Down Expand Up @@ -188,9 +186,21 @@ auto Process::WriteMemory(void* address, void const* src, size_t size) const ->
lol_trace_func(lol_trace_var("{:p}", address), lol_trace_var("{:p}", src), lol_trace_var("{:#x}", size));
lol_throw_if(address == nullptr);
lol_throw_if(size != 0 && src == nullptr);
# if defined(CSLOL_TRASH_PC_SUPPORT)
static DWORD(NTAPI * NtWriteVirtualMemory)(HANDLE ProcessHandle,
LPVOID BaseAddress,
LPCVOID Buffer,
ULONG BytesToWrite,
PULONG BytesWritten) =
(decltype(NtWriteVirtualMemory))GetProcAddress(LoadLibraryA("ntdll.dll"), "NtWriteVirtualMemory");
if (auto error = NtWriteVirtualMemory(handle_, address, src, size, nullptr)) {
lol_throw_msg("WriteProcessMemory: 0x{:08X}", error);
}
# else
if (!WriteProcessMemory(handle_, address, src, size, nullptr)) {
lol_throw_msg("WriteProcessMemory: {}", last_error());
}
# endif
}

auto Process::MarkMemoryWritable(void* address, size_t size) const -> void {
Expand Down

6 comments on commit e565bfb

@YasuopicV
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Friend .. can i ues LCS in Windows 7 ?

@Crauzer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Friend .. can i ues LCS in Windows 7 ?

No, windows 7 is not supported

@YasuopicV
Copy link

@YasuopicV YasuopicV commented on e565bfb Dec 19, 2022 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@YasuopicV
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#47 hey friend can you make LCS works in Windows 7 plz cuz my cpu cant not run windows 10 very well ( alot of lags )

@moonshadow565
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Buy a new CPU

@YasuopicV
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dont Have Money bro :l . plz try to make it for windows 7 too i mean windows 7 with 10 and 11 like that

Please sign in to comment.