WCHAR OALBLMenuReadKey(BOOL wait) { CHAR key; while ((key = OEMReadDebugByte()) == OEM_DEBUG_READ_NODATA && wait); if (key == OEM_DEBUG_READ_NODATA) key = 0; return (WCHAR)key; }
USHORT InputNumericalHex(CHAR *szCount, UINT32 length) { USHORT cwNumChars = 0; USHORT InChar = 0; while(!((InChar == 0x0d) || (InChar == 0x0a))) { InChar = toUpper(OEMReadDebugByte()); if (InChar != OEM_DEBUG_COM_ERROR && InChar != OEM_DEBUG_READ_NODATA) { // If it's a number or a period, add it to the string. // if ((InChar >= '0' && InChar <= '9')) { if (cwNumChars < length) { szCount[cwNumChars++] = (char)InChar; OEMWriteDebugByte((BYTE)InChar); } } if ((InChar >= 'A' && InChar <= 'F')) { if (cwNumChars < length) { szCount[cwNumChars++] = (char)InChar; OEMWriteDebugByte((BYTE)InChar); } } // If it's a backspace, back up. // else if (InChar == 8) { if (cwNumChars > 0) { cwNumChars--; OEMWriteDebugByte((BYTE)InChar); } } } } // If it's a carriage return with an empty string, don't change anything. // if (cwNumChars) { szCount[cwNumChars] = '\0'; } else { szCount[0] = '\0'; } return cwNumChars; }
BOOL ConfirmProcess(const char *msg) { BYTE KeySelect = 0; EdbgOutputDebugString ( msg); while (! ( ( (KeySelect == 'Y') || (KeySelect == 'y') ) || ( (KeySelect == 'N') || (KeySelect == 'n') ) )) { KeySelect = OEMReadDebugByte(); } if(KeySelect == 'Y' || KeySelect == 'y') { return TRUE; } return FALSE; }
unsigned char getChar() { unsigned char KeySelect = 0; while (! ( ( (KeySelect == ';') || (KeySelect == ':' ) ) || ( (KeySelect == '+') || (KeySelect == '-' ) ) || ( (KeySelect == 27) || (KeySelect == 8 ) ) || ( (KeySelect >= '0') && (KeySelect <= '9') ) || ( (KeySelect == 'A') || (KeySelect == 'a') ) || ( (KeySelect == 'B') || (KeySelect == 'b') ) || ( (KeySelect == 'C') || (KeySelect == 'c') ) || ( (KeySelect == 'D') || (KeySelect == 'd') ) || ( (KeySelect == 'E') || (KeySelect == 'e') ) || ( (KeySelect == 'F') || (KeySelect == 'f') ) || ( (KeySelect == 'G') || (KeySelect == 'g') ) || ( (KeySelect == 'H') || (KeySelect == 'h') ) || ( (KeySelect == 'I') || (KeySelect == 'i') ) || ( (KeySelect == 'J') || (KeySelect == 'j') ) || ( (KeySelect == 'K') || (KeySelect == 'k') ) || ( (KeySelect == 'L') || (KeySelect == 'l') ) || ( (KeySelect == 'M') || (KeySelect == 'm') ) || ( (KeySelect == 'N') || (KeySelect == 'n') ) || ( (KeySelect == 'O') || (KeySelect == 'o') ) || ( (KeySelect == 'P') || (KeySelect == 'p') ) || ( (KeySelect == 'Q') || (KeySelect == 'q') ) || ( (KeySelect == 'R') || (KeySelect == 'r') ) || ( (KeySelect == 'S') || (KeySelect == 's') ) || ( (KeySelect == 'T') || (KeySelect == 't') ) || ( (KeySelect == 'U') || (KeySelect == 'u') ) || ( (KeySelect == 'V') || (KeySelect == 'v') ) || ( (KeySelect == 'W') || (KeySelect == 'w') ) || ( (KeySelect == 'X') || (KeySelect == 'x') ) || ( (KeySelect == 'Y') || (KeySelect == 'y') ) || ( (KeySelect == 'Z') || (KeySelect == 'z') ) )) { KeySelect = OEMReadDebugByte(); } EdbgOutputDebugString ( "%c\r\n", KeySelect); return toUpper(KeySelect); }
USHORT GetIPString(char *szDottedD) { USHORT InChar = 0; USHORT cwNumChars = 0; while(!((InChar == 0x0d) || (InChar == 0x0a))) { InChar = OEMReadDebugByte(); if (InChar != OEM_DEBUG_COM_ERROR && InChar != OEM_DEBUG_READ_NODATA) { // If it's a number or a period, add it to the string. // if (InChar == '.' || (InChar >= '0' && InChar <= '9')) { if (cwNumChars < 16) // IP string cannot over 15. xxx.xxx.xxx.xxx { szDottedD[cwNumChars++] = (char)InChar; OEMWriteDebugByte((BYTE)InChar); } } // If it's a backspace, back up. // else if (InChar == 8) { if (cwNumChars > 0) { cwNumChars--; OEMWriteDebugByte((BYTE)InChar); } } } } return cwNumChars; }