At the old days of DOS, I only needed to read the right hardware port ($3DA) and wait the bits became $00. But now, as we know, the WinXP blocks the access to the hardware ports (except for driver mode programs) so any tries to read using the mnemonic IN (or write with mnemonic OUT) cause an "Access Violation".
This is the code that works under TurboPascal:

[pascal]procedure waitVSync; assembler;
begin
Mov dx,3DAh
@L1:
In al,dx
And al,08h
Jnz @L1
@L2:
In al,dx
And al,08h
Jz @L2
end;

[/pascal]And the same approach using Turbo C++:

Code:
void blit(void){
   while( inportb(0x3DA) & 8);
   while(!(inportb(0x3DA) & 8));
   _fmemcpy(VGA, offScreen, 64000);
}
I wonder if there are some WIN32API function that could do the same or any tricks to read the port $3DA?

Thanks a lot.