first off, formatting D was a waste of time and could only lead to a loss of your data, it is not important to the running of windows and is where i personally store all my downloaded files including any photos/documents etc. then in the case of needing to re-install windows, a simple format of C: and setup windows, all my data is intact and i can install all my existing software quickly and easily.
so back to your problem, how big is the actual hard drive (should be on a sticker on your lappy), how big are the partitions (C: +D:), dont expect them to add upto 40gig if you have a 40gig drive lol it doesnt work quite like that, it will probably be about 36 or 37 gig (my 160 gig is 152.5 after formatting) so i "lost" 7.5 gig, you should lose around 3gig
if you click My computer and select Manage, then disk management. it will show you the partitioning information of your hard drive, dont do anything there yet, just take a note of the sizes and come back to us. if you use a restore cd rather than a full XP CD then you might actually have a third partition which is hidden (this is where the data for the restore is held, the cd is only to boot up the restore program)
also let us know if you want to start again with re-installing windows or want to work with what you have (but i have to say, windows works much happier on drive C:)
if you want to make the partitions different sizes, you can but you need a program such as Partition Manager or something similar.