Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Replacing Characters within a TTY Printer Driver (W2003)

Posted on 2004-03-29
4
Medium Priority
?
366 Views
Last Modified: 2011-09-21
This is my first question here, and I'm not a C++ guy, but I've been asked to find a way to swap some characters out in a simple TTY printer driver.  The idea is to replace some weird control codes coming from one application before they get to the printer and mess up the output.

For this problem, I'd be happy to have the capability to switch "The quick brown fox" to "The slow brown fox" inside the standard TTY driver, for example -- in other words, to always find and switch "slow" for "quick".  In the real application, of course, it's more a string of relatively meaningless control characters.

I've been trying to modify the oemcom.cpp generic text driver provided with the Windows DDK, but I'm getting nowhere.

I tried modifying OutputCharStr in oemcom.cpp, for example:

      // Hello World??
      char* HelloWorld = "Hello World";
      pMyStuff->aubSpoolBuf = (PBYTE) &HelloWorld;

and it at least doesn't crash, but just gives me funky characters before and after the main text is printed - presumably related to header and footer information for the document.

It seems like there ought to be a string somewhere that could be modified as required, but I'm not finding it.

Thanks for any help.

Curt LaMontagne
0
Comment
Question by:Clamont
1 Comment
 
LVL 44

Accepted Solution

by:
Karl Heinz Kremer earned 1000 total points
ID: 10712789
There are two things you can do on your machine:
- re-implment the printer driver and do the string manipulations in the driver.
- implment a new port monitor for your output device (I assume you are printing via the serial port) that does the string manipulation.

The difference between the two is that the first one actually modifies the data that the driver produces, and you can use this with any port monitor, whereas the second one modifies teh behavior of the port monitor, so it will work with any printer driver.

The third solution would be (that is, if this is really a serial printer) to add another (cheap) computer between your machine and the printer that filters the serial data. Because the serial communication is really slow, you can take the oldest computer you can get your hands on for this task.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
Suggested Courses

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question