I finally figured out, what's been bugging me:
HashTypeBuf is an Array of Byte, and the OP uses it for the second Parameter for XWF_GetHashValue
As the Doc's state:
and a handle to the file (hItem) must be stored in the buffer at offset 4, i.e. directly after the DWORD value
There: Directly after the DWORD-Value.
A DWORD is 4 Bytes.
How in blazes is
HashTypeBuf[1] := hOpenResultAsBytes[0];
supposed to work?
Offset 4 would be HashTypeBuf[4] (0..3 would be the 4 Bytes for this DWORD Value)
EDIT: The original C-Declaration is
BOOL XWF_GetHashValue(
LONG nItemID,
LPVOID lpBuffer
);