Subversion Repositories userdetect2

Rev

Rev 86 | Rev 90 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 86 Rev 87
Line 16... Line 16...
16
  TUD2IdentificationEntry = class;
16
  TUD2IdentificationEntry = class;
17
 
17
 
18
  TUD2Plugin = class(TObject)
18
  TUD2Plugin = class(TObject)
19
  protected
19
  protected
20
    FDetectedIdentifications: TObjectList{<TUD2IdentificationEntry>};
20
    FDetectedIdentifications: TObjectList{<TUD2IdentificationEntry>};
-
 
21
    FOSNotSupportedEnforced: boolean;
-
 
22
    FPluginDLL: string;
-
 
23
    FPluginGUIDSet: boolean;
-
 
24
    FPluginGUID: TGUID;
-
 
25
    FPluginName: WideString;
-
 
26
    FPluginVendor: WideString;
-
 
27
    FPluginVersion: WideString;
-
 
28
    FIdentificationMethodName: WideString;
-
 
29
    FAcceptsDynamicRequests: boolean;
-
 
30
    FIdentificationProcedureStatusCode: UD2_STATUS;
-
 
31
    FIdentificationProcedureStatusCodeDescribed: WideString;
-
 
32
    FLoadingTime: Cardinal;
21
  public
33
  public
22
    // This flag will be set if "AutoOSNotSupportedCompatibility" of the INI manifest had to be enforced/used
34
    // This flag will be set if "AutoOSNotSupportedCompatibility" of the INI manifest had to be enforced/used
23
    OSNotSupportedEnforced: boolean;
35
    property OSNotSupportedEnforced: boolean read FOSNotSupportedEnforced;
24
 
36
 
25
    // TODO: this stuff should be read-only...    
37
    // Data read from the DLL
26
    PluginDLL: string;
38
    property PluginDLL: string read FPluginDLL;
-
 
39
    property PluginGUIDSet: boolean read FPluginGUIDSet;
27
    PluginGUID: TGUID;
40
    property PluginGUID: TGUID read FPluginGUID;
28
    PluginName: WideString;
41
    property PluginName: WideString read FPluginName;
29
    PluginVendor: WideString;
42
    property PluginVendor: WideString read FPluginVendor;
30
    PluginVersion: WideString;
43
    property PluginVersion: WideString read FPluginVersion;
31
    IdentificationMethodName: WideString;
44
    property IdentificationMethodName: WideString read FIdentificationMethodName;
32
    AcceptsDynamicRequests: boolean;
45
    property AcceptsDynamicRequests: boolean read FAcceptsDynamicRequests;
33
 
46
 
34
    // ONLY contains the non-failure status code of IdentificationStringW
47
    // ONLY contains the non-failure status code of IdentificationStringW
35
    IdentificationProcedureStatusCode: UD2_STATUS;
48
    property IdentificationProcedureStatusCode: UD2_STATUS read FIdentificationProcedureStatusCode;
36
    IdentificationProcedureStatusCodeDescribed: WideString;
49
    property IdentificationProcedureStatusCodeDescribed: WideString read FIdentificationProcedureStatusCodeDescribed;
-
 
50
 
-
 
51
    // How long did the plugin to load?
-
 
52
    property LoadingTime: Cardinal read FLoadingTime;
37
 
53
 
38
    Time: Cardinal;
-
 
39
    function PluginGUIDString: string;
54
    function PluginGUIDString: string;
40
    property DetectedIdentifications: TObjectList{<TUD2IdentificationEntry>} read FDetectedIdentifications;
55
    property DetectedIdentifications: TObjectList{<TUD2IdentificationEntry>} read FDetectedIdentifications;
41
    destructor Destroy; override;
56
    destructor Destroy; override;
42
    constructor Create;
57
    constructor Create;
43
    function AddIdentification(IdStr: WideString): TUD2IdentificationEntry;
58
    function AddIdentification(IdStr: WideString): TUD2IdentificationEntry;
44
 
59
 
45
    function InvokeDynamicCheck(dynamicData: string; var outIDs: TArrayOfString): boolean; overload;
60
    function InvokeDynamicCheck(dynamicData: WideString; var outIDs: TArrayOfString): boolean; overload;
46
    function InvokeDynamicCheck(dynamicData: string): boolean; overload;
61
    function InvokeDynamicCheck(dynamicData: WideString): boolean; overload;
47
    function GetDynamicRequestResult(dynamicData: string): TArrayOfString;
62
    function GetDynamicRequestResult(dynamicData: WideString): TArrayOfString;
48
 
63
 
49
    function EqualsMethodNameOrGuid(idMethodNameOrGUID: string): boolean;
64
    function EqualsMethodNameOrGuid(idMethodNameOrGUID: string): boolean;
50
  end;
65
  end;
51
 
66
 
52
  TUD2IdentificationEntry = class(TObject)
67
  TUD2IdentificationEntry = class(TObject)
53
  private
68
  private
54
    FIdentificationString: WideString;
69
    FIdentificationString: WideString;
55
    FPlugin: TUD2Plugin;
70
    FPlugin: TUD2Plugin;
56
    FDynamicDataUsed: boolean;
71
    FDynamicDataUsed: boolean;
57
    FDynamicData: string;
72
    FDynamicData: WideString;
58
  public
73
  public
59
    property DynamicDataUsed: boolean read FDynamicDataUsed write FDynamicDataUsed;
74
    property DynamicDataUsed: boolean read FDynamicDataUsed write FDynamicDataUsed;
60
    property DynamicData: string read FDynamicData write FDynamicData;
75
    property DynamicData: WideString read FDynamicData write FDynamicData;
61
    property IdentificationString: WideString read FIdentificationString;
76
    property IdentificationString: WideString read FIdentificationString;
62
    property Plugin: TUD2Plugin read FPlugin;
77
    property Plugin: TUD2Plugin read FPlugin;
63
    procedure GetIdNames(sl: TStrings);
78
    procedure GetIdNames(sl: TStrings);
64
    constructor Create(AIdentificationString: WideString; APlugin: TUD2Plugin);
79
    constructor Create(AIdentificationString: WideString; APlugin: TUD2Plugin);
65
  end;
80
  end;
Line 112... Line 127...
112
    useDynamicData: boolean;
127
    useDynamicData: boolean;
113
    dynamicData: WideString;
128
    dynamicData: WideString;
114
    procedure Execute; override;
129
    procedure Execute; override;
115
    function HandleDLL: boolean;
130
    function HandleDLL: boolean;
116
  public
131
  public
117
    pl: TUD2Plugin; // TODO: why do we need it?! can it be leaked if we use it for dynamic requests?
132
    pl: TUD2Plugin;
118
    Errors: TStringList;
133
    Errors: TStringList;
119
    ResultIdentifiers: TArrayOfString;
134
    ResultIdentifiers: TArrayOfString;
120
    constructor Create(Suspended: boolean; DLL: string; alngid: LANGID; useDynamicData: boolean; dynamicData: WideString);
135
    constructor Create(Suspended: boolean; DLL: string; alngid: LANGID; useDynamicData: boolean; dynamicData: WideString);
121
    destructor Destroy; override;
136
    destructor Destroy; override;
122
  end;
137
  end;
Line 172... Line 187...
172
 
187
 
173
{ TUD2Plugin }
188
{ TUD2Plugin }
174
 
189
 
175
function TUD2Plugin.PluginGUIDString: string;
190
function TUD2Plugin.PluginGUIDString: string;
176
begin
191
begin
-
 
192
  if PluginGUIDSet then
177
  result := UpperCase(GUIDToString(PluginGUID));
193
    result := UpperCase(GUIDToString(PluginGUID))
-
 
194
  else
-
 
195
    result := '';
178
end;
196
end;
179
 
197
 
180
function TUD2Plugin.AddIdentification(IdStr: WideString): TUD2IdentificationEntry;
198
function TUD2Plugin.AddIdentification(IdStr: WideString): TUD2IdentificationEntry;
181
begin
199
begin
182
  result := TUD2IdentificationEntry.Create(IdStr, Self);
200
  result := TUD2IdentificationEntry.Create(IdStr, Self);
Line 193... Line 211...
193
begin
211
begin
194
  inherited Create;
212
  inherited Create;
195
  FDetectedIdentifications := TObjectList{<TUD2IdentificationEntry>}.Create(true);
213
  FDetectedIdentifications := TObjectList{<TUD2IdentificationEntry>}.Create(true);
196
end;
214
end;
197
 
215
 
198
function TUD2Plugin.InvokeDynamicCheck(dynamicData: string; var outIDs: TArrayOfString): boolean;
216
function TUD2Plugin.InvokeDynamicCheck(dynamicData: WideString; var outIDs: TArrayOfString): boolean;
199
var
217
var
200
  ude: TUD2IdentificationEntry;
218
  ude: TUD2IdentificationEntry;
201
  i: integer;
219
  i: integer;
202
  id: string;
220
  id: string;
203
  l: integer;
221
  l: integer;
Line 232... Line 250...
232
 
250
 
233
    result := true;
251
    result := true;
234
  end;
252
  end;
235
end;
253
end;
236
 
254
 
237
function TUD2Plugin.GetDynamicRequestResult(dynamicData: string): TArrayOfString;
255
function TUD2Plugin.GetDynamicRequestResult(dynamicData: WideString): TArrayOfString;
238
var
256
var
239
  lngID: LANGID;
257
  lngID: LANGID;
240
  pll: TUD2PluginLoader;
258
  pll: TUD2PluginLoader;
241
begin
259
begin
242
  lngID := GetSystemDefaultLangID;
260
  lngID := GetSystemDefaultLangID;
243
 
261
 
244
  pll := TUD2PluginLoader.Create(false, PluginDLL, lngid, true, dynamicData);
262
  pll := TUD2PluginLoader.Create(false, PluginDLL, lngid, true, dynamicData);
245
  try
263
  try
246
    pll.WaitFor;
264
    pll.WaitFor;
247
    result := pll.ResultIdentifiers;
265
    result := pll.ResultIdentifiers;
-
 
266
    if Assigned(pll.pl) then FreeAndNil(pll.pl);
248
  finally
267
  finally
249
    pll.Free;
268
    pll.Free;
250
  end;
269
  end;
251
end;
270
end;
252
 
271
 
Line 254... Line 273...
254
begin
273
begin
255
  result := SameText(IdentificationMethodName, idMethodNameOrGUID) or
274
  result := SameText(IdentificationMethodName, idMethodNameOrGUID) or
256
            SameText(GUIDToString(PluginGUID), idMethodNameOrGUID)
275
            SameText(GUIDToString(PluginGUID), idMethodNameOrGUID)
257
end;
276
end;
258
 
277
 
259
function TUD2Plugin.InvokeDynamicCheck(dynamicData: string): boolean;
278
function TUD2Plugin.InvokeDynamicCheck(dynamicData: WideString): boolean;
260
var
279
var
261
  dummy: TArrayOfString;
280
  dummy: TArrayOfString;
262
begin
281
begin
263
  result := InvokeDynamicCheck(dynamicData, dummy)
282
  result := InvokeDynamicCheck(dynamicData, dummy)
264
end;
283
end;
Line 292... Line 311...
292
procedure TUD2.HandlePluginDir(APluginDir, AFileMask: string);
311
procedure TUD2.HandlePluginDir(APluginDir, AFileMask: string);
293
Var
312
Var
294
  SR: TSearchRec;
313
  SR: TSearchRec;
295
  path: string;
314
  path: string;
296
  pluginLoader: TUD2PluginLoader;
315
  pluginLoader: TUD2PluginLoader;
297
  tob: TObjectList;
316
  tob: TObjectList{<TUD2PluginLoader>};
298
  i: integer;
317
  i: integer;
299
  {$IFDEF CHECK_FOR_SAME_PLUGIN_GUID}
318
  {$IFDEF CHECK_FOR_SAME_PLUGIN_GUID}
300
  sPluginID, prevDLL: string;
319
  sPluginID, prevDLL: string;
301
  {$ENDIF}
320
  {$ENDIF}
302
  lngid: LANGID;
321
  lngid: LANGID;
303
resourcestring
322
resourcestring
304
  LNG_PLUGINS_SAME_GUID = 'Attention: The plugin "%s" and the plugin "%s" have the same identification GUID. The latter will not be loaded.';
323
  LNG_PLUGINS_SAME_GUID = 'Attention: The plugin "%s" and the plugin "%s" have the same identification GUID. The latter will not be loaded.';
305
begin
324
begin
306
  tob := TObjectList.Create;
325
  tob := TObjectList{<TUD2PluginLoader>}.Create;
307
  try
326
  try
308
    tob.OwnsObjects := false;
327
    tob.OwnsObjects := false;
309
 
328
 
310
    lngID := GetSystemDefaultLangID;
329
    lngID := GetSystemDefaultLangID;
311
 
330
 
Line 333... Line 352...
333
    for i := 0 to tob.count-1 do
352
    for i := 0 to tob.count-1 do
334
    begin
353
    begin
335
      pluginLoader := tob.items[i] as TUD2PluginLoader;
354
      pluginLoader := tob.items[i] as TUD2PluginLoader;
336
      pluginLoader.WaitFor;
355
      pluginLoader.WaitFor;
337
      Errors.AddStrings(pluginLoader.Errors);
356
      Errors.AddStrings(pluginLoader.Errors);
338
      {$IFDEF CHECK_FOR_SAME_PLUGIN_GUID}
-
 
339
      if Assigned(pluginLoader.pl) then
357
      if Assigned(pluginLoader.pl) then
340
      begin
358
      begin
-
 
359
        {$IFDEF CHECK_FOR_SAME_PLUGIN_GUID}
341
        if not pluginLoader.pl.OSNotSupportedEnforced then
360
        if pluginLoader.pl.PluginGUIDSet then
342
        begin
361
        begin
343
          sPluginID := GUIDToString(pluginLoader.pl.PluginGUID);
362
          sPluginID := GUIDToString(pluginLoader.pl.PluginGUID);
344
          prevDLL := FGUIDLookup.Values[sPluginID];
363
          prevDLL := FGUIDLookup.Values[sPluginID];
345
          if (prevDLL <> '') and (prevDLL <> pluginLoader.pl.PluginDLL) then
364
          if (prevDLL <> '') and (prevDLL <> pluginLoader.pl.PluginDLL) then
346
          begin
365
          begin
Line 350... Line 369...
350
          else
369
          else
351
          begin
370
          begin
352
            FGUIDLookup.Values[sPluginID] := pluginLoader.pl.PluginDLL;
371
            FGUIDLookup.Values[sPluginID] := pluginLoader.pl.PluginDLL;
353
            LoadedPlugins.Add(pluginLoader.pl);
372
            LoadedPlugins.Add(pluginLoader.pl);
354
          end;
373
          end;
-
 
374
        end
-
 
375
        else
-
 
376
        begin
-
 
377
          LoadedPlugins.Add(pluginLoader.pl);
355
        end;
378
        end;
356
      end;
379
        {$ELSE}
-
 
380
        LoadedPlugins.Add(pluginLoader.pl);
357
      {$ENDIF}
381
        {$ENDIF}
-
 
382
      end;
358
      pluginLoader.Free;
383
      pluginLoader.Free;
359
    end;
384
    end;
360
  finally
385
  finally
361
    tob.free;
386
    tob.free;
362
  end;
387
  end;
Line 412... Line 437...
412
function TUD2.TaskExists(ShortTaskName: string): boolean;
437
function TUD2.TaskExists(ShortTaskName: string): boolean;
413
begin
438
begin
414
  result := FIniFile.SectionExists(ShortTaskName);
439
  result := FIniFile.SectionExists(ShortTaskName);
415
end;
440
end;
416
 
441
 
417
function TUD2.ReadMetatagString(ShortTaskName, MetatagName: string;
442
function TUD2.ReadMetatagString(ShortTaskName, MetatagName: string; DefaultVal: string): string;
418
  DefaultVal: string): string;
-
 
419
begin
443
begin
420
  result := IniFile.ReadString(ShortTaskName, MetatagName, DefaultVal);
444
  result := IniFile.ReadString(ShortTaskName, MetatagName, DefaultVal);
421
end;
445
end;
422
 
446
 
423
function TUD2.ReadMetatagBool(ShortTaskName, MetatagName: string;
447
function TUD2.ReadMetatagBool(ShortTaskName, MetatagName: string; DefaultVal: string): boolean;
424
  DefaultVal: string): boolean;
-
 
425
begin
448
begin
426
  // DefaultVal is a string, because we want to allow an empty string, in case the
449
  // DefaultVal is a string, because we want to allow an empty string, in case the
427
  // user wishes an Exception in case the string is not a valid boolean string
450
  // user wishes an Exception in case the string is not a valid boolean string
428
  result := BetterInterpreteBool(IniFile.ReadString(ShortTaskName, MetatagName, DefaultVal));
451
  result := BetterInterpreteBool(IniFile.ReadString(ShortTaskName, MetatagName, DefaultVal));
429
end;
452
end;
Line 673... Line 696...
673
      iniConfig := TIniFile.Create(sPluginConfigFile);
696
      iniConfig := TIniFile.Create(sPluginConfigFile);
674
      try
697
      try
675
        sOverrideGUID := iniConfig.ReadString('Compatibility', 'OverrideGUID', '');
698
        sOverrideGUID := iniConfig.ReadString('Compatibility', 'OverrideGUID', '');
676
        if sOverrideGUID <> '' then
699
        if sOverrideGUID <> '' then
677
        begin
700
        begin
-
 
701
          pl.FPluginGUIDSet := true;
678
          pl.PluginGUID := StringToGUID(sOverrideGUID);
702
          pl.FPluginGUID := StringToGUID(sOverrideGUID);
679
          result := true;
703
          result := true;
680
        end;
704
        end;
681
      finally
705
      finally
682
        iniConfig.Free;
706
        iniConfig.Free;
683
      end;
707
      end;
Line 703... Line 727...
703
  end;
727
  end;
704
 
728
 
705
  procedure _OverwriteStatusToOSNotSupported;
729
  procedure _OverwriteStatusToOSNotSupported;
706
  begin
730
  begin
707
    pl := TUD2Plugin.Create;
731
    pl := TUD2Plugin.Create;
708
    pl.PluginDLL := dllFile;
732
    pl.FPluginDLL := dllFile;
709
    statusCode := UD2_STATUS_NOTAVAIL_OS_NOT_SUPPORTED;
733
    statusCode := UD2_STATUS_NOTAVAIL_OS_NOT_SUPPORTED;
710
    pl.IdentificationProcedureStatusCode := statusCode;
734
    pl.FIdentificationProcedureStatusCode := statusCode;
711
    pl.IdentificationProcedureStatusCodeDescribed := _ErrorLookup(statusCode);
735
    pl.FIdentificationProcedureStatusCodeDescribed := _ErrorLookup(statusCode);
712
    (*
-
 
713
    if not _ApplyCompatibilityGUID then
-
 
714
    begin
-
 
715
      CreateGUID(pl.PluginGUID); // to avoid the "double GUID" error
-
 
716
    end;
-
 
717
    *)
-
 
718
    pl.OSNotSupportedEnforced := true; // to avoid the "double GUID" error
736
    pl.FOSNotSupportedEnforced := true;
719
    result := true;
737
    result := true;
720
  end;
738
  end;
721
 
739
 
722
resourcestring
740
resourcestring
723
  LNG_DLL_NOT_LOADED = 'Plugin DLL "%s" could not be loaded: %s';
741
  LNG_DLL_NOT_LOADED = 'Plugin DLL "%s" could not be loaded: %s';
Line 761... Line 779...
761
          Errors.Add(Format(LNG_INVALID_PLUGIN, [dllFile]));
779
          Errors.Add(Format(LNG_INVALID_PLUGIN, [dllFile]));
762
          Exit;
780
          Exit;
763
        end;
781
        end;
764
 
782
 
765
        pl := TUD2Plugin.Create;
783
        pl := TUD2Plugin.Create;
766
        pl.PluginDLL := dllFile;
784
        pl.FPluginDLL := dllFile;
767
 
785
 
768
        @fDynamicIdentificationStringW := GetProcAddress(dllHandle, mnDynamicIdentificationStringW);
786
        @fDynamicIdentificationStringW := GetProcAddress(dllHandle, mnDynamicIdentificationStringW);
769
        pl.AcceptsDynamicRequests := Assigned(fDynamicIdentificationStringW);
787
        pl.FAcceptsDynamicRequests := Assigned(fDynamicIdentificationStringW);
770
 
788
 
771
        fIdentificationStringW := nil;
789
        fIdentificationStringW := nil;
772
        if useDynamicData then
790
        if useDynamicData then
773
        begin
791
        begin
774
          if not pl.AcceptsDynamicRequests then
792
          if not pl.AcceptsDynamicRequests then
775
          begin
793
          begin
776
            // TODO xxx: Darf hier ein fataler Fehler entstehen, obwohl dieses Szenario nur durch die INI file auftreten kann?
794
            // TODO xxx: Darf hier ein fataler Fehler entstehen, obwohl dieses Szenario nur durch die INI file auftreten kann?
777
            // TODO (allgemein): In der Modulübersicht soll auch gezeigt werden, ob dieses Modul dynamischen Content erlaubt.
-
 
778
            // TODO (allgemein): doku
795
            // TODO (allgemein): doku
779
            Errors.Add(Format(LNG_METHOD_NOT_FOUND, [mnDynamicIdentificationStringW, dllFile]));
796
            Errors.Add(Format(LNG_METHOD_NOT_FOUND, [mnDynamicIdentificationStringW, dllFile]));
780
            Exit;
797
            Exit;
781
          end;
798
          end;
782
        end
799
        end
Line 838... Line 855...
838
          if not Assigned(fPluginIdentifier) then
855
          if not Assigned(fPluginIdentifier) then
839
          begin
856
          begin
840
            Errors.Add(Format(LNG_METHOD_NOT_FOUND, [mnPluginIdentifier, dllFile]));
857
            Errors.Add(Format(LNG_METHOD_NOT_FOUND, [mnPluginIdentifier, dllFile]));
841
            Exit;
858
            Exit;
842
          end;
859
          end;
-
 
860
          pl.FPluginGUIDSet := true;
843
          pl.PluginGUID := fPluginIdentifier();
861
          pl.FPluginGUID := fPluginIdentifier();
844
        end;
862
        end;
845
 
863
 
846
        statusCode := fCheckLicense(nil);
864
        statusCode := fCheckLicense(nil);
847
        if statusCode.wCategory = UD2_STATUSCAT_FAILED then
865
        if statusCode.wCategory = UD2_STATUSCAT_FAILED then
848
        begin
866
        begin
Line 850... Line 868...
850
          Exit;
868
          Exit;
851
        end;
869
        end;
852
 
870
 
853
        ZeroMemory(@buf, cchBufferSize);
871
        ZeroMemory(@buf, cchBufferSize);
854
        statusCode := fPluginNameW(@buf, cchBufferSize, lngID);
872
        statusCode := fPluginNameW(@buf, cchBufferSize, lngID);
855
             if statusCode.wCategory = UD2_STATUSCAT_SUCCESS   then pl.PluginName := PWideChar(@buf)
873
             if statusCode.wCategory = UD2_STATUSCAT_SUCCESS   then pl.FPluginName := PWideChar(@buf)
856
        else if statusCode.wCategory = UD2_STATUSCAT_NOT_AVAIL then pl.PluginName := ''
874
        else if statusCode.wCategory = UD2_STATUSCAT_NOT_AVAIL then pl.FPluginName := ''
857
        else
875
        else
858
        begin
876
        begin
859
          Errors.Add(Format(LNG_METHOD_FAILURE, [_ErrorLookup(statusCode), mnPluginNameW, dllFile]));
877
          Errors.Add(Format(LNG_METHOD_FAILURE, [_ErrorLookup(statusCode), mnPluginNameW, dllFile]));
860
          Exit;
878
          Exit;
861
        end;
879
        end;
862
 
880
 
863
        ZeroMemory(@buf, cchBufferSize);
881
        ZeroMemory(@buf, cchBufferSize);
864
        statusCode := fPluginVendorW(@buf, cchBufferSize, lngID);
882
        statusCode := fPluginVendorW(@buf, cchBufferSize, lngID);
865
             if statusCode.wCategory = UD2_STATUSCAT_SUCCESS   then pl.PluginVendor := PWideChar(@buf)
883
             if statusCode.wCategory = UD2_STATUSCAT_SUCCESS   then pl.FPluginVendor := PWideChar(@buf)
866
        else if statusCode.wCategory = UD2_STATUSCAT_NOT_AVAIL then pl.PluginVendor := ''
884
        else if statusCode.wCategory = UD2_STATUSCAT_NOT_AVAIL then pl.FPluginVendor := ''
867
        else
885
        else
868
        begin
886
        begin
869
          Errors.Add(Format(LNG_METHOD_FAILURE, [_ErrorLookup(statusCode), mnPluginVendorW, dllFile]));
887
          Errors.Add(Format(LNG_METHOD_FAILURE, [_ErrorLookup(statusCode), mnPluginVendorW, dllFile]));
870
          Exit;
888
          Exit;
871
        end;
889
        end;
872
 
890
 
873
        ZeroMemory(@buf, cchBufferSize);
891
        ZeroMemory(@buf, cchBufferSize);
874
        statusCode := fPluginVersionW(@buf, cchBufferSize, lngID);
892
        statusCode := fPluginVersionW(@buf, cchBufferSize, lngID);
875
             if statusCode.wCategory = UD2_STATUSCAT_SUCCESS   then pl.PluginVersion := PWideChar(@buf)
893
             if statusCode.wCategory = UD2_STATUSCAT_SUCCESS   then pl.FPluginVersion := PWideChar(@buf)
876
        else if statusCode.wCategory = UD2_STATUSCAT_NOT_AVAIL then pl.PluginVersion := ''
894
        else if statusCode.wCategory = UD2_STATUSCAT_NOT_AVAIL then pl.FPluginVersion := ''
877
        else
895
        else
878
        begin
896
        begin
879
          Errors.Add(Format(LNG_METHOD_FAILURE, [_ErrorLookup(statusCode), mnPluginVersionW, dllFile]));
897
          Errors.Add(Format(LNG_METHOD_FAILURE, [_ErrorLookup(statusCode), mnPluginVersionW, dllFile]));
880
          Exit;
898
          Exit;
881
        end;
899
        end;
882
 
900
 
883
        ZeroMemory(@buf, cchBufferSize);
901
        ZeroMemory(@buf, cchBufferSize);
884
        statusCode := fIdentificationMethodNameW(@buf, cchBufferSize);
902
        statusCode := fIdentificationMethodNameW(@buf, cchBufferSize);
885
             if statusCode.wCategory = UD2_STATUSCAT_SUCCESS   then pl.IdentificationMethodName := PWideChar(@buf)
903
             if statusCode.wCategory = UD2_STATUSCAT_SUCCESS   then pl.FIdentificationMethodName := PWideChar(@buf)
886
        else if statusCode.wCategory = UD2_STATUSCAT_NOT_AVAIL then pl.IdentificationMethodName := ''
904
        else if statusCode.wCategory = UD2_STATUSCAT_NOT_AVAIL then pl.FIdentificationMethodName := ''
887
        else
905
        else
888
        begin
906
        begin
889
          Errors.Add(Format(LNG_METHOD_FAILURE, [_ErrorLookup(statusCode), mnIdentificationMethodNameW, dllFile]));
907
          Errors.Add(Format(LNG_METHOD_FAILURE, [_ErrorLookup(statusCode), mnIdentificationMethodNameW, dllFile]));
890
          Exit;
908
          Exit;
891
        end;
909
        end;
Line 898... Line 916...
898
        end
916
        end
899
        else
917
        else
900
        begin
918
        begin
901
          statusCode := fIdentificationStringW(@buf, cchBufferSize);
919
          statusCode := fIdentificationStringW(@buf, cchBufferSize);
902
        end;
920
        end;
903
        pl.IdentificationProcedureStatusCode := statusCode;
921
        pl.FIdentificationProcedureStatusCode := statusCode;
904
        pl.IdentificationProcedureStatusCodeDescribed := _ErrorLookup(statusCode);
922
        pl.FIdentificationProcedureStatusCodeDescribed := _ErrorLookup(statusCode);
905
        if statusCode.wCategory = UD2_STATUSCAT_SUCCESS then
923
        if statusCode.wCategory = UD2_STATUSCAT_SUCCESS then
906
        begin
924
        begin
907
          sIdentifier := PWideChar(@buf);
925
          sIdentifier := PWideChar(@buf);
908
          if UD2_STATUS_Equal(statusCode, UD2_STATUS_OK_MULTILINE, false) then
926
          if UD2_STATUS_Equal(statusCode, UD2_STATUS_OK_MULTILINE, false) then
909
          begin
927
          begin
Line 947... Line 965...
947
      if result then
965
      if result then
948
      begin
966
      begin
949
        endtime := GetTickCount;
967
        endtime := GetTickCount;
950
        time := endtime - starttime;
968
        time := endtime - starttime;
951
        if endtime < starttime then time := High(Cardinal) - time;
969
        if endtime < starttime then time := High(Cardinal) - time;
952
        pl.time := time;
970
        pl.FLoadingTime := time;
953
      end;
971
      end;
954
    end;
972
    end;
955
  except
973
  except
956
    // TODO: when an exception happens in a cdecl DLL, then this code is somehow not
974
    // TODO: when an exception happens in a cdecl DLL, then this code is somehow not
957
    // executed. Probably the memory is corrupted. Anyway, a cdecl DLL shall NEVER
975
    // executed. Probably the memory is corrupted. Anyway, a cdecl DLL shall NEVER