You don't need all that, it's all
winapi:
// This is the version for NT Terminal Server, 2000, XP/2003 and Server 2008
function DateTimeString(DateTime: PFILETIME; lpBuffer: PWideChar): PWideChar;
stdcall;
// This is a wrapped for all
OS versions
function DateTimeStringSafe(DateTime: PFILETIME; lpBuffer: PWideChar;
cchDest: SIZE_T): PWideChar; stdcall;
// This is the Vista version which takes an additional parameter with
// maximum buffer size (you have to set it)
function DateTimeStringVista(DateTime: PFILETIME; lpBuffer: PWideChar;
cchDest: SIZE_T): PWideChar; stdcall;
function DateTimeString; external utildll name 'DateTimeString';
function DateTimeStringVista; external utildll name 'DateTimeString';
function DateTimeStringSafe(DateTime: PFILETIME; lpBuffer: PWideChar;
cchDest: SIZE_T): PWideChar; stdcall;
begin
// Zero Memory
ZeroMemory(lpBuffer, cchDest * SizeOf(WCHAR));
// Are we running Vista?
if IsVista then
begin
// Vista version
Result := DateTimeStringVista(DateTime, lpBuffer, cchDest);
end
else begin
// Other
OS's (including server 2008!)
Result := DateTimeString(DateTime, lpBuffer);
end;
end;