//------------------------------------------------------------------------------
void GetUserGroupFromRegFile(DWORD rid, char *group, DWORD group_size_max, HK_F_OPEN *hks, char *reg_path)
{
  HBIN_CELL_NK_HEADER *nk_h = GetRegistryNK(hks->buffer, hks->taille_fic, (hks->pos_fhbin)+HBIN_HEADER_SIZE, hks->position, reg_path);
  if (nk_h == NULL)return;

  HBIN_CELL_NK_HEADER *nk_h_tmp;
  char cbuffer[MAX_LINE_SIZE], buffer[MAX_LINE_SIZE];
  DWORD valueSize,i,nbSubKey = GetSubNK(hks->buffer, hks->taille_fic, nk_h, hks->position, 0, NULL, 0);
  for (i=0;i<nbSubKey;i++)
  {
    //get nk of key :)
    nk_h_tmp = GetSubNKtonk(hks->buffer, hks->taille_fic, nk_h, hks->position, i);
    if (nk_h_tmp == NULL)continue;

    //C
    buffer[0]  = 0;
    cbuffer[0] = 0;
    valueSize  = MAX_LINE_SIZE;
    if(ReadBinarynk_Value(hks->buffer, hks->taille_fic, (hks->pos_fhbin)+HBIN_HEADER_SIZE, hks->position, NULL, nk_h_tmp,"C", buffer, &valueSize))
    {
      DataToHexaChar(buffer, valueSize, cbuffer, MAX_LINE_SIZE);
      TraiterGroupDataFromSAM_C(cbuffer, rid,  group,  group_size_max);
    }
  }
}
//------------------------------------------------------------------------------
void GetUserGroupInfos(unsigned int rid, char *group, unsigned int group_size_max, char *reg_path)
{
  int ret = set_sam_tree_access(HKEY_LOCAL_MACHINE,reg_path);
  if (ret == 0)
  {
    //read all groups
    HKEY CleTmp;
    if (RegOpenKey(HKEY_LOCAL_MACHINE,reg_path,&CleTmp)==ERROR_SUCCESS)
    {
      DWORD i,nbSubKey = 0, SubKeysize, valueSize;
      char NomSubKey[MAX_PATH], path[MAX_PATH],buffer[MAX_LINE_SIZE],cbuffer[MAX_LINE_SIZE];
      RegQueryInfoKey (CleTmp,0,0,0,&nbSubKey,0,0,0,0,0,0,0);
      for(i=0;i<nbSubKey;i++)
      {
        NomSubKey[0]=0;
        SubKeysize = MAX_PATH;
        if (RegEnumKeyEx(CleTmp,i,NomSubKey,&SubKeysize,0,0,0,0)==ERROR_SUCCESS)
        {
          //génération du path group
          buffer[0] = 0;
          cbuffer[0] = 0;
          snprintf(path,MAX_PATH,"%s\\%s",reg_path,NomSubKey);
          if((valueSize = ReadValue(HKEY_LOCAL_MACHINE, path, "C", buffer, MAX_LINE_SIZE)))
          {
            DataToHexaChar(buffer, valueSize, cbuffer, MAX_LINE_SIZE);
            TraiterGroupDataFromSAM_C(cbuffer, rid,  group,  group_size_max);
          }
        }
      }
      RegCloseKey(CleTmp);
    }
  }
  restore_sam_tree_access(HKEY_LOCAL_MACHINE,reg_path);
}