Re: 'Netsh firewall reset' but from a program.
- From: "Volodymyr M. Shcherbyna" <v_scherbina@xxxxxxxxxxxxxxx>
- Date: Fri, 2 May 2008 13:45:27 +0200
Well, this code is buggy, because the second parameter to CreateProcess
should be a pointer to a writable string, because unicode version of
function may alter the string. Read MSDN:
[...] "The Unicode version of this function, CreateProcessW, can modify the
contents of this string. Therefore, this parameter cannot be a pointer to
read-only memory (such as a const variable or a literal string). If this
parameter is a constant string, the function may cause an access violation."
[...]
--
V.
This posting is provided "AS IS" with no warranties, and confers no
rights.
"Control Freq" <nick@xxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:12afd4bd-cd28-4f52-a425-a14bf61c837c@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Well, I don't often get to answer my own question, but I managed to
sort out a way of doing what I need.
This code snippet:
// Below does the same, but without showing a command prompt.
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
CreateProcess(NULL, "netsh firewall reset", NULL, NULL, FALSE,
CREATE_NO_WINDOW | NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi);
//
... does what I need, without showing a DOS command prompt.
Thanks.
.
- Prev by Date: Re: Vista TCP/IP Stack not RFC 1624 compliant
- Next by Date: Re: connect open remote registry when login with a domain user on vista or windows server 2008.
- Previous by thread: Re: Vista TCP/IP Stack not RFC 1624 compliant
- Next by thread: Re: connect open remote registry when login with a domain user on vista or windows server 2008.
- Index(es):
Relevant Pages
|
|