Part of the codes in my application use Writefile to write to a disk partition. It works in XP but not in Windows 7. The value of TempPos is zero after written. What is wrong? Will there be file access rights problem? Thanks

__int64 Tmp64 = (((__int64) DriveInfo->NTRelativeSector) + ((__int64) DriveInfo->RelativeSector)) * 512;
long TempPos = Tmp64 & 0xFFFFFFFF;
long TempPosHi = (Tmp64 >> 32);
SetFilePointer(MyDisk[DriveInfo->Drive], TempPos, &TempPosHi, FILE_BEGIN);
TempPos = 0;
WriteFile(MyDisk[DriveInfo->Drive], Buffer, DriveInfo->NumSectors * 512, (DWORD *) &TempPos, NULL);