View Issue Details

IDProjectCategoryView StatusLast Update
0033743FPCOtherpublic2018-08-24 08:17
ReporterKlaus1 Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformWindowsOSWindows 7  
Product Version3.0.4 
Target Version3.2.0Fixed in Version3.3.1 
Summary0033743: unit registry; function ReadBinaryData give a Exception when read a special binary data
DescriptionWhen I search on the windows registry on HKCR\.pdf\OpenWithProgIds\
and search for a binary value with Value Nul and the Value has marked with
REG_NONE follow a Exception. The registry editor regedit show the value correct.
Microsoft say on MSDN that the Value for this case is correct.
TagsNo tags attached.
Fixed in Revision39667
FPCOldBugId
FPCTarget
Attached Files

Activities

Serge Anvarov

2018-05-17 15:29

reporter   ~0108371

Example? Save a specific part of the registry to *.reg file and show the code that you use to read it.

Klaus1

2018-08-23 09:04

reporter   ~0110258

(* Ableitung, da ich sonst keine Binärdaten mit Länge Null und
   REG_NONE lesen kann *)
{$IFDEF WINDOWS}
   TERegistry = class(TRegistry)
     public
       function fnReadBinaryData(const Name: string; var Buffer;
                                 BufSize: Integer): Integer;
       constructor Create;overload;
       destructor Destroy;override;
   end;
{$ENDIF}

{$IFDEF WINDOWS}
  constructor TERegistry.Create;
    begin
      inherited Create;
    end;

  destructor TERegistry.Destroy;
   begin
    inherited Destroy;
   end;

  function TERegistry.fnReadBinaryData(const Name: string; var Buffer;
                                       BufSize: Integer): Integer;
   var
     RegDataType :TRegDataType;

  begin
    Result := GetData(Name, @Buffer, BufSize, RegDataType);
    case RegDataType of
      rdUnknown:;
      rdString,rdExpandString,rdInteger:
        raise ERegistryException.CreateFmt(SInvalidRegType, [Name]);
    end;
  end;

{$ENDIF}
My work around -> I have not error yet.

Serge Anvarov

2018-08-23 21:36

reporter  

registry.diff (484 bytes)   
Index: packages/fcl-registry/src/registry.pp
===================================================================
--- packages/fcl-registry/src/registry.pp	(revision 39662)
+++ packages/fcl-registry/src/registry.pp	(working copy)
@@ -331,7 +331,7 @@
 
 begin
   Result := GetData(Name, @Buffer, BufSize, RegDataType);
-  If (RegDataType<>rdBinary) Then
+  If not (RegDataType in [rdBinary, rdUnknown]) Then
     Raise ERegistryException.CreateFmt(SInvalidRegType, [Name]);
 end;
 
registry.diff (484 bytes)   

Serge Anvarov

2018-08-23 21:38

reporter   ~0110274

OK. Patch.

Michael Van Canneyt

2018-08-24 08:17

administrator   ~0110281

Fixed as proposed, thank you very much.

Issue History

Date Modified Username Field Change
2018-05-16 07:52 Klaus1 New Issue
2018-05-17 15:29 Serge Anvarov Note Added: 0108371
2018-08-23 09:04 Klaus1 Note Added: 0110258
2018-08-23 21:36 Serge Anvarov File Added: registry.diff
2018-08-23 21:38 Serge Anvarov Note Added: 0110274
2018-08-24 08:17 Michael Van Canneyt Assigned To => Michael Van Canneyt
2018-08-24 08:17 Michael Van Canneyt Status new => assigned
2018-08-24 08:17 Michael Van Canneyt Fixed in Revision => 39667
2018-08-24 08:17 Michael Van Canneyt Note Added: 0110281
2018-08-24 08:17 Michael Van Canneyt Status assigned => resolved
2018-08-24 08:17 Michael Van Canneyt Fixed in Version => 3.3.1
2018-08-24 08:17 Michael Van Canneyt Resolution open => fixed
2018-08-24 08:17 Michael Van Canneyt Target Version => 3.2.0