Implement TRegistry.RegistryConnect for Windows (excluding WinCE).

registry.pp, TRegistry:
  * use FSysData to hold information whether we need to close the RootKey
winrec.inc, TRegistry:
  + add a TWinRegData type that holds the information whether the RootKey was explicitely opened by us
  * SysRegCreate: allocate FSysData as PWinRegData
  * SysRegFree: close the RootKey if necessary and free FSysData
  + RegistryConnect: implement for Win32/Win64; update RootKey only if RegConnectRegistry connects successfully, also the RootKey is now owned by us
  * SetRootKey: update the RootKey only if it differs from previous value (avoids orphaning the key by doing a "reg.RootKey := reg.RootKey") and close the previous RootKey if it was owned by us
  

git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@25332 3ad0048d-3df7-0310-abae-a5850022a9f2