the first number is the stack "reserve" - there is no way to increase it dynamically
the second one is the "commit" - probing the stack can take care of this one
what i would do is try to re-design the program so that the limit is known and not exceeded
rather than using an increased stack size, use "normal" dynamic allocation, such as HeapAlloc or VirtualAlloc
that way, the stack limitation is not an issue
the heap is managed by the operating system
and - memory that isn't reserved for stack space is available for other types of allocation
the OS balances stack requirement with other memory requirements
you should be able to calculate the requirement before reading the data into memory