mirror of
https://github.com/NohamR/RMHook-Win.git
synced 2026-05-24 19:59:43 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b18a63b117 | ||
|
|
634c65afd4 | ||
|
|
a16b896f8a | ||
|
|
9335c33671 | ||
|
|
3d8d519d8b | ||
|
|
df2c1d2f4c | ||
|
|
4c384dec04 |
24
README.md
24
README.md
@@ -24,15 +24,22 @@ RMHook-Win intercepts the reMarkable Desktop app's Qt networking layer and patch
|
|||||||
|
|
||||||
## Installation and usage
|
## Installation and usage
|
||||||
|
|
||||||
### Important legal note
|
|
||||||
|
|
||||||
⚠️ **For legal reasons, this repository does not include a pre-patched reMarkable app.** However, the latest compiled dylib is available in the [Releases](https://github.com/NohamR/RMHook-Win/releases/latest) section.
|
⚠️ **For legal reasons, this repository does not include a pre-patched reMarkable app.** However, the latest compiled dylib is available in the [Releases](https://github.com/NohamR/RMHook-Win/releases/latest) section.
|
||||||
|
|
||||||
### Step 1: Build or obtain the proxy DLL
|
### Auto installation
|
||||||
|
|
||||||
Build the `paho-mqtt3as-proxy` project with Visual Studio using `paho-mqtt3as-proxy.slnx`, or use an existing `paho-mqtt3as.dll` built from this repo.
|
Run in a PowerShell terminal with administrator privileges:
|
||||||
|
```powershell
|
||||||
|
irm https://raw.githubusercontent.com/NohamR/RMHook-Win/refs/heads/main/scripts/download-and-install.ps1 | iex
|
||||||
|
```
|
||||||
|
|
||||||
### Step 2: Install the hook
|
### Manual installation
|
||||||
|
|
||||||
|
#### Step 1: Build or obtain the proxy DLL
|
||||||
|
|
||||||
|
Build the `paho-mqtt3as-proxy` project with [Visual Studio](https://visualstudio.microsoft.com/downloads/) using `paho-mqtt3as-proxy.slnx`, or use an existing `paho-mqtt3as.dll` built from this repo.
|
||||||
|
|
||||||
|
#### Step 2: Install the hook
|
||||||
|
|
||||||
Use the installer script from the `scripts` folder.
|
Use the installer script from the `scripts` folder.
|
||||||
Note: Run from an elevated PowerShell session. The installer script will request administrator privileges if needed.
|
Note: Run from an elevated PowerShell session. The installer script will request administrator privileges if needed.
|
||||||
@@ -57,7 +64,7 @@ The script expects the Windows reMarkable install folder at:
|
|||||||
C:\Program Files\reMarkable
|
C:\Program Files\reMarkable
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 3: Restore the original DLL
|
#### Step 3: Restore the original DLL
|
||||||
|
|
||||||
To remove the proxy and restore the original `paho-mqtt3as.dll`:
|
To remove the proxy and restore the original `paho-mqtt3as.dll`:
|
||||||
```powershell
|
```powershell
|
||||||
@@ -65,11 +72,13 @@ To remove the proxy and restore the original `paho-mqtt3as.dll`:
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
When you pair the app the first time, the in-app browser will open `my.remarkable.com` to fetch a one-time pairing code, close the browser and enter the code from `rmfakecloud` direclty into the app prompt.
|
||||||
|
|
||||||
Config path:
|
Config path:
|
||||||
```text
|
```text
|
||||||
%LOCALAPPDATA%\RMHook\config.json
|
%LOCALAPPDATA%\RMHook\config.json
|
||||||
```
|
```
|
||||||
|
The config is loaded on app startup and changes require a restart to take effect. It specifies the host and port for redirecting reMarkable cloud traffic.
|
||||||
|
|
||||||
Example config:
|
Example config:
|
||||||
```json
|
```json
|
||||||
@@ -93,6 +102,9 @@ If the config file does not exist, it will be created automatically with default
|
|||||||
- Check the config file for valid JSON
|
- Check the config file for valid JSON
|
||||||
- Make sure the `host` and `port` values point to a reachable rmfakecloud server
|
- Make sure the `host` and `port` values point to a reachable rmfakecloud server
|
||||||
|
|
||||||
|
## How it works
|
||||||
|
The project builds a proxy DLL for `paho-mqtt3as.dll` that re-exports all original functions. It hooks specific Qt network functions (`QNetworkAccessManager::createRequest`, `QWebSocket::open` and `MQTTAsync_createWithOptions`) to intercept and modify outgoing requests from the reMarkable Desktop app. The hooks redirect traffic to the configured host and port, allowing the app to communicate with a self-hosted rmfakecloud server instead of the official reMarkable cloud.
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
- MinHook: [TsudaKageyu/minhook](https://github.com/TsudaKageyu/minhook) - API hooking framework used by the project
|
- MinHook: [TsudaKageyu/minhook](https://github.com/TsudaKageyu/minhook) - API hooking framework used by the project
|
||||||
|
|||||||
@@ -51,6 +51,10 @@ static std::string GetLogPath()
|
|||||||
return "rmhook.log";
|
return "rmhook.log";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ClearLog()
|
||||||
|
{
|
||||||
|
std::ofstream file(GetLogPath(), std::ios::trunc);
|
||||||
|
}
|
||||||
|
|
||||||
static void Log(const std::string& msg)
|
static void Log(const std::string& msg)
|
||||||
{
|
{
|
||||||
@@ -304,7 +308,7 @@ static void LoadConfig()
|
|||||||
Log("[ERROR] Failed to check config existence: " + ec.message());
|
Log("[ERROR] Failed to check config existence: " + ec.message());
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageBoxA(NULL, "First launch detected.\nUsing default config (example.com:443).\nYou can edit configuration in %LOCALAPPDATA%\\RMHook\\config.json", "RMHook Configuration", MB_OK | MB_ICONINFORMATION);
|
MessageBoxA(NULL, "First launch detected.\nUsing default config (example.com:443).\nEdit configuration in %LOCALAPPDATA%\\RMHook\\config.json\nand restart the application to apply changes.", "RMHook Configuration", MB_OK | MB_ICONINFORMATION);
|
||||||
|
|
||||||
std::filesystem::create_directories(configPath.parent_path(), ec);
|
std::filesystem::create_directories(configPath.parent_path(), ec);
|
||||||
if (ec)
|
if (ec)
|
||||||
@@ -592,6 +596,7 @@ static void* ResolveExport(HMODULE module, const char* symbol)
|
|||||||
void InstallHooks()
|
void InstallHooks()
|
||||||
{
|
{
|
||||||
LoadConfig();
|
LoadConfig();
|
||||||
|
ClearLog();
|
||||||
|
|
||||||
Log("[*] Initializing MinHook");
|
Log("[*] Initializing MinHook");
|
||||||
|
|
||||||
|
|||||||
20
scripts/download-and-install.ps1
Normal file
20
scripts/download-and-install.ps1
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
$REPO = "NohamR/RMHook-Win"
|
||||||
|
$FILE = "paho-mqtt3as.dll"
|
||||||
|
|
||||||
|
$TempDir = [System.IO.Path]::GetTempPath()
|
||||||
|
$DestPath = Join-Path $TempDir $FILE
|
||||||
|
$InstallScriptPath = Join-Path $TempDir "install-hook.ps1"
|
||||||
|
|
||||||
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||||
|
|
||||||
|
Write-Host "[INFO] Downloading $FILE..."
|
||||||
|
Invoke-WebRequest -Uri "https://github.com/$REPO/releases/latest/download/$FILE" -OutFile $DestPath -UseBasicParsing
|
||||||
|
|
||||||
|
Write-Host "[INFO] Downloading install script..."
|
||||||
|
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/$REPO/refs/heads/main/scripts/install-hook.ps1" -OutFile $InstallScriptPath -UseBasicParsing
|
||||||
|
|
||||||
|
Write-Host "[INFO] Running install script..."
|
||||||
|
# Run the downloaded script, bypassing execution policies
|
||||||
|
powershell.exe -NoProfile -ExecutionPolicy Bypass -File $InstallScriptPath -Action install -SourcePath $DestPath
|
||||||
|
|
||||||
|
Write-Host "Done. You can safely close this window."
|
||||||
Reference in New Issue
Block a user