Subversion Repositories userdetect2

Rev

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

  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.  
  21. function IdentificationStringW(lpIdentifier: LPWSTR; cchSize: DWORD): UD2_STATUSCODE; cdecl;
  22. var
  23.   sl: TStringList;
  24. begin
  25.   sl := TStringList.Create;
  26.   try
  27.     GetLocalIPAddressList(sl);
  28.     result := WriteStringListToPointerW(lpIdentifier, cchSize, sl);
  29.   finally
  30.     sl.Free;
  31.   end;
  32. end;
  33.  
  34. function PluginNameW(lpPluginName: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUSCODE; cdecl;
  35. var
  36.   stPluginName: WideString;
  37.   primaryLangID: Byte;
  38. begin
  39.   primaryLangID := wLangID and $00FF;
  40.   if primaryLangID = LANG_GERMAN then
  41.     stPluginName := 'IP-Adressen'
  42.   else
  43.     stPluginName := 'IP addresses';
  44.   result := WritePascalStringToPointerW(lpPluginName, cchSize, stPluginName);
  45. end;
  46.  
  47. function PluginVendorW(lpPluginVendor: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUSCODE; cdecl;
  48. begin
  49.   result := WritePascalStringToPointerW(lpPluginVendor, cchSize, 'ViaThinkSoft');
  50. end;
  51.  
  52. function PluginVersionW(lpPluginVersion: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUSCODE; cdecl;
  53. begin
  54.   result := WritePascalStringToPointerW(lpPluginVersion, cchSize, '1.0');
  55. end;
  56.  
  57. function IdentificationMethodNameW(lpIdentificationMethodName: LPWSTR; cchSize: DWORD): UD2_STATUSCODE; cdecl;
  58. var
  59.   stIdentificationMethodName: WideString;
  60. begin
  61.   stIdentificationMethodName := 'LAN_IP';
  62.   result := WritePascalStringToPointerW(lpIdentificationMethodName, cchSize, stIdentificationMethodName);
  63. end;
  64.  
  65. function CheckLicense(lpReserved: LPVOID): UD2_STATUSCODE; cdecl;
  66. begin
  67.   result := UD2_STATUS_OK;
  68. end;
  69.  
  70. exports
  71.   PluginInterfaceID         name mnPluginInterfaceID,
  72.   PluginIdentifier          name mnPluginIdentifier,
  73.   PluginNameW               name mnPluginNameW,
  74.   PluginVendorW             name mnPluginVendorW,
  75.   PluginVersionW            name mnPluginVersionW,
  76.   IdentificationMethodNameW name mnIdentificationMethodNameW,
  77.   IdentificationStringW     name mnIdentificationStringW,
  78.   CheckLicense              name mnCheckLicense;
  79.  
  80. end.
  81.