synopse/mORMot

TWinHTTP Thread safe issue in filling OSVersionInfo

myonlylonely opened this issue · 1 comments

Filling OSVersionInfo is not thread safe, it shoud be moved into the initialization part. It can cause the OpenType and the TWinHTTP.InternalGetProtocols check failed.

procedure TWinHTTP.InternalConnect(ConnectionTimeOut,SendTimeout,ReceiveTimeout: DWORD);
//...
begin
  if OSVersionInfo.dwOSVersionInfoSize=0 then begin // API call once
    OSVersionInfo.dwOSVersionInfoSize := sizeof(OSVersionInfo);
    GetVersionEx(OSVersionInfo);
  end;
//...

BTW mORMot 2 is not affected.