Subversion Repositories userdetect2

Rev

Rev 70 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
68 daniel-mar 1
library LAN_IP;
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 = '{3C7D83F7-742C-4B3C-9F63-D12DEB442D27}';
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
  sl := TStringList.Create;
28
  try
70 daniel-mar 29
    ec := GetLocalIPAddressList(sl);
30
    if ec = ERROR_NOT_SUPPORTED then
31
    begin
32
      result := UD2_STATUS_NOTAVAIL_OS_NOT_SUPPORTED;
33
      Exit;
34
    end
35
    else if ec <> ERROR_SUCCESS then
36
    begin
71 daniel-mar 37
      result := UD2_STATUS_OSError(ec);
70 daniel-mar 38
      Exit;
39
    end;
69 daniel-mar 40
    result := UD2_WriteStringListToPointerW(lpIdentifier, cchSize, sl);
68 daniel-mar 41
  finally
42
    sl.Free;
43
  end;
44
end;
45
 
69 daniel-mar 46
function PluginNameW(lpPluginName: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
68 daniel-mar 47
var
48
  stPluginName: WideString;
49
  primaryLangID: Byte;
50
begin
51
  primaryLangID := wLangID and $00FF;
52
  if primaryLangID = LANG_GERMAN then
53
    stPluginName := 'IP-Adressen'
54
  else
55
    stPluginName := 'IP addresses';
69 daniel-mar 56
  result := UD2_WritePascalStringToPointerW(lpPluginName, cchSize, stPluginName);
68 daniel-mar 57
end;
58
 
69 daniel-mar 59
function PluginVendorW(lpPluginVendor: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
68 daniel-mar 60
begin
69 daniel-mar 61
  result := UD2_WritePascalStringToPointerW(lpPluginVendor, cchSize, 'ViaThinkSoft');
68 daniel-mar 62
end;
63
 
69 daniel-mar 64
function PluginVersionW(lpPluginVersion: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
68 daniel-mar 65
begin
69 daniel-mar 66
  result := UD2_WritePascalStringToPointerW(lpPluginVersion, cchSize, '1.0');
68 daniel-mar 67
end;
68
 
69 daniel-mar 69
function IdentificationMethodNameW(lpIdentificationMethodName: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
68 daniel-mar 70
var
71
  stIdentificationMethodName: WideString;
72
begin
73
  stIdentificationMethodName := 'LAN_IP';
69 daniel-mar 74
  result := UD2_WritePascalStringToPointerW(lpIdentificationMethodName, cchSize, stIdentificationMethodName);
68 daniel-mar 75
end;
76
 
69 daniel-mar 77
function CheckLicense(lpReserved: LPVOID): UD2_STATUS; cdecl;
68 daniel-mar 78
begin
69 daniel-mar 79
  result := UD2_STATUS_OK_LICENSED;
68 daniel-mar 80
end;
81
 
70 daniel-mar 82
function DescribeOwnStatusCodeW(lpErrorDescription: LPWSTR; cchSize: DWORD; statusCode: UD2_STATUS; wLangID: LANGID): BOOL; cdecl;
83
begin
84
  // This function does not use non-generic status codes
85
  result := FALSE;
86
end;
87
 
68 daniel-mar 88
exports
89
  PluginInterfaceID         name mnPluginInterfaceID,
90
  PluginIdentifier          name mnPluginIdentifier,
91
  PluginNameW               name mnPluginNameW,
92
  PluginVendorW             name mnPluginVendorW,
93
  PluginVersionW            name mnPluginVersionW,
94
  IdentificationMethodNameW name mnIdentificationMethodNameW,
95
  IdentificationStringW     name mnIdentificationStringW,
70 daniel-mar 96
  CheckLicense              name mnCheckLicense,
97
  DescribeOwnStatusCodeW    name mnDescribeOwnStatusCodeW;
68 daniel-mar 98
 
99
end.