📘 Notes for the ver4 update

This commit is contained in:
bitcookies
2026-03-21 22:14:59 +08:00
parent 38f15bc187
commit 030c425e2e
2 changed files with 119 additions and 128 deletions
+61 -66
View File
@@ -21,7 +21,7 @@ WinRAR 是一款用于管理压缩包文件的共享软件。其算法由作者
它可以用来创建或浏览 RAR、ZIP 等众多格式的压缩包。
WinRAR 不是免费软件。如果你想使用它,你应当向 [__RARLAB__](https://www.rarlab.com/) 付费,然后获得一个授权文件 `rarreg.key`
WinRAR 不是免费软件。如果你想使用它,你应当向 [**RARLAB**](https://www.rarlab.com/) 付费,然后获得一个授权文件 `rarreg.key`
这份 repo 将会告诉你 `rarreg.key` 是如何生成的。
@@ -59,10 +59,10 @@ WinRAR license 有 `rarreg.key` 和 `rarkey.rar` 两种类型,它们仅在导
| <img width="100px" src="assets/file-icon.svg"> | <img width="100px" src="assets/winrar-icon.svg"> |
| 拖动导入或放于指定位置 | 双击运行自动导入 |
如果你无法执行拖动操作,你可以尝试`rarreg.key` 放置于以下目录中:
你可以把 `rarreg.key` 放置于以下目录中:
```shell
C:\Users\<yourname>\AppData\Roaming\WinRAR\rarreg.key
%APPDATA%\WinRAR\rarreg.key
```
你也可以将 `rarreg.key` 压缩成 `rarkey.rar` 然后双击运行,授权导入将会自动进行。
@@ -112,8 +112,6 @@ C:\Users\<yourname>\AppData\Roaming\WinRAR\rarreg.key
`rarreg_file.zip` 解压缩后会得到 `rarreg.key`,然后拖动导入 WinRAR 即可。你也可以将 `rarreg.key` 压缩成 `rarkey.rar`,然后双击运行,授权导入将会自动进行。
如果你得到的是 key 是无效的,请查看[解决方法](#7-无效的-Key)。
</details>
## 5. 使用 Github Actions with secrets
@@ -141,7 +139,7 @@ C:\Users\<yourname>\AppData\Roaming\WinRAR\rarreg.key
### 5.3 创建 secrets
允许 workflows 后,进入 **Settings > Secrets and variables > Actions > New repository secret** 创建 secrets
允许 workflows 后,进入 **Settings > Secrets and variables > Actions > New repository secret** 创建 secrets
![Secrets](assets/secrets-light.png#gh-light-mode-only)
@@ -187,8 +185,6 @@ C:\Users\<yourname>\AppData\Roaming\WinRAR\rarreg.key
`rarreg_file.zip` 解压缩后会得到 `rarreg.7z`,使用你设置的密码进行解压缩获得 `rarreg.key`,然后拖动导入 WinRAR 即可。你也可以将 `rarreg.key` 压缩成 `rarkey.rar`,然后双击运行,授权导入将会自动进行。
如果你得到的是 key 是无效的,请查看[解决方法](#7-无效的-Key)。
</details>
## 6. 通过 Visual Studio 编译使用
@@ -218,7 +214,7 @@ C:\Users\<yourname>\AppData\Roaming\WinRAR\rarreg.key
$ vcpkg install gmp:x64-windows
```
3. 你的 `vcpkg` 与 __Visual Studio__ 整合了,即你曾成功运行了下面这条命令:
3. 你的 `vcpkg` 与 **Visual Studio** 整合了,即你曾成功运行了下面这条命令:
```shell
$ vcpkg integrate install
@@ -226,9 +222,9 @@ C:\Users\<yourname>\AppData\Roaming\WinRAR\rarreg.key
### 6.2 编译
1. 在 __Visual Studio__ 中打开这个项目;
2. 选择 `Release` 配置;
3. 选择 __生成 > 生成解决方案__
1. 在 **Visual Studio** 中打开这个项目;
2. 选择 **Release** 配置;
3. 选择 **生成 > 生成解决方案**
你将在 `bin/` 目录下看到生成的文件。
@@ -236,15 +232,36 @@ C:\Users\<yourname>\AppData\Roaming\WinRAR\rarreg.key
直接在终端执行以下代码,配置两个参数即可生成 `rarreg.key`。
```shell
Usage:
winrar-keygen.exe <Username> <LicenseName> [options]
winrar-keygen.exe -v | --version
winrar-keygen.exe -h | --help
Options:
-e, --encoding <enc> utf8 (default), ascii, ansi
-o, --output <file> Output file (default: rarreg.key)
-a, --activate Write to %%APPDATA%%\WinRAR\rarreg.key
-t, --text Print to console only, don't write file
-v, --version Show version
-h, --help Show this help
```
#### 参数选项
| 参数 | 描述 |
| :--------------------- | :--------------------------------------- |
| `-e, --encoding <enc>` | `ascii` (默认), `ansi`, `utf8` |
| `-o, --output <file>` | Output file path (默认: `rarreg.key`) |
| `-a, --activate` | Write to `%%APPDATA%%\WinRAR\rarreg.key` |
| `-t, --text` | Print to console only, don't write file |
| `-v, --version` | Show version |
| `-h, --help` | Show help |
这里以 `Github` 和 `Single PC usage license` 参数和 ASCII 编码为例:
```shell
Usage:
winrar-keygen.exe <Username> <License Name>
Example:
winrar-keygen.exe "Github" "Single PC usage license"
./winrar-keygen.exe "Github" "Single PC usage license" -t -e ascii
```
![Terminal](assets/terminal.png)
@@ -265,73 +282,53 @@ dd4ab952600ba16a99236d910bfa995d5f60651ec451f462511507
5eede7ed46566b10bf033daa6384062b259194b1acbd0378116064
```
将生成的信息以 **ASCII 编码** 的文本格式保存为 `rarreg.key`。
### 6.4 更多示例
### 6.4 支持更多字符
生成 UTF-8 编码的 license 并直接激活 WinRAR
除了使用 ASCII 编码,你还可以使用 ANSI 和 UTF8NoBOM 以支持更多字符,但你需要[安装 PowerShell 7.4 及其后续版本](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.4)。
| `-Encoding` 值 | PowerShell 5.x | PowerShell 7.4+ |
| :------------: | :------------: | :-------------: |
| ASCII | ✅ | ✅ |
| ANSI | | ✅ |
| UTF8NoBOM | | ✅ |
在 PowerShell 5.x 中,你不能输出 ANSI 或 UTF8NoBOM 格式的 license,你只能通过命令生成并手动复制内容并保存为 ANSI 或 UTF8NoBOM 格式。
在 PowerShell 7.4+ 中,你可以用 ANSI 或 UTF8NoBOM 编码生成 license
> `utf8:` 是为了保证在不同语言的 WinRAR 中做到不变的字符表示。
> UTF-8 编码的 license 将会根据字符自动决定是否添加 `utf8:` 前缀
```shell
./winrar-keygen.exe "utf8:简体中文" "license" | Out-File -Encoding UTF8NoBOM rarreg.key
./winrar-keygen.exe "Github" "Single PC usage license" -a
```
./winrar-keygen.exe "utf8:Français" "license" | Out-File -Encoding UTF8NoBOM rarreg.key
生成 ANSI 编码的 license 并生成 license 文件:
./winrar-keygen.exe "utf8:日本語" "license" | Out-File -Encoding UTF8NoBOM rarreg.key
> ANSI 编码与 Windows 的地区有关,一般当前地区的字符能够正常展示,也会遇到字符乱码问题
./winrar-keygen.exe "utf8:한국어" "license" | Out-File -Encoding UTF8NoBOM rarreg.key
```shell
./winrar-keygen.exe "Github" "Single PC usage license" -e ansi
```
生成 ASCII 编码的 license 并只在控制台输出:
```shell
./winrar-keygen.exe "Github" "Single PC usage license" -t -e asci
```
</details>
## 7. 无效的 Key
## 7. 常见错误
为什么我生成的 `rarreg.key` 是无效的?
### 7.1 Keygen 错误
### 7.1 字符编码不正确
从 `ver4` 版本开始,Keygen 增加了一些常见的 Error 提示信息,请根据输出信息来进行修正。
参数 `TEXT1` `TEXT2` 需要满足[对应的编码要求](#31-编码说明)
```console
./winrar-keygen.exe <TEXT1> <TEXT2>
```
具体可参考原理文档:[授权文件"rarreg.key"的生成](https://github.com/bitcookies/winrar-keygen/blob/master/README.HOW_DOES_IT_WORK.zh-CN.md#7-%E6%8E%88%E6%9D%83%E6%96%87%E4%BB%B6rarregkey%E7%9A%84%E7%94%9F%E6%88%90)
### 7.2 文本储存编码不正确
如果你使用了如下命令:
使用 `-h` `--help` 来查看帮助信息
```shell
./winrar-keygen.exe "Github" "Single PC usage license" > rarreg.key
./winrar-keygen.exe -h
```
在较新的 Windows 10 / 11 系统中,PowerShell 将默认以 **UTF16-LE** 格式导出,这将会导致错误
### 7.2 Github Actions 错误
请指定输出编码格式,例如:
如果你使用 `ascii` 编码时发生了错误,原因是你使用了非 ASCII 字符。
```shell
./winrar-keygen.exe "Github" "license" | Out-File -Encoding ascii rarreg.key
./winrar-keygen.exe "Github" "license" | Out-File -Encoding ansi rarreg.key
./winrar-keygen.exe "utf8:Github" "license" | Out-File -Encoding UTF8NoBOM rarreg.key
```
如果你 `ansi` 编码时发生了错误,原因是因为字符编码不受当前 Windows 系统支持。GitHub Actions 的系统平台是 `windows-2022-english` ANSI code page 1252),包含非 ASCII 字符都会失败。
### 7.3 关于简体中文版
在 [__RARLAB__](https://www.rarlab.com/) 下载的简体中文版 WinRAR 将会自带广告组件,即使使用了 `rarreg.key` 授权,广告组件依旧会出现。这是由于简体中文代理商的一些意见,RARLAB 已将简体中文安装包的公开链接更换成了带有广告的简体中文安装包。
在 [**RARLAB**](https://www.rarlab.com/) 下载的简体中文版 WinRAR 将会自带广告组件,即使使用了 `rarreg.key` 授权,广告组件依旧会出现。这是由于简体中文代理商的一些意见,RARLAB 已将简体中文安装包的公开链接更换成了带有广告的简体中文安装包。
感谢 [@hoochanlon](https://github.com/hoochanlon) 提供的一些方法。可以使用 [win-rar-extractor](https://github.com/lvtx/WinRAR-Extractor) 获取简体中文商业版的下载连接;也可以根据商业版的地址规律,获取相应版本的简体中文安装包:
@@ -382,13 +379,11 @@ https://www.rarlab.com/rar/winrar-x64-624sc.exe
如果您遇到了一些问题,可在 [Issues](https://github.com/bitcookies/winrar-keygen/issues) 页面反馈,会有很多热心的开发者及 Github 用户帮助你。
该项目欢迎贡献和建议,您可以在 [Issues](https://github.com/bitcookies/winrar-keygen/issues) 提出建议,或者进行提交拉取请求 😄
该项目欢迎贡献和建议,您可以在 [Issues](https://github.com/bitcookies/winrar-keygen/issues) 提出建议,或者进行提交拉取请求
### 8.2 感谢
非常感谢一些热心的开发者,在 [Issues](https://github.com/bitcookies/winrar-keygen/issues) 帮助解答一些问题。
🏆 特别感谢 [@Sonic-The-Hedgehog-LNK1123](https://github.com/Sonic-The-Hedgehog-LNK1123)
感谢本项目的每位贡献者。感谢一些热心的开发者,在 [Issues](https://github.com/bitcookies/winrar-keygen/issues) 帮助解答一些问题。
## 9. 许可