Subversion Repositories userdetect2

Rev

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