Skip to content

Commit

Permalink
fixed SynCrtSock.SysErrorMessagePerModule on non-English systems
Browse files Browse the repository at this point in the history
- as reported by #411
  • Loading branch information
Arnaud Bouchez committed Oct 28, 2021
1 parent 8494081 commit f5cb6f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions SynCrtSock.pas
Original file line number Diff line number Diff line change
Expand Up @@ -3922,6 +3922,11 @@ function SysErrorMessagePerModule(Code: DWORD; ModuleName: PChar): string;
tmpLen := FormatMessage(
FORMAT_MESSAGE_FROM_HMODULE or FORMAT_MESSAGE_ALLOCATE_BUFFER,
pointer(GetModuleHandle(ModuleName)),Code,ENGLISH_LANGID,@err,0,nil);
// if string is empty, it may be because english is not found
if (tmpLen = 0) then
tmpLen := FormatMessage(
FORMAT_MESSAGE_FROM_HMODULE or FORMAT_MESSAGE_ALLOCATE_BUFFER or FORMAT_MESSAGE_IGNORE_INSERTS,
pointer(GetModuleHandle(ModuleName)),Code,0,@err,0,nil);
try
while (tmpLen>0) and (ord(err[tmpLen-1]) in [0..32,ord('.')]) do
dec(tmpLen);
Expand Down
2 changes: 1 addition & 1 deletion SynopseCommit.inc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
'1.18.6337'
'1.18.6338'

0 comments on commit f5cb6f9

Please sign in to comment.