title: Windows Assembly (x86) Read from Stdin and output to Stdout
body: <p>I recently figured out how to write to stdout in assembly but am now having trouble reading from stdin, and outputting what I read back to stdout. This is the code I have so far:</p>
  
  <pre><code>.386
  .model flat, stdcall
  
  WriteFile PROTO STDCALL:DWORD, :PTR, :DWORD, :PTR DWORD, :PTR OVERLAPPED
  ReadFile  PROTO STDCALL:DWORD, :PTR, :DWORD, :PTR DWORD, :PTR OVERLAPPED
  GetStdHandle PROTO STDCALL:DWORD
  .data
  
  
  .data?
  input DW ?
  input_size DD ?
  read DD ?
  
  .code
  main:
      INVOKE GetStdHandle, -10
      INVOKE ReadFile, eax, OFFSET input, input_size, read, 0
      INVOKE GetStdHandle, -11
      INVOKE WriteFile, eax, OFFSET input, OFFSET input_size, read, 0
      RET 
  END main
  </code></pre>
  
  <p>I'm pretty sure I'm reading it wrong. I am pretty sure that <code>input_size</code> and <code>read</code> are not behaving as expected (if I replace <code>input_size</code> with a <code>number</code> it displays a space <code>number</code> times) which is contributing to my problem (when I enter my input and hit return it simply displays nothing). </p>
  
  <p>I have fumbled around with this for quite some time and would appreciate any help. (I am doing this just to learn this is not homework).</p>
  
  <p>My question essentialy is what am I doing wrong?</p>