|
Hi all,
Is it possible to get client IP from the socket handle to which it is connected.
If possible please let me know.
Regards,
Sunil Kumar
|
|
|
|
|
getpeername [^] looks promising.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hello I have the following code but it isn't working as expected, can't figure out what the problem is.
Basically, I'm executing a process (a .NET process) and passing it command line arguments, it is executed successfully by CreateProcess() but CreateProcess() isn't passing the command line arguments
What am I doing wrong here??
int main(int argc, char* argv[])
{
PROCESS_INFORMATION ProcessInfo;
STARTUPINFO StartupInfo;
ZeroMemory(&StartupInfo, sizeof(StartupInfo));
StartupInfo.cb = sizeof StartupInfo ;
LPTSTR cmdArgs = "name@example.com";
if(CreateProcess("D:\\email\\smtp.exe", cmdArgs,
NULL,NULL,FALSE,0,NULL,
NULL,&StartupInfo,&ProcessInfo))
{
WaitForSingleObject(ProcessInfo.hProcess,INFINITE);
CloseHandle(ProcessInfo.hThread);
CloseHandle(ProcessInfo.hProcess);
printf("Yohoo!");
}
else
{
printf("The process could not be started...");
}
return 0;
}
Hey one more thing, if I pass my cmdArgs like this:
LPTSTR cmdArgs = " manzoor10@gmail.com";
I get the error:
Object reference not set to an instance of an object
then CreateProcess returns TRUE but my target process isn't executed.
|
|
|
|
|
good morning
Not sure it will solve your problem but did you notice that lpCommandLine is an in out parameter ?
in MSDN Help i found the following information:
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.
Hope this will help.
Regards
Franck
|
|
|
|
|
This:
http://bobmoore.mvps.org/Win32/w32tip46.htm[^]
may give you some insight but I'm not sure.
I always use CreateProcess by concatenating the app name and the arguments and set this as the second parameter (first parameter set to NULL) and it has never failed.
|
|
|
|
|
I suspect your command-line argument is being interpreted as the executable name. See the CreateProcess[^] documentation:
Console processes written in C can use the argc and argv arguments to parse the command line. Because argv[0] is the module name, C programmers generally repeat the module name as the first token in the command line.
While that's talking about C programs, .NET programs conform to that as well. Add an argument before the e-mail address and you should find it all works.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
PROCESS_INFORMATION pi;
ZeroMemory (&pi, sizeof (pi));
STARTUPINFOA si;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
si.dwFlags = STARTF_USESHOWWINDOW;
//si.wShowWindow = SW_HIDE;
si.wShowWindow = SW_SHOW;
CreateProcessA (NULL, cmd, 0, 0, 0, CREATE_NO_WINDOW, 0, 0, &si, &pi);
|
|
|
|
|
tns_ranjith wrote: STARTUPINFOA
tns_ranjith wrote: CreateProcessA
Why?
|
|
|
|
|
You shouldn't be giving him any importance (take a look at some of his recent posts). You could just mark it down instead.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Oh, I thought he was trying to make a point.
|
|
|
|
|
for unicode project u want to use non unicode characters support..
|
|
|
|
|
In C run-time libs is there a function that renurns if the given string is a directory or a file name?
Чесноков
|
|
|
|
|
|
Thank you very much, your solution is the right one for C run-times.
Чесноков
|
|
|
|
|
Nope. However, you may find these functions [^] useful.
[added]
I was wrong, see [^]
[/added]
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
modified on Thursday, July 16, 2009 3:43 AM
|
|
|
|
|
CPallini wrote: Nope.
Hi Carlos,
Are you sure about that?
Best Wishes,
-David Delaune
|
|
|
|
|
Randor wrote: Hi Carlos,
Are you sure about that?
I'm quite sure of the opposite, now.
I've to admit, I erroneously read 'path' as 'name' (i.e. more caffeine is needed this morning)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Randor wrote: Carlos
It's Carlo .
Carlos is the guy who likes tapas and slaughters bulls for a living.
|
|
|
|
|
|
is it possible to prevent the user from left clicking on USB drive icon but allow to right clicking?
i would appreciate if some one post an example for it
|
|
|
|
|
jon ray wrote: is it possible to prevent the user from left clicking on USB drive icon...
Within Windows Explorer?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
sorry for the late reply i was very busy until yesterday and yes within windows explorer
|
|
|
|
|
See if this helps. Also see here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi
I am using VC++
and i want to change the access of usb device form read and write to read only.
i have understood that ACL can do that.
i would like to know more information about how do we use
ACL in vc++ to change the access of usb device
thanks
Anil Veeraghattapu.
|
|
|
|
|
you can change access of usb device through registry.
Registry path
[code]
LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\StorageDevicePolicies"
[/code]
just you change the values
[code]
"0" to "1"
WriteProtect="1"
[/code]
|
|
|
|