Stubs

Stubs

Much too often, when we want to make a single application happy, we implement a needed function only as a stub.

Stubs are sometimes the reason for failures in other applications without notice.

Example:

/******************************************************************************
 *    SetPrinterW  [WINSPOOL.@]
 */
BOOL WINAPI SetPrinterW(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter, DWORD Command)
{
    FIXME("(%p, %d, %p, %d): stub\n", hPrinter, Level, pPrinter, Command);
    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
    return FALSE;
}

What to do, when touching the code

  • Write some tests.
  • Properly implement the function.

When this is not possible, make a stub:

  • The stub should dump all parameters with a FIXME(), and also output the text "stub" (preferred; more than 2500 occurrences) or "stub!" (about 800 occurrences) at the end.

  • If the stub returns a failure status, it should also provide an error code.

Workers: none yet


CategoryJanitorialProjects

Stubs (last edited 2008-12-13 21:32:59 by AlexanderScottJohns)