HP's results were down from last year but it still managed to make a bigger profit than expected

Hewlett-Packard reported a 32 percent drop in profit for its second fiscal quarter, due partly to slower sales of PCs and servers.

HP's revenue for the quarter, ended April 30, was $27.6 billion, down 10 percent from the same period last year, the company announced Wednesday.

The company is battling to turn itself around after some strategic missteps, but it's doing so against the headwinds of a shrinking PC market and lackluster economy.

Revenue from HP's massive PC division fell 20 percent in the quarter, led by a steep drop in laptop sales. Its printer division held more or less steady, with sales down 1 percent, HP said.

Business Critical Systems, which includes HP's Itanium servers, had another weak quarter, with sales down 37 percent, and sales of its industry-standard servers also declined. HP managed to eke out some small growth from its networking equipment.

Despite the poor sales, HP's earnings came in ahead of expectations on a pro forma basis, which excludes one-time costs. Pro forma earnings were $0.87 a share for the quarter, compared to the consensus estimate of $0.81 a share, according to a poll by Thomson Reuters.

CEO Meg Whitman said in a statement she was "encouraged" by the results, which she attributed to better-than-expected performance from printer and enterprise services divisions, and to cost-cutting efforts. But she acknowledged the company has "a long way to go."

HP is on track to meet its earnings outlook for the full year, she said.

Last week, Dell reported that it too had a tough quarter. Its profits fell 79 percent, partly due to the shrinking PC market. Founder Michael Dell is also going through a tough battle to take his company private.

James Niccolai covers data centers and general technology news for IDG News Service. Follow James on Twitter at @jniccolai. James's e-mail address is james_niccolai@idg.com