Even better question is, if it is this simple, why didn't Microsoft implement their malloc or whatever like this in the first case. If the OS needs to resize the page file, why don't they just delay the return of the function until that is done?
I'm guessing the answer is something along the lines of "it makes applications freeze for <amount of time> and users don't like that".