Subversion Repositories userdetect2

Rev

Rev 69 | Rev 80 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 69 Rev 71
Line 5... Line 5...
5
{$IF CompilerVersion >= 25.0}
5
{$IF CompilerVersion >= 25.0}
6
{$LEGACYIFEND ON}
6
{$LEGACYIFEND ON}
7
{$IFEND}
7
{$IFEND}
8
 
8
 
9
uses
9
uses
10
  Windows, Classes, UD2_PluginIntf;
10
  Windows, Classes, UD2_PluginIntf, UD2_PluginStatus;
11
 
11
 
12
function UD2_WritePascalStringToPointerW(lpDestination: LPWSTR; cchSize: DWORD;
12
function UD2_WritePascalStringToPointerW(lpDestination: LPWSTR; cchSize: DWORD;
13
  stSource: WideString): UD2_STATUS;
13
  stSource: WideString): UD2_STATUS;
14
 
14
 
15
function UD2_WriteStringListToPointerW(lpDestination: LPWSTR; cchSize: DWORD;
15
function UD2_WriteStringListToPointerW(lpDestination: LPWSTR; cchSize: DWORD;
Line 43... Line 43...
43
  cchSource: DWORD;
43
  cchSource: DWORD;
44
  cchCopy: DWORD;
44
  cchCopy: DWORD;
45
begin
45
begin
46
  if cchSize = 0 then
46
  if cchSize = 0 then
47
  begin
47
  begin
48
    result := UD2_STATUS_ERROR_INVALID_ARGS;
48
    result := UD2_STATUS_FAILURE_INVALID_ARGS;
49
    Exit;
49
    Exit;
50
  end;
50
  end;
51
 
51
 
52
  cchSource := Cardinal(Length(stSource));
52
  cchSource := Cardinal(Length(stSource));
53
  cchCopy   := Cardinal(Min(cchSource, cchSize));
53
  cchCopy   := Cardinal(Min(cchSource, cchSize));
Line 56... Line 56...
56
    CopyMemory(lpDestination, @stSource[1], cchCopy*SizeOf(WideChar));
56
    CopyMemory(lpDestination, @stSource[1], cchCopy*SizeOf(WideChar));
57
  end;
57
  end;
58
  lpDestination[cchCopy] := #0;
58
  lpDestination[cchCopy] := #0;
59
 
59
 
60
  if cchSource >= cchSize then
60
  if cchSource >= cchSize then
61
    result := UD2_STATUS_ERROR_BUFFER_TOO_SMALL
61
    result := UD2_STATUS_FAILURE_BUFFER_TOO_SMALL
62
  else if stSource = '' then
62
  else if stSource = '' then
63
    result := UD2_STATUS_NOTAVAIL_UNSPECIFIED
63
    result := UD2_STATUS_NOTAVAIL_UNSPECIFIED
64
  else if UD2_IsMultiLineW(stSource) then
64
  else if UD2_IsMultiLineW(stSource) then
65
    result := UD2_STATUS_OK_MULTILINE
65
    result := UD2_STATUS_OK_MULTILINE
66
  else
66
  else