-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
The call to FormatMessage() can only be compiled with {$TYPEDADDRESS OFF}. Otherwise
Lines 430 to 438 in f5d05ba
| Len := FormatMessage( | |
| FORMAT_MESSAGE_ALLOCATE_BUFFER or | |
| FORMAT_MESSAGE_FROM_SYSTEM or | |
| // FORMAT_MESSAGE_IGNORE_INSERTS or | |
| // FORMAT_MESSAGE_ARGUMENT_ARRAY or | |
| FORMAT_MESSAGE_FROM_HMODULE, | |
| Pointer(Hand), | |
| NTStatusMessage, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), | |
| @Buffer, 0, nil); |
will result in a compiler error:
[dcc32 Error] SCrypt.pas(438): E2010 Incompatible types: 'PWideChar' and 'Pointer' (translated from German). This is due to @Buffer being a pointer to PChar while FormatMessage() formally expects a PChar, though because of the combination of flags provided in the first parameter the provided pointer is actually treated as a pointer to PChar internally.
There are two solutions to this problem:
- Put a
{$TYPEDADDRESS OFF}at the top of the unit, or - put a typecast around
@Buffer, i.e.,PChar(@Buffer)
I think the second solution is preferrable, because it makes the special handling of this argument more explicit.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels