Subversion Repositories userdetect2

Rev

Rev 71 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 71 Rev 82
Line 24... Line 24...
24
  sl, sl2: TStringList;
24
  sl, sl2: TStringList;
25
  i: integer;
25
  i: integer;
26
  ip, mac: string;
26
  ip, mac: string;
27
  ec: DWORD;
27
  ec: DWORD;
28
begin
28
begin
29
  sl := TStringList.Create;
-
 
30
  sl2 := TStringList.Create;
-
 
31
  try
29
  try
32
    ec := GetLocalMACAddressList(sl2);
30
    sl := TStringList.Create;
33
    if ec = ERROR_NOT_SUPPORTED then
31
    sl2 := TStringList.Create;
34
    begin
-
 
35
      result := UD2_STATUS_NOTAVAIL_OS_NOT_SUPPORTED;
-
 
36
      Exit;
-
 
37
    end
32
    try
38
    else if ec <> ERROR_SUCCESS then
-
 
39
    begin
-
 
40
      result := UD2_STATUS_OSError(ec);
-
 
41
      Exit;
-
 
42
    end;
-
 
43
 
-
 
44
    // This procedure should not find any more MAC addresses...
-
 
45
    GetLocalIPAddressList(sl);
-
 
46
    for i := 0 to sl.Count-1 do
-
 
47
    begin
-
 
48
      ip := sl.Strings[i];
-
 
49
      ec := GetMACAddress(ip, mac);
33
      ec := GetLocalMACAddressList(sl2);
50
      if ec = ERROR_NOT_SUPPORTED then
34
      if ec = ERROR_NOT_SUPPORTED then
51
      begin
35
      begin
52
        result := UD2_STATUS_NOTAVAIL_OS_NOT_SUPPORTED;
36
        result := UD2_STATUS_NOTAVAIL_OS_NOT_SUPPORTED;
53
        Exit;
37
        Exit;
54
      end
38
      end
55
      else if (ec = S_OK) and
39
      else if ec <> ERROR_SUCCESS then
-
 
40
      begin
-
 
41
        result := UD2_STATUS_OSError(ec);
-
 
42
        Exit;
-
 
43
      end;
-
 
44
 
-
 
45
      // This procedure should not find any more MAC addresses...
56
              (mac <> '') and
46
      GetLocalIPAddressList(sl);
57
              (sl2.IndexOf(mac) = -1) then
47
      for i := 0 to sl.Count-1 do
58
      begin
48
      begin
-
 
49
        ip := sl.Strings[i];
-
 
50
        ec := GetMACAddress(ip, mac);
-
 
51
        if ec = ERROR_NOT_SUPPORTED then
-
 
52
        begin
-
 
53
          result := UD2_STATUS_NOTAVAIL_OS_NOT_SUPPORTED;
-
 
54
          Exit;
-
 
55
        end
-
 
56
        else if (ec = S_OK) and
-
 
57
                (mac <> '') and
-
 
58
                (sl2.IndexOf(mac) = -1) then
-
 
59
        begin
59
        sl2.add(mac);
60
          sl2.add(mac);
-
 
61
        end;
60
      end;
62
      end;
-
 
63
      result := UD2_WriteStringListToPointerW(lpIdentifier, cchSize, sl2);
-
 
64
    finally
-
 
65
      sl.Free;
-
 
66
      sl2.Free;
61
    end;
67
    end;
62
    result := UD2_WriteStringListToPointerW(lpIdentifier, cchSize, sl2);
-
 
63
  finally
68
  except
64
    sl.Free;
-
 
65
    sl2.Free;
69
    on E: Exception do result := UD2_STATUS_HandleException(E);
66
  end;
70
  end;
67
end;
71
end;
68
 
72
 
69
function PluginNameW(lpPluginName: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
73
function PluginNameW(lpPluginName: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
70
var
74
var