synopse / mORMot

Synopse mORMot 1 ORM/SOA/MVC framework - Please upgrade to mORMot 2 !
https://synopse.info
785 stars 323 forks source link

TWinHTTP Thread safe issue in filling OSVersionInfo #442

Closed myonlylonely closed 1 year ago

myonlylonely commented 1 year ago

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;
//...
synopse commented 1 year ago

BTW mORMot 2 is not affected.