well first off what do u mean pirated? did you get it from a friend (make a copy?) or did you download it from kazaa? or other p2p service.
copied cd instructions: mewgood.com get a cdkey filler and get 2 legit cdkeys (d2 origional and d2 lod cdkey). fill the cdkeys your using and get d2loaded to load these cdkeys by typing in -mpq cdkey.mpq under preferences on the shortcut. (more info on the cdkey refiller readme!)
p2p copy of d2 and lod : get a nocd program at mewgood.com, and cdkey refiller get 2 cdkeys as mentioned above, then use your nocd shortcut properties and type: -mpq cdkey.mpq on the properties menu of the shortcut to make it read the cdkeys and you should be able to play on bnet.
btw: your going to need 2 legit cdkeys to play. a cdkey generator WILL NOT WORK!