Delphi-Quellcode:
Inherited Create(CreateFileW(PWideChar(FileName), GENERIC_READ or GENERIC_WRITE,
0, nil, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0));
If FHandle < 0 Then
Raise EFCreateError.CreateResFmt(@SFCreateErrorEx, [ExpandFileName(FileName), SysErrorMessage(GetLastError)]);
Sollte
CreateFile fehlschlagen ist der Rückgabewert nicht kleiner null, sondern
INVALID_HANDLE_VALUE:
Zitat:
If the function fails, the return value is INVALID_HANDLE_VALUE. To get extended error information, call GetLastError.