View Issue Details

IDProjectCategoryView StatusLast Update
0038382FPCRTLpublic2021-04-22 17:12
ReporterWallaby Assigned ToMarco van de Voort  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformWindows 
Product Version3.3.1 
Summary0038382: Creating a COM server will fail if path contains non-Latin letters
DescriptionIn unit ComServ when a global TComServer object is initialised, it will fail if the current module's path contains non-Latin letters (and Windows default code page is set to English).

This would be because the ANSI version of GetModuleFileName is used. I suggest to replace that with GetModuleFileNameW for which I have attached a patch. This way an application that contains COM automation will fully support foreign characters in paths.
TagsNo tags attached.
Fixed in Revision49245
FPCOldBugId
FPCTarget-
Attached Files

Activities

Wallaby

2021-01-22 05:32

reporter  

comserv.pp.patch (599 bytes)   
Index: comserv.pp
===================================================================
--- comserv.pp	(revision 48131)
+++ comserv.pp	(working copy)
@@ -205,9 +205,12 @@
 function GetModuleFileName: String;
 const
   MAX_PATH_SIZE = 2048;
+var
+  FileName: WideString;
 begin
-  SetLength(Result, MAX_PATH_SIZE);
-  SetLength(Result, Windows.GetModuleFileName(HInstance, @Result[1], MAX_PATH_SIZE));
+  SetLength(FileName, MAX_PATH_SIZE);
+  SetLength(FileName, Windows.GetModuleFileNameW(HInstance, @FileName[1], MAX_PATH_SIZE));
+  Result := FileName;
 end;
 
 function GetModuleName: String;
comserv.pp.patch (599 bytes)   

Marco van de Voort

2021-04-22 17:12

manager   ~0130521

Applied, thanks

Issue History

Date Modified Username Field Change
2021-01-22 05:32 Wallaby New Issue
2021-01-22 05:32 Wallaby File Added: comserv.pp.patch
2021-04-22 17:12 Marco van de Voort Assigned To => Marco van de Voort
2021-04-22 17:12 Marco van de Voort Status new => resolved
2021-04-22 17:12 Marco van de Voort Resolution open => fixed
2021-04-22 17:12 Marco van de Voort Fixed in Revision => 49245
2021-04-22 17:12 Marco van de Voort FPCTarget => -
2021-04-22 17:12 Marco van de Voort Note Added: 0130521