Microsoft KB Archive/32732

From BetaArchive Wiki

INF: Definition of Raw and Cooked Modes ID Number: Q32732

2.x 3.x 4.00 4.00a 4.01 4.01a 5.00 MS-DOS

Summary:

Character devices have two modes that have significance when performing input/output through the Read Handle and Write Handle calls (Functions 3FH and 40H): “raw” and “cooked” modes. A device driver can be set to raw mode with the IOCTL Function Request 44H.

Cooked mode input is buffered input with echoing to the screen (if console) and CTRL+C checking. Cooked mode input containing a certain number of characters will return when the specified number of characters is returned or a carriage return is typed. Cooked mode output performs CTRL+C checking between characters.

Raw mode I/O is very fast. When raw mode I/O of “n” characters is requested, MS-DOS passes the request directly to the indicated device driver. The device driver does not return to MS-DOS until the I/O has completed. Characters are written or read directly from the process buffer. No checking of any kind is performed. No characters have any significance, including CTRL+C.

For example, if the requesting program puts a device in raw mode and requests a write of 50,000 characters to the AUX device, the device driver will get a request from MS-DOS to write 50,000 characters from the buffer located at the DWORD transfer address. The driver will not return until the request has completed.

In cooked mode, MS-DOS performs a CTRL+C check at the console after every character write. This is an overhead of 50,000 CTRL+C checks.

Additional reference words: 2.x 3.x 4.00 4.00a 4.01 4.01a 5.00