I'd use Grub's command line completion feature for this. When you boot, as soon as the OS menu appears, you should have the chance to enter 'c' to get a Grub command line ('grub>'). At that command line, enter 'root (hd <tab>' and Grub will show a list of valid drives. If hd1 is one of the choices, you can do: 'root (hd1, <tab>' and get a list of valid partitions. You can then do:
Code:
root (hd1,0)
bogus / <tab>
and get a listing of files and directories in the top level of partition (hd1,0). If it's Windows, you'll recognise it and you can write your Grub script based on that. You may need to use the "map" commands to let Windows think it is on the first hard drive.
You may not see your 2 IDE drives as described above. I had a similar setup, with Linux booting from a drive connected to an ATA/133 PCI card. Linux would boot fine and once up, I had all of my drives, but Grub could not see them: the kernel needed to be loaded for it all to work. My solution was to put a /boot partition on one of my IDE drives which would load the kernel from the IDE /boot partition and then get the root partition from the ATA/133-connected drive.