📘 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

120
README.md
View file

@ -21,7 +21,7 @@ WinRAR is a trialware file archiver utility for Windows, developed by Eugene Ros
It can create and view archives in RAR or ZIP file formats and unpack numerous archive file formats.
WinRAR is not a free software. If you want to use it, you should pay to [__RARLAB__](https://www.rarlab.com/) and then you will get a license file named `rarreg.key`.
WinRAR is not a free software. If you want to use it, you should pay to [**RARLAB**](https://www.rarlab.com/) and then you will get a license file named `rarreg.key`.
This repository will tell you how WinRAR license file `"rarreg.key"` is generated.
@ -59,10 +59,10 @@ There are two types of WinRAR licenses, `rarreg.key` and `rarkey.rar`, which dif
| <img width="100px" src="assets/file-icon.svg"> | <img width="100px" src="assets/winrar-icon.svg"> |
| Drag to import or place in a location | Double-click to run automatic import |
If you are unable to drag, you can try to put the `rarreg.key` in the following directory.
You can try to put the `rarreg.key` in the following directory.
```shell
C:\Users\<yourname>\AppData\Roaming\WinRAR\rarreg.key
%APPDATA%\WinRAR\rarreg.key
```
You can also compress `rarreg.key` into `rarkey.rar` and double-click it to run it, and the license import will take place automatically.
@ -112,8 +112,6 @@ After running successfully, open the corresponding task and select **rarreg_file
Extract rarreg_file.zip to get `rarreg.key` and drag to import into WinRAR. You can also compress `rarreg.key` into `rarkey.rar`, then double-click it to run it, and the license import will be done automatically.
If you get an invalid key, please check [the specific solution](#7-invalid-key).
</details>
## 5. Use Github Actions with secrets
@ -187,8 +185,6 @@ After running successfully, open the corresponding task and select **rarreg_file
Extract `rarreg_file.zip` to get `rarreg.7z`, unzip it with the password to get `rarreg.key`, then drag and drop to import into WinRAR. You can also compress `rarreg.key` into `rarkey.rar`, then double-click it to run it, and the license import will be done automatically.
If you get an invalid key, please check [the specific solution](#7-invalid-key).
</details>
## 6. Build in Visual Studio
@ -220,7 +216,7 @@ If you don't want to compile it yourself, you can also go to the [release](https
$ vcpkg install gmp:x64-windows
```
3. Your `vcpkg` has been integrated into your __Visual Studio__, which means you have run successfully.
3. Your `vcpkg` has been integrated into your **Visual Studio**, which means you have run successfully.
```shell
$ vcpkg integrate install
@ -229,11 +225,11 @@ If you don't want to compile it yourself, you can also go to the [release](https
### 6.2 Build
1. Open this project in __Visual Studio__.
1. Open this project in **Visual Studio**.
2. Select `Release` configuration.
2. Select **Release** configuration.
3. Select __Build > Build Solution__.
3. Select **Build > Build Solution**.
You will see executable files in `bin/` directory.
@ -241,15 +237,36 @@ You will see executable files in `bin/` directory.
Execute the following code in the terminal and configure two parameters to generate `rarreg.key`.
Here is an example of ASCII encoding for `Github` and `Single PC usage license`:
```shell
Usage:
winrar-keygen.exe <Username> <License Name>
winrar-keygen.exe <Username> <LicenseName> [options]
winrar-keygen.exe -v | --version
winrar-keygen.exe -h | --help
Example:
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
```
winrar-keygen.exe "Github" "Single PC usage license"
#### Options
| Flag | Description |
| :--------------------- | :--------------------------------------- |
| `-e, --encoding <enc>` | `ascii` (default), `ansi`, `utf8` |
| `-o, --output <file>` | Output file path (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 help |
Here is an example of ASCII encoding for `Github` and `Single PC usage license`.
```shell
./winrar-keygen.exe "Github" "Single PC usage license" -t -e ascii
```
![Terminal](assets/terminal.png)
@ -270,69 +287,50 @@ dd4ab952600ba16a99236d910bfa995d5f60651ec451f462511507
5eede7ed46566b10bf033daa6384062b259194b1acbd0378116064
```
Save the generated information in **ASCII encoding** as `rarreg.key`.
### 6.4 More examples
### 6.4 More character support
Generate a UTF-8 encoded license and activate WinRAR directly.
In addition to using ASCII encoding, you can use ANSI and UTF8NoBOM to support more characters, but you will need to install [PowerShell 7.4 or later](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 | | ✅ |
In PowerShell 5.x, you cannot output licenses in ANSI or UTF8NoBOM format. You must generate the content via commands, manually copy it, and save it as ANSI or UTF8NoBOM.
In PowerShell 7.4+, you can generate licenses encoded in ANSI or UTF8NoBOM:
> `utf8:` is to ensure constant character representation in WinRAR across languages.
> The UTF-8 encoded license will automatically determine whether to add the `utf8:` prefix based on the characters.
```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
Generate an ANSI-encoded license and generate a license file.
./winrar-keygen.exe "utf8:日本語" "license" | Out-File -Encoding UTF8NoBOM rarreg.key
> ANSI encoding is region-dependent on Windows. While characters in the current region may display correctly, garbled characters may still occur.
./winrar-keygen.exe "utf8:한국어" "license" | Out-File -Encoding UTF8NoBOM rarreg.key
```shell
./winrar-keygen.exe "Github" "Single PC usage license" -e ansi
```
Generate an ASCII-encoded license and output it only to the console.
```shell
./winrar-keygen.exe "Github" "Single PC usage license" -t -e asci
```
</details>
## 7. Invalid key
## 7. Common Errors
Why is my `rarreg.key` invalid?
### 7.1 Keygen Errors
### 7.1 Character encoding
Starting with version `ver4`, Keygen has added some common error messages. Please make corrections based on the output.
`TEXT1` and `TEXT2` are required to fulfill [corresponding coding requirements](#31-Encoding).
```console
./winrar-keygen.exe <TEXT1> <TEXT2>
```
You can refer to: [Generation of "rarreg.key"](https://github.com/bitcookies/winrar-keygen/blob/master/README.HOW_DOES_IT_WORK.md#7-generation-of-rarregkey)
### 7.2 Text encoding
If you use the following command:
Use `-h` or `--help` to view the help information:
```shell
./winrar-keygen.exe "Github" "Single PC usage license" > rarreg.key
./winrar-keygen.exe -h
```
In the newer Windows 10 / 11, PowerShell will export in **UTF16-LE** format by default, which will cause the error.
### 7.2 Github Actions Errors
Please use the following command:
If you encounter an error while using `ascii` encoding, it is because you are using non-ASCII characters.
```shell
./winrar-keygen.exe "Github" "license" | Out-File -Encoding ascii rarreg.key
If you encounter an error while using `ansi` encoding, it is because the character encoding is not supported by the current Windows system. The system platform for GitHub Actions is `windows-2022-english` (ANSI code page 1252), and any non-ASCII characters will cause the process to fail.
./winrar-keygen.exe "Github" "license" | Out-File -Encoding ansi rarreg.key
./winrar-keygen.exe "utf8:Github" "license" | Out-File -Encoding UTF8NoBOM rarreg.key
```
## 8. Contributing
@ -340,13 +338,11 @@ Please use the following command:
If you encounter some problems, you can report on the [Issues](https://github.com/bitcookies/winrar-keygen/issues) page. There will be many enthusiastic developers or Github users to help you.
This project welcomes contributions and suggestions. You can make suggestions in [Issues](https://github.com/bitcookies/winrar-keygen/issues), or submit a pull request 😄
This project welcomes contributions and suggestions. You can make suggestions in [Issues](https://github.com/bitcookies/winrar-keygen/issues), or submit a pull request.
### 8.2 Thanks
Thank you very much to some enthusiastic developers for helping answer some questions in [Issues](https://github.com/bitcookies/winrar-keygen/issues).
🏆 Special Thanks [@Sonic-The-Hedgehog-LNK1123](https://github.com/Sonic-The-Hedgehog-LNK1123)
Thank you to every contributor to this project. Thank you very much to some enthusiastic developers for helping answer some questions in [Issues](https://github.com/bitcookies/winrar-keygen/issues).
## 9. License

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. 许可