Rev 85 | Rev 87 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 85 | Rev 86 | ||
---|---|---|---|
Line 20... | Line 20... | ||
20 | FDetectedIdentifications: TObjectList{<TUD2IdentificationEntry>}; |
20 | FDetectedIdentifications: TObjectList{<TUD2IdentificationEntry>}; |
21 | public |
21 | public |
22 | // This flag will be set if "AutoOSNotSupportedCompatibility" of the INI manifest had to be enforced/used |
22 | // This flag will be set if "AutoOSNotSupportedCompatibility" of the INI manifest had to be enforced/used |
23 | OSNotSupportedEnforced: boolean; |
23 | OSNotSupportedEnforced: boolean; |
24 | 24 | ||
- | 25 | // TODO: this stuff should be read-only... |
|
25 | PluginDLL: string; |
26 | PluginDLL: string; |
26 | PluginGUID: TGUID; |
27 | PluginGUID: TGUID; |
27 | PluginName: WideString; |
28 | PluginName: WideString; |
28 | PluginVendor: WideString; |
29 | PluginVendor: WideString; |
29 | PluginVersion: WideString; |
30 | PluginVersion: WideString; |
30 | IdentificationMethodName: WideString; |
31 | IdentificationMethodName: WideString; |
- | 32 | AcceptsDynamicRequests: boolean; |
|
31 | 33 | ||
32 | // ONLY contains the non-failure status code of IdentificationStringW |
34 | // ONLY contains the non-failure status code of IdentificationStringW |
33 | IdentificationProcedureStatusCode: UD2_STATUS; |
35 | IdentificationProcedureStatusCode: UD2_STATUS; |
34 | IdentificationProcedureStatusCodeDescribed: WideString; |
36 | IdentificationProcedureStatusCodeDescribed: WideString; |
35 | 37 | ||
Line 38... | Line 40... | ||
38 | property DetectedIdentifications: TObjectList{<TUD2IdentificationEntry>} read FDetectedIdentifications; |
40 | property DetectedIdentifications: TObjectList{<TUD2IdentificationEntry>} read FDetectedIdentifications; |
39 | destructor Destroy; override; |
41 | destructor Destroy; override; |
40 | constructor Create; |
42 | constructor Create; |
41 | function AddIdentification(IdStr: WideString): TUD2IdentificationEntry; |
43 | function AddIdentification(IdStr: WideString): TUD2IdentificationEntry; |
42 | 44 | ||
- | 45 | function InvokeDynamicCheck(dynamicData: string; var outIDs: TArrayOfString): boolean; overload; |
|
43 | function InvokeDynamicCheck(dynamicData: string): boolean; |
46 | function InvokeDynamicCheck(dynamicData: string): boolean; overload; |
44 | function GetDynamicRequestResult(dynamicData: string): TArrayOfString; |
47 | function GetDynamicRequestResult(dynamicData: string): TArrayOfString; |
45 | 48 | ||
46 | function EqualsMethodNameOrGuid(idMethodNameOrGUID: string): boolean; |
49 | function EqualsMethodNameOrGuid(idMethodNameOrGUID: string): boolean; |
47 | end; |
50 | end; |
48 | 51 | ||
Line 190... | Line 193... | ||
190 | begin |
193 | begin |
191 | inherited Create; |
194 | inherited Create; |
192 | FDetectedIdentifications := TObjectList{<TUD2IdentificationEntry>}.Create(true); |
195 | FDetectedIdentifications := TObjectList{<TUD2IdentificationEntry>}.Create(true); |
193 | end; |
196 | end; |
194 | 197 | ||
195 | function TUD2Plugin.InvokeDynamicCheck(dynamicData: string): boolean; |
198 | function TUD2Plugin.InvokeDynamicCheck(dynamicData: string; var outIDs: TArrayOfString): boolean; |
196 | var |
199 | var |
197 | ude: TUD2IdentificationEntry; |
200 | ude: TUD2IdentificationEntry; |
198 | i: integer; |
201 | i: integer; |
199 | ids: TArrayOfString; |
- | |
200 | id: string; |
202 | id: string; |
- | 203 | l: integer; |
|
201 | begin |
204 | begin |
202 | result := false; |
205 | result := false; |
203 | 206 | ||
- | 207 | SetLength(outIDs, 0); |
|
- | 208 | ||
204 | for i := 0 to FDetectedIdentifications.Count-1 do |
209 | for i := 0 to FDetectedIdentifications.Count-1 do |
205 | begin |
210 | begin |
206 | ude := FDetectedIdentifications.Items[i] as TUD2IdentificationEntry; |
211 | ude := FDetectedIdentifications.Items[i] as TUD2IdentificationEntry; |
207 | if ude.dynamicDataUsed and (ude.dynamicData = dynamicData) then |
212 | if ude.dynamicDataUsed and (ude.dynamicData = dynamicData) then |
208 | begin |
213 | begin |
209 | // The dynamic content was already evaluated (and therefore is already added in FDetectedIdentifications). |
214 | l := Length(outIDs); |
210 | Exit; |
215 | SetLength(outIDs, l+1); |
- | 216 | outIDs[l] := ude.FIdentificationString; |
|
211 | end; |
217 | end; |
212 | end; |
218 | end; |
213 | 219 | ||
- | 220 | // The dynamic content was already evaluated (and therefore is already added in FDetectedIdentifications). |
|
214 | SetLength(ids, 0); |
221 | if Length(outIDs) > 0 then exit; |
- | 222 | ||
215 | ids := GetDynamicRequestResult(dynamicData); |
223 | outIDs := GetDynamicRequestResult(dynamicData); |
216 | 224 | ||
217 | for i := 0 to Length(ids)-1 do |
225 | for i := 0 to Length(outIDs)-1 do |
218 | begin |
226 | begin |
219 | id := ids[i]; |
227 | id := outIDs[i]; |
220 | 228 | ||
221 | ude := AddIdentification(id); |
229 | ude := AddIdentification(id); |
222 | ude.dynamicDataUsed := true; |
230 | ude.dynamicDataUsed := true; |
223 | ude.dynamicData := dynamicData; |
231 | ude.dynamicData := dynamicData; |
224 | 232 | ||
Line 246... | Line 254... | ||
246 | begin |
254 | begin |
247 | result := SameText(IdentificationMethodName, idMethodNameOrGUID) or |
255 | result := SameText(IdentificationMethodName, idMethodNameOrGUID) or |
248 | SameText(GUIDToString(PluginGUID), idMethodNameOrGUID) |
256 | SameText(GUIDToString(PluginGUID), idMethodNameOrGUID) |
249 | end; |
257 | end; |
250 | 258 | ||
- | 259 | function TUD2Plugin.InvokeDynamicCheck(dynamicData: string): boolean; |
|
- | 260 | var |
|
- | 261 | dummy: TArrayOfString; |
|
- | 262 | begin |
|
- | 263 | result := InvokeDynamicCheck(dynamicData, dummy) |
|
- | 264 | end; |
|
- | 265 | ||
251 | { TUD2IdentificationEntry } |
266 | { TUD2IdentificationEntry } |
252 | 267 | ||
253 | procedure TUD2IdentificationEntry.GetIdNames(sl: TStrings); |
268 | procedure TUD2IdentificationEntry.GetIdNames(sl: TStrings); |
254 | var |
269 | var |
255 | cond: TUD2TDFCondition; |
270 | cond: TUD2TDFCondition; |
Line 745... | Line 760... | ||
745 | begin |
760 | begin |
746 | Errors.Add(Format(LNG_INVALID_PLUGIN, [dllFile])); |
761 | Errors.Add(Format(LNG_INVALID_PLUGIN, [dllFile])); |
747 | Exit; |
762 | Exit; |
748 | end; |
763 | end; |
749 | 764 | ||
- | 765 | pl := TUD2Plugin.Create; |
|
- | 766 | pl.PluginDLL := dllFile; |
|
- | 767 | ||
- | 768 | @fDynamicIdentificationStringW := GetProcAddress(dllHandle, mnDynamicIdentificationStringW); |
|
750 | fDynamicIdentificationStringW := nil; |
769 | pl.AcceptsDynamicRequests := Assigned(fDynamicIdentificationStringW); |
- | 770 | ||
751 | fIdentificationStringW := nil; |
771 | fIdentificationStringW := nil; |
752 | if useDynamicData then |
772 | if useDynamicData then |
753 | begin |
773 | begin |
754 | @fDynamicIdentificationStringW := GetProcAddress(dllHandle, mnDynamicIdentificationStringW); |
- | |
755 | if not Assigned(fDynamicIdentificationStringW) then |
774 | if not pl.AcceptsDynamicRequests then |
756 | begin |
775 | begin |
757 | // TODO xxx: Darf hier ein fataler Fehler entstehen, obwohl dieses Szenario nur durch die INI file auftreten kann? |
776 | // TODO xxx: Darf hier ein fataler Fehler entstehen, obwohl dieses Szenario nur durch die INI file auftreten kann? |
758 | // TODO (allgemein): In der Modulübersicht soll auch gezeigt werden, ob dieses Modul dynamischen Content erlaubt. |
777 | // TODO (allgemein): In der Modulübersicht soll auch gezeigt werden, ob dieses Modul dynamischen Content erlaubt. |
759 | // TODO (allgemein): doku |
778 | // TODO (allgemein): doku |
760 | Errors.Add(Format(LNG_METHOD_NOT_FOUND, [mnDynamicIdentificationStringW, dllFile])); |
779 | Errors.Add(Format(LNG_METHOD_NOT_FOUND, [mnDynamicIdentificationStringW, dllFile])); |
Line 811... | Line 830... | ||
811 | begin |
830 | begin |
812 | Errors.Add(Format(LNG_METHOD_NOT_FOUND, [mnDescribeOwnStatusCodeW, dllFile])); |
831 | Errors.Add(Format(LNG_METHOD_NOT_FOUND, [mnDescribeOwnStatusCodeW, dllFile])); |
813 | Exit; |
832 | Exit; |
814 | end; |
833 | end; |
815 | 834 | ||
816 | pl := TUD2Plugin.Create; |
- | |
817 | pl.PluginDLL := dllFile; |
- | |
818 | - | ||
819 | if not _ApplyCompatibilityGUID then |
835 | if not _ApplyCompatibilityGUID then |
820 | begin |
836 | begin |
821 | @fPluginIdentifier := GetProcAddress(dllHandle, mnPluginIdentifier); |
837 | @fPluginIdentifier := GetProcAddress(dllHandle, mnPluginIdentifier); |
822 | if not Assigned(fPluginIdentifier) then |
838 | if not Assigned(fPluginIdentifier) then |
823 | begin |
839 | begin |