int result = 0;
CString pCommand;
CString pIP;
pIP.Format("1.1.1.1");
pCommand.Format("netsh advfirewall firewall show rule name=\"TestRule : %s\"",pIP.GetString());
result = system(pCommand.GetString());
if ( Result == 1 )
{
printf("Firewall Rule Not Found.\n");
}
else
{
printf("Firewall Rule Found.\n");
}
The code is run every time my Application Receive a TCP Handshake Request (WINSOCK.h).
Given the following code above I have the following Questions.
Could I Replicate the result of the code above using ShellExecute/ShellExecuteEx?
If yes, would it give better performance than the system call,or would it be okay to continue using the code above?
Would it be better to Use CreateProcess,Rather than system() or ShellExecute, and get the same results?