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.   if not GetDomainName(stIdentifier) then
  28.   begin
  29.     result := UD2_STATUS_NOTAVAIL_OS_NOT_SUPPORTED;
  30.     Exit;
  31.   end;
  32.   result := UD2_WritePascalStringToPointerW(lpIdentifier, cchSize, stIdentifier);
  33. end;
  34.  
  35. function PluginNameW(lpPluginName: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
  36. var
  37.   stPluginName: WideString;
  38.   primaryLangID: Byte;
  39. begin
  40.   primaryLangID := wLangID and $00FF;
  41.   if primaryLangID = LANG_GERMAN then
  42.     stPluginName := 'Domänen-Name'
  43.   else
  44.     stPluginName := 'Domain name';
  45.   result := UD2_WritePascalStringToPointerW(lpPluginName, cchSize, stPluginName);
  46. end;
  47.  
  48. function PluginVendorW(lpPluginVendor: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
  49. begin
  50.   result := UD2_WritePascalStringToPointerW(lpPluginVendor, cchSize, 'ViaThinkSoft');
  51. end;
  52.  
  53. function PluginVersionW(lpPluginVersion: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
  54. begin
  55.   result := UD2_WritePascalStringToPointerW(lpPluginVersion, cchSize, '1.0');
  56. end;
  57.  
  58. function IdentificationMethodNameW(lpIdentificationMethodName: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
  59. var
  60.   stIdentificationMethodName: WideString;
  61. begin
  62.   stIdentificationMethodName := 'DomainName';
  63.   result := UD2_WritePascalStringToPointerW(lpIdentificationMethodName, cchSize, stIdentificationMethodName);
  64. end;
  65.  
  66. function CheckLicense(lpReserved: LPVOID): UD2_STATUS; cdecl;
  67. begin
  68.   result := UD2_STATUS_OK_LICENSED;
  69. end;
  70.  
  71. function DescribeOwnStatusCodeW(lpErrorDescription: LPWSTR; cchSize: DWORD; statusCode: UD2_STATUS; wLangID: LANGID): BOOL; cdecl;
  72. begin
  73.   // This function does not use non-generic status codes
  74.   result := FALSE;
  75. end;
  76.  
  77. exports
  78.   PluginInterfaceID         name mnPluginInterfaceID,
  79.   PluginIdentifier          name mnPluginIdentifier,
  80.   PluginNameW               name mnPluginNameW,
  81.   PluginVendorW             name mnPluginVendorW,
  82.   PluginVersionW            name mnPluginVersionW,
  83.   IdentificationMethodNameW name mnIdentificationMethodNameW,
  84.   IdentificationStringW     name mnIdentificationStringW,
  85.   CheckLicense              name mnCheckLicense,
  86.   DescribeOwnStatusCodeW    name mnDescribeOwnStatusCodeW;
  87.  
  88. end.
  89.