windows - Programly detect if my machine remotely accessed -


i have winservice running in 1 pc, connected server can push command winservcice.

one of command should : isconnectedremotly : should return true if connect machine other machine (remotely), , username (the session username connected to)

how can that?

it depends... if mean "is calling process running under remote session, obtain session id process , get info session check if remote session, like:

dword processid; // filled calling program using getcurrentprocessid() dword sessionid, bytecount; lptstr buffer; if (processidtosessionid(processid, &sessionid))     if (wtsquerysessioninformation(wts_current_server_handle, sessionid,                                    wtsisremotesession, &buffer, &bytecount))         if (wtsquerysessioninformation(wts_current_server_handle, sessionid,                                        wtsusername, &buffer, &bytecount))         {   // copy away user name in buffer             wtsfreememory(buffer);         } 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -