Thanks Jaclaz for the links and advertisement on msfn

I am almost done with VHD, only the checksum gives me a hard time

I am stuck on a dumb function for hours and it gets me mad ...
This C function
ULONG
CalculateChecksum(
__in_bcount(Length) PVOID Buffer,
__in ULONG Length
)
/*++
Routine Description:
This routine calculates the one's complement of the checksum of all the
bytes with the given range, excluding the address to ignore.
Arguments:
Buffer - Pointer to the buffer to calculate the checksum for.
Length - Length of the buffer in bytes.
Return Value:
Checksum.
--*/
{
PUCHAR address = NULL;
ULONG checksum = 0;
checksum = 0;
address = (PUCHAR)Buffer;
while (Length != 0)
{
checksum += *address;
Length -= 1;
address += 1;
}
return ~checksum;
}
to this delphi code
function CalculateChecksum(var buf; length:ulong):ulong;
var
p:pword;
sum: ulong;
begin
p:=@buf;
sum:=0;
while (Length <> 0) do
begin
sum := sum + uchar(p^);
dec(length);
inc(p);
end;
Sum := not Sum;
result:=sum;
end;
produces a slightly different number and I dont get it

If a developper nearby happens to see the light...
About VDI, I am quite confident (maybe I should not...) that I'll manage it.
Coming back to VHD, is there any disk driver I should inject in my XP test before I make a VHD of it?
Thanks,
Erwan.