How to create Extended partition

Hello friends can anyone tell how can we create extended partitions using
Win32 APIs (I don’t want to write any driver for that). I want to create
partitions in NT 4 and windows 95 and drives are SCSI and IDE.

In fact We can use DeviceIoControl with IOCTL IOCTL_DISK_SET_DRIVE_LAYOUT
[You may need some other similar Ioctls for the
purpose]. But this is a solution which works for NT and not for 95.
Moreover, this solution is not very reliable coz the partitions thus created
is not gauranteed to be created correctly… Maybe I would have done some
mistake. I never tried to create the extended partition but only the primary
partition on which I had wasted my lot of time with deviceioControl. Then I
started reading and writing the very first sector of the disk (Don’t worry
how I read) where the
partition table resides and I could create with 90% success rate. All these
trials were only for primary partition. And I want to get as much
information as I can before starting my work on creating and deleting the
extended partition.
So to refine my question can you please get me the information related to
the partition table entry for the extended partitions.
Thanx,
-GM