title: TNetSharingManager access violation problem
body: <p>I'm trying to compile this <a href="http://delphi.about.com/od/humorandfun/a/fdac_macspoof.htm" rel="nofollow noreferrer">project</a> in Delphi 2010, which uses TNetSharingManager. I have imported the type library and tried compiling it, but unfortunately I'm getting an Access Violation in this function:</p>
  <pre>
  function TNetSharingManager.GetDefaultInterface: INetSharingManager;
  begin
    if FIntf = nil then
      Connect;
    Assert(FIntf  nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call "Connect" or "ConnectTo" before this operation');
    Result := FIntf;
  end;
  </pre>
  <p>(part of NETCONLib_TLB)
  The error is in : <code>if FIntf = nil then</code> for some odd reason..</p>
  <p>The code which is calling it:</p>
  <pre>
  procedure TForm1.GetConnectionList(Strings,IdList: TStrings);
  var
    pEnum: IEnumVariant;
    vNetCon: OleVARIANT;
    dwRetrieved: Cardinal;
    pUser: NETCONLib_TLB.PUserType1;
    NetCon : INetConnection;
  begin
    Strings.Clear;
    IdList.Clear;
    pEnum := ( NetSharingManager.EnumEveryConnection._NewEnum as IEnumVariant);
    while (pEnum.Next(1, vNetCon, dwRetrieved) = S_OK) do
    begin
       (IUnknown(vNetCon) as INetConnection).GetProperties(pUser);
       NetCon := (IUnknown(vNetCon) as INetConnection);
  
       if (pUser.Status in [NCS_CONNECTED,NCS_CONNECTING])//remove if you want disabled NIC cards also
       and (pUser.MediaType in [NCM_LAN,NCM_SHAREDACCESSHOST_LAN,NCM_ISDN] )
       and (GetMacAddress(GuidToString(pUser.guidId))'' ) then
       begin
         //we only want valid network cards that are enabled
         Strings.Add(pUser.pszwName );
         IdList.Add(GuidToString(pUser.guidId));
       end;
    end;
  end;
  </pre>
  <p>I don't understand why I cannot compare with <strong>nil</strong>. Any ideas?</p>