From 108cbdee49661d0c6e0a8980795c5593dc077d91 Mon Sep 17 00:00:00 2001 From: Fritz Elfert Date: Mon, 9 Oct 2000 19:54:42 +0000 Subject: Added a hack for Jotter on S5mx and some experimental stuff. --- lib/bufferstore.cc | 12 ++++++------ lib/rpcs.cc | 15 ++++++++++++--- lib/rpcs32.cc | 21 +++++++++++++++++++-- lib/rpcs32.h | 2 ++ 4 files changed, 39 insertions(+), 11 deletions(-) (limited to 'lib') diff --git a/lib/bufferstore.cc b/lib/bufferstore.cc index 7f2b49d..ea4bab6 100644 --- a/lib/bufferstore.cc +++ b/lib/bufferstore.cc @@ -64,7 +64,7 @@ void bufferStore::init() { len = 0; } -void bufferStore::init(const unsigned char*_buff, long _len) { +void bufferStore::init(const unsigned char *_buff, long _len) { checkAllocd(_len); start = 0; len = _len; @@ -95,8 +95,8 @@ unsigned int bufferStore::getDWord(long pos) const { (buff[pos+start+3] << 24); } -const char* bufferStore::getString(long pos) const { - return (const char*)buff + pos + start; +const char * bufferStore::getString(long pos) const { + return (const char *)buff + pos + start; } ostream &operator<<(ostream &s, const bufferStore &m) { @@ -137,19 +137,19 @@ void bufferStore::addByte(unsigned char cc) { buff[len++] = cc; } -void bufferStore::addString(const char* s) { +void bufferStore::addString(const char *s) { int l = strlen(s); checkAllocd(len + l); memcpy(&buff[len], s, l); len += l; } -void bufferStore::addStringT(const char* s) { +void bufferStore::addStringT(const char *s) { addString(s); addByte(0); } -void bufferStore::addBytes(const unsigned char* s, int l) { +void bufferStore::addBytes(const unsigned char *s, int l) { checkAllocd(len + l); memcpy(&buff[len], s, l); len += l; diff --git a/lib/rpcs.cc b/lib/rpcs.cc index f1cac8a..d93fad0 100644 --- a/lib/rpcs.cc +++ b/lib/rpcs.cc @@ -153,12 +153,12 @@ getResponse(bufferStore & data, bool statusIsFirstByte) Enum ret; if (skt->getBufferStore(data) == 1) { if (statusIsFirstByte) { - ret = (enum rfsv::errs)data.getByte(0); + ret = (enum rfsv::errs)((char)data.getByte(0)); data.discardFirstBytes(1); } else { int l = data.getLen(); if (l > 0) { - ret = (enum rfsv::errs)data.getByte(data.getLen() - 1); + ret = (enum rfsv::errs)((char)data.getByte(data.getLen() - 1)); data.init((const unsigned char *)data.getString(), l - 1); } else ret = rfsv::E_PSI_GEN_FAIL; @@ -198,7 +198,16 @@ execProgram(const char *program, const char *args) int l = strlen(program); for (int i = 127; i > l; i--) a.addByte(0); - a.addByte(strlen(args)); + + /** + * This is a hack for the jotter app on mx5 pro. (and probably others) + * Jotter seems to read it's arguments one char past normal apps. + * Without this hack, The Drive-Character gets lost. Other apps don't + * seem to be hurt by the additional blank. + */ + a.addByte(strlen(args) + 1); + a.addByte(' '); + a.addStringT(args); if (!sendCommand(EXEC_PROG, a)) return rfsv::E_PSI_FILE_DISC; diff --git a/lib/rpcs32.cc b/lib/rpcs32.cc index 85dd415..2175ef0 100644 --- a/lib/rpcs32.cc +++ b/lib/rpcs32.cc @@ -170,6 +170,22 @@ getMachineInfo(machineInfo &mi) static unsigned long hhh; +Enum rpcs32:: +regOpenIter(void) +{ + bufferStore a; + Enum res; + + a.addStringT("HKLM\\"); + if (!sendCommand(rpcs::REG_OPEN_ITER, a)) + return rfsv::E_PSI_FILE_DISC; + res = getResponse(a, true); + cout << "ro: r=" << res << " a=" << a << endl; + if (a.getLen() > 0) + hhh = a.getDWord(0); + return rfsv::E_PSI_GEN_NONE; +} + Enum rpcs32:: configOpen(void) { @@ -179,8 +195,9 @@ configOpen(void) if (!sendCommand(rpcs::CONFIG_OPEN, a)) return rfsv::E_PSI_FILE_DISC; res = getResponse(a, true); -cout << "co: r=" << res << " a=" << a << endl; - hhh = a.getDWord(0); + cout << "co: r=" << res << " a=" << a << endl; + if (a.getLen() > 0) + hhh = a.getDWord(0); return rfsv::E_PSI_GEN_NONE; } diff --git a/lib/rpcs32.h b/lib/rpcs32.h index 973b142..3b2a3f7 100644 --- a/lib/rpcs32.h +++ b/lib/rpcs32.h @@ -17,7 +17,9 @@ class rpcs32 : public rpcs { Enum configRead(void); #if 0 Enum closeHandle(int); +#endif Enum regOpenIter(void); +#if 0 Enum regReadIter(void); Enum regWrite(void); Enum regRead(void); -- cgit v1.2.3