Concept: If \(\int e^x g(x)dx = e^x f(x) + C\), then differentiating gives \(f(x) + f'(x) = g(x)\). Test each option by computing \(f+f'\) and matching with the given \(g(x) = \frac{x^3+3x^2+4}{(x+1)^3}\).
Step 1: Option (A): \(f(x) = \frac{x^2+2x-2}{(x+1)^2}\). Compute \(f'(x)\): derivative of numerator \((2x+2)\), denominator \((x+1)^2\). Using quotient rule, \(f'(x) = \frac{6}{(x+1)^3}\). Then \(f+f' = \frac{(x^2+2x-2)(x+1)+6}{(x+1)^3} = \frac{x^3+3x^2-2+6}{(x+1)^3} = \frac{x^3+3x^2+4}{(x+1)^3} = g(x)\). Matches.
Step 2: Option (A) is correct.
Step 3: Write the final answer. \(\boxed{f(x)=\frac{x^2+2x-2}{(x+1)^2}}\)