Subversion Repositories userdetect2

Rev

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

  1. library DHCP_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.   UD2_PluginStatus in '..\UD2_PluginStatus.pas',
  10.   NetworkUtils in 'NetworkUtils.pas';
  11.  
  12. {$R *.res}
  13.  
  14. const
  15.   PLUGIN_GUID: TGUID = '{3E0B99F7-E062-4FF1-B656-7D512BE90C47}';
  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.   sl := TStringList.Create;
  28.   try
  29.     ec := GetDHCPIPAddressList(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
  37.       result := UD2_STATUS_OSError(ec);
  38.       Exit;
  39.     end;
  40.     result := UD2_WriteStringListToPointerW(lpIdentifier, cchSize, sl);
  41.   finally
  42.     sl.Free;
  43.   end;
  44. end;
  45.  
  46. function PluginNameW(lpPluginName: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
  47. var
  48.   stPluginName: WideString;
  49.   primaryLangID: Byte;
  50. begin
  51.   primaryLangID := wLangID and $00FF;
  52.   if primaryLangID = LANG_GERMAN then
  53.     stPluginName := 'IP-Adresse der DHCP-Server'
  54.   else
  55.     stPluginName := 'DHCP IP addresses';
  56.   result := UD2_WritePascalStringToPointerW(lpPluginName, cchSize, stPluginName);
  57. end;
  58.  
  59. function PluginVendorW(lpPluginVendor: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
  60. begin
  61.   result := UD2_WritePascalStringToPointerW(lpPluginVendor, cchSize, 'ViaThinkSoft');
  62. end;
  63.  
  64. function PluginVersionW(lpPluginVersion: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
  65. begin
  66.   result := UD2_WritePascalStringToPointerW(lpPluginVersion, cchSize, '1.0');
  67. end;
  68.  
  69. function IdentificationMethodNameW(lpIdentificationMethodName: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
  70. var
  71.   stIdentificationMethodName: WideString;
  72. begin
  73.   stIdentificationMethodName := 'DHCP_IP';
  74.   result := UD2_WritePascalStringToPointerW(lpIdentificationMethodName, cchSize, stIdentificationMethodName);
  75. end;
  76.  
  77. function CheckLicense(lpReserved: LPVOID): UD2_STATUS; cdecl;
  78. begin
  79.   result := UD2_STATUS_OK_LICENSED;
  80. end;
  81.  
  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.  
  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,
  96.   CheckLicense              name mnCheckLicense,
  97.   DescribeOwnStatusCodeW    name mnDescribeOwnStatusCodeW;
  98.  
  99. end.
  100.