home *** CD-ROM | disk | FTP | other *** search
- /*
- DUMPICON.C -- Uses DumpIcon to dump WINIO class icon and cursor
-
- From Chapter 6 of "Undocumented Windows" (Addison-Wesley 1992)
- by Andrew Schulman, Dave Maxey and Matt Pietrek
-
- Build using: WINIOBC DUMPICON (for Borland C++ v3.00)
- WINIOMS DUMPICON (for Microsoft C/SDK)
- */
-
- #include <windows.h>
- #include "winio.h"
-
- /* undocumented structure */
- #include "cursicon.h"
-
- /* undocumented function */
- extern DWORD FAR PASCAL DumpIcon(LPCURSORICONINFO lpInfo,
- WORD FAR *lpLen, // Length of header
- LPSTR FAR *lpXORBits, // Pointer to XOR bits
- LPSTR FAR *lpANDMask // Pointer to AND bits
- );
-
- #include "checkord.c"
-
- int main()
- {
- LPCURSORICONINFO lpInfo;
- DWORD dwSize;
- WORD wHdrLen;
- LPSTR lpXOR;
- LPSTR lpAND;
-
- // Ord/name check
- if (! CheckOrdName("DumpIcon", "USER", 459))
- return 0;
-
- winio_about("DUMPICON"
- "\nUses DumpIcon to dump WINIO class icon and cursor"
- "\n\nFrom Chapter 6 of"
- "\n\"Undocumented Windows\" (Addison-Wesley, 1992)"
- "\nby Andrew Schulman, David Maxey and Matt Pietrek"
- );
-
- lpInfo = (LPCURSORICONINFO) LockResource(
- (HANDLE) GetClassWord(winio_current(), GCW_HCURSOR));
- if ((dwSize = DumpIcon(
- lpInfo,
- (WORD FAR *) &wHdrLen,
- (LPSTR FAR *) &lpXOR,
- (LPSTR FAR *) &lpAND)) == 0)
- {
- printf("Could not DumpIcon the class cursor...!\n");
- return 0;
- }
-
- FreeResource((HANDLE) GetClassWord(winio_current(), GCW_HCURSOR));
-
- winio_setpaint(__hMainWnd, FALSE);
- printf( "Dump of the winio_app class CURSOR\n"
- "----------------------------------\n"
- "Header length : %d bytes\n"
- " Hotspot X : %d\n"
- " Hotspot Y : %d\n"
- " Width : %d\n"
- " Height : %d\n"
- " Width in bytes : %d\n"
- " Bit planes : %d\n"
- " Bits per Pixel : %d\n"
- "Single plane size : %d\n"
- "Full bitmap size : %d\n"
- "XOR bitmap address : %Fp\n"
- "AND bitmap address : %Fp\n\n",
- wHdrLen,
- lpInfo->pntHotSpot.x,
- lpInfo->pntHotSpot.x,
- lpInfo->nWidth,
- lpInfo->nHeight,
- lpInfo->nWidthBytes,
- lpInfo->byPlanes,
- lpInfo->byBitsPix,
- (WORD) dwSize,
- (WORD) (dwSize >> 16), lpXOR, lpAND);
-
- lpInfo = (LPCURSORICONINFO) LockResource(
- (HANDLE) GetClassWord(winio_current(), GCW_HICON));
- if ((dwSize = DumpIcon(
- lpInfo,
- (WORD FAR *) &wHdrLen,
- (LPSTR FAR *) &lpXOR,
- (LPSTR FAR *) &lpAND)) == 0)
- {
- printf("Could not DumpIcon the class icon...!\n");
- return 0;
- }
-
- FreeResource((HANDLE) GetClassWord(winio_current(), GCW_HICON));
-
- printf( "Dump of the winio_app class ICON\n"
- "--------------------------------\n"
- "Header length : %d bytes\n"
- " Hotspot X : %d\n"
- " Hotspot Y : %d\n"
- " Width : %d\n"
- " Height : %d\n"
- " Width in bytes : %d\n"
- " Bit planes : %d\n"
- " Bits per Pixel : %d\n"
- "Single plane size : %d\n"
- "Full bitmap size : %d\n"
- "XOR bitmap address : %Fp\n"
- "AND bitmap address : %Fp\n\n",
- wHdrLen,
- lpInfo->pntHotSpot.x,
- lpInfo->pntHotSpot.x,
- lpInfo->nWidth,
- lpInfo->nHeight,
- lpInfo->nWidthBytes,
- lpInfo->byPlanes,
- lpInfo->byBitsPix,
- (WORD) dwSize,
- (WORD) (dwSize >> 16), lpXOR, lpAND);
-
-
- printf("Program terminated");
- winio_setpaint(__hMainWnd, TRUE);
- winio_home(__hMainWnd);
- return 0;
- }
-
-