-#define MAXREAD 32768 /* Number of bytes to be read during */
- /* each read operation. */
-
-/* Header signatutes for various resources */
-#define BFT_ICON 0x4349 /* 'IC' */
-#define BFT_BITMAP 0x4d42 /* 'BM' */
-#define BFT_CURSOR 0x5450 /* 'PT' */
-
-/* macro to determine if resource is a DIB */
-#define ISDIB(bft) ((bft) == BFT_BITMAP)
-
-/* Macro to align given value to the closest DWORD (unsigned long ) */
-#define ALIGNULONG(i) ((i+3)/4*4)
-
-/* Macro to determine to round off the given value to the closest byte */
-#define WIDTHBYTES(i) ((i+31)/32*4)
-
-#define PALVERSION 0x300
-#define MAXPALETTE 256 /* max. # supported palette entries */
-
-DWORD PASCAL lread(int fh, VOID FAR *pv, DWORD ul);
-DWORD PASCAL lwrite(int fh, VOID FAR *pv, DWORD ul);
-
-BOOL WriteDIB (LPSTR szFile,HANDLE hdib);
-WORD PaletteSize (VOID FAR * pv);
-WORD DibNumColors (VOID FAR * pv);
-// HANDLE DibFromBitmap (HBITMAP hbm, DWORD biStyle, WORD biBits, HPALETTE hpal);
-BOOL PASCAL MakeBitmapAndPalette(HDC,HANDLE,HPALETTE *,HBITMAP *);
-HPALETTE MakeDIBPalette(LPBITMAPINFOHEADER);
-BOOL ReadDIB(LPSTR lpFileName, HBITMAP *bitmap, HPALETTE *palette);
-
-/****************************************************************************
- * *
- * FUNCTION : WriteDIB(LPSTR szFile,HANDLE hdib) *
- * *
- * PURPOSE : Write a global handle in CF_DIB format to a file. *
- * *
- * RETURNS : TRUE - if successful. *
- * FALSE - otherwise *
- * *
- ****************************************************************************/
-
-BOOL WriteDIB(LPSTR szFile, HANDLE hdib)
-{
- BITMAPFILEHEADER hdr;
- LPBITMAPINFOHEADER lpbi;
- int fh;
- OFSTRUCT of;
-
- if (!hdib)
- return FALSE;
-
- fh = OpenFile(szFile, &of, OF_CREATE | OF_READWRITE);
- if (fh == -1)
- return FALSE;
-
-#ifdef __WINDOWS_386__
- lpbi = (LPBITMAPINFOHEADER) MK_FP32(GlobalLock(hdib));
-#else
- lpbi = (LPBITMAPINFOHEADER) GlobalLock(hdib);
-#endif
- /* Fill in the fields of the file header */
- hdr.bfType = BFT_BITMAP;
- hdr.bfSize = GlobalSize(hdib) + sizeof(BITMAPFILEHEADER);
- hdr.bfReserved1 = 0;
- hdr.bfReserved2 = 0;
- hdr.bfOffBits = (DWORD) sizeof(BITMAPFILEHEADER) + lpbi->biSize +
- PaletteSize(lpbi);
-
- /* Write the file header */
- _lwrite(fh, (LPSTR) &hdr, sizeof(BITMAPFILEHEADER));
-
- /* Write the DIB header and the bits */
- lwrite(fh, (LPSTR) lpbi, GlobalSize(hdib));
-
- GlobalUnlock(hdib);
- _lclose(fh);
- return TRUE;
-}