* Patch from Bart Broersma to implement Int64 support in xmlreg (bug ID 35227)

git-svn-id: trunk@41810 -
This commit is contained in:
michael 2019-04-01 16:46:48 +00:00
parent 848a563128
commit 17aa8da99f
2 changed files with 11 additions and 1 deletions

View File

@ -10,7 +10,7 @@ uses
Type Type
TDataType = (dtUnknown,dtDWORD,dtString,dtBinary,dtStrings); TDataType = (dtUnknown,dtDWORD,dtString,dtBinary,dtStrings,dtQWord);
TDataInfo = record TDataInfo = record
DataType : TDataType; DataType : TDataType;
DataSize : Integer; DataSize : Integer;
@ -306,6 +306,7 @@ Var
U : UnicodeString; U : UnicodeString;
HasData: Boolean; HasData: Boolean;
D : DWord; D : DWord;
Q : QWord;
begin begin
//writeln('TXmlRegistry.DoGetValueData: Name=',Name,' IsUnicode=',IsUnicode); //writeln('TXmlRegistry.DoGetValueData: Name=',Name,' IsUnicode=',IsUnicode);
@ -332,6 +333,12 @@ begin
if Result then if Result then
PCardinal(@Data)^:=D; PCardinal(@Data)^:=D;
end; 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 dtString : // DataNode is optional
if HasData then if HasData then
begin begin
@ -396,6 +403,7 @@ begin
Case DataType of Case DataType of
dtDWORD : SW:=UnicodeString(IntToStr(PCardinal(@Data)^)); dtDWORD : SW:=UnicodeString(IntToStr(PCardinal(@Data)^));
dtQWORD : SW:=UnicodeString(IntToStr(PUInt64(@Data)^));
dtString : begin dtString : begin
if IsUnicode then if IsUnicode then
SW:=UnicodeString(PUnicodeChar(@Data)) SW:=UnicodeString(PUnicodeChar(@Data))

View File

@ -20,6 +20,7 @@ begin
rdInteger : Result := dtDword; rdInteger : Result := dtDword;
rdBinary : Result := dtBinary; rdBinary : Result := dtBinary;
rdMultiString : Result := dtStrings; rdMultiString : Result := dtStrings;
rdInt64 : Result := dtQword;
else else
Raise ERegistryException.CreateFmt(SErrTypeNotSupported,[GetEnumName(TypeInfo(TRegDataType),Ord(RegData))]); Raise ERegistryException.CreateFmt(SErrTypeNotSupported,[GetEnumName(TypeInfo(TRegDataType),Ord(RegData))]);
end; end;
@ -31,6 +32,7 @@ begin
Case DataType of Case DataType of
dtUnknown: Result:=rdUnknown; dtUnknown: Result:=rdUnknown;
dtDword : Result:=rdInteger; dtDword : Result:=rdInteger;
dtQword : Result:=rdInt64;
dtString : Result:=rdString; dtString : Result:=rdString;
dtBinary : Result:=rdBinary; dtBinary : Result:=rdBinary;
dtStrings : Result:=rdMultiString; dtStrings : Result:=rdMultiString;