Posted on 2010-01-13 23:14
S.l.e!ep.¢% 阅读(1036)
评论(0) 编辑 收藏 引用 所属分类:
RootKit
void
envoiChaine
(char
*
sText)
{
bool
bShift, bControl, bAlt;
unsigned
int
nPos, nCpt;
char
cChar;
short
nKeyScan;
INPUT input[256
];
for
(nPos=
0
;nPos<=
strlen
(sText)-
1
;nPos+
+
)
{
ZeroMemory
(input, sizeof
input);
nCpt =
0
;
cChar =
sText[nPos];
nKeyScan =
VkKeyScan
(cChar);
bShift =
(HIBYTE
(nKeyScan) &
1
?1
:0
);
bControl =
(HIBYTE
(nKeyScan) &
2
?1
:0
);
bAlt =
(HIBYTE
(nKeyScan) &
4
?1
:0
);
if
(bShift)
{
input[nCpt].type =
INPUT_KEYBOARD;
input[nCpt].ki.wVk =
VK_SHIFT;
input[nCpt].ki.wScan =
MapVirtualKey
(VK_SHIFT, 0
);
nCpt+
+
;
}
if
(bControl)
{
input[nCpt].type =
INPUT_KEYBOARD;
input[nCpt].ki.wVk =
VK_CONTROL;
input[nCpt].ki.wScan =
MapVirtualKey
(VK_CONTROL, 0
);
nCpt+
+
;
}
if
(bAlt)
{
input[nCpt].type =
INPUT_KEYBOARD;
input[nCpt].ki.wVk =
VK_MENU;
input[nCpt].ki.wScan =
MapVirtualKey
(VK_MENU, 0
);
nCpt+
+
;
}
input[nCpt].type =
INPUT_KEYBOARD;
input[nCpt].ki.wVk =
LOBYTE
(nKeyScan);
input[nCpt].ki.wScan =
MapVirtualKey
(LOBYTE
(nKeyScan), 0
);
nCpt+
+
;
input[nCpt].type =
INPUT_KEYBOARD;
input[nCpt].ki.wVk =
LOBYTE
(nKeyScan);
input[nCpt].ki.wScan =
MapVirtualKey
(LOBYTE
(nKeyScan), 0
);
input[nCpt].ki.dwFlags =
KEYEVENTF_KEYUP;
nCpt+
+
;
if
(bShift)
{
input[nCpt].type =
INPUT_KEYBOARD;
input[nCpt].ki.wVk =
VK_SHIFT;
input[nCpt].ki.wScan =
MapVirtualKey
(VK_SHIFT, 0
);
input[nCpt].ki.dwFlags =
KEYEVENTF_KEYUP;
nCpt+
+
;
}
if
(bControl)
{
input[nCpt].type =
INPUT_KEYBOARD;
input[nCpt].ki.wVk =
VK_CONTROL;
input[nCpt].ki.wScan =
MapVirtualKey
(VK_CONTROL, 0
);
input[nCpt].ki.dwFlags =
KEYEVENTF_KEYUP;
nCpt+
+
;
}
if
(bAlt)
{
input[nCpt].type =
INPUT_KEYBOARD;
input[nCpt].ki.wVk =
VK_MENU;
input[nCpt].ki.wScan =
MapVirtualKey
(VK_MENU, 0
);
input[nCpt].ki.dwFlags =
KEYEVENTF_KEYUP;
nCpt+
+
;
}
SendInput
(nCpt, input, sizeof
INPUT);
}
}