Browse Source

* Fixed compilation (mantis #22413)

git-svn-id: trunk@21891 -
michael 13 years ago
parent
commit
1f25547903
1 changed files with 7 additions and 8 deletions
  1. 7 8
      rtl/win/dynlibs.inc

+ 7 - 8
rtl/win/dynlibs.inc

@@ -57,16 +57,15 @@ end;
 Function GetLoadErrorStr: string;
 Function GetLoadErrorStr: string;
 
 
 Var
 Var
-  rc : integer;
+  rc,c : integer;
+  
 begin  
 begin  
   rc := GetLastError;
   rc := GetLastError;
-  try
-    result := Trim(SysErrorMessage(rc));
-    if (result='') then
-      result := 'Operating system error 0x' + IntToHex(rc, 8) + ' (no descriptive text)'
-  except
-    result := 'Operating system error 0x' + IntToHex(rc, 8) + ' (error getting descriptive text)'
-  end;
+  SetLength(Result,255);
+  C:=FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM,nil,rc,
+                 MakeLangId(LANG_NEUTRAL, SUBLANG_DEFAULT),
+                 @Result[1], 255,nil);
+  SetLength(Result,c);
 end;
 end;
 
 
 {$endif}
 {$endif}