Results 1 to 2 of 2

Thread: Windows Security Alert

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Windows Security Alert

    when i connect to the internet, and upload a file using FtpPutFile
    the Windows Security Alert comes up telling me my program is blocked,

    if i ignore, it does not prevent the file from being uploaded, but

    is there any way to programatically to stop it from coming up or adding my program to the exceptions list as i don't really want the user being confronted with this dialog
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  2. #2

    Thread Starter
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Windows Security Alert

    looks like i can use the windows firewall API,

    got some sample vb script, so i will see if i can convert it to use
    vb Code:
    1. Option Explicit
    2.  
    3. ' Set constants
    4. Const NET_FW_PROFILE_DOMAIN = 0
    5. Const NET_FW_PROFILE_STANDARD = 1
    6.  
    7. ' Scope
    8. Const NET_FW_SCOPE_ALL = 0
    9.  
    10. ' IP Version – ANY is the only allowable setting for now
    11. Const NET_FW_IP_VERSION_ANY = 2
    12.  
    13. ' Declare variables
    14. Dim errornum
    15.  
    16. ' Create the firewall manager object.
    17. Dim fwMgr
    18. Set fwMgr = CreateObject("HNetCfg.FwMgr")
    19.  
    20. ' Get the current profile for the local firewall policy.
    21. Dim profile
    22. Set profile = fwMgr.LocalPolicy.CurrentProfile
    23.  
    24. Dim app
    25. Set app = CreateObject("HNetCfg.FwAuthorizedApplication")
    26.  
    27. app.ProcessImageFileName = "%PROGRAMFILES%\Outlook Express\msimn.exe"
    28. app.Name = "Outlook Express"
    29. app.Scope = NET_FW_SCOPE_ALL
    30. ' Use either Scope or RemoteAddresses, but not both
    31. 'app.RemoteAddresses = "*"
    32. app.IpVersion = NET_FW_IP_VERSION_ANY
    33. app.Enabled = TRUE
    34.  
    35. ' Use this line if you want to add the app, but disabled.
    36. 'app.Enabled = FALSE
    37.  
    38. On Error Resume Next
    39. errornum = 0
    40. profile.AuthorizedApplications.Add app
    41. errornum = Err.Number
    42. if errornum <> 0 then Wscript.Echo("Adding authorized application failed with: " & errornum)
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width