Subversion Repositories userdetect2

Rev

Rev 71 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
68 daniel-mar 1
library GatewayIP;
2
 
3
uses
4
  Windows,
5
  SysUtils,
6
  Classes,
7
  UD2_PluginIntf in '..\UD2_PluginIntf.pas',
8
  UD2_PluginUtils in '..\UD2_PluginUtils.pas',
71 daniel-mar 9
  UD2_PluginStatus in '..\UD2_PluginStatus.pas',
68 daniel-mar 10
  NetworkUtils in 'NetworkUtils.pas';
11
 
12
{$R *.res}
13
 
14
const
15
  PLUGIN_GUID: TGUID = '{F45C87FF-3A82-4AC8-AA19-C9DC0C6AAF7B}';
16
 
17
function PluginIdentifier: TGUID; cdecl;
18
begin
19
  result := PLUGIN_GUID;
20
end;
21
 
69 daniel-mar 22
function IdentificationStringW(lpIdentifier: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
68 daniel-mar 23
var
24
  sl: TStringList;
70 daniel-mar 25
  ec: DWORD;
68 daniel-mar 26
begin
27
  try
82 daniel-mar 28
    sl := TStringList.Create;
29
    try
30
      ec := GetGatewayIPAddressList(sl);
31
      if ec = ERROR_NOT_SUPPORTED then
32
      begin
33
        result := UD2_STATUS_NOTAVAIL_OS_NOT_SUPPORTED;
34
        Exit;
35
      end
36
      else if ec <> ERROR_SUCCESS then
37
      begin
38
        result := UD2_STATUS_OSError(ec);
39
        Exit;
40
      end;
41
      result := UD2_WriteStringListToPointerW(lpIdentifier, cchSize, sl);
42
    finally
43
      sl.Free;
70 daniel-mar 44
    end;
82 daniel-mar 45
  except
46
    on E: Exception do result := UD2_STATUS_HandleException(E);
68 daniel-mar 47
  end;
48
end;
49
 
69 daniel-mar 50
function PluginNameW(lpPluginName: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
68 daniel-mar 51
var
52
  stPluginName: WideString;
53
  primaryLangID: Byte;
54
begin
55
  primaryLangID := wLangID and $00FF;
56
  if primaryLangID = LANG_GERMAN then
57
    stPluginName := 'IP-Adressen der Gateways'
58
  else
59
    stPluginName := 'Gateway IP addresses';
69 daniel-mar 60
  result := UD2_WritePascalStringToPointerW(lpPluginName, cchSize, stPluginName);
68 daniel-mar 61
end;
62
 
69 daniel-mar 63
function PluginVendorW(lpPluginVendor: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
68 daniel-mar 64
begin
69 daniel-mar 65
  result := UD2_WritePascalStringToPointerW(lpPluginVendor, cchSize, 'ViaThinkSoft');
68 daniel-mar 66
end;
67
 
69 daniel-mar 68
function PluginVersionW(lpPluginVersion: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
68 daniel-mar 69
begin
69 daniel-mar 70
  result := UD2_WritePascalStringToPointerW(lpPluginVersion, cchSize, '1.0');
68 daniel-mar 71
end;
72
 
69 daniel-mar 73
function IdentificationMethodNameW(lpIdentificationMethodName: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
68 daniel-mar 74
var
75
  stIdentificationMethodName: WideString;
76
begin
77
  stIdentificationMethodName := 'GatewayIP';
69 daniel-mar 78
  result := UD2_WritePascalStringToPointerW(lpIdentificationMethodName, cchSize, stIdentificationMethodName);
68 daniel-mar 79
end;
80
 
69 daniel-mar 81
function CheckLicense(lpReserved: LPVOID): UD2_STATUS; cdecl;
68 daniel-mar 82
begin
69 daniel-mar 83
  result := UD2_STATUS_OK_LICENSED;
68 daniel-mar 84
end;
85
 
70 daniel-mar 86
function DescribeOwnStatusCodeW(lpErrorDescription: LPWSTR; cchSize: DWORD; statusCode: UD2_STATUS; wLangID: LANGID): BOOL; cdecl;
87
begin
88
  // This function does not use non-generic status codes
89
  result := FALSE;
90
end;
91
 
68 daniel-mar 92
exports
93
  PluginInterfaceID         name mnPluginInterfaceID,
94
  PluginIdentifier          name mnPluginIdentifier,
95
  PluginNameW               name mnPluginNameW,
96
  PluginVendorW             name mnPluginVendorW,
97
  PluginVersionW            name mnPluginVersionW,
98
  IdentificationMethodNameW name mnIdentificationMethodNameW,
99
  IdentificationStringW     name mnIdentificationStringW,
70 daniel-mar 100
  CheckLicense              name mnCheckLicense,
101
  DescribeOwnStatusCodeW    name mnDescribeOwnStatusCodeW;
68 daniel-mar 102
 
103
end.