R2R System SDK Readme (ALPHA)

The full SDK documentation is currently available for R2R members only.
Reasons : Not written in English, not finalized, contains internal info etc.

-------------------------------------------------------------------------------
License
-------------------------------------------------------------------------------
License agreement with anonymous underground group doesn't make sense :)

You can make use of R2R System and SDK without contacting to TEAM R2R.
* Link to Network Block Runtime DLLs.
* Use R2RSYS SDK, R2RSYS.dll and plugins in your application.

The only thing you shouldn't do is modifying files of R2R System in the end
user's computer. It makes troubleshooting much harder as you already know!


-------------------------------------------------------------------------------
SDK
-------------------------------------------------------------------------------
.\include\*	- Header files for R2RSYS and some R2R plugins
.\lib\*		- Lib files for R2RSYS and some R2R plugins
.\projects\*	- Example projects for Visual Studio C/C++.


-------------------------------------------------------------------------------
Pre included plugins
-------------------------------------------------------------------------------
bass		- https://www.un4seen.com/
ed25519		- https://github.com/orlp/ed25519
libcbor		- https://github.com/PJK/libcbor
libcrypto-3	- OpenSSL3 : https://slproweb.com/products/Win32OpenSSL.html
libeay32	- OpenSSL v1.0.2u
libsodium	- Libsodium : https://libsodium.org/
nanojsonc	- https://github.com/open-source-patterns/nanojsonc
R2RCRYPP	- Some minor crypto functions from Crypto++
R2REZKG		- Integrated Easy KeyGen library
R2RJUCE2	- Support JUCE related functions like crypto, data structure.
zlib		- zlib : https://zlib.net/

Plugins are located to
%COMMONPROGRAMFILES%\TEAM R2R\R2R System\Plugins\*

-------------------------------------------------------------------------------
Using R2RSYS (r2rsys.h, R2RSYS.lib)
-------------------------------------------------------------------------------
R2RSYS is base library to use R2R System.
The core R2RSYS.dll should be placed to Windows System32 folder.
It means that you can load R2RSYS DLL from everywhere.
You can load plugin like R2REZKG, R2RJUCE2, OpenSSL, libsodium, bass etc.
User Information (which is can be also acquired from R2RSYS).

[Use Plugin]
1. Call R2RSys_LoadPlugin() to load plugin.
2. Call R2RSys_GetPluginProcAddress() to get function pointers.
3. Call R2RSys_FreePlugin() to free plugin.

[Get User Information]
1. Call R2RSys_IsUserInfoProtected() to see if it's password protected.
   If it's protected, ask user to input password.
   Check the password by R2RSys_VerifyMasterPassword().
   When it returns r2r_ok, you can use R2RSys_GetUserInfo().

2. Use R2RSys_GetUserInfo() to get User Information.
   Specify r2rsys_userinfo_* to specify what info you want to get.
   Buffer size should be (r2rsys_max_*_len + 1).

If you want to use R2RSYS default validator, use R2RSys_ValidateUserInfo().


-------------------------------------------------------------------------------
Using R2REZKG (r2rezkg.h, R2REZKG.lib)
-------------------------------------------------------------------------------
R2REZKG is pre included plugin. It has almost everything to make keygen.
Except - GUI ;)

Almost all functions return r2r_ok when success.

[Output Buffer]
Most time, output buffer is allocated by R2REZKG.
Use EZKG_MemFree() to free it.

example:
	char *buf; int buf_size;
	if (r2r_is_ok(EZKG_FileRead("challenge.txt", &buf, &buf_size))) {
		printf("size : %d\n", buf_size);
		printf("data : %s\n", buf);
		EZKG_MemFree(buf);
	} else {
		printf("Reading file error.\n");
	}

[File Read/Write]
You can use environment path in the path.
Recursive folder creation is optional in Write mode.
example : %APPDATA%\\Shit Dev\\Shit Plug\\license.xml

[Reg Read/Write]
Use "HKCU" "HKLM" "HKLM32" "HKLM64" to specify the full key path.
example : "HKCU\\Software\\TEAM R2R\\R2R System"
Specify regval_* as type.
If type does not match while reading, it does not return r2r_ok.

[Split Text]
Often used to generate serial number.
EZKG_SplitTextFixed() can make "0123456789ABCDEF" to "0123-4567-89AB-CDEF".
EZKG_SplitText() supports variable length.

[RSA, DSA, ECDSA]
Key should be DER format. Not text based PEM.
EZKG_JuceRSAEn/Decrypt uses JUCE key format (3,123456789abcdef....).

[EZKG_Ed25519Sign]
Key can be generated by https://github.com/orlp/ed25519.

[JUCE realted functions]
R2REZKG has some wrapper functions for R2RJUCE2.
For the most JUCE application, you don't need to use R2RJUCE2.
See EZKG_Juce* functions.
You can use EZKG_MemFree() like other R2REZKG functions to free the mem.

[Bass Play/Stop]
We know you need some music in your tools ;)


-------------------------------------------------------------------------------
Using R2RJUCE2 (r2rjuce2.h, R2RJUCE2.lib)
-------------------------------------------------------------------------------
JUCE is the most used framework in the audio industry.
Many functions in JUCE have unique implementation and not compatible
popular formats. That's the reason why we need to make the plugin for JUCE.

[Output Buffer]
Like R2REZKG, output buffer is allocated by R2RJUCE2 plugin.
Allocated buffer can be deallocated by J2_Free().

[Machine ID]
Use J2_GetLocalMachineID() to get typical JUCE machine id.
JUCE's Machine ID generation has many problems in the history.
You need to specify machineid_* to get correct value.
The recent projects should be using machineid_uniqueid.

machineid_mac_address : Broken by changing network card
machineid_file_system : 32bit / 64bit returns different ID.
machineid_uniqueid_legacy : ID gets changed after restarting some computers
machineid_uniqueid : Current recommended method for the developers

[Online Unlock Status]
https://juce.com/tutorials/tutorial_online_unlock_status/
JUCE's licensing. Used by many developers today.
Use J2_GenerateKeyFile() function which wraps KeyGeneration::generateKeyFile().

[RSA]
Key format is typical JUCE one (3,123456789abcdef....).
Key can be generated by official JUCE Demo app.

[ValueTree Support]
ValueTree is JUCE's own strutured data expression.
R2RJUCE2 have J2_VT* functions to compose and export ValueTree.


-------------------------------------------------------------------------------
Solve linkage to the plugin
-------------------------------------------------------------------------------
While R2RSYS.dll is located to System32, other plugins are not.
If you simply link your program to the plugins,
you should get DLL not found error.
There are many possible solutions for that. Here are 2 examples.

[Solution 1 : Use Delay Load]
	Some linker like Visual Studio support DLL Delay Load.
	It dynamically loads DLL just before the DLL function called.
	Load the plugin from R2RSYS before using plugin functions.

	example : 
		hr2rplug handle;
		unsigned long long random_value;

		R2RSys_LoadPlugin(&handle, "R2REZKG");
		EZKG_Random64(&random_value);
		R2RSys_FreePlugin(handle);

	Then, set R2REZKG.dll in /DELAYLOAD to the linker (in Visual Studio).

[Solution 2 : Dynamically load plugin]
	Just avoid static link to the plugins.

	example :
		hr2rplug handle;
		int (r2rcall *func_EZKG_Random64)(unsigned long long *val);
		unsigned long long random_value;

		R2RSys_LoadPlugin(&handle, "R2REZKG");
		R2RSys_GetPluginProcAddress(
			&func_EZKG_Random64, handle, "EZKG_Random64");
		func_EZKG_Random64(&random_value);
		R2RSys_FreePlugin(handle);

In our example project (R2REZKG__Intro), Solution 1 is used.

-------------------------------------------------------------------------------
TEAM R2R 2026
