I'm a doctor, not a mechanic
Difference between revisions of "UE1:NBSPCrc (Class)"
(→Discussion) |
(→Limitations) |
||
(One intermediate revision by the same user not shown) | |||
Line 15: | Line 15: | ||
<br> | <br> | ||
--[[User:AnthraX|AnthraX]] 16:51, 22 May 2009 (UTC) | --[[User:AnthraX|AnthraX]] 16:51, 22 May 2009 (UTC) | ||
+ | |||
+ | == Limitations == | ||
+ | |||
+ | As mentioned above. This class was never intended to be used for this purpose, that's partially the reason why there are some very strict limitations to it. The main limitations are:<br> | ||
+ | * You cannot read files from the Cache folders on Linux and MacOS clients<br> | ||
+ | * The unreal engine has a "runaway limit" that limits the amount of times a function can be called. I believe the limit is 1,000,000 by default. This means that a runaway loop will be detected after the 1 million'th call of the SendBinary function. Assuming that all chunks of data are 255 bytes long, this imposes a limit of about 25Mb of data you can read before the game will crash. There is no way to avoid this using pure unrealscript.<br> | ||
+ | * Because of certain issues with the internal implementation of WebResponse, the IncludeBinaryFile function can be redirected without hooking into the game's main modules.<br> | ||
+ | |||
+ | --[[User:AnthraX|AnthraX]] 17:00, 22 May 2009 (UTC) | ||
== Complete source code == | == Complete source code == |
Latest revision as of 10:00, 22 May 2009
Purpose[edit]
The WebResponse class is most likely extended to create a limited file reader to perform CRC checks.
Variables[edit]
Discussion[edit]
As the name suggests, WebResponse was originally intended as a "Response" object from the webadmin and other WebApplications to the client. Epic added the possibility to include attachments in the response from the server to the client. By calling the IncludeBinaryFile function you can read a binary file. The engine then reads the file in chunks of 255 bytes, adds the bytes to a TArray<BYTE> structure and calls the SendBinary function.
The original WebResponse just passes the data to the WebConnection.SendBinary function, but by overriding the WebResponse.SendBinary function, certain operations, such as hashing can be performed. Long story short, every unrealscript filechecker does the following to check a file:
- Set the IncludePath, which is the folder from where the file will be read
- Call the IncludeBinaryFile function with the name of the file as the argument
- Perform hashing operations on every chunk of 255 bytes read from the file, this is done in the SendBinary function
--AnthraX 16:51, 22 May 2009 (UTC)
Limitations[edit]
As mentioned above. This class was never intended to be used for this purpose, that's partially the reason why there are some very strict limitations to it. The main limitations are:
- You cannot read files from the Cache folders on Linux and MacOS clients
- The unreal engine has a "runaway limit" that limits the amount of times a function can be called. I believe the limit is 1,000,000 by default. This means that a runaway loop will be detected after the 1 million'th call of the SendBinary function. Assuming that all chunks of data are 255 bytes long, this imposes a limit of about 25Mb of data you can read before the game will crash. There is no way to avoid this using pure unrealscript.
- Because of certain issues with the internal implementation of WebResponse, the IncludeBinaryFile function can be redirected without hooking into the game's main modules.
--AnthraX 17:00, 22 May 2009 (UTC)
Complete source code[edit]
//============================================================================= // NBSPCrc ==> NoBullShitPlus v1.09 //============================================================================= class NBSPCrc extends WebResponse; var private int q, a, x; function HTTPResponse (string Header) {} //SEND HEADER function SendStandardHeaders (optional string ContentType) {} function Redirect (string URL) {} event SendBinary (int b, byte ab[255]) { local int zzi, ti; const c = 0xedb82633; for (zzi=0;zzi<x;zzi++) a += ((ab[zzi] * ab[zzi]) + ((ab[zzi] - q)^ab[zzi]) ^ c) * ab[zzi]; } final function ss(private int g) { q = g; } final function ac(private int y) { x = y; } final function int gg() { return a; } final function dd() { a=0; } defaultproperties { IncludePath="" }