<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://ubersoft.org/Sputnik/wiki/skins/common/feed.css?301"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
		<id>http://ubersoft.org/Sputnik/wiki/index.php?action=history&amp;feed=atom&amp;title=Core_Function_BinaryMidReplace</id>
		<title>Core Function BinaryMidReplace - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://ubersoft.org/Sputnik/wiki/index.php?action=history&amp;feed=atom&amp;title=Core_Function_BinaryMidReplace"/>
		<link rel="alternate" type="text/html" href="http://ubersoft.org/Sputnik/wiki/index.php?title=Core_Function_BinaryMidReplace&amp;action=history"/>
		<updated>2026-04-13T13:34:13Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.17.0</generator>

	<entry>
		<id>http://ubersoft.org/Sputnik/wiki/index.php?title=Core_Function_BinaryMidReplace&amp;diff=4907&amp;oldid=prev</id>
		<title>UberFoX: 1 revision</title>
		<link rel="alternate" type="text/html" href="http://ubersoft.org/Sputnik/wiki/index.php?title=Core_Function_BinaryMidReplace&amp;diff=4907&amp;oldid=prev"/>
				<updated>2015-06-14T12:37:44Z</updated>
		
		<summary type="html">&lt;p&gt;1 revision&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='1' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='1' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 12:37, 14 June 2015&lt;/td&gt;
		&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>UberFoX</name></author>	</entry>

	<entry>
		<id>http://ubersoft.org/Sputnik/wiki/index.php?title=Core_Function_BinaryMidReplace&amp;diff=4906&amp;oldid=prev</id>
		<title>UberFoX: 1 revision</title>
		<link rel="alternate" type="text/html" href="http://ubersoft.org/Sputnik/wiki/index.php?title=Core_Function_BinaryMidReplace&amp;diff=4906&amp;oldid=prev"/>
				<updated>2014-08-11T21:41:08Z</updated>
		
		<summary type="html">&lt;p&gt;1 revision&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='1' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='1' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 21:41, 11 August 2014&lt;/td&gt;
		&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>UberFoX</name></author>	</entry>

	<entry>
		<id>http://ubersoft.org/Sputnik/wiki/index.php?title=Core_Function_BinaryMidReplace&amp;diff=3941&amp;oldid=prev</id>
		<title>UberFoX: /* Return Value */</title>
		<link rel="alternate" type="text/html" href="http://ubersoft.org/Sputnik/wiki/index.php?title=Core_Function_BinaryMidReplace&amp;diff=3941&amp;oldid=prev"/>
				<updated>2014-08-01T23:21:41Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Return Value&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 23:21, 1 August 2014&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 39:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 39:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Success: Returns true.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Success: Returns true.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;minus;&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Failure: Returns false (On error or if there was no bytes &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;removed&lt;/del&gt;).&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Failure: Returns false (On error or if there was no bytes &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;were added&lt;/ins&gt;).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== Remarks ===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== Remarks ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>UberFoX</name></author>	</entry>

	<entry>
		<id>http://ubersoft.org/Sputnik/wiki/index.php?title=Core_Function_BinaryMidReplace&amp;diff=3940&amp;oldid=prev</id>
		<title>UberFoX: Created page with &quot;&lt;pre&gt; BinaryMidReplace( &lt;binary-array&gt;, &lt;replacement&gt;, &lt;start&gt;, &lt;length&gt; ) &lt;/pre&gt;  === Description ===  Replace a section (from start to length) of the binary with the replacemen...&quot;</title>
		<link rel="alternate" type="text/html" href="http://ubersoft.org/Sputnik/wiki/index.php?title=Core_Function_BinaryMidReplace&amp;diff=3940&amp;oldid=prev"/>
				<updated>2014-08-01T23:21:14Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;pre&amp;gt; BinaryMidReplace( &amp;lt;binary-array&amp;gt;, &amp;lt;replacement&amp;gt;, &amp;lt;start&amp;gt;, &amp;lt;length&amp;gt; ) &amp;lt;/pre&amp;gt;  === Description ===  Replace a section (from start to length) of the binary with the replacemen...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
BinaryMidReplace( &amp;lt;binary-array&amp;gt;, &amp;lt;replacement&amp;gt;, &amp;lt;start&amp;gt;, &amp;lt;length&amp;gt; )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
&lt;br /&gt;
Replace a section (from start to length) of the binary with the replacement binary.&lt;br /&gt;
&lt;br /&gt;
=== Parameters ===&lt;br /&gt;
&lt;br /&gt;
==== binary-array ====&lt;br /&gt;
&lt;br /&gt;
The binary variable to use. &lt;br /&gt;
&lt;br /&gt;
==== replacement ====&lt;br /&gt;
&lt;br /&gt;
A variable to replace the section with&lt;br /&gt;
&lt;br /&gt;
(If it is not binary it will cast as binary for the replacement)&lt;br /&gt;
&lt;br /&gt;
==== start ====&lt;br /&gt;
&lt;br /&gt;
Position to start from.&lt;br /&gt;
&lt;br /&gt;
If the start is a negative value the position will work backwards from the length of the binary.&lt;br /&gt;
&lt;br /&gt;
==== length ====&lt;br /&gt;
&lt;br /&gt;
Optional; How many bytes to remove.&lt;br /&gt;
&lt;br /&gt;
Default is all remaining bytes;&lt;br /&gt;
&lt;br /&gt;
If length is given and is negative, then that many bytes will be omitted from the end of binary (after the start position has been calculated when a start is negative).&lt;br /&gt;
&lt;br /&gt;
If start denotes the position of this truncation or beyond, empty binary variable will be returned. &lt;br /&gt;
&lt;br /&gt;
=== Return Value ===&lt;br /&gt;
&lt;br /&gt;
Success: Returns true.&lt;br /&gt;
&lt;br /&gt;
Failure: Returns false (On error or if there was no bytes removed).&lt;br /&gt;
&lt;br /&gt;
=== Remarks ===&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
Remove everything after position 2 then insert the replacement&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sputnik&amp;quot;&amp;gt;&lt;br /&gt;
// Create the binary&lt;br /&gt;
$a = Pack(&amp;quot;A*&amp;quot;, &amp;quot;Hello World!&amp;quot;);&lt;br /&gt;
// Create the replacement binary&lt;br /&gt;
$b = Pack(&amp;quot;A*&amp;quot;, &amp;quot;CatDog&amp;quot;);&lt;br /&gt;
// Print it&lt;br /&gt;
say &amp;quot;Before:&amp;quot;;&lt;br /&gt;
say BinaryExpand($a);&lt;br /&gt;
// Remove bytes and insert in its place&lt;br /&gt;
BinaryMidReplace($a, $b, 2);&lt;br /&gt;
// Print result&lt;br /&gt;
say &amp;quot;After:&amp;quot;;&lt;br /&gt;
say BinaryExpand($a);&lt;br /&gt;
// Prints:&lt;br /&gt;
// Before:&lt;br /&gt;
// 00 | 48 65 6C 6C 6F 20 57 6F 72 6C 64 21 -- -- -- -- Hello World!&lt;br /&gt;
// After:&lt;br /&gt;
// 00 | 48 65 43 61 74 44 6F 67 -- -- -- -- -- -- -- -- HeCatDog&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remove 3 bytes after position 2 then insert the replacement&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sputnik&amp;quot;&amp;gt;&lt;br /&gt;
// Create the binary&lt;br /&gt;
$a = Pack(&amp;quot;A*&amp;quot;, &amp;quot;Hello World!&amp;quot;);&lt;br /&gt;
// Create the replacement binary&lt;br /&gt;
$b = Pack(&amp;quot;A*&amp;quot;, &amp;quot;CatDog&amp;quot;);&lt;br /&gt;
// Print it&lt;br /&gt;
say &amp;quot;Before:&amp;quot;;&lt;br /&gt;
say BinaryExpand($a);&lt;br /&gt;
// Remove bytes and insert in its place&lt;br /&gt;
BinaryMidReplace($a, $b, 2, 3);&lt;br /&gt;
// Print result&lt;br /&gt;
say &amp;quot;After:&amp;quot;;&lt;br /&gt;
say BinaryExpand($a);&lt;br /&gt;
// Prints:&lt;br /&gt;
// Before:&lt;br /&gt;
// 00 | 48 65 6C 6C 6F 20 57 6F 72 6C 64 21 -- -- -- -- Hello World!&lt;br /&gt;
// After:&lt;br /&gt;
// 00 | 48 65 43 61 74 44 6F 67 20 57 6F 72 6C 64 21 -- HeCatDog World!&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remove the last 3 bytes then insert the replacement&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sputnik&amp;quot;&amp;gt;&lt;br /&gt;
// Create the binary&lt;br /&gt;
$a = Pack(&amp;quot;A*&amp;quot;, &amp;quot;Hello World!&amp;quot;);&lt;br /&gt;
// Create the replacement binary&lt;br /&gt;
$b = Pack(&amp;quot;A*&amp;quot;, &amp;quot;CatDog&amp;quot;);&lt;br /&gt;
// Print it&lt;br /&gt;
say &amp;quot;Before:&amp;quot;;&lt;br /&gt;
say BinaryExpand($a);&lt;br /&gt;
// Remove bytes and insert in its place&lt;br /&gt;
BinaryMidReplace($a, $b, -3);&lt;br /&gt;
// Print result&lt;br /&gt;
say &amp;quot;After:&amp;quot;;&lt;br /&gt;
say BinaryExpand($a);&lt;br /&gt;
// Prints:&lt;br /&gt;
// Before:&lt;br /&gt;
// 00 | 48 65 6C 6C 6F 20 57 6F 72 6C 64 21 -- -- -- -- Hello World!&lt;br /&gt;
// After:&lt;br /&gt;
// 00 | 48 65 6C 6C 6F 20 57 6F 72 43 61 74 44 6F 67 -- Hello WorCatDog&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At the end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sputnik&amp;quot;&amp;gt;&lt;br /&gt;
// Create the binary&lt;br /&gt;
$a = Pack(&amp;quot;A*&amp;quot;, &amp;quot;Test&amp;quot;);&lt;br /&gt;
// Create the replacement binary&lt;br /&gt;
$b = Pack(&amp;quot;A*&amp;quot;, &amp;quot;CatDog&amp;quot;);&lt;br /&gt;
// Print it&lt;br /&gt;
say &amp;quot;Before:&amp;quot;;&lt;br /&gt;
say BinaryExpand($a);&lt;br /&gt;
// Remove bytes and insert in its place&lt;br /&gt;
BinaryMidReplace($a, $b, 4);&lt;br /&gt;
// Print result&lt;br /&gt;
say &amp;quot;After:&amp;quot;;&lt;br /&gt;
say BinaryExpand($a);&lt;br /&gt;
// Prints:&lt;br /&gt;
// Before:&lt;br /&gt;
// 00 | 48 65 6C 6C 6F 20 57 6F 72 6C 64 21 -- -- -- -- Hello World!&lt;br /&gt;
// After:&lt;br /&gt;
// 00 | 54 65 73 74 43 61 74 44 6F 67 -- -- -- -- -- -- TestCatDog&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At the beginning&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sputnik&amp;quot;&amp;gt;&lt;br /&gt;
// Create the binary&lt;br /&gt;
$a = Pack(&amp;quot;A*&amp;quot;, &amp;quot;Test&amp;quot;);&lt;br /&gt;
// Create the replacement binary&lt;br /&gt;
$b = Pack(&amp;quot;A*&amp;quot;, &amp;quot;CatDog&amp;quot;);&lt;br /&gt;
// Print it&lt;br /&gt;
say &amp;quot;Before:&amp;quot;;&lt;br /&gt;
say BinaryExpand($a);&lt;br /&gt;
// Remove bytes and insert in its place&lt;br /&gt;
BinaryMidReplace($a, $b, 0);&lt;br /&gt;
// Print result&lt;br /&gt;
say &amp;quot;After:&amp;quot;;&lt;br /&gt;
say BinaryExpand($a);&lt;br /&gt;
// Prints:&lt;br /&gt;
// Before:&lt;br /&gt;
// 00 | 48 65 6C 6C 6F 20 57 6F 72 6C 64 21 -- -- -- -- Hello World!&lt;br /&gt;
// After:&lt;br /&gt;
// 00 | 3 61 74 44 6F 67 -- -- -- -- -- -- -- -- -- -- CatDog&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Core Function]]&lt;/div&gt;</summary>
		<author><name>UberFoX</name></author>	</entry>

	</feed>