Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
2.4 KiB

  1. /*************************************************************************
  2. * CLASS1.C
  3. *
  4. * Routines used to enumerate window classes
  5. *
  6. *************************************************************************/
  7. #include "toolpriv.h"
  8. #include <testing.h>
  9. /* ----- Types ----- */
  10. /* The following was stolen from the 3.1 USER but is the same as 3.0.
  11. * Note that the only fielda we use (for now) are the atomClassName
  12. * and the pclsNext fields.
  13. * Oops. We're going to use the hInstance field also.
  14. */
  15. typedef struct tagCLS
  16. {
  17. struct tagCLS *pclsNext;
  18. unsigned clsMagic;
  19. unsigned atomClassName;
  20. char *pdce; /* DCE * to DC associated with class */
  21. int cWndReferenceCount; /* Windows registered with this class */
  22. unsigned style;
  23. long (far *lpfnWndProc)();
  24. int cbclsExtra;
  25. int cbwndExtra;
  26. HANDLE hInstance;
  27. HANDLE hIcon;
  28. HANDLE hCursor;
  29. HANDLE hbrBackground;
  30. char far *lpszMenuName;
  31. char far *lpszClassName;
  32. } CLS;
  33. typedef CLS FAR *LPCLS;
  34. /* ----- Functions ----- */
  35. /* ClassFirst
  36. * Returns information about the first task in the task chain.
  37. */
  38. BOOL TOOLHELPAPI ClassFirst(
  39. CLASSENTRY FAR *lpClass)
  40. {
  41. WORD wClassHead;
  42. /* Check for errors */
  43. if (!wLibInstalled || !lpClass || lpClass->dwSize != sizeof (CLASSENTRY))
  44. return FALSE;
  45. /* If we're in Win3.1, call the special entry point to get the head */
  46. if (!(wTHFlags & TH_WIN30))
  47. wClassHead = (WORD)(*lpfnUserSeeUserDo)(SD_GETCLASSHEADPTR, 0, 0L);
  48. /* In 3.0 (and 3.0a) we're forced to use a fixed offset. Unfortunately,
  49. * this offset is different in debug and nondebug versions.
  50. */
  51. else
  52. {
  53. if (GetSystemMetrics(SM_DEBUG))
  54. wClassHead = 0x1cc;
  55. else
  56. wClassHead = 0x1b8;
  57. wClassHead = *(WORD FAR *)MAKEFARPTR(hUserHeap, wClassHead);
  58. }
  59. /* Now get the stuff */
  60. return ClassInfo(lpClass, wClassHead);
  61. }
  62. /* ClassNext
  63. * Returns information about the next task in the task chain.
  64. */
  65. BOOL TOOLHELPAPI ClassNext(
  66. CLASSENTRY FAR *lpClass)
  67. {
  68. /* Check for errors */
  69. if (!wLibInstalled || !lpClass || !lpClass->wNext ||
  70. lpClass->dwSize != sizeof (CLASSENTRY))
  71. return FALSE;
  72. return ClassInfo(lpClass, lpClass->wNext);
  73. }