Link to home
Start Free TrialLog in
Avatar of deshaw
deshawFlag for India

asked on

C/C++ : How to get the remote logged on user from IP address

Hi,

My problem is, I want to retrieve the logged on user on remote machine. I will have remote machine's IP address. Is there any way to retrieve the information which says that the use XXX has been logged on this machine?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of deshaw

ASKER

I have removed most of errors but I am not able to remove below errors. Could anyone tell me how to remove it. One more thing I dont know why this code expect UNICODE defined? I am compiling code in Release mode.

Error259      error C2664: 'wcsicmp' : cannot convert parameter 1 from 'LPSTR' to 'const wchar_t *'            
Error260      error C2665: 'wcsstr' : none of the 2 overloads could convert all the argument types            
Error261      error C2664: 'swscanf' : cannot convert parameter 1 from 'LPSTR' to 'const wchar_t       
Error262      error C2664: 'wcsicmp' : cannot convert parameter 2 from 'LPSTR' to 'const wchar_t *'

Thanks            
Avatar of deshaw

ASKER

The condition "if( subAuthorityCount >= 3 ) {" never gets true and as a result it always says "No user logged on". Please let me know if you know the reason for this,

Thanks,
Avatar of deshaw

ASKER

Sorry, missed to tell you that I have used type casting - "(LPSTR)subKeyName"  and all errors went off.

>>I have used type casting - "(LPSTR)subKeyName"  and all errors went off.

Actually, it is not a good idea to typecast here - bettre set your project to UNICODE to get rid of these issues, this ensures that the code does not only compile but also run.
Avatar of deshaw

ASKER

Thanks, ikr