One of the issues is the many subtle variants of Microchip's ICSP protocol over the years and different device families. If Perdrix needs to program a dsPIC33, that narrows it down a lot, but to be certain one's got the right 'flavour' of the ICSP protocol, one should always check the programming documentation for the specific part.
@Perdrix,
If the dsPIC in question is on the PICkit 2 device support list or is very similar to one that is with the same ICSP protocol documentation, it may well be worth looking at the PICkit 2 firmware source to see how Microchip handled programming it. You'll probably also need to look at the application source to see what commands are being sent to the programmer. See:
https://www.microchip.com/forums/FindPost/804296 for links to everything PICkit 2 related that you may need.
The PICkit 2 firmware sourcecode is written in Microchip C18 to run on a PIC18F2550, and C18 was notorious for not being fully ANSI C89 compliant, so porting the code may offer some challenges other than just changing hardware platforms. YMMV.