|
|
1.1 ! root 1: /************************* MODULE HEADER *********************************** ! 2: * bWrite ! 3: * Simplified version of WriteFile(). ! 4: * ! 5: * ! 6: * Copyright (C) 1992 Microsoft Corporation. ! 7: * ! 8: ***************************************************************************/ ! 9: ! 10: #include <stddef.h> ! 11: #include <windows.h> ! 12: ! 13: #include "libproto.h" ! 14: ! 15: ! 16: /************************* Function Header ********************************* ! 17: * bWrite ! 18: * Writes data out to a file handle. Returns TRUE on success. ! 19: * Functions as a nop if the size request is zero. ! 20: * ! 21: * RETURNS: ! 22: * TRUE/FALSE, TRUE for success. ! 23: * ! 24: * HISTORY: ! 25: * 17:38 on Fri 21 Feb 1992 -by- Lindsay Harris [lindsayh] ! 26: * # 1 ! 27: * ! 28: ****************************************************************************/ ! 29: ! 30: BOOL ! 31: bWrite( hFile, pvBuf, iSize ) ! 32: HANDLE hFile; /* The file to which to write */ ! 33: VOID *pvBuf; /* Data to write */ ! 34: int iSize; /* Number of bytes to write */ ! 35: { ! 36: /* ! 37: * Simplify the ugly NT interface. Returns TRUE if the WriteFile ! 38: * call returns TRUE and the number of bytes written equals the ! 39: * number of bytes desired. ! 40: */ ! 41: ! 42: ! 43: BOOL bRet; ! 44: DWORD dwSize; /* Filled in by WriteFile */ ! 45: ! 46: ! 47: bRet = TRUE; ! 48: ! 49: if( iSize > 0 && ! 50: (!WriteFile( hFile, pvBuf, (DWORD)iSize, &dwSize, NULL ) || ! 51: (DWORD)iSize != dwSize) ) ! 52: bRet = FALSE; /* Too bad */ ! 53: ! 54: ! 55: return bRet; ! 56: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.