Subversion Repositories userdetect2

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

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