#include <stdio.h>
#include <fcntl.h>
#include <io.h>
#include <windows.h>
#include "hook.h"
Go to the source code of this file.
◆ __PRINTF_ATTR
◆ APP_NAME
#define APP_NAME "wpickclick.exe" |
◆ BOOL()
◆ cleanup()
Definition at line 99 of file wpickclick.c.
100{
102
103 while (*
str==
' ' || *
str==
'\t' || *
str==
'\r' || *
str==
'\n')
108 while (
s>
str && (*
s==
' ' || *
s==
'\t' || *
s==
'\r' || *
s==
'\n'))
112}
ACPI_SIZE strlen(const char *String)
char * strchr(const char *String, int ch)
◆ cxlog()
Definition at line 61 of file wpickclick.c.
62{
64
66 {
70 }
71}
_Check_return_opt_ _CRTIMP int __cdecl vfprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format, va_list _ArgList)
static __ms_va_list valist
Referenced by WinMain().
◆ init_debug()
static int init_debug |
( |
| ) |
|
|
static |
Definition at line 52 of file wpickclick.c.
53{
58}
char * strstr(char *String1, char *String2)
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
Referenced by WinMain().
◆ load_hook_dll()
Definition at line 73 of file wpickclick.c.
74{
78
81 return hinstDll;
82
85
96 return hinstDll;
97}
char * strcat(char *DstString, const char *SrcString)
_CRT_RESTORE_GCC_WARNINGS _CRT_DISABLE_GCC_WARNINGS _Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
#define GetModuleFileName
Referenced by WinMain().
◆ pGetAction()
static action_t *WINAPI * pGetAction |
( |
| ) |
|
|
static |
◆ void()
◆ WinMain()
Definition at line 114 of file wpickclick.c.
116{
119
121
122
125
126 if (
strstr(lpCmdLine,
"--help"))
127 {
128 fprintf(
stderr,
"%s - Utility to print coordinates, component, window title, component class and window class name of a click\n",
APP_NAME);
129 fprintf(
stderr,
"----------------------------------------------\n");
133 fprintf(
stderr,
"select where to click. If we properly track the click, it will be reported\n");
135 fprintf(
stderr,
" button-name x y component_name window_name component_class_name window_class_name\n");
136 fprintf(
stderr,
"Note that x and y can be negative; this typically happens if you click within the\n");
137 fprintf(
stderr,
"window manager decorations of a given window.\n");
140 };
141
142
144 if (!hDll)
145 {
148 return 1;
149 }
150
155 if (!pInstallHooks || !pRemoveHooks || !
pGetAction)
156 {
157 fprintf(
stderr,
"Error: Unable to get the hook.dll functions (%ld)\n",
160 return 1;
161 }
162
163 if (!pInstallHooks(hDll))
164 {
165 fprintf(
stderr,
"Error: Unable to install the hooks (%ld)\n",
168 return 1;
169 }
170
174 {
177 return 1;
178 }
179
181 {
182 case ACTION_FAILED:
184 break;
185 case ACTION_NONE:
187 break;
190 break;
191 case ACTION_BUTTON1:
192 case ACTION_BUTTON2:
193 case ACTION_BUTTON3:
194 printf(
"button%d %ld %ld\n",
action->action-ACTION_BUTTON1+1,
196 break;
197 default:
200 break;
201 }
207
208 cxlog(
"\n%s: action=%d x=%ld y=%ld\n", __FILE__,
action->action,
210 cxlog(
"window_class='%s'\n",
action->window_class);
211 cxlog(
"window_title='%s'\n",
action->window_title);
213 cxlog(
"control_class='%s'\n",
action->control_class);
214 cxlog(
"control_caption='%s'\n",
action->control_caption);
215
217 pRemoveHooks();
218 return 0;
219}
#define _setmode(fd, mode)
#define GetProcAddress(x, y)
static void cleanup(void)
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
DWORD WINAPI GetLastError(void)
static action_t *WINAPI * pGetAction()
static void cxlog(const char *format,...) __PRINTF_ATTR(1
static HINSTANCE load_hook_dll()
◆ debug_on