From 8bb7ed968db64e9b12a6447e2eec3586ef9e935c Mon Sep 17 00:00:00 2001 From: Dirk Date: Tue, 10 Jun 2014 14:19:40 +0200 Subject: Windows system name changer during bootup. --- windows/bootpgm/win32/IO.cpp | 136 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 windows/bootpgm/win32/IO.cpp (limited to 'windows/bootpgm/win32/IO.cpp') diff --git a/windows/bootpgm/win32/IO.cpp b/windows/bootpgm/win32/IO.cpp new file mode 100644 index 00000000..9b31832b --- /dev/null +++ b/windows/bootpgm/win32/IO.cpp @@ -0,0 +1,136 @@ +/* The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. + * + * The Initial Developer of the Original Code is Johannes Rudolph. + * Portions created by the Initial Developer are Copyright (C) 2006 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Johannes Rudolph + */ + +#include "StdAfx.h" +#include "IO.h" + +IO::IO(void):indent(0),current(0) +{ +} + +IO::~IO(void) +{ +} +void IO::print(char *buffer) +{ + if (current==0) + { + for (int i=0;i0) + { + curlength--; + handleCharEcho(curChar[0],buffer,curlength); + } + } + } + buffer[curlength-1]=0; + + debugout("readln beendet"); + //NT::DbgPrint("readln beendet\n"); +} +wchar_t *IO::char2wchar(char *buffer) +{ + unsigned int size=strlen(buffer)+1; + wchar_t *buffer2=(wchar_t*)malloc(sizeof(wchar_t)*size); + mbstowcs(buffer2,(char*)buffer,size); + buffer2[size-1]=0; + + return buffer2; +} +NT::UNICODE_STRING IO::getUnicodeString(char *buffer) +{ + wchar_t *buffer2=char2wchar(buffer); + + NT::UNICODE_STRING UnicodeFilespec; + RtlInitUnicodeString(&UnicodeFilespec, buffer2); + + return UnicodeFilespec; +} + +void IO::handleStatus(NT::NTSTATUS status,char *place,char *file,char *line,bool onlyWhenDebugging){ +#ifndef DEBUGGING + if (!onlyWhenDebugging) +#endif + if (status!=STATUS_SUCCESS) + { + print("[error]"); + print(file); + print("("); + print(line); + println("):"); + print("[error] Fehler: "); + println(place); + NT::DbgPrint("Fehler (Datei: %s \tZeile: %s): %s, %d\n",file,line,place,status); + } + else + { + print("[success] Erfolg: "); + println(place); + NT::DbgPrint("Erfolg: %s\n",place); + } +} +inline void IO::debugout(char *string) +{ +//#ifdef DEBUGGING + //print("[debug] "); + //println(string); + NT::DbgPrint("[bootpgm] %s\n",string); +//#endif +} + +void IO::setIndent(unsigned char indent) +{ + this->indent=indent; +} +unsigned char IO::getIndent() +{ + return indent; +} \ No newline at end of file -- cgit v1.2.3-55-g7522