View Issue Details

IDProjectCategoryView StatusLast Update
0035227FPCPackagespublic2019-04-03 15:51
ReporterBart BroersmaAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformx86_64OSLinux MintOS Version18.0
Product Version3.3.1Product Buildr41352 
Target Version3.2.0Fixed in Version3.3.1 
Summary0035227: TXMLRegistry does not support Int64
DescriptionOn non-Windows platforms TRegistry.WriteInt64 raises an excpetion:
ERegistryException: Registry data type not supported on this platform: rdInt64
TagsNo tags attached.
Fixed in Revision41810
FPCOldBugId
FPCTarget
Attached Files
  • registry.int64.xmlreg.diff (2,299 bytes)
    Index: packages/fcl-registry/src/xmlreg.pp
    ===================================================================
    --- packages/fcl-registry/src/xmlreg.pp	(revision 41788)
    +++ packages/fcl-registry/src/xmlreg.pp	(working copy)
    @@ -10,7 +10,7 @@
     
     Type
     
    -  TDataType = (dtUnknown,dtDWORD,dtString,dtBinary,dtStrings);
    +  TDataType = (dtUnknown,dtDWORD,dtString,dtBinary,dtStrings,dtQWord);
       TDataInfo = record
         DataType : TDataType;
         DataSize : Integer;
    @@ -306,6 +306,7 @@
       U : UnicodeString;
       HasData: Boolean;
       D : DWord;
    +  Q : QWord;
       
     begin
       //writeln('TXmlRegistry.DoGetValueData: Name=',Name,' IsUnicode=',IsUnicode);
    @@ -332,6 +333,12 @@
                       if Result then
                         PCardinal(@Data)^:=D;
                       end;
    +        dtQWORD : begin   // DataNode is required
    +                  NS:=SizeOf(QWORD);
    +                  Result:=HasData and TryStrToQWord(String(DataNode.NodeValue),Q) and (DataSize>=NS);
    +                  if Result then
    +                    PUInt64(@Data)^:=Q;
    +                  end;
             dtString : // DataNode is optional
                        if HasData then
                          begin
    @@ -396,6 +403,7 @@
     
         Case DataType of
           dtDWORD : SW:=UnicodeString(IntToStr(PCardinal(@Data)^));
    +      dtQWORD : SW:=UnicodeString(IntToStr(PUInt64(@Data)^));
           dtString : begin
                      if IsUnicode then
                        SW:=UnicodeString(PUnicodeChar(@Data))
    Index: packages/fcl-registry/src/xregreg.inc
    ===================================================================
    --- packages/fcl-registry/src/xregreg.inc	(revision 41788)
    +++ packages/fcl-registry/src/xregreg.inc	(working copy)
    @@ -20,6 +20,7 @@
         rdInteger               : Result := dtDword;
         rdBinary                : Result := dtBinary;
         rdMultiString           : Result := dtStrings;
    +    rdInt64                 : Result := dtQword;
       else
         Raise ERegistryException.CreateFmt(SErrTypeNotSupported,[GetEnumName(TypeInfo(TRegDataType),Ord(RegData))]);
       end;
    @@ -31,6 +32,7 @@
       Case DataType of
         dtUnknown: Result:=rdUnknown;
         dtDword  : Result:=rdInteger;
    +    dtQword  : Result:=rdInt64;
         dtString : Result:=rdString;
         dtBinary : Result:=rdBinary;
         dtStrings : Result:=rdMultiString;
    

Activities

Bart Broersma

2019-03-14 21:08

reporter   ~0114827

I can supply a patch, implementation probably is trivial, but first I want to fix 0035213.

Bart Broersma

2019-03-31 13:01

reporter  

registry.int64.xmlreg.diff (2,299 bytes)
Index: packages/fcl-registry/src/xmlreg.pp
===================================================================
--- packages/fcl-registry/src/xmlreg.pp	(revision 41788)
+++ packages/fcl-registry/src/xmlreg.pp	(working copy)
@@ -10,7 +10,7 @@
 
 Type
 
-  TDataType = (dtUnknown,dtDWORD,dtString,dtBinary,dtStrings);
+  TDataType = (dtUnknown,dtDWORD,dtString,dtBinary,dtStrings,dtQWord);
   TDataInfo = record
     DataType : TDataType;
     DataSize : Integer;
@@ -306,6 +306,7 @@
   U : UnicodeString;
   HasData: Boolean;
   D : DWord;
+  Q : QWord;
   
 begin
   //writeln('TXmlRegistry.DoGetValueData: Name=',Name,' IsUnicode=',IsUnicode);
@@ -332,6 +333,12 @@
                   if Result then
                     PCardinal(@Data)^:=D;
                   end;
+        dtQWORD : begin   // DataNode is required
+                  NS:=SizeOf(QWORD);
+                  Result:=HasData and TryStrToQWord(String(DataNode.NodeValue),Q) and (DataSize>=NS);
+                  if Result then
+                    PUInt64(@Data)^:=Q;
+                  end;
         dtString : // DataNode is optional
                    if HasData then
                      begin
@@ -396,6 +403,7 @@
 
     Case DataType of
       dtDWORD : SW:=UnicodeString(IntToStr(PCardinal(@Data)^));
+      dtQWORD : SW:=UnicodeString(IntToStr(PUInt64(@Data)^));
       dtString : begin
                  if IsUnicode then
                    SW:=UnicodeString(PUnicodeChar(@Data))
Index: packages/fcl-registry/src/xregreg.inc
===================================================================
--- packages/fcl-registry/src/xregreg.inc	(revision 41788)
+++ packages/fcl-registry/src/xregreg.inc	(working copy)
@@ -20,6 +20,7 @@
     rdInteger               : Result := dtDword;
     rdBinary                : Result := dtBinary;
     rdMultiString           : Result := dtStrings;
+    rdInt64                 : Result := dtQword;
   else
     Raise ERegistryException.CreateFmt(SErrTypeNotSupported,[GetEnumName(TypeInfo(TRegDataType),Ord(RegData))]);
   end;
@@ -31,6 +32,7 @@
   Case DataType of
     dtUnknown: Result:=rdUnknown;
     dtDword  : Result:=rdInteger;
+    dtQword  : Result:=rdInt64;
     dtString : Result:=rdString;
     dtBinary : Result:=rdBinary;
     dtStrings : Result:=rdMultiString;

Bart Broersma

2019-03-31 13:02

reporter   ~0115143

Patch registry.int64.xmlreg.diff implements Int64 support for the xmlreg implementation of TRegistry.

Since Integers are written as DWord (unsigned) I opted to do the same for Int64.

Michael Van Canneyt

2019-04-01 18:48

administrator   ~0115168

Thanks for the patch. Checked and applied. The choice for QWord is somewhat surprising, but I don't think we should change it.

Issue History

Date Modified Username Field Change
2019-03-14 21:07 Bart Broersma New Issue
2019-03-14 21:08 Bart Broersma Note Added: 0114827
2019-03-31 13:01 Bart Broersma File Added: registry.int64.xmlreg.diff
2019-03-31 13:02 Bart Broersma Note Added: 0115143
2019-04-01 18:41 Michael Van Canneyt Assigned To => Michael Van Canneyt
2019-04-01 18:41 Michael Van Canneyt Status new => assigned
2019-04-01 18:48 Michael Van Canneyt Fixed in Revision => 41810
2019-04-01 18:48 Michael Van Canneyt Note Added: 0115168
2019-04-01 18:48 Michael Van Canneyt Status assigned => resolved
2019-04-01 18:48 Michael Van Canneyt Fixed in Version => 3.3.1
2019-04-01 18:48 Michael Van Canneyt Resolution open => fixed
2019-04-01 18:48 Michael Van Canneyt Target Version => 3.2.0
2019-04-03 15:51 Bart Broersma Status resolved => closed