Subversion Repositories userdetect2

Rev

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

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