title: NtQuerySystemInformation returns 24 (ERROR_BAD_LENGTH)
body: <p>Here is my function:</p>
  
  <pre><code>PVOID QuerySystemInformation(SYSTEMINFOCLASS SystemEnum) {
          DWORD MemorySize = NULL;
          NTSTATUS Status = NtQuerySystemInformation(SystemEnum, NULL, 0, &amp;MemorySize);
          if (NT_SUCCESS(Status)) {
              PVOID Memory = PVOID(Allocate(MemorySize));
              if (Memory != ERROR) {
                  Status = NtQuerySystemInformation(SystemEnum, Memory, MemorySize, &amp;MemorySize);
                  if (NT_SUCCESS(Status)) {
                      return Memory;
                  }
                  Free(Memory);
              }
          }
          return ERROR;
      }
  </code></pre>
  
  <p>I pass <code>SystemBasicInformation</code> to the function. After the first call to <code>NtQuerySystemInformation</code>, I get an error. The result of <code>RtlNtStatusToDosError(Status)</code> is <code>24 (ERROR_BAD_LENGTH)</code>. Where is the problem?</p>