Subversion Repositories userdetect2

Rev

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

  1. library EnvironmentString;
  2.  
  3. uses
  4.   Windows,
  5.   SysUtils,
  6.   Classes,
  7.   MiscUtils,
  8.   UD2_PluginIntf in '..\UD2_PluginIntf.pas',
  9.   UD2_PluginUtils in '..\UD2_PluginUtils.pas',
  10.   UD2_PluginStatus in '..\UD2_PluginStatus.pas';
  11.  
  12. {$R *.res}
  13.  
  14. const
  15.   PLUGIN_GUID: TGUID = '{145EEB93-8170-4220-8959-09253881E4B6}';
  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. begin
  26.   try
  27.     sl := TStringList.Create;
  28.     try
  29.       EnvironmentStringsToStrings(sl);
  30.       result := UD2_WriteStringListToPointerW(lpIdentifier, cchSize, sl);
  31.     finally
  32.       sl.Free;
  33.     end;
  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 := 'Umgebungsvariable'
  47.   else
  48.     stPluginName := 'Environment variable';
  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 := 'EnvironmentString';
  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.