GetKeyState verstehen

Hallo,
es gibt einen Texteditor, der eine DLL für Eingabe lädt, die eine system DLL Funktion für Eingabe aufruft. So weit - so gut.

Relevant ist aus einer DLL:

.text:1003A745 loc_1003A745:                           ; CODE XREF: sub_1003A0D6+51E j
.text:1003A745                                         ; DATA XREF: .text:off_1003AEBE o
.text:1003A745                 mov     esi, ds:GetKeyState
.text:1003A74B                 push    12h             ; nVirtKey
.text:1003A74D                 mov     [edi+1020h], dl
.text:1003A753                 call    esi ; GetKeyState
.text:1003A755                 cwde
.text:1003A756                 xor     ebx, ebx
.text:1003A758                 shr     eax, 1Fh
.text:1003A75B                 inc     ebx
.text:1003A75C                 and     al, bl
.text:1003A75E                 push    11h             ; nVirtKey
.text:1003A760                 mov     [ebp+28h], eax
.text:1003A763                 call    esi ; GetKeyState
.text:1003A765                 cwde
.text:1003A766                 shr     eax, 1Fh
.text:1003A769                 and     al, bl
.text:1003A76B                 push    10h             ; nVirtKey
.text:1003A76D                 mov     [ebp+24h], eax
.text:1003A770                 call    esi ; GetKeyState
.text:1003A772                 mov     ecx, [ebp+2Ch]
.text:1003A775                 movsx   ebx, ax
.text:1003A778                 shr     ebx, 1Fh
.text:1003A77B                 and     bl, 1
.text:1003A77E                 call    sub_10038718
.text:1003A783                 mov     dl, [ebp+24h]
.text:1003A786                 mov     esi, eax
.text:1003A788                 lea     eax, [edi+1020h]
.text:1003A78E                 push    eax
.text:1003A78F                 push    ecx
.text:1003A790                 push    dword ptr [ebp+28h]
.text:1003A793                 mov     cl, bl
.text:1003A795                 call    sub_10011274
.text:1003A79A                 pop     ecx
.text:1003A79B                 pop     ecx
.text:1003A79C                 push    eax
.text:1003A79D                 push    esi
.text:1003A79E                 mov     ecx, edi
.text:1003A7A0                 call    sub_1001457C
.text:1003A7A5                 test    eax, eax
.text:1003A7A7                 jnz     loc_1003A1B7
.text:1003A7AD                 cmp     [edi+1020h], al
.text:1003A7B3                 jnz     loc_1003A1B7
.text:1003A7B9                 mov     edx, [ebp+3Ch]
.text:1003A7BC                 push    edx
.text:1003A7BD                 push    dword ptr [ebp+2Ch]

...745 wird glaube ich wiederholt aufgerufen und viele call s.

Fragen:

  1. Was passiert da?
  2. Warum 4mal GetKeyState?
  3. Welche Funktion wird aufgerufen, wenn 1 Zeichen eingegeben wurde, das der Editor anzeigen soll?
  4. Und welches Zeichen wurde eingegeben? In welchem register steht das?

(1. bis 4. sind nach ihrer Wichtigkeit umgekehrt sortiert wiedergegeben.)