title: C++ How To Make Function Crash Upon Being Called Twice (32bit Machine)
body: <p>A program can be re-injected &amp; functions that should only be called once are called twice because the program was re-injected. One way to help prevent this would be to have some of these functions that should only be called once crash upon being called a second time.</p>
  
  <p>I came up with this with no luck:</p>
  
  <pre><code>void exmapleFunction(int r3, int r4)
  {
      //Where our normal function code would go
  }
  
  exmapleFunction(1, 0);//our first call
  *(int*)(&amp;exmapleFunction) = 0x00000000;//set first instruction of our subroutine to 0 to hopefully cause a crash if the function is attempted to be called again
  </code></pre>
  
  <p>Though this did not cause a crash if I tried to call the function a second time which confused me.</p>
  
  <p>And if you are wondering, this is just one of many techniques I'm implementing into my software to <strong>help</strong> make it more annoying to a person attempting to crack my software. Though, please ignore that and just focus on the matter of the question. </p>