コード例 #1
0
ファイル: infcore.c プロジェクト: GYGit/reactos
/* add a field containing the current token to the current line */
static struct field *add_field_from_token( struct parser *parser, int is_key )
{
  PVOID field;

  if (!parser->line)  /* need to start a new line */
    {
      if (parser->cur_section == NULL)  /* got a line before the first section */
        {
          parser->error = INF_STATUS_WRONG_INF_STYLE;
          return NULL;
        }

      parser->line = InfpAddLine(parser->cur_section);
      if (parser->line == NULL)
        goto error;
    }
  else
    {
//      assert(!is_key);
    }

  if (is_key)
    {
      field = InfpAddKeyToLine(parser->line, parser->token);
    }
  else
    {
      field = InfpAddFieldToLine(parser->line, parser->token);
    }

  if (field != NULL)
    {
      parser->token_len = 0;
      return field;
    }

error:
  parser->error = INF_STATUS_NOT_ENOUGH_MEMORY;
  return NULL;
}
コード例 #2
0
ファイル: infput.c プロジェクト: HBelusca/NasuTek-Odyssey
INFSTATUS
InfpAddLineWithKey(PINFCONTEXT Context, PCWSTR Key)
{
  if (NULL == Context)
    {
      DPRINT1("Invalid parameter\n");
      return INF_STATUS_INVALID_PARAMETER;
    }

  Context->Line = InfpAddLine(Context->Section);
  if (NULL == Context->Line)
    {
      DPRINT("Failed to create line\n");
      return INF_STATUS_NO_MEMORY;
    }

  if (NULL != Key && NULL == InfpAddKeyToLine(Context->Line, Key))
    {
      DPRINT("Failed to add key\n");
      return INF_STATUS_NO_MEMORY;
    }

  return INF_STATUS_SUCCESS;
}