title: Coinitialize has not been called error message
body: <p>I am in the process of coding a console application that will create a firewall exception for my main app called Client.exe which uploads a few documents to our servers via FTP.  I borrowed RRUZ code from <a href="https://stackoverflow.com/questions/9180348/delphi-7-windows-vista-7-firewall-exception-network-locations">Delphi 7 Windows Vista/7 Firewall Exception Network Locations</a> my code looks like this:</p>
  
  <pre><code>program ChangeFW;
  
  {$APPTYPE CONSOLE}
  
  {$R *.res}
  
  uses
    System.SysUtils,
    ComObj;
  
  var
    ExecName: string;
  
  procedure AddExceptionToFirewall(Const Caption, Executable: String);
  const
  NET_FW_PROFILE2_DOMAIN  = 1;
  NET_FW_PROFILE2_PRIVATE = 2;
  NET_FW_PROFILE2_PUBLIC  = 4;
  
  NET_FW_IP_PROTOCOL_TCP = 6;
  NET_FW_ACTION_ALLOW    = 1;
  var
    fwPolicy2      : OleVariant;
    RulesObject    : OleVariant;
    Profile        : Integer;
    NewRule        : OleVariant;
  begin
    Profile             := NET_FW_PROFILE2_PRIVATE OR NET_FW_PROFILE2_PUBLIC;
    fwPolicy2           := CreateOleObject('HNetCfg.FwPolicy2');
    RulesObject         := fwPolicy2.Rules;
    NewRule             := CreateOleObject('HNetCfg.FWRule');
    NewRule.Name        := Caption;
    NewRule.Description := Caption;
    NewRule.Applicationname := Executable;
    NewRule.Protocol := NET_FW_IP_PROTOCOL_TCP;
    NewRule.Enabled := TRUE;
    NewRule.Profiles := Profile;
    NewRule.Action := NET_FW_ACTION_ALLOW;
    RulesObject.Add(NewRule);
  end;
  
  begin
    try
      { TODO -oUser -cConsole Main : Insert code here }
      ExecName := GetCurrentDir + '\' + 'Client.exe';
      AddExceptionToFirewall('SIP Inventory',ExecName);
    except
      on E: Exception do
        Writeln(E.ClassName, ': ', E.Message);
    end;
  end.
  </code></pre>
  
  <p>When I execute the application I get the following error message:
  <strong>EOIeSysError: Coinitialize has not been called, ProgID: “HNetCfg.FwPolicy2”</strong>
  Any idea what I am doing wrong?  Could you please point me in the right direction? Thank you so very much.</p>