Subversion Repositories userdetect2

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
83 daniel-mar 1
library TestDynamicEcho;
2
 
3
uses
4
  Windows,
5
  SysUtils,
6
  Classes,
7
  UD2_PluginIntf in '..\UD2_PluginIntf.pas',
8
  UD2_PluginUtils in '..\UD2_PluginUtils.pas',
9
  UD2_PluginStatus in '..\UD2_PluginStatus.pas';
10
 
11
{$R *.res}
12
 
13
const
14
  PLUGIN_GUID: TGUID = '{30653D69-0806-450E-AEF9-19C2D36D298E}';
15
 
16
function PluginIdentifier: TGUID; cdecl;
17
begin
18
  result := PLUGIN_GUID;
19
end;
20
 
21
function IdentificationStringW(lpIdentifier: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
22
begin
23
  result := UD2_STATUS_NOTAVAIL_ONLY_ACCEPT_DYNAMIC;
24
end;
25
 
26
function PluginNameW(lpPluginName: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
27
var
28
  stPluginName: WideString;
29
  primaryLangID: Byte;
30
begin
31
  primaryLangID := wLangID and $00FF;
32
  if primaryLangID = LANG_GERMAN then
33
    stPluginName := 'Dynamisches Echo (Test plugin)'
34
  else
35
    stPluginName := 'Dynamic echo (Test plugin)';
36
  result := UD2_WritePascalStringToPointerW(lpPluginName, cchSize, stPluginName);
37
end;
38
 
39
function PluginVendorW(lpPluginVendor: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
40
begin
41
  result := UD2_WritePascalStringToPointerW(lpPluginVendor, cchSize, 'ViaThinkSoft');
42
end;
43
 
44
function PluginVersionW(lpPluginVersion: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
45
begin
46
  result := UD2_WritePascalStringToPointerW(lpPluginVersion, cchSize, '1.0');
47
end;
48
 
49
function IdentificationMethodNameW(lpIdentificationMethodName: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
50
var
51
  stIdentificationMethodName: WideString;
52
begin
53
  stIdentificationMethodName := 'TestEcho';
54
  result := UD2_WritePascalStringToPointerW(lpIdentificationMethodName, cchSize, stIdentificationMethodName);
55
end;
56
 
57
function CheckLicense(lpReserved: LPVOID): UD2_STATUS; cdecl;
58
begin
59
  result := UD2_STATUS_OK_LICENSED;
60
end;
61
 
62
function DescribeOwnStatusCodeW(lpErrorDescription: LPWSTR; cchSize: DWORD; statusCode: UD2_STATUS; wLangID: LANGID): BOOL; cdecl;
63
begin
64
  // This function does not use non-generic status codes
65
  result := FALSE;
66
end;
67
 
68
function DynamicIdentificationStringW(lpIdentifier: LPWSTR; cchSize: DWORD; lpDynamicData: LPWSTR): UD2_STATUS; cdecl;
69
var
70
  stIdentifier: WideString;
71
begin
72
  try
73
    stIdentifier := lpDynamicData; // "echo"
74
    result := UD2_WritePascalStringToPointerW(lpIdentifier, cchSize, stIdentifier);
75
  except
76
    on E: Exception do result := UD2_STATUS_HandleException(E);
77
  end;
78
end;
79
 
80
 
81
exports
82
  PluginInterfaceID         name mnPluginInterfaceID,
83
  PluginIdentifier          name mnPluginIdentifier,
84
  PluginNameW               name mnPluginNameW,
85
  PluginVendorW             name mnPluginVendorW,
86
  PluginVersionW            name mnPluginVersionW,
87
  IdentificationMethodNameW name mnIdentificationMethodNameW,
88
  IdentificationStringW     name mnIdentificationStringW,
89
  CheckLicense              name mnCheckLicense,
90
  DescribeOwnStatusCodeW    name mnDescribeOwnStatusCodeW,
91
  DynamicIdentificationStringW name mnDynamicIdentificationStringW;
92
 
93
end.