Subversion Repositories userdetect2

Rev

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

  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',
  9.   UD2_PluginStatus in '..\UD2_PluginStatus.pas',
  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.  
  22. function IdentificationStringW(lpIdentifier: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
  23. var
  24.   sl: TStringList;
  25.   ec: DWORD;
  26. begin
  27.   try
  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;
  44.     end;
  45.   except
  46.     on E: Exception do result := UD2_STATUS_HandleException(E);
  47.   end;
  48. end;
  49.  
  50. function PluginNameW(lpPluginName: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
  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';
  60.   result := UD2_WritePascalStringToPointerW(lpPluginName, cchSize, stPluginName);
  61. end;
  62.  
  63. function PluginVendorW(lpPluginVendor: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
  64. begin
  65.   result := UD2_WritePascalStringToPointerW(lpPluginVendor, cchSize, 'ViaThinkSoft');
  66. end;
  67.  
  68. function PluginVersionW(lpPluginVersion: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
  69. begin
  70.   result := UD2_WritePascalStringToPointerW(lpPluginVersion, cchSize, '1.0');
  71. end;
  72.  
  73. function IdentificationMethodNameW(lpIdentificationMethodName: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
  74. var
  75.   stIdentificationMethodName: WideString;
  76. begin
  77.   stIdentificationMethodName := 'GatewayIP';
  78.   result := UD2_WritePascalStringToPointerW(lpIdentificationMethodName, cchSize, stIdentificationMethodName);
  79. end;
  80.  
  81. function CheckLicense(lpReserved: LPVOID): UD2_STATUS; cdecl;
  82. begin
  83.   result := UD2_STATUS_OK_LICENSED;
  84. end;
  85.  
  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.  
  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,
  100.   CheckLicense              name mnCheckLicense,
  101.   DescribeOwnStatusCodeW    name mnDescribeOwnStatusCodeW;
  102.  
  103. end.
  104.