INFSTATUS InfpAddField(PINFCONTEXT Context, PCWSTR Data) { if (NULL == Context || NULL == Context->Line) { DPRINT1("Invalid parameter\n"); return INF_STATUS_INVALID_PARAMETER; } if (NULL == InfpAddFieldToLine(Context->Line, Data)) { DPRINT("Failed to add field\n"); return INF_STATUS_NO_MEMORY; } return INF_STATUS_SUCCESS; }
/* 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 = STATUS_WRONG_INF_STYLE; return NULL; } parser->line = InfpCacheAddLine(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 = FALSE; return NULL; }