28 #define SIP(String, Integer) { (String), (PVOID)(Integer) }
68 SIP(L
"{backspace}", VK_BACK),
69 SIP(L
"{delete}", VK_DELETE),
70 SIP(L
"{down}", VK_DOWN),
71 SIP(L
"{end}", VK_END),
72 SIP(L
"{enter}", VK_RETURN),
81 SIP(L
"{F10}", VK_F10),
82 SIP(L
"{F11}", VK_F11),
83 SIP(L
"{F12}", VK_F12),
84 SIP(L
"{home}", VK_HOME),
85 SIP(L
"{insert}", VK_INSERT),
86 SIP(L
"{left}", VK_LEFT),
87 SIP(L
"{-}", VK_SUBTRACT),
88 SIP(L
"{pagedown}", VK_NEXT),
89 SIP(L
"{pageup}", VK_PRIOR),
91 SIP(L
"{prtscrn}", VK_SNAPSHOT),
92 SIP(L
"{right}", VK_RIGHT),
93 SIP(L
"{spacebar}", VK_SPACE),
94 SIP(L
"{*}", VK_MULTIPLY),
95 SIP(L
"{tab}", VK_TAB),
107 _In_ HWND ParentWindowHandle,
111 if (SessionId == NtCurrentPeb()->SessionId)
113 PhShowError(ParentWindowHandle, L
"You cannot remote control the current session.");
137 HWND virtualKeyComboBox;
140 PWSTR stringToSelect;
142 SetProp(hwndDlg, L
"SessionId", (HANDLE)(ULONG)lParam);
150 stringToSelect = L
"{*}";
154 ComboBox_AddString(virtualKeyComboBox, VirtualKeyPairs[i].Key);
156 if ((ULONG)VirtualKeyPairs[i].Value == (ULONG)hotkey.
X)
158 stringToSelect = VirtualKeyPairs[i].
Key;
173 RemoveProp(hwndDlg, L
"SessionId");
178 switch (LOWORD(wParam))
181 EndDialog(hwndDlg, IDCANCEL);
185 ULONG sessionId = (ULONG)GetProp(hwndDlg, L
"SessionId");
188 WCHAR computerName[64];
189 ULONG computerNameLength = 64;
191 virtualKey = VK_MULTIPLY;
194 sizeof(VirtualKeyPairs),
201 if (Button_GetCheck(GetDlgItem(hwndDlg,
IDC_SHIFT)) == BST_CHECKED)
203 if (Button_GetCheck(GetDlgItem(hwndDlg,
IDC_CTRL)) == BST_CHECKED)
205 if (Button_GetCheck(GetDlgItem(hwndDlg,
IDC_ALT)) == BST_CHECKED)
208 if (GetComputerName(computerName, &computerNameLength))
210 if (
WinStationShadow(NULL, computerName, sessionId, (UCHAR)virtualKey, (USHORT)modifiers))
214 hotkey.
X = virtualKey;
215 hotkey.
Y = modifiers;
218 EndDialog(hwndDlg, IDOK);
222 PhShowStatus(hwndDlg, L
"Unable to remote control the session", 0, GetLastError());
227 PhShowError(hwndDlg, L
"The computer name is too long.");