Subversion Repositories userdetect2

Rev

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

  1. library DomainName;
  2.  
  3. uses
  4.   Windows,
  5.   SysUtils,
  6.   Classes,
  7.   Registry,
  8.   networkutils in 'networkutils.pas',
  9.   UD2_PluginIntf in '..\UD2_PluginIntf.pas',
  10.   UD2_PluginUtils in '..\UD2_PluginUtils.pas',
  11.   UD2_PluginStatus in '..\UD2_PluginStatus.pas';
  12.  
  13. {$R *.res}
  14.  
  15. const
  16.   PLUGIN_GUID: TGUID = '{6D7AABD7-C4A8-43ED-99E3-3AF4723DD7B2}';
  17.  
  18. function PluginIdentifier: TGUID; cdecl;
  19. begin
  20.   result := PLUGIN_GUID;
  21. end;
  22.  
  23. function IdentificationStringW(lpIdentifier: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
  24. var
  25.   stIdentifier: WideString;
  26. begin
  27.   try
  28.     if not GetDomainName(stIdentifier) then
  29.     begin
  30.       result := UD2_STATUS_NOTAVAIL_OS_NOT_SUPPORTED;
  31.       Exit;
  32.     end;
  33.     result := UD2_WritePascalStringToPointerW(lpIdentifier, cchSize, stIdentifier);
  34.   except
  35.     on E: Exception do result := UD2_STATUS_HandleException(E);
  36.   end;
  37. end;
  38.  
  39. function PluginNameW(lpPluginName: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
  40. var
  41.   stPluginName: WideString;
  42.   primaryLangID: Byte;
  43. begin
  44.   primaryLangID := wLangID and $00FF;
  45.   if primaryLangID = LANG_GERMAN then
  46.     stPluginName := 'Domänen-Name'
  47.   else
  48.     stPluginName := 'Domain name';
  49.   result := UD2_WritePascalStringToPointerW(lpPluginName, cchSize, stPluginName);
  50. end;
  51.  
  52. function PluginVendorW(lpPluginVendor: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
  53. begin
  54.   result := UD2_WritePascalStringToPointerW(lpPluginVendor, cchSize, 'ViaThinkSoft');
  55. end;
  56.  
  57. function PluginVersionW(lpPluginVersion: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
  58. begin
  59.   result := UD2_WritePascalStringToPointerW(lpPluginVersion, cchSize, '1.0');
  60. end;
  61.  
  62. function IdentificationMethodNameW(lpIdentificationMethodName: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
  63. var
  64.   stIdentificationMethodName: WideString;
  65. begin
  66.   stIdentificationMethodName := 'DomainName';
  67.   result := UD2_WritePascalStringToPointerW(lpIdentificationMethodName, cchSize, stIdentificationMethodName);
  68. end;
  69.  
  70. function CheckLicense(lpReserved: LPVOID): UD2_STATUS; cdecl;
  71. begin
  72.   result := UD2_STATUS_OK_LICENSED;
  73. end;
  74.  
  75. function DescribeOwnStatusCodeW(lpErrorDescription: LPWSTR; cchSize: DWORD; statusCode: UD2_STATUS; wLangID: LANGID): BOOL; cdecl;
  76. begin
  77.   // This function does not use non-generic status codes
  78.   result := FALSE;
  79. end;
  80.  
  81. exports
  82.   PluginInterfaceID         name mnPluginInterfaceID,
  83.   PluginIdentifier          name mnPluginIdentifier,
  84.   PluginNameW               name mnPluginNameW,
  85.   PluginVendorW             name mnPluginVendorW,
  86.   PluginVersionW            name mnPluginVersionW,
  87.   IdentificationMethodNameW name mnIdentificationMethodNameW,
  88.   IdentificationStringW     name mnIdentificationStringW,
  89.   CheckLicense              name mnCheckLicense,
  90.   DescribeOwnStatusCodeW    name mnDescribeOwnStatusCodeW;
  91.  
  92. end.
  93.