This repository has been archived by the owner on Jan 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinout.c
175 lines (146 loc) · 2.16 KB
/
inout.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#include "all.h"
void
setmousepoint(Point p)
{
Ureg u;
memset(&u, 0, sizeof u);
u.cx = BackSetptrloc;
u.bx = (p.x<<16) | p.y;
backdoor(&u, 1);
}
Point
getmousepoint(void)
{
Point p;
Ureg u;
memset(&u, 0, sizeof u);
u.cx = BackGetptrloc;
backdoor(&u, 0);
p.x = (signed)((u.ax>>16)&0xFFFF);
p.y = (signed)(u.ax & 0xFFFF);
return p;
}
int
getsnarflength(void)
{
Ureg u;
memset(&u, 0, sizeof u);
u.cx = BackGetsellength;
backdoor(&u, 0);
return u.ax;
}
uint
getsnarfpiece(void)
{
Ureg u;
memset(&u, 0, sizeof u);
u.cx = BackGetnextpiece;
backdoor(&u, 0);
return u.ax;
}
void
setsnarflength(uint len)
{
Ureg u;
memset(&u, 0, sizeof u);
u.cx = BackSetsellength;
u.bx = len;
backdoor(&u, 1);
}
void
setsnarfpiece(uint p)
{
Ureg u;
memset(&u, 0, sizeof u);
u.cx = BackSetnextpiece;
u.bx = p;
backdoor(&u, 1);
}
int
getversion(void)
{
Ureg u;
jmp_buf jb;
memset(&u, 0, sizeof u);
u.cx = BackGetversion;
memmove(jb, backdoorjmp, sizeof jb);
if(setjmp(backdoorjmp)){
memmove(backdoorjmp, jb, sizeof jb);
return -1;
}
backdoor(&u, 0);
memmove(backdoorjmp, jb, sizeof jb);
if(u.ax != VersionMagic || u.bx != BackMagic)
return -1;
return 0;
}
int
setdevicestate(uint id, int enable)
{
Ureg u;
if(enable)
id |= 0x80000000;
memset(&u, 0, sizeof u);
u.cx = BackToggledev;
u.bx = id;
backdoor(&u, 0);
return u.ax;
}
int
getdeviceinfo(uint id, uint offset, uint *p)
{
Ureg u;
memset(&u, 0, sizeof u);
u.bx = (id<<16) | offset;
u.cx = BackGetdevlistel;
backdoor(&u, 0);
*p = u.bx;
return u.ax;
}
void
setguistate(uint state)
{
Ureg u;
memset(&u, 0, sizeof u);
u.bx = state;
u.cx = BackSetguiopt;
backdoor(&u, 1);
}
uint
getguistate(void)
{
Ureg u;
memset(&u, 0, sizeof u);
u.cx = BackGetguiopt;
backdoor(&u, 0);
return u.ax;
}
uint
copystep(uint x)
{
Ureg u;
memset(&u, 0, sizeof u);
u.cx = BackHostcopy;
u.bx = x;
backdoor(&u, 0);
return u.ax;
}
void
gettime(uint *sec, uint *micro, uint *lag)
{
Ureg u;
memset(&u, 0, sizeof u);
u.cx = BackGettime;
backdoor(&u, 0);
*sec = u.ax;
*micro = u.bx;
*lag = u.cx;
}
void
stopcatchup(void)
{
Ureg u;
memset(&u, 0, sizeof u);
u.cx = BackStopcatchup;
backdoor(&u, 0);
}