Initial revision
authorStephen Adams <edu/mit/csail/zurich/adams>
Mon, 20 Sep 1993 01:13:04 +0000 (01:13 +0000)
committerStephen Adams <edu/mit/csail/zurich/adams>
Mon, 20 Sep 1993 01:13:04 +0000 (01:13 +0000)
15 files changed:
v7/src/win32/dib.scm [new file with mode: 0644]
v7/src/win32/ffimacro.scm [new file with mode: 0644]
v7/src/win32/graphics.scm [new file with mode: 0644]
v7/src/win32/make.scm [new file with mode: 0644]
v7/src/win32/module.scm [new file with mode: 0644]
v7/src/win32/protect.scm [new file with mode: 0644]
v7/src/win32/wf_user.scm [new file with mode: 0644]
v7/src/win32/win32.cbf [new file with mode: 0644]
v7/src/win32/win32.pkg [new file with mode: 0644]
v7/src/win32/win32.sf [new file with mode: 0644]
v7/src/win32/win_ffi.scm [new file with mode: 0644]
v7/src/win32/wingdi.scm [new file with mode: 0644]
v7/src/win32/winnt.scm [new file with mode: 0644]
v7/src/win32/winuser.scm [new file with mode: 0644]
v7/src/win32/wt_user.scm [new file with mode: 0644]

diff --git a/v7/src/win32/dib.scm b/v7/src/win32/dib.scm
new file mode 100644 (file)
index 0000000..e31369e
--- /dev/null
@@ -0,0 +1,169 @@
+#| -*-Scheme-*-
+
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/win32/dib.scm,v 1.1 1993/09/20 01:13:04 adams Exp $
+
+Copyright (c) 1993 Massachusetts Institute of Technology
+
+This material was developed by the Scheme project at the Massachusetts
+Institute of Technology, Department of Electrical Engineering and
+Computer Science.  Permission to copy this software, to redistribute
+it, and to use it for any purpose is granted, subject to the following
+restrictions and understandings.
+
+1. Any copy made of this software must include this copyright notice
+in full.
+
+2. Users of this software agree to make their best efforts (a) to
+return to the MIT Scheme project any improvements or extensions that
+they make, so that these may be included in future releases; and (b)
+to inform MIT of noteworthy uses of this software.
+
+3. All materials developed as a consequence of the use of this
+software shall duly acknowledge such use, in accordance with the usual
+standards of acknowledging credit in academic research.
+
+4. MIT has made no warrantee or representation that the operation of
+this software will be error-free, and MIT is under no obligation to
+provide any services, by way of maintenance, update, or otherwise.
+
+5. In conjunction with products arising from the use of this material,
+there shall be no use of the name of the Massachusetts Institute of
+Technology nor of any adaptation thereof in any advertising,
+promotional, or sales literature without prior written consent from
+MIT in each case. |#
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;; Device-independent bitmaps (dibutils.dll)
+;;; package: (win32 dib)
+
+(define-structure
+  (dib
+   (constructor %make-dib))
+  handle
+)
+
+;; DIBS are handles into non-scheme memory.  They are kept on a protection list
+;; so that the memory can be freed if there is no longer a handle to the DIB.
+;; Because DIBS can be huge, we also support explicit deallocation via DELETE-DIB.
+;; The protection list descriptor is a CELL containing the handle.  It is shared with
+;; the DIB structure so that explicit deallocation can signal that the dib is void.
+
+(define dib-protection-list)
+
+(define (make-dib handle)
+  (let* ((cell (make-cell handle))
+        (dib  (%make-dib cell)))
+    (add-to-protection-list! dib-protection-list dib cell)
+    dib))
+
+
+(define dib-result
+  (lambda (handle)
+    (if (= handle 0)
+       #f
+       (make-dib handle))))
+
+(define dib-arg
+  (lambda (dib)
+    (if dib
+       (cell-contents (dib-handle dib))
+       0)))  
+
+(define-windows-type dib
+  (lambda (thing) (or (dib? thing) (eq? thing #f)))
+  dib-arg
+  dib-result)
+
+
+(define (delete-dib dib)
+  (let ((handle (cell-contents (dib-handle dib))))
+    (set-cell-contents! (dib-handle dib) 0)
+    (%delete-dib handle)))
+
+(define (destroy-lost-dibs)
+  (clean-lost-protected-objects
+    dib-protection-list
+    (lambda (cell) (%delete-dib (cell-contents cell)))))
+
+
+(define dibutils.dll)
+(define open-dib)
+(define write-dib)
+(define copy-bitmap)
+(define create-dib)
+(define crop-bitmap)
+(define bitmap-from-dib)
+(define dib-from-bitmap)
+(define dib-blt)
+(define %delete-dib)
+(define dib-width)
+(define dib-height)
+(define dib-set-pixels-unaligned)
+
+(define (initialize-package!)
+
+  (set! dibutils.dll (find-module "DIBUTILS.DLL"))
+
+  (set!  open-dib
+    (windows-procedure (open-dib (filename string))
+       dib dibutils.dll "OpenDIB"))
+
+  (set!  write-dib
+    (windows-procedure (write-dib (filename string) (dib dib))
+                      bool dibutils.dll "WriteDIB"))
+
+
+  (set!  bitmap-from-dib
+    (windows-procedure (bitmap-from-dib (dib dib) (palette hpalette))
+                      hbitmap dibutils.dll "BitmapFromDib"))
+
+  (set!  dib-from-bitmap
+    (windows-procedure
+     (dib-from-bitmap (bitmap hbitmap) (style dword) (bits word) (palette hpalette))
+     dib  dibutils.dll "DibFromBitmap"))
+
+  (set!  dib-blt
+    (windows-procedure
+     (dib-blt (dest hdc) (x int) (y int) (w int) (height int) 
+             (src dib) (src-x int) (src-y int) (raster-op long))
+     bool dibutils.dll "DibBlt"))
+
+  (set!  %delete-dib
+    (windows-procedure
+      (%delete-dib (dib-handle handle)) bool dibutils.dll "DeleteDIB"))
+    ;; int-arg is the handle, NOT dib-arg for a DIB record.
+
+  (set!  dib-height
+    (windows-procedure (dib-height (dib dib)) int dibutils.dll "DibHeight" expand))
+
+  (set!  dib-width
+    (windows-procedure (dib-width (dib dib)) int dibutils.dll "DibWidth" expand))
+
+  (set!  copy-bitmap
+    (windows-procedure (copy-bitmap (bm hbitmap))
+      hbitmap dibutils.dll "CopyBitmap"))
+
+  (set!  create-dib
+    (windows-procedure
+       (create-dib (width int) (height int)
+                   (style int) (depth int) (palette hpalette))
+      dib dibutils.dll "CreateDIB"))
+
+  (set!  crop-bitmap
+    (windows-procedure
+       (crop-bitmap (bm hbitmap) (left int) (top int) (right int) (bottom int))
+      hbitmap dibutils.dll "CropBitmap"))
+
+  (set!  dib-set-pixels-unaligned
+    (windows-procedure
+       (dib-set-pixels-unaligned (dib dib) (pixels string))
+      bool dibutils.dll "DIBSetPixelsUnaligned"))
+
+  (set! dib-protection-list (make-protection-list))
+  (add-gc-daemon! destroy-lost-dibs)
+)
+
+
+
+
+
diff --git a/v7/src/win32/ffimacro.scm b/v7/src/win32/ffimacro.scm
new file mode 100644 (file)
index 0000000..c1d6f3a
--- /dev/null
@@ -0,0 +1,204 @@
+#|
+WINDOWS PROCEDURE TYPE SYSTEM
+
+Each type TYPE has 4 procedures associated with it.  The association is by
+the following naming scheme:
+
+  (TYPE:CHECK x)    a predicate.  Returns #t if its argument is acceptable
+  (TYPE:CONVERT x)  converts an argument into a form suitable for the foreign
+                    function.
+  (TYPE:RETURN-CONVERT x)  converts from the C retrun values to a scheme object
+  (TYPE:REVERT x xcvt) This is for mirriring changes to variables passed by
+                       reference.  X is the original argument, XCVT is the
+                       result of (TYPE:CONVERT X) which has already been passed
+                       to the foreign function.  The idea is that TYPE:REVERT
+                       updates X to reflect the changes in XCVT.
+
+Additionally, there is another derived procedure, (TYPE:CHECK&CONVERT x)
+which checks the argument and then does conversion.
+
+
+DEFINE-WINDOWS-TYPE and DEFINE-SIMILAR-WINDOWS-TYPE macros
+
+(DEFINE-WINDOWS-TYPE <name> <check> <convert> <return> <revert>)
+
+This defines <name> to be a type according to the above scheme.  <name> is a
+symbol.  The other components are either functions, or #f for the default
+operation (which is do nothing).
+
+Thus we could define the type char as follows:
+
+  (define-windows-type char
+     char?          ; <check>
+     char->integer  ;
+     integer->char  ;
+     #f)            ; no reversion
+
+
+(DEFINE-SIMILAR-WINDOWS-TYPE <name> <model>
+        #!optional  <check> <convert> <return> <revert>)
+
+This defines a type as above, but the defaults are taken from the type <model>
+rather than defaulting to null operations.
+
+
+WINDOWS-PROCEDURE macro
+
+(WINDOWS-PROCEDURE (foo (argname type) ...)  module entry-name)
+(WINDOWS-PROCEDURE (foo (argname type) ...)  module entry-name WITH-REVERSIONS)
+(WINDOWS-PROCEDURE (foo (argname type) ...)  module entry-name EXPAND)
+(WINDOWS-PROCEDURE (foo (argname type) ...)  module entry-name <CODE>)
+
+The first form generates a slower but more compact version, based on a generic
+n-place higher order procedure parameterized with the check&convert functions.
+No reversion code is inserted.  If any of the argument types has a reversion
+procedure then the first form should not be used.
+
+The other versions generate faster code by using macro expansion to insert the
+type handling functions.  As the type handling functions generated by DEFINE-WINDOWS-TYPE
+are declared integrable and are often simple or trivial, this removes the cost of a
+general function call to convert each parameter.  EXPAND and WITH-REVERSIONS have the
+same effect, but allow the user to `document' the reason for using the expanded form.
+
+The final form also generates an expanded form, and inserts <CODE> after the type
+checking but before the type conversion.  This allows extra consistency checks to be
+placed, especially checks that several arguments are mutualy consistent (e.g. an index
+into a buffer indexes to inside a string that is being used as the buffer).
+
+|#
+
+
+(let ()
+
+  (define ffi-module-entry-variable  (string->symbol "[ffi entry]"))
+  (define ffi-result-variable (string->symbol "[ffi result]"))
+
+
+  (define (type->checker type)
+    (string->symbol (string-append (symbol-name type) ":check")))
+
+  (define (type->converter type)
+    (string->symbol (string-append (symbol-name type) ":convert")))
+
+  (define (type->check&converter type)
+    (string->symbol (string-append (symbol-name type) ":check&convert")))
+
+  (define (type->return-converter type)
+    (string->symbol (string-append (symbol-name type) ":return-convert")))
+
+  (define (type->reverter type)
+    (string->symbol (string-append (symbol-name type) ":revert")))
+
+
+  (define  (expand/windows-procedure args return-type module entry-name
+                                    . additional-specifications)
+
+    (define (make-converted-name sym)
+      (string->symbol (string-append "[converted " (symbol-name sym) "]")))
+    
+    (define (make-check type arg)
+      `(if (not (,(type->checker type) ,arg))
+          (windows-procedure-argument-type-check-error ',type ,arg)))
+    
+    (define (make-conversion type arg)
+      `(,(type->converter type) ,arg))
+    
+    (define (make-reversion type sym representation)
+      `(,(type->reverter type) ,sym ,representation))
+    
+    (define (make-return-conversion type expr)
+      `(,(type->return-converter type) ,expr))
+
+    (if  additional-specifications
+       ;; expanded version:
+       (let* ((procedure-name (car args))
+              (arg-names    (map car (cdr args)))
+              (arg-types    (map cadr (cdr args)))
+              (cvt-names    (map make-converted-name arg-names))
+              (checks       (map make-check arg-types arg-names))
+              (conversions  (map (lambda (cvt-name arg-type arg-name)
+                                   `(,cvt-name
+                                     ,(make-conversion arg-type arg-name)))
+                                 cvt-names arg-types arg-names))
+              (reversions   (map make-reversion arg-types arg-names cvt-names))
+              (additional-checks (if (and (pair? additional-specifications)
+                                          (symbol? (car additional-specifications)))
+                                     (cdr additional-specifications)
+                                     additional-specifications))
+              )
+
+         `((access parameterize-with-module-entry ())
+            (lambda (,ffi-module-entry-variable)
+              (named-lambda (,procedure-name . ,arg-names)
+                ,@checks
+                ,@additional-checks
+                (let ,conversions
+                    (let ((,ffi-result-variable
+                           (%call-foreign-function
+                            (module-entry/machine-address
+                             ,ffi-module-entry-variable)
+                             . ,cvt-names)))
+                      ,@reversions
+                      ,(make-return-conversion return-type
+                                               ffi-result-variable)))))
+            ,module ,entry-name))
+
+       ;; closure version:
+       (let* ((arg-types     (map cadr (cdr args))))
+         `(make-windows-procedure ,module ,entry-name
+             ,(type->return-converter return-type)
+             ,@(map type->check&converter arg-types)))))
+
+
+  (define (expand/define-windows-type  name
+                                      #!optional check convert return revert)
+    (let ((check    (if (default-object? check)   #f check))
+         (convert  (if (default-object? convert) #f convert))
+         (return   (if (default-object? return)  #f return))
+         (revert   (if (default-object? revert)  #f revert)))
+      (let ((check    (or check   '(lambda (x) x #t)))
+           (convert  (or convert '(lambda (x) x)))
+           (return   (or return  '(lambda (x) x)))
+           (revert   (or revert  '(lambda (x y) x y unspecific))))
+       `(begin 
+          (define-integrable (,(type->checker name) x)          (,check x))
+          (define-integrable (,(type->converter name) x)        (,convert x))
+          (define-integrable (,(type->check&converter name) x)
+            (if (,(type->checker name) x)
+                (,(type->converter name) x)
+                (windows-procedure-argument-type-check-error ',name x)))
+          (define-integrable (,(type->return-converter name) x) (,return x))
+          (define-integrable (,(type->reverter name) x y)       (,revert x y))))))
+
+
+  (define (expand/define-similar-windows-type
+          name model
+          #!optional check convert return revert)
+    (let ((check    (if (default-object? check)   #f check))
+         (convert  (if (default-object? convert) #f convert))
+         (return   (if (default-object? return)  #f return))
+         (revert   (if (default-object? revert)  #f revert)))
+      ;; eta conversion below are deliberate to persuade integration to chain
+      (let ((check    (or check   (type->checker model)))
+           (convert  (or convert (type->converter model)))
+           (return   (or return  (type->return-converter model)))
+           (revert   (or revert  (type->reverter model))))
+       `(begin
+          (define-integrable (,(type->checker name) x)          (,check x))
+          (define-integrable (,(type->converter name) x)        (,convert x))
+          (define-integrable (,(type->check&converter name) x)
+            (if (,(type->checker name) x)
+                (,(type->converter name) x)
+                (windows-procedure-argument-type-check-error ',name x)))
+          (define-integrable (,(type->return-converter name) x) (,return x))
+          (define-integrable (,(type->reverter name) x y)       (,revert x y))))))
+
+  (syntax-table-define system-global-syntax-table 'WINDOWS-PROCEDURE
+    expand/windows-procedure)
+
+  (syntax-table-define system-global-syntax-table 'DEFINE-WINDOWS-TYPE
+    expand/define-windows-type)
+
+  (syntax-table-define system-global-syntax-table 'DEFINE-SIMILAR-WINDOWS-TYPE
+    expand/define-similar-windows-type)
+)
diff --git a/v7/src/win32/graphics.scm b/v7/src/win32/graphics.scm
new file mode 100644 (file)
index 0000000..5676a4d
--- /dev/null
@@ -0,0 +1,917 @@
+#| -*-Scheme-*-
+
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/win32/graphics.scm,v 1.1 1993/09/20 01:13:04 adams Exp $
+
+Copyright (c) 1993 Massachusetts Institute of Technology
+
+This material was developed by the Scheme project at the Massachusetts
+Institute of Technology, Department of Electrical Engineering and
+Computer Science.  Permission to copy this software, to redistribute
+it, and to use it for any purpose is granted, subject to the following
+restrictions and understandings.
+
+1. Any copy made of this software must include this copyright notice
+in full.
+
+2. Users of this software agree to make their best efforts (a) to
+return to the MIT Scheme project any improvements or extensions that
+they make, so that these may be included in future releases; and (b)
+to inform MIT of noteworthy uses of this software.
+
+3. All materials developed as a consequence of the use of this
+software shall duly acknowledge such use, in accordance with the usual
+standards of acknowledging credit in academic research.
+
+4. MIT has made no warrantee or representation that the operation of
+this software will be error-free, and MIT is under no obligation to
+provide any services, by way of maintenance, update, or otherwise.
+
+5. In conjunction with products arising from the use of this material,
+there shall be no use of the name of the Massachusetts Institute of
+Technology nor of any adaptation thereof in any advertising,
+promotional, or sales literature without prior written consent from
+MIT in each case. |#
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;; Scheme Graphics Operations
+;;; package: (win32 scheme-graphics)
+
+(declare (usual-integrations))
+
+(define-structure (win32-device (conc-name win32-device/)
+                                 (constructor %make-win32-device))
+
+  width
+  height
+  bitmap
+  hwnd
+  hdc
+
+  cursor-x
+  cursor-y
+
+  x-left y-bottom x-right y-top ;
+  x-scale y-scale
+    
+  fg-color  bg-color
+  pen-valid?
+  line-width line-style
+
+  invalid?
+  ;; iv-left iv-top iv-right iv-bottom   ; invalidated region
+
+  palette
+)
+
+(define (make-win32-device width height palette)
+  (%make-win32-device
+    width height
+    #f #f #f
+
+    0 0 ; cursor
+    -1.0 -1.0 1.0 1.0
+    (/ (- width 1) 2.0)  ; xscale
+    (/ (- height 1) -2.0) ; yscale
+    #x000000 #xffffff
+    #f
+    0 0
+
+    #f
+    ;;0 0 0 0
+    palette
+))
+
+
+(define-integrable (win32-xform-x window x)
+  (round->exact (* (- x (win32-device/x-left window))
+                   (win32-device/x-scale window))))
+
+(define-integrable (win32-xform-y window y)
+  (round->exact (* (- y (win32-device/y-top window))
+                   (win32-device/y-scale window))))
+
+
+
+(define (make-picture-wndproc window)
+
+  (define ps (make-paintstruct))
+
+  (lambda (hwnd msg wparam lparam)
+
+    (define (default) (default-scheme-wndproc hwnd msg wparam lparam))
+
+    (define (update-palette)
+      (let* ((palette (win32-device/palette window))
+            (hdc     (get-dc hwnd))
+            (oldpal  (select-palette hdc palette #f))
+            (ncolors-changed (realize-palette hdc))
+            (redisplay  (> ncolors-changed 0)))
+       (if redisplay
+           (begin
+             (invalidate-rect hwnd #f #f)
+             (update-window hwnd)
+             ))
+       (release-dc hwnd hdc)
+       (select-palette hdc oldpal #f)
+       redisplay))
+
+    (cond
+     ((= msg WM_CREATE)
+      (let* ((palette    (win32-device/palette window))
+            (hdc        (get-dc hwnd))
+            (bitmap-dc)
+            (bitmap))
+       
+       (if palette
+           (select-palette hdc palette #f))
+       (set! bitmap-dc  (create-compatible-dc hdc))
+       (if palette
+           (select-palette bitmap-dc palette #f))
+       (set! bitmap   
+             (create-compatible-bitmap hdc (win32-device/width window)
+                                       (win32-device/height window)))
+       (if palette
+           (realize-palette hdc))
+       
+       (set-win32-device/bitmap! window bitmap)
+       (set-win32-device/hwnd! window hwnd)
+       (set-win32-device/hdc! window bitmap-dc)
+       (set-bk-color bitmap-dc (win32-device/bg-color window))
+       (set-bk-mode bitmap-dc TRANSPARENT)
+       (set-text-align bitmap-dc (+ TA_BASELINE TA_LEFT TA_NOUPDATECP))
+       (select-object bitmap-dc bitmap)
+       (if palette
+           (realize-palette bitmap-dc))
+       ;;(delete-dc bitmap-dc)
+       (release-dc hwnd hdc)
+       (win32-device/clear window)
+       0))
+     
+     ((= msg WM_DESTROY)
+      (delete-dc (win32-device/hdc window))
+      (delete-object (win32-device/bitmap window))
+      (delete-object (win32-device/palette window))
+      (set-win32-device/hdc! window 0)
+      (set-win32-device/hwnd! window #f)
+      (set-win32-device/palette! window #f)
+      0)
+
+     ((= msg WM_PAINT)
+      ;; flush here so that uncovering parts of a buffered window causes
+      ;; other visible buffered parts to be updated
+      (win32-device/flush window)
+      (let*  ((hdc      (begin-paint hwnd ps))
+             (palette  (win32-device/palette window))
+             )
+       (if palette
+           (begin
+             (select-palette hdc palette #f)
+             (realize-palette hdc)
+             (realize-palette (win32-device/hdc window))
+           ))
+       (bit-blt hdc 0 0 
+                (win32-device/width window) (win32-device/height window)
+                (win32-device/hdc window) 0 0 SRCCOPY)
+       (end-paint hwnd ps))
+      0)
+
+     ((= msg WM_PALETTECHANGED)
+      (if (and (win32-device/palette window) (not (= wparam hwnd)))
+         (let* ((hdc (get-dc hwnd)))
+           (realize-palette hdc)
+           (invalidate-rect hwnd #f #f)
+           (release-dc hwnd hdc)
+           ))
+       0)
+           
+     ((and (= msg WM_PALETTEISCHANGING) (win32-device/palette window))
+      (default))
+           
+     ((and (= msg WM_QUERYNEWPALETTE) (win32-device/palette window))
+      (update-palette))
+
+     ((and (= msg WM_ACTIVATE) (not (= wparam 0)) (win32-device/palette window))
+      (update-palette)
+      0)
+
+     ((and (= msg WM_SETFOCUS) (win32-device/palette window))
+      (update-palette)
+      0)
+
+    ((= msg WM_SIZE)
+      (if (is-iconic? hwnd)
+       0
+        (let*  ((new-w      (loword lparam))
+               (new-h      (hiword lparam))
+               (old-w      (win32-device/width window))
+               (old-h      (win32-device/height window)))
+         (if (and (= new-w old-w) (= new-h old-h))
+           0
+           (let*  ((palette    (win32-device/palette window))
+                   (hdc        (get-dc hwnd))
+                   (bitmap-dc  (create-compatible-dc hdc))
+                   (bitmap     (create-compatible-bitmap hdc new-w new-h))
+                   (old-bm     (win32-device/bitmap window))
+                   (old-bm-dc  (win32-device/hdc window)))
+             (select-object bitmap-dc bitmap)
+             (if palette
+                 (begin
+                   (select-palette bitmap-dc palette #f)
+                   (realize-palette bitmap-dc)))
+              (set-bk-color bitmap-dc (win32-device/bg-color window))
+             (set-bk-mode bitmap-dc TRANSPARENT)
+             (set-text-align bitmap-dc (+ TA_BASELINE TA_LEFT TA_NOUPDATECP))
+              (set-stretch-blt-mode bitmap-dc COLORONCOLOR #|HALFTONE|#)
+             (stretch-blt bitmap-dc 0 0 new-w new-h
+                          old-bm-dc 0 0 old-w old-h
+                          SRCCOPY)
+              (set-win32-device/bitmap! window bitmap)
+             (set-win32-device/hdc!    window bitmap-dc)
+             (set-win32-device/width!  window new-w)
+             (set-win32-device/height! window new-h)
+             (set-win32-device/pen-valid?! window #f)
+             (set-rop2 bitmap-dc (get-rop2 old-bm-dc))
+             (win32-device/rescale window)
+             (delete-dc old-bm-dc)
+             (delete-object old-bm)
+             (release-dc hwnd hdc)
+             (invalidate-rect hwnd #f #f)
+             0)))))
+
+    ((= msg WM_NCLBUTTONDOWN)
+      (win32-device/flush window)
+      (default))
+
+    (else
+      (default)))))
+       
+
+(define (make-standard-palette)
+  (define pal (make-string (+ 4 (* 4 256))))
+  (define i 0)
+  (define (alloc r g b f)
+    (let ((base (fix:+ 4 (fix:* i 4))))
+      (vector-8b-set! pal base       r)
+      (vector-8b-set! pal (+ base 1) g)
+      (vector-8b-set! pal (+ base 2) b)
+      (vector-8b-set! pal (+ base 3) f)
+      (set! i (1+ i))))
+
+  ;; RGB intensities scaled to look good.  Notice that 128 is in the list
+  (define cv #(0 88 128 170 212 255))
+  (alloc 0 0 0 0)              ; Black is matched
+  (alloc 255 255 255 0)                ; White is matched
+  ; Grays are not matched: this ensures order of colors in palette is always the same
+  ; when the graphcis window has the focus
+  (do ((grey 48 (+ grey 8)))
+      ((>= grey 255))
+    (alloc grey grey grey PC_NOCOLLAPSE))
+  (do ((r 0 (1+ r)))
+      ((> r 5))
+    (do ((g 0 (1+ g)))
+       ((> g 5))
+      (do ((b 0 (1+ b)))
+         ((> b 5))
+       (if (not (= r g b))
+           (alloc (vector-ref cv r) (vector-ref cv g) (vector-ref cv b)
+                  PC_NOCOLLAPSE)))))
+  (vector-8b-set! pal 0 #x00)
+  (vector-8b-set! pal 1 #x03)
+  (vector-8b-set! pal 2 (fix:and i 255))
+  (vector-8b-set! pal 3 (fix:lsh i -8))
+  (create-palette pal)
+)
+
+(define (make-grayscale-palette)
+  (define pal (make-string (+ 4 (* 4 256))))
+  (define i 0)
+  (define (alloc r g b f)
+    (let ((base (fix:+ 4 (fix:* i 4))))
+      (vector-8b-set! pal base           r)
+      (vector-8b-set! pal (fix:+ base 1) g)
+      (vector-8b-set! pal (fix:+ base 2) b)
+      (vector-8b-set! pal (fix:+ base 3) f)
+      (set! i (1+ i))))
+
+  (alloc 0 0 0 0)              ; Black is matched
+  ; Grays are not matched: this ensures order of colors in palette is always
+  ; the same when the graphics window has the focus, which is important in
+  ; maintaining consistency between the screen image and backing bitmap.
+  (do ((grey 24 (fix:+ grey 1)))
+      ((> grey 254))
+    (alloc grey grey grey PC_NOCOLLAPSE))
+  (alloc 255 255 255 0)                ; White is matched
+  (vector-8b-set! pal 0 #x00)
+  (vector-8b-set! pal 1 #x03)
+  (vector-8b-set! pal 2 (fix:and i 255))
+  (vector-8b-set! pal 3 (fix:lsh i -8))
+  (create-palette pal)
+)
+
+
+(define (make-grayscale-128-palette)
+  (define pal (make-string (+ 4 (* 4 256))))
+  (define i 0)
+  (define (alloc r g b f)
+    (let ((base (fix:+ 4 (fix:* i 4))))
+      (vector-8b-set! pal base           r)
+      (vector-8b-set! pal (fix:+ base 1) g)
+      (vector-8b-set! pal (fix:+ base 2) b)
+      (vector-8b-set! pal (fix:+ base 3) f)
+      (set! i (1+ i))))
+
+  (alloc 0 0 0 0)              ; Black is matched
+  ; Grays are not matched: this ensures order of colors in palette is always
+  ; the same when the graphcis window has the focus.
+  (do ((grey 2 (fix:+ grey 2)))
+      ((> grey 254))
+    (alloc grey grey grey PC_NOCOLLAPSE))
+  (alloc 255 255 255 0)                ; White is matched
+  (vector-8b-set! pal 0 #x00)
+  (vector-8b-set! pal 1 #x03)
+  (vector-8b-set! pal 2 (fix:and i 255))
+  (vector-8b-set! pal 3 (fix:lsh i -8))
+  (create-palette pal)
+)
+
+
+(define (client-width->window-width w)
+  (+ w (* 2 (get-system-metrics SM_CXFRAME))))
+
+(define (client-height->window-height h)
+  (+ h (- (get-system-metrics SM_CYCAPTION)
+          (get-system-metrics SM_CYBORDER))
+       (* 2 (get-system-metrics SM_CYFRAME))))
+
+(define (win32-graphics/open #!optional width height palette-kind)
+  (let* ((width   (if (default-object? width)  512 width))
+         (height  (if (default-object? height) 512 height))
+        (palette
+           (cond ((default-object? palette-kind)    (make-standard-palette))
+                 ((eq? palette-kind 'grayscale)     (make-grayscale-palette))
+                 ((eq? palette-kind 'grayscale-128) 
+                                                (make-grayscale-128-palette))
+                 ((eq? palette-kind 'standard)      (make-standard-palette))
+                 ((eq? palette-kind 'system)        #f)
+                 (else  #f)))
+         (device  (make-win32-device width height palette))
+        (wndproc (make-picture-wndproc device))
+         (w
+          (create-scheme-window
+            (+)
+            "SCHEME-GRAPHICS"
+            "Scheme Graphics"
+             (+ WS_OVERLAPPED WS_VISIBLE WS_CAPTION WS_THICKFRAME
+                WS_SYSMENU WS_MINIMIZEBOX)
+            CW_USEDEFAULT CW_USEDEFAULT
+             (client-width->window-width width)
+             (client-height->window-height height)
+            0 0 (get-handle 0) 0
+             wndproc)))
+    device))
+
+
+(define (win32-device/select-pen window)
+  (let* ((hdc      (win32-device/hdc window))
+         (new-pen  (create-pen (win32-device/line-style window)
+                              (win32-device/line-width window)
+                              (win32-device/fg-color window)))
+        (old-pen  (select-object hdc new-pen)))
+    (delete-object old-pen)
+    (set-win32-device/pen-valid?! window #t)))
+  
+(define-integrable (win32-device/validate-pen window)
+  (if (not (win32-device/pen-valid? window))
+      (win32-device/select-pen window)))
+
+
+(define (win32-graphics/device-coordinate-limits device)
+  (define window (graphics-device/descriptor device))
+  (values 0
+          (- (win32-device/height window) 1)
+         (- (win32-device/width window) 1)
+         0))
+
+(define (win32-graphics/coordinate-limits device)
+  (define window (graphics-device/descriptor device))
+  (values (win32-device/x-left   window)
+          (win32-device/y-bottom window)
+          (win32-device/x-right  window)
+          (win32-device/y-top    window)))
+
+(define (win32-graphics/set-coordinate-limits device
+                x-left y-bottom x-right y-top)
+  (let ((window (graphics-device/descriptor device)))
+    (win32-graphics/reset-clip-rectangle device)
+    (set-win32-device/x-left!    window  x-left)
+    (set-win32-device/y-bottom!  window  y-bottom)
+    (set-win32-device/x-right!   window  x-right)
+    (set-win32-device/y-top!     window  y-top)
+    (win32-device/rescale window)
+    unspecific))
+
+(define (win32-device/rescale window)
+  (set-win32-device/x-scale!   window
+    (/ (- (win32-device/width window) 1)
+       (- (win32-device/x-right window) (win32-device/x-left window))))
+  (set-win32-device/y-scale!   window
+    (/ (- (win32-device/height window) 1)
+      (- (win32-device/y-bottom window) (win32-device/y-top window)))))
+    
+(define (win32-translate-drawing-mode mode)
+  ;; I am not sure what values should be used here...
+  (cond
+    ((= mode 0 #|drawing-mode:erase|#)         R2_XORPEN)
+    ((= mode 1 #|drawing-mode:non-dominant|#)  R2_COPYPEN)
+    ((= mode 2 #|drawing-mode:compliment|#)    R2_XORPEN)
+    ((= mode 3 #|drawing-mode:dominant|#)      R2_COPYPEN)))
+
+(define (win32-graphics/set-drawing-mode device mode)
+  (let* ((window (graphics-device/descriptor device))
+         (hdc    (win32-device/hdc window))
+         (rop2   (win32-translate-drawing-mode mode)))
+    (set-rop2 hdc rop2)))
+
+(define (win32-graphics/set-line-style device style)
+  (let ((window (graphics-device/descriptor device)))
+    (set-win32-device/line-style! window style)
+    (set-win32-device/pen-valid?! window #f)
+    unspecific))
+
+(define (win32-graphics/set-line-width device width)
+  (let ((window (graphics-device/descriptor device)))
+    (set-win32-device/line-width! window width)
+    (set-win32-device/pen-valid?! window #f)
+    unspecific))
+
+
+
+(define-integrable (win32-device/invalidate! window)
+  (set-win32-device/invalid?!  window #t))
+
+(define (win32-device/flush window)
+  (if (win32-device/invalid? window)
+    (let ((hwnd   (win32-device/hwnd window)))
+      (set-win32-device/invalid?! window #f)
+      (if hwnd
+         (begin
+           (invalidate-rect hwnd #f #f)
+           unspecific)
+         ((access error ()) "Attempt to use deleted Scheme Graphics window" window)))))
+
+(define (win32-graphics/flush device)
+  (win32-device/flush (graphics-device/descriptor device)))
+
+    
+
+(define (win32-device/clear window)
+  (win32-device/validate-pen window)
+  (let* ((hdc (win32-device/hdc window))
+         (w   (win32-device/width window))
+         (h   (win32-device/height window))
+        (penwidth (+ 1 (win32-device/line-width window)))
+        (rgb (win32-device/bg-color window)))
+    (define newbrush (create-solid-brush rgb))
+    (define oldbrush (select-object hdc newbrush))
+    (rectangle hdc (- penwidth) (- penwidth) (+ w penwidth) (+ h penwidth))
+    (select-object hdc oldbrush)
+    (delete-object newbrush)
+    (win32-device/invalidate! window)
+    unspecific))
+
+(define (win32-graphics/clear device)
+  (win32-device/clear (graphics-device/descriptor device))
+  (win32-graphics/flush device))
+
+(define (win32-graphics/draw-line device x1 y1 x2 y2)
+  (let* ((window (graphics-device/descriptor device))
+         (hdc    (win32-device/hdc window))
+         (x1t    (win32-xform-x window x1))
+         (y1t    (win32-xform-y window y1))
+         (x2t    (win32-xform-x window x2))
+         (y2t    (win32-xform-y window y2)))
+    ;(realize-palette hdc)
+    (win32-device/validate-pen window)
+    (move-to-ex hdc x1t y1t #f)
+    (line-to hdc x2t y2t)
+    (line-to hdc (+ 1 x2t) y2t)                ;; draws end point
+    (win32-device/invalidate! window)
+    unspecific))
+
+(define (win32-graphics/draw-point device x y)
+  ;; use line-to to get ROP2 effects
+  (let* ((window (graphics-device/descriptor device))
+         (hdc    (win32-device/hdc window))
+        ;(color  (win32-device/fg-color window))
+         (xt     (win32-xform-x window x))
+         (yt     (win32-xform-y window y)))
+    (win32-device/validate-pen window)
+    (move-to-ex hdc xt yt #f)
+    (line-to hdc (+ 1 xt) yt)
+;    (set-pixel hdc xt yt color)
+    (win32-device/invalidate! window)
+    unspecific))
+
+(define (win32-graphics/draw-text device x y text)
+  (let* ((window (graphics-device/descriptor device))
+         (hdc    (win32-device/hdc window))
+         (xt     (win32-xform-x window x))
+         (yt     (win32-xform-y window y)))
+    (win32-device/validate-pen window)
+    (text-out hdc xt yt text (string-length text))
+    (win32-device/invalidate! window)
+    unspecific))
+  
+
+(define (win32-graphics/move-cursor device x y)
+  (let ((window (graphics-device/descriptor device)))
+    (set-win32-device/cursor-x! window x)
+    (set-win32-device/cursor-y! window y)
+    unspecific))
+
+(define (win32-graphics/drag-cursor device x y)
+  ;; use line-to to get ROP2 effects
+  (let ((window (graphics-device/descriptor device)))
+    (win32-graphics/draw-line device
+      (win32-device/cursor-x window) (win32-device/cursor-y window) x y)
+    (set-win32-device/cursor-x! window x)
+    (set-win32-device/cursor-y! window y)
+    unspecific))
+
+
+(define (win32-graphics/draw-ellipse device left top right bottom)
+  (let* ((window (graphics-device/descriptor device))
+         (hdc    (win32-device/hdc window))
+         (x1t    (win32-xform-x window left))
+         (y1t    (win32-xform-y window top))
+         (x2t    (win32-xform-x window right))
+         (y2t    (win32-xform-y window bottom)))
+    (win32-device/validate-pen window)
+    (arc hdc x1t y1t x2t y2t x1t y1t x1t y1t)
+    (win32-device/invalidate! window)
+    unspecific))
+
+
+(define (make-C-point-vector window vec)
+  (let* ((n  (vector-length vec))
+         (s  (make-string (* 4 n))))
+    (define (loop i)
+      (if (fix:< i n)
+       (begin
+         (int32-offset-set! s (fix:* i 4)
+           (win32-xform-x window (vector-ref vec i)))
+         (int32-offset-set! s (fix:* (+ 1 i) 4)
+           (win32-xform-y window (vector-ref vec (+ 1 i))))
+         (loop (fix:+ i 2)))))
+    (loop 0)
+    s))
+
+
+(define (win32-graphics/fill-polygon device point-vector)
+  (let* ((window        (graphics-device/descriptor device))
+         (hdc          (win32-device/hdc window))
+         (old-width     (win32-device/line-width window))
+        (pt-vec        (make-C-point-vector  window point-vector)))
+
+    (dynamic-wind
+      (lambda ()
+       (win32-graphics/set-line-width device 0))
+      (lambda ()
+       (let* ((newbrush (create-solid-brush (win32-device/fg-color window)))
+              (oldbrush (select-object hdc newbrush)))
+          (polygon hdc pt-vec (fix:lsh (vector-length point-vector) -1))
+         ;(polyline hdc pt-vec (fix:lsh (vector-length point-vector) -1))
+         (select-object hdc oldbrush)
+         (delete-object newbrush)))
+      (lambda ()
+       (win32-graphics/set-line-width device old-width)))
+    (win32-device/invalidate! window)))
+
+
+(define (win32-graphics/copy-area device x-left y-top width height
+              destination-x-left destination-y-top)
+  (let* ((window (graphics-device/descriptor device))
+         (hdc    (win32-device/hdc window))
+         (x1t    (win32-xform-x window x-left))
+         (y1t    (win32-xform-y window y-top))
+        (x2t    (win32-xform-x window (+ x-left width)))
+        (y2t    (win32-xform-y window (+ y-top height)))
+        (widtht (- x2t x1t))
+        (heightt (- y2t y1t))
+         (xdt    (win32-xform-x window destination-x-left))
+         (ydt    (win32-xform-y window destination-y-top))
+        (x0) (y0) (x1) (y1) (w) (h)
+        )
+    (if (< widtht 0)
+      (begin
+       (set! x0 x2t)
+       (set! x1 (+ xdt widtht))
+       (set! w  (- widtht)))
+      (begin
+       (set! x0 x1t)
+       (set! x1 xdt)
+       (set! w widtht)))
+    (if (< heightt 0)
+      (begin
+       (set! y0 y2t)
+       (set! y1 (+ ydt heightt))
+       (set! h  (- heightt)))
+      (begin
+       (set! y0 y1t)
+       (set! y1 ydt)
+       (set! h heightt)))
+
+    (bit-blt hdc x1 y1 w h hdc x0 y0 SRCCOPY)
+         
+    (win32-device/invalidate! window)
+    unspecific))
+
+
+(define (win32-graphics/close device)
+  (send-message (win32-device/hwnd (graphics-device/descriptor device))
+                WM_CLOSE 0 0)
+  unspecific)
+
+(define (win32-graphics/set-clip-rectangle device
+           x-left y-bottom x-right y-top)
+  (define window (graphics-device/descriptor device))
+  (let* ((hdc (win32-device/hdc window))
+         (x1t  (win32-xform-x window x-left))
+         (y1t  (win32-xform-y window y-bottom))
+         (x2t  (win32-xform-x window x-right))
+         (y2t  (win32-xform-y window y-top))
+        (rgn  (create-rect-rgn x1t y2t x2t y1t)))
+    (select-clip-rgn hdc rgn)
+    unspecific))
+
+(define (win32-graphics/reset-clip-rectangle device)
+  (define window (graphics-device/descriptor device))
+  (let* ((hdc (win32-device/hdc window)))
+    (select-clip-rgn hdc 0)
+    unspecific))
+
+;;
+;;  Colors
+;;
+
+(define-integrable (rgb r g b)
+  (+ #x02000000 r (* g 256) (* b 65536)))
+
+(define (->color spec)
+  (cond ((integer? spec)
+        (if (< spec 0x02000000)
+            (+ spec 0x02000000)
+            spec))
+        ((and (vector? spec) (= (vector-length spec) 3))
+         (rgb (vector-ref spec 0) (vector-ref spec 1) (vector-ref spec 2)))
+        ((and (list? spec) (= (length spec) 3))
+         (rgb (list-ref spec 0) (list-ref spec 1) (list-ref spec 2)))
+       ((and (string? spec) (> (string-length spec) 1)
+             (char=? (string-ref spec 0) #\#))
+         ((access error '()) "Cant do #rrggbb colors yet:" spec))
+       ((string? spec)
+         (let  ((pair (list-search-positive
+                         color-table
+                         (lambda (pair) (string-ci=? (car pair) spec)))))
+           (if pair
+               (cdr pair)
+               ((access error ()) "Unknown color name:" spec))))
+       (else
+         ((access error ()) "Illegal color" spec))))
+
+(define color-table)
+
+(define (win32-graphics/define-color device name spec)
+  device
+  (set! color-table (cons (cons name (->color spec)) color-table)))
+
+(define (win32-graphics/find-color device spec)
+  device
+  (->color spec))
+
+(define initial-color-definitions
+  `(("red"          255   0   0)
+    ("green"          0 255   0)
+    ("blue"           0   0 255)
+    ("cyan"           0 255 255)
+    ("magenta"      255   0 255)
+    ("yellow"       255 255   0)
+    ("black"          0   0   0)
+    ("dark gray"     63  63  63)
+    ("dark grey"     63  63  63)
+    ("grey"         127 127 127)
+    ("gray"         127 127 127)
+    ("light gray"   191 191 191)
+    ("light grey"   191 191 191)
+    ("white"        255 255 255)
+    ("purple"      127   0 127)
+    ("dark green"     0 127   0)
+    ("brown"        127  63   0)))
+
+    
+(define (win32-graphics/set-foreground-color device color)
+  (let* ((window (graphics-device/descriptor device))
+         (hdc    (win32-device/hdc window))
+        (rgb    (->color color)))
+    (set-win32-device/fg-color!  window (->color color))
+    (set-win32-device/pen-valid?! window #f)
+    (set-text-color hdc rgb))
+  unspecific)
+
+(define (win32-graphics/set-background-color device color)
+  (define window (graphics-device/descriptor device))
+  (define rgb (->color color))
+  (set-win32-device/bg-color! window rgb)
+  unspecific)
+
+(define (win32-graphics/available?)
+  (implemented-primitive-procedure?
+   (ucode-primitive set-general-scheme-wndproc 1)))
+
+;;----------------------------------------------------------------------------
+
+(define (win32-graphics/move-window device x y)
+  (let* ((window (graphics-device/descriptor device))
+         (hwnd   (win32-device/hwnd window)))
+    (set-window-pos hwnd 0 x y 0 0 (+ SWP_NOZORDER SWP_NOSIZE SWP_NOACTIVATE))))
+      
+(define (win32-graphics/resize-window device w h)
+  (let* ((window (graphics-device/descriptor device))
+         (hwnd   (win32-device/hwnd window)))
+    (set-window-pos hwnd 0 0 0
+      (client-width->window-width w)
+      (client-height->window-height h)
+      (+ SWP_NOZORDER SWP_NOMOVE SWP_NOACTIVATE))))
+      
+(define (win32-graphics/set-font device font)
+  (let* ((window (graphics-device/descriptor device))
+         (hdc    (win32-device/hdc window)))
+    (select-object hdc font)
+    unspecific))
+
+(define (win32-graphics/set-window-name device name)
+  (let* ((window (graphics-device/descriptor device))
+         (hwnd   (win32-device/hwnd window)))
+    (set-window-text hwnd name)
+    unspecific))
+;;------------------------------------------------------------------------------
+;;
+
+(define dib-image-type)
+
+(define (dib-image/destroy image)
+  (let* ((dib    (image/descriptor image)))
+    (delete-dib dib)))
+
+(define (dib-image/create device width height)
+  (let* ((window  (graphics-device/descriptor device))
+        (palette (win32-device/palette window))
+        (dib     (create-dib width height BI_RGB 8 palette)))
+    dib))
+
+(define (dib-image/width image)   (dib-width  (image/descriptor image)))
+(define (dib-image/height image)  (dib-height (image/descriptor image)))
+
+(define (dib-image/draw device x y image)
+  (let*  ((dib    (image/descriptor image))
+         (window (graphics-device/descriptor device))
+         (hdc    (win32-device/hdc window))
+         (w      (dib-width dib))
+         (h      (dib-height dib)))
+    (if (and (= x 0) (= y 0)
+            (= w (win32-device/width window)) (= h (win32-device/height window)))
+       (let ((bm (bitmap-from-dib dib (win32-device/palette window))))
+         ;(display ";Special full window image/draw\n")
+         (set-win32-device/bitmap! window bm)
+         (delete-object (select-object hdc bm)))
+       (dib-blt hdc x y w h dib 0 0 SRCCOPY))
+    (win32-device/invalidate! window)))
+
+(define (dib-image/draw-subimage device x y image im-x im-y w h)
+  (let*  ((dib    (image/descriptor image))
+         (window (graphics-device/descriptor device))
+         (hdc    (win32-device/hdc window)))
+    (dib-blt hdc x y w h dib im-x im-y SRCCOPY)
+    (win32-device/invalidate! window)))
+
+(define (dib-image/fill-from-byte-vector image byte-vector)
+  (dib-set-pixels-unaligned (image/descriptor image) byte-vector))
+
+(define (win32-graphics/create-image device width height)
+  (image/create dib-image-type device width height))
+
+;; Should the following be in the runtime?
+;; (or we can just pass image/draw to make-graphics-device-type
+;(define (win32-graphics/draw-image device x y image)
+;  (image/draw device x y image))
+
+;(define (win32-graphics/draw-subimage device x y image im-x im-y w h)
+;  (image/draw-subimage device x y image im-x im-y w h))
+
+;;------------------------------------------------------------------------------
+;;
+(define (bitmap-namestring filename)
+  (->namestring (merge-pathnames filename (pathname-new-type filename "bmp"))))
+
+(define (win32-graphics/save-bitmap device filename)
+  (let* ((true-filename (bitmap-namestring filename))
+        (window        (graphics-device/descriptor device))
+        (ddb           (win32-device/bitmap window))
+        (palette       (win32-device/palette window))
+        (dib           (dib-from-bitmap ddb BI_RGB 0 palette))
+        (success?      (write-dib true-filename dib)))
+    (if dib
+       (delete-dib dib))
+    (if success?
+       unspecific
+       ((access error ()) "Cannot save bitmap to" true-filename))))
+
+(define (win32-graphics/load-bitmap device filename)
+  (let* ((true-filename (bitmap-namestring filename))
+        (dib           (open-dib true-filename)))
+    (if dib
+       (let* ((width   (dib-width dib))
+              (height  (dib-height dib)))
+         (graphics-operation device 'resize-window width height)
+         (let* ((window  (graphics-device/descriptor device))
+                (hdc     (win32-device/hdc window)))
+           (dib-blt hdc 0 0 width height dib 0 0 SRCCOPY)
+           (win32-device/invalidate! window)
+           (delete-dib dib)
+           unspecific))
+       ((access error ()) "Cannot load bitmap from" true-filename))))
+
+;;----------------------------------------------------------------------------
+;;
+;;
+
+(define (register-graphics-window-class)
+  (let* ((hInstance (get-handle 0))
+         (hIcon     (load-icon hInstance "GRAPHICS_ICON")))
+    (register-class (+) (get-handle 3) 0 0 hInstance
+                    hIcon 32515 NULL_BRUSH 0 "SCHEME-GRAPHICS")))
+
+
+(define (initialize-package!)
+  (set! win32-graphics-device-type
+       (make-graphics-device-type
+        `((available? ,win32-graphics/available?)
+          (open  ,win32-graphics/open)
+          (clear ,win32-graphics/clear)
+          (close ,win32-graphics/close)
+          (coordinate-limits ,win32-graphics/coordinate-limits)
+           (copy-area ,win32-graphics/copy-area)
+          (create-image ,win32-graphics/create-image)
+          (define-color ,win32-graphics/define-color)
+          (device-coordinate-limits ,win32-graphics/device-coordinate-limits)
+          (drag-cursor ,win32-graphics/drag-cursor)
+          (draw-image ,image/draw)
+          (draw-subimage ,image/draw-subimage)
+          (draw-line ,win32-graphics/draw-line)
+          (draw-point ,win32-graphics/draw-point)
+          (draw-text ,win32-graphics/draw-text)
+          (draw-ellipse ,win32-graphics/draw-ellipse)
+          (fill-polygon   ,win32-graphics/fill-polygon)
+          (find-color   ,win32-graphics/find-color)
+          (flush ,win32-graphics/flush)
+          (load-bitmap ,win32-graphics/load-bitmap)
+          (save-bitmap ,win32-graphics/save-bitmap)
+          (move-cursor ,win32-graphics/move-cursor)
+          (move-window ,win32-graphics/move-window)
+          (reset-clip-rectangle ,win32-graphics/reset-clip-rectangle)
+          (resize-window ,win32-graphics/resize-window)
+          (set-clip-rectangle ,win32-graphics/set-clip-rectangle)
+          (set-coordinate-limits ,win32-graphics/set-coordinate-limits)
+          (set-drawing-mode ,win32-graphics/set-drawing-mode)
+          (set-font ,win32-graphics/set-font)
+          (set-line-style ,win32-graphics/set-line-style)
+          (set-line-width ,win32-graphics/set-line-width)
+          (set-foreground-color ,win32-graphics/set-foreground-color)
+          (set-background-color ,win32-graphics/set-background-color)
+          (set-window-name ,win32-graphics/set-window-name)
+          )))
+
+  (set! dib-image-type
+       (make-image-type
+        `((create ,dib-image/create)
+          (destroy ,dib-image/destroy)
+          (width   ,dib-image/width)
+          (height  ,dib-image/height)
+          (draw    ,dib-image/draw)
+          (draw-subimage   ,dib-image/draw-subimage)
+          (fill-from-byte-vector ,dib-image/fill-from-byte-vector))))
+
+  (set! color-table '())
+  (for-each
+    (lambda (pair) (win32-graphics/define-color #f (car pair) (cdr pair)))
+    initial-color-definitions)
+  (register-graphics-window-class)
+  (add-event-receiver! event:after-restore register-graphics-window-class)
+  (register-graphics-device-type 'win32 win32-graphics-device-type)
+  unspecific)
+
+(define win32-graphics-device-type)
+
+;;
+;;  BUGS
+
diff --git a/v7/src/win32/make.scm b/v7/src/win32/make.scm
new file mode 100644 (file)
index 0000000..7bd4e84
--- /dev/null
@@ -0,0 +1,88 @@
+#| -*-Scheme-*-
+
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/win32/make.scm,v 1.1 1993/09/20 01:13:04 adams Exp $
+
+Copyright (c) 1993 Massachusetts Institute of Technology
+
+This material was developed by the Scheme project at the Massachusetts
+Institute of Technology, Department of Electrical Engineering and
+Computer Science.  Permission to copy this software, to redistribute
+it, and to use it for any purpose is granted, subject to the following
+restrictions and understandings.
+
+1. Any copy made of this software must include this copyright notice
+in full.
+
+2. Users of this software agree to make their best efforts (a) to
+return to the MIT Scheme project any improvements or extensions that
+they make, so that these may be included in future releases; and (b)
+to inform MIT of noteworthy uses of this software.
+
+3. All materials developed as a consequence of the use of this
+software shall duly acknowledge such use, in accordance with the usual
+standards of acknowledging credit in academic research.
+
+4. MIT has made no warrantee or representation that the operation of
+this software will be error-free, and MIT is under no obligation to
+provide any services, by way of maintenance, update, or otherwise.
+
+5. In conjunction with products arising from the use of this material,
+there shall be no use of the name of the Massachusetts Institute of
+Technology nor of any adaptation thereof in any advertising,
+promotional, or sales literature without prior written consent from
+MIT in each case. |#
+
+;;;; Win32 subsystem: System Construction
+
+(declare (usual-integrations))
+
+(load "ffimacro")
+
+(package/system-loader "win32" '() 'QUERY)
+;((package/reference (find-package '(WIN32))
+;                  'INITIALIZE-PACKAGE!))
+(add-system! (make-system "Win32" 1 0 '()))
+
+
+(define (package-initialize package-name procedure-name mandatory?)
+  (define (print-name string)
+    (display "\n")
+    (display string)
+    (display " (")
+    (let loop ((name package-name))
+      (if (not (null? name))
+         (begin
+           (if (not (eq? name package-name))
+               (display " "))
+           (display (system-pair-car (car name)))
+           (loop (cdr name)))))
+    (display ")"))
+
+  (define (package-reference name)
+    (package/environment (find-package name)))
+
+  (let ((env (package-reference package-name)))
+    (cond ((not (lexical-unreferenceable? env procedure-name))
+          (print-name "initialize:")
+          (if (not (eq? procedure-name 'INITIALIZE-PACKAGE!))
+              (begin
+                (display " [")
+                (display (system-pair-car procedure-name))
+                (display "]")))
+          ((lexical-reference env procedure-name)))
+         ((not mandatory?)
+          (print-name "* skipping:"))
+         (else
+          ;; Missing mandatory package! Report it and die.
+          (print-name "Package")
+          (display " is missing initialization procedure ")
+          (display (system-pair-car procedure-name))
+          (fatal-error "Could not initialize a required package.")))))
+
+
+(package-initialize '(win32) 'initialize-protection-list-package! #t)
+(package-initialize '(win32) 'initialize-module-package! #t)
+(package-initialize '(win32) 'initialize-package! #t)
+(package-initialize '(win32) 'init-wf_user! #t)
+(package-initialize '(win32 scheme-graphics) 'initialize-package! #t)
+(package-initialize '(win32 dib) 'initialize-package! #t)
diff --git a/v7/src/win32/module.scm b/v7/src/win32/module.scm
new file mode 100644 (file)
index 0000000..5c25a43
--- /dev/null
@@ -0,0 +1,237 @@
+#| -*-Scheme-*-
+
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/win32/module.scm,v 1.1 1993/09/20 01:13:04 adams Exp $
+
+Copyright (c) 1993 Massachusetts Institute of Technology
+
+This material was developed by the Scheme project at the Massachusetts
+Institute of Technology, Department of Electrical Engineering and
+Computer Science.  Permission to copy this software, to redistribute
+it, and to use it for any purpose is granted, subject to the following
+restrictions and understandings.
+
+1. Any copy made of this software must include this copyright notice
+in full.
+
+2. Users of this software agree to make their best efforts (a) to
+return to the MIT Scheme project any improvements or extensions that
+they make, so that these may be included in future releases; and (b)
+to inform MIT of noteworthy uses of this software.
+
+3. All materials developed as a consequence of the use of this
+software shall duly acknowledge such use, in accordance with the usual
+standards of acknowledging credit in academic research.
+
+4. MIT has made no warrantee or representation that the operation of
+this software will be error-free, and MIT is under no obligation to
+provide any services, by way of maintenance, update, or otherwise.
+
+5. In conjunction with products arising from the use of this material,
+there shall be no use of the name of the Massachusetts Institute of
+Technology nor of any adaptation thereof in any advertising,
+promotional, or sales literature without prior written consent from
+MIT in each case. |#
+
+;;;; Scheme interface to win32 modules
+;;; package: (win32)
+
+(declare (usual-integrations))
+
+;;
+;; Scheme level operations for windows modules (.EXEs and .DLLs)
+;; All this gubbins is needed for calling functions in DLLs, especially
+;; the case when a band is loaded and the DLLs have been mapped to a new
+;; place in the address space, or even worse, the DLLs can't be loaded
+;; (e.g. not enough memory or the files can't be found).
+
+
+;; Package: (win32 module)
+
+(define-structure
+  (module
+    (conc-name module/)
+    (constructor %make-module)
+    (print-procedure
+     (unparser/standard-method 'MODULE
+       (lambda (state module)
+        (unparse-object state (module/load-name module))))))
+  load-name
+  handle
+  entries      ;; a protection list of all the functions from this module
+  finalization-info
+)
+
+;; handle      entry/address  description
+;;   integer?    integer?       module loaded, handle valid, address valid
+;;   integer?    #f             module loaded, handle valid, entry absent
+;;   'bogus      #f             could not load module
+;;   'unloaded   #f             should autoload module
+;;
+;; Thus if a module is loaded then all the entries hand been found or marked
+;; absent.
+
+;; The set of modules we know about
+;; --------------------------------
+;; The modules are kept in a protection list.  The associated finalization
+;; is a cell containing the handle if the module is curremtly loaded
+;; (by load-library) and thus requires a call to free-library, otherwise it
+;; contains a non-handle.
+
+(define *modules*)
+
+(define (*modules*/lookup load-name)  ;; -> #f or module
+  (protection-list/find
+    (lambda (module) (string-ci=? load-name (module/load-name module)))
+    *modules*))
+
+(define (make-module load-name handle)
+  (let* ((finfo  (make-cell handle))
+         (module (%make-module
+                  load-name handle (make-entries-list) finfo)))
+    (protection-list/add! *modules* module finfo)
+    module))
+
+;;------------------------------------------------------------------------------
+
+(define (find-module load-name)
+  ;; find a linked in module.  Return module if found or linked, otherwise #f
+  (let  ((module (*modules*/lookup load-name)))
+    (or module
+        (let ((handle  (load-library load-name)))
+         (if (= handle 0)
+             (make-module load-name 'bogus)
+             (make-module load-name handle))))))
+    
+
+(define (unload-module! module #!optional free?)
+  (case (module/handle module)
+    ((unloaded bogus)
+     unspecific)
+    (else
+     (let ((free? (if (default-object? free?) #t free?)))
+       (without-interrupts
+       (lambda ()
+         (if free?
+             (free-library (module/handle module)))
+         (set-module/handle! module 'unloaded)
+         (set-cell-contents! (module/finalization-info module) #f)
+         (protection-list/for-each-info
+          (lambda (entry)
+            (set-module-entry/address! entry #f))
+          (module/entries module))))))))
+
+(define (load-module! module)
+  (case (module/handle module)
+    ((unloaded bogus)
+     (let ((handle (load-library (module/load-name module))))
+       (if (= handle 0)
+          (set-module/handle! module 'bogus)
+          (without-interrupts
+           (lambda ()
+             (set-module/handle! module handle)
+             (set-cell-contents! (module/finalization-info module) handle))))))
+    (else
+     unspecific)))
+
+(define (reload-module! module)
+  (unload-module! module)
+  (load-module! module))
+
+
+(define (mark-modules-as-unloaded!)
+  (protection-list/for-each
+    (lambda (module) (unload-module! module #f))    
+    *modules*))
+
+;;
+;;-------------------------------------
+;;
+
+(define (make-entries-list)
+  (make-protection-list identity-procedure))
+;;
+
+(define-structure
+  (module-entry
+    (conc-name module-entry/)
+    (constructor %make-module-entry))
+  module       
+  name         ;; a string
+  address              ;; the address from GetProcAddress, or #f
+  proc         ;; a weak pair of the foreign function (a scheme procedure)
+)
+
+
+(define ((entry-without-procedure entry) . ?)
+  ?
+  ((access error ()) "Called dll entry without procedure:" entry))
+
+(define-integrable (module-entry/machine-address entry)
+  (or (module-entry/address entry)
+      (module-entry/attempt-linkage entry)))
+
+(define (module-entry/attempt-linkage entry)
+  (let* ((module  (module-entry/module entry))
+        (handle  (module/handle module)))
+    (if (eq? (module/handle module) 'unloaded)
+       (load-module! module))
+    (let ((address (module-entry/address entry)))
+      (if address
+         address
+         (case (module/handle module)
+           ((unloaded bogus)
+            (module-entry/error/bad-module entry))
+           (else
+            (let ((address (get-proc-address (module/handle module)
+                                             (module-entry/name entry))))
+              (if address
+                  (begin
+                    (set-module-entry/address! entry address)
+                    address)
+                  (module-entry/error/bad-entry entry)))))))))
+
+
+(define (module-entry/error/bad-entry entry)
+  ((access error ())
+   "Cant find"
+   entry 'for (module-entry/name entry)
+   'in (module-entry/module entry)))
+    
+(define (module-entry/error/bad-module entry)
+  ((access error ())
+   "Cant load"
+   (module-entry/module entry)
+   'for 'procedure (module-entry/name entry)))
+    
+(define (make-module-entry module name)
+  (let* ((handle       (module/handle module))
+        (address      (if (int:integer? handle)
+                          (get-proc-address handle name)
+                          #f))
+        (entry        (%make-module-entry module name address #f))
+        (weak-pair    (protection-list/add! (module/entries module) (entry-without-procedure entry) entry)))
+    (set-module-entry/proc! entry weak-pair)
+    entry))
+
+(define (parameterize-with-module-entry procedure module name)
+  (let* ((entry  (make-module-entry module name))
+        (proc   (procedure entry)))
+    (weak-set-car! (module-entry/proc entry) proc)
+    proc))
+                
+;;
+;;----------------------------------------------------------------------
+;;
+
+
+(define (initialize-module-package!)
+  (set! *modules*
+    (make-protection-list
+      ;;(lambda (handle)
+      ;;  (and handle
+      ;;     (integer? (cell-contents handle))
+      ;;     (free-library (cell-contents handle))))
+      (lambda (handle-cell) handle-cell)
+      ))
+  (add-event-receiver! event:after-restore mark-modules-as-unloaded!)
+)
diff --git a/v7/src/win32/protect.scm b/v7/src/win32/protect.scm
new file mode 100644 (file)
index 0000000..c3d205b
--- /dev/null
@@ -0,0 +1,165 @@
+#| -*-Scheme-*-
+
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/win32/protect.scm,v 1.1 1993/09/20 01:13:04 adams Exp $
+
+Copyright (c) 1993 Massachusetts Institute of Technology
+
+This material was developed by the Scheme project at the Massachusetts
+Institute of Technology, Department of Electrical Engineering and
+Computer Science.  Permission to copy this software, to redistribute
+it, and to use it for any purpose is granted, subject to the following
+restrictions and understandings.
+
+1. Any copy made of this software must include this copyright notice
+in full.
+
+2. Users of this software agree to make their best efforts (a) to
+return to the MIT Scheme project any improvements or extensions that
+they make, so that these may be included in future releases; and (b)
+to inform MIT of noteworthy uses of this software.
+
+3. All materials developed as a consequence of the use of this
+software shall duly acknowledge such use, in accordance with the usual
+standards of acknowledging credit in academic research.
+
+4. MIT has made no warrantee or representation that the operation of
+this software will be error-free, and MIT is under no obligation to
+provide any services, by way of maintenance, update, or otherwise.
+
+5. In conjunction with products arising from the use of this material,
+there shall be no use of the name of the Massachusetts Institute of
+Technology nor of any adaptation thereof in any advertising,
+promotional, or sales literature without prior written consent from
+MIT in each case. |#
+
+;;;; Protection lists
+;;; package: (win32)
+
+(declare (usual-integrations))
+
+;; A protection list has a header cons cell.
+;; Elements of the list are weak pairs (thing . info)
+;; The car of the header contains the finalization procedure which is called
+;; on the info field when the THING disappears.
+
+(define-structure
+  (protection-list
+    (conc-name protection-list/)
+    (constructor %make-protection-list))              
+  head)
+
+
+(define (make-protection-list finalizer)
+  (let* ((header  (cons finalizer '()))
+         (p       (%make-protection-list header)))
+    (protection-list/add! *protection-lists* p header)
+    p))
+
+
+(define (protection-list/add! p thing info)
+  ;; we return the weak pair allocated so that we can use it to get at thing
+  ;; if this is really needed
+  ;; do we need to wrap this in a without-interrupts?
+  (let* ((weakpr  (weak-cons thing info))
+         (link    (cons weakpr #f))
+         (header  (protection-list/head p)))
+    (let ((tail (cdr header)))
+      (set-cdr! link tail)
+      (set-cdr! header link)
+      weakpr)))
+
+(define (protection-list/finalize! p)
+  ;; During finalization, the list is set to '().  This allows items
+  ;; to be added to the list during finalization.  The call to append!
+  ;; merges the new and old lists
+  (let*  ((header    (if (protection-list? p)
+                         (protection-list/head p)
+                        p))
+          (items     (cdr header))
+          (finalize! (car header)))
+
+    (define (loop/no-head items)
+      (if (pair? items)
+          (if (weak-car (car items))
+             (loop/with-head items items (cdr items))
+             (begin (finalize! (weak-cdr (car items)))
+                    (loop/no-head (cdr items))))
+         '()))
+
+    (define (loop/with-head first-cons mutate-point items)
+      (if (pair? items)
+         (if (weak-car (car items))
+             (begin
+               (set-cdr! mutate-point items)
+               (loop/with-head first-cons items (cdr items)))
+             (begin
+               (finalize! (weak-cdr (car items)))
+               (set-cdr! mutate-point (cdr items))
+               (loop/with-head first-cons mutate-point (cdr items))))
+         first-cons))
+
+    (set-cdr! header '())
+    (set-cdr! header (append! (cdr header) (loop/no-head items)))))
+
+
+(define (protection-list/empty? p)
+  (null? (cdr (protection-list/head p))))
+
+
+(define (protection-list/finalize-protection-list hd)
+  ;; if the list is still protecting something then add it back to the
+  ;; master list
+  (if (pair? (cdr hd))
+    (protection-list/add! *protection-lists* (%make-protection-list hd) hd)))
+
+(define (protection-list/gc-daemon)
+;(display ";; protection-list/gc-daemon\n")
+  (for-each (lambda (wp)
+;              (display ";;Finalizing ") (display (weak-car wp)) (newline)
+              (protection-list/finalize! (weak-cdr wp)))
+            (cdr (protection-list/head *protection-lists*)))
+  (protection-list/finalize! *protection-lists*))            
+
+(define (protection-list/for-each action p)
+  (define (loop items)
+    (if (pair? items)
+      (begin
+       (if (weak-car (car items))
+         (action (weak-car (car items))))
+       (loop (cdr items)))))
+  (loop (cdr (protection-list/head p))))
+
+(define (protection-list/for-each-info action p)
+  (define (loop items)
+    (if (pair? items)
+      (begin
+       (if (weak-car (car items))
+         (action (weak-cdr (car items))))
+       (loop (cdr items)))))
+  (loop (cdr (protection-list/head p))))
+
+(define (protection-list/find pred p)
+  (define (loop items)
+    (if (pair? items)
+      (let* ((item  (car items))
+            (thing (weak-car item)))
+       (if (and (weak-pair/car? item) (pred thing))
+           thing
+           (loop (cdr items))))
+      #f))
+  (loop (cdr (protection-list/head p))))
+         
+
+(define *protection-lists*)
+
+;(define p+ protection-list/add!)
+(define (gc) (gc-flip) (protection-list/gc-daemon))
+
+(define (initialize-protection-list-package!)
+  (set! *protection-lists*
+    (%make-protection-list
+      (cons protection-list/finalize-protection-list '())))
+  (add-gc-daemon! protection-list/gc-daemon)
+)
+
+                          
\ No newline at end of file
diff --git a/v7/src/win32/wf_user.scm b/v7/src/win32/wf_user.scm
new file mode 100644 (file)
index 0000000..d5fcffd
--- /dev/null
@@ -0,0 +1,306 @@
+#| -*-Scheme-*-
+
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/win32/wf_user.scm,v 1.1 1993/09/20 01:13:04 adams Exp $
+
+Copyright (c) 1993 Massachusetts Institute of Technology
+
+This material was developed by the Scheme project at the Massachusetts
+Institute of Technology, Department of Electrical Engineering and
+Computer Science.  Permission to copy this software, to redistribute
+it, and to use it for any purpose is granted, subject to the following
+restrictions and understandings.
+
+1. Any copy made of this software must include this copyright notice
+in full.
+
+2. Users of this software agree to make their best efforts (a) to
+return to the MIT Scheme project any improvements or extensions that
+they make, so that these may be included in future releases; and (b)
+to inform MIT of noteworthy uses of this software.
+
+3. All materials developed as a consequence of the use of this
+software shall duly acknowledge such use, in accordance with the usual
+standards of acknowledging credit in academic research.
+
+4. MIT has made no warrantee or representation that the operation of
+this software will be error-free, and MIT is under no obligation to
+provide any services, by way of maintenance, update, or otherwise.
+
+5. In conjunction with products arising from the use of this material,
+there shall be no use of the name of the Massachusetts Institute of
+Technology nor of any adaptation thereof in any advertising,
+promotional, or sales literature without prior written consent from
+MIT in each case. |#
+
+;;;; win32 foreign functions
+;;; package: (win32)
+
+(declare (usual-integrations))
+
+
+(define  arc)
+(define  begin-paint)
+(define  bit-blt)
+(define  create-brush-indirect)
+(define  create-compatible-bitmap)
+(define  create-compatible-dc)
+(define  create-palette)
+(define  create-pen)
+(define  create-rect-rgn)
+(define  create-solid-brush)
+(define  delete-dc)
+(define  delete-object)
+(define  debug-break)
+(define  ellipse)
+(define  end-paint)
+(define  get-dc)
+(define  get-device-caps)
+(define  get-nearest-color)
+(define  get-nearest-palette-index)
+(define  get-rop2)
+(define  get-stock-object)
+(define  get-window-text-length)
+(define  get-system-metrics)
+(define  invalidate-rect)
+(define  line-to)
+(define  load-cursor)
+(define  load-icon)
+(define  move-to-ex)
+(define  polygon)
+(define  polyline)
+(define  realize-palette)
+(define  release-dc)
+(define  rectangle)
+(define  select-object)
+(define  select-palette)
+(define  select-clip-rgn)
+(define  set-bk-color)
+(define  set-bk-mode)
+(define  set-cursor)
+(define  set-focus)
+(define  set-pixel)
+(define  set-text-align)
+(define  set-text-color)
+(define  set-rop2)
+(define  set-stretch-blt-mode)
+(define  set-window-pos)
+(define  stretch-blt)
+(define  text-out)
+(define  update-colors)
+(define  update-window)
+
+(define (init-wf_user!)
+
+  (set!  arc
+    (windows-procedure
+       (Arc (hdc hdc) (leftrect int) (toprect int) (rightrect int) (bottomrect int)
+            (xstartarc int) (ystartarc int) (xendarc int) (yendarc int))
+      bool gdi32.dll "Arc"))
+
+  (set!  begin-paint
+    (windows-procedure (begin-paint (hwnd hwnd) (ps paintstruct))
+      hdc user32.dll "BeginPaint"))
+
+  (set!  bit-blt
+    (windows-procedure
+       (bit-blt (dest hdc) (xdest int) (ydest int) (width int) (height int)
+                (src hdc) (xsrc int) (ysrc int) (rop dword))
+      bool gdi32.dll "BitBlt"))
+
+  (set!  create-brush-indirect
+    (windows-procedure (create-brush-indirect (logbrush unchecked))
+      hbrush gdi32.dll "CreateBrushIndirect"))
+
+  (set!  create-compatible-bitmap
+    (windows-procedure
+       (create-compatible-bitmap (hdc hdc) (width int) (height int))
+      hbitmap gdi32.dll "CreateCompatibleBitmap"))
+
+  (set!  create-compatible-dc
+    (windows-procedure (create-compatible-dc (hdc hdc))
+      hdc gdi32.dll "CreateCompatibleDC"))
+
+  (set!  create-palette
+    (windows-procedure (create-palette (logpalette unchecked))
+      hpalette gdi32.dll "CreatePalette"))
+
+  (set!  create-pen
+    (windows-procedure (create-pen (style int) (width int) (color colorref))
+      hpen gdi32.dll "CreatePen"))
+
+  (set!  create-rect-rgn
+    (windows-procedure
+       (create-rect-rgn (left int) (top int) (right int) (bottom int))
+      hrgn gdi32.dll "CreateRectRgn"))
+
+  (set!  create-solid-brush
+    (windows-procedure (create-solid-brush (color colorref))
+      hbrush gdi32.dll "CreateSolidBrush"))
+
+  (set!  delete-dc
+    (windows-procedure (delete-dc (hdc hdc)) bool gdi32.dll "DeleteDC"))
+
+  (set!  delete-object
+    (windows-procedure (delete-object (handle handle))
+      bool gdi32.dll "DeleteObject"))
+
+  (set!  debug-break
+    (windows-procedure (debug-break) unchecked kernel32.dll "DebugBreak"))
+
+  (set!  ellipse
+    (windows-procedure
+       (ellipse (hdc hdc) (left int) (top int) (right int) (bottom int))
+      bool gdi32.dll "Ellipse"))
+
+  (set!  end-paint
+    (windows-procedure (end-paint (hwnd hwnd) (ps paintstruct))
+      bool user32.dll "EndPaint"))
+
+  (set!  get-dc
+    (windows-procedure (get-dc (hwnd hwnd)) hdc user32.dll "GetDC"))
+
+  (set!  get-device-caps
+    (windows-procedure (get-device-caps (hdc hdc) (index int))
+      int user32.dll "GetDeviceCaps"))
+
+  (set!  get-nearest-color
+    (windows-procedure (get-nearest-color (hdc hdc) (color colorref))
+      colorref gdi32.dll "GetNearestColor"))
+
+  (set!  get-nearest-palette-index
+    (windows-procedure
+       (get-nearest-palette-index (pal hpalette) (color colorref))
+      uint gdi32.dll "GetNearestPaletteIndex"))
+
+  (set!  get-rop2
+    (windows-procedure (get-rop2 (hdc hdc)) int gdi32.dll "GetROP2"))
+
+  (set!  get-stock-object
+    (windows-procedure (get-stock-object (object int))
+      hgdiobj gdi32.dll "GetStockObject"))
+
+  (set!  get-window-text-length
+    (windows-procedure (get-window-text-length (hdc hdc))
+      int user32.dll "GetWindowTextLengthA"))
+
+  (set!  get-system-metrics
+    (windows-procedure (get-system-metrics (index int))
+      int user32.dll "GetSystemMetrics"))
+
+  (set!  invalidate-rect
+    (windows-procedure (invalidate-rect (hwnd hwnd) (rect rect) (erase? bool))
+      bool user32.dll "InvalidateRect"))
+
+  (set!  line-to
+    (windows-procedure (line-to (hdc hdc) (x int) (y int))
+      bool gdi32.dll "LineTo"))
+
+  (set!  load-cursor
+    (windows-procedure (load-cursor (inst hinstance) (id resource-id))
+      hcursor user32.dll "LoadCursorA"))
+
+  (set!  load-icon
+    (windows-procedure (load-icon (inst hinstance) (id resource-id))
+      hicon user32.dll "LoadIconA"))
+
+  (set!  move-to-ex
+    (windows-procedure (move-to-ex (hdc hdc) (x int) (y int) (point unchecked))
+      bool gdi32.dll "MoveToEx"))
+
+  (set!  polygon
+    (windows-procedure (polygon (hdc hdc) (points unchecked) (count int))
+      bool gdi32.dll "Polygon"))
+
+  (set!  polyline
+    (windows-procedure (polyline (hdc hdc) (points unchecked) (count int))
+      bool gdi32.dll "Polyline"))
+
+  (set!  rectangle
+    (windows-procedure
+       (rectangle (hdc hdc) (left int) (top int) (right int) (bottom int))
+      bool gdi32.dll "Rectangle"))
+
+  (set!  realize-palette
+    (windows-procedure (realize-palette (hdc hdc))
+      uint gdi32.dll "RealizePalette"))
+
+  (set!  release-dc
+    (windows-procedure (release-dc (hwnd hwnd) (hdc hdc))
+      int user32.dll "ReleaseDC"))
+
+  (set!  select-object
+    (windows-procedure (select-object (hdc hdc) (obj hgdiobj))
+      hgdiobj gdi32.dll "SelectObject"))
+
+  (set!  select-palette
+    (windows-procedure
+       (select-palette (hdc hdc) (pal hpalette) (force-background? bool))
+      hpalette gdi32.dll "SelectPalette"))
+
+  (set!  select-clip-rgn
+    (windows-procedure (select-clip-rgn (hdc hdc) (region hrgn))
+      int gdi32.dll "SelectClipRgn"))
+
+  (set!  set-bk-color
+    (windows-procedure (set-bk-color (hdc hdc) (color colorref))
+      colorref gdi32.dll "SetBkColor"))
+
+  (set!  set-bk-mode
+    (windows-procedure (set-bk-mode (hdc hdc) (bkmode int))
+      int gdi32.dll "SetBkMode"))
+
+  (set!  set-cursor
+    (windows-procedure (set-cursor (cur hcursor))
+      hcursor user32.dll "SetCursor"))
+
+  (set!  set-focus
+    (windows-procedure (set-focus (hwnd hwnd)) hwnd user32.dll "SetFocus"))
+
+  (set!  set-pixel
+    (windows-procedure (set-pixel (hdc hdc) (x int) (y int) (color colorref))
+      colorref gdi32.dll "SetPixel"))
+
+  (set!  set-rop2
+    (windows-procedure (set-rop2 (hdc hdc) (draw-mode int))
+      int gdi32.dll "SetROP2"))
+
+  (set!  set-stretch-blt-mode
+    (windows-procedure (set-stretch-blt-mode (hdc hdc) (stretch-mode int))
+      int gdi32.dll "SetStretchBltMode"))
+
+  (set!  set-text-align
+    (windows-procedure (set-text-align (hdc hdc) (mode uint))
+      uint gdi32.dll "SetTextAlign"))
+
+  (set!  set-text-color
+    (windows-procedure (set-text-color (hdc hdc) (color colorref))
+      colorref gdi32.dll "SetTextColor"))
+
+  (set!  set-window-pos
+    (windows-procedure
+       (set-window-pos (hwnd hwnd) (insert-after hwnd)
+                       (x int) (y int) (cx int) (cy int) (flags uint))
+      bool user32.dll "SetWindowPos"))
+
+  (set!  stretch-blt
+    (windows-procedure
+       (stretch-blt
+        (dest hdc) (xdest int) (ydest int) (widthdest int) (heightdest int)
+        (src hdc) (xsrc int) (ysrc int) (widthsrc int) (heightsrc int)
+        (rop dword))
+      bool gdi32.dll "StretchBlt"))
+
+  (set!  text-out
+    (windows-procedure
+       (text-out (hdc hdc) (x int) (y int) (text string) (count int))
+      bool gdi32.dll "TextOutA"))
+
+  (set!  update-colors
+    (windows-procedure (update-colors (hdc hdc))
+      bool gdi32.dll "UpdateColors"))
+
+  (set!  update-window
+    (windows-procedure (update-window (hwnd hwnd))
+      bool user32.dll "UpdateWindow"))
+
+)
diff --git a/v7/src/win32/win32.cbf b/v7/src/win32/win32.cbf
new file mode 100644 (file)
index 0000000..121854e
--- /dev/null
@@ -0,0 +1,35 @@
+#| -*-Scheme-*-
+
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/win32/win32.cbf,v 1.1 1993/09/20 01:13:04 adams Exp $
+
+Copyright (c) 1993 Massachusetts Institute of Technology
+
+This material was developed by the Scheme project at the Massachusetts
+Institute of Technology, Department of Electrical Engineering and
+Computer Science.  Permission to copy this software, to redistribute
+it, and to use it for any purpose is granted, subject to the following
+restrictions and understandings.
+
+1. Any copy made of this software must include this copyright notice
+in full.
+
+2. Users of this software agree to make their best efforts (a) to
+return to the MIT Scheme project any improvements or extensions that
+they make, so that these may be included in future releases; and (b)
+to inform MIT of noteworthy uses of this software.
+
+3. All materials developed as a consequence of the use of this
+software shall duly acknowledge such use, in accordance with the usual
+standards of acknowledging credit in academic research.
+
+4. MIT has made no warrantee or representation that the operation of
+this software will be error-free, and MIT is under no obligation to
+provide any services, by way of maintenance, update, or otherwise.
+
+5. In conjunction with products arising from the use of this material,
+there shall be no use of the name of the Massachusetts Institute of
+Technology nor of any adaptation thereof in any advertising,
+promotional, or sales literature without prior written consent from
+MIT in each case. |#
+
+(compile-directory ".")
\ No newline at end of file
diff --git a/v7/src/win32/win32.pkg b/v7/src/win32/win32.pkg
new file mode 100644 (file)
index 0000000..71d2ebd
--- /dev/null
@@ -0,0 +1,99 @@
+#| -*-Scheme-*-
+
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/win32/win32.pkg,v 1.1 1993/09/20 01:13:04 adams Exp $
+
+Copyright (c) 1993 Massachusetts Institute of Technology
+
+This material was developed by the Scheme project at the Massachusetts
+Institute of Technology, Department of Electrical Engineering and
+Computer Science.  Permission to copy this software, to redistribute
+it, and to use it for any purpose is granted, subject to the following
+restrictions and understandings.
+
+1. Any copy made of this software must include this copyright notice
+in full.
+
+2. Users of this software agree to make their best efforts (a) to
+return to the MIT Scheme project any improvements or extensions that
+they make, so that these may be included in future releases; and (b)
+to inform MIT of noteworthy uses of this software.
+
+3. All materials developed as a consequence of the use of this
+software shall duly acknowledge such use, in accordance with the usual
+standards of acknowledging credit in academic research.
+
+4. MIT has made no warrantee or representation that the operation of
+this software will be error-free, and MIT is under no obligation to
+provide any services, by way of maintenance, update, or otherwise.
+
+5. In conjunction with products arising from the use of this material,
+there shall be no use of the name of the Massachusetts Institute of
+Technology nor of any adaptation thereof in any advertising,
+promotional, or sales literature without prior written consent from
+MIT in each case. |#
+
+;;;; WIN32 Packaging
+\f
+(global-definitions "../runtime/runtim")
+
+;(define-package (win32)
+;  (parent ())
+;  (file-case os-type
+;   ((nt) "winuser" "wingdi" "win_ffi")
+;   (else))
+;  (initialization (initialize-package!)))
+
+(define-package (win32)
+  (parent ())
+  (files "winuser"
+        "wt_user"
+        "wf_user"
+        "wingdi"
+        "win_ffi"
+        "module"
+        "protect"
+        )
+  (export ()
+         %call-foreign-function
+         parameterize-with-module-entry
+         module-entry/machine-address
+         module-entry/attempt-linkage
+          start-message-polling-thread)
+  (initialization (initialize-package!))
+)
+
+
+(define-package (win32 scheme-graphics)
+  (files "graphics")
+  (parent (win32))
+;  (export ()
+;          in32-graphics-device-type)
+  (import (win32 dib)
+         create-dib
+         open-dib
+         write-dib
+         dib-height
+         dib-width
+         dib-blt
+         dib-from-bitmap
+         bitmap-from-dib
+         dib-set-pixels-unaligned
+         delete-dib)
+  (import (runtime graphics)
+         register-graphics-device-type
+         make-image-type
+         image/create
+         image/draw
+         image/draw-subimage
+         image/descriptor)
+  (initialization (initialize-package!))
+)
+
+(define-package (win32 dib)
+  (files "dib")
+  (parent (win32))
+  (import (runtime primitive-io)
+         make-protection-list
+         add-to-protection-list!
+         clean-lost-protected-objects)
+)
diff --git a/v7/src/win32/win32.sf b/v7/src/win32/win32.sf
new file mode 100644 (file)
index 0000000..66175bb
--- /dev/null
@@ -0,0 +1,66 @@
+#| -*-Scheme-*-
+
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/win32/win32.sf,v 1.1 1993/09/20 01:13:04 adams Exp $
+
+Copyright (c) 1993 Massachusetts Institute of Technology
+
+This material was developed by the Scheme project at the Massachusetts
+Institute of Technology, Department of Electrical Engineering and
+Computer Science.  Permission to copy this software, to redistribute
+it, and to use it for any purpose is granted, subject to the following
+restrictions and understandings.
+
+1. Any copy made of this software must include this copyright notice
+in full.
+
+2. Users of this software agree to make their best efforts (a) to
+return to the MIT Scheme project any improvements or extensions that
+they make, so that these may be included in future releases; and (b)
+to inform MIT of noteworthy uses of this software.
+
+3. All materials developed as a consequence of the use of this
+software shall duly acknowledge such use, in accordance with the usual
+standards of acknowledging credit in academic research.
+
+4. MIT has made no warrantee or representation that the operation of
+this software will be error-free, and MIT is under no obligation to
+provide any services, by way of maintenance, update, or otherwise.
+
+5. In conjunction with products arising from the use of this material,
+there shall be no use of the name of the Massachusetts Institute of
+Technology nor of any adaptation thereof in any advertising,
+promotional, or sales literature without prior written consent from
+MIT in each case. |#
+
+
+(fluid-let ((sf/default-syntax-table syntax-table/system-internal))
+  (for-each
+    (lambda (names)
+             (sf/add-file-declarations! (car names)
+                                        `((integrate-external . ,(cdr names)))))
+    '(("module"     "winuser" "wingdi" "wt_user")
+      ("graphics"   "winuser" "wingdi" "wt_user")
+      ("win_ffi"    "winuser" "wingdi" "wt_user")
+      ("wf_user"    "win_ffi" "wt_user")
+      ("dib"        "win_ffi")))
+
+  (sf-conditionally "ffimacro")
+  (if (or (not (file-exists? "ffimacro.com"))
+         (> (file-modification-time "ffimacro.bin")
+            (file-modification-time "ffimacro.com")))
+      (cbf "ffimacro"))
+  (load "ffimacro")
+
+  (sf-conditionally "winuser")
+  (sf-conditionally "wingdi")
+  (sf-conditionally "wt_user")
+  (sf-conditionally "win_ffi")
+  (sf-directory "."))
+
+;; Guarantee that the package modeller is loaded.
+(if (not (name->package '(CROSS-REFERENCE)))
+    (with-working-directory-pathname "../cref" (lambda () (load "make"))))
+
+(cref/generate-constructors "win32")
+(sf "win32.con" "win32.bcon")
+(sf "win32.ldr" "win32.bldr")
\ No newline at end of file
diff --git a/v7/src/win32/win_ffi.scm b/v7/src/win32/win_ffi.scm
new file mode 100644 (file)
index 0000000..0391be2
--- /dev/null
@@ -0,0 +1,517 @@
+#| -*-Scheme-*-
+
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/win32/win_ffi.scm,v 1.1 1993/09/20 01:13:04 adams Exp $
+
+Copyright (c) 1993 Massachusetts Institute of Technology
+
+This material was developed by the Scheme project at the Massachusetts
+Institute of Technology, Department of Electrical Engineering and
+Computer Science.  Permission to copy this software, to redistribute
+it, and to use it for any purpose is granted, subject to the following
+restrictions and understandings.
+
+1. Any copy made of this software must include this copyright notice
+in full.
+
+2. Users of this software agree to make their best efforts (a) to
+return to the MIT Scheme project any improvements or extensions that
+they make, so that these may be included in future releases; and (b)
+to inform MIT of noteworthy uses of this software.
+
+3. All materials developed as a consequence of the use of this
+software shall duly acknowledge such use, in accordance with the usual
+standards of acknowledging credit in academic research.
+
+4. MIT has made no warrantee or representation that the operation of
+this software will be error-free, and MIT is under no obligation to
+provide any services, by way of maintenance, update, or otherwise.
+
+5. In conjunction with products arising from the use of this material,
+there shall be no use of the name of the Massachusetts Institute of
+Technology nor of any adaptation thereof in any advertising,
+promotional, or sales literature without prior written consent from
+MIT in each case. |#
+
+;;;; Foreign function interface
+;;; package: (win32)
+
+(declare (usual-integrations))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;  Windows foreign function interface
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+
+(define get-handle        (make-primitive-procedure 'get-handle))
+(define send-message      (make-primitive-procedure 'nt:send-message))
+(define get-module-handle (make-primitive-procedure 'nt:get-module-handle))
+(define load-library      (make-primitive-procedure 'nt:load-library))
+(define free-library      (make-primitive-procedure 'nt:free-library))
+(define get-proc-address  (make-primitive-procedure 'nt:get-proc-address))
+(define def-window-proc   (make-primitive-procedure 'win:def-window-proc))
+(define register-class    (make-primitive-procedure 'register-class))
+
+(define (win:register-class name style hIcon hCursor background menu-name)
+  (register-class style (get-handle 2) 4 4 (get-handle 0)
+     hIcon hCursor background menu-name name))
+
+
+;(define %call-foreign-function (make-primitive-procedure 'call-ff))
+(define-integrable %call-foreign-function (ucode-primitive call-ff))
+
+;(define int-result (lambda (result) result))
+;(define bool-result (lambda (result) (not (= result 0))))
+;(define void-result (lambda (result) result unspecific))
+;(define nullable-pointer-result (lambda (result) (if (= result 0) #f result)))
+;(define handle-result int-result)
+;(define hwnd-result handle-result)
+
+;(define any-arg (lambda (arg) arg))
+;(define int-arg (lambda (arg) arg))
+;(define bool-arg (lambda (arg) (if arg 1 0)))
+;(define nullable-pointer-arg (lambda (arg) (or arg 0)))
+;(define string-arg
+;  (lambda (arg)
+;    (if (or (eq? arg #f) (string? arg))
+;        arg
+;      ((access error ())
+;          "Type error on foreign function argument: Not string" arg))))
+;(define-integrable handle-arg int-arg)
+;(define-integrable hwnd-arg handle-arg)
+
+;(define-integrable hdc-result handle-result)
+;(define-integrable hdc-arg handle-arg)
+
+
+(define (windows-procedure-argument-type-check-error type arg)
+  ((access error ()) "Bad argument type for foreign procedure: " type 'value: arg))
+
+
+(define-macro (call-case n)
+#|  Generate
+;      (lambda (module-entry)
+;      (let ((arg1-type (list-ref arg-types 0))
+;            (arg2-type (list-ref arg-types 1)))
+;        (lambda (arg1 arg2)
+;          (result-type (%call-foreign-function
+;                         (module-entry/machine-address module-entry)
+;                         (arg1-type arg1)
+;                         (arg2-type arg2)))))))
+|#
+  (define (map-index f i n)
+    (if (<= i n)
+       (cons (f i) (map-index f (1+ i) n))
+       '()))
+  (define (->string thing)
+    (cond  ((string? thing)  thing)
+          ((symbol? thing)  (symbol-name thing))
+          ((number? thing)  (number->string thing))))
+  (define (concat . things)
+    (string->symbol (apply string-append (map ->string things))))
+
+  (let* ((arg-names  (map-index (lambda (i) (concat "arg" i)) 1 n))
+        (type-names (map-index (lambda (i) (concat "arg" i "-type")) 1 n))
+        (indexes    (map-index identity-procedure 1 n))
+        (type-binds (map (lambda (type-name index) 
+                           `(,type-name (list-ref arg-types ,(- index 1))))
+                         type-names indexes))
+        (conversions (map list type-names arg-names)))
+
+    `(lambda (module-entry)
+       (let ,type-binds
+          (lambda ,arg-names
+            (result-type (%call-foreign-function
+                          (module-entry/machine-address module-entry)
+                          . ,conversions)))))))
+
+
+(define (make-windows-procedure lib name result-type . arg-types)
+  (let* ((arg-count (length arg-types))
+        (procedure
+         (case arg-count
+           (0  (call-case 0))
+           (1  (call-case 1))
+           (2  (call-case 2))
+           (3  (call-case 3))
+           (4  (call-case 4))
+           (5  (call-case 5))
+           (6  (call-case 6))
+           (7  (call-case 7))
+           (8  (call-case 8))
+           (9  (call-case 9))
+           (10  (call-case 10))
+           (11  (call-case 11))
+           (12  (call-case 12))
+           (13  (call-case 13))
+           (14  (call-case 14))
+           (15  (call-case 15))
+           (else
+            (lambda args
+              (if (= (length args) arg-count)
+                  (result-type
+                   (apply %call-foreign-function
+                          (module-entry/machine-address module-entry)
+                          (map (lambda (f x) (f x)) arg-types args)))
+                  ((access error ())
+                    "Wrong arg count for foreign function" 
+                   name
+                   (length args)
+                   (list 'requires arg-count))))))))
+    (parameterize-with-module-entry procedure lib name)))
+  
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;  Windows function registry
+;;
+;;  CREATE-SCHEME-WINDOW calls create-window-ex with all but the scheme
+;;  procedure argument.  The window class has to be declared with the C
+;;  wndproc that calls GENERAL-SCHEME-WNDPROC.  This C wndproc is available
+;;  as (GET-HANDLE 3)
+;;
+;;  GENERAL-SCHEME-WNDPROC is invoked as the window procedure of every
+;;  scheme window.  It used the hwnd parameter to find the window-specific
+;;  version of the wndproc.  There is a minor complication: the first time
+;;  that we know what the window handle is happens during the call to
+;;  GENERAL-SCHEME-WNDPROC, so we can only associate the handle with 
+;;  the window procedure at that time
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+
+
+(load-option 'hash-table)
+
+(define make-integer-hash-table
+        (hash-table/constructor  modulo
+                                int:=
+                                cons
+                                true
+                                car
+                                cdr
+                                set-cdr!))
+
+(define (initialize-wndproc-registry)
+  (set! wndproc-registry (make-integer-hash-table)))
+
+
+(define newproc #f)
+
+(define (general-scheme-wndproc hwnd message wparam lparam)
+  (let ((wndproc (hash-table/get wndproc-registry hwnd #f)))
+    (if wndproc
+        (wndproc hwnd message wparam lparam)
+        (let ((theproc newproc))
+         (set! newproc #f)
+         (if (eq? theproc #f)
+             (begin
+               (display "\nNo wndproc for ") (display hwnd) (display "!\n")
+               (set! newproc default-scheme-wndproc)))
+         (hash-table/put! wndproc-registry hwnd theproc)
+         (theproc hwnd message wparam lparam)))))
+
+(define (create-scheme-window ex-style class name style x y w h
+                               parent menu inst param proc)
+  (set! newproc proc)
+  (create-window-ex ex-style class name style x y w h
+                   parent menu inst param))
+
+
+;;
+;; How do we delete wndprocs from the table?  It is not clear what is the very
+;; last windows message received by a window. 
+;; As a temporary measure we check to see if the windows still exist every GC
+
+(define (wndproc-registry-cleaner)
+  (hash-table/for-each wndproc-registry
+    (lambda (hwnd wndproc)
+      wndproc
+      (if (not (is-window? hwnd))
+        (hash-table/remove! wndproc-registry hwnd)))))
+
+;; Use DEFAULT-SCHEME-WNDPROC rather than DEF-WINDOW-PROC so that we can hook in
+;; behaviour for scheme windows
+
+(define default-scheme-wndproc def-window-proc)
+
+;; SUBCLASS-WINDOW! hwnd
+;;    (lambda (prev) (lambda (hwnd msg wp lp) ... (prev hwnd msg wp lp)))
+(define (subclass-window! hwnd subclass-behaviour)
+  (let* ((scheme-wndproc (get-handle 3))
+         (C-proc    (get-window-long hwnd GWL_WNDPROC))
+         (scheme?   (= C-proc scheme-wndproc))
+        (old-proc  (if scheme?
+                       (or (hash-table/get wndproc-registry hwnd #f)
+                           default-scheme-wndproc)
+                       (lambda (hw m w l)
+                         (%call-foreign-function c-proc hw m w l)))))
+    (set-window-long hwnd GWL_WNDPROC scheme-wndproc)
+    (hash-table/put! wndproc-registry hwnd (subclass-behaviour old-proc))
+    unspecific))
+                       
+
+(define wndproc-registry)
+(define message-polling-thread)
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;  Message polling thread.
+;;  Using a thread gives the window procedures a well-defined dynamic context
+;;  rather than using the interrupt handlers dynamic context
+;;
+;;  (START-MESSAGE-POLLING-THREAD) sets thing going.
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+
+(define (make-message-polling-loop)
+  (define msg (make-string 40))
+  (define (message-polling-loop)
+    (if (peek-message msg 0 0 0 1 #|PM_REMOVE|#)
+        (begin
+         (translate-message msg)
+         (without-interrupts (lambda()(dispatch-message msg)))
+         (message-polling-loop))))
+  message-polling-loop)
+
+(define (start-message-polling-thread)
+  (define default-handler-interrupt-mask 8)
+  (define clear-interrupts! (make-primitive-procedure 'clear-interrupts!))
+  (define (ignoring-interrupt-handler interrupt-code interrupt-mask)
+    interrupt-code interrupt-mask
+    (clear-interrupts! default-handler-interrupt-mask))
+  (define message-polling-loop (make-message-polling-loop))
+  (define (thunk)
+    (define (loop)
+;;      (disallow-preempt-current-thread)
+      (message-polling-loop)
+      (yield-current-thread)
+      (loop))
+    (loop))
+
+  ;; install dummy handler and 
+  (without-interrupts
+    (lambda ()
+      (let  ((system-interrupt-vector
+              (vector-ref (get-fixed-objects-vector)
+                          (fixed-objects-vector-slot 'SYSTEM-INTERRUPT-VECTOR))))
+         (vector-set! system-interrupt-vector 3 ignoring-interrupt-handler))))
+
+  (set! message-polling-thread (create-thread #f thunk)))
+;
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;   Windows common types
+;;
+
+(define-windows-type unchecked
+  #f #f #f #f)
+
+(define-windows-type bool
+  boolean?
+  (lambda (it) (if it 1 0))
+  (lambda (it) (if (eq? it 0) #f #t))
+  #f)
+
+(define-windows-type int
+  int:integer?
+  #f
+  #f
+  #f)
+
+(define-similar-windows-type uint int)
+(define-similar-windows-type long int)
+(define-similar-windows-type ulong int)
+(define-similar-windows-type short int)
+(define-similar-windows-type ushort int)
+(define-similar-windows-type dword int)
+(define-similar-windows-type word int)
+(define-similar-windows-type byte int)
+
+(define-similar-windows-type colorref int)
+
+(define-windows-type string
+  string?)
+
+(define-windows-type char*
+  (lambda (thing) (or (eq? thing #f) (string? #f))))
+
+(define-windows-type handle
+  (lambda (x) (or (eq? x #f) (int:integer? x)))
+  #f
+  #f
+  #f)
+
+(define-similar-windows-type hbitmap handle)
+(define-similar-windows-type hbrush handle)
+(define-similar-windows-type hcursor handle)
+(define-similar-windows-type hdc handle)
+(define-similar-windows-type hgdiobj handle)
+(define-similar-windows-type hicon handle)
+(define-similar-windows-type hinstance handle)
+(define-similar-windows-type hmenu handle)
+(define-similar-windows-type hpalette handle)
+(define-similar-windows-type hpen handle)
+(define-similar-windows-type hrgn handle)
+(define-similar-windows-type hwnd handle)
+
+(define-windows-type resource-id  ;; string or int
+  (lambda (x) (or (string? x) (int:integer? x)))
+  #f
+  #f
+  #f)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(define kernel32.dll)
+(define shell32.dll)
+(define user32.dll)
+(define gdi32.dll)
+
+;;(define get-last-error
+;;  (make-windows-procedure kernel32.dll "GetLastError" int-result))
+;;    
+;;(define set-last-error
+;;  (make-windows-procedure kernel32.dll "SetLastError" void-result int-arg))
+    
+(define close-window)
+(define create-rect-rgn)
+(define create-round-rect-rgn)
+(define create-window-ex)
+(define dispatch-message)
+(define get-window-long)       
+(define get-window-text)
+(define is-iconic?)
+(define is-window?)
+(define message-beep)
+(define message-box)
+(define message-box-ex)
+(define peek-message)
+(define pt-in-region)      
+(define set-window-long)
+(define set-window-text)
+(define translate-message)
+(define unregister-class)      
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(define (create-windows-procedures!)
+  (set! kernel32.dll (find-module "kernel32"))
+  (set! shell32.dll  (find-module "shell32"))
+  (set! user32.dll (find-module "user32.dll"))
+  (set! gdi32.dll  (find-module "gdi32.dll"))
+
+  (set! close-window
+    (windows-procedure (close-window (hwnd hwnd))
+      bool user32.dll "CloseWindow"))
+
+  (set! set-window-text
+    (windows-procedure (set-window-text (hwnd hwnd) (text string))
+      bool user32.dll "SetWindowTextA"))
+
+  (set! get-window-text
+    (windows-procedure
+       (get-window-text (hwnd hwnd) (text string) (maxlength int))
+      int user32.dll "GetWindowTextA"))
+
+  (set! message-beep
+    (windows-procedure (message-beep (sound-type int))
+      bool user32.dll "MessageBeep"))
+
+  (set! is-iconic?
+    (windows-procedure (is-iconic? (hwnd hwnd)) bool user32.dll "IsIconic"))
+
+  (set! is-window?
+    (windows-procedure (is-window? (hwnd hwnd)) bool user32.dll "IsWindow"))
+
+  (set! create-round-rect-rgn
+    (windows-procedure
+       (create-round-rect-rgn (left int) (top int) (right int) (bottom int)
+                              (widthellipse int)(heightellipse int))
+      hrgn gdi32.dll "CreateRoundRectRgn"))
+
+  (set! create-rect-rgn
+     (windows-procedure
+        (create-rect-rgn (left int) (top int) (right int) (bottom int))
+       hrgn gdi32.dll "CreateRectRgn"))
+
+  (set! pt-in-region
+    (windows-procedure (pt-in-region (hrgn hrgn) (x int) (y int))
+      bool gdi32.dll "PtInRegion"))
+
+  (set! create-window-ex
+    (windows-procedure
+       (create-window-ex (ex-style dword)
+                         (class-name string)
+                         (window-name string)
+                         (style dword)
+                         (x int)
+                         (y int)
+                         (width int)
+                         (height int)
+                         (parent hwnd)
+                         (menu hmenu)
+                         (instance hinstance)
+                         (param unchecked))
+      hwnd user32.dll "CreateWindowExA"))
+
+  (set! unregister-class
+    (windows-procedure (unregister-class (name string) (instance hinstance))
+      bool user32.dll "UnregisterClassA"))
+      
+  (set! get-window-long
+    (windows-procedure (get-window-long (hwnd hwnd) (index int))
+      long user32.dll "GetWindowLongA"))
+       
+  (set! set-window-long
+    (windows-procedure (set-window-long (hwnd hwnd) (index int) (value long))
+      long user32.dll "SetWindowLongA"))
+       
+  (set! message-box
+    (windows-procedure
+       (message-box (owner hwnd) (text string ) (title string) (style int))
+      int user32.dll "MessageBoxA"))
+
+  (set! message-box-ex
+    (windows-procedure
+       (message-box (owner hwnd) (text string ) (title string)
+                    (style int) (language word))
+      int user32.dll "MessageBoxExA"))
+
+  (set! peek-message
+    (windows-procedure
+       (peek-message (msg unchecked) (hwnd hwnd)
+                     (filter-min int) (filter-max int) (remove-flag int))
+      bool user32.dll "PeekMessageA"))
+
+  (set! translate-message
+    (windows-procedure (translate-message (msg unchecked))
+      bool user32.dll "TranslateMessage"))
+
+  (set! dispatch-message
+    (windows-procedure (dispatch-message (msg unchecked))
+      long user32.dll "DispatchMessageA"))
+  )
+
+
+(define (install-general-scheme-wndproc!)
+  ((make-primitive-procedure 'set-general-scheme-wndproc)
+    general-scheme-wndproc))
+
+    
+(define (initialize-package!)
+  ;; Install GENERAL-SCHEME-WNDPROC
+  ;; (initialize-general-scheme-wndproc!)
+  (purify general-scheme-wndproc)
+  (flush-purification-queue!)
+  (install-general-scheme-wndproc!)
+  (add-event-receiver! event:after-restore install-general-scheme-wndproc!)
+  (create-windows-procedures!)
+
+  (initialize-wndproc-registry)
+  (add-gc-daemon! wndproc-registry-cleaner)
+  ;(start-message-polling-thread)
+)
diff --git a/v7/src/win32/wingdi.scm b/v7/src/win32/wingdi.scm
new file mode 100644 (file)
index 0000000..074417f
--- /dev/null
@@ -0,0 +1,3089 @@
+;;/*++ BUILD Version: 0004    // Increment this if a change has global effects
+;;
+;;Copyright (c) 1985-91, Microsoft Corporation
+;;
+;;Module Name:
+;;
+;;    wingdi.h
+;;
+;;Abstract:
+;;
+;;    Procedure declarations, constant definitions and macros for the GDI
+;;    component.
+;;
+;;--*/
+;;
+;;#ifndef _WINGDI_
+;;#define _WINGDI_
+;;
+;;#ifdef __cplusplus
+;;extern "C" {
+;;#endif
+;;
+;;#ifndef NOGDI
+;;
+;;#ifndef NORASTEROPS
+;;
+;;/* Binary raster ops */
+(define-integrable R2_BLACK            1 ) ;  /*  0       */
+(define-integrable R2_NOTMERGEPEN      2 ) ;  /* DPon     */
+(define-integrable R2_MASKNOTPEN       3 ) ;  /* DPna     */
+(define-integrable R2_NOTCOPYPEN       4 ) ;  /* PN       */
+(define-integrable R2_MASKPENNOT       5 ) ;  /* PDna     */
+(define-integrable R2_NOT              6 ) ;  /* Dn       */
+(define-integrable R2_XORPEN           7 ) ;  /* DPx      */
+(define-integrable R2_NOTMASKPEN       8 ) ;  /* DPan     */
+(define-integrable R2_MASKPEN          9 ) ;  /* DPa      */
+(define-integrable R2_NOTXORPEN        10) ;  /* DPxn     */
+(define-integrable R2_NOP              11) ;  /* D        */
+(define-integrable R2_MERGENOTPEN      12) ;  /* DPno     */
+(define-integrable R2_COPYPEN          13) ;  /* P        */
+(define-integrable R2_MERGEPENNOT      14) ;  /* PDno     */
+(define-integrable R2_MERGEPEN         15) ;  /* DPo      */
+(define-integrable R2_WHITE            16) ;  /*  1       */
+(define-integrable R2_LAST             16)
+
+;;/*  Ternary raster operations */
+(define-integrable SRCCOPY             #x00CC0020)  ;/* dest = source                   */
+(define-integrable SRCPAINT            #x00EE0086)  ;/* dest = source OR dest           */
+(define-integrable SRCAND              #x008800C6)  ;/* dest = source AND dest          */
+(define-integrable SRCINVERT           #x00660046)  ;/* dest = source XOR dest          */
+(define-integrable SRCERASE            #x00440328)  ;/* dest = source AND (NOT dest )   */
+(define-integrable NOTSRCCOPY          #x00330008)  ;/* dest = (NOT source)             */
+(define-integrable NOTSRCERASE         #x001100A6)  ;/* dest = (NOT src) AND (NOT dest) */
+(define-integrable MERGECOPY           #x00C000CA)  ;/* dest = (source AND pattern)     */
+(define-integrable MERGEPAINT          #x00BB0226)  ;/* dest = (NOT source) OR dest     */
+(define-integrable PATCOPY             #x00F00021)  ;/* dest = pattern                  */
+(define-integrable PATPAINT            #x00FB0A09)  ;/* dest = DPSnoo                   */
+(define-integrable PATINVERT           #x005A0049)  ;/* dest = pattern XOR dest         */
+(define-integrable DSTINVERT           #x00550009)  ;/* dest = (NOT dest)               */
+(define-integrable BLACKNESS           #x00000042)  ;/* dest = BLACK                    */
+(define-integrable WHITENESS           #x00FF0062)  ;/* dest = WHITE                    */
+;;#endif /* NORASTEROPS */
+;;
+(define-integrable GDI_ERROR #xFFFFFFFF)
+(define-integrable HGDI_ERROR #xFFFFFFFF)  ;#define HGDI_ERROR ((HANDLE)(0xFFFFFFFFL))
+
+;;/* Region Flags */
+(define-integrable ERROR               0)
+(define-integrable NULLREGION          1)
+(define-integrable SIMPLEREGION        2)
+(define-integrable COMPLEXREGION       3)
+(define-integrable RGN_ERROR ERROR)
+
+;;/* CombineRgn() Styles */
+(define-integrable RGN_AND             1)
+(define-integrable RGN_OR              2)
+(define-integrable RGN_XOR             3)
+(define-integrable RGN_DIFF            4)
+(define-integrable RGN_COPY            5)
+(define-integrable RGN_MIN             RGN_AND)
+(define-integrable RGN_MAX             RGN_COPY)
+
+;;/* StretchBlt() Modes */
+(define-integrable BLACKONWHITE                 1)
+(define-integrable WHITEONBLACK                 2)
+(define-integrable COLORONCOLOR                 3)
+(define-integrable HALFTONE                     4)
+(define-integrable MAXSTRETCHBLTMODE            4)
+
+;;/* PolyFill() Modes */
+(define-integrable ALTERNATE                    1)
+(define-integrable WINDING                      2)
+(define-integrable POLYFILL_LAST                2)
+
+;;/* Text Alignment Options */
+(define-integrable TA_NOUPDATECP                0)
+(define-integrable TA_UPDATECP                  1)
+
+(define-integrable TA_LEFT                      0)
+(define-integrable TA_RIGHT                     2)
+(define-integrable TA_CENTER                    6)
+
+(define-integrable TA_TOP                       0)
+(define-integrable TA_BOTTOM                    8)
+(define-integrable TA_BASELINE                  24)
+(define-integrable TA_MASK       (+ TA_BASELINE TA_CENTER TA_UPDATECP))
+
+(define-integrable VTA_BASELINE TA_BASELINE)
+(define-integrable VTA_LEFT     TA_BOTTOM)
+(define-integrable VTA_RIGHT    TA_TOP)
+(define-integrable VTA_CENTER   TA_CENTER)
+(define-integrable VTA_BOTTOM   TA_RIGHT)
+(define-integrable VTA_TOP      TA_LEFT)
+
+
+(define-integrable ETO_GRAYED                   1)
+(define-integrable ETO_OPAQUE                   2)
+(define-integrable ETO_CLIPPED                  4)
+
+(define-integrable ASPECT_FILTERING             #x0001)
+
+;;/* Bounds Accumulation APIs */
+
+(define-integrable DCB_RESET       #x0001)
+(define-integrable DCB_ACCUMULATE  #x0002)
+(define-integrable DCB_DIRTY       DCB_ACCUMULATE)
+(define-integrable DCB_SET         (+ DCB_RESET DCB_ACCUMULATE))
+(define-integrable DCB_ENABLE      #x0004)
+(define-integrable DCB_DISABLE     #x0008)
+
+;;#ifndef NOMETAFILE
+;;
+;;/* Metafile Functions */
+(define-integrable META_SETBKCOLOR              #x0201)
+(define-integrable META_SETBKMODE               #x0102)
+(define-integrable META_SETMAPMODE              #x0103)
+(define-integrable META_SETROP2                 #x0104)
+(define-integrable META_SETRELABS               #x0105)
+(define-integrable META_SETPOLYFILLMODE         #x0106)
+(define-integrable META_SETSTRETCHBLTMODE       #x0107)
+(define-integrable META_SETTEXTCHAREXTRA        #x0108)
+(define-integrable META_SETTEXTCOLOR            #x0209)
+(define-integrable META_SETTEXTJUSTIFICATION    #x020A)
+(define-integrable META_SETWINDOWORG            #x020B)
+(define-integrable META_SETWINDOWEXT            #x020C)
+(define-integrable META_SETVIEWPORTORG          #x020D)
+(define-integrable META_SETVIEWPORTEXT          #x020E)
+(define-integrable META_OFFSETWINDOWORG         #x020F)
+(define-integrable META_SCALEWINDOWEXT          #x0410)
+(define-integrable META_OFFSETVIEWPORTORG       #x0211)
+(define-integrable META_SCALEVIEWPORTEXT        #x0412)
+(define-integrable META_LINETO                  #x0213)
+(define-integrable META_MOVETO                  #x0214)
+(define-integrable META_EXCLUDECLIPRECT         #x0415)
+(define-integrable META_INTERSECTCLIPRECT       #x0416)
+(define-integrable META_ARC                     #x0817)
+(define-integrable META_ELLIPSE                 #x0418)
+(define-integrable META_FLOODFILL               #x0419)
+(define-integrable META_PIE                     #x081A)
+(define-integrable META_RECTANGLE               #x041B)
+(define-integrable META_ROUNDRECT               #x061C)
+(define-integrable META_PATBLT                  #x061D)
+(define-integrable META_SAVEDC                  #x001E)
+(define-integrable META_SETPIXEL                #x041F)
+(define-integrable META_OFFSETCLIPRGN           #x0220)
+(define-integrable META_TEXTOUT                 #x0521)
+(define-integrable META_BITBLT                  #x0922)
+(define-integrable META_STRETCHBLT              #x0B23)
+(define-integrable META_POLYGON                 #x0324)
+(define-integrable META_POLYLINE                #x0325)
+(define-integrable META_ESCAPE                  #x0626)
+(define-integrable META_RESTOREDC               #x0127)
+(define-integrable META_FILLREGION              #x0228)
+(define-integrable META_FRAMEREGION             #x0429)
+(define-integrable META_INVERTREGION            #x012A)
+(define-integrable META_PAINTREGION             #x012B)
+(define-integrable META_SELECTCLIPREGION        #x012C)
+(define-integrable META_SELECTOBJECT            #x012D)
+(define-integrable META_SETTEXTALIGN            #x012E)
+(define-integrable META_CHORD                   #x0830)
+(define-integrable META_SETMAPPERFLAGS          #x0231)
+(define-integrable META_EXTTEXTOUT              #x0a32)
+(define-integrable META_SETDIBTODEV             #x0d33)
+(define-integrable META_SELECTPALETTE           #x0234)
+(define-integrable META_REALIZEPALETTE          #x0035)
+(define-integrable META_ANIMATEPALETTE          #x0436)
+(define-integrable META_SETPALENTRIES           #x0037)
+(define-integrable META_POLYPOLYGON             #x0538)
+(define-integrable META_RESIZEPALETTE           #x0139)
+(define-integrable META_DIBBITBLT               #x0940)
+(define-integrable META_DIBSTRETCHBLT           #x0b41)
+(define-integrable META_DIBCREATEPATTERNBRUSH   #x0142)
+(define-integrable META_STRETCHDIB              #x0f43)
+(define-integrable META_EXTFLOODFILL            #x0548)
+(define-integrable META_DELETEOBJECT            #x01f0)
+(define-integrable META_CREATEPALETTE           #x00f7)
+(define-integrable META_CREATEPATTERNBRUSH      #x01F9)
+(define-integrable META_CREATEPENINDIRECT       #x02FA)
+(define-integrable META_CREATEFONTINDIRECT      #x02FB)
+(define-integrable META_CREATEBRUSHINDIRECT     #x02FC)
+(define-integrable META_CREATEREGION            #x06FF)
+
+;;#endif /* NOMETAFILE */
+;;
+;;/* GDI Escapes */
+(define-integrable NEWFRAME                     1)
+(define-integrable ABORTDOC                     2)
+(define-integrable NEXTBAND                     3)
+(define-integrable SETCOLORTABLE                4)
+(define-integrable GETCOLORTABLE                5)
+(define-integrable FLUSHOUTPUT                  6)
+(define-integrable DRAFTMODE                    7)
+(define-integrable QUERYESCSUPPORT              8)
+(define-integrable SETABORTPROC                 9)
+(define-integrable STARTDOC                     10)
+(define-integrable ENDDOC                       11)
+(define-integrable GETPHYSPAGESIZE              12)
+(define-integrable GETPRINTINGOFFSET            13)
+(define-integrable GETSCALINGFACTOR             14)
+(define-integrable MFCOMMENT                    15)
+(define-integrable GETPENWIDTH                  16)
+(define-integrable SETCOPYCOUNT                 17)
+(define-integrable SELECTPAPERSOURCE            18)
+(define-integrable DEVICEDATA                   19)
+(define-integrable PASSTHROUGH                  19)
+(define-integrable GETTECHNOLGY                 20)
+(define-integrable GETTECHNOLOGY                20)
+(define-integrable SETLINECAP                   21)
+(define-integrable SETLINEJOIN                  22)
+(define-integrable SETMITERLIMIT                23)
+(define-integrable BANDINFO                     24)
+(define-integrable DRAWPATTERNRECT              25)
+(define-integrable GETVECTORPENSIZE             26)
+(define-integrable GETVECTORBRUSHSIZE           27)
+(define-integrable ENABLEDUPLEX                 28)
+(define-integrable GETSETPAPERBINS              29)
+(define-integrable GETSETPRINTORIENT            30)
+(define-integrable ENUMPAPERBINS                31)
+(define-integrable SETDIBSCALING                32)
+(define-integrable EPSPRINTING                  33)
+(define-integrable ENUMPAPERMETRICS             34)
+(define-integrable GETSETPAPERMETRICS           35)
+(define-integrable POSTSCRIPT_DATA              37)
+(define-integrable POSTSCRIPT_IGNORE            38)
+(define-integrable MOUSETRAILS                  39)
+
+(define-integrable GETEXTENDEDTEXTMETRICS       256)
+(define-integrable GETEXTENTTABLE               257)
+(define-integrable GETPAIRKERNTABLE             258)
+(define-integrable GETTRACKKERNTABLE            259)
+(define-integrable EXTTEXTOUT                   512)
+(define-integrable ENABLERELATIVEWIDTHS         768)
+(define-integrable ENABLEPAIRKERNING            769)
+(define-integrable SETKERNTRACK                 770)
+(define-integrable SETALLJUSTVALUES             771)
+(define-integrable SETCHARSET                   772)
+
+(define-integrable STRETCHBLT                   2048)
+(define-integrable GETSETSCREENPARAMS           3072)
+(define-integrable BEGIN_PATH                   4096)
+(define-integrable CLIP_TO_PATH                 4097)
+(define-integrable END_PATH                     4098)
+(define-integrable EXT_DEVICE_CAPS              4099)
+(define-integrable RESTORE_CTM                  4100)
+(define-integrable SAVE_CTM                     4101)
+(define-integrable SET_ARC_DIRECTION            4102)
+(define-integrable SET_BACKGROUND_COLOR         4103)
+(define-integrable SET_POLY_MODE                4104)
+(define-integrable SET_SCREEN_ANGLE             4105)
+(define-integrable SET_SPREAD                   4106)
+(define-integrable TRANSFORM_CTM                4107)
+(define-integrable SET_CLIP_BOX                 4108)
+(define-integrable SET_BOUNDS                   4109)
+(define-integrable SET_MIRROR_MODE              4110)
+
+;;/* Spooler Error Codes */
+(define-integrable SP_NOTREPORTED               #x4000)
+(define-integrable SP_ERROR                     -1)
+(define-integrable SP_APPABORT                  -2)
+(define-integrable SP_USERABORT                 -3)
+(define-integrable SP_OUTOFDISK                 -4)
+(define-integrable SP_OUTOFMEMORY               -5)
+
+(define-integrable PR_JOBSTATUS                 #x0000)
+
+;;/* Object Definitions for EnumObjects() */
+(define-integrable OBJ_PEN             1)
+(define-integrable OBJ_BRUSH           2)
+(define-integrable OBJ_DC              3)
+(define-integrable OBJ_METADC          4)
+(define-integrable OBJ_PAL             5)
+(define-integrable OBJ_FONT            6)
+(define-integrable OBJ_BITMAP          7)
+(define-integrable OBJ_REGION          8)
+(define-integrable OBJ_METAFILE        9)
+(define-integrable OBJ_MEMDC           10)
+(define-integrable OBJ_EXTPEN          11)
+(define-integrable OBJ_ENHMETADC       12)
+(define-integrable OBJ_ENHMETAFILE     13)
+
+;;/* xform stuff */
+(define-integrable MWT_IDENTITY        1)
+(define-integrable MWT_LEFTMULTIPLY    2)
+(define-integrable MWT_RIGHTMULTIPLY   3)
+
+(define-integrable MWT_MIN             MWT_IDENTITY)
+(define-integrable MWT_MAX             MWT_RIGHTMULTIPLY)
+
+;;#define _XFORM_
+;;typedef struct  tagXFORM
+;;  {
+;;    FLOAT   eM11;
+;;    FLOAT   eM12;
+;;    FLOAT   eM21;
+;;    FLOAT   eM22;
+;;    FLOAT   eDx;
+;;    FLOAT   eDy;
+;;  } XFORM, *PXFORM, FAR *LPXFORM;
+;;
+;;/* Bitmap Header Definition */
+;;typedef struct tagBITMAP
+;;  {
+;;    LONG        bmType;
+;;    LONG        bmWidth;
+;;    LONG        bmHeight;
+;;    LONG        bmWidthBytes;
+;;    WORD        bmPlanes;
+;;    WORD        bmBitsPixel;
+;;    LPVOID      bmBits;
+;;  } BITMAP, *PBITMAP, NEAR *NPBITMAP, FAR *LPBITMAP;
+;;
+;;typedef struct tagRGBTRIPLE {
+;;        BYTE    rgbtBlue;
+;;        BYTE    rgbtGreen;
+;;        BYTE    rgbtRed;
+;;} RGBTRIPLE;
+;;
+;;typedef struct tagRGBQUAD {
+;;        BYTE    rgbBlue;
+;;        BYTE    rgbGreen;
+;;        BYTE    rgbRed;
+;;        BYTE    rgbReserved;
+;;} RGBQUAD;
+;;
+;;/* structures for defining DIBs */
+;;typedef struct tagBITMAPCOREHEADER {
+;;        DWORD   bcSize;                 /* used to get to color table */
+;;        WORD    bcWidth;
+;;        WORD    bcHeight;
+;;        WORD    bcPlanes;
+;;        WORD    bcBitCount;
+;;} BITMAPCOREHEADER, FAR *LPBITMAPCOREHEADER, *PBITMAPCOREHEADER;
+;;
+;;
+;;typedef struct tagBITMAPINFOHEADER{
+;;        DWORD      biSize;
+;;        LONG       biWidth;
+;;        LONG       biHeight;
+;;        WORD       biPlanes;
+;;        WORD       biBitCount;
+;;        DWORD      biCompression;
+;;        DWORD      biSizeImage;
+;;        LONG       biXPelsPerMeter;
+;;        LONG       biYPelsPerMeter;
+;;        DWORD      biClrUsed;
+;;        DWORD      biClrImportant;
+;;} BITMAPINFOHEADER, FAR *LPBITMAPINFOHEADER, *PBITMAPINFOHEADER;
+;;
+;;/* constants for the biCompression field */
+(define-integrable BI_RGB        0)
+(define-integrable BI_RLE8       1)
+(define-integrable BI_RLE4       2)
+(define-integrable BI_BITFIELDS  3)
+
+;;typedef struct tagBITMAPINFO {
+;;    BITMAPINFOHEADER    bmiHeader;
+;;    RGBQUAD             bmiColors[1];
+;;} BITMAPINFO, FAR *LPBITMAPINFO, *PBITMAPINFO;
+;;
+;;typedef struct tagBITMAPCOREINFO {
+;;    BITMAPCOREHEADER    bmciHeader;
+;;    RGBTRIPLE           bmciColors[1];
+;;} BITMAPCOREINFO, FAR *LPBITMAPCOREINFO, *PBITMAPCOREINFO;
+;;
+;;#pragma pack(2)
+;;typedef struct tagBITMAPFILEHEADER {
+;;        WORD    bfType;
+;;        DWORD   bfSize;
+;;        WORD    bfReserved1;
+;;        WORD    bfReserved2;
+;;        DWORD   bfOffBits;
+;;} BITMAPFILEHEADER, FAR *LPBITMAPFILEHEADER, *PBITMAPFILEHEADER;
+;;#pragma pack()
+;;
+;;#define MAKEPOINTS(l)       (*((POINTS FAR *)&(l)))
+;;
+;;#ifndef NOMETAFILE
+;;
+;;/* Clipboard Metafile Picture Structure */
+;;typedef struct tagHANDLETABLE
+;;  {
+;;    HGDIOBJ     objectHandle[1];
+;;  } HANDLETABLE, *PHANDLETABLE, FAR *LPHANDLETABLE;
+;;
+;;typedef struct tagMETARECORD
+;;  {
+;;    DWORD       rdSize;
+;;    WORD        rdFunction;
+;;    WORD        rdParm[1];
+;;  } METARECORD;
+;;typedef struct tagMETARECORD UNALIGNED *PMETARECORD;
+;;typedef struct tagMETARECORD UNALIGNED FAR *LPMETARECORD;
+;;
+;;typedef struct tagMETAFILEPICT
+;;  {
+;;    LONG        mm;
+;;    LONG        xExt;
+;;    LONG        yExt;
+;;    HMETAFILE   hMF;
+;;  } METAFILEPICT, FAR *LPMETAFILEPICT;
+;;
+;;#pragma pack(2)
+;;typedef struct tagMETAHEADER
+;;{
+;;    WORD        mtType;
+;;    WORD        mtHeaderSize;
+;;    WORD        mtVersion;
+;;    DWORD       mtSize;
+;;    WORD        mtNoObjects;
+;;    DWORD       mtMaxRecord;
+;;    WORD        mtNoParameters;
+;;} METAHEADER;
+;;typedef struct tagMETAHEADER UNALIGNED *PMETAHEADER;
+;;typedef struct tagMETAHEADER UNALIGNED FAR *LPMETAHEADER;
+;;
+;;#pragma pack()
+;;
+;;/* Enhanced Metafile structures */
+;;typedef struct tagENHMETARECORD
+;;{
+;;    DWORD   iType;              // Record type MR_XXX
+;;    DWORD   nSize;              // Record size in bytes
+;;    DWORD   dParm[1];           // Parameters
+;;} ENHMETARECORD, *PENHMETARECORD, *LPENHMETARECORD;
+;;
+;;typedef struct tagENHMETAHEADER
+;;{
+;;    DWORD   iType;              // Record type MR_METAFILE
+;;    DWORD   nSize;              // Record size in bytes.  This may be greater
+;;                                // than the sizeof(ENHMETAHEADER).
+;;    RECTL   rclBounds;          // Inclusive-inclusive bounds in device units
+;;    RECTL   rclFrame;           // Inclusive-inclusive Picture Frame of metafile in .01 mm units
+;;    DWORD   dSignature;         // Signature.  Must be ENHMETA_SIGNATURE.
+;;    DWORD   nVersion;           // Version number
+;;    DWORD   nBytes;             // Size of the metafile in bytes
+;;    DWORD   nRecords;           // Number of records in the metafile
+;;    WORD    nHandles;           // Number of handles in the handle table
+;;                                // Handle index zero is reserved.
+;;    WORD    sReserved;          // Reserved.  Must be zero.
+;;    DWORD   nDescription;       // Number of chars in the unicode description string
+;;                                // This is 0 if there is no description string
+;;    DWORD   offDescription;     // Offset to the metafile description record.
+;;                                // This is 0 if there is no description string
+;;    DWORD   nPalEntries;        // Number of entries in the metafile palette.
+;;    SIZEL   szlDevice;          // Size of the reference device in pels
+;;    SIZEL   szlMillimeters;     // Size of the reference device in millimeters
+;;} ENHMETAHEADER, *PENHMETAHEADER, *LPENHMETAHEADER;
+;;
+;;#endif /* NOMETAFILE */
+;;
+;;#ifndef NOTEXTMETRIC
+;;
+;;/* tmPitchAntFamily flags */
+(define-integrable TMPF_FIXED_PITCH    #x01)
+(define-integrable TMPF_VECTOR             #x02)
+(define-integrable TMPF_DEVICE             #x08)
+(define-integrable TMPF_TRUETYPE       #x04)
+
+;;typedef struct tagTEXTMETRICA
+;;{
+;;    LONG        tmHeight;
+;;    LONG        tmAscent;
+;;    LONG        tmDescent;
+;;    LONG        tmInternalLeading;
+;;    LONG        tmExternalLeading;
+;;    LONG        tmAveCharWidth;
+;;    LONG        tmMaxCharWidth;
+;;    LONG        tmWeight;
+;;    LONG        tmOverhang;
+;;    LONG        tmDigitizedAspectX;
+;;    LONG        tmDigitizedAspectY;
+;;    BYTE        tmFirstChar;
+;;    BYTE        tmLastChar;
+;;    BYTE        tmDefaultChar;
+;;    BYTE        tmBreakChar;
+;;    BYTE        tmItalic;
+;;    BYTE        tmUnderlined;
+;;    BYTE        tmStruckOut;
+;;    BYTE        tmPitchAndFamily;
+;;    BYTE        tmCharSet;
+;;} TEXTMETRICA, *PTEXTMETRICA, NEAR *NPTEXTMETRICA, FAR *LPTEXTMETRICA;
+;;typedef struct tagTEXTMETRICW
+;;{
+;;    LONG        tmHeight;
+;;    LONG        tmAscent;
+;;    LONG        tmDescent;
+;;    LONG        tmInternalLeading;
+;;    LONG        tmExternalLeading;
+;;    LONG        tmAveCharWidth;
+;;    LONG        tmMaxCharWidth;
+;;    LONG        tmWeight;
+;;    LONG        tmOverhang;
+;;    LONG        tmDigitizedAspectX;
+;;    LONG        tmDigitizedAspectY;
+;;    WCHAR       tmFirstChar;
+;;    WCHAR       tmLastChar;
+;;    WCHAR       tmDefaultChar;
+;;    WCHAR       tmBreakChar;
+;;    BYTE        tmItalic;
+;;    BYTE        tmUnderlined;
+;;    BYTE        tmStruckOut;
+;;    BYTE        tmPitchAndFamily;
+;;    BYTE        tmCharSet;
+;;} TEXTMETRICW, *PTEXTMETRICW, NEAR *NPTEXTMETRICW, FAR *LPTEXTMETRICW;
+;;#ifdef UNICODE
+;;typedef TEXTMETRICW TEXTMETRIC;
+;;typedef PTEXTMETRICW PTEXTMETRIC;
+;;typedef NPTEXTMETRICW NPTEXTMETRIC;
+;;typedef LPTEXTMETRICW LPTEXTMETRIC;
+;;#else
+;;typedef TEXTMETRICA TEXTMETRIC;
+;;typedef PTEXTMETRICA PTEXTMETRIC;
+;;typedef NPTEXTMETRICA NPTEXTMETRIC;
+;;typedef LPTEXTMETRICA LPTEXTMETRIC;
+;;#endif // UNICODE
+;;
+;;/* ntmFlags field flags */
+(define-integrable NTM_REGULAR     #x00000040)
+(define-integrable NTM_BOLD        #x00000020)
+(define-integrable NTM_ITALIC      #x00000001)
+;;
+;;typedef struct tagNEWTEXTMETRICA
+;;{
+;;    LONG        tmHeight;
+;;    LONG        tmAscent;
+;;    LONG        tmDescent;
+;;    LONG        tmInternalLeading;
+;;    LONG        tmExternalLeading;
+;;    LONG        tmAveCharWidth;
+;;    LONG        tmMaxCharWidth;
+;;    LONG        tmWeight;
+;;    LONG        tmOverhang;
+;;    LONG        tmDigitizedAspectX;
+;;    LONG        tmDigitizedAspectY;
+;;    BYTE        tmFirstChar;
+;;    BYTE        tmLastChar;
+;;    BYTE        tmDefaultChar;
+;;    BYTE        tmBreakChar;
+;;    BYTE        tmItalic;
+;;    BYTE        tmUnderlined;
+;;    BYTE        tmStruckOut;
+;;    BYTE        tmPitchAndFamily;
+;;    BYTE        tmCharSet;
+;;    DWORD   ntmFlags;
+;;    UINT    ntmSizeEM;
+;;    UINT    ntmCellHeight;
+;;    UINT    ntmAvgWidth;
+;;} NEWTEXTMETRICA, *PNEWTEXTMETRICA, NEAR *NPNEWTEXTMETRICA, FAR *LPNEWTEXTMETRICA;
+;;typedef struct tagNEWTEXTMETRICW
+;;{
+;;    LONG        tmHeight;
+;;    LONG        tmAscent;
+;;    LONG        tmDescent;
+;;    LONG        tmInternalLeading;
+;;    LONG        tmExternalLeading;
+;;    LONG        tmAveCharWidth;
+;;    LONG        tmMaxCharWidth;
+;;    LONG        tmWeight;
+;;    LONG        tmOverhang;
+;;    LONG        tmDigitizedAspectX;
+;;    LONG        tmDigitizedAspectY;
+;;    WCHAR       tmFirstChar;
+;;    WCHAR       tmLastChar;
+;;    WCHAR       tmDefaultChar;
+;;    WCHAR       tmBreakChar;
+;;    BYTE        tmItalic;
+;;    BYTE        tmUnderlined;
+;;    BYTE        tmStruckOut;
+;;    BYTE        tmPitchAndFamily;
+;;    BYTE        tmCharSet;
+;;    DWORD   ntmFlags;
+;;    UINT    ntmSizeEM;
+;;    UINT    ntmCellHeight;
+;;    UINT    ntmAvgWidth;
+;;} NEWTEXTMETRICW, *PNEWTEXTMETRICW, NEAR *NPNEWTEXTMETRICW, FAR *LPNEWTEXTMETRICW;
+;;#ifdef UNICODE
+;;typedef NEWTEXTMETRICW NEWTEXTMETRIC;
+;;typedef PNEWTEXTMETRICW PNEWTEXTMETRIC;
+;;typedef NPNEWTEXTMETRICW NPNEWTEXTMETRIC;
+;;typedef LPNEWTEXTMETRICW LPNEWTEXTMETRIC;
+;;#else
+;;typedef NEWTEXTMETRICA NEWTEXTMETRIC;
+;;typedef PNEWTEXTMETRICA PNEWTEXTMETRIC;
+;;typedef NPNEWTEXTMETRICA NPNEWTEXTMETRIC;
+;;typedef LPNEWTEXTMETRICA LPNEWTEXTMETRIC;
+;;#endif // UNICODE
+;;
+;;#endif /* NOTEXTMETRIC */
+;;/* GDI Logical Objects: */
+;;
+;;/* Pel Array */
+;;typedef struct tagPELARRAY
+;;  {
+;;    LONG        paXCount;
+;;    LONG        paYCount;
+;;    LONG        paXExt;
+;;    LONG        paYExt;
+;;    BYTE        paRGBs;
+;;  } PELARRAY, *PPELARRAY, NEAR *NPPELARRAY, FAR *LPPELARRAY;
+;;
+;;/* Logical Brush (or Pattern) */
+;;typedef struct tagLOGBRUSH
+;;  {
+;;    UINT        lbStyle;
+;;    COLORREF    lbColor;
+;;    LONG        lbHatch;
+;;  } LOGBRUSH, *PLOGBRUSH, NEAR *NPLOGBRUSH, FAR *LPLOGBRUSH;
+;;
+;;typedef LOGBRUSH            PATTERN;
+;;typedef PATTERN             *PPATTERN;
+;;typedef PATTERN NEAR        *NPPATTERN;
+;;typedef PATTERN FAR         *LPPATTERN;
+;;
+;;/* Logical Pen */
+;;typedef struct tagLOGPEN
+;;  {
+;;    UINT        lopnStyle;
+;;    POINT       lopnWidth;
+;;    COLORREF    lopnColor;
+;;  } LOGPEN, *PLOGPEN, NEAR *NPLOGPEN, FAR *LPLOGPEN;
+;;
+;;typedef struct tagEXTLOGPEN {
+;;    DWORD       elpPenStyle;
+;;    DWORD       elpWidth;
+;;    UINT        elpBrushStyle;
+;;    COLORREF    elpColor;
+;;    LONG        elpHatch;
+;;    DWORD       elpNumEntries;
+;;    DWORD       elpStyleEntry[1];
+;;} EXTLOGPEN, *PEXTLOGPEN, NEAR *NPEXTLOGPEN, FAR *LPEXTLOGPEN;
+;;
+;;typedef struct tagPALETTEENTRY {
+;;    BYTE        peRed;
+;;    BYTE        peGreen;
+;;    BYTE        peBlue;
+;;    BYTE        peFlags;
+;;} PALETTEENTRY, *PPALETTEENTRY, FAR *LPPALETTEENTRY;
+;;
+;;/* Logical Palette */
+;;typedef struct tagLOGPALETTE {
+;;    WORD        palVersion;
+;;    WORD        palNumEntries;
+;;    PALETTEENTRY        palPalEntry[1];
+;;} LOGPALETTE, *PLOGPALETTE, NEAR *NPLOGPALETTE, FAR *LPLOGPALETTE;
+;;
+;;
+;;/* Logical Font */
+;;#define LF_FACESIZE         32
+;;
+;;typedef struct tagLOGFONTA
+;;{
+;;    LONG      lfHeight;
+;;    LONG      lfWidth;
+;;    LONG      lfEscapement;
+;;    LONG      lfOrientation;
+;;    LONG      lfWeight;
+;;    BYTE      lfItalic;
+;;    BYTE      lfUnderline;
+;;    BYTE      lfStrikeOut;
+;;    BYTE      lfCharSet;
+;;    BYTE      lfOutPrecision;
+;;    BYTE      lfClipPrecision;
+;;    BYTE      lfQuality;
+;;    BYTE      lfPitchAndFamily;
+;;    CHAR      lfFaceName[LF_FACESIZE];
+;;} LOGFONTA, *PLOGFONTA, NEAR *NPLOGFONTA, FAR *LPLOGFONTA;
+;;typedef struct tagLOGFONTW
+;;{
+;;    LONG      lfHeight;
+;;    LONG      lfWidth;
+;;    LONG      lfEscapement;
+;;    LONG      lfOrientation;
+;;    LONG      lfWeight;
+;;    BYTE      lfItalic;
+;;    BYTE      lfUnderline;
+;;    BYTE      lfStrikeOut;
+;;    BYTE      lfCharSet;
+;;    BYTE      lfOutPrecision;
+;;    BYTE      lfClipPrecision;
+;;    BYTE      lfQuality;
+;;    BYTE      lfPitchAndFamily;
+;;    WCHAR     lfFaceName[LF_FACESIZE];
+;;} LOGFONTW, *PLOGFONTW, NEAR *NPLOGFONTW, FAR *LPLOGFONTW;
+;;#ifdef UNICODE
+;;typedef LOGFONTW LOGFONT;
+;;typedef PLOGFONTW PLOGFONT;
+;;typedef NPLOGFONTW NPLOGFONT;
+;;typedef LPLOGFONTW LPLOGFONT;
+;;#else
+;;typedef LOGFONTA LOGFONT;
+;;typedef PLOGFONTA PLOGFONT;
+;;typedef NPLOGFONTA NPLOGFONT;
+;;typedef LPLOGFONTA LPLOGFONT;
+;;#endif // UNICODE
+;;
+(define-integrable LF_FULLFACESIZE     64)
+;;
+;;/* Structure passed to FONTENUMPROC */
+;;typedef struct tagENUMLOGFONTA
+;;{
+;;    LOGFONTA elfLogFont;
+;;    BYTE     elfFullName[LF_FULLFACESIZE];
+;;    BYTE     elfStyle[LF_FACESIZE];
+;;} ENUMLOGFONTA, FAR* LPENUMLOGFONTA;
+;;/* Structure passed to FONTENUMPROC */
+;;typedef struct tagENUMLOGFONTW
+;;{
+;;    LOGFONTW elfLogFont;
+;;    WCHAR    elfFullName[LF_FULLFACESIZE];
+;;    WCHAR    elfStyle[LF_FACESIZE];
+;;} ENUMLOGFONTW, FAR* LPENUMLOGFONTW;
+;;#ifdef UNICODE
+;;typedef ENUMLOGFONTW ENUMLOGFONT;
+;;typedef LPENUMLOGFONTW LPENUMLOGFONT;
+;;#else
+;;typedef ENUMLOGFONTA ENUMLOGFONT;
+;;typedef LPENUMLOGFONTA LPENUMLOGFONT;
+;;#endif // UNICODE
+;;
+(define-integrable OUT_DEFAULT_PRECIS      0)
+(define-integrable OUT_STRING_PRECIS       1)
+(define-integrable OUT_CHARACTER_PRECIS    2)
+(define-integrable OUT_STROKE_PRECIS       3)
+(define-integrable OUT_TT_PRECIS           4)
+(define-integrable OUT_DEVICE_PRECIS       5)
+(define-integrable OUT_RASTER_PRECIS       6)
+(define-integrable OUT_TT_ONLY_PRECIS      7)
+(define-integrable OUT_OUTLINE_PRECIS      8)
+
+(define-integrable CLIP_DEFAULT_PRECIS     0)
+(define-integrable CLIP_CHARACTER_PRECIS   1)
+(define-integrable CLIP_STROKE_PRECIS      2)
+(define-integrable CLIP_MASK               #xf)
+(define-integrable CLIP_LH_ANGLES          (* 1 16))
+(define-integrable CLIP_TT_ALWAYS          (* 2 16))
+(define-integrable CLIP_EMBEDDED           (* 8 16))
+
+(define-integrable DEFAULT_QUALITY         0)
+(define-integrable DRAFT_QUALITY           1)
+(define-integrable PROOF_QUALITY           2)
+
+(define-integrable DEFAULT_PITCH           0)
+(define-integrable FIXED_PITCH             1)
+(define-integrable VARIABLE_PITCH          2)
+
+(define-integrable ANSI_CHARSET            0)
+(define-integrable SYMBOL_CHARSET          2)
+(define-integrable SHIFTJIS_CHARSET        128)
+(define-integrable HANGEUL_CHARSET         129)
+(define-integrable CHINESEBIG5_CHARSET     136)
+(define-integrable OEM_CHARSET             255)
+
+;;/* Font Families */
+(define-integrable FF_DONTCARE         (fix:lsh 0 4))  ;/* Don't care or don't know. */
+(define-integrable FF_ROMAN            (fix:lsh 1 4))  ;/* Variable stroke width, serifed. */
+                                            ;/* Times Roman, Century Schoolbook, etc. */
+(define-integrable FF_SWISS            (fix:lsh 2 4))  ;/* Variable stroke width, sans-serifed. */
+                                           ;/* Helvetica, Swiss, etc. */
+(define-integrable FF_MODERN           (fix:lsh 3 4))  ;/* Constant stroke width, serifed or sans-serifed. */
+                                           ;/* Pica, Elite, Courier, etc. */
+(define-integrable FF_SCRIPT           (fix:lsh 4 4))  ;/* Cursive, etc. */
+(define-integrable FF_DECORATIVE       (fix:lsh 5 4))  ;/* Old English, etc. */
+
+;;/* Font Weights */
+(define-integrable FW_DONTCARE         0)
+(define-integrable FW_THIN             100)
+(define-integrable FW_EXTRALIGHT       200)
+(define-integrable FW_LIGHT            300)
+(define-integrable FW_NORMAL           400)
+(define-integrable FW_MEDIUM           500)
+(define-integrable FW_SEMIBOLD         600)
+(define-integrable FW_BOLD             700)
+(define-integrable FW_EXTRABOLD        800)
+(define-integrable FW_HEAVY            900)
+
+(define-integrable FW_ULTRALIGHT       FW_EXTRALIGHT)
+(define-integrable FW_REGULAR          FW_NORMAL)
+(define-integrable FW_DEMIBOLD         FW_SEMIBOLD)
+(define-integrable FW_ULTRABOLD        FW_EXTRABOLD)
+(define-integrable FW_BLACK            FW_HEAVY)
+
+(define-integrable PANOSE_COUNT               10)
+(define-integrable PAN_FAMILYTYPE_INDEX        0)
+(define-integrable PAN_SERIFSTYLE_INDEX        1)
+(define-integrable PAN_WEIGHT_INDEX            2)
+(define-integrable PAN_PROPORTION_INDEX        3)
+(define-integrable PAN_CONTRAST_INDEX          4)
+(define-integrable PAN_STROKEVARIATION_INDEX   5)
+(define-integrable PAN_ARMSTYLE_INDEX          6)
+(define-integrable PAN_LETTERFORM_INDEX        7)
+(define-integrable PAN_MIDLINE_INDEX           8)
+(define-integrable PAN_XHEIGHT_INDEX           9)
+
+(define-integrable PAN_CULTURE_LATIN           0)
+
+;;typedef struct tagPANOSE
+;;{
+;;    BYTE    bFamilyType;
+;;    BYTE    bSerifStyle;
+;;    BYTE    bWeight;
+;;    BYTE    bProportion;
+;;    BYTE    bContrast;
+;;    BYTE    bStrokeVariation;
+;;    BYTE    bArmStyle;
+;;    BYTE    bLetterform;
+;;    BYTE    bMidline;
+;;    BYTE    bXHeight;
+;;} PANOSE, * LPPANOSE;
+
+(define-integrable PAN_ANY                         0);/* Any                            */
+(define-integrable PAN_NO_FIT                      1);/* No Fit                         */
+
+(define-integrable PAN_FAMILY_TEXT_DISPLAY         2);/* Text and Display               */
+(define-integrable PAN_FAMILY_SCRIPT               3);/* Script                         */
+(define-integrable PAN_FAMILY_DECORATIVE           4);/* Decorative                     */
+(define-integrable PAN_FAMILY_PICTORIAL            5);/* Pictorial                      */
+
+(define-integrable PAN_SERIF_COVE                  2);/* Cove                           */
+(define-integrable PAN_SERIF_OBTUSE_COVE           3);/* Obtuse Cove                    */
+(define-integrable PAN_SERIF_SQUARE_COVE           4);/* Square Cove                    */
+(define-integrable PAN_SERIF_OBTUSE_SQUARE_COVE    5);/* Obtuse Square Cove             */
+(define-integrable PAN_SERIF_SQUARE                6);/* Square                         */
+(define-integrable PAN_SERIF_THIN                  7);/* Thin                           */
+(define-integrable PAN_SERIF_BONE                  8);/* Bone                           */
+(define-integrable PAN_SERIF_EXAGGERATED           9);/* Exaggerated                    */
+(define-integrable PAN_SERIF_TRIANGLE             10);/* Triangle                       */
+(define-integrable PAN_SERIF_NORMAL_SANS          11);/* Normal Sans                    */
+(define-integrable PAN_SERIF_OBTUSE_SANS          12);/* Obtuse Sans                    */
+(define-integrable PAN_SERIF_PERP_SANS            13);/* Prep Sans                      */
+(define-integrable PAN_SERIF_FLARED               14);/* Flared                         */
+(define-integrable PAN_SERIF_ROUNDED              15);/* Rounded                        */
+
+(define-integrable PAN_WEIGHT_VERY_LIGHT           2);/* Very Light                     */
+(define-integrable PAN_WEIGHT_LIGHT                3);/* Light                          */
+(define-integrable PAN_WEIGHT_THIN                 4);/* Thin                           */
+(define-integrable PAN_WEIGHT_BOOK                 5);/* Book                           */
+(define-integrable PAN_WEIGHT_MEDIUM               6);/* Medium                         */
+(define-integrable PAN_WEIGHT_DEMI                 7);/* Demi                           */
+(define-integrable PAN_WEIGHT_BOLD                 8);/* Bold                           */
+(define-integrable PAN_WEIGHT_HEAVY                9);/* Heavy                          */
+(define-integrable PAN_WEIGHT_BLACK               10);/* Black                          */
+(define-integrable PAN_WEIGHT_NORD                11);/* Nord                           */
+
+(define-integrable PAN_PROP_OLD_STYLE              2);/* Old Style                      */
+(define-integrable PAN_PROP_MODERN                 3);/* Modern                         */
+(define-integrable PAN_PROP_EVEN_WIDTH             4);/* Even Width                     */
+(define-integrable PAN_PROP_EXPANDED               5);/* Expanded                       */
+(define-integrable PAN_PROP_CONDENSED              6);/* Condensed                      */
+(define-integrable PAN_PROP_VERY_EXPANDED          7);/* Very Expanded                  */
+(define-integrable PAN_PROP_VERY_CONDENSED         8);/* Very Condensed                 */
+(define-integrable PAN_PROP_MONOSPACED             9);/* Monospaced                     */
+
+(define-integrable PAN_CONTRAST_NONE               2);/* None                           */
+(define-integrable PAN_CONTRAST_VERY_LOW           3);/* Very Low                       */
+(define-integrable PAN_CONTRAST_LOW                4);/* Low                            */
+(define-integrable PAN_CONTRAST_MEDIUM_LOW         5);/* Medium Low                     */
+(define-integrable PAN_CONTRAST_MEDIUM             6);/* Medium                         */
+(define-integrable PAN_CONTRAST_MEDIUM_HIGH        7);/* Mediim High                    */
+(define-integrable PAN_CONTRAST_HIGH               8);/* High                           */
+(define-integrable PAN_CONTRAST_VERY_HIGH          9);/* Very High                      */
+
+(define-integrable PAN_STROKE_GRADUAL_DIAG         2);/* Gradual/Diagonal               */
+(define-integrable PAN_STROKE_GRADUAL_TRAN         3);/* Gradual/Transitional           */
+(define-integrable PAN_STROKE_GRADUAL_VERT         4);/* Gradual/Vertical               */
+(define-integrable PAN_STROKE_GRADUAL_HORZ         5);/* Gradual/Horizontal             */
+(define-integrable PAN_STROKE_RAPID_VERT           6);/* Rapid/Vertical                 */
+(define-integrable PAN_STROKE_RAPID_HORZ           7);/* Rapid/Horizontal               */
+(define-integrable PAN_STROKE_INSTANT_VERT         8);/* Instant/Vertical               */
+
+(define-integrable PAN_STRAIGHT_ARMS_HORZ          2);/* Straight Arms/Horizontal       */
+(define-integrable PAN_STRAIGHT_ARMS_WEDGE         3);/* Straight Arms/Wedge            */
+(define-integrable PAN_STRAIGHT_ARMS_VERT          4);/* Straight Arms/Vertical         */
+(define-integrable PAN_STRAIGHT_ARMS_SINGLE_SERIF  5);/* Straight Arms/Single-Serif     */
+(define-integrable PAN_STRAIGHT_ARMS_DOUBLE_SERIF  6);/* Straight Arms/Double-Serif     */
+(define-integrable PAN_BENT_ARMS_HORZ              7);/* Non-Straight Arms/Horizontal   */
+(define-integrable PAN_BENT_ARMS_WEDGE             8);/* Non-Straight Arms/Wedge        */
+(define-integrable PAN_BENT_ARMS_VERT              9);/* Non-Straight Arms/Vertical     */
+(define-integrable PAN_BENT_ARMS_SINGLE_SERIF     10);/* Non-Straight Arms/Single-Serif */
+(define-integrable PAN_BENT_ARMS_DOUBLE_SERIF     11);/* Non-Straight Arms/Double-Serif */
+
+(define-integrable PAN_LETT_NORMAL_CONTACT         2);/* Normal/Contact                 */
+(define-integrable PAN_LETT_NORMAL_WEIGHTED        3);/* Normal/Weighted                */
+(define-integrable PAN_LETT_NORMAL_BOXED           4);/* Normal/Boxed                   */
+(define-integrable PAN_LETT_NORMAL_FLATTENED       5);/* Normal/Flattened               */
+(define-integrable PAN_LETT_NORMAL_ROUNDED         6);/* Normal/Rounded                 */
+(define-integrable PAN_LETT_NORMAL_OFF_CENTER      7);/* Normal/Off Center              */
+(define-integrable PAN_LETT_NORMAL_SQUARE          8);/* Normal/Square                  */
+(define-integrable PAN_LETT_OBLIQUE_CONTACT        9);/* Oblique/Contact                */
+(define-integrable PAN_LETT_OBLIQUE_WEIGHTED      10);/* Oblique/Weighted               */
+(define-integrable PAN_LETT_OBLIQUE_BOXED         11);/* Oblique/Boxed                  */
+(define-integrable PAN_LETT_OBLIQUE_FLATTENED     12);/* Oblique/Flattened              */
+(define-integrable PAN_LETT_OBLIQUE_ROUNDED       13);/* Oblique/Rounded                */
+(define-integrable PAN_LETT_OBLIQUE_OFF_CENTER    14);/* Oblique/Off Center             */
+(define-integrable PAN_LETT_OBLIQUE_SQUARE        15);/* Oblique/Square                 */
+
+(define-integrable PAN_MIDLINE_STANDARD_TRIMMED    2);/* Standard/Trimmed               */
+(define-integrable PAN_MIDLINE_STANDARD_POINTED    3);/* Standard/Pointed               */
+(define-integrable PAN_MIDLINE_STANDARD_SERIFED    4);/* Standard/Serifed               */
+(define-integrable PAN_MIDLINE_HIGH_TRIMMED        5);/* High/Trimmed                   */
+(define-integrable PAN_MIDLINE_HIGH_POINTED        6);/* High/Pointed                   */
+(define-integrable PAN_MIDLINE_HIGH_SERIFED        7);/* High/Serifed                   */
+(define-integrable PAN_MIDLINE_CONSTANT_TRIMMED    8);/* Constant/Trimmed               */
+(define-integrable PAN_MIDLINE_CONSTANT_POINTED    9);/* Constant/Pointed               */
+(define-integrable PAN_MIDLINE_CONSTANT_SERIFED   10);/* Constant/Serifed               */
+(define-integrable PAN_MIDLINE_LOW_TRIMMED        11);/* Low/Trimmed                    */
+(define-integrable PAN_MIDLINE_LOW_POINTED        12);/* Low/Pointed                    */
+(define-integrable PAN_MIDLINE_LOW_SERIFED        13);/* Low/Serifed                    */
+
+(define-integrable PAN_XHEIGHT_CONSTANT_SMALL      2);/* Constant/Small                 */
+(define-integrable PAN_XHEIGHT_CONSTANT_STD        3);/* Constant/Standard              */
+(define-integrable PAN_XHEIGHT_CONSTANT_LARGE      4);/* Constant/Large                 */
+(define-integrable PAN_XHEIGHT_DUCKING_SMALL       5);/* Ducking/Small                  */
+(define-integrable PAN_XHEIGHT_DUCKING_STD         6);/* Ducking/Standard               */
+(define-integrable PAN_XHEIGHT_DUCKING_LARGE       7);/* Ducking/Large                  */
+
+
+(define-integrable ELF_VENDOR_SIZE     4)
+
+;;/* The extended logical font       */
+;;/* An extension of the ENUMLOGFONT */
+
+;;typedef struct tagEXTLOGFONTA {
+;;    LOGFONTA    elfLogFont;
+;;    BYTE        elfFullName[LF_FULLFACESIZE];
+;;    BYTE        elfStyle[LF_FACESIZE];
+;;    DWORD       elfVersion;     /* 0 for the first release of NT */
+;;    DWORD       elfStyleSize;
+;;    DWORD       elfMatch;
+;;    DWORD       elfReserved;
+;;    BYTE        elfVendorId[ELF_VENDOR_SIZE];
+;;    DWORD       elfCulture;     /* 0 for Latin                   */
+;;    PANOSE      elfPanose;
+;;} EXTLOGFONTA, *PEXTLOGFONTA, NEAR *NPEXTLOGFONTA, FAR *LPEXTLOGFONTA;
+;;typedef struct tagEXTLOGFONTW {
+;;    LOGFONTW    elfLogFont;
+;;    WCHAR       elfFullName[LF_FULLFACESIZE];
+;;    WCHAR       elfStyle[LF_FACESIZE];
+;;    DWORD       elfVersion;     /* 0 for the first release of NT */
+;;    DWORD       elfStyleSize;
+;;    DWORD       elfMatch;
+;;    DWORD       elfReserved;
+;;    BYTE        elfVendorId[ELF_VENDOR_SIZE];
+;;    DWORD       elfCulture;     /* 0 for Latin                   */
+;;    PANOSE      elfPanose;
+;;} EXTLOGFONTW, *PEXTLOGFONTW, NEAR *NPEXTLOGFONTW, FAR *LPEXTLOGFONTW;
+;;#ifdef UNICODE
+;;typedef EXTLOGFONTW EXTLOGFONT;
+;;typedef PEXTLOGFONTW PEXTLOGFONT;
+;;typedef NPEXTLOGFONTW NPEXTLOGFONT;
+;;typedef LPEXTLOGFONTW LPEXTLOGFONT;
+;;#else
+;;typedef EXTLOGFONTA EXTLOGFONT;
+;;typedef PEXTLOGFONTA PEXTLOGFONT;
+;;typedef NPEXTLOGFONTA NPEXTLOGFONT;
+;;typedef LPEXTLOGFONTA LPEXTLOGFONT;
+;;#endif // UNICODE
+;;
+;;
+(define-integrable ELF_VERSION         0)
+(define-integrable ELF_CULTURE_LATIN   0)
+;;
+;;/* EnumFonts Masks */
+(define-integrable RASTER_FONTTYPE     #x0001)
+(define-integrable DEVICE_FONTTYPE     #x002)
+(define-integrable TRUETYPE_FONTTYPE   #x004)
+;;
+;;#define RGB(r,g,b)          ((COLORREF)(((BYTE)(r)|((WORD)(g)<<8))|(((DWORD)(BYTE)(b))<<16)))
+;;#define PALETTERGB(r,g,b)   (0x02000000 | RGB(r,g,b))
+;;#define PALETTEINDEX(i)     ((COLORREF)(0x01000000 | (DWORD)(WORD)(i)))
+;;
+;;/* palette entry flags */
+;;
+(define-integrable PC_RESERVED     #x01   );/* palette index used for animation */
+(define-integrable PC_EXPLICIT     #x02   );/* palette index is explicit to device */
+(define-integrable PC_NOCOLLAPSE   #x04   );/* do not match color to system palette */
+
+;;#define GetRValue(rgb)      ((BYTE)(rgb))
+;;#define GetGValue(rgb)      ((BYTE)(((WORD)(rgb)) >> 8))
+;;#define GetBValue(rgb)      ((BYTE)((rgb)>>16))
+;;
+;;/* Background Modes */
+(define-integrable TRANSPARENT         1)
+(define-integrable OPAQUE              2)
+(define-integrable BKMODE_LAST         2)
+
+;;/* Graphics Modes */
+
+(define-integrable GM_COMPATIBLE       1)
+(define-integrable GM_ADVANCED         2)
+(define-integrable GM_LAST             2)
+
+;;/* PolyDraw and GetPath point types */
+(define-integrable PT_CLOSEFIGURE      #x01)
+(define-integrable PT_LINETO           #x02)
+(define-integrable PT_BEZIERTO         #x04)
+(define-integrable PT_MOVETO           #x06)
+
+;;/* Mapping Modes */
+(define-integrable MM_TEXT             1)
+(define-integrable MM_LOMETRIC         2)
+(define-integrable MM_HIMETRIC         3)
+(define-integrable MM_LOENGLISH        4)
+(define-integrable MM_HIENGLISH        5)
+(define-integrable MM_TWIPS            6)
+(define-integrable MM_ISOTROPIC        7)
+(define-integrable MM_ANISOTROPIC      8)
+
+;;/* Min and Max Mapping Mode values */
+(define-integrable MM_MIN              MM_TEXT)
+(define-integrable MM_MAX              MM_ANISOTROPIC)
+(define-integrable MM_MAX_FIXEDSCALE   MM_TWIPS)
+
+;;/* Coordinate Modes */
+(define-integrable ABSOLUTE            1)
+(define-integrable RELATIVE            2)
+
+;;/* Stock Logical Objects */
+(define-integrable WHITE_BRUSH         0)
+(define-integrable LTGRAY_BRUSH        1)
+(define-integrable GRAY_BRUSH          2)
+(define-integrable DKGRAY_BRUSH        3)
+(define-integrable BLACK_BRUSH         4)
+(define-integrable NULL_BRUSH          5)
+(define-integrable HOLLOW_BRUSH        NULL_BRUSH)
+(define-integrable WHITE_PEN           6)
+(define-integrable BLACK_PEN           7)
+(define-integrable NULL_PEN            8)
+(define-integrable OEM_FIXED_FONT      10)
+(define-integrable ANSI_FIXED_FONT     11)
+(define-integrable ANSI_VAR_FONT       12)
+(define-integrable SYSTEM_FONT         13)
+(define-integrable DEVICE_DEFAULT_FONT 14)
+(define-integrable DEFAULT_PALETTE     15)
+(define-integrable SYSTEM_FIXED_FONT   16)
+(define-integrable STOCK_LAST          16)
+
+(define-integrable CLR_INVALID     #xFFFFFFFF)
+
+;;/* Brush Styles */
+(define-integrable BS_SOLID            0)
+(define-integrable BS_NULL             1)
+(define-integrable BS_HOLLOW           BS_NULL)
+(define-integrable BS_HATCHED          2)
+(define-integrable BS_PATTERN          3)
+(define-integrable BS_INDEXED          4)
+(define-integrable BS_DIBPATTERN       5)
+(define-integrable BS_DIBPATTERNPT     6)
+(define-integrable BS_PATTERN8X8       7)
+
+;;/* Hatch Styles */
+(define-integrable HS_HORIZONTAL       0)       ;/* ----- */
+(define-integrable HS_VERTICAL         1)       ;/* ||||| */
+(define-integrable HS_FDIAGONAL        2)       ;/* \\\\\ */
+(define-integrable HS_BDIAGONAL        3)       ;/* ///// */
+(define-integrable HS_CROSS            4)       ;/* +++++ */
+(define-integrable HS_DIAGCROSS        5)       ;/* xxxxx */
+(define-integrable HS_FDIAGONAL1       6)
+(define-integrable HS_BDIAGONAL1       7)
+(define-integrable HS_SOLID            8)
+(define-integrable HS_DENSE1           9)
+(define-integrable HS_DENSE2           10)
+(define-integrable HS_DENSE3           11)
+(define-integrable HS_DENSE4           12)
+(define-integrable HS_DENSE5           13)
+(define-integrable HS_DENSE6           14)
+(define-integrable HS_DENSE7           15)
+(define-integrable HS_DENSE8           16)
+(define-integrable HS_NOSHADE          17)
+(define-integrable HS_HALFTONE         18)
+(define-integrable HS_SOLIDCLR     19)
+(define-integrable HS_DITHEREDCLR          20)
+(define-integrable HS_SOLIDTEXTCLR     21)
+(define-integrable HS_DITHEREDTEXTCLR  22)
+(define-integrable HS_SOLIDBKCLR           23)
+(define-integrable HS_DITHEREDBKCLR    24)
+(define-integrable HS_API_MAX      25)
+
+;;/* Pen Styles */
+(define-integrable PS_SOLID            0)
+(define-integrable PS_DASH             1)       ;/* -------  */
+(define-integrable PS_DOT              2)       ;/* .......  */
+(define-integrable PS_DASHDOT          3)       ;/* _._._._  */
+(define-integrable PS_DASHDOTDOT       4)       ;/* _.._.._  */
+(define-integrable PS_NULL             5)
+(define-integrable PS_INSIDEFRAME      6)
+(define-integrable PS_USERSTYLE        7)
+(define-integrable PS_ALTERNATE        8)
+(define-integrable PS_STYLE_MASK       #x0000000F)
+
+(define-integrable PS_ENDCAP_ROUND     #x00000000)
+(define-integrable PS_ENDCAP_SQUARE    #x00000100)
+(define-integrable PS_ENDCAP_FLAT      #x00000200)
+(define-integrable PS_ENDCAP_MASK      #x00000F00)
+
+(define-integrable PS_JOIN_ROUND       #x00000000)
+(define-integrable PS_JOIN_BEVEL       #x00001000)
+(define-integrable PS_JOIN_MITER       #x00002000)
+(define-integrable PS_JOIN_MASK        #x0000F000)
+
+(define-integrable PS_COSMETIC         #x00000000)
+(define-integrable PS_GEOMETRIC        #x00010000)
+(define-integrable PS_TYPE_MASK        #x000F0000)
+
+(define-integrable AD_COUNTERCLOCKWISE 1)
+(define-integrable AD_CLOCKWISE        2)
+
+;;/* Device Parameters for GetDeviceCaps() */
+(define-integrable DRIVERVERSION 0)     ;/* Device driver version                    */
+(define-integrable TECHNOLOGY    2)     ;/* Device classification                    */
+(define-integrable HORZSIZE      4)     ;/* Horizontal size in millimeters           */
+(define-integrable VERTSIZE      6)     ;/* Vertical size in millimeters             */
+(define-integrable HORZRES       8)     ;/* Horizontal width in pixels               */
+(define-integrable VERTRES       10)    ;/* Vertical width in pixels                 */
+(define-integrable BITSPIXEL     12)    ;/* Number of bits per pixel                 */
+(define-integrable PLANES        14)    ;/* Number of planes                         */
+(define-integrable NUMBRUSHES    16)    ;/* Number of brushes the device has         */
+(define-integrable NUMPENS       18)    ;/* Number of pens the device has            */
+(define-integrable NUMMARKERS    20)    ;/* Number of markers the device has         */
+(define-integrable NUMFONTS      22)    ;/* Number of fonts the device has           */
+(define-integrable NUMCOLORS     24)    ;/* Number of colors the device supports     */
+(define-integrable PDEVICESIZE   26)    ;/* Size required for device descriptor      */
+(define-integrable CURVECAPS     28)    ;/* Curve capabilities                       */
+(define-integrable LINECAPS      30)    ;/* Line capabilities                        */
+(define-integrable POLYGONALCAPS 32)    ;/* Polygonal capabilities                   */
+(define-integrable TEXTCAPS      34)    ;/* Text capabilities                        */
+(define-integrable CLIPCAPS      36)    ;/* Clipping capabilities                    */
+(define-integrable RASTERCAPS    38)    ;/* Bitblt capabilities                      */
+(define-integrable ASPECTX       40)    ;/* Length of the X leg                      */
+(define-integrable ASPECTY       42)    ;/* Length of the Y leg                      */
+(define-integrable ASPECTXY      44)    ;/* Length of the hypotenuse                 */
+
+(define-integrable LOGPIXELSX    88)    ;/* Logical pixels/inch in X                 */
+(define-integrable LOGPIXELSY    90)    ;/* Logical pixels/inch in Y                 */
+
+(define-integrable SIZEPALETTE  104)    ;/* Number of entries in physical palette    */
+(define-integrable NUMRESERVED  106)    ;/* Number of reserved entries in palette    */
+(define-integrable COLORRES     108)    ;/* Actual color resolution                  */
+
+
+;;// Printing related DeviceCaps. These replace the appropriate Escapes
+
+(define-integrable PHYSICALWIDTH   110) ;// Physical Width in device units
+(define-integrable PHYSICALHEIGHT  111) ;// Physical Height in device units
+(define-integrable PHYSICALOFFSETX 112) ;// Physical Printable Area x margin
+(define-integrable PHYSICALOFFSETY 113) ;// Physical Printable Area y margin
+(define-integrable SCALINGFACTORX  114) ;// Scaling factor x
+(define-integrable SCALINGFACTORY  115) ;// Scaling factor y
+
+;;#ifndef NOGDICAPMASKS
+;;
+;;;/* Device Capability Masks: */
+;;
+;;/* Device Technologies */
+(define-integrable DT_PLOTTER          0)   ;/* Vector plotter                   */
+(define-integrable DT_RASDISPLAY       1)   ;/* Raster display                   */
+(define-integrable DT_RASPRINTER       2)   ;/* Raster printer                   */
+(define-integrable DT_RASCAMERA        3)   ;/* Raster camera                    */
+(define-integrable DT_CHARSTREAM       4)   ;/* Character-stream, PLP            */
+(define-integrable DT_METAFILE         5)   ;/* Metafile, VDM                    */
+(define-integrable DT_DISPFILE         6)   ;/* Display-file                     */
+;;
+;;/* Curve Capabilities */
+(define-integrable CC_NONE             0)   ;/* Curves not supported             */
+(define-integrable CC_CIRCLES          1)   ;/* Can do circles                   */
+(define-integrable CC_PIE              2)   ;/* Can do pie wedges                */
+(define-integrable CC_CHORD            4)   ;/* Can do chord arcs                */
+(define-integrable CC_ELLIPSES         8)   ;/* Can do ellipese                  */
+(define-integrable CC_WIDE             16)  ;/* Can do wide lines                */
+(define-integrable CC_STYLED           32)  ;/* Can do styled lines              */
+(define-integrable CC_WIDESTYLED       64)  ;/* Can do wide styled lines         */
+(define-integrable CC_INTERIORS        128) ;/* Can do interiors                 */
+(define-integrable CC_ROUNDRECT        256) ;/*                                  */
+;;
+;;/* Line Capabilities */
+(define-integrable LC_NONE             0)   ;/* Lines not supported              */
+(define-integrable LC_POLYLINE         2)   ;/* Can do polylines                 */
+(define-integrable LC_MARKER           4)   ;/* Can do markers                   */
+(define-integrable LC_POLYMARKER       8)   ;/* Can do polymarkers               */
+(define-integrable LC_WIDE             16)  ;/* Can do wide lines                */
+(define-integrable LC_STYLED           32)  ;/* Can do styled lines              */
+(define-integrable LC_WIDESTYLED       64)  ;/* Can do wide styled lines         */
+(define-integrable LC_INTERIORS        128) ;/* Can do interiors                 */
+;;
+;;/* Polygonal Capabilities */
+(define-integrable PC_NONE             0)   ;/* Polygonals not supported         */
+(define-integrable PC_POLYGON          1)   ;/* Can do polygons                  */
+(define-integrable PC_RECTANGLE        2)   ;/* Can do rectangles                */
+(define-integrable PC_WINDPOLYGON      4)   ;/* Can do winding polygons          */
+(define-integrable PC_TRAPEZOID        4)   ;/* Can do trapezoids                */
+(define-integrable PC_SCANLINE         8)   ;/* Can do scanlines                 */
+(define-integrable PC_WIDE             16)  ;/* Can do wide borders              */
+(define-integrable PC_STYLED           32)  ;/* Can do styled borders            */
+(define-integrable PC_WIDESTYLED       64)  ;/* Can do wide styled borders       */
+(define-integrable PC_INTERIORS        128) ;/* Can do interiors                 */
+;;
+;;/* Polygonal Capabilities */
+(define-integrable CP_NONE             0)   ;/* No clipping of output            */
+(define-integrable CP_RECTANGLE        1)   ;/* Output clipped to rects          */
+(define-integrable CP_REGION           2)   ;/*                                  */
+
+;;/* Text Capabilities */
+(define-integrable TC_OP_CHARACTER     #x00000001)  ;/* Can do OutputPrecision   CHARACTER      */
+(define-integrable TC_OP_STROKE        #x00000002)  ;/* Can do OutputPrecision   STROKE         */
+(define-integrable TC_CP_STROKE        #x00000004)  ;/* Can do ClipPrecision     STROKE         */
+(define-integrable TC_CR_90            #x00000008)  ;/* Can do CharRotAbility    90             */
+(define-integrable TC_CR_ANY           #x00000010)  ;/* Can do CharRotAbility    ANY            */
+(define-integrable TC_SF_X_YINDEP      #x00000020)  ;/* Can do ScaleFreedom      X_YINDEPENDENT */
+(define-integrable TC_SA_DOUBLE        #x00000040)  ;/* Can do ScaleAbility      DOUBLE         */
+(define-integrable TC_SA_INTEGER       #x00000080)  ;/* Can do ScaleAbility      INTEGER        */
+(define-integrable TC_SA_CONTIN        #x00000100)  ;/* Can do ScaleAbility      CONTINUOUS     */
+(define-integrable TC_EA_DOUBLE        #x00000200)  ;/* Can do EmboldenAbility   DOUBLE         */
+(define-integrable TC_IA_ABLE          #x00000400)  ;/* Can do ItalisizeAbility  ABLE           */
+(define-integrable TC_UA_ABLE          #x00000800)  ;/* Can do UnderlineAbility  ABLE           */
+(define-integrable TC_SO_ABLE          #x00001000)  ;/* Can do StrikeOutAbility  ABLE           */
+(define-integrable TC_RA_ABLE          #x00002000)  ;/* Can do RasterFontAble    ABLE           */
+(define-integrable TC_VA_ABLE          #x00004000)  ;/* Can do VectorFontAble    ABLE           */
+(define-integrable TC_RESERVED         #x00008000)
+(define-integrable TC_SCROLLBLT        #x00010000)  ;/* do text scroll with blt                 */
+;;
+;;#endif /* NOGDICAPMASKS */
+;;
+;;/* Raster Capabilities */
+;;#define RC_NONE
+(define-integrable RC_BITBLT           1)       ;/* Can do standard BLT.             */
+(define-integrable RC_BANDING          2)       ;/* Device requires banding support  */
+(define-integrable RC_SCALING          4)       ;/* Device requires scaling support  */
+(define-integrable RC_BITMAP64         8)       ;/* Device can support >64K bitmap   */
+(define-integrable RC_GDI20_OUTPUT     #x0010)      ;/* has 2.0 output calls         */
+(define-integrable RC_GDI20_STATE      #x0020)
+(define-integrable RC_SAVEBITMAP       #x0040)
+(define-integrable RC_DI_BITMAP        #x0080)      ;/* supports DIB to memory       */
+(define-integrable RC_PALETTE          #x0100)      ;/* supports a palette           */
+(define-integrable RC_DIBTODEV         #x0200)      ;/* supports DIBitsToDevice      */
+(define-integrable RC_BIGFONT          #x0400)      ;/* supports >64K fonts          */
+(define-integrable RC_STRETCHBLT       #x0800)      ;/* supports StretchBlt          */
+(define-integrable RC_FLOODFILL        #x1000)      ;/* supports FloodFill           */
+(define-integrable RC_STRETCHDIB       #x2000)      ;/* supports StretchDIBits       */
+(define-integrable RC_OP_DX_OUTPUT     #x4000)
+(define-integrable RC_DEVBITS          #x8000)
+;;
+;;/* DIB color table identifiers */
+;;
+(define-integrable DIB_RGB_COLORS      0) ;/* color table in RGBs */
+(define-integrable DIB_PAL_COLORS      1) ;/* color table in palette indices */
+(define-integrable DIB_PAL_INDICES     2) ;/* No color table indices into surf palette */
+(define-integrable DIB_PAL_PHYSINDICES 2) ;/* No color table indices into surf palette */
+(define-integrable DIB_PAL_LOGINDICES  4) ;/* No color table indices into DC palette */
+;;
+;;/* constants for Get/SetSystemPaletteUse() */
+;;
+(define-integrable SYSPAL_ERROR    0)
+(define-integrable SYSPAL_STATIC   1)
+(define-integrable SYSPAL_NOSTATIC 2)
+;;
+;;/* constants for CreateDIBitmap */
+(define-integrable CBM_CREATEDIB   #x02)   ;/* create DIB bitmap */
+(define-integrable CBM_INIT        #x04)   ;/* initialize bitmap */
+;;
+;;/* ExtFloodFill style flags */
+(define-integrable  FLOODFILLBORDER   0)
+(define-integrable  FLOODFILLSURFACE  1)
+;;
+;;/* size of a device name string */
+(define-integrable CCHDEVICENAME 32)
+;;
+;;/* size of a form name string */
+(define-integrable CCHFORMNAME 32)
+;;
+;;typedef struct _devicemodeA {
+;;    BYTE   dmDeviceName[CCHDEVICENAME];
+;;    WORD dmSpecVersion;
+;;    WORD dmDriverVersion;
+;;    WORD dmSize;
+;;    WORD dmDriverExtra;
+;;    DWORD dmFields;
+;;    short dmOrientation;
+;;    short dmPaperSize;
+;;    short dmPaperLength;
+;;    short dmPaperWidth;
+;;    short dmScale;
+;;    short dmCopies;
+;;    short dmDefaultSource;
+;;    short dmPrintQuality;
+;;    short dmColor;
+;;    short dmDuplex;
+;;    short dmYResolution;
+;;    short dmTTOption;
+;;    short dmCollate;
+;;    BYTE   dmFormName[CCHFORMNAME];
+;;    WORD   dmUnusedPadding;
+;;    DWORD  dmBitsPerPel;
+;;    DWORD  dmPelsWidth;
+;;    DWORD  dmPelsHeight;
+;;    DWORD  dmDisplayFlags;
+;;    DWORD  dmDisplayFrequency;
+;;} DEVMODEA, *PDEVMODEA, *NPDEVMODEA, *LPDEVMODEA;
+;;typedef struct _devicemodeW {
+;;    WCHAR  dmDeviceName[CCHDEVICENAME];
+;;    WORD dmSpecVersion;
+;;    WORD dmDriverVersion;
+;;    WORD dmSize;
+;;    WORD dmDriverExtra;
+;;    DWORD dmFields;
+;;    short dmOrientation;
+;;    short dmPaperSize;
+;;    short dmPaperLength;
+;;    short dmPaperWidth;
+;;    short dmScale;
+;;    short dmCopies;
+;;    short dmDefaultSource;
+;;    short dmPrintQuality;
+;;    short dmColor;
+;;    short dmDuplex;
+;;    short dmYResolution;
+;;    short dmTTOption;
+;;    short dmCollate;
+;;    WCHAR  dmFormName[CCHFORMNAME];
+;;    WORD   dmUnusedPadding;
+;;    DWORD  dmBitsPerPel;
+;;    DWORD  dmPelsWidth;
+;;    DWORD  dmPelsHeight;
+;;    DWORD  dmDisplayFlags;
+;;    DWORD  dmDisplayFrequency;
+;;} DEVMODEW, *PDEVMODEW, *NPDEVMODEW, *LPDEVMODEW;
+;;#ifdef UNICODE
+;;typedef DEVMODEW DEVMODE;
+;;typedef PDEVMODEW PDEVMODE;
+;;typedef NPDEVMODEW NPDEVMODE;
+;;typedef LPDEVMODEW LPDEVMODE;
+;;#else
+;;typedef DEVMODEA DEVMODE;
+;;typedef PDEVMODEA PDEVMODE;
+;;typedef NPDEVMODEA NPDEVMODE;
+;;typedef LPDEVMODEA LPDEVMODE;
+;;#endif // UNICODE
+;;
+;;/* current version of specification */
+(define-integrable DM_SPECVERSION #x320)
+;;
+;;/* field selection bits */
+(define-integrable DM_ORIENTATION      #x0000001)
+(define-integrable DM_PAPERSIZE        #x0000002)
+(define-integrable DM_PAPERLENGTH      #x0000004)
+(define-integrable DM_PAPERWIDTH       #x0000008)
+(define-integrable DM_SCALE            #x0000010)
+(define-integrable DM_COPIES           #x0000100)
+(define-integrable DM_DEFAULTSOURCE    #x0000200)
+(define-integrable DM_PRINTQUALITY     #x0000400)
+(define-integrable DM_COLOR            #x0000800)
+(define-integrable DM_DUPLEX           #x0001000)
+(define-integrable DM_YRESOLUTION      #x0002000)
+(define-integrable DM_TTOPTION         #x0004000)
+(define-integrable DM_COLLATE          #x0008000)
+(define-integrable DM_FORMNAME         #x0010000)
+;;
+;;/* orientation selections */
+(define-integrable DMORIENT_PORTRAIT   1)
+(define-integrable DMORIENT_LANDSCAPE  2)
+;;
+;;/* paper selections */
+(define-integrable DMPAPER_LETTER      1)           ;/* Letter 8 1/2 x 11 in               */
+(define-integrable DMPAPER_FIRST       DMPAPER_LETTER)
+(define-integrable DMPAPER_LETTERSMALL 2)           ;/* Letter Small 8 1/2 x 11 in         */
+(define-integrable DMPAPER_TABLOID     3)           ;/* Tabloid 11 x 17 in                 */
+(define-integrable DMPAPER_LEDGER      4)           ;/* Ledger 17 x 11 in                  */
+(define-integrable DMPAPER_LEGAL       5)           ;/* Legal 8 1/2 x 14 in                */
+(define-integrable DMPAPER_STATEMENT   6)           ;/* Statement 5 1/2 x 8 1/2 in         */
+(define-integrable DMPAPER_EXECUTIVE   7)           ;/* Executive 7 1/4 x 10 1/2 in        */
+(define-integrable DMPAPER_A3          8)           ;/* A3 297 x 420 mm                    */
+(define-integrable DMPAPER_A4          9)           ;/* A4 210 x 297 mm                    */
+(define-integrable DMPAPER_A4SMALL     10)          ;/* A4 Small 210 x 297 mm              */
+(define-integrable DMPAPER_A5          11)          ;/* A5 148 x 210 mm                    */
+(define-integrable DMPAPER_B4          12)          ;/* B4 250 x 354                       */
+(define-integrable DMPAPER_B5          13)          ;/* B5 182 x 257 mm                    */
+(define-integrable DMPAPER_FOLIO       14)          ;/* Folio 8 1/2 x 13 in                */
+(define-integrable DMPAPER_QUARTO      15)          ;/* Quarto 215 x 275 mm                */
+(define-integrable DMPAPER_10X14       16)          ;/* 10x14 in                           */
+(define-integrable DMPAPER_11X17       17)          ;/* 11x17 in                           */
+(define-integrable DMPAPER_NOTE        18)          ;/* Note 8 1/2 x 11 in                 */
+(define-integrable DMPAPER_ENV_9       19)          ;/* Envelope #9 3 7/8 x 8 7/8          */
+(define-integrable DMPAPER_ENV_10      20)          ;/* Envelope #10 4 1/8 x 9 1/2         */
+(define-integrable DMPAPER_ENV_11      21)          ;/* Envelope #11 4 1/2 x 10 3/8        */
+(define-integrable DMPAPER_ENV_12      22)          ;/* Envelope #12 4 \276 x 11           */
+(define-integrable DMPAPER_ENV_14      23)          ;/* Envelope #14 5 x 11 1/2            */
+(define-integrable DMPAPER_CSHEET      24)          ;/* C size sheet                       */
+(define-integrable DMPAPER_DSHEET      25)          ;/* D size sheet                       */
+(define-integrable DMPAPER_ESHEET      26)          ;/* E size sheet                       */
+(define-integrable DMPAPER_ENV_DL      27)          ;/* Envelope DL 110 x 220mm            */
+(define-integrable DMPAPER_ENV_C5      28)          ;/* Envelope C5 162 x 229 mm           */
+(define-integrable DMPAPER_ENV_C3      29)          ;/* Envelope C3  324 x 458 mm          */
+(define-integrable DMPAPER_ENV_C4      30)          ;/* Envelope C4  229 x 324 mm          */
+(define-integrable DMPAPER_ENV_C6      31)          ;/* Envelope C6  114 x 162 mm          */
+(define-integrable DMPAPER_ENV_C65     32)          ;/* Envelope C65 114 x 229 mm          */
+(define-integrable DMPAPER_ENV_B4      33)          ;/* Envelope B4  250 x 353 mm          */
+(define-integrable DMPAPER_ENV_B5      34)          ;/* Envelope B5  176 x 250 mm          */
+(define-integrable DMPAPER_ENV_B6      35)          ;/* Envelope B6  176 x 125 mm          */
+(define-integrable DMPAPER_ENV_ITALY   36)          ;/* Envelope 110 x 230 mm              */
+(define-integrable DMPAPER_ENV_MONARCH 37)          ;/* Envelope Monarch 3.875 x 7.5 in    */
+(define-integrable DMPAPER_ENV_PERSONAL 38)         ;/* 6 3/4 Envelope 3 5/8 x 6 1/2 in    */
+(define-integrable DMPAPER_FANFOLD_US  39)          ;/* US Std Fanfold 14 7/8 x 11 in      */
+(define-integrable DMPAPER_FANFOLD_STD_GERMAN  40)  ;/* German Std Fanfold 8 1/2 x 12 in   */
+(define-integrable DMPAPER_FANFOLD_LGL_GERMAN  41)  ;/* German Legal Fanfold 8 1/2 x 13 in */
+
+(define-integrable DMPAPER_LAST        DMPAPER_FANFOLD_LGL_GERMAN)
+
+(define-integrable DMPAPER_USER        256)
+;;
+;;/* bin selections */
+(define-integrable DMBIN_UPPER         1)
+(define-integrable DMBIN_FIRST         DMBIN_UPPER)
+(define-integrable DMBIN_ONLYONE       1)
+(define-integrable DMBIN_LOWER         2)
+(define-integrable DMBIN_MIDDLE        3)
+(define-integrable DMBIN_MANUAL        4)
+(define-integrable DMBIN_ENVELOPE      5)
+(define-integrable DMBIN_ENVMANUAL     6)
+(define-integrable DMBIN_AUTO          7)
+(define-integrable DMBIN_TRACTOR       8)
+(define-integrable DMBIN_SMALLFMT      9)
+(define-integrable DMBIN_LARGEFMT      10)
+(define-integrable DMBIN_LARGECAPACITY 11)
+(define-integrable DMBIN_CASSETTE      14)
+(define-integrable DMBIN_LAST          DMBIN_CASSETTE)
+
+(define-integrable DMBIN_USER          256)     ;/* device specific bins start here */
+;;
+;;/* print qualities */
+(define-integrable DMRES_DRAFT         -1)
+(define-integrable DMRES_LOW           -2)
+(define-integrable DMRES_MEDIUM        -3)
+(define-integrable DMRES_HIGH          -4)
+;;
+;;/* color enable/disable for color printers */
+(define-integrable DMCOLOR_MONOCHROME  1)
+(define-integrable DMCOLOR_COLOR       2)
+;;
+;;/* duplex enable */
+(define-integrable DMDUP_SIMPLEX    1)
+(define-integrable DMDUP_VERTICAL   2)
+(define-integrable DMDUP_HORIZONTAL 3)
+;;
+;;/* TrueType options */
+(define-integrable DMTT_BITMAP     1)       ;/* print TT fonts as graphics */
+(define-integrable DMTT_DOWNLOAD   2)       ;/* download TT fonts as soft fonts */
+(define-integrable DMTT_SUBDEV     3)       ;/* substitute device fonts for TT fonts */
+;;
+;;/* Collation selections */
+(define-integrable DMCOLLATE_FALSE  0)
+(define-integrable DMCOLLATE_TRUE   1)
+;;
+;;/* DEVMODE dmDisplayFlags flags */
+;;
+(define-integrable DM_GRAYSCALE  #x00000001)
+(define-integrable DM_INTERLACED #x00000002)
+;;
+;;/* GetRegionData/ExtCreateRegion */
+;;
+(define-integrable RDH_RECTANGLES  1)
+;;
+;;typedef struct _RGNDATAHEADER {
+;;    DWORD   dwSize;
+;;    DWORD   iType;
+;;    DWORD   nCount;
+;;    DWORD   nRgnSize;
+;;    RECT    rcBound;
+;;} RGNDATAHEADER, *PRGNDATAHEADER;
+;;
+;;typedef struct _RGNDATA {
+;;    RGNDATAHEADER   rdh;
+;;    char            Buffer[1];
+;;} RGNDATA, *PRGNDATA, NEAR *NPRGNDATA, FAR *LPRGNDATA;
+;;
+;;
+;;typedef struct _ABC {
+;;    int     abcA;
+;;    UINT    abcB;
+;;    int     abcC;
+;;} ABC, *PABC, NEAR *NPABC, FAR *LPABC;
+;;
+;;typedef struct _ABCFLOAT {
+;;    FLOAT   abcfA;
+;;    FLOAT   abcfB;
+;;    FLOAT   abcfC;
+;;} ABCFLOAT, *PABCFLOAT, NEAR *NPABCFLOAT, FAR *LPABCFLOAT;
+;;
+;;#ifndef NOTEXTMETRIC
+;;
+;;typedef struct _OUTLINETEXTMETRICA {
+;;    UINT    otmSize;
+;;    TEXTMETRICA otmTextMetrics;
+;;    BYTE    otmFiller;
+;;    PANOSE  otmPanoseNumber;
+;;    UINT    otmfsSelection;
+;;    UINT    otmfsType;
+;;    UINT    otmsCharSlopeRise;
+;;    UINT    otmsCharSlopeRun;
+;;    UINT    otmItalicAngle;
+;;    UINT    otmEMSquare;
+;;    UINT    otmAscent;
+;;     int    otmDescent;
+;;     int    otmLineGap;
+;;    UINT    otmsCapEmHeight;
+;;    UINT    otmsXHeight;
+;;    RECT    otmrcFontBox;
+;;     int    otmMacAscent;
+;;     int    otmMacDescent;
+;;    UINT    otmMacLineGap;
+;;    UINT    otmusMinimumPPEM;
+;;    POINT   otmptSubscriptSize;
+;;    POINT   otmptSubscriptOffset;
+;;    POINT   otmptSuperscriptSize;
+;;    POINT   otmptSuperscriptOffset;
+;;    UINT    otmsStrikeoutSize;
+;;     int    otmsStrikeoutPosition;
+;;     int    otmsUnderscoreSize;
+;;    UINT    otmsUnderscorePosition;
+;;    PSTR    otmpFamilyName;
+;;    PSTR    otmpFaceName;
+;;    PSTR    otmpStyleName;
+;;    PSTR    otmpFullName;
+;;} OUTLINETEXTMETRICA, *POUTLINETEXTMETRICA, NEAR *NPOUTLINETEXTMETRICA, FAR *LPOUTLINETEXTMETRICA;
+;;typedef struct _OUTLINETEXTMETRICW {
+;;    UINT    otmSize;
+;;    TEXTMETRICW otmTextMetrics;
+;;    BYTE    otmFiller;
+;;    PANOSE  otmPanoseNumber;
+;;    UINT    otmfsSelection;
+;;    UINT    otmfsType;
+;;    UINT    otmsCharSlopeRise;
+;;    UINT    otmsCharSlopeRun;
+;;    UINT    otmItalicAngle;
+;;    UINT    otmEMSquare;
+;;    UINT    otmAscent;
+;;     int    otmDescent;
+;;     int    otmLineGap;
+;;    UINT    otmsCapEmHeight;
+;;    UINT    otmsXHeight;
+;;    RECT    otmrcFontBox;
+;;     int    otmMacAscent;
+;;     int    otmMacDescent;
+;;    UINT    otmMacLineGap;
+;;    UINT    otmusMinimumPPEM;
+;;    POINT   otmptSubscriptSize;
+;;    POINT   otmptSubscriptOffset;
+;;    POINT   otmptSuperscriptSize;
+;;    POINT   otmptSuperscriptOffset;
+;;    UINT    otmsStrikeoutSize;
+;;     int    otmsStrikeoutPosition;
+;;     int    otmsUnderscoreSize;
+;;    UINT    otmsUnderscorePosition;
+;;    PSTR    otmpFamilyName;
+;;    PSTR    otmpFaceName;
+;;    PSTR    otmpStyleName;
+;;    PSTR    otmpFullName;
+;;} OUTLINETEXTMETRICW, *POUTLINETEXTMETRICW, NEAR *NPOUTLINETEXTMETRICW, FAR *LPOUTLINETEXTMETRICW;
+;;#ifdef UNICODE
+;;typedef OUTLINETEXTMETRICW OUTLINETEXTMETRIC;
+;;typedef POUTLINETEXTMETRICW POUTLINETEXTMETRIC;
+;;typedef NPOUTLINETEXTMETRICW NPOUTLINETEXTMETRIC;
+;;typedef LPOUTLINETEXTMETRICW LPOUTLINETEXTMETRIC;
+;;#else
+;;typedef OUTLINETEXTMETRICA OUTLINETEXTMETRIC;
+;;typedef POUTLINETEXTMETRICA POUTLINETEXTMETRIC;
+;;typedef NPOUTLINETEXTMETRICA NPOUTLINETEXTMETRIC;
+;;typedef LPOUTLINETEXTMETRICA LPOUTLINETEXTMETRIC;
+;;#endif // UNICODE
+;;
+;;#endif /* NOTEXTMETRIC */
+;;
+;;
+;;typedef struct tagPOLYTEXTA
+;;{
+;;    int       x;
+;;    int       y;
+;;    UINT      n;
+;;    LPCSTR    lpstr;
+;;    UINT      uiFlags;
+;;    RECT      rcl;
+;;    int      *pdx;
+;;} POLYTEXTA, *PPOLYTEXTA, NEAR *NPPOLYTEXTA, FAR *LPPOLYTEXTA;
+;;typedef struct tagPOLYTEXTW
+;;{
+;;    int       x;
+;;    int       y;
+;;    UINT      n;
+;;    LPCWSTR   lpstr;
+;;    UINT      uiFlags;
+;;    RECT      rcl;
+;;    int      *pdx;
+;;} POLYTEXTW, *PPOLYTEXTW, NEAR *NPPOLYTEXTW, FAR *LPPOLYTEXTW;
+;;#ifdef UNICODE
+;;typedef POLYTEXTW POLYTEXT;
+;;typedef PPOLYTEXTW PPOLYTEXT;
+;;typedef NPPOLYTEXTW NPPOLYTEXT;
+;;typedef LPPOLYTEXTW LPPOLYTEXT;
+;;#else
+;;typedef POLYTEXTA POLYTEXT;
+;;typedef PPOLYTEXTA PPOLYTEXT;
+;;typedef NPPOLYTEXTA NPPOLYTEXT;
+;;typedef LPPOLYTEXTA LPPOLYTEXT;
+;;#endif // UNICODE
+;;
+;;typedef struct _FIXED {
+;;    WORD    fract;
+;;    short   value;
+;;} FIXED;
+;;
+;;
+;;typedef struct _MAT2 {
+;;     FIXED  eM11;
+;;     FIXED  eM12;
+;;     FIXED  eM21;
+;;     FIXED  eM22;
+;;} MAT2, FAR *LPMAT2;
+;;
+;;
+;;
+;;typedef struct _GLYPHMETRICS {
+;;    UINT    gmBlackBoxX;
+;;    UINT    gmBlackBoxY;
+;;    POINT   gmptGlyphOrigin;
+;;    short   gmCellIncX;
+;;    short   gmCellIncY;
+;;} GLYPHMETRICS, FAR *LPGLYPHMETRICS;
+;;
+;;//  GetGlyphOutline constants
+;;
+(define-integrable GGO_NONE           0)
+(define-integrable GGO_BITMAP         1)
+(define-integrable GGO_NATIVE         2)
+
+(define-integrable TT_POLYGON_TYPE   24)
+
+(define-integrable TT_PRIM_LINE       1)
+(define-integrable TT_PRIM_QSPLINE    2)
+
+;;typedef struct tagPOINTFX
+;;{
+;;    FIXED x;
+;;    FIXED y;
+;;} POINTFX, FAR* LPPOINTFX;
+;;
+;;typedef struct tagTTPOLYCURVE
+;;{
+;;    WORD    wType;
+;;    WORD    cpfx;
+;;    POINTFX apfx[1];
+;;} TTPOLYCURVE, FAR* LPTTPOLYCURVE;
+;;
+;;typedef struct tagTTPOLYGONHEADER
+;;{
+;;    DWORD   cb;
+;;    DWORD   dwType;
+;;    POINTFX pfxStart;
+;;} TTPOLYGONHEADER, FAR* LPTTPOLYGONHEADER;
+;;
+;;
+;;
+;;typedef struct _RASTERIZER_STATUS {
+;;    short   nSize;
+;;    short   wFlags;
+;;    short   nLanguageID;
+;;} RASTERIZER_STATUS, FAR *LPRASTERIZER_STATUS;
+;;
+;;/* bits defined in wFlags of RASTERIZER_STATUS */
+(define-integrable TT_AVAILABLE    #x0001)
+(define-integrable TT_ENABLED      #x0002)
+;;
+;;#ifdef STRICT
+;;#if !defined(NOTEXTMETRIC)
+;;typedef int (CALLBACK* OLDFONTENUMPROC)(CONST LOGFONT *, CONST TEXTMETRIC *, DWORD, LPARAM);
+;;#else
+;;typedef int (CALLBACK* OLDFONTENUMPROC)(CONST LOGFONT * ,CONST VOID *, DWORD, LPARAM);
+;;#endif
+;;typedef int (CALLBACK* GOBJENUMPROC)(LPVOID, LPARAM);
+;;typedef VOID (CALLBACK* LINEDDAPROC)(int, int, LPARAM);
+;;#else
+;;typedef FARPROC OLDFONTENUMPROC;
+;;typedef FARPROC GOBJENUMPROC;
+;;typedef FARPROC LINEDDAPROC;
+;;#endif
+;;
+;;typedef OLDFONTENUMPROC FONTENUMPROC;
+;;
+;;int WINAPI AddFontResourceA(LPCSTR);
+;;int WINAPI AddFontResourceW(LPCWSTR);
+;;#ifdef UNICODE
+;;#define AddFontResource  AddFontResourceW
+;;#else
+;;#define AddFontResource  AddFontResourceA
+;;#endif // !UNICODE
+;;
+;;int   WINAPI AddFontModule(HMODULE);
+;;BOOL  WINAPI AnimatePalette(HPALETTE, UINT, UINT, CONST PALETTEENTRY *);
+;;BOOL  WINAPI Arc(HDC, int, int, int, int, int, int, int, int);
+;;BOOL  WINAPI BitBlt(HDC, int, int, int, int, HDC, int, int, DWORD);
+;;BOOL  WINAPI CancelDC(HDC);
+;;BOOL  WINAPI Chord(HDC, int, int, int, int, int, int, int, int);
+;;HMETAFILE  WINAPI CloseMetaFile(HDC);
+;;int     WINAPI CombineRgn(HRGN, HRGN, HRGN, int);
+;;HMETAFILE WINAPI CopyMetaFileA(HMETAFILE, LPSTR);
+;;HMETAFILE WINAPI CopyMetaFileW(HMETAFILE, LPWSTR);
+;;#ifdef UNICODE
+;;#define CopyMetaFile  CopyMetaFileW
+;;#else
+;;#define CopyMetaFile  CopyMetaFileA
+;;#endif // !UNICODE
+;;HBITMAP WINAPI CreateBitmap(int, int, UINT, UINT, CONST VOID *);
+;;HBITMAP WINAPI CreateBitmapIndirect(LPBITMAP);
+;;HBRUSH  WINAPI CreateBrushIndirect(LPLOGBRUSH);
+;;HBITMAP WINAPI CreateCompatibleBitmap(HDC, int, int);
+;;HBITMAP WINAPI CreateDiscardableBitmap(HDC, int, int);
+;;HDC     WINAPI CreateCompatibleDC(HDC);
+;;HDC     WINAPI CreateDCA(LPCSTR, LPCSTR , LPCSTR , CONST DEVMODEA FAR *);
+;;HDC     WINAPI CreateDCW(LPCWSTR, LPCWSTR , LPCWSTR , CONST DEVMODEW FAR *);
+;;#ifdef UNICODE
+;;#define CreateDC  CreateDCW
+;;#else
+;;#define CreateDC  CreateDCA
+;;#endif // !UNICODE
+;;HBITMAP WINAPI CreateDIBitmap(HDC, LPBITMAPINFOHEADER, DWORD, CONST BYTE *, LPBITMAPINFO, UINT);
+;;HBITMAP WINAPI CreateDIBSection(HDC, LPBITMAPINFO, DWORD, DWORD);
+;;HBRUSH  WINAPI CreateDIBPatternBrush(HGLOBAL, UINT);
+;;HBRUSH       WINAPI CreateDIBPatternBrushPt(LPVOID, UINT);
+;;HRGN    WINAPI CreateEllipticRgn(int, int, int, int);
+;;HRGN    WINAPI CreateEllipticRgnIndirect(CONST RECT *);
+;;HFONT   WINAPI CreateFontIndirectA(CONST LOGFONTA *);
+;;HFONT   WINAPI CreateFontIndirectW(CONST LOGFONTW *);
+;;#ifdef UNICODE
+;;#define CreateFontIndirect  CreateFontIndirectW
+;;#else
+;;#define CreateFontIndirect  CreateFontIndirectA
+;;#endif // !UNICODE
+;;HFONT   WINAPI CreateFontA(int, int, int, int, int, DWORD,
+;;                             DWORD, DWORD, DWORD, DWORD, DWORD,
+;;                             DWORD, DWORD, LPCSTR);
+;;HFONT   WINAPI CreateFontW(int, int, int, int, int, DWORD,
+;;                             DWORD, DWORD, DWORD, DWORD, DWORD,
+;;                             DWORD, DWORD, LPCWSTR);
+;;#ifdef UNICODE
+;;#define CreateFont  CreateFontW
+;;#else
+;;#define CreateFont  CreateFontA
+;;#endif // !UNICODE
+;;
+;;HBRUSH  WINAPI CreateHatchBrush(int, COLORREF);
+;;HDC     WINAPI CreateICA(LPCSTR, LPCSTR , LPCSTR , CONST DEVMODEA FAR *);
+;;HDC     WINAPI CreateICW(LPCWSTR, LPCWSTR , LPCWSTR , CONST DEVMODEW FAR *);
+;;#ifdef UNICODE
+;;#define CreateIC  CreateICW
+;;#else
+;;#define CreateIC  CreateICA
+;;#endif // !UNICODE
+;;HDC     WINAPI CreateMetaFileA(LPCSTR);
+;;HDC     WINAPI CreateMetaFileW(LPCWSTR);
+;;#ifdef UNICODE
+;;#define CreateMetaFile  CreateMetaFileW
+;;#else
+;;#define CreateMetaFile  CreateMetaFileA
+;;#endif // !UNICODE
+;;HPALETTE WINAPI CreatePalette(CONST LOGPALETTE *);
+;;HPEN    WINAPI CreatePen(int, int, COLORREF);
+;;HPEN    WINAPI CreatePenIndirect(LPLOGPEN);
+;;HRGN    WINAPI CreatePolyPolygonRgn(CONST POINT *, CONST INT *, int, int);
+;;HBRUSH  WINAPI CreatePatternBrush(HBITMAP);
+;;HRGN    WINAPI CreateRectRgn(int, int, int, int);
+;;HRGN    WINAPI CreateRectRgnIndirect(CONST RECT *);
+;;HRGN    WINAPI CreateRoundRectRgn(int, int, int, int, int, int);
+;;BOOL    WINAPI CreateScalableFontResourceA(DWORD, LPCSTR, LPCSTR, LPSTR);
+;;BOOL    WINAPI CreateScalableFontResourceW(DWORD, LPCWSTR, LPCWSTR, LPWSTR);
+;;#ifdef UNICODE
+;;#define CreateScalableFontResource  CreateScalableFontResourceW
+;;#else
+;;#define CreateScalableFontResource  CreateScalableFontResourceA
+;;#endif // !UNICODE
+;;HBRUSH  WINAPI CreateSolidBrush(COLORREF);
+;;
+;;BOOL WINAPI DeleteDC(HDC);
+;;BOOL WINAPI DeleteMetaFile(HMETAFILE);
+;;BOOL WINAPI DeleteObject(HGDIOBJ);
+;;
+;;/* define types of pointers to ExtDeviceMode() and DeviceCapabilities()
+;; * functions for Win 3.1 compatibility
+;; */
+;;
+;;typedef UINT   (CALLBACK* LPFNDEVMODE)(HWND, HMODULE, LPDEVMODE, LPSTR, LPSTR, LPDEVMODE, LPSTR, UINT);
+;;
+;;typedef DWORD  (CALLBACK* LPFNDEVCAPS)(LPSTR, LPSTR, UINT, LPSTR, LPDEVMODE);
+;;
+;;/* mode selections for the device mode function */
+(define-integrable DM_UPDATE           1)
+(define-integrable DM_COPY             2)
+(define-integrable DM_PROMPT           4)
+(define-integrable DM_MODIFY           8)
+
+(define-integrable DM_IN_BUFFER        DM_MODIFY)
+(define-integrable DM_IN_PROMPT        DM_PROMPT)
+(define-integrable DM_OUT_BUFFER       DM_COPY)
+(define-integrable DM_OUT_DEFAULT      DM_UPDATE)
+
+;;/* device capabilities indices */
+(define-integrable DC_FIELDS           1)
+(define-integrable DC_PAPERS           2)
+(define-integrable DC_PAPERSIZE        3)
+(define-integrable DC_MINEXTENT        4)
+(define-integrable DC_MAXEXTENT        5)
+(define-integrable DC_BINS             6)
+(define-integrable DC_DUPLEX           7)
+(define-integrable DC_SIZE             8)
+(define-integrable DC_EXTRA            9)
+(define-integrable DC_VERSION          10)
+(define-integrable DC_DRIVER           11)
+(define-integrable DC_BINNAMES         12)
+(define-integrable DC_ENUMRESOLUTIONS  13)
+(define-integrable DC_FILEDEPENDENCIES 14)
+(define-integrable DC_TRUETYPE         15)
+(define-integrable DC_PAPERNAMES       16)
+(define-integrable DC_ORIENTATION      17)
+(define-integrable DC_COPIES           18)
+
+;;int  WINAPI DeviceCapabilitiesExA(LPCSTR, LPCSTR, LPCSTR, int,
+;;                                  LPCSTR, LPDEVMODEA );
+;;int  WINAPI DeviceCapabilitiesExW(LPCWSTR, LPCWSTR, LPCWSTR, int,
+;;                                  LPCWSTR, LPDEVMODEW );
+;;#ifdef UNICODE
+;;#define DeviceCapabilitiesEx  DeviceCapabilitiesExW
+;;#else
+;;#define DeviceCapabilitiesEx  DeviceCapabilitiesExA
+;;#endif // !UNICODE
+;;BOOL  WINAPI Ellipse(HDC, int, int, int, int);
+;;
+;;int  WINAPI EnumFontFamiliesA(HDC, LPCSTR, FONTENUMPROC, LPARAM);
+;;int  WINAPI EnumFontFamiliesW(HDC, LPCWSTR, FONTENUMPROC, LPARAM);
+;;#ifdef UNICODE
+;;#define EnumFontFamilies  EnumFontFamiliesW
+;;#else
+;;#define EnumFontFamilies  EnumFontFamiliesA
+;;#endif // !UNICODE
+;;int  WINAPI EnumFontsA(HDC, LPCSTR,  FONTENUMPROC, LPARAM);
+;;int  WINAPI EnumFontsW(HDC, LPCWSTR,  FONTENUMPROC, LPARAM);
+;;#ifdef UNICODE
+;;#define EnumFonts  EnumFontsW
+;;#else
+;;#define EnumFonts  EnumFontsA
+;;#endif // !UNICODE
+;;
+;;#ifdef STRICT
+;;int  WINAPI EnumObjects(HDC, int, GOBJENUMPROC, LPARAM);
+;;#else
+;;int  WINAPI EnumObjects(HDC, int, GOBJENUMPROC, LPVOID);
+;;#endif
+;;
+;;BOOL WINAPI EqualRgn(HRGN, HRGN);
+;;int  WINAPI Escape(HDC, int, int, LPCSTR, LPVOID);
+;;int  WINAPI ExtEscape(HDC, int, int, LPCSTR, int, LPSTR);
+;;int  WINAPI DrawEscape(HDC, int, int, LPCSTR);
+;;int  WINAPI ExcludeClipRect(HDC, int, int, int, int);
+;;HRGN WINAPI ExtCreateRegion(LPXFORM, DWORD, LPRGNDATA);
+;;BOOL  WINAPI ExtFloodFill(HDC, int, int, COLORREF, UINT);
+;;BOOL   WINAPI FillRgn(HDC, HRGN, HBRUSH);
+;;BOOL   WINAPI FloodFill(HDC, int, int, COLORREF);
+;;BOOL   WINAPI FrameRgn(HDC, HRGN, HBRUSH, int, int);
+;;int   WINAPI GetROP2(HDC);
+;;BOOL  WINAPI GetAspectRatioFilterEx(HDC, LPSIZE);
+;;COLORREF WINAPI GetBkColor(HDC);
+;;int   WINAPI GetBkMode(HDC);
+;;LONG  WINAPI GetBitmapBits(HBITMAP, LONG, LPVOID);
+;;BOOL  WINAPI GetBitmapDimensionEx(HBITMAP, LPSIZE);
+;;UINT  WINAPI GetBoundsRect(HDC, LPRECT, UINT);
+;;
+;;BOOL  WINAPI GetBrushOrgEx(HDC, LPPOINT);
+;;
+;;BOOL  WINAPI GetCharWidthA(HDC, UINT, UINT, LPINT);
+;;BOOL  WINAPI GetCharWidthW(HDC, UINT, UINT, LPINT);
+;;#ifdef UNICODE
+;;#define GetCharWidth  GetCharWidthW
+;;#else
+;;#define GetCharWidth  GetCharWidthA
+;;#endif // !UNICODE
+;;BOOL  WINAPI GetCharWidth32A(HDC, UINT, UINT, LPINT);
+;;BOOL  WINAPI GetCharWidth32W(HDC, UINT, UINT, LPINT);
+;;#ifdef UNICODE
+;;#define GetCharWidth32  GetCharWidth32W
+;;#else
+;;#define GetCharWidth32  GetCharWidth32A
+;;#endif // !UNICODE
+;;BOOL  APIENTRY GetCharWidthFloatA(HDC, UINT, UINT, PFLOAT);
+;;BOOL  APIENTRY GetCharWidthFloatW(HDC, UINT, UINT, PFLOAT);
+;;#ifdef UNICODE
+;;#define GetCharWidthFloat  GetCharWidthFloatW
+;;#else
+;;#define GetCharWidthFloat  GetCharWidthFloatA
+;;#endif // !UNICODE
+;;
+;;BOOL  APIENTRY GetCharABCWidthsA(HDC, UINT, UINT, LPABC);
+;;BOOL  APIENTRY GetCharABCWidthsW(HDC, UINT, UINT, LPABC);
+;;#ifdef UNICODE
+;;#define GetCharABCWidths  GetCharABCWidthsW
+;;#else
+;;#define GetCharABCWidths  GetCharABCWidthsA
+;;#endif // !UNICODE
+;;BOOL  APIENTRY GetCharABCWidthsFloatA(HDC, UINT, UINT, LPABCFLOAT);
+;;BOOL  APIENTRY GetCharABCWidthsFloatW(HDC, UINT, UINT, LPABCFLOAT);
+;;#ifdef UNICODE
+;;#define GetCharABCWidthsFloat  GetCharABCWidthsFloatW
+;;#else
+;;#define GetCharABCWidthsFloat  GetCharABCWidthsFloatA
+;;#endif // !UNICODE
+;;
+;;int   WINAPI GetClipBox(HDC, LPRECT);
+;;int   WINAPI GetClipRgn(HDC, HRGN);
+;;int   WINAPI GetMetaRgn(HDC, HRGN);
+;;HGDIOBJ WINAPI GetCurrentObject(HDC, UINT);
+;;BOOL  WINAPI GetCurrentPositionEx(HDC, LPPOINT);
+;;int   WINAPI GetDeviceCaps(HDC, int);
+;;int   WINAPI GetDIBits(HDC, HBITMAP, UINT, UINT, LPVOID, LPBITMAPINFO, UINT);
+;;DWORD WINAPI GetFontData(HDC, DWORD, DWORD, LPVOID, DWORD);
+;;DWORD WINAPI GetGlyphOutline(HDC, UINT, UINT, LPGLYPHMETRICS, DWORD, LPVOID, CONST MAT2 *);
+;;int   WINAPI GetGraphicsMode(HDC);
+;;int   WINAPI GetMapMode(HDC);
+;;UINT  WINAPI GetMetaFileBitsEx(HMETAFILE, UINT, LPVOID);
+;;HMETAFILE   WINAPI GetMetaFileA(LPCSTR);
+;;HMETAFILE   WINAPI GetMetaFileW(LPCWSTR);
+;;#ifdef UNICODE
+;;#define GetMetaFile  GetMetaFileW
+;;#else
+;;#define GetMetaFile  GetMetaFileA
+;;#endif // !UNICODE
+;;COLORREF WINAPI GetNearestColor(HDC, COLORREF);
+;;UINT  WINAPI GetNearestPaletteIndex(HPALETTE, COLORREF);
+;;DWORD WINAPI GetObjectType(HGDIOBJ h);
+;;
+;;#ifndef NOTEXTMETRIC
+;;
+;;UINT APIENTRY GetOutlineTextMetricsA(HDC, UINT, LPOUTLINETEXTMETRICA);
+;;UINT APIENTRY GetOutlineTextMetricsW(HDC, UINT, LPOUTLINETEXTMETRICW);
+;;#ifdef UNICODE
+;;#define GetOutlineTextMetrics  GetOutlineTextMetricsW
+;;#else
+;;#define GetOutlineTextMetrics  GetOutlineTextMetricsA
+;;#endif // !UNICODE
+;;
+;;#endif /* NOTEXTMETRIC */
+;;
+;;UINT  WINAPI GetPaletteEntries(HPALETTE, UINT, UINT, LPPALETTEENTRY);
+;;COLORREF WINAPI GetPixel(HDC, int, int);
+;;int   WINAPI GetPolyFillMode(HDC);
+;;BOOL  WINAPI GetRasterizerCaps(LPRASTERIZER_STATUS, UINT);
+;;DWORD WINAPI GetRegionData(HRGN, DWORD, LPRGNDATA);
+;;int   WINAPI GetRgnBox(HRGN, LPRECT);
+;;HGDIOBJ WINAPI GetStockObject(int);
+;;int   WINAPI GetStretchBltMode(HDC);
+;;UINT  WINAPI GetSystemPaletteEntries(HDC, UINT, UINT, LPPALETTEENTRY);
+;;UINT  WINAPI GetSystemPaletteUse(HDC);
+;;int   WINAPI GetTextCharacterExtra(HDC);
+;;UINT  WINAPI GetTextAlign(HDC);
+;;COLORREF WINAPI GetTextColor(HDC);
+;;
+;;BOOL  APIENTRY GetTextExtentPointA(
+;;                    HDC,
+;;                    LPCSTR,
+;;                    int,
+;;                    LPSIZE
+;;                    );
+;;BOOL  APIENTRY GetTextExtentPointW(
+;;                    HDC,
+;;                    LPCWSTR,
+;;                    int,
+;;                    LPSIZE
+;;                    );
+;;#ifdef UNICODE
+;;#define GetTextExtentPoint  GetTextExtentPointW
+;;#else
+;;#define GetTextExtentPoint  GetTextExtentPointA
+;;#endif // !UNICODE
+;;
+;;BOOL  APIENTRY GetTextExtentPoint32A(
+;;                    HDC,
+;;                    LPCSTR,
+;;                    int,
+;;                    LPSIZE
+;;                    );
+;;BOOL  APIENTRY GetTextExtentPoint32W(
+;;                    HDC,
+;;                    LPCWSTR,
+;;                    int,
+;;                    LPSIZE
+;;                    );
+;;#ifdef UNICODE
+;;#define GetTextExtentPoint32  GetTextExtentPoint32W
+;;#else
+;;#define GetTextExtentPoint32  GetTextExtentPoint32A
+;;#endif // !UNICODE
+;;
+;;BOOL  APIENTRY GetTextExtentExPointA(
+;;                    HDC,
+;;                    LPCSTR,
+;;                    int,
+;;                    int,
+;;                    LPINT,
+;;                    LPINT,
+;;                    LPSIZE
+;;                    );
+;;BOOL  APIENTRY GetTextExtentExPointW(
+;;                    HDC,
+;;                    LPCWSTR,
+;;                    int,
+;;                    int,
+;;                    LPINT,
+;;                    LPINT,
+;;                    LPSIZE
+;;                    );
+;;#ifdef UNICODE
+;;#define GetTextExtentExPoint  GetTextExtentExPointW
+;;#else
+;;#define GetTextExtentExPoint  GetTextExtentExPointA
+;;#endif // !UNICODE
+;;
+;;BOOL  WINAPI GetViewportExtEx(HDC, LPSIZE);
+;;BOOL  WINAPI GetViewportOrgEx(HDC, LPPOINT);
+;;BOOL  WINAPI GetWindowExtEx(HDC, LPSIZE);
+;;BOOL  WINAPI GetWindowOrgEx(HDC, LPPOINT);
+;;
+;;int  WINAPI IntersectClipRect(HDC, int, int, int, int);
+;;BOOL WINAPI InvertRgn(HDC, HRGN);
+;;BOOL WINAPI LineDDA(int, int, int, int, LINEDDAPROC, LPARAM);
+;;BOOL WINAPI LineTo(HDC, int, int);
+;;BOOL WINAPI MaskBlt(HDC, int, int, int, int,
+;;              HDC, int, int, HBITMAP, int, int, DWORD);
+;;BOOL WINAPI PlgBlt(HDC, LPPOINT, HDC, int, int, int,
+;;                     int, HBITMAP, int, int);
+;;
+;;int  WINAPI OffsetClipRgn(HDC, int, int);
+;;int  WINAPI OffsetRgn(HRGN, int, int);
+;;BOOL WINAPI PatBlt(HDC, int, int, int, int, DWORD);
+;;BOOL WINAPI Pie(HDC, int, int, int, int, int, int, int, int);
+;;BOOL WINAPI PlayMetaFile(HDC, HMETAFILE);
+;;BOOL WINAPI PaintRgn(HDC, HRGN);
+;;BOOL WINAPI PolyPolygon(HDC, CONST POINT *, LPINT, int);
+;;BOOL WINAPI PtInRegion(HRGN, int, int);
+;;BOOL WINAPI PtVisible(HDC, int, int);
+;;BOOL WINAPI RectInRegion(HRGN, CONST RECT *);
+;;BOOL WINAPI RectVisible(HDC, CONST RECT *);
+;;BOOL WINAPI Rectangle(HDC, int, int, int, int);
+;;BOOL WINAPI RestoreDC(HDC, int);
+;;HDC  WINAPI ResetDCA(HDC, CONST DEVMODEA *);
+;;HDC  WINAPI ResetDCW(HDC, CONST DEVMODEW *);
+;;#ifdef UNICODE
+;;#define ResetDC  ResetDCW
+;;#else
+;;#define ResetDC  ResetDCA
+;;#endif // !UNICODE
+;;UINT WINAPI RealizePalette(HDC);
+;;BOOL WINAPI RemoveFontModule(HMODULE);
+;;BOOL WINAPI RemoveFontResourceA(LPSTR);
+;;BOOL WINAPI RemoveFontResourceW(LPWSTR);
+;;#ifdef UNICODE
+;;#define RemoveFontResource  RemoveFontResourceW
+;;#else
+;;#define RemoveFontResource  RemoveFontResourceA
+;;#endif // !UNICODE
+;;BOOL  WINAPI RoundRect(HDC, int, int, int, int, int, int);
+;;BOOL WINAPI ResizePalette(HPALETTE, UINT);
+;;
+;;int  WINAPI SaveDC(HDC);
+;;int  WINAPI SelectClipRgn(HDC, HRGN);
+;;int  WINAPI ExtSelectClipRgn(HDC, HRGN, int);
+;;int  WINAPI SetMetaRgn(HDC);
+;;HGDIOBJ WINAPI SelectObject(HDC, HGDIOBJ);
+;;HPALETTE WINAPI SelectPalette(HDC, HPALETTE, BOOL);
+;;COLORREF WINAPI SetBkColor(HDC, COLORREF);
+;;int   WINAPI SetBkMode(HDC, int);
+;;LONG  WINAPI SetBitmapBits(HBITMAP, DWORD, CONST VOID *);
+;;
+;;UINT  WINAPI SetBoundsRect(HDC, CONST RECT *, UINT);
+;;int   WINAPI SetDIBits(HDC, HBITMAP, UINT, UINT, CONST VOID *, LPBITMAPINFO, UINT);
+;;int   WINAPI SetDIBitsToDevice(HDC, int, int, DWORD, DWORD, int, int, UINT, UINT, LPVOID, LPBITMAPINFO, UINT);
+;;DWORD WINAPI SetMapperFlags(HDC, DWORD);
+;;int   WINAPI SetGraphicsMode(HDC hdc, int iMode);
+;;int   WINAPI SetMapMode(HDC, int);
+;;HMETAFILE   WINAPI SetMetaFileBitsEx(UINT, LPBYTE);
+;;UINT  WINAPI SetPaletteEntries(HPALETTE, UINT, UINT, CONST PALETTEENTRY *);
+;;COLORREF WINAPI SetPixel(HDC, int, int, COLORREF);
+;;BOOL   WINAPI SetPixelV(HDC, int, int, COLORREF);
+;;int   WINAPI SetPolyFillMode(HDC, int);
+;;BOOL   WINAPI StretchBlt(HDC, int, int, int, int, HDC, int, int, int, int, DWORD);
+;;BOOL   WINAPI SetRectRgn(HRGN, int, int, int, int);
+;;int   WINAPI StretchDIBits(HDC, int, int, int, int, int, int, int, int, CONST
+;;        VOID *, LPBITMAPINFO, UINT, DWORD);
+;;int   WINAPI SetROP2(HDC, int);
+;;int   WINAPI SetStretchBltMode(HDC, int);
+;;UINT  WINAPI SetSystemPaletteUse(HDC, UINT);
+;;int   WINAPI SetTextCharacterExtra(HDC, int);
+;;COLORREF WINAPI SetTextColor(HDC, COLORREF);
+;;UINT  WINAPI SetTextAlign(HDC, UINT);
+;;BOOL  WINAPI SetTextJustification(HDC, int, int);
+;;BOOL  WINAPI UpdateColors(HDC);
+;;
+;;#ifndef NOMETAFILE
+;;
+;;BOOL  WINAPI PlayMetaFileRecord(HDC, LPHANDLETABLE, LPMETARECORD, UINT);
+;;typedef int (CALLBACK* MFENUMPROC)(HDC, HANDLETABLE FAR*, METARECORD FAR*, int, LPARAM);
+;;BOOL  WINAPI EnumMetaFile(HDC, HMETAFILE, MFENUMPROC, LPARAM);
+;;
+;;typedef int (CALLBACK* ENHMFENUMPROC)(HDC, HANDLETABLE FAR*, ENHMETARECORD FAR*, int, LPARAM);
+;;
+;;// Enhanced Metafile Function Declarations
+;;
+;;HENHMETAFILE WINAPI CloseEnhMetaFile(HDC);
+;;HENHMETAFILE WINAPI CopyEnhMetaFileA(HENHMETAFILE, LPSTR);
+;;HENHMETAFILE WINAPI CopyEnhMetaFileW(HENHMETAFILE, LPWSTR);
+;;#ifdef UNICODE
+;;#define CopyEnhMetaFile  CopyEnhMetaFileW
+;;#else
+;;#define CopyEnhMetaFile  CopyEnhMetaFileA
+;;#endif // !UNICODE
+;;HDC   WINAPI CreateEnhMetaFileA(HDC, LPSTR, LPRECT, LPSTR);
+;;HDC   WINAPI CreateEnhMetaFileW(HDC, LPWSTR, LPRECT, LPWSTR);
+;;#ifdef UNICODE
+;;#define CreateEnhMetaFile  CreateEnhMetaFileW
+;;#else
+;;#define CreateEnhMetaFile  CreateEnhMetaFileA
+;;#endif // !UNICODE
+;;BOOL  WINAPI DeleteEnhMetaFile(HENHMETAFILE);
+;;BOOL  WINAPI EnumEnhMetaFile(HDC, HENHMETAFILE, ENHMFENUMPROC, LPVOID, LPRECT);
+;;HENHMETAFILE  WINAPI GetEnhMetaFileA(LPSTR);
+;;HENHMETAFILE  WINAPI GetEnhMetaFileW(LPWSTR);
+;;#ifdef UNICODE
+;;#define GetEnhMetaFile  GetEnhMetaFileW
+;;#else
+;;#define GetEnhMetaFile  GetEnhMetaFileA
+;;#endif // !UNICODE
+;;UINT  WINAPI GetEnhMetaFileBits(HENHMETAFILE, UINT, LPBYTE);
+;;UINT  WINAPI GetEnhMetaFileDescriptionA(HENHMETAFILE, UINT, LPSTR );
+;;UINT  WINAPI GetEnhMetaFileDescriptionW(HENHMETAFILE, UINT, LPWSTR );
+;;#ifdef UNICODE
+;;#define GetEnhMetaFileDescription  GetEnhMetaFileDescriptionW
+;;#else
+;;#define GetEnhMetaFileDescription  GetEnhMetaFileDescriptionA
+;;#endif // !UNICODE
+;;UINT  WINAPI GetEnhMetaFileHeader(HENHMETAFILE, UINT, LPENHMETAHEADER );
+;;UINT  WINAPI GetEnhMetaFilePaletteEntries(HENHMETAFILE, UINT, LPPALETTEENTRY );
+;;UINT  WINAPI GetWinMetaFileBits(HENHMETAFILE, UINT, LPBYTE, INT, HDC);
+;;BOOL  WINAPI PlayEnhMetaFile(HDC, HENHMETAFILE, LPRECT);
+;;BOOL  WINAPI PlayEnhMetaFileRecord(HDC, LPHANDLETABLE, LPENHMETARECORD, UINT);
+;;HENHMETAFILE  WINAPI SetEnhMetaFileBits(UINT, LPBYTE);
+;;HENHMETAFILE  WINAPI SetWinMetaFileBits(UINT, LPBYTE, HDC, LPMETAFILEPICT);
+;;BOOL  WINAPI GdiComment(HDC, UINT, LPBYTE);
+;;
+;;#endif  /* NOMETAFILE */
+;;
+;;#ifndef NOTEXTMETRIC
+;;
+;;BOOL WINAPI GetTextMetricsA(HDC, LPTEXTMETRICA);
+;;BOOL WINAPI GetTextMetricsW(HDC, LPTEXTMETRICW);
+;;#ifdef UNICODE
+;;#define GetTextMetrics  GetTextMetricsW
+;;#else
+;;#define GetTextMetrics  GetTextMetricsA
+;;#endif // !UNICODE
+;;
+;;#endif
+;;
+;;/* new GDI */
+;;BOOL WINAPI AngleArc(HDC, int, int, DWORD, FLOAT, FLOAT);
+;;BOOL WINAPI PolyPolyline(HDC, LPPOINT, LPDWORD, DWORD);
+;;BOOL WINAPI GetWorldTransform(HDC, LPXFORM);
+;;BOOL WINAPI SetWorldTransform(HDC, LPXFORM);
+;;BOOL WINAPI ModifyWorldTransform(HDC, LPXFORM , DWORD);
+;;BOOL WINAPI CombineTransform(LPXFORM, LPXFORM, LPXFORM);
+;;
+;;/* Flags value for COLORADJUSTMENT */
+(define-integrable CA_NEGATIVE                 #x0001)
+(define-integrable CA_LOG_FILTER               #x0002)
+;;
+;;/* IlluminantIndex values */
+(define-integrable ILLUMINANT_DEVICE_DEFAULT   0)
+(define-integrable ILLUMINANT_A                1)
+(define-integrable ILLUMINANT_B                2)
+(define-integrable ILLUMINANT_C                3)
+(define-integrable ILLUMINANT_D50              4)
+(define-integrable ILLUMINANT_D55              5)
+(define-integrable ILLUMINANT_D65              6)
+(define-integrable ILLUMINANT_D75              7)
+(define-integrable ILLUMINANT_F2               8)
+(define-integrable ILLUMINANT_MAX_INDEX        ILLUMINANT_F2)
+
+(define-integrable ILLUMINANT_TUNGSTEN         ILLUMINANT_A)
+(define-integrable ILLUMINANT_DAYLIGHT         ILLUMINANT_C)
+(define-integrable ILLUMINANT_FLUORESCENT      ILLUMINANT_F2)
+(define-integrable ILLUMINANT_NTSC             ILLUMINANT_C)
+;;
+;;/* Min and max for RedGamma, GreenGamma, BlueGamma */
+(define-integrable RGB_GAMMA_MIN               02500)  ;(WORD)02500
+(define-integrable RGB_GAMMA_MAX               65000)
+;;
+;;/* Min and max for ReferenceBlack and ReferenceWhite */
+(define-integrable REFERENCE_WHITE_MIN         6000)   ;(WORD)6000
+(define-integrable REFERENCE_WHITE_MAX         10000)  ;(WORD)10000
+(define-integrable REFERENCE_BLACK_MIN         0)      ;(WORD)0
+(define-integrable REFERENCE_BLACK_MAX         4000)   ;(WORD)4000
+;;
+;;/* Min and max for Contrast, Brightness, Colorfulness, RedGreenTint */
+(define-integrable COLOR_ADJ_MIN               -100)   ;(SHORT)-100
+(define-integrable COLOR_ADJ_MAX               100)    ;(SHORT)100
+;;
+;;typedef struct  tagCOLORADJUSTMENT {
+;;    WORD   caSize;
+;;    WORD   caFlags;
+;;    WORD   caIlluminantIndex;
+;;    WORD   caRedGamma;
+;;    WORD   caGreenGamma;
+;;    WORD   caBlueGamma;
+;;    WORD   caReferenceBlack;
+;;    WORD   caReferenceWhite;
+;;    SHORT  caContrast;
+;;    SHORT  caBrightness;
+;;    SHORT  caColorfulness;
+;;    SHORT  caRedGreenTint;
+;;} COLORADJUSTMENT, *PCOLORADJUSTMENT, FAR *LPCOLORADJUSTMENT;
+;;
+;;BOOL WINAPI SetColorAdjustment(HDC, LPCOLORADJUSTMENT);
+;;BOOL WINAPI GetColorAdjustment(HDC, LPCOLORADJUSTMENT);
+;;HPALETTE WINAPI CreateHalftonePalette(HDC);
+;;
+;;#ifdef STRICT
+;;typedef BOOL (CALLBACK* ABORTPROC)(HDC, int);
+;;#else
+;;typedef FARPROC ABORTPROC;
+;;#endif
+;;
+;;typedef struct _DOCINFOA {
+;;    int     cbSize;
+;;    LPCSTR   lpszDocName;
+;;    LPCSTR   lpszOutput;
+;;} DOCINFOA, *LPDOCINFOA;
+;;typedef struct _DOCINFOW {
+;;    int     cbSize;
+;;    LPCWSTR  lpszDocName;
+;;    LPCWSTR  lpszOutput;
+;;} DOCINFOW, *LPDOCINFOW;
+;;#ifdef UNICODE
+;;typedef DOCINFOW DOCINFO;
+;;typedef LPDOCINFOW LPDOCINFO;
+;;#else
+;;typedef DOCINFOA DOCINFO;
+;;typedef LPDOCINFOA LPDOCINFO;
+;;#endif // UNICODE
+;;
+;;int WINAPI StartDocA(HDC, LPDOCINFOA);
+;;int WINAPI StartDocW(HDC, LPDOCINFOW);
+;;#ifdef UNICODE
+;;#define StartDoc  StartDocW
+;;#else
+;;#define StartDoc  StartDocA
+;;#endif // !UNICODE
+;;int WINAPI EndDoc(HDC);
+;;int WINAPI StartPage(HDC);
+;;int WINAPI EndPage(HDC);
+;;int WINAPI AbortDoc(HDC);
+;;int WINAPI SetAbortProc(HDC, ABORTPROC);
+;;
+;;BOOL WINAPI AbortPath(HDC);
+;;BOOL WINAPI ArcTo(HDC, int, int, int, int, int, int,int, int);
+;;BOOL WINAPI BeginPath(HDC);
+;;BOOL WINAPI CloseFigure(HDC);
+;;BOOL WINAPI EndPath(HDC);
+;;BOOL WINAPI FillPath(HDC);
+;;BOOL WINAPI FlattenPath(HDC);
+;;int  WINAPI GetPath(HDC, LPPOINT, LPBYTE, int);
+;;HRGN WINAPI PathToRegion(HDC);
+;;BOOL WINAPI PolyDraw(HDC, LPPOINT, LPBYTE, int);
+;;BOOL WINAPI SelectClipPath(HDC, int);
+;;int  WINAPI SetArcDirection(HDC, int);
+;;BOOL WINAPI SetMiterLimit(HDC, FLOAT, PFLOAT);
+;;BOOL WINAPI StrokeAndFillPath(HDC);
+;;BOOL WINAPI StrokePath(HDC);
+;;BOOL WINAPI WidenPath(HDC);
+;;HPEN WINAPI ExtCreatePen(DWORD, DWORD, LPLOGBRUSH, DWORD, LPDWORD);
+;;BOOL WINAPI GetMiterLimit(HDC, PFLOAT);
+;;int  WINAPI GetArcDirection(HDC);
+;;
+;;int   WINAPI GetObjectA(HGDIOBJ, int, LPVOID);
+;;int   WINAPI GetObjectW(HGDIOBJ, int, LPVOID);
+;;#ifdef UNICODE
+;;#define GetObject  GetObjectW
+;;#else
+;;#define GetObject  GetObjectA
+;;#endif // !UNICODE
+;;BOOL  WINAPI MoveToEx(HDC, int, int, LPPOINT);
+;;BOOL  WINAPI TextOutA(HDC, int, int, LPCSTR, int);
+;;BOOL  WINAPI TextOutW(HDC, int, int, LPCWSTR, int);
+;;#ifdef UNICODE
+;;#define TextOut  TextOutW
+;;#else
+;;#define TextOut  TextOutA
+;;#endif // !UNICODE
+;;BOOL  WINAPI ExtTextOutA(HDC, int, int, UINT, CONST RECT *, LPCSTR, UINT, LPINT);
+;;BOOL  WINAPI ExtTextOutW(HDC, int, int, UINT, CONST RECT *, LPCWSTR, UINT, LPINT);
+;;#ifdef UNICODE
+;;#define ExtTextOut  ExtTextOutW
+;;#else
+;;#define ExtTextOut  ExtTextOutA
+;;#endif // !UNICODE
+;;BOOL  WINAPI PolyTextOutA(HDC, POLYTEXTA *, int);
+;;BOOL  WINAPI PolyTextOutW(HDC, POLYTEXTW *, int);
+;;#ifdef UNICODE
+;;#define PolyTextOut  PolyTextOutW
+;;#else
+;;#define PolyTextOut  PolyTextOutA
+;;#endif // !UNICODE
+;;
+;;HRGN  WINAPI CreatePolygonRgn(CONST POINT *, int, int);
+;;BOOL  WINAPI DPtoLP(HDC, LPPOINT, int);
+;;BOOL  WINAPI LPtoDP(HDC, LPPOINT, int);
+;;BOOL  WINAPI Polygon(HDC, CONST POINT *, int);
+;;BOOL  WINAPI Polyline(HDC, CONST POINT *, int);
+;;
+;;BOOL  WINAPI PolyBezier(HDC, LPPOINT, DWORD);
+;;BOOL  WINAPI PolyBezierTo(HDC, LPPOINT, DWORD);
+;;BOOL  WINAPI PolylineTo(HDC, LPPOINT, DWORD);
+;;
+;;BOOL  WINAPI SetViewportExtEx(HDC, int, int, LPSIZE);
+;;BOOL  WINAPI SetViewportOrgEx(HDC, int, int, LPPOINT);
+;;BOOL  WINAPI SetWindowExtEx(HDC, int, int, LPSIZE);
+;;BOOL  WINAPI SetWindowOrgEx(HDC, int, int, LPPOINT);
+;;
+;;BOOL  WINAPI OffsetViewportOrgEx(HDC, int, int, LPPOINT);
+;;BOOL  WINAPI OffsetWindowOrgEx(HDC, int, int, LPPOINT);
+;;BOOL  WINAPI ScaleViewportExtEx(HDC, int, int, int, int, LPSIZE);
+;;BOOL  WINAPI ScaleWindowExtEx(HDC, int, int, int, int, LPSIZE);
+;;BOOL  WINAPI SetBitmapDimensionEx(HBITMAP, int, int, LPSIZE);
+;;BOOL  WINAPI SetBrushOrgEx(HDC, int, int, LPPOINT);
+;;
+;;int   WINAPI GetTextFaceA(HDC, int, LPSTR);
+;;int   WINAPI GetTextFaceW(HDC, int, LPWSTR);
+;;#ifdef UNICODE
+;;#define GetTextFace  GetTextFaceW
+;;#else
+;;#define GetTextFace  GetTextFaceA
+;;#endif // !UNICODE
+;;
+;;#define FONTMAPPER_MAX 10
+;;
+;;HFONT  WINAPI ExtCreateFontIndirectA(LPEXTLOGFONTA);
+;;HFONT  WINAPI ExtCreateFontIndirectW(LPEXTLOGFONTW);
+;;#ifdef UNICODE
+;;#define ExtCreateFontIndirect  ExtCreateFontIndirectW
+;;#else
+;;#define ExtCreateFontIndirect  ExtCreateFontIndirectA
+;;#endif // !UNICODE
+;;typedef struct tagKERNINGPAIR {
+;;   WORD wFirst;
+;;   WORD wSecond;
+;;   int  iKernAmount;
+;;} KERNINGPAIR, *LPKERNINGPAIR;
+;;
+;;DWORD WINAPI GetKerningPairs(HDC, DWORD, LPKERNINGPAIR);
+;;
+;;DWORD WINAPI GetDCOrg(HDC);
+;;BOOL  WINAPI FixBrushOrgEx(HDC,int,int,LPPOINT);
+;;BOOL  WINAPI UnrealizeObject(HGDIOBJ);
+;;
+;;BOOL  WINAPI GdiFlush();
+;;DWORD WINAPI GdiSetBatchLimit(DWORD);
+;;DWORD WINAPI GdiGetBatchLimit();
+;;
+;;#ifndef NOMETAFILE
+;;
+;;// Enhanced metafile constants.
+;;
+;;#define ENHMETA_SIGNATURE    0x464D4520
+;;
+;;// Stock object flag used in the object handle index in the enhanced
+;;// metafile records.
+;;// E.g. The object handle index (META_STOCK_OBJECT | BLACK_BRUSH)
+;;// represents the stock object BLACK_BRUSH.
+;;
+;;#define ENHMETA_STOCK_OBJECT 0x80000000
+;;
+;;// Enhanced metafile record types.
+;;
+(define-integrable EMR_HEADER                  1)
+(define-integrable EMR_POLYBEZIER                      2)
+(define-integrable EMR_POLYGON                 3)
+(define-integrable EMR_POLYLINE                        4)
+(define-integrable EMR_POLYBEZIERTO            5)
+(define-integrable EMR_POLYLINETO                      6)
+(define-integrable EMR_POLYPOLYLINE            7)
+(define-integrable EMR_POLYPOLYGON                     8)
+(define-integrable EMR_SETWINDOWEXTEX          9)
+(define-integrable EMR_SETWINDOWORGEX          10)
+(define-integrable EMR_SETVIEWPORTEXTEX                11)
+(define-integrable EMR_SETVIEWPORTORGEX                12)
+(define-integrable EMR_SETBRUSHORGEX           13)
+(define-integrable EMR_EOF                             14)
+(define-integrable EMR_SETPIXELV                       15)
+(define-integrable EMR_SETMAPPERFLAGS          16)
+(define-integrable EMR_SETMAPMODE                      17)
+(define-integrable EMR_SETBKMODE                       18)
+(define-integrable EMR_SETPOLYFILLMODE         19)
+(define-integrable EMR_SETROP2                 20)
+(define-integrable EMR_SETSTRETCHBLTMODE               21)
+(define-integrable EMR_SETTEXTALIGN            22)
+(define-integrable EMR_SETCOLORADJUSTMENT              23)
+(define-integrable EMR_SETTEXTCOLOR            24)
+(define-integrable EMR_SETBKCOLOR                      25)
+(define-integrable EMR_OFFSETCLIPRGN           26)
+(define-integrable EMR_MOVETOEX                        27)
+(define-integrable EMR_SETMETARGN                      28)
+(define-integrable EMR_EXCLUDECLIPRECT         29)
+(define-integrable EMR_INTERSECTCLIPRECT               30)
+(define-integrable EMR_SCALEVIEWPORTEXTEX              31)
+(define-integrable EMR_SCALEWINDOWEXTEX                32)
+(define-integrable EMR_SAVEDC                  33)
+(define-integrable EMR_RESTOREDC                       34)
+(define-integrable EMR_SETWORLDTRANSFORM               35)
+(define-integrable EMR_MODIFYWORLDTRANSFORM    36)
+(define-integrable EMR_SELECTOBJECT            37)
+(define-integrable EMR_CREATEPEN                       38)
+(define-integrable EMR_CREATEBRUSHINDIRECT             39)
+(define-integrable EMR_DELETEOBJECT            40)
+(define-integrable EMR_ANGLEARC                        41)
+(define-integrable EMR_ELLIPSE                 42)
+(define-integrable EMR_RECTANGLE                       43)
+(define-integrable EMR_ROUNDRECT                       44)
+(define-integrable EMR_ARC                             45)
+(define-integrable EMR_CHORD                   46)
+(define-integrable EMR_PIE                             47)
+(define-integrable EMR_SELECTPALETTE           48)
+(define-integrable EMR_CREATEPALETTE           49)
+(define-integrable EMR_SETPALETTEENTRIES               50)
+(define-integrable EMR_RESIZEPALETTE           51)
+(define-integrable EMR_REALIZEPALETTE          52)
+(define-integrable EMR_EXTFLOODFILL            53)
+(define-integrable EMR_LINETO                  54)
+(define-integrable EMR_ARCTO                   55)
+(define-integrable EMR_POLYDRAW                        56)
+(define-integrable EMR_SETARCDIRECTION         57)
+(define-integrable EMR_SETMITERLIMIT           58)
+(define-integrable EMR_BEGINPATH                       59)
+(define-integrable EMR_ENDPATH                 60)
+(define-integrable EMR_CLOSEFIGURE                     61)
+(define-integrable EMR_FILLPATH                        62)
+(define-integrable EMR_STROKEANDFILLPATH               63)
+(define-integrable EMR_STROKEPATH                      64)
+(define-integrable EMR_FLATTENPATH                     65)
+(define-integrable EMR_WIDENPATH                       66)
+(define-integrable EMR_SELECTCLIPPATH          67)
+(define-integrable EMR_ABORTPATH                       68)
+
+(define-integrable EMR_GDICOMMENT                      70)
+(define-integrable EMR_FILLRGN                 71)
+(define-integrable EMR_FRAMERGN                        72)
+(define-integrable EMR_INVERTRGN                       73)
+(define-integrable EMR_PAINTRGN                        74)
+(define-integrable EMR_EXTSELECTCLIPRGN                75)
+(define-integrable EMR_BITBLT                  76)
+(define-integrable EMR_STRETCHBLT                      77)
+(define-integrable EMR_MASKBLT                 78)
+(define-integrable EMR_PLGBLT                  79)
+(define-integrable EMR_SETDIBITSTODEVICE               80)
+(define-integrable EMR_STRETCHDIBITS           81)
+(define-integrable EMR_EXTCREATEFONTINDIRECTW  82)
+(define-integrable EMR_EXTTEXTOUTA             83)
+(define-integrable EMR_EXTTEXTOUTW             84)
+(define-integrable EMR_POLYBEZIER16            85)
+(define-integrable EMR_POLYGON16                       86)
+(define-integrable EMR_POLYLINE16                      87)
+(define-integrable EMR_POLYBEZIERTO16          88)
+(define-integrable EMR_POLYLINETO16            89)
+(define-integrable EMR_POLYPOLYLINE16          90)
+(define-integrable EMR_POLYPOLYGON16           91)
+(define-integrable EMR_POLYDRAW16                      92)
+(define-integrable EMR_CREATEMONOBRUSH         93)
+(define-integrable EMR_CREATEDIBPATTERNBRUSHPT 94)
+(define-integrable EMR_EXTCREATEPEN            95)
+(define-integrable EMR_POLYTEXTOUTA            96)
+(define-integrable EMR_POLYTEXTOUTW            97)
+
+(define-integrable EMR_MIN                             1)
+(define-integrable EMR_MAX                             97)
+
+;;// Base record type for the enhanced metafile.
+;;
+;;typedef struct tagEMR
+;;{
+;;    DWORD   iType;           // Enhanced metafile record type
+;;    DWORD   nSize;           // Length of the record in bytes.
+;;                             // This must be a multiple of 4.
+;;} EMR, *PEMR;
+;;
+;;// Base text record type for the enhanced metafile.
+;;
+;;typedef struct tagEMRTEXT
+;;{
+;;    POINTL  ptlReference;
+;;    DWORD   nChars;
+;;    DWORD   offString;               // Offset to the string
+;;    DWORD   fOptions;
+;;    RECTL   rcl;
+;;    DWORD   offDx;           // Offset to the inter-character spacing array.
+;;                             // This is always given.
+;;} EMRTEXT, *PEMRTEXT;
+;;
+;;// Record structures for the enhanced metafile.
+;;
+;;typedef struct tagABORTPATH
+;;{
+;;    EMR     emr;
+;;} EMRABORTPATH,      *PEMRABORTPATH,
+;;  EMRBEGINPATH,      *PEMRBEGINPATH,
+;;  EMRENDPATH,        *PEMRENDPATH,
+;;  EMRCLOSEFIGURE,    *PEMRCLOSEFIGURE,
+;;  EMRFLATTENPATH,    *PEMRFLATTENPATH,
+;;  EMRWIDENPATH,      *PEMRWIDENPATH,
+;;  EMRSETMETARGN,     *PEMRSETMETARGN,
+;;  EMRSAVEDC,         *PEMRSAVEDC,
+;;  EMRREALIZEPALETTE, *PEMRREALIZEPALETTE;
+;;
+;;typedef struct tagEMRSELECTCLIPPATH
+;;{
+;;    EMR     emr;
+;;    DWORD   iMode;
+;;} EMRSELECTCLIPPATH,    *PEMRSELECTCLIPPATH,
+;;  EMRSETBKMODE,         *PEMRSETBKMODE,
+;;  EMRSETMAPMODE,        *PEMRSETMAPMODE,
+;;  EMRSETPOLYFILLMODE,   *PEMRSETPOLYFILLMODE,
+;;  EMRSETROP2,           *PEMRSETROP2,
+;;  EMRSETSTRETCHBLTMODE, *PEMRSETSTRETCHBLTMODE,
+;;  EMRSETTEXTALIGN,      *PEMRSETTEXTALIGN;
+;;
+;;typedef struct tagEMRSETMITERLIMIT
+;;{
+;;    EMR     emr;
+;;    FLOAT   eMiterLimit;
+;;} EMRSETMITERLIMIT, *PEMRSETMITERLIMIT;
+;;
+;;typedef struct tagEMRRESTOREDC
+;;{
+;;    EMR     emr;
+;;    LONG    iRelative;               // Specifies a relative instance
+;;} EMRRESTOREDC, *PEMRRESTOREDC;
+;;
+;;typedef struct tagEMRSETARCDIRECTION
+;;{
+;;    EMR     emr;
+;;    DWORD   iArcDirection;   // Specifies the arc direction in the
+;;                             // advanced graphics mode.
+;;} EMRSETARCDIRECTION, *PEMRSETARCDIRECTION;
+;;
+;;typedef struct tagEMRSETMAPPERFLAGS
+;;{
+;;    EMR     emr;
+;;    DWORD   dwFlags;
+;;} EMRSETMAPPERFLAGS, *PEMRSETMAPPERFLAGS;
+;;
+;;typedef struct tagEMRSETTEXTCOLOR
+;;{
+;;    EMR     emr;
+;;    COLORREF crColor;
+;;} EMRSETBKCOLOR,   *PEMRSETBKCOLOR,
+;;  EMRSETTEXTCOLOR, *PEMRSETTEXTCOLOR;
+;;
+;;typedef struct tagEMRSELECTOBJECT
+;;{
+;;    EMR     emr;
+;;    DWORD   ihObject;                // Object handle index
+;;} EMRSELECTOBJECT, *PEMRSELECTOBJECT,
+;;  EMRDELETEOBJECT, *PEMRDELETEOBJECT;
+;;
+;;typedef struct tagEMRSELECTPALETTE
+;;{
+;;    EMR     emr;
+;;    DWORD   ihPal;           // Palette handle index, background mode only
+;;} EMRSELECTPALETTE, *PEMRSELECTPALETTE;
+;;
+;;typedef struct tagEMRRESIZEPALETTE
+;;{
+;;    EMR     emr;
+;;    DWORD   ihPal;           // Palette handle index
+;;    DWORD   cEntries;
+;;} EMRRESIZEPALETTE, *PEMRRESIZEPALETTE;
+;;
+;;typedef struct tagEMRSETPALETTEENTRIES
+;;{
+;;    EMR     emr;
+;;    DWORD   ihPal;           // Palette handle index
+;;    DWORD   iStart;
+;;    DWORD   cEntries;
+;;    PALETTEENTRY aPalEntries[1];// The peFlags fields do not contain any flags
+;;} EMRSETPALETTEENTRIES, *PEMRSETPALETTEENTRIES;
+;;
+;;typedef struct tagEMRSETCOLORADJUSTMENT
+;;{
+;;    EMR     emr;
+;;    COLORADJUSTMENT ColorAdjustment;
+;;} EMRSETCOLORADJUSTMENT, *PEMRSETCOLORADJUSTMENT;
+;;
+;;typedef struct tagEMRGDICOMMENT
+;;{
+;;    EMR     emr;
+;;    DWORD   cbData;          // Size of data in bytes
+;;    BYTE    Data[1];
+;;} EMRGDICOMMENT, *PEMRGDICOMMENT;
+;;
+;;typedef struct tagEMREOF
+;;{
+;;    EMR     emr;
+;;    DWORD   nPalEntries;     // Number of palette entries
+;;    DWORD   offPalEntries;   // Offset to the palette entries
+;;    DWORD   nSizeLast;               // Same as nSize and must be the last DWORD
+;;                             // of the record.  The palette entries,
+;;                             // if exist, precede this field.
+;;} EMREOF, *PEMREOF;
+;;
+;;typedef struct tagEMRLINETO
+;;{
+;;    EMR     emr;
+;;    POINTL  ptl;
+;;} EMRLINETO,   *PEMRLINETO,
+;;  EMRMOVETOEX, *PEMRMOVETOEX;
+;;
+;;typedef struct tagEMROFFSETCLIPRGN
+;;{
+;;    EMR     emr;
+;;    POINTL  ptlOffset;
+;;} EMROFFSETCLIPRGN, *PEMROFFSETCLIPRGN;
+;;
+;;typedef struct tagEMRFILLPATH
+;;{
+;;    EMR     emr;
+;;    RECTL   rclBounds;               // Inclusive-inclusive bounds in device units
+;;} EMRFILLPATH,          *PEMRFILLPATH,
+;;  EMRSTROKEANDFILLPATH, *PEMRSTROKEANDFILLPATH,
+;;  EMRSTROKEPATH,        *PEMRSTROKEPATH;
+;;
+;;typedef struct tagEMREXCLUDECLIPRECT
+;;{
+;;    EMR     emr;
+;;    RECTL   rclClip;
+;;} EMREXCLUDECLIPRECT,   *PEMREXCLUDECLIPRECT,
+;;  EMRINTERSECTCLIPRECT, *PEMRINTERSECTCLIPRECT;
+;;
+;;typedef struct tagEMRSETVIEWPORTORGEX
+;;{
+;;    EMR     emr;
+;;    POINTL  ptlOrigin;
+;;} EMRSETVIEWPORTORGEX, *PEMRSETVIEWPORTORGEX,
+;;  EMRSETWINDOWORGEX,   *PEMRSETWINDOWORGEX,
+;;  EMRSETBRUSHORGEX,    *PEMRSETBRUSHORGEX;
+;;
+;;typedef struct tagEMRSETVIEWPORTEXTEX
+;;{
+;;    EMR     emr;
+;;    SIZEL   szlExtent;
+;;} EMRSETVIEWPORTEXTEX, *PEMRSETVIEWPORTEXTEX,
+;;  EMRSETWINDOWEXTEX,   *PEMRSETWINDOWEXTEX;
+;;
+;;typedef struct tagEMRSCALEVIEWPORTEXTEX
+;;{
+;;    EMR     emr;
+;;    LONG    xNum;
+;;    LONG    xDenom;
+;;    LONG    yNum;
+;;    LONG    yDenom;
+;;} EMRSCALEVIEWPORTEXTEX, *PEMRSCALEVIEWPORTEXTEX,
+;;  EMRSCALEWINDOWEXTEX,   *PEMRSCALEWINDOWEXTEX;
+;;
+;;typedef struct tagEMRSETWORLDTRANSFORM
+;;{
+;;    EMR     emr;
+;;    XFORM   xform;
+;;} EMRSETWORLDTRANSFORM, *PEMRSETWORLDTRANSFORM;
+;;
+;;typedef struct tagEMRMODIFYWORLDTRANSFORM
+;;{
+;;    EMR     emr;
+;;    XFORM   xform;
+;;    DWORD   iMode;
+;;} EMRMODIFYWORLDTRANSFORM, *PEMRMODIFYWORLDTRANSFORM;
+;;
+;;typedef struct tagEMRSETPIXELV
+;;{
+;;    EMR     emr;
+;;    POINTL  ptlPixel;
+;;    COLORREF crColor;
+;;} EMRSETPIXELV, *PEMRSETPIXELV;
+;;
+;;typedef struct tagEMREXTFLOODFILL
+;;{
+;;    EMR     emr;
+;;    POINTL  ptlStart;
+;;    COLORREF crColor;
+;;    DWORD   iMode;
+;;} EMREXTFLOODFILL, *PEMREXTFLOODFILL;
+;;
+;;typedef struct tagEMRELLIPSE
+;;{
+;;    EMR     emr;
+;;    RECTL   rclBox;          // Inclusive-inclusive bounding rectangle
+;;} EMRELLIPSE,  *PEMRELLIPSE,
+;;  EMRRECTANGLE, *PEMRRECTANGLE;
+;;
+;;typedef struct tagEMRROUNDRECT
+;;{
+;;    EMR     emr;
+;;    RECTL   rclBox;          // Inclusive-inclusive bounding rectangle
+;;    SIZEL   szlCorner;
+;;} EMRROUNDRECT, *PEMRROUNDRECT;
+;;
+;;typedef struct tagEMRARC
+;;{
+;;    EMR     emr;
+;;    RECTL   rclBox;          // Inclusive-inclusive bounding rectangle
+;;    POINTL  ptlStart;
+;;    POINTL  ptlEnd;
+;;} EMRARC,   *PEMRARC,
+;;  EMRARCTO, *PEMRARCTO,
+;;  EMRCHORD, *PEMRCHORD,
+;;  EMRPIE,   *PEMRPIE;
+;;
+;;typedef struct tagEMRANGLEARC
+;;{
+;;    EMR     emr;
+;;    POINTL  ptlCenter;
+;;    DWORD   nRadius;
+;;    FLOAT   eStartAngle;
+;;    FLOAT   eSweepAngle;
+;;} EMRANGLEARC, *PEMRANGLEARC;
+;;
+;;typedef struct tagEMRPOLYLINE
+;;{
+;;    EMR     emr;
+;;    RECTL   rclBounds;               // Inclusive-inclusive bounds in device units
+;;    DWORD   cptl;
+;;    POINTL  aptl[1];
+;;} EMRPOLYLINE,     *PEMRPOLYLINE,
+;;  EMRPOLYBEZIER,   *PEMRPOLYBEZIER,
+;;  EMRPOLYGON,      *PEMRPOLYGON,
+;;  EMRPOLYBEZIERTO, *PEMRPOLYBEZIERTO,
+;;  EMRPOLYLINETO,   *PEMRPOLYLINETO;
+;;
+;;typedef struct tagEMRPOLYLINE16
+;;{
+;;    EMR     emr;
+;;    RECTL   rclBounds;               // Inclusive-inclusive bounds in device units
+;;    DWORD   cpts;
+;;    POINTS  apts[1];
+;;} EMRPOLYLINE16,     *PEMRPOLYLINE16,
+;;  EMRPOLYBEZIER16,   *PEMRPOLYBEZIER16,
+;;  EMRPOLYGON16,      *PEMRPOLYGON16,
+;;  EMRPOLYBEZIERTO16, *PEMRPOLYBEZIERTO16,
+;;  EMRPOLYLINETO16,   *PEMRPOLYLINETO16;
+;;
+;;typedef struct tagEMRPOLYDRAW
+;;{
+;;    EMR     emr;
+;;    RECTL   rclBounds;               // Inclusive-inclusive bounds in device units
+;;    DWORD   cptl;            // Number of points
+;;    POINTL  aptl[1];         // Array of points
+;;    BYTE    abTypes[1];              // Array of point types
+;;} EMRPOLYDRAW, *PEMRPOLYDRAW;
+;;
+;;typedef struct tagEMRPOLYDRAW16
+;;{
+;;    EMR     emr;
+;;    RECTL   rclBounds;               // Inclusive-inclusive bounds in device units
+;;    DWORD   cpts;            // Number of points
+;;    POINTS  apts[1];         // Array of points
+;;    BYTE    abTypes[1];              // Array of point types
+;;} EMRPOLYDRAW16, *PEMRPOLYDRAW16;
+;;
+;;typedef struct tagEMRPOLYPOLYLINE
+;;{
+;;    EMR     emr;
+;;    RECTL   rclBounds;               // Inclusive-inclusive bounds in device units
+;;    DWORD   nPolys;          // Number of polys
+;;    DWORD   cptl;            // Total number of points in all polys
+;;    DWORD   aPolyCounts[1];  // Array of point counts for each poly
+;;    POINTL  aptl[1];         // Array of points
+;;} EMRPOLYPOLYLINE, *PEMRPOLYPOLYLINE,
+;;  EMRPOLYPOLYGON,  *PEMRPOLYPOLYGON;
+;;
+;;typedef struct tagEMRPOLYPOLYLINE16
+;;{
+;;    EMR     emr;
+;;    RECTL   rclBounds;               // Inclusive-inclusive bounds in device units
+;;    DWORD   nPolys;          // Number of polys
+;;    DWORD   cpts;            // Total number of points in all polys
+;;    DWORD   aPolyCounts[1];  // Array of point counts for each poly
+;;    POINTS  apts[1];         // Array of points
+;;} EMRPOLYPOLYLINE16, *PEMRPOLYPOLYLINE16,
+;;  EMRPOLYPOLYGON16,  *PEMRPOLYPOLYGON16;
+;;
+;;typedef struct tagEMRINVERTRGN
+;;{
+;;    EMR     emr;
+;;    RECTL   rclBounds;               // Inclusive-inclusive bounds in device units
+;;    DWORD   cbRgnData;               // Size of region data in bytes
+;;    BYTE    RgnData[1];
+;;} EMRINVERTRGN, *PEMRINVERTRGN,
+;;  EMRPAINTRGN,  *PEMRPAINTRGN;
+;;
+;;typedef struct tagEMRFILLRGN
+;;{
+;;    EMR     emr;
+;;    RECTL   rclBounds;               // Inclusive-inclusive bounds in device units
+;;    DWORD   cbRgnData;               // Size of region data in bytes
+;;    DWORD   ihBrush;         // Brush handle index
+;;    BYTE    RgnData[1];
+;;} EMRFILLRGN, *PEMRFILLRGN;
+;;
+;;typedef struct tagEMRFRAMERGN
+;;{
+;;    EMR     emr;
+;;    RECTL   rclBounds;               // Inclusive-inclusive bounds in device units
+;;    DWORD   cbRgnData;               // Size of region data in bytes
+;;    DWORD   ihBrush;         // Brush handle index
+;;    SIZEL   szlStroke;
+;;    BYTE    RgnData[1];
+;;} EMRFRAMERGN, *PEMRFRAMERGN;
+;;
+;;typedef struct tagEMREXTSELECTCLIPRGN
+;;{
+;;    EMR     emr;
+;;    DWORD   cbRgnData;               // Size of region data in bytes
+;;    DWORD   iMode;
+;;    BYTE    RgnData[1];
+;;} EMREXTSELECTCLIPRGN, *PEMREXTSELECTCLIPRGN;
+;;
+;;typedef struct tagEMREXTTEXTOUTA
+;;{
+;;    EMR     emr;
+;;    RECTL   rclBounds;               // Inclusive-inclusive bounds in device units
+;;    DWORD   iGraphicsMode;   // Current graphics mode
+;;    FLOAT   exScale;            // X and Y scales from Page units to .01mm units
+;;    FLOAT   eyScale;            //   if graphics mode is GM_COMPATIBLE.
+;;    EMRTEXT emrtext;         // This is followed by the string and spacing
+;;                             // array
+;;} EMREXTTEXTOUTA, *PEMREXTTEXTOUTA,
+;;  EMREXTTEXTOUTW, *PEMREXTTEXTOUTW;
+;;
+;;typedef struct tagEMRPOLYTEXTOUTA
+;;{
+;;    EMR     emr;
+;;    RECTL   rclBounds;               // Inclusive-inclusive bounds in device units
+;;    DWORD   iGraphicsMode;   // Current graphics mode
+;;    FLOAT   exScale;            // X and Y scales from Page units to .01mm units
+;;    FLOAT   eyScale;            //   if graphics mode is GM_COMPATIBLE.
+;;    LONG    cStrings;
+;;    EMRTEXT aemrtext[1];     // Array of EMRTEXT structures.  This is
+;;                             // followed by the strings and spacing arrays.
+;;} EMRPOLYTEXTOUTA, *PEMRPOLYTEXTOUTA,
+;;  EMRPOLYTEXTOUTW, *PEMRPOLYTEXTOUTW;
+;;
+;;typedef struct tagEMRBITBLT
+;;{
+;;    EMR     emr;
+;;    RECTL   rclBounds;               // Inclusive-inclusive bounds in device units
+;;    LONG    xDest;
+;;    LONG    yDest;
+;;    LONG    cxDest;
+;;    LONG    cyDest;
+;;    DWORD   dwRop;
+;;    LONG    xSrc;
+;;    LONG    ySrc;
+;;    XFORM   xformSrc;                // Source DC transform
+;;    COLORREF crBkColorSrc;   // Source DC BkColor in RGB
+;;    DWORD   iUsageSrc;               // Source bitmap info color table usage
+;;                             // (DIB_RGB_COLORS)
+;;    DWORD   offBmiSrc;               // Offset to the source BITMAPINFO structure
+;;    DWORD   cbBmiSrc;                // Size of the source BITMAPINFO structure
+;;    DWORD   offBitsSrc;              // Offset to the source bitmap bits
+;;    DWORD   cbBitsSrc;               // Size of the source bitmap bits
+;;} EMRBITBLT, *PEMRBITBLT;
+;;
+;;typedef struct tagEMRSTRETCHBLT
+;;{
+;;    EMR     emr;
+;;    RECTL   rclBounds;               // Inclusive-inclusive bounds in device units
+;;    LONG    xDest;
+;;    LONG    yDest;
+;;    LONG    cxDest;
+;;    LONG    cyDest;
+;;    DWORD   dwRop;
+;;    LONG    xSrc;
+;;    LONG    ySrc;
+;;    XFORM   xformSrc;                // Source DC transform
+;;    COLORREF crBkColorSrc;   // Source DC BkColor in RGB
+;;    DWORD   iUsageSrc;               // Source bitmap info color table usage
+;;                             // (DIB_RGB_COLORS)
+;;    DWORD   offBmiSrc;               // Offset to the source BITMAPINFO structure
+;;    DWORD   cbBmiSrc;                // Size of the source BITMAPINFO structure
+;;    DWORD   offBitsSrc;              // Offset to the source bitmap bits
+;;    DWORD   cbBitsSrc;               // Size of the source bitmap bits
+;;    LONG    cxSrc;
+;;    LONG    cySrc;
+;;} EMRSTRETCHBLT, *PEMRSTRETCHBLT;
+;;
+;;typedef struct tagEMRMASKBLT
+;;{
+;;    EMR     emr;
+;;    RECTL   rclBounds;               // Inclusive-inclusive bounds in device units
+;;    LONG    xDest;
+;;    LONG    yDest;
+;;    LONG    cxDest;
+;;    LONG    cyDest;
+;;    DWORD   dwRop;
+;;    LONG    xSrc;
+;;    LONG    ySrc;
+;;    XFORM   xformSrc;                // Source DC transform
+;;    COLORREF crBkColorSrc;   // Source DC BkColor in RGB
+;;    DWORD   iUsageSrc;               // Source bitmap info color table usage
+;;                             // (DIB_RGB_COLORS)
+;;    DWORD   offBmiSrc;               // Offset to the source BITMAPINFO structure
+;;    DWORD   cbBmiSrc;                // Size of the source BITMAPINFO structure
+;;    DWORD   offBitsSrc;              // Offset to the source bitmap bits
+;;    DWORD   cbBitsSrc;               // Size of the source bitmap bits
+;;    LONG    xMask;
+;;    LONG    yMask;
+;;    DWORD   iUsageMask;              // Mask bitmap info color table usage
+;;    DWORD   offBmiMask;              // Offset to the mask BITMAPINFO structure if any
+;;    DWORD   cbBmiMask;               // Size of the mask BITMAPINFO structure if any
+;;    DWORD   offBitsMask;     // Offset to the mask bitmap bits if any
+;;    DWORD   cbBitsMask;              // Size of the mask bitmap bits if any
+;;} EMRMASKBLT, *PEMRMASKBLT;
+;;
+;;typedef struct tagEMRPLGBLT
+;;{
+;;    EMR     emr;
+;;    RECTL   rclBounds;               // Inclusive-inclusive bounds in device units
+;;    POINTL  aptlDest[3];
+;;    LONG    xSrc;
+;;    LONG    ySrc;
+;;    LONG    cxSrc;
+;;    LONG    cySrc;
+;;    XFORM   xformSrc;                // Source DC transform
+;;    COLORREF crBkColorSrc;   // Source DC BkColor in RGB
+;;    DWORD   iUsageSrc;               // Source bitmap info color table usage
+;;                             // (DIB_RGB_COLORS)
+;;    DWORD   offBmiSrc;               // Offset to the source BITMAPINFO structure
+;;    DWORD   cbBmiSrc;                // Size of the source BITMAPINFO structure
+;;    DWORD   offBitsSrc;              // Offset to the source bitmap bits
+;;    DWORD   cbBitsSrc;               // Size of the source bitmap bits
+;;    LONG    xMask;
+;;    LONG    yMask;
+;;    DWORD   iUsageMask;              // Mask bitmap info color table usage
+;;    DWORD   offBmiMask;              // Offset to the mask BITMAPINFO structure if any
+;;    DWORD   cbBmiMask;               // Size of the mask BITMAPINFO structure if any
+;;    DWORD   offBitsMask;     // Offset to the mask bitmap bits if any
+;;    DWORD   cbBitsMask;              // Size of the mask bitmap bits if any
+;;} EMRPLGBLT, *PEMRPLGBLT;
+;;
+;;typedef struct tagEMRSETDIBITSTODEVICE
+;;{
+;;    EMR     emr;
+;;    RECTL   rclBounds;               // Inclusive-inclusive bounds in device units
+;;    LONG    xDest;
+;;    LONG    yDest;
+;;    LONG    xSrc;
+;;    LONG    ySrc;
+;;    LONG    cxSrc;
+;;    LONG    cySrc;
+;;    DWORD   offBmiSrc;               // Offset to the source BITMAPINFO structure
+;;    DWORD   cbBmiSrc;                // Size of the source BITMAPINFO structure
+;;    DWORD   offBitsSrc;              // Offset to the source bitmap bits
+;;    DWORD   cbBitsSrc;               // Size of the source bitmap bits
+;;    DWORD   iUsageSrc;               // Source bitmap info color table usage
+;;    DWORD   iStartScan;
+;;    DWORD   cScans;
+;;} EMRSETDIBITSTODEVICE, *PEMRSETDIBITSTODEVICE;
+;;
+;;typedef struct tagEMRSTRETCHDIBITS
+;;{
+;;    EMR     emr;
+;;    RECTL   rclBounds;               // Inclusive-inclusive bounds in device units
+;;    LONG    xDest;
+;;    LONG    yDest;
+;;    LONG    xSrc;
+;;    LONG    ySrc;
+;;    LONG    cxSrc;
+;;    LONG    cySrc;
+;;    DWORD   offBmiSrc;               // Offset to the source BITMAPINFO structure
+;;    DWORD   cbBmiSrc;                // Size of the source BITMAPINFO structure
+;;    DWORD   offBitsSrc;              // Offset to the source bitmap bits
+;;    DWORD   cbBitsSrc;               // Size of the source bitmap bits
+;;    DWORD   iUsageSrc;               // Source bitmap info color table usage
+;;    DWORD   dwRop;
+;;    LONG    cxDest;
+;;    LONG    cyDest;
+;;} EMRSTRETCHDIBITS, *PEMRSTRETCHDIBITS;
+;;
+;;typedef struct tagEMREXTCREATEFONTINDIRECTW
+;;{
+;;    EMR     emr;
+;;    DWORD   ihFont;          // Font handle index
+;;    EXTLOGFONTW      elfw;
+;;} EMREXTCREATEFONTINDIRECTW, *PEMREXTCREATEFONTINDIRECTW;
+;;
+;;typedef struct tagEMRCREATEPALETTE
+;;{
+;;    EMR     emr;
+;;    DWORD   ihPal;           // Palette handle index
+;;    LOGPALETTE lgpl;         // The peFlags fields in the palette entries
+;;                             // do not contain any flags
+;;} EMRCREATEPALETTE, *PEMRCREATEPALETTE;
+;;
+;;typedef struct tagEMRCREATEPEN
+;;{
+;;    EMR     emr;
+;;    DWORD   ihPen;           // Pen handle index
+;;    LOGPEN  lopn;
+;;} EMRCREATEPEN, *PEMRCREATEPEN;
+;;
+;;typedef struct tagEMREXTCREATEPEN
+;;{
+;;    EMR     emr;
+;;    DWORD   ihPen;           // Pen handle index
+;;    DWORD   offBmi;          // Offset to the BITMAPINFO structure if any
+;;    DWORD   cbBmi;           // Size of the BITMAPINFO structure if any
+;;                             // The bitmap info is followed by the bitmap
+;;                             // bits to form a packed DIB.
+;;    DWORD   offBits;         // Offset to the brush bitmap bits if any
+;;    DWORD   cbBits;          // Size of the brush bitmap bits if any
+;;    EXTLOGPEN elp;           // The extended pen with the style array.
+;;} EMREXTCREATEPEN, *PEMREXTCREATEPEN;
+;;
+;;typedef struct tagEMRCREATEBRUSHINDIRECT
+;;{
+;;    EMR     emr;
+;;    DWORD   ihBrush;         // Brush handle index
+;;    LOGBRUSH lb;             // The style must be BS_SOLID, BS_HOLLOW,
+;;                             // BS_NULL or BS_HATCHED.
+;;} EMRCREATEBRUSHINDIRECT, *PEMRCREATEBRUSHINDIRECT;
+;;
+;;typedef struct tagEMRCREATEMONOBRUSH
+;;{
+;;    EMR     emr;
+;;    DWORD   ihBrush;         // Brush handle index
+;;    DWORD   iUsage;          // Bitmap info color table usage
+;;    DWORD   offBmi;          // Offset to the BITMAPINFO structure
+;;    DWORD   cbBmi;           // Size of the BITMAPINFO structure
+;;    DWORD   offBits;         // Offset to the bitmap bits
+;;    DWORD   cbBits;          // Size of the bitmap bits
+;;} EMRCREATEMONOBRUSH, *PEMRCREATEMONOBRUSH;
+;;
+;;typedef struct tagEMRCREATEDIBPATTERNBRUSHPT
+;;{
+;;    EMR     emr;
+;;    DWORD   ihBrush;         // Brush handle index
+;;    DWORD   iUsage;          // Bitmap info color table usage
+;;    DWORD   offBmi;          // Offset to the BITMAPINFO structure
+;;    DWORD   cbBmi;           // Size of the BITMAPINFO structure
+;;                             // The bitmap info is followed by the bitmap
+;;                             // bits to form a packed DIB.
+;;    DWORD   offBits;         // Offset to the bitmap bits
+;;    DWORD   cbBits;          // Size of the bitmap bits
+;;} EMRCREATEDIBPATTERNBRUSHPT, *PEMRCREATEDIBPATTERNBRUSHPT;
+;;
+;;#endif  /* NOMETAFILE */
+;;
+;;#endif /* NOGDI */
+;;
+;;#ifdef __cplusplus
+;;}
+;;#endif
+;;
+;;#endif /* _WINGDI_ */
diff --git a/v7/src/win32/winnt.scm b/v7/src/win32/winnt.scm
new file mode 100644 (file)
index 0000000..62fea95
--- /dev/null
@@ -0,0 +1,3930 @@
+;;/*++ BUILD Version: 0093     Increment this if a change has global effects
+;;
+;;Copyright (c) 1990-1993  Microsoft Corporation
+;;
+;;Module Name:
+;;
+;;    winnt.h
+;;
+;;Abstract:
+;;
+;;    This module defines the 32-Bit Windows types and constants that are
+;;    defined by NT, but exposed through the Win32 API.
+;;
+;;Revision History:
+;;
+;;--*/
+;;
+;;#ifndef _WINNT_
+;;#define _WINNT_
+;;
+;;#ifdef __cplusplus
+;;extern "C" {
+;;#endif
+;;
+;;#include <ctype.h>  
+;;#define ANYSIZE_ARRAY 1       
+;;#if defined(_MIPS_) || defined(_ALPHA_)     
+;;#define UNALIGNED __unaligned               
+;;#else                                       
+;;#define UNALIGNED                           
+;;#endif                                      
+;;typedef void *PVOID;    
+;;#if (_MSC_VER >= 800)                                                    
+;;#define NTAPI __stdcall                                                  
+;;#else                                                                    
+;;#define _cdecl                                                           
+;;#define NTAPI                                                            
+;;#endif                                                                   
+;;
+;;//
+;;// Basics
+;;//
+;;
+;;#ifndef VOID
+;;#define VOID void
+;;typedef char CHAR;
+;;typedef short SHORT;
+;;typedef long LONG;
+;;#endif
+;;
+;;//
+;;// UNICODE (Wide Character) types
+;;//
+;;
+;;typedef wchar_t WCHAR;    // wc,   16-bit UNICODE character
+;;
+;;typedef WCHAR *PWCHAR;
+;;typedef WCHAR *LPWCH, *PWCH;
+;;typedef CONST WCHAR *LPCWCH, *PCWCH;
+;;typedef WCHAR *NWPSTR;
+;;typedef WCHAR *LPWSTR, *PWSTR;
+;;
+;;typedef CONST WCHAR *LPCWSTR, *PCWSTR;
+;;
+;;//
+;;// ANSI (Multi-byte Character) types
+;;//
+;;typedef CHAR *PCHAR;
+;;typedef CHAR *LPCH, *PCH;
+;;
+;;typedef CONST CHAR *LPCCH, *PCCH;
+;;typedef CHAR *NPSTR;
+;;typedef CHAR *LPSTR, *PSTR;
+;;typedef CONST CHAR *LPCSTR, *PCSTR;
+;;
+;;//
+;;// Neutral ANSI/UNICODE types and macros
+;;//
+;;#ifdef  UNICODE
+;;
+;;#ifndef _TCHAR_DEFINED
+;;typedef WCHAR TCHAR, *PTCHAR;
+;;typedef WCHAR TBYTE , *PTBYTE ;
+;;#define _TCHAR_DEFINED
+;;#endif /* !_TCHAR_DEFINED */
+;;
+;;typedef LPWSTR LPTCH, PTCH;
+;;typedef LPWSTR PTSTR, LPTSTR;
+;;typedef LPCWSTR LPCTSTR;
+;;typedef LPWSTR LP;
+;;#define __TEXT(quote) L##quote
+;;
+;;#else   /* UNICODE */
+;;
+;;#ifndef _TCHAR_DEFINED
+;;typedef char TCHAR, *PTCHAR;
+;;typedef unsigned char TBYTE , *PTBYTE ;
+;;#define _TCHAR_DEFINED
+;;#endif /* !_TCHAR_DEFINED */
+;;
+;;typedef LPSTR LPTCH, PTCH;
+;;typedef LPSTR PTSTR, LPTSTR;
+;;typedef LPCSTR LPCTSTR;
+;;#define __TEXT(quote) quote
+;;
+;;#endif /* UNICODE */
+;;#define TEXT(quote) __TEXT(quote)
+;;
+;;
+;;typedef SHORT *PSHORT;  
+;;typedef LONG *PLONG;    
+;;
+;;#ifdef STRICT
+;;typedef void *HANDLE;
+;;#define DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name
+;;#else
+;;typedef PVOID HANDLE;
+;;#define DECLARE_HANDLE(name) typedef HANDLE name
+;;#endif
+;;typedef HANDLE *PHANDLE;
+;;
+;;typedef char CCHAR;          
+;;typedef DWORD LCID;         
+;;typedef PDWORD PLCID;       
+;;typedef WORD   LANGID;      
+;;/*lint -e624 */  
+;;/*lint +e624 */  
+(define-integrable APPLICATION_ERROR_MASK       #x20000000)
+;;#define ERROR_SEVERITY_SUCCESS       0x00000000
+;;#define ERROR_SEVERITY_INFORMATIONAL 0x40000000
+;;#define ERROR_SEVERITY_WARNING       0x80000000
+;;#define ERROR_SEVERITY_ERROR         0xC0000000
+;;
+;;#if defined(MIDL_PASS)
+;;typedef double LONGLONG;
+;;typedef double DWORDLONG;
+;;#else
+;;#if defined(_M_IX86)
+;;typedef double LONGLONG;
+;;typedef double DWORDLONG;
+;;#else
+;;typedef double LONGLONG;
+;;typedef double DWORDLONG;
+;;#endif
+;;#endif
+;;
+;;typedef LONGLONG *PLONGLONG;
+;;typedef DWORDLONG *PDWORDLONG;
+;;
+;;#if defined(MIDL_PASS)
+;;typedef struct _LARGE_INTEGER {
+;;#else // MIDL_PASS
+;;typedef union _LARGE_INTEGER {
+;;#if defined(_CFRONT_PASS_)
+;;    struct {
+;;        DWORD LowPart;
+;;        LONG HighPart;
+;;    } u;
+;;#else
+;;    struct {
+;;        DWORD LowPart;
+;;        LONG HighPart;
+;;    };
+;;#endif
+;;#endif //MIDL_PASS
+;;    LONGLONG QuadPart;
+;;} LARGE_INTEGER, *PLARGE_INTEGER;
+;;
+;;
+;;#if defined(MIDL_PASS)
+;;typedef struct _ULARGE_INTEGER {
+;;#else // MIDL_PASS
+;;typedef union _ULARGE_INTEGER {
+;;#if defined(_CFRONT_PASS_)
+;;    struct {
+;;        DWORD LowPart;
+;;        DWORD HighPart;
+;;    } u;
+;;#else
+;;    struct {
+;;        DWORD LowPart;
+;;        DWORD HighPart;
+;;    };
+;;#endif
+;;#endif //MIDL_PASS
+;;    DWORDLONG QuadPart;
+;;} ULARGE_INTEGER, *PULARGE_INTEGER;
+;;
+;;// end_ntminiport
+;;
+;;//
+;;// Locally Unique Identifier
+;;//
+;;
+;;typedef LARGE_INTEGER LUID, *PLUID;
+;;
+;;#define UNICODE_NULL ((WCHAR)0) 
+;;typedef BYTE  BOOLEAN;           
+;;typedef BOOLEAN *PBOOLEAN;       
+;;//
+;;//  Doubly linked list structure.  Can be used as either a list head, or
+;;//  as link words.
+;;//
+;;
+;;typedef struct _LIST_ENTRY {
+;;   struct _LIST_ENTRY *Flink;
+;;   struct _LIST_ENTRY *Blink;
+;;} LIST_ENTRY;
+;;typedef LIST_ENTRY *PLIST_ENTRY;
+;;
+;;//
+;;//  Singly linked list structure. Can be used as either a list head, or
+;;//  as link words.
+;;//
+;;
+;;typedef struct _SINGLE_LIST_ENTRY {
+;;    struct _SINGLE_LIST_ENTRY *Next;
+;;} SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY;
+;;#define MINCHAR     0x80        
+;;#define MAXCHAR     0x7f        
+;;#define MINSHORT    0x8000      
+;;#define MAXSHORT    0x7fff      
+;;#define MINLONG     0x80000000  
+;;#define MAXLONG     0x7fffffff  
+;;#define MAXBYTE     0xff        
+;;#define MAXWORD     0xffff      
+;;#define MAXDWORD    0xffffffff  
+;;//
+;;// Calculate the byte offset of a field in a structure of type type.
+;;//
+;;
+;;#define FIELD_OFFSET(type, field)    ((LONG)&(((type *)0)->field))
+;;
+;;
+;;//
+;;// Calculate the address of the base of the structure given its type, and an
+;;// address of a field within the structure.
+;;//
+;;
+;;#define CONTAINING_RECORD(address, type, field) ((type *)( \
+;;                                                  (PCHAR)(address) - \
+;;                                                  (PCHAR)(&((type *)0)->field)))
+;;
+;;/*
+;; *  Language IDs.
+;; *
+;; *  The following two combinations of primary language ID and
+;; *  sublanguage ID have special semantics:
+;; *
+;; *    Primary Language ID   Sublanguage ID      Result
+;; *    -------------------   ---------------     ------------------------
+;; *    LANG_NEUTRAL          SUBLANG_NEUTRAL     Language neutral
+;; *    LANG_NEUTRAL          SUBLANG_DEFAULT     User default language
+;; *    LANG_NEUTRAL          SUBLANG_SYS_DEFAULT System default language
+;; */
+;;
+;;/*
+;; *  Primary language IDs.
+;; */
+;;#define LANG_NEUTRAL                     0x00
+;;
+;;#define LANG_ALBANIAN                    0x1c
+;;#define LANG_ARABIC                      0x01
+;;#define LANG_BAHASA                      0x21
+;;#define LANG_BULGARIAN                   0x02
+;;#define LANG_CATALAN                     0x03
+;;#define LANG_CHINESE                     0x04
+;;#define LANG_CZECH                       0x05
+;;#define LANG_DANISH                      0x06
+;;#define LANG_DUTCH                       0x13
+;;#define LANG_ENGLISH                     0x09
+;;#define LANG_FINNISH                     0x0b
+;;#define LANG_FRENCH                      0x0c
+;;#define LANG_GERMAN                      0x07
+;;#define LANG_GREEK                       0x08
+;;#define LANG_HEBREW                      0x0d
+;;#define LANG_HUNGARIAN                   0x0e
+;;#define LANG_ICELANDIC                   0x0f
+;;#define LANG_ITALIAN                     0x10
+;;#define LANG_JAPANESE                    0x11
+;;#define LANG_KOREAN                      0x12
+;;#define LANG_NORWEGIAN                   0x14
+;;#define LANG_POLISH                      0x15
+;;#define LANG_PORTUGUESE                  0x16
+;;#define LANG_RHAETO_ROMAN                0x17
+;;#define LANG_ROMANIAN                    0x18
+;;#define LANG_RUSSIAN                     0x19
+;;#define LANG_SERBO_CROATIAN              0x1a
+;;#define LANG_SLOVAK                      0x1b
+;;#define LANG_SPANISH                     0x0a
+;;#define LANG_SWEDISH                     0x1d
+;;#define LANG_THAI                        0x1e
+;;#define LANG_TURKISH                     0x1f
+;;#define LANG_URDU                        0x20
+;;
+;;/*
+;; *  Sublanguage IDs.
+;; *
+;; *  The name immediately following SUBLANG_ dictates which primary
+;; *  language ID that sublanguage ID can be combined with to form a
+;; *  valid language ID.
+;; */
+;;#define SUBLANG_NEUTRAL                  0x00    /* language neutral */
+;;#define SUBLANG_DEFAULT                  0x01    /* user default */
+;;#define SUBLANG_SYS_DEFAULT              0x02    /* system default */
+;;
+;;#define SUBLANG_CHINESE_SIMPLIFIED       0x02    /* Chinese (Simplified) */
+;;#define SUBLANG_CHINESE_TRADITIONAL      0x01    /* Chinese (Traditional) */
+;;#define SUBLANG_DUTCH                    0x01    /* Dutch */
+;;#define SUBLANG_DUTCH_BELGIAN            0x02    /* Dutch (Belgian) */
+;;#define SUBLANG_ENGLISH_US               0x01    /* English (USA) */
+;;#define SUBLANG_ENGLISH_UK               0x02    /* English (UK) */
+;;#define SUBLANG_ENGLISH_AUS              0x03    /* English (Australian) */
+;;#define SUBLANG_ENGLISH_CAN              0x04    /* English (Canadian) */
+;;#define SUBLANG_ENGLISH_NZ               0x05    /* English (New Zealand) */
+;;#define SUBLANG_ENGLISH_EIRE             0x06    /* English (Irish) */
+;;#define SUBLANG_FRENCH                   0x01    /* French */
+;;#define SUBLANG_FRENCH_BELGIAN           0x02    /* French (Belgian) */
+;;#define SUBLANG_FRENCH_CANADIAN          0x03    /* French (Canadian) */
+;;#define SUBLANG_FRENCH_SWISS             0x04    /* French (Swiss) */
+;;#define SUBLANG_GERMAN                   0x01    /* German */
+;;#define SUBLANG_GERMAN_SWISS             0x02    /* German (Swiss) */
+;;#define SUBLANG_GERMAN_AUSTRIAN          0x03    /* German (Austrian) */
+;;#define SUBLANG_ITALIAN                  0x01    /* Italian */
+;;#define SUBLANG_ITALIAN_SWISS            0x02    /* Italian (Swiss) */
+;;#define SUBLANG_NORWEGIAN_BOKMAL         0x01    /* Norwegian (Bokmal) */
+;;#define SUBLANG_NORWEGIAN_NYNORSK        0x02    /* Norwegian (Nynorsk) */
+;;#define SUBLANG_PORTUGUESE               0x02    /* Portuguese */
+;;#define SUBLANG_PORTUGUESE_BRAZILIAN     0x01    /* Portuguese (Brazilian) */
+;;#define SUBLANG_SERBO_CROATIAN_CYRILLIC  0x02    /* Serbo-Croatian (Cyrillic) */
+;;#define SUBLANG_SERBO_CROATIAN_LATIN     0x01    /* Croato-Serbian (Latin) */
+;;#define SUBLANG_SPANISH                  0x01    /* Spanish (Castilian) */
+;;#define SUBLANG_SPANISH_MEXICAN          0x02    /* Spanish (Mexican) */
+;;#define SUBLANG_SPANISH_MODERN           0x03    /* Spanish (Modern) */
+;;
+;;/*
+;; *  Sorting IDs.
+;; *
+;; */
+;;#define SORT_DEFAULT                     0x0     /* sorting default */
+;;
+;;
+;;/*
+;; *  A language ID is a 16 bit value which is the combination of a
+;; *  primary language ID and a secondary language ID.  The bits are
+;; *  allocated as follows:
+;; *
+;; *       +-----------------------+-------------------------+
+;; *       |     Sublanguage ID    |   Primary Language ID   |
+;; *       +-----------------------+-------------------------+
+;; *        15                   10 9                       0   bit
+;; *
+;; *
+;; *  Language ID creation/extraction macros:
+;; *
+;; *    MAKELANGID    - construct language id from a primary language id and
+;; *                    a sublanguage id.
+;; *    PRIMARYLANGID - extract primary language id from a language id.
+;; *    SUBLANGID     - extract sublanguage id from a language id.
+;; */
+;;#define MAKELANGID(p, s)       ((((WORD  )(s)) << 10) | (WORD  )(p))
+;;#define PRIMARYLANGID(lgid)    ((WORD  )(lgid) & 0x3ff)
+;;#define SUBLANGID(lgid)        ((WORD  )(lgid) >> 10)
+;;
+;;
+;;/*
+;; *  A locale ID is a 32 bit value which is the combination of a
+;; *  language ID, a sort ID, and a reserved area.  The bits are
+;; *  allocated as follows:
+;; *
+;; *       +-------------+---------+-------------------------+
+;; *       |   Reserved  | Sort ID |      Language ID        |
+;; *       +-------------+---------+-------------------------+
+;; *        31         20 19     16 15                      0   bit
+;; *
+;; *
+;; *  Locale ID creation/extraction macros:
+;; *
+;; *    MAKELCID       - construct locale id from a language id and a sort id.
+;; *    LANGIDFROMLCID - extract language id from a locale id.
+;; *    SORTIDFROMLCID - extract sort id from a locale id.
+;; */
+;;#define NLS_VALID_LOCALE_MASK  0x000fffff
+;;
+;;#define MAKELCID(lgid, srtid)  ((DWORD)((((DWORD)((WORD  )(srtid))) << 16) |  \
+;;                                         ((DWORD)((WORD  )(lgid)))))
+;;#define LANGIDFROMLCID(lcid)   ((WORD  )(lcid))
+;;#define SORTIDFROMLCID(lcid)   ((WORD  )((((DWORD)(lcid)) & NLS_VALID_LOCALE_MASK) >> 16))
+;;
+;;
+;;/*
+;; *  Default System and User IDs for language and locale.
+;; */
+;;#define LANG_SYSTEM_DEFAULT    (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
+;;#define LANG_USER_DEFAULT      (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
+;;
+;;#define LOCALE_SYSTEM_DEFAULT  (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
+;;#define LOCALE_USER_DEFAULT    (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
+;;
+;;
+;;
+;;// begin_ntminiport
+;;
+;;//
+;;// Macros used to eliminate compiler warning generated when formal
+;;// parameters or local variables are not declared.
+;;//
+;;// Use DBG_UNREFERENCED_PARAMETER() when a parameter is not yet
+;;// referenced but will be once the module is completely developed.
+;;//
+;;// Use DBG_UNREFERENCED_LOCAL_VARIABLE() when a local variable is not yet
+;;// referenced but will be once the module is completely developed.
+;;//
+;;// Use UNREFERENCED_PARAMETER() if a parameter will never be referenced.
+;;//
+;;// DBG_UNREFERENCED_PARAMETER and DBG_UNREFERENCED_LOCAL_VARIABLE will
+;;// eventually be made into a null macro to help determine whether there
+;;// is unfinished work.
+;;//
+;;
+;;#if ! (defined(lint) || defined(_lint))
+;;#define UNREFERENCED_PARAMETER(P)          (P)
+;;#define DBG_UNREFERENCED_PARAMETER(P)      (P)
+;;#define DBG_UNREFERENCED_LOCAL_VARIABLE(V) (V)
+;;
+;;#else // lint or _lint
+;;
+;;// Note: lint -e530 says don't complain about uninitialized variables for
+;;// this.  line +e530 turns that checking back on.  Error 527 has to do with
+;;// unreachable code.
+;;
+;;#define UNREFERENCED_PARAMETER(P)          \
+;;    /*lint -e527 -e530 */ \
+;;    { \
+;;        (P) = (P); \
+;;    } \
+;;    /*lint +e527 +e530 */
+;;#define DBG_UNREFERENCED_PARAMETER(P)      \
+;;    /*lint -e527 -e530 */ \
+;;    { \
+;;        (P) = (P); \
+;;    } \
+;;    /*lint +e527 +e530 */
+;;#define DBG_UNREFERENCED_LOCAL_VARIABLE(V) \
+;;    /*lint -e527 -e530 */ \
+;;    { \
+;;        (V) = (V); \
+;;    } \
+;;    /*lint +e527 +e530 */
+;;
+;;#endif // lint or _lint
+;;
+;;
+;;/*lint -save -e767 */  
+;;#define STATUS_WAIT_0                    ((DWORD   )0x00000000L)    
+;;#define STATUS_ABANDONED_WAIT_0          ((DWORD   )0x00000080L)    
+;;#define STATUS_USER_APC                  ((DWORD   )0x000000C0L)    
+;;#define STATUS_TIMEOUT                   ((DWORD   )0x00000102L)    
+;;#define STATUS_PENDING                   ((DWORD   )0x00000103L)    
+;;#define STATUS_DATATYPE_MISALIGNMENT     ((DWORD   )0x80000002L)    
+;;#define STATUS_BREAKPOINT                ((DWORD   )0x80000003L)    
+;;#define STATUS_SINGLE_STEP               ((DWORD   )0x80000004L)    
+;;#define STATUS_ACCESS_VIOLATION          ((DWORD   )0xC0000005L)    
+;;#define STATUS_IN_PAGE_ERROR             ((DWORD   )0xC0000006L)    
+;;#define STATUS_NO_MEMORY                 ((DWORD   )0xC0000017L)    
+;;#define STATUS_ILLEGAL_INSTRUCTION       ((DWORD   )0xC000001DL)    
+;;#define STATUS_NONCONTINUABLE_EXCEPTION  ((DWORD   )0xC0000025L)    
+;;#define STATUS_INVALID_DISPOSITION       ((DWORD   )0xC0000026L)    
+;;#define STATUS_ARRAY_BOUNDS_EXCEEDED     ((DWORD   )0xC000008CL)    
+;;#define STATUS_FLOAT_DENORMAL_OPERAND    ((DWORD   )0xC000008DL)    
+;;#define STATUS_FLOAT_DIVIDE_BY_ZERO      ((DWORD   )0xC000008EL)    
+;;#define STATUS_FLOAT_INEXACT_RESULT      ((DWORD   )0xC000008FL)    
+;;#define STATUS_FLOAT_INVALID_OPERATION   ((DWORD   )0xC0000090L)    
+;;#define STATUS_FLOAT_OVERFLOW            ((DWORD   )0xC0000091L)    
+;;#define STATUS_FLOAT_STACK_CHECK         ((DWORD   )0xC0000092L)    
+;;#define STATUS_FLOAT_UNDERFLOW           ((DWORD   )0xC0000093L)    
+;;#define STATUS_INTEGER_DIVIDE_BY_ZERO    ((DWORD   )0xC0000094L)    
+;;#define STATUS_INTEGER_OVERFLOW          ((DWORD   )0xC0000095L)    
+;;#define STATUS_PRIVILEGED_INSTRUCTION    ((DWORD   )0xC0000096L)    
+;;#define STATUS_STACK_OVERFLOW            ((DWORD   )0xC00000FDL)    
+;;#define STATUS_CONTROL_C_EXIT            ((DWORD   )0xC000013AL)    
+;;/*lint -restore */  
+;;#define MAXIMUM_WAIT_OBJECTS 64     // Maximum number of wait objects
+;;
+;;#define MAXIMUM_SUSPEND_COUNT MAXCHAR // Maximum times thread can be suspended
+;;typedef DWORD KSPIN_LOCK;  
+;;
+;;#ifdef _ALPHA_
+;;
+;;// begin_ntddk begin_nthal
+;;//
+;;// The following flags control the contents of the CONTEXT structure.
+;;//
+;;
+;;#define CONTEXT_PORTABLE_32BIT     0x00100000
+;;#define CONTEXT_ALPHA              0x00020000
+;;
+;;#define CONTEXT_CONTROL         (CONTEXT_ALPHA | 0x00000001L)
+;;#define CONTEXT_FLOATING_POINT  (CONTEXT_ALPHA | 0x00000002L)
+;;#define CONTEXT_INTEGER         (CONTEXT_ALPHA | 0x00000004L)
+;;
+;;#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
+;;
+;;#ifndef _PORTABLE_32BIT_CONTEXT
+;;
+;;//
+;;// Context Frame
+;;//
+;;//  This frame has a several purposes: 1) it is used as an argument to
+;;//  NtContinue, 2) it is used to construct a call frame for APC delivery,
+;;//  3) it is used to construct a call frame for exception dispatching
+;;//  in user mode, 4) it is used in the user level thread creation
+;;//  routines, and 5) it is used to to pass thread state to debuggers.
+;;//
+;;//  N.B. Because this record is used as a call frame, it must be EXACTLY
+;;//  a multiple of 16 bytes in length.
+;;//
+;;//  There are two variations of the context structure. This is the real one.
+;;//
+;;
+;;typedef struct _CONTEXT {
+;;
+;;    //
+;;    // This section is specified/returned if the ContextFlags word contains
+;;    // the flag CONTEXT_FLOATING_POINT.
+;;    //
+;;
+;;    DWORDLONG FltF0;
+;;    DWORDLONG FltF1;
+;;    DWORDLONG FltF2;
+;;    DWORDLONG FltF3;
+;;    DWORDLONG FltF4;
+;;    DWORDLONG FltF5;
+;;    DWORDLONG FltF6;
+;;    DWORDLONG FltF7;
+;;    DWORDLONG FltF8;
+;;    DWORDLONG FltF9;
+;;    DWORDLONG FltF10;
+;;    DWORDLONG FltF11;
+;;    DWORDLONG FltF12;
+;;    DWORDLONG FltF13;
+;;    DWORDLONG FltF14;
+;;    DWORDLONG FltF15;
+;;    DWORDLONG FltF16;
+;;    DWORDLONG FltF17;
+;;    DWORDLONG FltF18;
+;;    DWORDLONG FltF19;
+;;    DWORDLONG FltF20;
+;;    DWORDLONG FltF21;
+;;    DWORDLONG FltF22;
+;;    DWORDLONG FltF23;
+;;    DWORDLONG FltF24;
+;;    DWORDLONG FltF25;
+;;    DWORDLONG FltF26;
+;;    DWORDLONG FltF27;
+;;    DWORDLONG FltF28;
+;;    DWORDLONG FltF29;
+;;    DWORDLONG FltF30;
+;;    DWORDLONG FltF31;
+;;
+;;    //
+;;    // This section is specified/returned if the ContextFlags word contains
+;;    // the flag CONTEXT_INTEGER.
+;;    //
+;;    // N.B. The registers gp, sp, and ra are defined in this section, but are
+;;    //  considered part of the control context rather than part of the integer
+;;    //  context.
+;;    //
+;;
+;;    DWORDLONG IntV0;    //  $0: return value register, v0
+;;    DWORDLONG IntT0;    //  $1: temporary registers, t0 - t7
+;;    DWORDLONG IntT1;    //  $2:
+;;    DWORDLONG IntT2;    //  $3:
+;;    DWORDLONG IntT3;    //  $4:
+;;    DWORDLONG IntT4;    //  $5:
+;;    DWORDLONG IntT5;    //  $6:
+;;    DWORDLONG IntT6;    //  $7:
+;;    DWORDLONG IntT7;    //  $8:
+;;    DWORDLONG IntS0;    //  $9: nonvolatile registers, s0 - s5
+;;    DWORDLONG IntS1;    // $10:
+;;    DWORDLONG IntS2;    // $11:
+;;    DWORDLONG IntS3;    // $12:
+;;    DWORDLONG IntS4;    // $13:
+;;    DWORDLONG IntS5;    // $14:
+;;    DWORDLONG IntFp;    // $15: frame pointer register, fp/s6
+;;    DWORDLONG IntA0;    // $16: argument registers, a0 - a5
+;;    DWORDLONG IntA1;    // $17:
+;;    DWORDLONG IntA2;    // $18:
+;;    DWORDLONG IntA3;    // $19:
+;;    DWORDLONG IntA4;    // $20:
+;;    DWORDLONG IntA5;    // $21:
+;;    DWORDLONG IntT8;    // $22: temporary registers, t8 - t11
+;;    DWORDLONG IntT9;    // $23:
+;;    DWORDLONG IntT10;   // $24:
+;;    DWORDLONG IntT11;   // $25:
+;;    DWORDLONG IntRa;    // $26: return address register, ra
+;;    DWORDLONG IntT12;   // $27: temporary register, t12
+;;    DWORDLONG IntAt;    // $28: assembler temp register, at
+;;    DWORDLONG IntGp;    // $29: global pointer register, gp
+;;    DWORDLONG IntSp;    // $30: stack pointer register, sp
+;;    DWORDLONG IntZero;  // $31: zero register, zero
+;;
+;;    //
+;;    // This section is specified/returned if the ContextFlags word contains
+;;    // the flag CONTEXT_FLOATING_POINT.
+;;    //
+;;
+;;    DWORDLONG Fpcr;     // floating point control register
+;;    DWORDLONG SoftFpcr; // software extension to FPCR
+;;
+;;    //
+;;    // This section is specified/returned if the ContextFlags word contains
+;;    // the flag CONTEXT_CONTROL.
+;;    //
+;;    // N.B. The registers gp, sp, and ra are defined in the integer section,
+;;    //   but are considered part of the control context rather than part of
+;;    //   the integer context.
+;;    //
+;;
+;;    DWORDLONG Fir;      // (fault instruction) continuation address
+;;    DWORD Psr;          // processor status
+;;
+;;    //
+;;    // The flags values within this flag control the contents of
+;;    // a CONTEXT record.
+;;    //
+;;    // If the context record is used as an input parameter, then
+;;    // for each portion of the context record controlled by a flag
+;;    // whose value is set, it is assumed that that portion of the
+;;    // context record contains valid context. If the context record
+;;    // is being used to modify a thread's context, then only that
+;;    // portion of the threads context will be modified.
+;;    //
+;;    // If the context record is used as an IN OUT parameter to capture
+;;    // the context of a thread, then only those portions of the thread's
+;;    // context corresponding to set flags will be returned.
+;;    //
+;;    // The context record is never used as an OUT only parameter.
+;;    //
+;;
+;;    DWORD ContextFlags;
+;;    DWORD Fill[4];      // padding for 16-byte stack frame alignment
+;;
+;;} CONTEXT, *PCONTEXT;
+;;
+;;#else
+;;
+;;//
+;;// 32-bit Context Frame
+;;//
+;;//  This alternate version of the Alpha context structure parallels that
+;;//  of MIPS and IX86 in style for the first 64 entries: 32-bit machines
+;;//  can operate on the fields, and a value declared as a pointer to an
+;;//  array of int's can be used to index into the fields.  This makes life
+;;//  with windbg and ntsd vastly easier.
+;;//
+;;//  There are two parts: the first contains the lower 32-bits of each
+;;//  element in the 64-bit definition above.  The second part contains
+;;//  the upper 32-bits of each 64-bit element above.
+;;//
+;;//  The names in the first part are identical to the 64-bit names.
+;;//  The second part names are prefixed with "High".
+;;//
+;;//  1st half: at 32 bits each, (containing the low parts of 64-bit values)
+;;//      32 floats, 32 ints, fpcrs, fir, psr, contextflags
+;;//  2nd half: at 32 bits each
+;;//      32 floats, 32 ints, fpcrs, fir, fill
+;;//
+;;//  There is no external support for the 32-bit version of the context
+;;//  structure.  It is only used internally by windbg and ntsd.
+;;//
+;;//  This structure must be the same size as the 64-bit version above.
+;;//
+;;
+;;typedef struct _CONTEXT {
+;;
+;;    DWORD FltF0;
+;;    DWORD FltF1;
+;;    DWORD FltF2;
+;;    DWORD FltF3;
+;;    DWORD FltF4;
+;;    DWORD FltF5;
+;;    DWORD FltF6;
+;;    DWORD FltF7;
+;;    DWORD FltF8;
+;;    DWORD FltF9;
+;;    DWORD FltF10;
+;;    DWORD FltF11;
+;;    DWORD FltF12;
+;;    DWORD FltF13;
+;;    DWORD FltF14;
+;;    DWORD FltF15;
+;;    DWORD FltF16;
+;;    DWORD FltF17;
+;;    DWORD FltF18;
+;;    DWORD FltF19;
+;;    DWORD FltF20;
+;;    DWORD FltF21;
+;;    DWORD FltF22;
+;;    DWORD FltF23;
+;;    DWORD FltF24;
+;;    DWORD FltF25;
+;;    DWORD FltF26;
+;;    DWORD FltF27;
+;;    DWORD FltF28;
+;;    DWORD FltF29;
+;;    DWORD FltF30;
+;;    DWORD FltF31;
+;;
+;;    DWORD IntV0;        //  $0: return value register, v0
+;;    DWORD IntT0;        //  $1: temporary registers, t0 - t7
+;;    DWORD IntT1;        //  $2:
+;;    DWORD IntT2;        //  $3:
+;;    DWORD IntT3;        //  $4:
+;;    DWORD IntT4;        //  $5:
+;;    DWORD IntT5;        //  $6:
+;;    DWORD IntT6;        //  $7:
+;;    DWORD IntT7;        //  $8:
+;;    DWORD IntS0;        //  $9: nonvolatile registers, s0 - s5
+;;    DWORD IntS1;        // $10:
+;;    DWORD IntS2;        // $11:
+;;    DWORD IntS3;        // $12:
+;;    DWORD IntS4;        // $13:
+;;    DWORD IntS5;        // $14:
+;;    DWORD IntFp;        // $15: frame pointer register, fp/s6
+;;    DWORD IntA0;        // $16: argument registers, a0 - a5
+;;    DWORD IntA1;        // $17:
+;;    DWORD IntA2;        // $18:
+;;    DWORD IntA3;        // $19:
+;;    DWORD IntA4;        // $20:
+;;    DWORD IntA5;        // $21:
+;;    DWORD IntT8;        // $22: temporary registers, t8 - t11
+;;    DWORD IntT9;        // $23:
+;;    DWORD IntT10;       // $24:
+;;    DWORD IntT11;       // $25:
+;;    DWORD IntRa;        // $26: return address register, ra
+;;    DWORD IntT12;       // $27: temporary register, t12
+;;    DWORD IntAt;        // $28: assembler temp register, at
+;;    DWORD IntGp;        // $29: global pointer register, gp
+;;    DWORD IntSp;        // $30: stack pointer register, sp
+;;    DWORD IntZero;      // $31: zero register, zero
+;;
+;;    DWORD Fpcr;         // floating point control register
+;;    DWORD SoftFpcr;     // software extension to FPCR
+;;
+;;    DWORD Fir;          // (fault instruction) continuation address
+;;
+;;    DWORD Psr;          // processor status
+;;    DWORD ContextFlags;
+;;
+;;    //
+;;    // Beginning of the "second half".
+;;    // The name "High" parallels the HighPart of a LargeInteger.
+;;    //
+;;
+;;    DWORD HighFltF0;
+;;    DWORD HighFltF1;
+;;    DWORD HighFltF2;
+;;    DWORD HighFltF3;
+;;    DWORD HighFltF4;
+;;    DWORD HighFltF5;
+;;    DWORD HighFltF6;
+;;    DWORD HighFltF7;
+;;    DWORD HighFltF8;
+;;    DWORD HighFltF9;
+;;    DWORD HighFltF10;
+;;    DWORD HighFltF11;
+;;    DWORD HighFltF12;
+;;    DWORD HighFltF13;
+;;    DWORD HighFltF14;
+;;    DWORD HighFltF15;
+;;    DWORD HighFltF16;
+;;    DWORD HighFltF17;
+;;    DWORD HighFltF18;
+;;    DWORD HighFltF19;
+;;    DWORD HighFltF20;
+;;    DWORD HighFltF21;
+;;    DWORD HighFltF22;
+;;    DWORD HighFltF23;
+;;    DWORD HighFltF24;
+;;    DWORD HighFltF25;
+;;    DWORD HighFltF26;
+;;    DWORD HighFltF27;
+;;    DWORD HighFltF28;
+;;    DWORD HighFltF29;
+;;    DWORD HighFltF30;
+;;    DWORD HighFltF31;
+;;
+;;    DWORD HighIntV0;        //  $0: return value register, v0
+;;    DWORD HighIntT0;        //  $1: temporary registers, t0 - t7
+;;    DWORD HighIntT1;        //  $2:
+;;    DWORD HighIntT2;        //  $3:
+;;    DWORD HighIntT3;        //  $4:
+;;    DWORD HighIntT4;        //  $5:
+;;    DWORD HighIntT5;        //  $6:
+;;    DWORD HighIntT6;        //  $7:
+;;    DWORD HighIntT7;        //  $8:
+;;    DWORD HighIntS0;        //  $9: nonvolatile registers, s0 - s5
+;;    DWORD HighIntS1;        // $10:
+;;    DWORD HighIntS2;        // $11:
+;;    DWORD HighIntS3;        // $12:
+;;    DWORD HighIntS4;        // $13:
+;;    DWORD HighIntS5;        // $14:
+;;    DWORD HighIntFp;        // $15: frame pointer register, fp/s6
+;;    DWORD HighIntA0;        // $16: argument registers, a0 - a5
+;;    DWORD HighIntA1;        // $17:
+;;    DWORD HighIntA2;        // $18:
+;;    DWORD HighIntA3;        // $19:
+;;    DWORD HighIntA4;        // $20:
+;;    DWORD HighIntA5;        // $21:
+;;    DWORD HighIntT8;        // $22: temporary registers, t8 - t11
+;;    DWORD HighIntT9;        // $23:
+;;    DWORD HighIntT10;       // $24:
+;;    DWORD HighIntT11;       // $25:
+;;    DWORD HighIntRa;        // $26: return address register, ra
+;;    DWORD HighIntT12;       // $27: temporary register, t12
+;;    DWORD HighIntAt;        // $28: assembler temp register, at
+;;    DWORD HighIntGp;        // $29: global pointer register, gp
+;;    DWORD HighIntSp;        // $30: stack pointer register, sp
+;;    DWORD HighIntZero;      // $31: zero register, zero
+;;
+;;    DWORD HighFpcr;         // floating point control register
+;;    DWORD HighSoftFpcr;     // software extension to FPCR
+;;    DWORD HighFir;          // processor status
+;;
+;;    double DoNotUseThisField; // to force quadword structure alignment
+;;    DWORD HighFill[2];      // padding for 16-byte stack frame alignment
+;;
+;;} CONTEXT, *PCONTEXT;
+;;
+;;//
+;;// These should name the fields in the _PORTABLE_32BIT structure
+;;// that overlay the Psr and ContextFlags in the normal structure.
+;;//
+;;
+;;#define _QUAD_PSR_OFFSET   HighSoftFpcr
+;;#define _QUAD_FLAGS_OFFSET HighFir
+;;
+;;#endif // _PORTABLE_32BIT_CONTEXT
+;;
+;;// end_ntddk end_nthal
+;;
+;;#endif // _ALPHA_
+;;
+;;
+;;#ifdef _ALPHA_
+;;
+;;VOID
+;;__jump_unwind (
+;;    PVOID VirtualFramePointer,
+;;    PVOID TargetPc
+;;    );
+;;
+;;#endif // _ALPHA_
+;;
+;;
+;;#ifdef _X86_
+;;
+;;//
+;;// Disable these two pramas that evaluate to "sti" "cli" on x86 so that driver
+;;// writers to not leave them inadvertantly in their code.
+;;//
+;;
+;;#if !defined(MIDL_PASS)
+;;#if !defined(_CFRONT_PASS_)
+;;#if !defined(RC_INVOKED)
+;;
+;;#pragma warning(disable:4164)   // disable C4164 warning so that apps that
+;;                                // build with /Od don't get weird errors !
+;;#pragma function(_enable)
+;;#pragma function(_disable)
+;;
+;;#pragma warning(default:4164)   // reenable C4164 warning
+;;
+;;#endif
+;;#endif
+;;#endif
+;;
+;;
+;;//
+;;//  Define the size of the 80387 save area, which is in the context frame.
+;;//
+;;
+;;#define SIZE_OF_80387_REGISTERS      80
+;;
+;;//
+;;// The following flags control the contents of the CONTEXT structure.
+;;//
+;;
+;;#define CONTEXT_i386    0x00010000    // this assumes that i386 and
+;;#define CONTEXT_i486    0x00010000    // i486 have identical context records
+;;
+;;#define CONTEXT_CONTROL         (CONTEXT_i386 | 0x00000001L) // SS:SP, CS:IP, FLAGS, BP
+;;#define CONTEXT_INTEGER         (CONTEXT_i386 | 0x00000002L) // AX, BX, CX, DX, SI, DI
+;;#define CONTEXT_SEGMENTS        (CONTEXT_i386 | 0x00000004L) // DS, ES, FS, GS
+;;#define CONTEXT_FLOATING_POINT  (CONTEXT_i386 | 0x00000008L) // 387 state
+;;#define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x00000010L) // DB 0-3,6,7
+;;
+;;#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER |\
+;;                      CONTEXT_SEGMENTS)
+;;
+;;typedef struct _FLOATING_SAVE_AREA {
+;;    DWORD   ControlWord;
+;;    DWORD   StatusWord;
+;;    DWORD   TagWord;
+;;    DWORD   ErrorOffset;
+;;    DWORD   ErrorSelector;
+;;    DWORD   DataOffset;
+;;    DWORD   DataSelector;
+;;    BYTE    RegisterArea[SIZE_OF_80387_REGISTERS];
+;;    DWORD   Cr0NpxState;
+;;} FLOATING_SAVE_AREA;
+;;
+;;typedef FLOATING_SAVE_AREA *PFLOATING_SAVE_AREA;
+;;
+;;//
+;;// Context Frame
+;;//
+;;//  This frame has a several purposes: 1) it is used as an argument to
+;;//  NtContinue, 2) is is used to constuct a call frame for APC delivery,
+;;//  and 3) it is used in the user level thread creation routines.
+;;//
+;;//  The layout of the record conforms to a standard call frame.
+;;//
+;;
+;;typedef struct _CONTEXT {
+;;
+;;    //
+;;    // The flags values within this flag control the contents of
+;;    // a CONTEXT record.
+;;    //
+;;    // If the context record is used as an input parameter, then
+;;    // for each portion of the context record controlled by a flag
+;;    // whose value is set, it is assumed that that portion of the
+;;    // context record contains valid context. If the context record
+;;    // is being used to modify a threads context, then only that
+;;    // portion of the threads context will be modified.
+;;    //
+;;    // If the context record is used as an IN OUT parameter to capture
+;;    // the context of a thread, then only those portions of the thread's
+;;    // context corresponding to set flags will be returned.
+;;    //
+;;    // The context record is never used as an OUT only parameter.
+;;    //
+;;
+;;    DWORD ContextFlags;
+;;
+;;    //
+;;    // This section is specified/returned if CONTEXT_DEBUG_REGISTERS is
+;;    // set in ContextFlags.  Note that CONTEXT_DEBUG_REGISTERS is NOT
+;;    // included in CONTEXT_FULL.
+;;    //
+;;
+;;    DWORD   Dr0;
+;;    DWORD   Dr1;
+;;    DWORD   Dr2;
+;;    DWORD   Dr3;
+;;    DWORD   Dr6;
+;;    DWORD   Dr7;
+;;
+;;    //
+;;    // This section is specified/returned if the
+;;    // ContextFlags word contians the flag CONTEXT_FLOATING_POINT.
+;;    //
+;;
+;;    FLOATING_SAVE_AREA FloatSave;
+;;
+;;    //
+;;    // This section is specified/returned if the
+;;    // ContextFlags word contians the flag CONTEXT_SEGMENTS.
+;;    //
+;;
+;;    DWORD   SegGs;
+;;    DWORD   SegFs;
+;;    DWORD   SegEs;
+;;    DWORD   SegDs;
+;;
+;;    //
+;;    // This section is specified/returned if the
+;;    // ContextFlags word contians the flag CONTEXT_INTEGER.
+;;    //
+;;
+;;    DWORD   Edi;
+;;    DWORD   Esi;
+;;    DWORD   Ebx;
+;;    DWORD   Edx;
+;;    DWORD   Ecx;
+;;    DWORD   Eax;
+;;
+;;    //
+;;    // This section is specified/returned if the
+;;    // ContextFlags word contians the flag CONTEXT_CONTROL.
+;;    //
+;;
+;;    DWORD   Ebp;
+;;    DWORD   Eip;
+;;    DWORD   SegCs;              // MUST BE SANITIZED
+;;    DWORD   EFlags;             // MUST BE SANITIZED
+;;    DWORD   Esp;
+;;    DWORD   SegSs;
+;;
+;;} CONTEXT;
+;;
+;;
+;;
+;;typedef CONTEXT *PCONTEXT;
+;;
+;;// begin_ntminiport
+;;
+;;#endif //_X86_
+;;
+;;
+;;typedef struct _LDT_ENTRY {
+;;    WORD    LimitLow;
+;;    WORD    BaseLow;
+;;    union {
+;;        struct {
+;;            BYTE    BaseMid;
+;;            BYTE    Flags1;     // Declare as bytes to avoid alignment
+;;            BYTE    Flags2;     // Problems.
+;;            BYTE    BaseHi;
+;;        } Bytes;
+;;        struct {
+;;            DWORD   BaseMid : 8;
+;;            DWORD   Type : 5;
+;;            DWORD   Dpl : 2;
+;;            DWORD   Pres : 1;
+;;            DWORD   LimitHi : 4;
+;;            DWORD   Sys : 1;
+;;            DWORD   Reserved_0 : 1;
+;;            DWORD   Default_Big : 1;
+;;            DWORD   Granularity : 1;
+;;            DWORD   BaseHi : 8;
+;;        } Bits;
+;;    } HighWord;
+;;} LDT_ENTRY, *PLDT_ENTRY;
+;;
+;;
+;;#if defined(_MIPS_)
+;;
+;;// begin_ntddk begin_nthal
+;;//
+;;// The following flags control the contents of the CONTEXT structure.
+;;//
+;;
+;;#define CONTEXT_R4000   0x00010000    // r4000 context
+;;
+;;#define CONTEXT_CONTROL         (CONTEXT_R4000 | 0x00000001L)
+;;#define CONTEXT_FLOATING_POINT  (CONTEXT_R4000 | 0x00000002L)
+;;#define CONTEXT_INTEGER         (CONTEXT_R4000 | 0x00000004L)
+;;
+;;#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
+;;
+;;//
+;;// Context Frame
+;;//
+;;//  N.B. This frame must be exactly a multiple of 16 bytes in length.
+;;//
+;;//  This frame has a several purposes: 1) it is used as an argument to
+;;//  NtContinue, 2) it is used to constuct a call frame for APC delivery,
+;;//  3) it is used to construct a call frame for exception dispatching
+;;//  in user mode, and 4) it is used in the user level thread creation
+;;//  routines.
+;;//
+;;//  The layout of the record conforms to a standard call frame.
+;;//
+;;
+;;typedef struct _CONTEXT {
+;;
+;;    //
+;;    // This section is always present and is used as an argument build
+;;    // area.
+;;    //
+;;
+;;    DWORD Argument[4];
+;;
+;;    //
+;;    // This section is specified/returned if the ContextFlags word contains
+;;    // the flag CONTEXT_FLOATING_POINT.
+;;    //
+;;
+;;    DWORD FltF0;
+;;    DWORD FltF1;
+;;    DWORD FltF2;
+;;    DWORD FltF3;
+;;    DWORD FltF4;
+;;    DWORD FltF5;
+;;    DWORD FltF6;
+;;    DWORD FltF7;
+;;    DWORD FltF8;
+;;    DWORD FltF9;
+;;    DWORD FltF10;
+;;    DWORD FltF11;
+;;    DWORD FltF12;
+;;    DWORD FltF13;
+;;    DWORD FltF14;
+;;    DWORD FltF15;
+;;    DWORD FltF16;
+;;    DWORD FltF17;
+;;    DWORD FltF18;
+;;    DWORD FltF19;
+;;    DWORD FltF20;
+;;    DWORD FltF21;
+;;    DWORD FltF22;
+;;    DWORD FltF23;
+;;    DWORD FltF24;
+;;    DWORD FltF25;
+;;    DWORD FltF26;
+;;    DWORD FltF27;
+;;    DWORD FltF28;
+;;    DWORD FltF29;
+;;    DWORD FltF30;
+;;    DWORD FltF31;
+;;
+;;    //
+;;    // This section is specified/returned if the ContextFlags word contains
+;;    // the flag CONTEXT_INTEGER.
+;;    //
+;;    // N.B. The registers gp, sp, and ra are defined in this section, but are
+;;    //  considered part of the control context rather than part of the integer
+;;    //  context.
+;;    //
+;;    // N.B. Register zero is not stored in the frame.
+;;    //
+;;
+;;    DWORD IntZero;
+;;    DWORD IntAt;
+;;    DWORD IntV0;
+;;    DWORD IntV1;
+;;    DWORD IntA0;
+;;    DWORD IntA1;
+;;    DWORD IntA2;
+;;    DWORD IntA3;
+;;    DWORD IntT0;
+;;    DWORD IntT1;
+;;    DWORD IntT2;
+;;    DWORD IntT3;
+;;    DWORD IntT4;
+;;    DWORD IntT5;
+;;    DWORD IntT6;
+;;    DWORD IntT7;
+;;    DWORD IntS0;
+;;    DWORD IntS1;
+;;    DWORD IntS2;
+;;    DWORD IntS3;
+;;    DWORD IntS4;
+;;    DWORD IntS5;
+;;    DWORD IntS6;
+;;    DWORD IntS7;
+;;    DWORD IntT8;
+;;    DWORD IntT9;
+;;    DWORD IntK0;
+;;    DWORD IntK1;
+;;    DWORD IntGp;
+;;    DWORD IntSp;
+;;    DWORD IntS8;
+;;    DWORD IntRa;
+;;    DWORD IntLo;
+;;    DWORD IntHi;
+;;
+;;    //
+;;    // This section is specified/returned if the ContextFlags word contains
+;;    // the flag CONTEXT_FLOATING_POINT.
+;;    //
+;;
+;;    DWORD Fsr;
+;;
+;;    //
+;;    // This section is specified/returned if the ContextFlags word contains
+;;    // the flag CONTEXT_CONTROL.
+;;    //
+;;    // N.B. The registers gp, sp, and ra are defined in the integer section,
+;;    //   but are considered part of the control context rather than part of
+;;    //   the integer context.
+;;    //
+;;
+;;    DWORD Fir;
+;;    DWORD Psr;
+;;
+;;    //
+;;    // The flags values within this flag control the contents of
+;;    // a CONTEXT record.
+;;    //
+;;    // If the context record is used as an input parameter, then
+;;    // for each portion of the context record controlled by a flag
+;;    // whose value is set, it is assumed that that portion of the
+;;    // context record contains valid context. If the context record
+;;    // is being used to modify a thread's context, then only that
+;;    // portion of the threads context will be modified.
+;;    //
+;;    // If the context record is used as an IN OUT parameter to capture
+;;    // the context of a thread, then only those portions of the thread's
+;;    // context corresponding to set flags will be returned.
+;;    //
+;;    // The context record is never used as an OUT only parameter.
+;;    //
+;;
+;;    DWORD ContextFlags;
+;;
+;;    DWORD Fill[2];
+;;} CONTEXT, *PCONTEXT;
+;;
+;;// end_ntddk end_nthal
+;;
+;;#endif // MIPS
+;;
+;;
+;;#if defined(_MIPS_)
+;;
+;;VOID
+;;__jump_unwind (
+;;    PVOID Fp,
+;;    PVOID TargetPc
+;;    );
+;;
+;;#endif // MIPS
+;;
+;;#define EXCEPTION_NONCONTINUABLE 0x1    // Noncontinuable exception
+;;#define EXCEPTION_MAXIMUM_PARAMETERS 15 // maximum number of exception parameters
+;;
+;;//
+;;// Exception record definition.
+;;//
+;;
+;;typedef struct _EXCEPTION_RECORD {
+;;    /*lint -e18 */  // Don't complain about different definitions
+;;    DWORD    ExceptionCode;
+;;    /*lint +e18 */  // Resume checking for different definitions
+;;    DWORD ExceptionFlags;
+;;    struct _EXCEPTION_RECORD *ExceptionRecord;
+;;    PVOID ExceptionAddress;
+;;    DWORD NumberParameters;
+;;    DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
+;;    } EXCEPTION_RECORD;
+;;
+;;typedef EXCEPTION_RECORD *PEXCEPTION_RECORD;
+;;
+;;//
+;;// Typedef for pointer returned by exception_info()
+;;//
+;;
+;;typedef struct _EXCEPTION_POINTERS {
+;;    PEXCEPTION_RECORD ExceptionRecord;
+;;    PCONTEXT ContextRecord;
+;;} EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
+;;#define PROCESS_TERMINATE         (0x0001)  
+;;#define PROCESS_CREATE_THREAD     (0x0002)  
+;;#define PROCESS_VM_OPERATION      (0x0008)  
+;;#define PROCESS_VM_READ           (0x0010)  
+;;#define PROCESS_VM_WRITE          (0x0020)  
+;;#define PROCESS_DUP_HANDLE        (0x0040)  
+;;#define PROCESS_CREATE_PROCESS    (0x0080)  
+;;#define PROCESS_SET_INFORMATION   (0x0200)  
+;;#define PROCESS_QUERY_INFORMATION (0x0400)  
+;;#define PROCESS_ALL_ACCESS        (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | \
+;;                                   0xFFF)
+;;
+;;#define THREAD_TERMINATE               (0x0001)  
+;;#define THREAD_SUSPEND_RESUME          (0x0002)  
+;;#define THREAD_GET_CONTEXT             (0x0008)  
+;;#define THREAD_SET_CONTEXT             (0x0010)  
+;;#define THREAD_SET_INFORMATION         (0x0020)  
+;;#define THREAD_QUERY_INFORMATION       (0x0040)  
+;;#define THREAD_SET_THREAD_TOKEN        (0x0080)
+;;#define THREAD_IMPERSONATE             (0x0100)
+;;#define THREAD_DIRECT_IMPERSONATION    (0x0200)
+;;// begin_ntddk
+;;
+;;#define THREAD_ALL_ACCESS         (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | \
+;;                                   0x3FF)
+;;
+;;// end_ntddk
+;;#define TLS_MINIMUM_AVAILABLE 64    
+;;#define THREAD_BASE_PRIORITY_LOWRT  15  // value that gets a thread to LowRealtime-1
+;;#define THREAD_BASE_PRIORITY_MAX    2   // maximum thread base priority boost
+;;#define THREAD_BASE_PRIORITY_MIN    -2  // minimum thread base priority boost
+;;#define THREAD_BASE_PRIORITY_IDLE   -15 // value that gets a thread to idle
+;;#define EVENT_MODIFY_STATE      0x0002  
+;;#define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3) 
+;;#define MUTANT_QUERY_STATE      0x0001
+;;
+;;#define MUTANT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|\
+;;                          MUTANT_QUERY_STATE)
+;;#define SEMAPHORE_MODIFY_STATE      0x0002  
+;;#define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3) 
+;;#define TIME_ZONE_ID_UNKNOWN  0
+;;#define TIME_ZONE_ID_STANDARD 1
+;;#define TIME_ZONE_ID_DAYLIGHT 2
+;;
+;;#define PROCESSOR_INTEL_386     386
+;;#define PROCESSOR_INTEL_486     486
+;;#define PROCESSOR_INTEL_PENTIUM 586
+;;#define PROCESSOR_INTEL_860     860
+;;#define PROCESSOR_MIPS_R2000    2000
+;;#define PROCESSOR_MIPS_R3000    3000
+;;#define PROCESSOR_MIPS_R4000    4000
+;;#define PROCESSOR_ALPHA_21064   21064
+;;
+;;typedef struct _MEMORY_BASIC_INFORMATION {
+;;    PVOID BaseAddress;
+;;    PVOID AllocationBase;
+;;    DWORD AllocationProtect;
+;;    DWORD RegionSize;
+;;    DWORD State;
+;;    DWORD Protect;
+;;    DWORD Type;
+;;} MEMORY_BASIC_INFORMATION, *PMEMORY_BASIC_INFORMATION;
+;;#define SECTION_QUERY       0x0001
+;;#define SECTION_MAP_WRITE   0x0002
+;;#define SECTION_MAP_READ    0x0004
+;;#define SECTION_MAP_EXECUTE 0x0008
+;;#define SECTION_EXTEND_SIZE 0x0010
+;;
+;;#define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SECTION_QUERY|\
+;;                            SECTION_MAP_WRITE |      \
+;;                            SECTION_MAP_READ |       \
+;;                            SECTION_MAP_EXECUTE |    \
+;;                            SECTION_EXTEND_SIZE)
+;;#define PAGE_NOACCESS          0x01     
+;;#define PAGE_READONLY          0x02     
+;;#define PAGE_READWRITE         0x04     
+;;#define PAGE_WRITECOPY         0x08     
+;;#define PAGE_EXECUTE           0x10     
+;;#define PAGE_EXECUTE_READ      0x20     
+;;#define PAGE_EXECUTE_READWRITE 0x40     
+;;#define PAGE_EXECUTE_WRITECOPY 0x80     
+;;#define PAGE_GUARD            0x100     
+;;#define PAGE_NOCACHE          0x200     
+;;#define MEM_COMMIT           0x1000     
+;;#define MEM_RESERVE          0x2000     
+;;#define MEM_DECOMMIT         0x4000     
+;;#define MEM_RELEASE          0x8000     
+;;#define MEM_FREE            0x10000     
+;;#define MEM_PRIVATE         0x20000     
+;;#define MEM_MAPPED          0x40000     
+;;#define MEM_TOP_DOWN       0x100000     
+;;#define SEC_FILE           0x800000     
+;;#define SEC_IMAGE         0x1000000     
+;;#define SEC_RESERVE       0x4000000     
+;;#define SEC_COMMIT        0x8000000     
+;;#define SEC_NOCACHE      0x10000000     
+;;#define MEM_IMAGE         SEC_IMAGE     
+;;
+;;//
+;;// Define access rights to files and directories
+;;//
+;;
+;;//
+;;// The FILE_READ_DATA and FILE_WRITE_DATA constants are also defined in
+;;// devioctl.h as FILE_READ_ACCESS and FILE_WRITE_ACCESS. The values for these
+;;// constants *MUST* always be in sync.
+;;// The values are redefined in devioctl.h because they must be available to
+;;// both DOS and NT.
+;;//
+;;
+;;#define FILE_READ_DATA            ( 0x0001 )    // file & pipe
+;;#define FILE_LIST_DIRECTORY       ( 0x0001 )    // directory
+;;
+;;#define FILE_WRITE_DATA           ( 0x0002 )    // file & pipe
+;;#define FILE_ADD_FILE             ( 0x0002 )    // directory
+;;
+;;#define FILE_APPEND_DATA          ( 0x0004 )    // file
+;;#define FILE_ADD_SUBDIRECTORY     ( 0x0004 )    // directory
+;;#define FILE_CREATE_PIPE_INSTANCE ( 0x0004 )    // named pipe
+;;
+;;#define FILE_READ_EA              ( 0x0008 )    // file & directory
+;;
+;;#define FILE_WRITE_EA             ( 0x0010 )    // file & directory
+;;
+;;#define FILE_EXECUTE              ( 0x0020 )    // file
+;;#define FILE_TRAVERSE             ( 0x0020 )    // directory
+;;
+;;#define FILE_DELETE_CHILD         ( 0x0040 )    // directory
+;;
+;;#define FILE_READ_ATTRIBUTES      ( 0x0080 )    // all
+;;
+;;#define FILE_WRITE_ATTRIBUTES     ( 0x0100 )    // all
+;;
+;;#define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1FF)
+;;
+;;
+;;#define FILE_GENERIC_READ         (STANDARD_RIGHTS_READ     |\
+;;                                   FILE_READ_DATA           |\
+;;                                   FILE_READ_ATTRIBUTES     |\
+;;                                   FILE_READ_EA             |\
+;;                                   SYNCHRONIZE)
+;;
+;;
+;;#define FILE_GENERIC_WRITE        (STANDARD_RIGHTS_WRITE    |\
+;;                                   FILE_WRITE_DATA          |\
+;;                                   FILE_WRITE_ATTRIBUTES    |\
+;;                                   FILE_WRITE_EA            |\
+;;                                   FILE_APPEND_DATA         |\
+;;                                   SYNCHRONIZE)
+;;
+;;
+;;#define FILE_GENERIC_EXECUTE      (STANDARD_RIGHTS_EXECUTE  |\
+;;                                   FILE_READ_ATTRIBUTES     |\
+;;                                   FILE_EXECUTE             |\
+;;                                   SYNCHRONIZE)
+;;
+;;#define FILE_SHARE_READ                 0x00000001  
+;;#define FILE_SHARE_WRITE                0x00000002  
+;;#define FILE_ATTRIBUTE_READONLY         0x00000001  
+;;#define FILE_ATTRIBUTE_HIDDEN           0x00000002  
+;;#define FILE_ATTRIBUTE_SYSTEM           0x00000004  
+;;#define FILE_ATTRIBUTE_DIRECTORY        0x00000010  
+;;#define FILE_ATTRIBUTE_ARCHIVE          0x00000020  
+;;#define FILE_ATTRIBUTE_NORMAL           0x00000080  
+;;#define FILE_ATTRIBUTE_TEMPORARY        0x00000100  
+;;#define FILE_ATTRIBUTE_ATOMIC_WRITE     0x00000200  
+;;#define FILE_ATTRIBUTE_XACTION_WRITE    0x00000400  
+;;#define FILE_NOTIFY_CHANGE_FILE_NAME    0x00000001   
+;;#define FILE_NOTIFY_CHANGE_DIR_NAME     0x00000002   
+;;#define FILE_NOTIFY_CHANGE_ATTRIBUTES   0x00000004   
+;;#define FILE_NOTIFY_CHANGE_SIZE         0x00000008   
+;;#define FILE_NOTIFY_CHANGE_LAST_WRITE   0x00000010   
+;;#define FILE_NOTIFY_CHANGE_SECURITY     0x00000100   
+;;#define MAILSLOT_NO_MESSAGE             ((DWORD)-1) 
+;;#define MAILSLOT_WAIT_FOREVER           ((DWORD)-1) 
+;;#define FILE_CASE_SENSITIVE_SEARCH      0x00000001  
+;;#define FILE_CASE_PRESERVED_NAMES       0x00000002  
+;;#define FILE_UNICODE_ON_DISK            0x00000004  
+;;#define FILE_PERSISTENT_ACLS            0x00000008  
+;;#define DUPLICATE_CLOSE_SOURCE      0x00000001  
+;;#define DUPLICATE_SAME_ACCESS       0x00000002  
+;;typedef PVOID PACCESS_TOKEN;            
+;;typedef PVOID PSECURITY_DESCRIPTOR;     
+;;typedef PVOID PSID;     
+;;////////////////////////////////////////////////////////////////////////
+;;//                                                                    //
+;;//                             ACCESS MASK                            //
+;;//                                                                    //
+;;////////////////////////////////////////////////////////////////////////
+;;
+;;//
+;;//  Define the access mask as a longword sized structure divided up as
+;;//  follows:
+;;//
+;;//       3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+;;//       1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+;;//      +---------------+---------------+-------------------------------+
+;;//      |G|G|G|G|Res'd|A| StandardRights|         SpecificRights        |
+;;//      |R|W|E|A|     |S|               |                               |
+;;//      +-+-------------+---------------+-------------------------------+
+;;//
+;;//      typedef struct _ACCESS_MASK {
+;;//          WORD   SpecificRights;
+;;//          BYTE  StandardRights;
+;;//          BYTE  AccessSystemAcl : 1;
+;;//          BYTE  Reserved : 3;
+;;//          BYTE  GenericAll : 1;
+;;//          BYTE  GenericExecute : 1;
+;;//          BYTE  GenericWrite : 1;
+;;//          BYTE  GenericRead : 1;
+;;//      } ACCESS_MASK;
+;;//      typedef ACCESS_MASK *PACCESS_MASK;
+;;//
+;;//  but to make life simple for programmer's we'll allow them to specify
+;;//  a desired access mask by simply OR'ing together mulitple single rights
+;;//  and treat an access mask as a DWORD.  For example
+;;//
+;;//      DesiredAccess = DELETE | READ_CONTROL
+;;//
+;;//  So we'll declare ACCESS_MASK as DWORD
+;;//
+;;
+;;// begin_ntddk begin_nthal
+;;typedef DWORD ACCESS_MASK;
+;;typedef ACCESS_MASK *PACCESS_MASK;
+;;
+;;////////////////////////////////////////////////////////////////////////
+;;//                                                                    //
+;;//                             ACCESS TYPES                           //
+;;//                                                                    //
+;;////////////////////////////////////////////////////////////////////////
+;;
+;;
+;;// begin_ntddk begin_nthal
+;;//
+;;//  The following are masks for the predefined standard access types
+;;//
+;;
+;;#define DELETE                           (0x00010000L)
+;;#define READ_CONTROL                     (0x00020000L)
+;;#define WRITE_DAC                        (0x00040000L)
+;;#define WRITE_OWNER                      (0x00080000L)
+;;#define SYNCHRONIZE                      (0x00100000L)
+;;
+;;#define STANDARD_RIGHTS_REQUIRED         (0x000F0000L)
+;;
+;;#define STANDARD_RIGHTS_READ             (READ_CONTROL)
+;;#define STANDARD_RIGHTS_WRITE            (READ_CONTROL)
+;;#define STANDARD_RIGHTS_EXECUTE          (READ_CONTROL)
+;;
+;;#define STANDARD_RIGHTS_ALL              (0x001F0000L)
+;;
+;;#define SPECIFIC_RIGHTS_ALL              (0x0000FFFFL)
+;;
+;;//
+;;// AccessSystemAcl access type
+;;//
+;;
+;;#define ACCESS_SYSTEM_SECURITY           (0x01000000L)
+;;
+;;//
+;;// MaximumAllowed access type
+;;//
+;;
+;;#define MAXIMUM_ALLOWED                  (0x02000000L)
+;;
+;;//
+;;//  These are the generic rights.
+;;//
+;;
+;;#define GENERIC_READ                     (0x80000000L)
+;;#define GENERIC_WRITE                    (0x40000000L)
+;;#define GENERIC_EXECUTE                  (0x20000000L)
+;;#define GENERIC_ALL                      (0x10000000L)
+;;
+;;
+;;//
+;;//  Define the generic mapping array.  This is used to denote the
+;;//  mapping of each generic access right to a specific access mask.
+;;//
+;;
+;;typedef struct _GENERIC_MAPPING {
+;;    ACCESS_MASK GenericRead;
+;;    ACCESS_MASK GenericWrite;
+;;    ACCESS_MASK GenericExecute;
+;;    ACCESS_MASK GenericAll;
+;;} GENERIC_MAPPING;
+;;typedef GENERIC_MAPPING *PGENERIC_MAPPING;
+;;
+;;
+;;
+;;////////////////////////////////////////////////////////////////////////
+;;//                                                                    //
+;;//                        LUID_AND_ATTRIBUTES                         //
+;;//                                                                    //
+;;////////////////////////////////////////////////////////////////////////
+;;//
+;;//
+;;
+;;
+;;#ifndef RC_INVOKED
+;;#pragma pack(4)
+;;#endif
+;;
+;;typedef struct _LUID_AND_ATTRIBUTES {
+;;    LUID Luid;
+;;    DWORD Attributes;
+;;    } LUID_AND_ATTRIBUTES, * PLUID_AND_ATTRIBUTES;
+;;typedef LUID_AND_ATTRIBUTES LUID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY];
+;;typedef LUID_AND_ATTRIBUTES_ARRAY *PLUID_AND_ATTRIBUTES_ARRAY;
+;;
+;;#ifndef RC_INVOKED
+;;#pragma pack()
+;;#endif
+;;
+;;
+;;////////////////////////////////////////////////////////////////////////
+;;//                                                                    //
+;;//              Security Id     (SID)                                 //
+;;//                                                                    //
+;;////////////////////////////////////////////////////////////////////////
+;;//
+;;//
+;;// Pictorially the structure of an SID is as follows:
+;;//
+;;//         1   1   1   1   1   1
+;;//         5   4   3   2   1   0   9   8   7   6   5   4   3   2   1   0
+;;//      +---------------------------------------------------------------+
+;;//      |      SubAuthorityCount        |Reserved1 (SBZ)|   Revision    |
+;;//      +---------------------------------------------------------------+
+;;//      |                   IdentifierAuthority[0]                      |
+;;//      +---------------------------------------------------------------+
+;;//      |                   IdentifierAuthority[1]                      |
+;;//      +---------------------------------------------------------------+
+;;//      |                   IdentifierAuthority[2]                      |
+;;//      +---------------------------------------------------------------+
+;;//      |                                                               |
+;;//      +- -  -  -  -  -  -  -  SubAuthority[]  -  -  -  -  -  -  -  - -+
+;;//      |                                                               |
+;;//      +---------------------------------------------------------------+
+;;//
+;;//
+;;
+;;typedef struct _SID_IDENTIFIER_AUTHORITY {
+;;    BYTE  Value[6];
+;;} SID_IDENTIFIER_AUTHORITY, *PSID_IDENTIFIER_AUTHORITY;
+;;
+;;
+;;typedef struct _SID {
+;;   BYTE  Revision;
+;;   BYTE  SubAuthorityCount;
+;;   SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
+;;#ifdef MIDL_PASS
+;;   [size_is(SubAuthorityCount)] DWORD SubAuthority[*];
+;;#else // MIDL_PASS
+;;   DWORD SubAuthority[ANYSIZE_ARRAY];
+;;#endif // MIDL_PASS
+;;} SID, *PISID;
+;;
+;;
+;;#define SID_REVISION                     (1)    // Current revision level
+;;#define SID_MAX_SUB_AUTHORITIES          (15)
+;;#define SID_RECOMMENDED_SUB_AUTHORITIES  (1)    // Will change to around 6
+;;                                                // in a future release.
+;;
+;;typedef enum _SID_NAME_USE {
+;;    SidTypeUser = 1,
+;;    SidTypeGroup,
+;;    SidTypeDomain,
+;;    SidTypeAlias,
+;;    SidTypeWellKnownGroup,
+;;    SidTypeDeletedAccount,
+;;    SidTypeInvalid,
+;;    SidTypeUnknown
+;;} SID_NAME_USE, *PSID_NAME_USE;
+;;
+;;
+;;typedef struct _SID_AND_ATTRIBUTES {
+;;    PSID Sid;
+;;    DWORD Attributes;
+;;    } SID_AND_ATTRIBUTES, * PSID_AND_ATTRIBUTES;
+;;
+;;typedef SID_AND_ATTRIBUTES SID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY];
+;;typedef SID_AND_ATTRIBUTES_ARRAY *PSID_AND_ATTRIBUTES_ARRAY;
+;;
+;;
+;;\f
+;;/////////////////////////////////////////////////////////////////////////////
+;;//                                                                         //
+;;// Universal well-known SIDs                                               //
+;;//                                                                         //
+;;//     Null SID              S-1-0-0                                       //
+;;//     World                 S-1-1-0                                       //
+;;//     Local                 S-1-2-0                                       //
+;;//     Creator Owner ID      S-1-3-0                                       //
+;;//     Creator Group ID      S-1-3-1                                       //
+;;//                                                                         //
+;;//     (Non-unique IDs)      S-1-4                                         //
+;;//                                                                         //
+;;/////////////////////////////////////////////////////////////////////////////
+;;
+;;#define SECURITY_NULL_SID_AUTHORITY     {0,0,0,0,0,0}
+;;#define SECURITY_WORLD_SID_AUTHORITY    {0,0,0,0,0,1}
+;;#define SECURITY_LOCAL_SID_AUTHORITY    {0,0,0,0,0,2}
+;;#define SECURITY_CREATOR_SID_AUTHORITY  {0,0,0,0,0,3}
+;;#define SECURITY_NON_UNIQUE_AUTHORITY   {0,0,0,0,0,4}
+;;
+;;#define SECURITY_NULL_RID               (0x00000000L)
+;;#define SECURITY_WORLD_RID              (0x00000000L)
+;;#define SECURITY_LOCAL_RID              (0X00000000L)
+;;
+;;#define SECURITY_CREATOR_OWNER_RID      (0x00000000L)
+;;#define SECURITY_CREATOR_GROUP_RID      (0x00000001L)
+;;
+;;
+;;
+;;
+;;/////////////////////////////////////////////////////////////////////////////
+;;//                                                                         //
+;;// NT well-known SIDs                                                      //
+;;//                                                                         //
+;;//     NT Authority          S-1-5                                         //
+;;//     Dialup                S-1-5-1                                       //
+;;//                                                                         //
+;;//     Network               S-1-5-2                                       //
+;;//     Batch                 S-1-5-3                                       //
+;;//     Interactive           S-1-5-4                                       //
+;;//     Service               S-1-5-6                                       //
+;;//     AnonymousLogon        S-1-5-7       (aka null logon session)        //
+;;//                                                                         //
+;;//     (Logon IDs)           S-1-5-5-X-Y                                   //
+;;//                                                                         //
+;;//     (NT non-unique IDs)   S-1-5-0x15-...                                //
+;;//                                                                         //
+;;//     (Built-in domain)     s-1-5-0x20                                    //
+;;//                                                                         //
+;;/////////////////////////////////////////////////////////////////////////////
+;;
+;;
+;;#define SECURITY_NT_AUTHORITY           {0,0,0,0,0,5}
+;;
+;;#define SECURITY_DIALUP_RID             (0x00000001L)
+;;#define SECURITY_NETWORK_RID            (0x00000002L)
+;;#define SECURITY_BATCH_RID              (0x00000003L)
+;;#define SECURITY_INTERACTIVE_RID        (0x00000004L)
+;;#define SECURITY_SERVICE_RID            (0x00000006L)
+;;#define SECURITY_ANONYMOUS_LOGON_RID    (0x00000007L)
+;;
+;;#define SECURITY_LOGON_IDS_RID          (0x00000005L)
+;;#define SECURITY_LOGON_IDS_RID_COUNT    (3L)
+;;
+;;#define SECURITY_LOCAL_SYSTEM_RID       (0x00000012L)
+;;
+;;#define SECURITY_NT_NON_UNIQUE          (0x00000015L)
+;;
+;;#define SECURITY_BUILTIN_DOMAIN_RID     (0x00000020L)
+;;
+;;
+;;
+;;
+;;\f
+;;/////////////////////////////////////////////////////////////////////////////
+;;//                                                                         //
+;;// well-known domain relative sub-authority values (RIDs)...               //
+;;//                                                                         //
+;;/////////////////////////////////////////////////////////////////////////////
+;;
+;;// Well-known users ...
+;;
+;;#define DOMAIN_USER_RID_ADMIN          (0x000001F4L)
+;;#define DOMAIN_USER_RID_GUEST          (0x000001F5L)
+;;
+;;
+;;
+;;// well-known groups ...
+;;
+;;#define DOMAIN_GROUP_RID_ADMINS        (0x00000200L)
+;;#define DOMAIN_GROUP_RID_USERS         (0x00000201L)
+;;
+;;
+;;
+;;
+;;// well-known aliases ...
+;;
+;;#define DOMAIN_ALIAS_RID_ADMINS        (0x00000220L)
+;;#define DOMAIN_ALIAS_RID_USERS         (0x00000221L)
+;;#define DOMAIN_ALIAS_RID_GUESTS        (0x00000222L)
+;;#define DOMAIN_ALIAS_RID_POWER_USERS   (0x00000223L)
+;;
+;;#define DOMAIN_ALIAS_RID_ACCOUNT_OPS   (0x00000224L)
+;;#define DOMAIN_ALIAS_RID_SYSTEM_OPS    (0x00000225L)
+;;#define DOMAIN_ALIAS_RID_PRINT_OPS     (0x00000226L)
+;;#define DOMAIN_ALIAS_RID_BACKUP_OPS    (0x00000227L)
+;;
+;;#define DOMAIN_ALIAS_RID_REPLICATOR    (0x00000228L)
+;;
+;;
+;;
+;;
+;;
+;;
+;;//
+;;// Allocate the System Luid.  The first 1000 LUIDs are reserved.
+;;// Use #999 here (0x3E7 = 999)
+;;//
+;;
+;;#define SYSTEM_LUID                     { 0x3E7, 0x0 }
+;;
+;;
+;;
+;;////////////////////////////////////////////////////////////////////////
+;;//                                                                    //
+;;//                          User and Group related SID attributes     //
+;;//                                                                    //
+;;////////////////////////////////////////////////////////////////////////
+;;
+;;//
+;;// Group attributes
+;;//
+;;
+;;#define SE_GROUP_MANDATORY              (0x00000001L)
+;;#define SE_GROUP_ENABLED_BY_DEFAULT     (0x00000002L)
+;;#define SE_GROUP_ENABLED                (0x00000004L)
+;;#define SE_GROUP_OWNER                  (0x00000008L)
+;;#define SE_GROUP_LOGON_ID               (0xC0000000L)
+;;
+;;
+;;
+;;//
+;;// User attributes
+;;//
+;;
+;;// (None yet defined.)
+;;
+;;
+;;\f
+;;
+;;////////////////////////////////////////////////////////////////////////
+;;//                                                                    //
+;;//                         ACL  and  ACE                              //
+;;//                                                                    //
+;;////////////////////////////////////////////////////////////////////////
+;;
+;;//
+;;//  Define an ACL and the ACE format.  The structure of an ACL header
+;;//  followed by one or more ACEs.  Pictorally the structure of an ACL header
+;;//  is as follows:
+;;//
+;;//       3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+;;//       1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+;;//      +-------------------------------+---------------+---------------+
+;;//      |            AclSize            |      Sbz1     |  AclRevision  |
+;;//      +-------------------------------+---------------+---------------+
+;;//      |              Sbz2             |           AceCount            |
+;;//      +-------------------------------+-------------------------------+
+;;//
+;;//  The current AclRevision is defined to be ACL_REVISION.
+;;//
+;;//  AclSize is the size, in bytes, allocated for the ACL.  This includes
+;;//  the ACL header, ACES, and remaining free space in the buffer.
+;;//
+;;//  AceCount is the number of ACES in the ACL.
+;;//
+;;
+;;// begin_ntddk
+;;// This is the *current* ACL revision
+;;
+;;#define ACL_REVISION     (2)
+;;
+;;// This is the history of ACL revisions.  Add a new one whenever
+;;// ACL_REVISION is updated
+;;
+;;#define ACL_REVISION1   (1)
+;;#define ACL_REVISION2   (2)
+;;
+;;typedef struct _ACL {
+;;    BYTE  AclRevision;
+;;    BYTE  Sbz1;
+;;    WORD   AclSize;
+;;    WORD   AceCount;
+;;    WORD   Sbz2;
+;;} ACL;
+;;typedef ACL *PACL;
+;;
+;;// end_ntddk
+;;
+;;//
+;;//  The structure of an ACE is a common ace header followed by ace type
+;;//  specific data.  Pictorally the structure of the common ace header is
+;;//  as follows:
+;;//
+;;//       3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+;;//       1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+;;//      +---------------+-------+-------+---------------+---------------+
+;;//      |            AceSize            |    AceFlags   |     AceType   |
+;;//      +---------------+-------+-------+---------------+---------------+
+;;//
+;;//  AceType denotes the type of the ace, there are some predefined ace
+;;//  types
+;;//
+;;//  AceSize is the size, in bytes, of ace.
+;;//
+;;//  AceFlags are the Ace flags for audit and inheritance, defined shortly.
+;;
+;;typedef struct _ACE_HEADER {
+;;    BYTE  AceType;
+;;    BYTE  AceFlags;
+;;    WORD   AceSize;
+;;} ACE_HEADER;
+;;typedef ACE_HEADER *PACE_HEADER;
+;;
+;;//
+;;//  The following are the predefined ace types that go into the AceType
+;;//  field of an Ace header.
+;;//
+;;
+;;#define ACCESS_ALLOWED_ACE_TYPE          (0x0)
+;;#define ACCESS_DENIED_ACE_TYPE           (0x1)
+;;#define SYSTEM_AUDIT_ACE_TYPE            (0x2)
+;;#define SYSTEM_ALARM_ACE_TYPE            (0x3)
+;;
+;;//
+;;//  The following are the inherit flags that go into the AceFlags field
+;;//  of an Ace header.
+;;//
+;;
+;;#define OBJECT_INHERIT_ACE                (0x1)
+;;#define CONTAINER_INHERIT_ACE             (0x2)
+;;#define NO_PROPAGATE_INHERIT_ACE          (0x4)
+;;#define INHERIT_ONLY_ACE                  (0x8)
+;;#define VALID_INHERIT_FLAGS               (0xF)
+;;
+;;
+;;//  The following are the currently defined ACE flags that go into the
+;;//  AceFlags field of an ACE header.  Each ACE type has its own set of
+;;//  AceFlags.
+;;//
+;;//  SUCCESSFUL_ACCESS_ACE_FLAG - used only with system audit and alarm ACE
+;;//  types to indicate that a message is generated for successful accesses.
+;;//
+;;//  FAILED_ACCESS_ACE_FLAG - used only with system audit and alarm ACE types
+;;//  to indicate that a message is generated for failed accesses.
+;;//
+;;
+;;//
+;;//  SYSTEM_AUDIT and SYSTEM_ALARM AceFlags
+;;//
+;;//  These control the signaling of audit and alarms for success or failure.
+;;//
+;;
+;;#define SUCCESSFUL_ACCESS_ACE_FLAG       (0x40)
+;;#define FAILED_ACCESS_ACE_FLAG           (0x80)
+;;
+;;
+;;//
+;;//  We'll define the structure of the predefined ACE types.  Pictorally
+;;//  the structure of the predefined ACE's is as follows:
+;;//
+;;//       3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+;;//       1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+;;//      +---------------+-------+-------+---------------+---------------+
+;;//      |    AceFlags   | Resd  |Inherit|    AceSize    |     AceType   |
+;;//      +---------------+-------+-------+---------------+---------------+
+;;//      |                              Mask                             |
+;;//      +---------------------------------------------------------------+
+;;//      |                                                               |
+;;//      +                                                               +
+;;//      |                                                               |
+;;//      +                              Sid                              +
+;;//      |                                                               |
+;;//      +                                                               +
+;;//      |                                                               |
+;;//      +---------------------------------------------------------------+
+;;//
+;;//  Mask is the access mask associated with the ACE.  This is either the
+;;//  access allowed, access denied, audit, or alarm mask.
+;;//
+;;//  Sid is the Sid associated with the ACE.
+;;//
+;;
+;;//  The following are the four predefined ACE types.
+;;
+;;//  Examine the AceType field in the Header to determine
+;;//  which structure is appropriate to use for casting.
+;;
+;;typedef struct _ACCESS_ALLOWED_ACE {
+;;    ACE_HEADER Header;
+;;    ACCESS_MASK Mask;
+;;    DWORD SidStart;
+;;} ACCESS_ALLOWED_ACE;
+;;
+;;typedef ACCESS_ALLOWED_ACE *PACCESS_ALLOWED_ACE;
+;;
+;;typedef struct _ACCESS_DENIED_ACE {
+;;    ACE_HEADER Header;
+;;    ACCESS_MASK Mask;
+;;    DWORD SidStart;
+;;} ACCESS_DENIED_ACE;
+;;typedef ACCESS_DENIED_ACE *PACCESS_DENIED_ACE;
+;;
+;;typedef struct _SYSTEM_AUDIT_ACE {
+;;    ACE_HEADER Header;
+;;    ACCESS_MASK Mask;
+;;    DWORD SidStart;
+;;} SYSTEM_AUDIT_ACE;
+;;typedef SYSTEM_AUDIT_ACE *PSYSTEM_AUDIT_ACE;
+;;
+;;typedef struct _SYSTEM_ALARM_ACE {
+;;    ACE_HEADER Header;
+;;    ACCESS_MASK Mask;
+;;    DWORD SidStart;
+;;} SYSTEM_ALARM_ACE;
+;;typedef SYSTEM_ALARM_ACE *PSYSTEM_ALARM_ACE;
+;;
+;;
+;;\f
+;;//
+;;//  The following declarations are used for setting and querying information
+;;//  about and ACL.  First are the various information classes available to
+;;//  the user.
+;;//
+;;
+;;typedef enum _ACL_INFORMATION_CLASS {
+;;    AclRevisionInformation = 1,
+;;    AclSizeInformation
+;;} ACL_INFORMATION_CLASS;
+;;
+;;//
+;;//  This record is returned/sent if the user is requesting/setting the
+;;//  AclRevisionInformation
+;;//
+;;
+;;typedef struct _ACL_REVISION_INFORMATION {
+;;    DWORD AclRevision;
+;;} ACL_REVISION_INFORMATION;
+;;typedef ACL_REVISION_INFORMATION *PACL_REVISION_INFORMATION;
+;;
+;;//
+;;//  This record is returned if the user is requesting AclSizeInformation
+;;//
+;;
+;;typedef struct _ACL_SIZE_INFORMATION {
+;;    DWORD AceCount;
+;;    DWORD AclBytesInUse;
+;;    DWORD AclBytesFree;
+;;} ACL_SIZE_INFORMATION;
+;;typedef ACL_SIZE_INFORMATION *PACL_SIZE_INFORMATION;
+;;
+;;
+;;////////////////////////////////////////////////////////////////////////
+;;//                                                                    //
+;;//                             SECURITY_DESCRIPTOR                    //
+;;//                                                                    //
+;;////////////////////////////////////////////////////////////////////////
+;;//
+;;//  Define the Security Descriptor and related data types.
+;;//  This is an opaque data structure.
+;;//
+;;
+;;// begin_ntddk
+;;//
+;;// Current security descriptor revision value
+;;//
+;;
+;;#define SECURITY_DESCRIPTOR_REVISION     (1)
+;;#define SECURITY_DESCRIPTOR_REVISION1    (1)
+;;
+;;// end_ntddk
+;;
+;;//
+;;// Minimum length, in bytes, needed to build a security descriptor
+;;// (NOTE: This must manually be kept consistent with the)
+;;// (sizeof(SECURITY_DESCRIPTOR)                         )
+;;//
+;;
+;;#define SECURITY_DESCRIPTOR_MIN_LENGTH   (20)
+;;
+;;
+;;typedef WORD   SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL;
+;;
+;;#define SE_OWNER_DEFAULTED               (0x0001)
+;;#define SE_GROUP_DEFAULTED               (0x0002)
+;;#define SE_DACL_PRESENT                  (0x0004)
+;;#define SE_DACL_DEFAULTED                (0x0008)
+;;#define SE_SACL_PRESENT                  (0x0010)
+;;#define SE_SACL_DEFAULTED                (0x0020)
+;;#define SE_SELF_RELATIVE                 (0x8000)
+;;
+;;//
+;;//  Where:
+;;//
+;;//      SE_OWNER_DEFAULTED - This boolean flag, when set, indicates that the
+;;//          SID pointed to by the Owner field was provided by a
+;;//          defaulting mechanism rather than explicitly provided by the
+;;//          original provider of the security descriptor.  This may
+;;//          affect the treatment of the SID with respect to inheritence
+;;//          of an owner.
+;;//
+;;//      SE_GROUP_DEFAULTED - This boolean flag, when set, indicates that the
+;;//          SID in the Group field was provided by a defaulting mechanism
+;;//          rather than explicitly provided by the original provider of
+;;//          the security descriptor.  This may affect the treatment of
+;;//          the SID with respect to inheritence of a primary group.
+;;//
+;;//      SE_DACL_PRESENT - This boolean flag, when set, indicates that the
+;;//          security descriptor contains a discretionary ACL.  If this
+;;//          flag is set and the Dacl field of the SECURITY_DESCRIPTOR is
+;;//          null, then a null ACL is explicitly being specified.
+;;//
+;;//      SE_DACL_DEFAULTED - This boolean flag, when set, indicates that the
+;;//          ACL pointed to by the Dacl field was provided by a defaulting
+;;//          mechanism rather than explicitly provided by the original
+;;//          provider of the security descriptor.  This may affect the
+;;//          treatment of the ACL with respect to inheritence of an ACL.
+;;//          This flag is ignored if the DaclPresent flag is not set.
+;;//
+;;//      SE_SACL_PRESENT - This boolean flag, when set,  indicates that the
+;;//          security descriptor contains a system ACL pointed to by the
+;;//          Sacl field.  If this flag is set and the Sacl field of the
+;;//          SECURITY_DESCRIPTOR is null, then an empty (but present)
+;;//          ACL is being specified.
+;;//
+;;//      SE_SACL_DEFAULTED - This boolean flag, when set, indicates that the
+;;//          ACL pointed to by the Sacl field was provided by a defaulting
+;;//          mechanism rather than explicitly provided by the original
+;;//          provider of the security descriptor.  This may affect the
+;;//          treatment of the ACL with respect to inheritence of an ACL.
+;;//          This flag is ignored if the SaclPresent flag is not set.
+;;//
+;;//      SE_SELF_RELATIVE - This boolean flag, when set, indicates that the
+;;//          security descriptor is in self-relative form.  In this form,
+;;//          all fields of the security descriptor are contiguous in memory
+;;//          and all pointer fields are expressed as offsets from the
+;;//          beginning of the security descriptor.  This form is useful
+;;//          for treating security descriptors as opaque data structures
+;;//          for transmission in communication protocol or for storage on
+;;//          secondary media.
+;;//
+;;//
+;;//
+;;// Pictorially the structure of a security descriptor is as follows:
+;;//
+;;//       3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+;;//       1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+;;//      +---------------------------------------------------------------+
+;;//      |            Control            |Reserved1 (SBZ)|   Revision    |
+;;//      +---------------------------------------------------------------+
+;;//      |                            Owner                              |
+;;//      +---------------------------------------------------------------+
+;;//      |                            Group                              |
+;;//      +---------------------------------------------------------------+
+;;//      |                            Sacl                               |
+;;//      +---------------------------------------------------------------+
+;;//      |                            Dacl                               |
+;;//      +---------------------------------------------------------------+
+;;//
+;;// In general, this data structure should be treated opaquely to ensure future
+;;// compatibility.
+;;//
+;;//
+;;
+;;typedef struct _SECURITY_DESCRIPTOR {
+;;   BYTE  Revision;
+;;   BYTE  Sbz1;
+;;   SECURITY_DESCRIPTOR_CONTROL Control;
+;;   PSID Owner;
+;;   PSID Group;
+;;   PACL Sacl;
+;;   PACL Dacl;
+;;   } SECURITY_DESCRIPTOR, *PISECURITY_DESCRIPTOR;
+;;
+;;
+;;// Where:
+;;//
+;;//     Revision - Contains the revision level of the security
+;;//         descriptor.  This allows this structure to be passed between
+;;//         systems or stored on disk even though it is expected to
+;;//         change in the future.
+;;//
+;;//     Control - A set of flags which qualify the meaning of the
+;;//         security descriptor or individual fields of the security
+;;//         descriptor.
+;;//
+;;//     Owner - is a pointer to an SID representing an object's owner.
+;;//         If this field is null, then no owner SID is present in the
+;;//         security descriptor.  If the security descriptor is in
+;;//         self-relative form, then this field contains an offset to
+;;//         the SID, rather than a pointer.
+;;//
+;;//     Group - is a pointer to an SID representing an object's primary
+;;//         group.  If this field is null, then no primary group SID is
+;;//         present in the security descriptor.  If the security descriptor
+;;//         is in self-relative form, then this field contains an offset to
+;;//         the SID, rather than a pointer.
+;;//
+;;//     Sacl - is a pointer to a system ACL.  This field value is only
+;;//         valid if the DaclPresent control flag is set.  If the
+;;//         SaclPresent flag is set and this field is null, then a null
+;;//         ACL  is specified.  If the security descriptor is in
+;;//         self-relative form, then this field contains an offset to
+;;//         the ACL, rather than a pointer.
+;;//
+;;//     Dacl - is a pointer to a discretionary ACL.  This field value is
+;;//         only valid if the DaclPresent control flag is set.  If the
+;;//         DaclPresent flag is set and this field is null, then a null
+;;//         ACL (unconditionally granting access) is specified.  If the
+;;//         security descriptor is in self-relative form, then this field
+;;//         contains an offset to the ACL, rather than a pointer.
+;;//
+;;
+;;
+;;
+;;////////////////////////////////////////////////////////////////////////
+;;//                                                                    //
+;;//               Privilege Related Data Structures                    //
+;;//                                                                    //
+;;////////////////////////////////////////////////////////////////////////
+;;
+;;
+;;// begin_ntddk begin_nthal
+;;//
+;;// Privilege attributes
+;;//
+;;
+;;#define SE_PRIVILEGE_ENABLED_BY_DEFAULT (0x00000001L)
+;;#define SE_PRIVILEGE_ENABLED            (0x00000002L)
+;;#define SE_PRIVILEGE_USED_FOR_ACCESS    (0x80000000L)
+;;
+;;//
+;;// Privilege Set Control flags
+;;//
+;;
+;;#define PRIVILEGE_SET_ALL_NECESSARY    (1)
+;;
+;;//
+;;//  Privilege Set - This is defined for a privilege set of one.
+;;//                  If more than one privilege is needed, then this structure
+;;//                  will need to be allocated with more space.
+;;//
+;;//  Note: don't change this structure without fixing the INITIAL_PRIVILEGE_SET
+;;//  structure (defined in se.h)
+;;//
+;;
+;;typedef struct _PRIVILEGE_SET {
+;;    DWORD PrivilegeCount;
+;;    DWORD Control;
+;;    LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY];
+;;    } PRIVILEGE_SET, * PPRIVILEGE_SET;
+;;
+;;
+;;////////////////////////////////////////////////////////////////////////
+;;//                                                                    //
+;;//               NT Defined Privileges                                //
+;;//                                                                    //
+;;////////////////////////////////////////////////////////////////////////
+;;
+;;#define SE_CREATE_TOKEN_NAME              TEXT("SeCreateTokenPrivilege")
+;;#define SE_ASSIGNPRIMARYTOKEN_NAME        TEXT("SeAssignPrimaryTokenPrivilege")
+;;#define SE_LOCK_MEMORY_NAME               TEXT("SeLockMemoryPrivilege")
+;;#define SE_INCREASE_QUOTA_NAME            TEXT("SeIncreaseQuotaPrivilege")
+;;#define SE_UNSOLICITED_INPUT_NAME         TEXT("SeUnsolicitedInputPrivilege")
+;;#define SE_TCB_NAME                       TEXT("SeTcbPrivilege")
+;;#define SE_SECURITY_NAME                  TEXT("SeSecurityPrivilege")
+;;#define SE_TAKE_OWNERSHIP_NAME            TEXT("SeTakeOwnershipPrivilege")
+;;#define SE_LOAD_DRIVER_NAME               TEXT("SeLoadDriverPrivilege")
+;;#define SE_SYSTEM_PROFILE_NAME            TEXT("SeSystemProfilePrivilege")
+;;#define SE_SYSTEMTIME_NAME                TEXT("SeSystemtimePrivilege")
+;;#define SE_PROF_SINGLE_PROCESS_NAME       TEXT("SeProfileSingleProcessPrivilege")
+;;#define SE_INC_BASE_PRIORITY_NAME         TEXT("SeIncreaseBasePriorityPrivilege")
+;;#define SE_CREATE_PAGEFILE_NAME           TEXT("SeCreatePagefilePrivilege")
+;;#define SE_CREATE_PERMANENT_NAME          TEXT("SeCreatePermanentPrivilege")
+;;#define SE_BACKUP_NAME                    TEXT("SeBackupPrivilege")
+;;#define SE_RESTORE_NAME                   TEXT("SeRestorePrivilege")
+;;#define SE_SHUTDOWN_NAME                  TEXT("SeShutdownPrivilege")
+;;#define SE_DEBUG_NAME                     TEXT("SeDebugPrivilege")
+;;#define SE_AUDIT_NAME                     TEXT("SeAuditPrivilege")
+;;#define SE_SYSTEM_ENVIRONMENT_NAME        TEXT("SeSystemEnvironmentPrivilege")
+;;#define SE_CHANGE_NOTIFY_NAME             TEXT("SeChangeNotifyPrivilege")
+;;#define SE_REMOTE_SHUTDOWN_NAME           TEXT("SeRemoteShutdownPrivilege")
+;;
+;;
+;;////////////////////////////////////////////////////////////////////
+;;//                                                                //
+;;//           Security Quality Of Service                          //
+;;//                                                                //
+;;//                                                                //
+;;////////////////////////////////////////////////////////////////////
+;;
+;;// begin_ntddk begin_nthal
+;;//
+;;// Impersonation Level
+;;//
+;;// Impersonation level is represented by a pair of bits in Windows.
+;;// If a new impersonation level is added or lowest value is changed from
+;;// 0 to something else, fix the Windows CreateFile call.
+;;//
+;;
+;;typedef enum _SECURITY_IMPERSONATION_LEVEL {
+;;    SecurityAnonymous,
+;;    SecurityIdentification,
+;;    SecurityImpersonation,
+;;    SecurityDelegation
+;;    } SECURITY_IMPERSONATION_LEVEL, * PSECURITY_IMPERSONATION_LEVEL;
+;;
+;;#define SECURITY_MAX_IMPERSONATION_LEVEL SecurityDelegation
+;;
+;;#define DEFAULT_IMPERSONATION_LEVEL SecurityImpersonation
+;;
+;;// end_nthal
+;;//
+;;// Security Tracking Mode
+;;//
+;;
+;;#define SECURITY_DYNAMIC_TRACKING      (TRUE)
+;;#define SECURITY_STATIC_TRACKING       (FALSE)
+;;
+;;typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE,
+;;                    * PSECURITY_CONTEXT_TRACKING_MODE;
+;;
+;;
+;;
+;;//
+;;// Quality Of Service
+;;//
+;;
+;;typedef struct _SECURITY_QUALITY_OF_SERVICE {
+;;    DWORD Length;
+;;    SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
+;;    SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode;
+;;    BOOLEAN EffectiveOnly;
+;;    } SECURITY_QUALITY_OF_SERVICE, * PSECURITY_QUALITY_OF_SERVICE;
+;;
+;;
+;;//
+;;// Used to represent information related to a thread impersonation
+;;//
+;;
+;;typedef struct _SE_IMPERSONATION_STATE {
+;;    PACCESS_TOKEN Token;
+;;    BOOLEAN CopyOnOpen;
+;;    BOOLEAN EffectiveOnly;
+;;    SECURITY_IMPERSONATION_LEVEL Level;
+;;} SE_IMPERSONATION_STATE, *PSE_IMPERSONATION_STATE;
+;;
+;;
+;;////////////////////////////////////////////////////////////////////
+;;//                                                                //
+;;//           Token Object Definitions                             //
+;;//                                                                //
+;;//                                                                //
+;;////////////////////////////////////////////////////////////////////
+;;
+;;
+;;//
+;;// Token Specific Access Rights.
+;;//
+;;
+;;#define TOKEN_ASSIGN_PRIMARY    (0x0001)
+;;#define TOKEN_DUPLICATE         (0x0002)
+;;#define TOKEN_IMPERSONATE       (0x0004)
+;;#define TOKEN_QUERY             (0x0008)
+;;#define TOKEN_QUERY_SOURCE      (0x0010)
+;;#define TOKEN_ADJUST_PRIVILEGES (0x0020)
+;;#define TOKEN_ADJUST_GROUPS     (0x0040)
+;;#define TOKEN_ADJUST_DEFAULT    (0x0080)
+;;
+;;#define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED  |\
+;;                          TOKEN_ASSIGN_PRIMARY      |\
+;;                          TOKEN_DUPLICATE           |\
+;;                          TOKEN_IMPERSONATE         |\
+;;                          TOKEN_QUERY               |\
+;;                          TOKEN_QUERY_SOURCE        |\
+;;                          TOKEN_ADJUST_PRIVILEGES   |\
+;;                          TOKEN_ADJUST_GROUPS       |\
+;;                          TOKEN_ADJUST_DEFAULT)
+;;
+;;
+;;#define TOKEN_READ       (STANDARD_RIGHTS_READ      |\
+;;                          TOKEN_QUERY)
+;;
+;;
+;;#define TOKEN_WRITE      (STANDARD_RIGHTS_WRITE     |\
+;;                          TOKEN_ADJUST_PRIVILEGES   |\
+;;                          TOKEN_ADJUST_GROUPS       |\
+;;                          TOKEN_ADJUST_DEFAULT)
+;;
+;;#define TOKEN_EXECUTE    (STANDARD_RIGHTS_EXECUTE)
+;;
+;;
+;;//
+;;// Token Types
+;;//
+;;
+;;typedef enum _TOKEN_TYPE {
+;;    TokenPrimary = 1,
+;;    TokenImpersonation
+;;    } TOKEN_TYPE;
+;;typedef TOKEN_TYPE *PTOKEN_TYPE;
+;;
+;;
+;;//
+;;// Token Information Classes.
+;;//
+;;
+;;
+;;typedef enum _TOKEN_INFORMATION_CLASS {
+;;    TokenUser = 1,
+;;    TokenGroups,
+;;    TokenPrivileges,
+;;    TokenOwner,
+;;    TokenPrimaryGroup,
+;;    TokenDefaultDacl,
+;;    TokenSource,
+;;    TokenType,
+;;    TokenImpersonationLevel,
+;;    TokenStatistics
+;;} TOKEN_INFORMATION_CLASS, *PTOKEN_INFORMATION_CLASS;
+;;
+;;//
+;;// Token information class structures
+;;//
+;;
+;;typedef struct _TOKEN_USER {
+;;    SID_AND_ATTRIBUTES User;
+;;} TOKEN_USER, *PTOKEN_USER;
+;;
+;;
+;;typedef struct _TOKEN_GROUPS {
+;;    DWORD GroupCount;
+;;    SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
+;;} TOKEN_GROUPS, *PTOKEN_GROUPS;
+;;
+;;
+;;typedef struct _TOKEN_PRIVILEGES {
+;;    DWORD PrivilegeCount;
+;;    LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY];
+;;} TOKEN_PRIVILEGES, *PTOKEN_PRIVILEGES;
+;;
+;;
+;;typedef struct _TOKEN_OWNER {
+;;    PSID Owner;
+;;} TOKEN_OWNER, *PTOKEN_OWNER;
+;;
+;;
+;;typedef struct _TOKEN_PRIMARY_GROUP {
+;;    PSID PrimaryGroup;
+;;} TOKEN_PRIMARY_GROUP, *PTOKEN_PRIMARY_GROUP;
+;;
+;;
+;;typedef struct _TOKEN_DEFAULT_DACL {
+;;    PACL DefaultDacl;
+;;} TOKEN_DEFAULT_DACL, *PTOKEN_DEFAULT_DACL;
+;;
+;;
+;;
+;;#define TOKEN_SOURCE_LENGTH 8
+;;
+;;typedef struct _TOKEN_SOURCE {
+;;    CHAR SourceName[TOKEN_SOURCE_LENGTH];
+;;    LUID SourceIdentifier;
+;;} TOKEN_SOURCE, *PTOKEN_SOURCE;
+;;
+;;
+;;typedef struct _TOKEN_STATISTICS {
+;;    LUID TokenId;
+;;    LUID AuthenticationId;
+;;    LARGE_INTEGER ExpirationTime;
+;;    TOKEN_TYPE TokenType;
+;;    SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
+;;    DWORD DynamicCharged;
+;;    DWORD DynamicAvailable;
+;;    DWORD GroupCount;
+;;    DWORD PrivilegeCount;
+;;    LUID ModifiedId;
+;;} TOKEN_STATISTICS, *PTOKEN_STATISTICS;
+;;
+;;
+;;typedef struct _TOKEN_CONTROL {
+;;    LUID TokenId;
+;;    LUID AuthenticationId;
+;;    LUID ModifiedId;
+;;    TOKEN_SOURCE TokenSource;
+;;    } TOKEN_CONTROL, *PTOKEN_CONTROL;
+;;
+;;
+;;typedef DWORD SECURITY_INFORMATION, *PSECURITY_INFORMATION;
+;;
+;;#define OWNER_SECURITY_INFORMATION       (0X00000001L)
+;;#define GROUP_SECURITY_INFORMATION       (0X00000002L)
+;;#define DACL_SECURITY_INFORMATION        (0X00000004L)
+;;#define SACL_SECURITY_INFORMATION        (0X00000008L)
+;;
+;;
+;;//
+;;// Image Format
+;;//
+;;
+;;#ifndef RC_INVOKED
+;;#pragma pack (1)
+;;#endif // !RC_INVOKED
+;;
+;;#define IMAGE_DOS_SIGNATURE                 0x5A4D      // MZ
+;;#define IMAGE_OS2_SIGNATURE                 0x454E      // NE
+;;#define IMAGE_OS2_SIGNATURE_LE              0x454C      // LE
+;;#define IMAGE_NT_SIGNATURE                  0x00004550  // PE00
+;;
+;;typedef struct _IMAGE_DOS_HEADER {      // DOS .EXE header
+;;    WORD   e_magic;                     // Magic number
+;;    WORD   e_cblp;                      // Bytes on last page of file
+;;    WORD   e_cp;                        // Pages in file
+;;    WORD   e_crlc;                      // Relocations
+;;    WORD   e_cparhdr;                   // Size of header in paragraphs
+;;    WORD   e_minalloc;                  // Minimum extra paragraphs needed
+;;    WORD   e_maxalloc;                  // Maximum extra paragraphs needed
+;;    WORD   e_ss;                        // Initial (relative) SS value
+;;    WORD   e_sp;                        // Initial SP value
+;;    WORD   e_csum;                      // Checksum
+;;    WORD   e_ip;                        // Initial IP value
+;;    WORD   e_cs;                        // Initial (relative) CS value
+;;    WORD   e_lfarlc;                    // File address of relocation table
+;;    WORD   e_ovno;                      // Overlay number
+;;    WORD   e_res[4];                    // Reserved words
+;;    WORD   e_oemid;                     // OEM identifier (for e_oeminfo)
+;;    WORD   e_oeminfo;                   // OEM information; e_oemid specific
+;;    WORD   e_res2[10];                  // Reserved words
+;;    LONG   e_lfanew;                    // File address of new exe header
+;;  } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
+;;
+;;typedef struct _IMAGE_OS2_HEADER {      // OS/2 .EXE header
+;;    WORD   ne_magic;                    // Magic number
+;;    CHAR   ne_ver;                      // Version number
+;;    CHAR   ne_rev;                      // Revision number
+;;    WORD   ne_enttab;                   // Offset of Entry Table
+;;    WORD   ne_cbenttab;                 // Number of bytes in Entry Table
+;;    LONG   ne_crc;                      // Checksum of whole file
+;;    WORD   ne_flags;                    // Flag word
+;;    WORD   ne_autodata;                 // Automatic data segment number
+;;    WORD   ne_heap;                     // Initial heap allocation
+;;    WORD   ne_stack;                    // Initial stack allocation
+;;    LONG   ne_csip;                     // Initial CS:IP setting
+;;    LONG   ne_sssp;                     // Initial SS:SP setting
+;;    WORD   ne_cseg;                     // Count of file segments
+;;    WORD   ne_cmod;                     // Entries in Module Reference Table
+;;    WORD   ne_cbnrestab;                // Size of non-resident name table
+;;    WORD   ne_segtab;                   // Offset of Segment Table
+;;    WORD   ne_rsrctab;                  // Offset of Resource Table
+;;    WORD   ne_restab;                   // Offset of resident name table
+;;    WORD   ne_modtab;                   // Offset of Module Reference Table
+;;    WORD   ne_imptab;                   // Offset of Imported Names Table
+;;    LONG   ne_nrestab;                  // Offset of Non-resident Names Table
+;;    WORD   ne_cmovent;                  // Count of movable entries
+;;    WORD   ne_align;                    // Segment alignment shift count
+;;    WORD   ne_cres;                     // Count of resource segments
+;;    BYTE   ne_exetyp;                   // Target Operating system
+;;    BYTE   ne_flagsothers;              // Other .EXE flags
+;;    WORD   ne_pretthunks;               // offset to return thunks
+;;    WORD   ne_psegrefbytes;             // offset to segment ref. bytes
+;;    WORD   ne_swaparea;                 // Minimum code swap area size
+;;    WORD   ne_expver;                   // Expected Windows version number
+;;  } IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER;
+;;
+;;//
+;;// File header format.
+;;//
+;;
+;;typedef struct _IMAGE_FILE_HEADER {
+;;    WORD    Machine;
+;;    WORD    NumberOfSections;
+;;    DWORD   TimeDateStamp;
+;;    DWORD   PointerToSymbolTable;
+;;    DWORD   NumberOfSymbols;
+;;    WORD    SizeOfOptionalHeader;
+;;    WORD    Characteristics;
+;;} IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
+;;
+;;#define IMAGE_SIZEOF_FILE_HEADER             20
+;;
+;;#define IMAGE_FILE_RELOCS_STRIPPED           0x0001  // Relocation info stripped from file.
+;;#define IMAGE_FILE_EXECUTABLE_IMAGE          0x0002  // File is executable  (i.e. no unresolved externel references).
+;;#define IMAGE_FILE_LINE_NUMS_STRIPPED        0x0004  // Line nunbers stripped from file.
+;;#define IMAGE_FILE_LOCAL_SYMS_STRIPPED       0x0008  // Local symbols stripped from file.
+;;#define IMAGE_FILE_MINIMAL_OBJECT            0x0010  // Reserved.
+;;#define IMAGE_FILE_UPDATE_OBJECT             0x0020  // Reserved.
+;;#define IMAGE_FILE_16BIT_MACHINE             0x0040  // 16 bit word machine.
+;;#define IMAGE_FILE_BYTES_REVERSED_LO         0x0080  // Bytes of machine word are reversed.
+;;#define IMAGE_FILE_32BIT_MACHINE             0x0100  // 32 bit word machine.
+;;#define IMAGE_FILE_DEBUG_STRIPPED            0x0200  // Debugging info stripped from file in .DBG file
+;;#define IMAGE_FILE_PATCH                     0x0400  // Reserved.
+;;#define IMAGE_FILE_SYSTEM                    0x1000  // System File.
+;;#define IMAGE_FILE_DLL                       0x2000  // File is a DLL.
+;;#define IMAGE_FILE_BYTES_REVERSED_HI         0x8000  // Bytes of machine word are reversed.
+;;
+;;#define IMAGE_FILE_MACHINE_UNKNOWN           0
+;;#define IMAGE_FILE_MACHINE_I860              0x14d   // Intel 860.
+;;#define IMAGE_FILE_MACHINE_I386              0x14c   // Intel 386.
+;;#define IMAGE_FILE_MACHINE_R3000             0x162   // MIPS little-endian, 0540 big-endian
+;;#define IMAGE_FILE_MACHINE_R4000             0x166   // MIPS little-endian
+;;#define IMAGE_FILE_MACHINE_ALPHA             0x184   // Alpha_AXP
+;;
+;;//
+;;// Directory format.
+;;//
+;;
+;;typedef struct _IMAGE_DATA_DIRECTORY {
+;;    DWORD   VirtualAddress;
+;;    DWORD   Size;
+;;} IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
+;;
+;;#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES    16
+;;
+;;//
+;;// Optional header format.
+;;//
+;;
+;;typedef struct _IMAGE_OPTIONAL_HEADER {
+;;    //
+;;    // Standard fields.
+;;    //
+;;
+;;    WORD    Magic;
+;;    BYTE    MajorLinkerVersion;
+;;    BYTE    MinorLinkerVersion;
+;;    DWORD   SizeOfCode;
+;;    DWORD   SizeOfInitializedData;
+;;    DWORD   SizeOfUninitializedData;
+;;    DWORD   AddressOfEntryPoint;
+;;    DWORD   BaseOfCode;
+;;    DWORD   BaseOfData;
+;;
+;;    //
+;;    // NT additional fields.
+;;    //
+;;
+;;    DWORD   ImageBase;
+;;    DWORD   SectionAlignment;
+;;    DWORD   FileAlignment;
+;;    WORD    MajorOperatingSystemVersion;
+;;    WORD    MinorOperatingSystemVersion;
+;;    WORD    MajorImageVersion;
+;;    WORD    MinorImageVersion;
+;;    WORD    MajorSubsystemVersion;
+;;    WORD    MinorSubsystemVersion;
+;;    DWORD   Reserved1;
+;;    DWORD   SizeOfImage;
+;;    DWORD   SizeOfHeaders;
+;;    DWORD   CheckSum;
+;;    WORD    Subsystem;
+;;    WORD    DllCharacteristics;
+;;    DWORD   SizeOfStackReserve;
+;;    DWORD   SizeOfStackCommit;
+;;    DWORD   SizeOfHeapReserve;
+;;    DWORD   SizeOfHeapCommit;
+;;    DWORD   LoaderFlags;
+;;    DWORD   NumberOfRvaAndSizes;
+;;    IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
+;;} IMAGE_OPTIONAL_HEADER, *PIMAGE_OPTIONAL_HEADER;
+;;
+;;#define IMAGE_SIZEOF_STD_OPTIONAL_HEADER      28
+;;#define IMAGE_SIZEOF_NT_OPTIONAL_HEADER      224
+;;
+;;typedef struct _IMAGE_NT_HEADERS {
+;;    DWORD Signature;
+;;    IMAGE_FILE_HEADER FileHeader;
+;;    IMAGE_OPTIONAL_HEADER OptionalHeader;
+;;} IMAGE_NT_HEADERS, *PIMAGE_NT_HEADERS;
+;;
+;;#define IMAGE_FIRST_SECTION( ntheader ) ((PIMAGE_SECTION_HEADER)        \
+;;    ((DWORD)ntheader +                                                  \
+;;     FIELD_OFFSET( IMAGE_NT_HEADERS, OptionalHeader ) +                 \
+;;     ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader   \
+;;    ))
+;;
+;;
+;;// Subsystem Values
+;;
+;;#define IMAGE_SUBSYSTEM_UNKNOWN              0   // Unknown subsystem.
+;;#define IMAGE_SUBSYSTEM_NATIVE               1   // Image doesn't require a subsystem.
+;;#define IMAGE_SUBSYSTEM_WINDOWS_GUI          2   // Image runs in the Windows GUI subsystem.
+;;#define IMAGE_SUBSYSTEM_WINDOWS_CUI          3   // Image runs in the Windows character subsystem.
+;;#define IMAGE_SUBSYSTEM_OS2_CUI              5   // image runs in the OS/2 character subsystem.
+;;#define IMAGE_SUBSYSTEM_POSIX_CUI            7   // image run  in the Posix character subsystem.
+;;
+;;// Dll Characteristics
+;;
+;;#define IMAGE_LIBRARY_PROCESS_INIT           1   // Dll has a process initialization routine.
+;;#define IMAGE_LIBRARY_PROCESS_TERM           2   // Dll has a thread termination routine.
+;;#define IMAGE_LIBRARY_THREAD_INIT            4   // Dll has a thread initialization routine.
+;;#define IMAGE_LIBRARY_THREAD_TERM            8   // Dll has a thread termination routine.
+;;
+;;//
+;;// Loader Flags
+;;//
+;;
+;;#define IMAGE_LOADER_FLAGS_BREAK_ON_LOAD    0x00000001
+;;#define IMAGE_LOADER_FLAGS_DEBUG_ON_LOAD    0x00000002
+;;
+;;
+;;// Directory Entries
+;;
+;;#define IMAGE_DIRECTORY_ENTRY_EXPORT         0   // Export Directory
+;;#define IMAGE_DIRECTORY_ENTRY_IMPORT         1   // Import Directory
+;;#define IMAGE_DIRECTORY_ENTRY_RESOURCE       2   // Resource Directory
+;;#define IMAGE_DIRECTORY_ENTRY_EXCEPTION      3   // Exception Directory
+;;#define IMAGE_DIRECTORY_ENTRY_SECURITY       4   // Security Directory
+;;#define IMAGE_DIRECTORY_ENTRY_BASERELOC      5   // Base Relocation Table
+;;#define IMAGE_DIRECTORY_ENTRY_DEBUG          6   // Debug Directory
+;;#define IMAGE_DIRECTORY_ENTRY_COPYRIGHT      7   // Description String
+;;#define IMAGE_DIRECTORY_ENTRY_GLOBALPTR      8   // Machine Value (MIPS GP)
+;;#define IMAGE_DIRECTORY_ENTRY_TLS            9   // TLS Directory
+;;#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG   10   // Load Configuration Directory
+;;
+;;//
+;;// Section header format.
+;;//
+;;
+;;#define IMAGE_SIZEOF_SHORT_NAME              8
+;;
+;;typedef struct _IMAGE_SECTION_HEADER {
+;;    BYTE    Name[IMAGE_SIZEOF_SHORT_NAME];
+;;    union {
+;;            DWORD   PhysicalAddress;
+;;            DWORD   VirtualSize;
+;;    } Misc;
+;;    DWORD   VirtualAddress;
+;;    DWORD   SizeOfRawData;
+;;    DWORD   PointerToRawData;
+;;    DWORD   PointerToRelocations;
+;;    DWORD   PointerToLinenumbers;
+;;    WORD    NumberOfRelocations;
+;;    WORD    NumberOfLinenumbers;
+;;    DWORD   Characteristics;
+;;} IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;
+;;
+;;#define IMAGE_SIZEOF_SECTION_HEADER          40
+;;
+;;#define IMAGE_SCN_TYPE_REGULAR               0x00000000  //
+;;#define IMAGE_SCN_TYPE_DUMMY                 0x00000001  // Reserved.
+;;#define IMAGE_SCN_TYPE_NO_LOAD               0x00000002  // Reserved.
+;;#define IMAGE_SCN_TYPE_GROUPED               0x00000004  // Used for 16-bit offset code.
+;;#define IMAGE_SCN_TYPE_NO_PAD                0x00000008  // Reserved.
+;;#define IMAGE_SCN_TYPE_COPY                  0x00000010  // Reserved.
+;;
+;;#define IMAGE_SCN_CNT_CODE                   0x00000020  // Section contains code.
+;;#define IMAGE_SCN_CNT_INITIALIZED_DATA       0x00000040  // Section contains initialized data.
+;;#define IMAGE_SCN_CNT_UNINITIALIZED_DATA     0x00000080  // Section contains uninitialized data.
+;;
+;;#define IMAGE_SCN_LNK_OTHER                  0x00000100  // Reserved.
+;;#define IMAGE_SCN_LNK_INFO                   0x00000200  // Section contains comments or some other type of information.
+;;#define IMAGE_SCN_LNK_OVERLAY                0x00000400  // Section contains an overlay.
+;;#define IMAGE_SCN_LNK_REMOVE                 0x00000800  // Section contents will not become part of image.
+;;#define IMAGE_SCN_LNK_COMDAT                 0x00001000  // Section contents comdat.
+;;
+;;#define IMAGE_SCN_ALIGN_1BYTES               0x00100000  //
+;;#define IMAGE_SCN_ALIGN_2BYTES               0x00200000  //
+;;#define IMAGE_SCN_ALIGN_4BYTES               0x00300000  //
+;;#define IMAGE_SCN_ALIGN_8BYTES               0x00400000  //
+;;#define IMAGE_SCN_ALIGN_16BYTES              0x00500000  // Default alignment if no others are specified.
+;;#define IMAGE_SCN_ALIGN_32BYTES              0x00600000  //
+;;#define IMAGE_SCN_ALIGN_64BYTES              0x00700000  //
+;;
+;;#define IMAGE_SCN_MEM_DISCARDABLE            0x02000000  // Section can be discarded.
+;;#define IMAGE_SCN_MEM_NOT_CACHED             0x04000000  // Section is not cachable.
+;;#define IMAGE_SCN_MEM_NOT_PAGED              0x08000000  // Section is not pageable.
+;;#define IMAGE_SCN_MEM_SHARED                 0x10000000  // Section is shareable.
+;;#define IMAGE_SCN_MEM_EXECUTE                0x20000000  // Section is executable.
+;;#define IMAGE_SCN_MEM_READ                   0x40000000  // Section is readable.
+;;#define IMAGE_SCN_MEM_WRITE                  0x80000000  // Section is writeable.
+;;
+;;//
+;;// Symbol format.
+;;//
+;;
+;;typedef struct _IMAGE_SYMBOL {
+;;    union {
+;;        BYTE    ShortName[8];
+;;        struct {
+;;            DWORD   Short;     // if 0, use LongName
+;;            DWORD   Long;      // offset into string table
+;;        } Name;
+;;        PBYTE   LongName[2];
+;;    } N;
+;;    DWORD   Value;
+;;    SHORT   SectionNumber;
+;;    WORD    Type;
+;;    BYTE    StorageClass;
+;;    BYTE    NumberOfAuxSymbols;
+;;} IMAGE_SYMBOL;
+;;typedef IMAGE_SYMBOL UNALIGNED *PIMAGE_SYMBOL;
+;;
+;;#define IMAGE_SIZEOF_SYMBOL                  18
+;;
+;;//
+;;// Section values.
+;;//
+;;// Symbols have a section number of the section in which they are
+;;// defined. Otherwise, section numbers have the following meanings:
+;;//
+;;
+;;#define IMAGE_SYM_UNDEFINED           (SHORT)0           // Symbol is undefined or is common.
+;;#define IMAGE_SYM_ABSOLUTE            (SHORT)-1          // Symbol is an absolute value.
+;;#define IMAGE_SYM_DEBUG               (SHORT)-2          // Symbol is a special debug item.
+;;
+;;//
+;;// Type (fundamental) values.
+;;//
+;;
+;;#define IMAGE_SYM_TYPE_NULL                  0           // no type.
+;;#define IMAGE_SYM_TYPE_VOID                  1           //
+;;#define IMAGE_SYM_TYPE_CHAR                  2           // type character.
+;;#define IMAGE_SYM_TYPE_SHORT                 3           // type short integer.
+;;#define IMAGE_SYM_TYPE_INT                   4           //
+;;#define IMAGE_SYM_TYPE_LONG                  5           //
+;;#define IMAGE_SYM_TYPE_FLOAT                 6           //
+;;#define IMAGE_SYM_TYPE_DOUBLE                7           //
+;;#define IMAGE_SYM_TYPE_STRUCT                8           //
+;;#define IMAGE_SYM_TYPE_UNION                 9           //
+;;#define IMAGE_SYM_TYPE_ENUM                  10          // enumeration.
+;;#define IMAGE_SYM_TYPE_MOE                   11          // member of enumeration.
+;;#define IMAGE_SYM_TYPE_BYTE                  12          //
+;;#define IMAGE_SYM_TYPE_WORD                  13          //
+;;#define IMAGE_SYM_TYPE_UINT                  14          //
+;;#define IMAGE_SYM_TYPE_DWORD                 15          //
+;;
+;;//
+;;// Type (derived) values.
+;;//
+;;
+;;#define IMAGE_SYM_DTYPE_NULL                 0           // no derived type.
+;;#define IMAGE_SYM_DTYPE_POINTER              1           // pointer.
+;;#define IMAGE_SYM_DTYPE_FUNCTION             2           // function.
+;;#define IMAGE_SYM_DTYPE_ARRAY                3           // array.
+;;
+;;//
+;;// Storage classes.
+;;//
+;;
+;;#define IMAGE_SYM_CLASS_END_OF_FUNCTION      (BYTE )-1
+;;#define IMAGE_SYM_CLASS_NULL                 0
+;;#define IMAGE_SYM_CLASS_AUTOMATIC            1
+;;#define IMAGE_SYM_CLASS_EXTERNAL             2
+;;#define IMAGE_SYM_CLASS_STATIC               3
+;;#define IMAGE_SYM_CLASS_REGISTER             4
+;;#define IMAGE_SYM_CLASS_EXTERNAL_DEF         5
+;;#define IMAGE_SYM_CLASS_LABEL                6
+;;#define IMAGE_SYM_CLASS_UNDEFINED_LABEL      7
+;;#define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT     8
+;;#define IMAGE_SYM_CLASS_ARGUMENT             9
+;;#define IMAGE_SYM_CLASS_STRUCT_TAG           10
+;;#define IMAGE_SYM_CLASS_MEMBER_OF_UNION      11
+;;#define IMAGE_SYM_CLASS_UNION_TAG            12
+;;#define IMAGE_SYM_CLASS_TYPE_DEFINITION      13
+;;#define IMAGE_SYM_CLASS_UNDEFINED_STATIC     14
+;;#define IMAGE_SYM_CLASS_ENUM_TAG             15
+;;#define IMAGE_SYM_CLASS_MEMBER_OF_ENUM       16
+;;#define IMAGE_SYM_CLASS_REGISTER_PARAM       17
+;;#define IMAGE_SYM_CLASS_BIT_FIELD            18
+;;#define IMAGE_SYM_CLASS_BLOCK                100
+;;#define IMAGE_SYM_CLASS_FUNCTION             101
+;;#define IMAGE_SYM_CLASS_END_OF_STRUCT        102
+;;#define IMAGE_SYM_CLASS_FILE                 103
+;;// new
+;;#define IMAGE_SYM_CLASS_SECTION              104
+;;#define IMAGE_SYM_CLASS_WEAK_EXTERNAL        105
+;;
+;;// type packing constants
+;;
+;;#define N_BTMASK                            017
+;;#define N_TMASK                             060
+;;#define N_TMASK1                            0300
+;;#define N_TMASK2                            0360
+;;#define N_BTSHFT                            4
+;;#define N_TSHIFT                            2
+;;
+;;// MACROS
+;;
+;;// Basic Type of  x
+;;#define BTYPE(x) ((x) & N_BTMASK)
+;;
+;;// Is x a pointer?
+;;#ifndef ISPTR
+;;#define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
+;;#endif
+;;
+;;// Is x a function?
+;;#ifndef ISFCN
+;;#define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
+;;#endif
+;;
+;;// Is x an array?
+;;
+;;#ifndef ISARY
+;;#define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
+;;#endif
+;;
+;;// Is x a structure, union, or enumeration TAG?
+;;#ifndef ISTAG
+;;#define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG)
+;;#endif
+;;
+;;#ifndef INCREF
+;;#define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
+;;#endif
+;;#ifndef DECREF
+;;#define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
+;;#endif
+;;
+;;//
+;;// Auxiliary entry format.
+;;//
+;;
+;;typedef union _IMAGE_AUX_SYMBOL {
+;;    struct {
+;;        DWORD    TagIndex;                      // struct, union, or enum tag index
+;;        union {
+;;            struct {
+;;                WORD    Linenumber;             // declaration line number
+;;                WORD    Size;                   // size of struct, union, or enum
+;;            } LnSz;
+;;           DWORD    TotalSize;
+;;        } Misc;
+;;        union {
+;;            struct {                            // if ISFCN, tag, or .bb
+;;                DWORD    PointerToLinenumber;
+;;                DWORD    PointerToNextFunction;
+;;            } Function;
+;;            struct {                            // if ISARY, up to 4 dimen.
+;;                WORD     Dimension[4];
+;;            } Array;
+;;        } FcnAry;
+;;        WORD    TvIndex;                        // tv index
+;;    } Sym;
+;;    struct {
+;;        BYTE    Name[IMAGE_SIZEOF_SYMBOL];
+;;    } File;
+;;    struct {
+;;        DWORD   Length;                         // section length
+;;        WORD    NumberOfRelocations;            // number of relocation entries
+;;        WORD    NumberOfLinenumbers;            // number of line numbers
+;;        DWORD   CheckSum;                       // checksum for communal
+;;        SHORT   Number;                         // section number to associate with
+;;        BYTE    Selection;                      // communal selection type
+;;    } Section;
+;;} IMAGE_AUX_SYMBOL;
+;;typedef IMAGE_AUX_SYMBOL UNALIGNED *PIMAGE_AUX_SYMBOL;
+;;
+;;#define IMAGE_SIZEOF_AUX_SYMBOL              18
+;;
+;;//
+;;// Communal selection types.
+;;//
+;;
+;;#define IMAGE_COMDAT_SELECT_UNKNOWN        0
+;;#define IMAGE_COMDAT_SELECT_NODUPLICATES   1
+;;#define IMAGE_COMDAT_SELECT_ANY            2
+;;#define IMAGE_COMDAT_SELECT_SAME_SIZE      3
+;;#define IMAGE_COMDAT_SELECT_EXACT_MATCH    4
+;;#define IMAGE_COMDAT_SELECT_ASSOCIATIVE    5
+;;
+;;#define IMAGE_WEAK_EXTERN_SEARCH_UNKNOWN   0
+;;#define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
+;;#define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY   2
+;;
+;;
+;;//
+;;// Relocation format.
+;;//
+;;
+;;typedef struct _IMAGE_RELOCATION {
+;;    DWORD   VirtualAddress;
+;;    DWORD   SymbolTableIndex;
+;;    WORD    Type;
+;;} IMAGE_RELOCATION;
+;;typedef IMAGE_RELOCATION UNALIGNED *PIMAGE_RELOCATION;
+;;
+;;#define IMAGE_SIZEOF_RELOCATION              10
+;;
+;;//
+;;// I860 relocation types.
+;;//
+;;
+;;#define IMAGE_REL_I860_ABSOLUTE              0           // Reference is absolute, no relocation is necessary
+;;#define IMAGE_REL_I860_DIR32                 06          // Direct 32-bit reference to the symbols virtual address
+;;#define IMAGE_REL_I860_DIR32NB               07
+;;#define IMAGE_REL_I860_SECTION               012
+;;#define IMAGE_REL_I860_SECREL                013
+;;#define IMAGE_REL_I860_PAIR                  034
+;;#define IMAGE_REL_I860_HIGH                  036
+;;#define IMAGE_REL_I860_LOW0                  037
+;;#define IMAGE_REL_I860_LOW1                  040
+;;#define IMAGE_REL_I860_LOW2                  041
+;;#define IMAGE_REL_I860_LOW3                  042
+;;#define IMAGE_REL_I860_LOW4                  043
+;;#define IMAGE_REL_I860_SPLIT0                044
+;;#define IMAGE_REL_I860_SPLIT1                045
+;;#define IMAGE_REL_I860_SPLIT2                046
+;;#define IMAGE_REL_I860_HIGHADJ               047
+;;#define IMAGE_REL_I860_BRADDR                050
+;;
+;;//
+;;// I386 relocation types.
+;;//
+;;
+;;#define IMAGE_REL_I386_ABSOLUTE              0           // Reference is absolute, no relocation is necessary
+;;#define IMAGE_REL_I386_DIR16                 01          // Direct 16-bit reference to the symbols virtual address
+;;#define IMAGE_REL_I386_REL16                 02          // PC-relative 16-bit reference to the symbols virtual address
+;;#define IMAGE_REL_I386_DIR32                 06          // Direct 32-bit reference to the symbols virtual address
+;;#define IMAGE_REL_I386_DIR32NB               07          // Direct 32-bit reference to the symbols virtual address, base not included
+;;#define IMAGE_REL_I386_SEG12                 011         // Direct 16-bit reference to the segment-selector bits of a 32-bit virtual address
+;;#define IMAGE_REL_I386_SECTION               012
+;;#define IMAGE_REL_I386_SECREL                013
+;;#define IMAGE_REL_I386_REL32                 024         // PC-relative 32-bit reference to the symbols virtual address
+;;
+;;//
+;;// MIPS relocation types.
+;;//
+;;
+;;#define IMAGE_REL_MIPS_ABSOLUTE              0           // Reference is absolute, no relocation is necessary
+;;#define IMAGE_REL_MIPS_REFHALF               01
+;;#define IMAGE_REL_MIPS_REFWORD               02
+;;#define IMAGE_REL_MIPS_JMPADDR               03
+;;#define IMAGE_REL_MIPS_REFHI                 04
+;;#define IMAGE_REL_MIPS_REFLO                 05
+;;#define IMAGE_REL_MIPS_GPREL                 06
+;;#define IMAGE_REL_MIPS_LITERAL               07
+;;#define IMAGE_REL_MIPS_SECTION               012
+;;#define IMAGE_REL_MIPS_SECREL                013
+;;#define IMAGE_REL_MIPS_REFWORDNB             042
+;;#define IMAGE_REL_MIPS_PAIR                  045
+;;
+;;//
+;;// Alpha Relocation types.
+;;//
+;;
+;;#define IMAGE_REL_ALPHA_ABSOLUTE             0x0
+;;#define IMAGE_REL_ALPHA_REFLONG              0x1
+;;#define IMAGE_REL_ALPHA_REFQUAD              0x2
+;;#define IMAGE_REL_ALPHA_GPREL32              0x3
+;;#define IMAGE_REL_ALPHA_LITERAL              0x4
+;;#define IMAGE_REL_ALPHA_LITUSE               0x5
+;;#define IMAGE_REL_ALPHA_GPDISP               0x6
+;;#define IMAGE_REL_ALPHA_BRADDR               0x7
+;;#define IMAGE_REL_ALPHA_HINT                 0x8
+;;#define IMAGE_REL_ALPHA_INLINE_REFLONG       0x9
+;;#define IMAGE_REL_ALPHA_REFHI                0xA
+;;#define IMAGE_REL_ALPHA_REFLO                0xB
+;;#define IMAGE_REL_ALPHA_PAIR                 0xC
+;;#define IMAGE_REL_ALPHA_MATCH                0xD
+;;#define IMAGE_REL_ALPHA_SECTION              0xE
+;;#define IMAGE_REL_ALPHA_SECREL               0xF
+;;#define IMAGE_REL_ALPHA_REFLONGNB            0x10
+;;
+;;//
+;;// Based relocation format.
+;;//
+;;
+;;typedef struct _IMAGE_BASE_RELOCATION {
+;;    DWORD   VirtualAddress;
+;;    DWORD   SizeOfBlock;
+;;//  WORD    TypeOffset[1];
+;;} IMAGE_BASE_RELOCATION, *PIMAGE_BASE_RELOCATION;
+;;
+;;#define IMAGE_SIZEOF_BASE_RELOCATION         8
+;;
+;;//
+;;// Based relocation types.
+;;//
+;;
+;;#define IMAGE_REL_BASED_ABSOLUTE              0
+;;#define IMAGE_REL_BASED_HIGH                  1
+;;#define IMAGE_REL_BASED_LOW                   2
+;;#define IMAGE_REL_BASED_HIGHLOW               3
+;;#define IMAGE_REL_BASED_HIGHADJ               4
+;;#define IMAGE_REL_BASED_MIPS_JMPADDR          5
+;;#define IMAGE_REL_BASED_I860_BRADDR           6
+;;#define IMAGE_REL_BASED_I860_SPLIT            7
+;;
+;;//
+;;// Line number format.
+;;//
+;;
+;;typedef struct _IMAGE_LINENUMBER {
+;;    union {
+;;        DWORD   SymbolTableIndex;                       // Symbol table index of function name if Linenumber is 0.
+;;        DWORD   VirtualAddress;                         // Virtual address of line number.
+;;    } Type;
+;;    WORD    Linenumber;                                 // Line number.
+;;} IMAGE_LINENUMBER;
+;;typedef IMAGE_LINENUMBER UNALIGNED *PIMAGE_LINENUMBER;
+;;
+;;#define IMAGE_SIZEOF_LINENUMBER              6
+;;
+;;//
+;;// Archive format.
+;;//
+;;
+;;#define IMAGE_ARCHIVE_START_SIZE             8
+;;#define IMAGE_ARCHIVE_START                  "!<arch>\n"
+;;#define IMAGE_ARCHIVE_END                    "`\n"
+;;#define IMAGE_ARCHIVE_PAD                    "\n"
+;;#define IMAGE_ARCHIVE_LINKER_MEMBER          "/               "
+;;#define IMAGE_ARCHIVE_LONGNAMES_MEMBER       "//              "
+;;
+;;typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER {
+;;    BYTE     Name[16];                                  // File member name - `/' terminated.
+;;    BYTE     Date[12];                                  // File member date - decimal.
+;;    BYTE     UserID[6];                                 // File member user id - decimal.
+;;    BYTE     GroupID[6];                                // File member group id - decimal.
+;;    BYTE     Mode[8];                                   // File member mode - octal.
+;;    BYTE     Size[10];                                  // File member size - decimal.
+;;    BYTE     EndHeader[2];                              // String to end header.
+;;} IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER;
+;;
+;;#define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR      60
+;;
+;;//
+;;// DLL support.
+;;//
+;;
+;;//
+;;// Export Format
+;;//
+;;
+;;typedef struct _IMAGE_EXPORT_DIRECTORY {
+;;    DWORD   Characteristics;
+;;    DWORD   TimeDateStamp;
+;;    WORD    MajorVersion;
+;;    WORD    MinorVersion;
+;;    DWORD   Name;
+;;    DWORD   Base;
+;;    DWORD   NumberOfFunctions;
+;;    DWORD   NumberOfNames;
+;;    PDWORD  *AddressOfFunctions;
+;;    PDWORD  *AddressOfNames;
+;;    PWORD   *AddressOfNameOrdinals;
+;;} IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY;
+;;
+;;//
+;;// Import Format
+;;//
+;;
+;;typedef struct _IMAGE_IMPORT_BY_NAME {
+;;    WORD    Hint;
+;;    BYTE    Name[1];
+;;} IMAGE_IMPORT_BY_NAME, *PIMAGE_IMPORT_BY_NAME;
+;;
+;;typedef struct _IMAGE_THUNK_DATA {
+;;    union {
+;;        PDWORD Function;
+;;        DWORD Ordinal;
+;;        PIMAGE_IMPORT_BY_NAME AddressOfData;
+;;    } u1;
+;;} IMAGE_THUNK_DATA, *PIMAGE_THUNK_DATA;
+;;
+;;#define IMAGE_ORDINAL_FLAG 0x80000000
+;;#define IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG) != 0)
+;;#define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff)
+;;
+;;typedef struct _IMAGE_IMPORT_DESCRIPTOR {
+;;    DWORD   Characteristics;
+;;    DWORD   TimeDateStamp;
+;;    DWORD   ForwarderChain;
+;;    DWORD   Name;
+;;    PIMAGE_THUNK_DATA FirstThunk;
+;;} IMAGE_IMPORT_DESCRIPTOR, *PIMAGE_IMPORT_DESCRIPTOR;
+;;
+;;//
+;;// Thread Local Storage
+;;//
+;;
+;;typedef VOID
+;;(NTAPI *PIMAGE_TLS_CALLBACK) (
+;;    PVOID DllHandle,
+;;    DWORD Reason,
+;;    PVOID Reserved
+;;    );
+;;
+;;typedef struct _IMAGE_TLS_DIRECTORY {
+;;    DWORD   StartAddressOfRawData;
+;;    DWORD   EndAddressOfRawData;
+;;    PDWORD  AddressOfIndex;
+;;    PIMAGE_TLS_CALLBACK *AddressOfCallBacks;
+;;    DWORD   SizeOfZeroFill;
+;;    DWORD   Characteristics;
+;;} IMAGE_TLS_DIRECTORY, *PIMAGE_TLS_DIRECTORY;
+;;
+;;
+;;//
+;;// Resource Format.
+;;//
+;;
+;;//
+;;// Resource directory consists of two counts, following by a variable length
+;;// array of directory entries.  The first count is the number of entries at
+;;// beginning of the array that have actual names associated with each entry.
+;;// The entries are in ascending order, case insensitive strings.  The second
+;;// count is the number of entries that immediately follow the named entries.
+;;// This second count identifies the number of entries that have 31-bit integer
+;;// Ids as their name.  These entries are also sorted in ascending order.
+;;//
+;;// This structure allows fast lookup by either name or number, but for any
+;;// given resource entry only one form of lookup is supported, not both.
+;;// This is consistant with the syntax of the .RC file and the .RES file.
+;;//
+;;
+;;typedef struct _IMAGE_RESOURCE_DIRECTORY {
+;;    DWORD   Characteristics;
+;;    DWORD   TimeDateStamp;
+;;    WORD    MajorVersion;
+;;    WORD    MinorVersion;
+;;    WORD    NumberOfNamedEntries;
+;;    WORD    NumberOfIdEntries;
+;;//  IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[];
+;;} IMAGE_RESOURCE_DIRECTORY, *PIMAGE_RESOURCE_DIRECTORY;
+;;
+;;#define IMAGE_RESOURCE_NAME_IS_STRING        0x80000000
+;;#define IMAGE_RESOURCE_DATA_IS_DIRECTORY     0x80000000
+;;
+;;//
+;;// Each directory contains the 32-bit Name of the entry and an offset,
+;;// relative to the beginning of the resource directory of the data associated
+;;// with this directory entry.  If the name of the entry is an actual text
+;;// string instead of an integer Id, then the high order bit of the name field
+;;// is set to one and the low order 31-bits are an offset, relative to the
+;;// beginning of the resource directory of the string, which is of type
+;;// IMAGE_RESOURCE_DIRECTORY_STRING.  Otherwise the high bit is clear and the
+;;// low-order 31-bits are the integer Id that identify this resource directory
+;;// entry. If the directory entry is yet another resource directory (i.e. a
+;;// subdirectory), then the high order bit of the offset field will be
+;;// set to indicate this.  Otherwise the high bit is clear and the offset
+;;// field points to a resource data entry.
+;;//
+;;
+;;typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
+;;    DWORD   Name;
+;;    DWORD   OffsetToData;
+;;} IMAGE_RESOURCE_DIRECTORY_ENTRY, *PIMAGE_RESOURCE_DIRECTORY_ENTRY;
+;;
+;;//
+;;// For resource directory entries that have actual string names, the Name
+;;// field of the directory entry points to an object of the following type.
+;;// All of these string objects are stored together after the last resource
+;;// directory entry and before the first resource data object.  This minimizes
+;;// the impact of these variable length objects on the alignment of the fixed
+;;// size directory entry objects.
+;;//
+;;
+;;typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING {
+;;    WORD    Length;
+;;    CHAR    NameString[ 1 ];
+;;} IMAGE_RESOURCE_DIRECTORY_STRING, *PIMAGE_RESOURCE_DIRECTORY_STRING;
+;;
+;;
+;;typedef struct _IMAGE_RESOURCE_DIR_STRING_U {
+;;    WORD    Length;
+;;    WCHAR   NameString[ 1 ];
+;;} IMAGE_RESOURCE_DIR_STRING_U, *PIMAGE_RESOURCE_DIR_STRING_U;
+;;
+;;
+;;//
+;;// Each resource data entry describes a leaf node in the resource directory
+;;// tree.  It contains an offset, relative to the beginning of the resource
+;;// directory of the data for the resource, a size field that gives the number
+;;// of bytes of data at that offset, a CodePage that should be used when
+;;// decoding code point values within the resource data.  Typically for new
+;;// applications the code page would be the unicode code page.
+;;//
+;;
+;;typedef struct _IMAGE_RESOURCE_DATA_ENTRY {
+;;    DWORD   OffsetToData;
+;;    DWORD   Size;
+;;    DWORD   CodePage;
+;;    DWORD   Reserved;
+;;} IMAGE_RESOURCE_DATA_ENTRY, *PIMAGE_RESOURCE_DATA_ENTRY;
+;;
+;;//
+;;// Load Configuration Directory Entry
+;;//
+;;
+;;typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY {
+;;    DWORD   Characteristics;
+;;    DWORD   TimeDateStamp;
+;;    WORD    MajorVersion;
+;;    WORD    MinorVersion;
+;;    DWORD   GlobalFlagsClear;
+;;    DWORD   GlobalFlagsSet;
+;;    DWORD   CriticalSectionDefaultTimeout;
+;;    DWORD   DeCommitFreeBlockThreshold;
+;;    DWORD   DeCommitTotalFreeThreshold;
+;;    DWORD   Reserved[ 8 ];
+;;} IMAGE_LOAD_CONFIG_DIRECTORY, *PIMAGE_LOAD_CONFIG_DIRECTORY;
+;;
+;;
+;;//
+;;// Function table entry format for MIPS/ALPHA images.  Function table is
+;;// pointed to by the IMAGE_DIRECTORY_ENTRY_EXCEPTION directory entry.
+;;// This definition duplicates ones in ntmips.h and ntalpha.h for use
+;;// by portable image file mungers.
+;;//
+;;
+;;typedef struct _IMAGE_RUNTIME_FUNCTION_ENTRY {
+;;    DWORD BeginAddress;
+;;    DWORD EndAddress;
+;;    PVOID ExceptionHandler;
+;;    PVOID HandlerData;
+;;    DWORD PrologEndAddress;
+;;} IMAGE_RUNTIME_FUNCTION_ENTRY, *PIMAGE_RUNTIME_FUNCTION_ENTRY;
+;;
+;;//
+;;// Debug Format
+;;//
+;;
+;;typedef struct _IMAGE_DEBUG_DIRECTORY {
+;;    DWORD   Characteristics;
+;;    DWORD   TimeDateStamp;
+;;    WORD    MajorVersion;
+;;    WORD    MinorVersion;
+;;    DWORD   Type;
+;;    DWORD   SizeOfData;
+;;    DWORD   AddressOfRawData;
+;;    DWORD   PointerToRawData;
+;;} IMAGE_DEBUG_DIRECTORY, *PIMAGE_DEBUG_DIRECTORY;
+;;
+;;#define IMAGE_DEBUG_TYPE_UNKNOWN          0
+;;#define IMAGE_DEBUG_TYPE_COFF             1
+;;#define IMAGE_DEBUG_TYPE_CODEVIEW         2
+;;#define IMAGE_DEBUG_TYPE_FPO              3
+;;#define IMAGE_DEBUG_TYPE_MISC             4
+;;#define IMAGE_DEBUG_TYPE_EXCEPTION        5
+;;#define IMAGE_DEBUG_TYPE_FIXUP            6
+;;#define IMAGE_DEBUG_TYPE_RESERVED6        7
+;;#define IMAGE_DEBUG_TYPE_RESERVED7        8
+;;
+;;typedef struct _IMAGE_COFF_SYMBOLS_HEADER {
+;;    DWORD   NumberOfSymbols;
+;;    DWORD   LvaToFirstSymbol;
+;;    DWORD   NumberOfLinenumbers;
+;;    DWORD   LvaToFirstLinenumber;
+;;    DWORD   RvaToFirstByteOfCode;
+;;    DWORD   RvaToLastByteOfCode;
+;;    DWORD   RvaToFirstByteOfData;
+;;    DWORD   RvaToLastByteOfData;
+;;} IMAGE_COFF_SYMBOLS_HEADER, *PIMAGE_COFF_SYMBOLS_HEADER;
+;;
+;;#define FRAME_FPO   0
+;;#define FRAME_TRAP  1
+;;#define FRAME_TSS   2
+;;
+;;typedef struct _FPO_DATA {
+;;    DWORD       ulOffStart;             // offset 1st byte of function code
+;;    DWORD       cbProcSize;             // # bytes in function
+;;    DWORD       cdwLocals;              // # bytes in locals/4
+;;    WORD        cdwParams;              // # bytes in params/4
+;;    WORD        cbProlog : 8;           // # bytes in prolog
+;;    WORD        cbRegs   : 3;           // # regs saved
+;;    WORD        fHasSEH  : 1;           // TRUE if SEH in func
+;;    WORD        fUseBP   : 1;           // TRUE if EBP has been allocated
+;;    WORD        reserved : 1;           // reserved for future use
+;;    WORD        cbFrame  : 2;           // frame type
+;;} FPO_DATA, *PFPO_DATA;
+;;#define SIZEOF_RFPO_DATA 16
+;;
+;;
+;;#define IMAGE_DEBUG_MISC_EXENAME    1
+;;
+;;typedef struct _IMAGE_DEBUG_MISC {
+;;    DWORD       DataType;               // type of misc data, see defines
+;;    DWORD       Length;                 // total length of record, rounded to four
+;;                                        // byte multiple.
+;;    BOOLEAN     Unicode;                // TRUE if data is unicode string
+;;    BYTE        Reserved[ 3 ];
+;;    BYTE        Data[ 1 ];              // Actual data
+;;} IMAGE_DEBUG_MISC, *PIMAGE_DEBUG_MISC;
+;;
+;;
+;;//
+;;// Debugging information can be stripped from an image file and placed
+;;// in a separate .DBG file, whose file name part is the same as the
+;;// image file name part (e.g. symbols for CMD.EXE could be stripped
+;;// and placed in CMD.DBG).  This is indicated by the IMAGE_FILE_DEBUG_STRIPPED
+;;// flag in the Characteristics field of the file header.  The beginning of
+;;// the .DBG file contains the following structure which captures certain
+;;// information from the image file.  This allows a debug to proceed even if
+;;// the original image file is not accessable.  This header is followed by
+;;// zero of more IMAGE_SECTION_HEADER structures, followed by zero or more
+;;// IMAGE_DEBUG_DIRECTORY structures.  The latter structures and those in
+;;// the image file contain file offsets relative to the beginning of the
+;;// .DBG file.
+;;//
+;;// If symbols have been stripped from an image, the IMAGE_DEBUG_MISC structure
+;;// is left in the image file, but not mapped.  This allows a debugger to
+;;// compute the name of the .DBG file, from the name of the image in the
+;;// IMAGE_DEBUG_MISC structure.
+;;//
+;;
+;;typedef struct _IMAGE_SEPARATE_DEBUG_HEADER {
+;;    WORD        Signature;
+;;    WORD        Flags;
+;;    WORD        Machine;
+;;    WORD        Characteristics;
+;;    DWORD       TimeDateStamp;
+;;    DWORD       CheckSum;
+;;    DWORD       ImageBase;
+;;    DWORD       SizeOfImage;
+;;    DWORD       NumberOfSections;
+;;    DWORD       ExportedNamesSize;
+;;    DWORD       DebugDirectorySize;
+;;    DWORD       Reserved[ 3 ];
+;;} IMAGE_SEPARATE_DEBUG_HEADER, *PIMAGE_SEPARATE_DEBUG_HEADER;
+;;
+;;#define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
+;;
+;;#ifndef RC_INVOKED
+;;#pragma pack ()
+;;#endif  // !RC_INVOKED
+;;
+;;//
+;;// End Image Format
+;;//
+;;
+;;//
+;;// for move macros
+;;//
+;;#include <string.h>
+;;#define HEAP_NO_SERIALIZE               0x00000001      
+;;#define HEAP_GROWABLE                   0x00000002      
+;;#define HEAP_GENERATE_EXCEPTIONS        0x00000004      
+;;#define HEAP_ZERO_MEMORY                0x00000008      
+;;#define HEAP_REALLOC_IN_PLACE_ONLY      0x00000010      
+;;#define HEAP_TAIL_CHECKING_ENABLED      0x00000020      
+;;#define HEAP_FREE_CHECKING_ENABLED      0x00000040      
+;;#define HEAP_DISABLE_COALESCE_ON_FREE   0x00000080      
+;;#ifdef _M_IX86
+;;#define RtlMoveMemory(Destination,Source,Length) memmove((Destination),(Source),(Length))
+;;#define RtlCopyMemory(Destination,Source,Length) memcpy((Destination),(Source),(Length))
+;;#define RtlFillMemory(Destination,Length,Fill) memset((Destination),(Fill),(Length))
+;;#define RtlZeroMemory(Destination,Length) memset((Destination),0,(Length))
+;;#else
+;;#define RtlCopyMemory(Destination,Source,Length) RtlMoveMemory((Destination),(Source),(Length))
+;;VOID
+;;NTAPI
+;;RtlMoveMemory (
+;;   PVOID Destination,
+;;   CONST VOID *Source,
+;;   DWORD Length
+;;   );
+;;
+;;VOID
+;;NTAPI
+;;RtlFillMemory (
+;;   PVOID Destination,
+;;   DWORD Length,
+;;   BYTE  Fill
+;;   );
+;;
+;;VOID
+;;NTAPI
+;;RtlZeroMemory (
+;;   PVOID Destination,
+;;   DWORD Length
+;;   );
+;;#endif
+;;
+;;typedef struct _RTL_CRITICAL_SECTION_DEBUG {
+;;    WORD   Type;
+;;    WORD   CreatorBackTraceIndex;
+;;    struct _RTL_CRITICAL_SECTION *CriticalSection;
+;;    LIST_ENTRY ProcessLocksList;
+;;    DWORD EntryCount;
+;;    DWORD ContentionCount;
+;;    DWORD Depth;
+;;    PVOID OwnerBackTrace[ 5 ];
+;;} RTL_CRITICAL_SECTION_DEBUG, *PRTL_CRITICAL_SECTION_DEBUG;
+;;
+;;#define RTL_CRITSECT_TYPE 0
+;;#define RTL_RESOURCE_TYPE 1
+;;
+;;typedef struct _RTL_CRITICAL_SECTION {
+;;    PRTL_CRITICAL_SECTION_DEBUG DebugInfo;
+;;
+;;    //
+;;    //  The following three fields control entering and exiting the critical
+;;    //  section for the resource
+;;    //
+;;
+;;    LONG LockCount;
+;;    LONG RecursionCount;
+;;    HANDLE OwningThread;        // from the thread's ClientId->UniqueThread
+;;    HANDLE LockSemaphore;
+;;    DWORD Reserved;
+;;} RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;
+;;#define DLL_PROCESS_ATTACH 1    
+;;#define DLL_THREAD_ATTACH  2    
+;;#define DLL_THREAD_DETACH  3    
+;;#define DLL_PROCESS_DETACH 0    
+;;
+;;//
+;;// Defines for the READ flags for Eventlogging
+;;//
+;;#define EVENTLOG_SEQUENTIAL_READ        0X0001
+;;#define EVENTLOG_SEEK_READ              0X0002
+;;#define EVENTLOG_FORWARDS_READ          0X0004
+;;#define EVENTLOG_BACKWARDS_READ         0X0008
+;;
+;;//
+;;// The types of events that can be logged.
+;;//
+;;#define EVENTLOG_SUCCESS                0X0000
+;;#define EVENTLOG_ERROR_TYPE             0x0001
+;;#define EVENTLOG_WARNING_TYPE           0x0002
+;;#define EVENTLOG_INFORMATION_TYPE       0x0004
+;;#define EVENTLOG_AUDIT_SUCCESS          0x0008
+;;#define EVENTLOG_AUDIT_FAILURE          0x0010
+;;
+;;//
+;;// Defines for the WRITE flags used by Auditing for paired events
+;;// These are not implemented in Product 1
+;;//
+;;
+;;#define EVENTLOG_START_PAIRED_EVENT    0x0001
+;;#define EVENTLOG_END_PAIRED_EVENT      0x0002
+;;#define EVENTLOG_END_ALL_PAIRED_EVENTS 0x0004
+;;#define EVENTLOG_PAIRED_EVENT_ACTIVE   0x0008
+;;#define EVENTLOG_PAIRED_EVENT_INACTIVE 0x0010
+;;
+;;//
+;;// Structure that defines the header of the Eventlog record. This is the
+;;// fixed-sized portion before all the variable-length strings, binary
+;;// data and pad bytes.
+;;//
+;;// TimeGenerated is the time it was generated at the client.
+;;// TimeWritten is the time it was put into the log at the server end.
+;;//
+;;
+;;typedef struct _EVENTLOGRECORD {
+;;    DWORD  Length;        // Length of full record
+;;    DWORD  Reserved;      // Used by the service
+;;    DWORD  RecordNumber;  // Absolute record number
+;;    DWORD  TimeGenerated; // Seconds since 1-1-1970
+;;    DWORD  TimeWritten;   // Seconds since 1-1-1970
+;;    DWORD  EventID;
+;;    WORD   EventType;
+;;    WORD   NumStrings;
+;;    WORD   EventCategory;
+;;    WORD   ReservedFlags; // For use with paired events (auditing)
+;;    DWORD  ClosingRecordNumber; // For use with paired events (auditing)
+;;    DWORD  StringOffset;  // Offset from beginning of record
+;;    DWORD  UserSidLength;
+;;    DWORD  UserSidOffset;
+;;    DWORD  DataLength;
+;;    DWORD  DataOffset;    // Offset from beginning of record
+;;    //
+;;    // Then follow:
+;;    //
+;;    // WCHAR SourceName[]
+;;    // WCHAR Computername[]
+;;    // SID   UserSid
+;;    // WCHAR Strings[]
+;;    // BYTE  Data[]
+;;    // CHAR  Pad[]
+;;    // DWORD Length;
+;;    //
+;;} EVENTLOGRECORD, *PEVENTLOGRECORD;
+;;
+;;#define DBG_CONTINUE                    ((DWORD   )0x00010002L) 
+;;#define DBG_TERMINATE_THREAD            ((DWORD   )0x40010003L) 
+;;#define DBG_TERMINATE_PROCESS           ((DWORD   )0x40010004L) 
+;;#define DBG_CONTROL_C                   ((DWORD   )0x40010005L) 
+;;#define DBG_CONTROL_BREAK               ((DWORD   )0x40010008L) 
+;;#define DBG_EXCEPTION_NOT_HANDLED       ((DWORD   )0x80010001L) 
+;;//
+;;
+;;// begin_ntddk begin_nthal
+;;//
+;;// Registry Specific Access Rights.
+;;//
+;;
+;;#define KEY_QUERY_VALUE         (0x0001)
+;;#define KEY_SET_VALUE           (0x0002)
+;;#define KEY_CREATE_SUB_KEY      (0x0004)
+;;#define KEY_ENUMERATE_SUB_KEYS  (0x0008)
+;;#define KEY_NOTIFY              (0x0010)
+;;#define KEY_CREATE_LINK         (0x0020)
+;;
+;;#define KEY_READ                ((STANDARD_RIGHTS_READ       |\
+;;                                  KEY_QUERY_VALUE            |\
+;;                                  KEY_ENUMERATE_SUB_KEYS     |\
+;;                                  KEY_NOTIFY)                 \
+;;                                  &                           \
+;;                                 (~SYNCHRONIZE))
+;;
+;;
+;;#define KEY_WRITE               ((STANDARD_RIGHTS_WRITE      |\
+;;                                  KEY_SET_VALUE              |\
+;;                                  KEY_CREATE_SUB_KEY)         \
+;;                                  &                           \
+;;                                 (~SYNCHRONIZE))
+;;
+;;#define KEY_EXECUTE             ((KEY_READ)                   \
+;;                                  &                           \
+;;                                 (~SYNCHRONIZE))
+;;
+;;#define KEY_ALL_ACCESS          ((STANDARD_RIGHTS_ALL        |\
+;;                                  KEY_QUERY_VALUE            |\
+;;                                  KEY_SET_VALUE              |\
+;;                                  KEY_CREATE_SUB_KEY         |\
+;;                                  KEY_ENUMERATE_SUB_KEYS     |\
+;;                                  KEY_NOTIFY                 |\
+;;                                  KEY_CREATE_LINK)            \
+;;                                  &                           \
+;;                                 (~SYNCHRONIZE))
+;;
+;;//
+;;// Open/Create Options
+;;//
+;;
+;;#define REG_OPTION_RESERVED         (0x00000000L)   // Parameter is reserved
+;;
+;;#define REG_OPTION_NON_VOLATILE     (0x00000000L)   // Key is preserved
+;;                                                    // when system is rebooted
+;;
+;;#define REG_OPTION_VOLATILE         (0x00000001L)   // Key is not preserved
+;;                                                    // when system is rebooted
+;;
+;;#define REG_OPTION_CREATE_LINK      (0x00000002L)   // Created key is a
+;;                                                    // symbolic link
+;;
+;;#define REG_OPTION_BACKUP_RESTORE   (0x00000004L)   // open for backup or restore
+;;                                                    // special access rules
+;;                                                    // privilege required
+;;
+;;#define REG_LEGAL_OPTION            \
+;;                (REG_OPTION_RESERVED            |\
+;;                 REG_OPTION_NON_VOLATILE        |\
+;;                 REG_OPTION_VOLATILE            |\
+;;                 REG_OPTION_CREATE_LINK         |\
+;;                 REG_OPTION_BACKUP_RESTORE)
+;;
+;;//
+;;// Key creation/open disposition
+;;//
+;;
+;;#define REG_CREATED_NEW_KEY         (0x00000001L)   // New Registry Key created
+;;#define REG_OPENED_EXISTING_KEY     (0x00000002L)   // Existing Key opened
+;;
+;;//
+;;// Key restore flags
+;;//
+;;
+;;#define REG_WHOLE_HIVE_VOLATILE     (0x00000001L)   // Restore whole hive volatile
+;;#define REG_REFRESH_HIVE            (0x00000002L)   // Unwind changes to last flush
+;;
+;;// end_ntddk end_nthal
+;;
+;;//
+;;// Notify filter values
+;;//
+;;#define REG_NOTIFY_CHANGE_NAME          (0x00000001L) // Create or delete (child)
+;;#define REG_NOTIFY_CHANGE_ATTRIBUTES    (0x00000002L)
+;;#define REG_NOTIFY_CHANGE_LAST_SET      (0x00000004L) // time stamp
+;;#define REG_NOTIFY_CHANGE_SECURITY      (0x00000008L)
+;;
+;;#define REG_LEGAL_CHANGE_FILTER                 \
+;;                (REG_NOTIFY_CHANGE_NAME          |\
+;;                 REG_NOTIFY_CHANGE_ATTRIBUTES    |\
+;;                 REG_NOTIFY_CHANGE_LAST_SET      |\
+;;                 REG_NOTIFY_CHANGE_SECURITY)
+;;
+;;//
+;;//
+;;// Predefined Value Types.
+;;//
+;;
+;;#define REG_NONE                    ( 0 )   // No value type
+;;#define REG_SZ                      ( 1 )   // Unicode nul terminated string
+;;#define REG_EXPAND_SZ               ( 2 )   // Unicode nul terminated string
+;;                                            // (with environment variable references)
+;;#define REG_BINARY                  ( 3 )   // Free form binary
+;;#define REG_DWORD                   ( 4 )   // 32-bit number
+;;#define REG_DWORD_LITTLE_ENDIAN     ( 4 )   // 32-bit number (same as REG_DWORD)
+;;#define REG_DWORD_BIG_ENDIAN        ( 5 )   // 32-bit number
+;;#define REG_LINK                    ( 6 )   // Symbolic Link (unicode)
+;;#define REG_MULTI_SZ                ( 7 )   // Multiple Unicode strings
+;;#define REG_RESOURCE_LIST           ( 8 )   // Resource list in the resource map
+;;#define REG_FULL_RESOURCE_DESCRIPTOR ( 9 )  // Resource list in the hardware description
+;;
+;;// end_ntddk end_nthal
+;;\f
+;;// begin_ntddk begin_nthal
+;;//
+;;// Service Types (Bit Mask)
+;;//
+;;#define SERVICE_KERNEL_DRIVER          0x00000001
+;;#define SERVICE_FILE_SYSTEM_DRIVER     0x00000002
+;;#define SERVICE_ADAPTER                0x00000004
+;;#define SERVICE_RECOGNIZER_DRIVER      0x00000008
+;;
+;;#define SERVICE_DRIVER                 (SERVICE_KERNEL_DRIVER | \
+;;                                        SERVICE_FILE_SYSTEM_DRIVER | \
+;;                                        SERVICE_RECOGNIZER_DRIVER)
+;;
+;;#define SERVICE_WIN32_OWN_PROCESS      0x00000010
+;;#define SERVICE_WIN32_SHARE_PROCESS    0x00000020
+;;#define SERVICE_WIN32                  (SERVICE_WIN32_OWN_PROCESS | \
+;;                                        SERVICE_WIN32_SHARE_PROCESS)
+;;
+;;#define SERVICE_TYPE_ALL               (SERVICE_WIN32  | \
+;;                                        SERVICE_ADAPTER | \
+;;                                        SERVICE_DRIVER)
+;;
+;;//
+;;// Start Type
+;;//
+;;
+;;#define SERVICE_BOOT_START             0x00000000
+;;#define SERVICE_SYSTEM_START           0x00000001
+;;#define SERVICE_AUTO_START             0x00000002
+;;#define SERVICE_DEMAND_START           0x00000003
+;;#define SERVICE_DISABLED               0x00000004
+;;
+;;//
+;;// Error control type
+;;//
+;;#define SERVICE_ERROR_IGNORE           0x00000000
+;;#define SERVICE_ERROR_NORMAL           0x00000001
+;;#define SERVICE_ERROR_SEVERE           0x00000002
+;;#define SERVICE_ERROR_CRITICAL         0x00000003
+;;
+;;//
+;;//
+;;// Define the registry driver node enumerations
+;;//
+;;
+;;typedef enum _CM_SERVICE_NODE_TYPE {
+;;    DriverType               = SERVICE_KERNEL_DRIVER,
+;;    FileSystemType           = SERVICE_FILE_SYSTEM_DRIVER,
+;;    Win32ServiceOwnProcess   = SERVICE_WIN32_OWN_PROCESS,
+;;    Win32ServiceShareProcess = SERVICE_WIN32_SHARE_PROCESS,
+;;    AdapterType              = SERVICE_ADAPTER,
+;;    RecognizerType           = SERVICE_RECOGNIZER_DRIVER
+;;} SERVICE_NODE_TYPE;
+;;
+;;typedef enum _CM_SERVICE_LOAD_TYPE {
+;;    BootLoad    = SERVICE_BOOT_START,
+;;    SystemLoad  = SERVICE_SYSTEM_START,
+;;    AutoLoad    = SERVICE_AUTO_START,
+;;    DemandLoad  = SERVICE_DEMAND_START,
+;;    DisableLoad = SERVICE_DISABLED
+;;} SERVICE_LOAD_TYPE;
+;;
+;;typedef enum _CM_ERROR_CONTROL_TYPE {
+;;    IgnoreError   = SERVICE_ERROR_IGNORE,
+;;    NormalError   = SERVICE_ERROR_NORMAL,
+;;    SevereError   = SERVICE_ERROR_SEVERE,
+;;    CriticalError = SERVICE_ERROR_CRITICAL
+;;} SERVICE_ERROR_TYPE;
+;;
+;;
+;;//
+;;// IOCTL_TAPE_ERASE definitions
+;;//
+;;
+;;#define TAPE_ERASE_SHORT            0L
+;;#define TAPE_ERASE_LONG             1L
+;;
+;;typedef struct _TAPE_ERASE {
+;;    DWORD Type;
+;;    BOOLEAN Immediate;
+;;} TAPE_ERASE, *PTAPE_ERASE;
+;;
+;;//
+;;// IOCTL_TAPE_PREPARE definitions
+;;//
+;;
+;;#define TAPE_LOAD                   0L
+;;#define TAPE_UNLOAD                 1L
+;;#define TAPE_TENSION                2L
+;;#define TAPE_LOCK                   3L
+;;#define TAPE_UNLOCK                 4L
+;;#define TAPE_FORMAT                 5L
+;;
+;;typedef struct _TAPE_PREPARE {
+;;    DWORD Operation;
+;;    BOOLEAN Immediate;
+;;} TAPE_PREPARE, *PTAPE_PREPARE;
+;;
+;;//
+;;// IOCTL_TAPE_WRITE_MARKS definitions
+;;//
+;;
+;;#define TAPE_SETMARKS               0L
+;;#define TAPE_FILEMARKS              1L
+;;#define TAPE_SHORT_FILEMARKS        2L
+;;#define TAPE_LONG_FILEMARKS         3L
+;;
+;;typedef struct _TAPE_WRITE_MARKS {
+;;    DWORD Type;
+;;    DWORD Count;
+;;    BOOLEAN Immediate;
+;;} TAPE_WRITE_MARKS, *PTAPE_WRITE_MARKS;
+;;
+;;//
+;;// IOCTL_TAPE_GET_POSITION definitions
+;;//
+;;
+;;#define TAPE_ABSOLUTE_POSITION       0L
+;;#define TAPE_LOGICAL_POSITION        1L
+;;#define TAPE_PSEUDO_LOGICAL_POSITION 2L
+;;
+;;typedef struct _TAPE_GET_POSITION {
+;;    DWORD Type;
+;;    DWORD Partition;
+;;    LARGE_INTEGER Offset;
+;;} TAPE_GET_POSITION, *PTAPE_GET_POSITION;
+;;
+;;//
+;;// IOCTL_TAPE_SET_POSITION definitions
+;;//
+;;
+;;#define TAPE_REWIND                 0L
+;;#define TAPE_ABSOLUTE_BLOCK         1L
+;;#define TAPE_LOGICAL_BLOCK          2L
+;;#define TAPE_PSEUDO_LOGICAL_BLOCK   3L
+;;#define TAPE_SPACE_END_OF_DATA      4L
+;;#define TAPE_SPACE_RELATIVE_BLOCKS  5L
+;;#define TAPE_SPACE_FILEMARKS        6L
+;;#define TAPE_SPACE_SEQUENTIAL_FMKS  7L
+;;#define TAPE_SPACE_SETMARKS         8L
+;;#define TAPE_SPACE_SEQUENTIAL_SMKS  9L
+;;
+;;typedef struct _TAPE_SET_POSITION {
+;;    DWORD Method;
+;;    DWORD Partition;
+;;    LARGE_INTEGER Offset;
+;;    BOOLEAN Immediate;
+;;} TAPE_SET_POSITION, *PTAPE_SET_POSITION;
+;;
+;;//
+;;// IOCTL_TAPE_GET_DRIVE_PARAMS definitions
+;;//
+;;
+;;//
+;;// Definitions for FeaturesLow parameter
+;;//
+;;
+;;#define TAPE_DRIVE_FIXED            0x00000001
+;;#define TAPE_DRIVE_SELECT           0x00000002
+;;#define TAPE_DRIVE_INITIATOR        0x00000004
+;;
+;;#define TAPE_DRIVE_ERASE_SHORT      0x00000010
+;;#define TAPE_DRIVE_ERASE_LONG       0x00000020
+;;#define TAPE_DRIVE_ERASE_BOP_ONLY   0x00000040
+;;#define TAPE_DRIVE_ERASE_IMMEDIATE  0x00000080
+;;
+;;#define TAPE_DRIVE_TAPE_CAPACITY    0x00000100
+;;#define TAPE_DRIVE_TAPE_REMAINING   0x00000200
+;;#define TAPE_DRIVE_FIXED_BLOCK      0x00000400
+;;#define TAPE_DRIVE_VARIABLE_BLOCK   0x00000800
+;;
+;;#define TAPE_DRIVE_WRITE_PROTECT    0x00001000
+;;#define TAPE_DRIVE_EOT_WZ_SIZE      0x00002000
+;;
+;;#define TAPE_DRIVE_ECC              0x00010000
+;;#define TAPE_DRIVE_COMPRESSION      0x00020000
+;;#define TAPE_DRIVE_PADDING          0x00040000
+;;#define TAPE_DRIVE_REPORT_SMKS      0x00080000
+;;
+;;#define TAPE_DRIVE_GET_ABSOLUTE_BLK 0x00100000
+;;#define TAPE_DRIVE_GET_LOGICAL_BLK  0x00200000
+;;#define TAPE_DRIVE_SET_EOT_WZ_SIZE  0x00400000
+;;
+;;#define TAPE_DRIVE_RESERVED_BIT     0x80000000  //don't use this bit!
+;;//                                              //can't be a low features bit!
+;;//                                              //reserved; high features only
+;;
+;;//
+;;// Definitions for FeaturesHigh parameter
+;;//
+;;
+;;#define TAPE_DRIVE_LOAD_UNLOAD      0x80000001
+;;#define TAPE_DRIVE_TENSION          0x80000002
+;;#define TAPE_DRIVE_LOCK_UNLOCK      0x80000004
+;;#define TAPE_DRIVE_REWIND_IMMEDIATE 0x80000008
+;;
+;;#define TAPE_DRIVE_SET_BLOCK_SIZE   0x80000010
+;;#define TAPE_DRIVE_LOAD_UNLD_IMMED  0x80000020
+;;#define TAPE_DRIVE_TENSION_IMMED    0x80000040
+;;#define TAPE_DRIVE_LOCK_UNLK_IMMED  0x80000080
+;;
+;;#define TAPE_DRIVE_SET_ECC          0x80000100
+;;#define TAPE_DRIVE_SET_COMPRESSION  0x80000200
+;;#define TAPE_DRIVE_SET_PADDING      0x80000400
+;;#define TAPE_DRIVE_SET_REPORT_SMKS  0x80000800
+;;
+;;#define TAPE_DRIVE_ABSOLUTE_BLK     0x80001000
+;;#define TAPE_DRIVE_ABS_BLK_IMMED    0x80002000
+;;#define TAPE_DRIVE_LOGICAL_BLK      0x80004000
+;;#define TAPE_DRIVE_LOG_BLK_IMMED    0x80008000
+;;
+;;#define TAPE_DRIVE_END_OF_DATA      0x80010000
+;;#define TAPE_DRIVE_RELATIVE_BLKS    0x80020000
+;;#define TAPE_DRIVE_FILEMARKS        0x80040000
+;;#define TAPE_DRIVE_SEQUENTIAL_FMKS  0x80080000
+;;
+;;#define TAPE_DRIVE_SETMARKS         0x80100000
+;;#define TAPE_DRIVE_SEQUENTIAL_SMKS  0x80200000
+;;#define TAPE_DRIVE_REVERSE_POSITION 0x80400000
+;;#define TAPE_DRIVE_SPACE_IMMEDIATE  0x80800000
+;;
+;;#define TAPE_DRIVE_WRITE_SETMARKS   0x81000000
+;;#define TAPE_DRIVE_WRITE_FILEMARKS  0x82000000
+;;#define TAPE_DRIVE_WRITE_SHORT_FMKS 0x84000000
+;;#define TAPE_DRIVE_WRITE_LONG_FMKS  0x88000000
+;;
+;;#define TAPE_DRIVE_WRITE_MARK_IMMED 0x90000000
+;;#define TAPE_DRIVE_FORMAT           0xA0000000
+;;#define TAPE_DRIVE_FORMAT_IMMEDIATE 0xC0000000
+;;#define TAPE_DRIVE_HIGH_FEATURES    0x80000000  //mask for high features flag
+;;
+;;typedef struct _TAPE_GET_DRIVE_PARAMETERS {
+;;    BOOLEAN ECC;
+;;    BOOLEAN Compression;
+;;    BOOLEAN DataPadding;
+;;    BOOLEAN ReportSetmarks;
+;;    DWORD DefaultBlockSize;
+;;    DWORD MaximumBlockSize;
+;;    DWORD MinimumBlockSize;
+;;    DWORD MaximumPartitionCount;
+;;    DWORD FeaturesLow;
+;;    DWORD FeaturesHigh;
+;;    DWORD EOTWarningZoneSize;
+;;} TAPE_GET_DRIVE_PARAMETERS, *PTAPE_GET_DRIVE_PARAMETERS;
+;;
+;;//
+;;// IOCTL_TAPE_SET_DRIVE_PARAMETERS definitions
+;;//
+;;
+;;typedef struct _TAPE_SET_DRIVE_PARAMETERS {
+;;    BOOLEAN ECC;
+;;    BOOLEAN Compression;
+;;    BOOLEAN DataPadding;
+;;    BOOLEAN ReportSetmarks;
+;;    DWORD EOTWarningZoneSize;
+;;} TAPE_SET_DRIVE_PARAMETERS, *PTAPE_SET_DRIVE_PARAMETERS;
+;;
+;;//
+;;// IOCTL_TAPE_GET_MEDIA_PARAMETERS definitions
+;;//
+;;
+;;typedef struct _TAPE_GET_MEDIA_PARAMETERS {
+;;    LARGE_INTEGER Capacity;
+;;    LARGE_INTEGER Remaining;
+;;    DWORD BlockSize;
+;;    DWORD PartitionCount;
+;;    BOOLEAN WriteProtected;
+;;} TAPE_GET_MEDIA_PARAMETERS, *PTAPE_GET_MEDIA_PARAMETERS;
+;;
+;;//
+;;// IOCTL_TAPE_SET_MEDIA_PARAMETERS definitions
+;;//
+;;
+;;typedef struct _TAPE_SET_MEDIA_PARAMETERS {
+;;    DWORD BlockSize;
+;;} TAPE_SET_MEDIA_PARAMETERS, *PTAPE_SET_MEDIA_PARAMETERS;
+;;
+;;//
+;;// IOCTL_TAPE_CREATE_PARTITION definitions
+;;//
+;;
+;;#define TAPE_FIXED_PARTITIONS       0L
+;;#define TAPE_SELECT_PARTITIONS      1L
+;;#define TAPE_INITIATOR_PARTITIONS   2L
+;;
+;;typedef struct _TAPE_CREATE_PARTITION {
+;;    DWORD Method;
+;;    DWORD Count;
+;;    DWORD Size;
+;;} TAPE_CREATE_PARTITION, *PTAPE_CREATE_PARTITION;
+;;
+;;
+;;#ifdef __cplusplus
+;;}
+;;#endif
+;;
+;;#endif /* _WINNT_ */
+;;
diff --git a/v7/src/win32/winuser.scm b/v7/src/win32/winuser.scm
new file mode 100644 (file)
index 0000000..4092499
--- /dev/null
@@ -0,0 +1,5689 @@
+;;/*++ BUILD Version: 0003    // Increment this if a change has global effects
+;;
+;;Copyright (c) 1985-91, Microsoft Corporation
+;;
+;;Module Name:
+;;
+;;    winuser.h
+;;
+;;Abstract:
+;;
+;;    Procedure declarations, constant definitions and macros for the User
+;;    component.
+;;
+;;--*/
+;;
+;;#ifndef _WINUSER_
+;;#define _WINUSER_
+;;
+;;#ifdef __cplusplus
+;;extern "C" {
+;;#endif /* __cplusplus */
+;;
+;;#ifndef WINVER
+;;#define WINVER  0x0314      // version 3.2
+;;#endif /* !WINVER */
+;;
+;;#include "stdarg.h"
+;;
+;;#ifndef NOUSER
+;;
+;;typedef HANDLE HDWP;
+;;typedef VOID MENUTEMPLATEA;
+;;typedef VOID MENUTEMPLATEW;
+;;#ifdef UNICODE
+;;typedef MENUTEMPLATEW MENUTEMPLATE;
+;;#else
+;;typedef MENUTEMPLATEA MENUTEMPLATE;
+;;#endif // UNICODE
+;;typedef PVOID LPMENUTEMPLATEA;
+;;typedef PVOID LPMENUTEMPLATEW;
+;;#ifdef UNICODE
+;;typedef LPMENUTEMPLATEW LPMENUTEMPLATE;
+;;#else
+;;typedef LPMENUTEMPLATEA LPMENUTEMPLATE;
+;;#endif // UNICODE
+;;
+;;typedef LRESULT (CALLBACK* WNDPROC)(HWND, UINT, WPARAM, LPARAM);
+;;#ifdef STRICT
+;;typedef BOOL (CALLBACK* DLGPROC)(HWND, UINT, WPARAM, LPARAM);
+;;typedef VOID (CALLBACK* TIMERPROC)(HWND, UINT, UINT, DWORD);
+;;typedef BOOL (CALLBACK* GRAYSTRINGPROC)(HDC, LPARAM, int);
+;;typedef BOOL (CALLBACK* PROPENUMPROC)(HWND, LPCSTR, HANDLE);
+;;typedef BOOL (CALLBACK* PROPENUMPROCEX)(HWND, LPTSTR, HANDLE, DWORD);
+;;typedef BOOL (CALLBACK* WNDENUMPROC)(HWND, LPARAM);
+;;typedef LRESULT (CALLBACK* HOOKPROC)(int code, WPARAM wParam, LPARAM lParam);
+;;typedef int (CALLBACK* EDITWORDBREAKPROC)(LPSTR lpch, int ichCurrent, int cch, int code);
+;;typedef VOID (CALLBACK* SENDASYNCPROC)(HWND, UINT, DWORD, LRESULT);
+;;#else /* !STRICT */
+;;typedef FARPROC DLGPROC;
+;;typedef FARPROC TIMERPROC;
+;;typedef FARPROC GRAYSTRINGPROC;
+;;typedef FARPROC PROPENUMPROC;
+;;typedef FARPROC PROPENUMPROCEX;
+;;typedef FARPROC WNDENUMPROC;
+;;typedef FARPROC HOOKPROC;
+;;typedef FARPROC EDITWORDBREAKPROC;
+;;typedef FARPROC SENDASYNCPROC;
+;;#endif /* !STRICT */
+;;
+;;#define MAKEINTRESOURCEA(i) (LPSTR)((DWORD)((WORD)(i)))
+;;#define MAKEINTRESOURCEW(i) (LPWSTR)((DWORD)((WORD)(i)))
+;;#ifdef UNICODE
+;;#define MAKEINTRESOURCE  MAKEINTRESOURCEW
+;;#else
+;;#define MAKEINTRESOURCE  MAKEINTRESOURCEA
+;;#endif // !UNICODE
+;;
+;;#ifndef NORESOURCE
+;;
+;;/*
+;; * Predefined Resource Types
+;; */
+(define-integrable RT_CURSOR           1)
+(define-integrable RT_BITMAP           2)
+(define-integrable RT_ICON             3)
+(define-integrable RT_MENU             4)
+(define-integrable RT_DIALOG           5)
+(define-integrable RT_STRING           6)
+(define-integrable RT_FONTDIR          7)
+(define-integrable RT_FONT             8)
+(define-integrable RT_ACCELERATOR      9)
+(define-integrable RT_RCDATA           10)
+(define-integrable RT_MESSAGETABLE     11)
+
+(define-integrable DIFFERENCE          11)
+(define-integrable RT_GROUP_CURSOR     (+ RT_CURSOR DIFFERENCE))
+(define-integrable RT_GROUP_ICON       (+ RT_ICON DIFFERENCE))
+(define-integrable RT_VERSION          16)
+(define-integrable RT_DLGINCLUDE       17)
+;;
+;;#endif /* !NORESOURCE */
+;;
+;;int WINAPI wvsprintfA(LPSTR, LPCSTR, CONST VOID *arglist);
+;;int WINAPI wvsprintfW(LPWSTR, LPCWSTR, CONST VOID *arglist);
+;;#ifdef UNICODE
+;;#define wvsprintf  wvsprintfW
+;;#else
+;;#define wvsprintf  wvsprintfA
+;;#endif // !UNICODE
+;;int WINAPI wsprintfA(LPSTR, LPCSTR, ...);
+;;int WINAPI wsprintfW(LPWSTR, LPCWSTR, ...);
+;;#ifdef UNICODE
+;;#define wsprintf  wsprintfW
+;;#else
+;;#define wsprintf  wsprintfA
+;;#endif // !UNICODE
+;;
+;;#ifndef NOSCROLL
+;;
+;;/*
+;; * Scroll Bar Constants
+;; */
+(define-integrable SB_HORZ             0)
+(define-integrable SB_VERT             1)
+(define-integrable SB_CTL              2)
+(define-integrable SB_BOTH             3)
+
+;;/*
+;; * Scroll Bar Commands
+;; */
+(define-integrable SB_LINEUP           0)
+(define-integrable SB_LINELEFT         0)
+(define-integrable SB_LINEDOWN         1)
+(define-integrable SB_LINERIGHT        1)
+(define-integrable SB_PAGEUP           2)
+(define-integrable SB_PAGELEFT         2)
+(define-integrable SB_PAGEDOWN         3)
+(define-integrable SB_PAGERIGHT        3)
+(define-integrable SB_THUMBPOSITION    4)
+(define-integrable SB_THUMBTRACK       5)
+(define-integrable SB_TOP              6)
+(define-integrable SB_LEFT             6)
+(define-integrable SB_BOTTOM           7)
+(define-integrable SB_RIGHT            7)
+(define-integrable SB_ENDSCROLL        8)
+
+;;#endif /* !NOSCROLL */
+;;
+;;#ifndef NOSHOWWINDOW
+;;
+;;/*
+;; * ShowWindow() Commands
+;; */
+(define-integrable SW_HIDE             0)
+(define-integrable SW_SHOWNORMAL       1)
+(define-integrable SW_NORMAL           1)
+(define-integrable SW_SHOWMINIMIZED    2)
+(define-integrable SW_SHOWMAXIMIZED    3)
+(define-integrable SW_MAXIMIZE         3)
+(define-integrable SW_SHOWNOACTIVATE   4)
+(define-integrable SW_SHOW             5)
+(define-integrable SW_MINIMIZE         6)
+(define-integrable SW_SHOWMINNOACTIVE  7)
+(define-integrable SW_SHOWNA           8)
+(define-integrable SW_RESTORE          9)
+(define-integrable SW_SHOWDEFAULT      10)
+(define-integrable SW_MAX              10)
+
+;;/*
+;; * Old ShowWindow() Commands
+;; */
+(define-integrable HIDE_WINDOW         0)
+(define-integrable SHOW_OPENWINDOW     1)
+(define-integrable SHOW_ICONWINDOW     2)
+(define-integrable SHOW_FULLSCREEN     3)
+(define-integrable SHOW_OPENNOACTIVATE 4)
+
+;;/*
+;; * Identifiers for the WM_SHOWWINDOW message
+;; */
+(define-integrable SW_PARENTCLOSING    1)
+(define-integrable SW_OTHERZOOM        2)
+(define-integrable SW_PARENTOPENING    3)
+(define-integrable SW_OTHERUNZOOM      4)
+
+;;#endif /* !NOSHOWWINDOW */
+;;
+;;/*
+;; * WM_KEYUP/DOWN/CHAR HIWORD(lParam) flags
+;; */
+(define-integrable KF_EXTENDED         #x0100)
+(define-integrable KF_DLGMODE          #x0800)
+(define-integrable KF_MENUMODE         #x1000)
+(define-integrable KF_ALTDOWN          #x2000)
+(define-integrable KF_REPEAT           #x4000)
+(define-integrable KF_UP               #x8000)
+;;
+;;#ifndef NOVIRTUALKEYCODES
+;;
+;;/*
+;; * Virtual Keys, Standard Set
+;; */
+(define-integrable VK_LBUTTON        #x01)
+(define-integrable VK_RBUTTON        #x02)
+(define-integrable VK_CANCEL         #x03)
+(define-integrable VK_MBUTTON        #x04)  ;   /* NOT contiguous with L & RBUTTON */
+
+(define-integrable VK_BACK           #x08)
+(define-integrable VK_TAB            #x09)
+
+(define-integrable VK_CLEAR          #x0C)
+(define-integrable VK_RETURN         #x0D)
+
+(define-integrable VK_SHIFT          #x10)
+(define-integrable VK_CONTROL        #x11)
+(define-integrable VK_MENU           #x12)
+(define-integrable VK_PAUSE          #x13)
+(define-integrable VK_CAPITAL        #x14)
+
+(define-integrable VK_ESCAPE         #x1B)
+
+(define-integrable VK_SPACE          #x20)
+(define-integrable VK_PRIOR          #x21)
+(define-integrable VK_NEXT           #x22)
+(define-integrable VK_END            #x23)
+(define-integrable VK_HOME           #x24)
+(define-integrable VK_LEFT           #x25)
+(define-integrable VK_UP             #x26)
+(define-integrable VK_RIGHT          #x27)
+(define-integrable VK_DOWN           #x28)
+(define-integrable VK_SELECT         #x29)
+(define-integrable VK_PRINT          #x2A)
+(define-integrable VK_EXECUTE        #x2B)
+(define-integrable VK_SNAPSHOT       #x2C)
+(define-integrable VK_INSERT         #x2D)
+(define-integrable VK_DELETE         #x2E)
+(define-integrable VK_HELP           #x2F)
+
+;;/* VK_0 thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39) */
+;;/* VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A) */
+
+(define-integrable VK_NUMPAD0        #x60)
+(define-integrable VK_NUMPAD1        #x61)
+(define-integrable VK_NUMPAD2        #x62)
+(define-integrable VK_NUMPAD3        #x63)
+(define-integrable VK_NUMPAD4        #x64)
+(define-integrable VK_NUMPAD5        #x65)
+(define-integrable VK_NUMPAD6        #x66)
+(define-integrable VK_NUMPAD7        #x67)
+(define-integrable VK_NUMPAD8        #x68)
+(define-integrable VK_NUMPAD9        #x69)
+(define-integrable VK_MULTIPLY       #x6A)
+(define-integrable VK_ADD            #x6B)
+(define-integrable VK_SEPARATOR      #x6C)
+(define-integrable VK_SUBTRACT       #x6D)
+(define-integrable VK_DECIMAL        #x6E)
+(define-integrable VK_DIVIDE         #x6F)
+(define-integrable VK_F1             #x70)
+(define-integrable VK_F2             #x71)
+(define-integrable VK_F3             #x72)
+(define-integrable VK_F4             #x73)
+(define-integrable VK_F5             #x74)
+(define-integrable VK_F6             #x75)
+(define-integrable VK_F7             #x76)
+(define-integrable VK_F8             #x77)
+(define-integrable VK_F9             #x78)
+(define-integrable VK_F10            #x79)
+(define-integrable VK_F11            #x7A)
+(define-integrable VK_F12            #x7B)
+(define-integrable VK_F13            #x7C)
+(define-integrable VK_F14            #x7D)
+(define-integrable VK_F15            #x7E)
+(define-integrable VK_F16            #x7F)
+(define-integrable VK_F17            #x80)
+(define-integrable VK_F18            #x81)
+(define-integrable VK_F19            #x82)
+(define-integrable VK_F20            #x83)
+(define-integrable VK_F21            #x84)
+(define-integrable VK_F22            #x85)
+(define-integrable VK_F23            #x86)
+(define-integrable VK_F24            #x87)
+
+(define-integrable VK_NUMLOCK        #x90)
+(define-integrable VK_SCROLL         #x91)
+
+;;/*
+;; * VK_L* & VK_R* - left and right Alt, Ctrl and Shift virtual keys.
+;; * Used only as parameters to GetAsyncKeyState() and GetKeyState().
+;; * No other API or message will distinguish left and right keys in this way.
+;; */
+(define-integrable VK_LSHIFT         #xA0)
+(define-integrable VK_RSHIFT         #xA1)
+(define-integrable VK_LCONTROL       #xA2)
+(define-integrable VK_RCONTROL       #xA3)
+(define-integrable VK_LMENU          #xA4)
+(define-integrable VK_RMENU          #xA5)
+
+(define-integrable VK_ATTN           #xF6)
+(define-integrable VK_CRSEL          #xF7)
+(define-integrable VK_EXSEL          #xF8)
+(define-integrable VK_EREOF          #xF9)
+(define-integrable VK_PLAY           #xFA)
+(define-integrable VK_ZOOM           #xFB)
+(define-integrable VK_NONAME         #xFC)
+(define-integrable VK_PA1            #xFD)
+(define-integrable VK_OEM_CLEAR      #xFE)
+
+;;#endif /* !NOVIRTUALKEYCODES */
+;;
+;;#ifndef NOWH
+;;
+;;/*
+;; * SetWindowsHook() codes
+;; */
+(define-integrable WH_MIN              -1)
+(define-integrable WH_MSGFILTER        -1)
+(define-integrable WH_JOURNALRECORD    0)
+(define-integrable WH_JOURNALPLAYBACK  1)
+(define-integrable WH_KEYBOARD         2)
+(define-integrable WH_GETMESSAGE       3)
+(define-integrable WH_CALLWNDPROC      4)
+(define-integrable WH_CBT              5)
+(define-integrable WH_SYSMSGFILTER     6)
+(define-integrable WH_MOUSE            7)
+(define-integrable WH_HARDWARE         8)
+(define-integrable WH_DEBUG            9)
+(define-integrable WH_SHELL           10)
+(define-integrable WH_FOREGROUNDIDLE  11)
+(define-integrable WH_MAX             11)
+
+;;/*
+;; * Hook Codes
+;; */
+(define-integrable HC_ACTION           0)
+(define-integrable HC_GETNEXT          1)
+(define-integrable HC_SKIP             2)
+(define-integrable HC_NOREMOVE         3)
+(define-integrable HC_NOREM            HC_NOREMOVE)
+(define-integrable HC_SYSMODALON       4)
+(define-integrable HC_SYSMODALOFF      5)
+
+;;/*
+;; * CBT Hook Codes
+;; */
+(define-integrable HCBT_MOVESIZE       0)
+(define-integrable HCBT_MINMAX         1)
+(define-integrable HCBT_QS             2)
+(define-integrable HCBT_CREATEWND      3)
+(define-integrable HCBT_DESTROYWND     4)
+(define-integrable HCBT_ACTIVATE       5)
+(define-integrable HCBT_CLICKSKIPPED   6)
+(define-integrable HCBT_KEYSKIPPED     7)
+(define-integrable HCBT_SYSCOMMAND     8)
+(define-integrable HCBT_SETFOCUS       9)
+
+;;/*
+;; * HCBT_CREATEWND parameters pointed to by lParam
+;; */
+;;typedef struct tagCBT_CREATEWNDA
+;;{
+;;    struct tagCREATESTRUCTA *lpcs;
+;;    HWND           hwndInsertAfter;
+;;} CBT_CREATEWNDA, *LPCBT_CREATEWNDA;
+;;/*
+;; * HCBT_CREATEWND parameters pointed to by lParam
+;; */
+;;typedef struct tagCBT_CREATEWNDW
+;;{
+;;    struct tagCREATESTRUCTW *lpcs;
+;;    HWND           hwndInsertAfter;
+;;} CBT_CREATEWNDW, *LPCBT_CREATEWNDW;
+;;#ifdef UNICODE
+;;typedef CBT_CREATEWNDW CBT_CREATEWND;
+;;typedef LPCBT_CREATEWNDW LPCBT_CREATEWND;
+;;#else
+;;typedef CBT_CREATEWNDA CBT_CREATEWND;
+;;typedef LPCBT_CREATEWNDA LPCBT_CREATEWND;
+;;#endif // UNICODE
+;;
+;;/*
+;; * HCBT_ACTIVATE structure pointed to by lParam
+;; */
+;;typedef struct tagCBTACTIVATESTRUCT
+;;{
+;;    BOOL    fMouse;
+;;    HWND    hWndActive;
+;;} CBTACTIVATESTRUCT, *LPCBTACTIVATESTRUCT;
+;;
+;;/*
+;; * WH_MSGFILTER Filter Proc Codes
+;; */
+(define-integrable MSGF_DIALOGBOX      0)
+(define-integrable MSGF_MESSAGEBOX     1)
+(define-integrable MSGF_MENU           2)
+(define-integrable MSGF_MOVE           3)
+(define-integrable MSGF_SIZE           4)
+(define-integrable MSGF_SCROLLBAR      5)
+(define-integrable MSGF_NEXTWINDOW     6)
+(define-integrable MSGF_MAINLOOP       8)
+(define-integrable MSGF_MAX            8)
+(define-integrable MSGF_USER           4096)
+
+;;/*
+;; * Shell support
+;; */
+(define-integrable HSHELL_WINDOWCREATED       1)
+(define-integrable HSHELL_WINDOWDESTROYED     2)
+(define-integrable HSHELL_ACTIVATESHELLWINDOW 3)
+
+;;/*
+;; * Window Manager Hook Codes
+;; */
+(define-integrable WC_INIT             1)
+(define-integrable WC_SWP              2)
+(define-integrable WC_DEFWINDOWPROC    3)
+(define-integrable WC_MINMAX           4)
+(define-integrable WC_MOVE             5)
+(define-integrable WC_SIZE             6)
+(define-integrable WC_DRAWCAPTION      7)
+
+;;/*
+;; * Message Structure used in Journaling
+;; */
+;;typedef struct tagEVENTMSG {
+;;    UINT    message;
+;;    UINT    paramL;
+;;    UINT    paramH;
+;;    DWORD    time;
+;;    HWND     hwnd;
+;;} EVENTMSG, *PEVENTMSGMSG, NEAR *NPEVENTMSGMSG, FAR *LPEVENTMSGMSG;
+;;
+;;typedef struct tagEVENTMSG *PEVENTMSG, NEAR *NPEVENTMSG, FAR *LPEVENTMSG;
+;;
+;;/*
+;; * Message structure used by WH_CALLWNDPROC
+;; */
+;;typedef struct tagCWPSTRUCT {
+;;    LPARAM  lParam;
+;;    WPARAM  wParam;
+;;    DWORD   message;
+;;    HWND    hwnd;
+;;} CWPSTRUCT, *PCWPSTRUCT, NEAR *NPCWPSTRUCT, FAR *LPCWPSTRUCT;
+;;
+;;/*
+;; * Structure used by WH_DEBUG
+;; */
+;;typedef struct tagDEBUGHOOKINFO
+;;{
+;;    DWORD   idThread;
+;;    LPARAM  reserved;
+;;    LPARAM  lParam;
+;;    WPARAM  wParam;
+;;    int     code;
+;;} DEBUGHOOKINFO, *PDEBUGHOOKINFO, NEAR *NPDEBUGHOOKINFO, FAR* LPDEBUGHOOKINFO;
+;;
+;;typedef struct tagMOUSEHOOKSTRUCT {
+;;    POINT   pt;
+;;    HWND    hwnd;
+;;    UINT    wHitTestCode;
+;;    DWORD   dwExtraInfo;
+;;} MOUSEHOOKSTRUCT, FAR *LPMOUSEHOOKSTRUCT, *PMOUSEHOOKSTRUCT;
+;;#endif /* !NOWH */
+;;
+;;/*
+;; * Keyboard Layout API
+;; */
+(define-integrable HKL_PREV            0)
+(define-integrable HKL_NEXT            1)
+
+(define-integrable KLF_ACTIVATE        #x00000001)
+(define-integrable KLF_SUBSTITUTE_OK   #x00000002)
+(define-integrable KLF_UNLOADPREVIOUS  #x00000004)
+(define-integrable KLF_REORDER         #x00000008)
+
+;;/*
+;; * Size of KeyboardLayoutName (number of characters), including nul terminator
+;; */
+(define-integrable KL_NAMELENGTH       9)
+
+;;HKL WINAPI LoadKeyboardLayoutA(LPCSTR pwszKLID, UINT Flags);
+;;HKL WINAPI LoadKeyboardLayoutW(LPCWSTR pwszKLID, UINT Flags);
+;;#ifdef UNICODE
+;;#define LoadKeyboardLayout  LoadKeyboardLayoutW
+;;#else
+;;#define LoadKeyboardLayout  LoadKeyboardLayoutA
+;;#endif // !UNICODE
+;;BOOL WINAPI ActivateKeyboardLayout(HKL hkl, UINT Flags);
+;;BOOL WINAPI UnloadKeyboardLayout(HKL hkl);
+;;BOOL WINAPI GetKeyboardLayoutNameA(LPSTR pwszKLID);
+;;BOOL WINAPI GetKeyboardLayoutNameW(LPWSTR pwszKLID);
+;;#ifdef UNICODE
+;;#define GetKeyboardLayoutName  GetKeyboardLayoutNameW
+;;#else
+;;#define GetKeyboardLayoutName  GetKeyboardLayoutNameA
+;;#endif // !UNICODE
+;;
+;;#ifndef NODESKTOP
+;;/*
+;; * Desktop-specific access flags
+;; */
+(define-integrable DESKTOP_ENUMWINDOWS         #x0001)
+(define-integrable DESKTOP_CREATEWINDOW        #x0002)
+(define-integrable DESKTOP_CREATEMENU          #x0004)
+(define-integrable DESKTOP_HOOKCONTROL         #x0008)
+(define-integrable DESKTOP_JOURNALRECORD       #x0010)
+(define-integrable DESKTOP_JOURNALPLAYBACK     #x0020)
+(define-integrable DESKTOP_ENUMERATE           #x0040)
+
+;;HDESK
+;;WINAPI
+;;GetThreadDesktop(
+;;    DWORD);
+;;
+;;#endif  /* !NODESKTOP */
+;;
+;;#ifndef NOWINDOWSTATION
+;;/*
+;; * Windowstation-specific access flags
+;; */
+(define-integrable WINSTA_ENUMDESKTOPS         #x0001)
+(define-integrable WINSTA_READATTRIBUTES       #x0002)
+(define-integrable WINSTA_ACCESSCLIPBOARD      #x0004)
+(define-integrable WINSTA_CREATEDESKTOP        #x0008)
+(define-integrable WINSTA_WRITEATTRIBUTES      #x0010)
+(define-integrable WINSTA_ACCESSGLOBALATOMS    #x0020)
+(define-integrable WINSTA_EXITWINDOWS          #x0040)
+(define-integrable WINSTA_ENUMERATE            #x0100)
+(define-integrable WINSTA_READSCREEN           #x0200)
+
+;;HWINSTA
+;;WINAPI
+;;GetProcessWindowStation(
+;;    VOID);
+;;#endif  /* !NOWINDOWSTATION */
+;;
+;;#ifndef NOSECURITY
+;;/*
+;; * window-specific access flags
+;; */
+(define-integrable WIN_ACCESSWINDOW            #x0001)
+
+;;/*
+;; * menu-specific access flags
+;; */
+(define-integrable MENU_ACCESSMENU             #x0001)
+
+;;BOOL
+;;WINAPI
+;;SetUserObjectSecurity(
+;;    HANDLE hObj,
+;;    PSECURITY_INFORMATION pSIRequested,
+;;    PSECURITY_DESCRIPTOR pSID);
+;;
+;;BOOL
+;;WINAPI
+;;GetUserObjectSecurity(
+;;    HANDLE hObj,
+;;    PSECURITY_INFORMATION pSIRequested,
+;;    PSECURITY_DESCRIPTOR pSID,
+;;    DWORD nLength,
+;;    LPDWORD lpnLengthNeeded);
+;;
+;;#endif  /* !NOSECURITY */
+;;
+;;typedef struct tagWNDCLASSA {
+;;    UINT        style;
+;;    WNDPROC     lpfnWndProc;
+;;    int         cbClsExtra;
+;;    int         cbWndExtra;
+;;    HINSTANCE   hInstance;
+;;    HICON       hIcon;
+;;    HCURSOR     hCursor;
+;;    HBRUSH      hbrBackground;
+;;    LPCSTR      lpszMenuName;
+;;    LPCSTR      lpszClassName;
+;;} WNDCLASSA, *PWNDCLASSA, NEAR *NPWNDCLASSA, FAR *LPWNDCLASSA;
+;;typedef struct tagWNDCLASSW {
+;;    UINT        style;
+;;    WNDPROC     lpfnWndProc;
+;;    int         cbClsExtra;
+;;    int         cbWndExtra;
+;;    HINSTANCE   hInstance;
+;;    HICON       hIcon;
+;;    HCURSOR     hCursor;
+;;    HBRUSH      hbrBackground;
+;;    LPCWSTR     lpszMenuName;
+;;    LPCWSTR     lpszClassName;
+;;} WNDCLASSW, *PWNDCLASSW, NEAR *NPWNDCLASSW, FAR *LPWNDCLASSW;
+;;#ifdef UNICODE
+;;typedef WNDCLASSW WNDCLASS;
+;;typedef PWNDCLASSW PWNDCLASS;
+;;typedef NPWNDCLASSW NPWNDCLASS;
+;;typedef LPWNDCLASSW LPWNDCLASS;
+;;#else
+;;typedef WNDCLASSA WNDCLASS;
+;;typedef PWNDCLASSA PWNDCLASS;
+;;typedef NPWNDCLASSA NPWNDCLASS;
+;;typedef LPWNDCLASSA LPWNDCLASS;
+;;#endif // UNICODE
+
+
+;;#ifndef NOMSG
+;;
+;;/*
+;; * Message structure
+;; */
+;;typedef struct tagMSG {
+;;    HWND        hwnd;
+;;    UINT        message;
+;;    WPARAM      wParam;
+;;    LPARAM      lParam;
+;;    DWORD       time;
+;;    POINT       pt;
+;;} MSG, *PMSG, NEAR *NPMSG, FAR *LPMSG;
+;;
+;;#define POINTSTOPOINT(pt,pts)  {(pt).x = (SHORT)LOWORD(pts); \
+;;                                (pt).y = (SHORT)HIWORD(pts);}
+;;#define POINTTOPOINTS(pt)      (MAKELONG((short)((pt).x), (short)((pt).y)))
+;;#define MAKEWPARAM(l, h)      (WPARAM)MAKELONG(l, h)
+;;#define MAKELPARAM(l, h)      (LPARAM)MAKELONG(l, h)
+;;#define MAKELRESULT(l, h)     (LRESULT)MAKELONG(l, h)
+
+
+;;#endif /* !NOMSG */
+;;
+;;#ifndef NOWINOFFSETS
+;;
+;;/*
+;; * Window field offsets for GetWindowLong()
+;; */
+(define-integrable GWL_WNDPROC         -4)
+(define-integrable GWL_HINSTANCE       -6)
+(define-integrable GWL_HWNDPARENT      -8)
+(define-integrable GWL_STYLE           -16)
+(define-integrable GWL_EXSTYLE         -20)
+(define-integrable GWL_USERDATA        -21)
+(define-integrable GWL_ID              -12)
+
+;;/*
+;; * Class field offsets for GetClassLong()
+;; */
+(define-integrable GCL_MENUNAME        -8)
+(define-integrable GCL_HBRBACKGROUND   -10)
+(define-integrable GCL_HCURSOR         -12)
+(define-integrable GCL_HICON           -14)
+(define-integrable GCL_HMODULE         -16)
+(define-integrable GCL_CBWNDEXTRA      -18)
+(define-integrable GCL_CBCLSEXTRA      -20)
+(define-integrable GCL_WNDPROC         -24)
+(define-integrable GCL_STYLE           -26)
+
+
+;;#endif /* !NOWINOFFSETS */
+;;
+;;#ifndef NOWINMESSAGES
+;;
+;;/*
+;; * Window Messages
+;; */
+
+(define-integrable WM_NULL                         #x0000)
+(define-integrable WM_CREATE                       #x0001)
+(define-integrable WM_DESTROY                      #x0002)
+(define-integrable WM_MOVE                         #x0003)
+(define-integrable WM_SIZE                         #x0005)
+
+(define-integrable WM_ACTIVATE                     #x0006)
+;;/*
+;; * WM_ACTIVATE state values
+;; */
+(define-integrable     WA_INACTIVE     0)
+(define-integrable     WA_ACTIVE       1)
+(define-integrable     WA_CLICKACTIVE  2)
+
+(define-integrable WM_SETFOCUS                     #x0007)
+(define-integrable WM_KILLFOCUS                    #x0008)
+(define-integrable WM_ENABLE                       #x000A)
+(define-integrable WM_SETREDRAW                    #x000B)
+(define-integrable WM_SETTEXT                      #x000C)
+(define-integrable WM_GETTEXT                      #x000D)
+(define-integrable WM_GETTEXTLENGTH                #x000E)
+(define-integrable WM_PAINT                        #x000F)
+(define-integrable WM_CLOSE                        #x0010)
+(define-integrable WM_QUERYENDSESSION              #x0011)
+(define-integrable WM_QUIT                         #x0012)
+(define-integrable WM_QUERYOPEN                    #x0013)
+(define-integrable WM_ERASEBKGND                   #x0014)
+(define-integrable WM_SYSCOLORCHANGE               #x0015)
+(define-integrable WM_ENDSESSION                   #x0016)
+(define-integrable WM_SHOWWINDOW                   #x0018)
+(define-integrable WM_WININICHANGE                 #x001A)
+(define-integrable WM_DEVMODECHANGE                #x001B)
+(define-integrable WM_ACTIVATEAPP                  #x001C)
+(define-integrable WM_FONTCHANGE                   #x001D)
+(define-integrable WM_TIMECHANGE                   #x001E)
+(define-integrable WM_CANCELMODE                   #x001F)
+(define-integrable WM_SETCURSOR                    #x0020)
+(define-integrable WM_MOUSEACTIVATE                #x0021)
+(define-integrable WM_CHILDACTIVATE                #x0022)
+(define-integrable WM_QUEUESYNC                    #x0023)
+
+(define-integrable WM_GETMINMAXINFO                #x0024)
+;;/*
+;; * STRUCT POINTED TO BY WM_GETMINMAXINFO LPARAM
+;; */
+;;TYPEDEF STRUCT TAGMINMAXINFO {
+;;    POINT PTRESERVED;
+;;    POINT PTMAXSIZE;
+;;    POINT PTMAXPOSITION;
+;;    POINT PTMINTRACKSIZE;
+;;    POINT PTMAXTRACKSIZE;
+;;} MINMAXINFO, *PMINMAXINFO, *LPMINMAXINFO;
+
+(define-integrable WM_PAINTICON                    #x0026)
+(define-integrable WM_ICONERASEBKGND               #x0027)
+(define-integrable WM_NEXTDLGCTL                   #x0028)
+(define-integrable WM_SPOOLERSTATUS                #x002A)
+(define-integrable WM_DRAWITEM                     #x002B)
+(define-integrable WM_MEASUREITEM                  #x002C)
+(define-integrable WM_DELETEITEM                   #x002D)
+(define-integrable WM_VKEYTOITEM                   #x002E)
+(define-integrable WM_CHARTOITEM                   #x002F)
+(define-integrable WM_SETFONT                      #x0030)
+(define-integrable WM_GETFONT                      #x0031)
+(define-integrable WM_SETHOTKEY                    #x0032)
+(define-integrable WM_GETHOTKEY                    #x0033)
+(define-integrable WM_QUERYDRAGICON                #x0037)
+(define-integrable WM_COMPAREITEM                  #x0039)
+(define-integrable WM_COMPACTING                   #x0041)
+(define-integrable WM_OTHERWINDOWCREATED           #x0042) ;  // NO LONGER SUPORTED
+(define-integrable WM_OTHERWINDOWDESTROYED         #x0043) ;  // NO LONGER SUPORTED
+(define-integrable WM_COMMNOTIFY                   #x0044) ;  // NO LONGER SUPORTED
+(define-integrable WM_HOTKEYEVENT                  #x0045)
+(define-integrable WM_WINDOWPOSCHANGING            #x0046)
+(define-integrable WM_WINDOWPOSCHANGED             #x0047)
+
+(define-integrable WM_POWER                        #x0048)
+;;/*
+;; * WPARAM FOR WM_POWER WINDOW MESSAGE AND DRV_POWER DRIVER NOTIFICATION
+;; */
+(define-integrable PWR_OK              1)
+(define-integrable PWR_FAIL           -1)
+(define-integrable PWR_SUSPENDREQUEST  1)
+(define-integrable PWR_SUSPENDRESUME   2)
+(define-integrable PWR_CRITICALRESUME  3)
+
+(define-integrable WM_COPYDATA                     #x004A)
+(define-integrable WM_CANCELJOURNAL                #x004B)
+;;/*
+;; * LPARAM OF WM_COPYDATA MESSAGE POINTS TO...
+;; */
+;;TYPEDEF STRUCT TAGCOPYDATASTRUCT {
+;;    DWORD DWDATA;
+;;    DWORD CBDATA;
+;;    PVOID LPDATA;
+;;} COPYDATASTRUCT, *PCOPYDATASTRUCT;
+
+(define-integrable WM_NCCREATE                     #x0081)
+(define-integrable WM_NCDESTROY                    #x0082)
+(define-integrable WM_NCCALCSIZE                   #x0083)
+(define-integrable WM_NCHITTEST                    #x0084)
+(define-integrable WM_NCPAINT                      #x0085)
+(define-integrable WM_NCACTIVATE                   #x0086)
+(define-integrable WM_GETDLGCODE                   #x0087)
+(define-integrable WM_NCMOUSEMOVE                  #x00A0)
+(define-integrable WM_NCLBUTTONDOWN                #x00A1)
+(define-integrable WM_NCLBUTTONUP                  #x00A2)
+(define-integrable WM_NCLBUTTONDBLCLK              #x00A3)
+(define-integrable WM_NCRBUTTONDOWN                #x00A4)
+(define-integrable WM_NCRBUTTONUP                  #x00A5)
+(define-integrable WM_NCRBUTTONDBLCLK              #x00A6)
+(define-integrable WM_NCMBUTTONDOWN                #x00A7)
+(define-integrable WM_NCMBUTTONUP                  #x00A8)
+(define-integrable WM_NCMBUTTONDBLCLK              #x00A9)
+
+(define-integrable WM_KEYFIRST                     #x0100)
+(define-integrable WM_KEYDOWN                      #x0100)
+(define-integrable WM_KEYUP                        #x0101)
+(define-integrable WM_CHAR                         #x0102)
+(define-integrable WM_DEADCHAR                     #x0103)
+(define-integrable WM_SYSKEYDOWN                   #x0104)
+(define-integrable WM_SYSKEYUP                     #x0105)
+(define-integrable WM_SYSCHAR                      #x0106)
+(define-integrable WM_SYSDEADCHAR                  #x0107)
+(define-integrable WM_KEYLAST                      #x0108)
+(define-integrable WM_INITDIALOG                   #x0110)
+(define-integrable WM_COMMAND                      #x0111)
+(define-integrable WM_SYSCOMMAND                   #x0112)
+(define-integrable WM_TIMER                        #x0113)
+(define-integrable WM_HSCROLL                      #x0114)
+(define-integrable WM_VSCROLL                      #x0115)
+(define-integrable WM_INITMENU                     #x0116)
+(define-integrable WM_INITMENUPOPUP                #x0117)
+(define-integrable WM_MENUSELECT                   #x011F)
+(define-integrable WM_MENUCHAR                     #x0120)
+(define-integrable WM_ENTERIDLE                    #x0121)
+
+(define-integrable WM_CTLCOLORMSGBOX               #x0132)
+(define-integrable WM_CTLCOLOREDIT                 #x0133)
+(define-integrable WM_CTLCOLORLISTBOX              #x0134)
+(define-integrable WM_CTLCOLORBTN                  #x0135)
+(define-integrable WM_CTLCOLORDLG                  #x0136)
+(define-integrable WM_CTLCOLORSCROLLBAR            #x0137)
+(define-integrable WM_CTLCOLORSTATIC               #x0138)
+
+(define-integrable WM_MOUSEFIRST                   #x0200)
+(define-integrable WM_MOUSEMOVE                    #x0200)
+(define-integrable WM_LBUTTONDOWN                  #x0201)
+(define-integrable WM_LBUTTONUP                    #x0202)
+(define-integrable WM_LBUTTONDBLCLK                #x0203)
+(define-integrable WM_RBUTTONDOWN                  #x0204)
+(define-integrable WM_RBUTTONUP                    #x0205)
+(define-integrable WM_RBUTTONDBLCLK                #x0206)
+(define-integrable WM_MBUTTONDOWN                  #x0207)
+(define-integrable WM_MBUTTONUP                    #x0208)
+(define-integrable WM_MBUTTONDBLCLK                #x0209)
+(define-integrable WM_MOUSELAST                    #x0209)
+
+(define-integrable WM_PARENTNOTIFY                 #x0210)
+(define-integrable WM_ENTERMENULOOP                #x0211)
+(define-integrable WM_EXITMENULOOP                 #x0212)
+(define-integrable WM_MDICREATE                    #x0220)
+(define-integrable WM_MDIDESTROY                   #x0221)
+(define-integrable WM_MDIACTIVATE                  #x0222)
+(define-integrable WM_MDIRESTORE                   #x0223)
+(define-integrable WM_MDINEXT                      #x0224)
+(define-integrable WM_MDIMAXIMIZE                  #x0225)
+(define-integrable WM_MDITILE                      #x0226)
+(define-integrable WM_MDICASCADE                   #x0227)
+(define-integrable WM_MDIICONARRANGE               #x0228)
+(define-integrable WM_MDIGETACTIVE                 #x0229)
+(define-integrable WM_MDISETMENU                   #x0230)
+(define-integrable WM_DROPFILES                    #x0233)
+(define-integrable WM_MDIREFRESHMENU               #x0234)
+
+
+(define-integrable WM_CUT                          #x0300)
+(define-integrable WM_COPY                         #x0301)
+(define-integrable WM_PASTE                        #x0302)
+(define-integrable WM_CLEAR                        #x0303)
+(define-integrable WM_UNDO                         #x0304)
+(define-integrable WM_RENDERFORMAT                 #x0305)
+(define-integrable WM_RENDERALLFORMATS             #x0306)
+(define-integrable WM_DESTROYCLIPBOARD             #x0307)
+(define-integrable WM_DRAWCLIPBOARD                #x0308)
+(define-integrable WM_PAINTCLIPBOARD               #x0309)
+(define-integrable WM_VSCROLLCLIPBOARD             #x030A)
+(define-integrable WM_SIZECLIPBOARD                #x030B)
+(define-integrable WM_ASKCBFORMATNAME              #x030C)
+(define-integrable WM_CHANGECBCHAIN                #x030D)
+(define-integrable WM_HSCROLLCLIPBOARD             #x030E)
+(define-integrable WM_QUERYNEWPALETTE              #x030F)
+(define-integrable WM_PALETTEISCHANGING            #x0310)
+(define-integrable WM_PALETTECHANGED               #x0311)
+(define-integrable WM_HOTKEY                       #x0312)
+
+(define-integrable WM_PENWINFIRST                  #x0380)
+(define-integrable WM_PENWINLAST                   #x038F)
+
+
+
+
+;;/*
+;; * NOTE: ALL MESSAGE NUMBERS BELOW 0X0400 ARE RESERVED.
+;; *
+;; * PRIVATE WINDOW MESSAGES START HERE:
+;; */
+(define-integrable WM_USER                         #x0400)
+
+;;#IFNDEF NONCMESSAGES
+;;
+;;/*
+;; * WM_SYNCTASK COMMANDS
+;; */
+(define-integrable ST_BEGINSWP         0)
+(define-integrable ST_ENDSWP           1)
+
+;;/*
+;; * WM_NCHITTEST AND MOUSEHOOKSTRUCT MOUSE POSITION CODES
+;; */
+(define-integrable HTERROR             -2)
+(define-integrable HTTRANSPARENT       -1)
+(define-integrable HTNOWHERE           0)
+(define-integrable HTCLIENT            1)
+(define-integrable HTCAPTION           2)
+(define-integrable HTSYSMENU           3)
+(define-integrable HTGROWBOX           4)
+(define-integrable HTSIZE              4)
+(define-integrable HTMENU              5)
+(define-integrable HTHSCROLL           6)
+(define-integrable HTVSCROLL           7)
+(define-integrable HTMINBUTTON         8)
+(define-integrable HTMAXBUTTON         9)
+(define-integrable HTLEFT              10)
+(define-integrable HTRIGHT             11)
+(define-integrable HTTOP               12)
+(define-integrable HTTOPLEFT           13)
+(define-integrable HTTOPRIGHT          14)
+(define-integrable HTBOTTOM            15)
+(define-integrable HTBOTTOMLEFT        16)
+(define-integrable HTBOTTOMRIGHT       17)
+(define-integrable HTBORDER            18)
+(define-integrable HTREDUCE            8)
+(define-integrable HTZOOM              9)
+(define-integrable HTSIZEFIRST         10)
+(define-integrable HTSIZELAST          17)
+
+;;/*
+;; * SENDMESSAGETIMEOUT VALUES
+;; */
+(define-integrable SMTO_NORMAL         #x0000)
+(define-integrable SMTO_BLOCK          #x0001)
+(define-integrable SMTO_ABORTIFHUNG    #x0002)
+
+;;#ENDIF /* !NONCMESSAGES */
+;;
+;;/*
+;; * WM_MOUSEACTIVATE RETURN CODES
+;; */
+(define-integrable MA_ACTIVATE         1)
+(define-integrable MA_ACTIVATEANDEAT   2)
+(define-integrable MA_NOACTIVATE       3)
+(define-integrable MA_NOACTIVATEANDEAT 4)
+
+;;UINT
+;;WINAPI
+;;REGISTERWINDOWMESSAGEA(
+;;    LPCSTR LPSTRING);
+;;UINT
+;;WINAPI
+;;REGISTERWINDOWMESSAGEW(
+;;    LPCWSTR LPSTRING);
+;;#IFDEF UNICODE
+;;#DEFINE REGISTERWINDOWMESSAGE  REGISTERWINDOWMESSAGEW
+;;#ELSE
+;;#DEFINE REGISTERWINDOWMESSAGE  REGISTERWINDOWMESSAGEA
+;;#ENDIF // !UNICODE
+;;
+;;/*
+;; * WM_SIZE MESSAGE WPARAM VALUES
+;; */
+(define-integrable SIZE_RESTORED       0)
+(define-integrable SIZE_MINIMIZED      1)
+(define-integrable SIZE_MAXIMIZED      2)
+(define-integrable SIZE_MAXSHOW        3)
+(define-integrable SIZE_MAXHIDE        4)
+
+;;/*
+;; * OBSOLETE CONSTANT NAMES
+;; */
+(define-integrable SIZENORMAL          0)
+(define-integrable SIZEICONIC          1)
+(define-integrable SIZEFULLSCREEN      2)
+(define-integrable SIZEZOOMSHOW        3)
+(define-integrable SIZEZOOMHIDE        4)
+
+;;/*
+;; * WM_WINDOWPOSCHANGING/CHANGED STRUCT POINTED TO BY LPARAM
+;; */
+;;TYPEDEF STRUCT TAGWINDOWPOS {
+;;    HWND    HWND;
+;;    HWND    HWNDINSERTAFTER;
+;;    INT     X;
+;;    INT     Y;
+;;    INT     CX;
+;;    INT     CY;
+;;    UINT    FLAGS;
+;;} WINDOWPOS, *LPWINDOWPOS, *PWINDOWPOS;
+;;
+;;/*
+;; * WM_NCCALCSIZE PARAMETER STRUCTURE
+;; */
+;;TYPEDEF STRUCT TAGNCCALCSIZE_PARAMS {
+;;    RECT       RGRC[3];
+;;    PWINDOWPOS LPPOS;
+;;} NCCALCSIZE_PARAMS, *LPNCCALCSIZE_PARAMS;
+;;
+;;/*
+;; * WM_NCCALCSIZE "WINDOW VALID RECT" RETURN VALUES
+;; */
+(define-integrable WVR_ALIGNTOP        #x0010)
+(define-integrable WVR_ALIGNLEFT       #x0020)
+(define-integrable WVR_ALIGNBOTTOM     #x0040)
+(define-integrable WVR_ALIGNRIGHT      #x0080)
+(define-integrable WVR_HREDRAW         #x0100)
+(define-integrable WVR_VREDRAW         #x0200)
+(define-integrable WVR_REDRAW          (+ WVR_HREDRAW
+                                          WVR_VREDRAW))
+(define-integrable WVR_VALIDRECTS      #x0400)
+
+
+;;#IFNDEF NOKEYSTATES
+;;
+;;/*
+;; * KEY STATE MASKS FOR MOUSE MESSAGES
+;; */
+(define-integrable MK_LBUTTON          #x0001)
+(define-integrable MK_RBUTTON          #x0002)
+(define-integrable MK_SHIFT            #x0004)
+(define-integrable MK_CONTROL          #x0008)
+(define-integrable MK_MBUTTON          #x0010)
+;;
+;;#ENDIF /* !NOKEYSTATES */
+;;
+;;#ENDIF /* !NOWINMESSAGES */
+;;
+;;#IFNDEF NOWINSTYLES
+;;
+;;/*
+;; * WINDOW STYLES
+;; */
+(define-integrable WS_OVERLAPPED       #x00000000)
+(define-integrable WS_POPUP            #x80000000)
+(define-integrable WS_CHILD            #x40000000)
+(define-integrable WS_MINIMIZE         #x20000000)
+(define-integrable WS_VISIBLE          #x10000000)
+(define-integrable WS_DISABLED         #x08000000)
+(define-integrable WS_CLIPSIBLINGS     #x04000000)
+(define-integrable WS_CLIPCHILDREN     #x02000000)
+(define-integrable WS_MAXIMIZE         #x01000000)
+(define-integrable WS_CAPTION          #x00C00000)
+(define-integrable WS_BORDER           #x00800000)
+(define-integrable WS_DLGFRAME         #x00400000)
+(define-integrable WS_VSCROLL          #x00200000)
+(define-integrable WS_HSCROLL          #x00100000)
+(define-integrable WS_SYSMENU          #x00080000)
+(define-integrable WS_THICKFRAME       #x00040000)
+(define-integrable WS_GROUP            #x00020000)
+(define-integrable WS_TABSTOP          #x00010000)
+
+(define-integrable WS_MINIMIZEBOX      #x00020000)
+(define-integrable WS_MAXIMIZEBOX      #x00010000)
+
+(define-integrable WS_TILED            WS_OVERLAPPED)
+(define-integrable WS_ICONIC           WS_MINIMIZE)
+(define-integrable WS_SIZEBOX          WS_THICKFRAME)
+(define-integrable WS_TILEDWINDOW      (+ WS_OVERLAPPED WS_CAPTION WS_SYSMENU WS_THICKFRAME WS_MINIMIZEBOX WS_MAXIMIZEBOX))
+
+;;/*
+;; * COMMON WINDOW STYLES
+;; */
+(define-integrable WS_OVERLAPPEDWINDOW (+ WS_OVERLAPPED 
+                                          WS_CAPTION
+                                          WS_SYSMENU
+                                          WS_THICKFRAME
+                                          WS_MINIMIZEBOX
+                                          WS_MAXIMIZEBOX))
+
+(define-integrable WS_POPUPWINDOW      (+ WS_POPUP
+                                          WS_BORDER
+                                          WS_SYSMENU))
+
+(define-integrable WS_CHILDWINDOW      WS_CHILD)
+
+;;/*
+;; * EXTENDED WINDOW STYLES
+;; */
+(define-integrable WS_EX_DLGMODALFRAME  #x00000001)
+(define-integrable WS_EX_NOPARENTNOTIFY #x00000004)
+(define-integrable WS_EX_TOPMOST        #x00000008)
+(define-integrable WS_EX_ACCEPTFILES    #x00000010)
+(define-integrable WS_EX_TRANSPARENT    #x00000020)
+
+;;/*
+;; * CLASS STYLES
+;; */
+(define-integrable CS_VREDRAW          #x0001)
+(define-integrable CS_HREDRAW          #x0002)
+(define-integrable CS_KEYCVTWINDOW     #x0004)
+(define-integrable CS_DBLCLKS          #x0008)
+(define-integrable CS_OWNDC            #x0020)
+(define-integrable CS_CLASSDC          #x0040)
+(define-integrable CS_PARENTDC         #x0080)
+(define-integrable CS_NOKEYCVT         #x0100)
+(define-integrable CS_NOCLOSE          #x0200)
+(define-integrable CS_SAVEBITS         #x0800)
+(define-integrable CS_BYTEALIGNCLIENT  #X1000)
+(define-integrable CS_BYTEALIGNWINDOW  #X2000)
+(define-integrable CS_GLOBALCLASS      #X4000)
+
+;;#ENDIF /* !NOWINSTYLES */
+;;
+;;#IFNDEF NOCLIPBOARD
+;;
+;;/*
+;; * PREDEFINED CLIPBOARD FORMATS
+;; */
+(define-integrable CF_TEXT             1)
+(define-integrable CF_BITMAP           2)
+(define-integrable CF_METAFILEPICT     3)
+(define-integrable CF_SYLK             4)
+(define-integrable CF_DIF              5)
+(define-integrable CF_TIFF             6)
+(define-integrable CF_OEMTEXT          7)
+(define-integrable CF_DIB              8)
+(define-integrable CF_PALETTE          9)
+(define-integrable CF_PENDATA          10)
+(define-integrable CF_RIFF             11)
+(define-integrable CF_WAVE             12)
+(define-integrable CF_UNICODETEXT      13)
+(define-integrable CF_ENHMETAFILE      14)
+
+(define-integrable CF_OWNERDISPLAY     #x0080)
+(define-integrable CF_DSPTEXT          #x0081)
+(define-integrable CF_DSPBITMAP        #x0082)
+(define-integrable CF_DSPMETAFILEPICT  #x0083)
+(define-integrable CF_DSPENHMETAFILE   #x008E)
+
+;;/*
+;; * "PRIVATE" FORMATS DON'T GET GLOBALFREE()'D
+;; */
+(define-integrable CF_PRIVATEFIRST     #x0200)
+(define-integrable CF_PRIVATELAST      #x02FF)
+
+;;/*
+;; * "GDIOBJ" FORMATS DO GET DELETEOBJECT()'D
+;; */
+(define-integrable CF_GDIOBJFIRST      #x0300)
+(define-integrable CF_GDIOBJLAST       #x03FF)
+
+;;#ENDIF /* !NOCLIPBOARD */
+;;
+;;/*
+;; * DEFINES FOR THE FVIRT FIELD OF THE ACCELERATOR TABLE STRUCTURE.
+;; */
+(define-integrable FVIRTKEY  #t)
+(define-integrable FNOINVERT #x02)
+(define-integrable FSHIFT    #x04)
+(define-integrable FCONTROL  #x08)
+(define-integrable FALT      #X10)
+
+;;TYPEDEF STRUCT TAGACCEL {
+;;    BYTE   FVIRT;               /* ALSO CALLED THE FLAGS FIELD */
+;;    WORD   KEY;
+;;    WORD   CMD;
+;;} ACCEL, *LPACCEL;
+;;
+;;TYPEDEF STRUCT TAGPAINTSTRUCT {
+;;    HDC         HDC;
+;;    BOOL        FERASE;
+;;    RECT        RCPAINT;
+;;    BOOL        FRESTORE;
+;;    BOOL        FINCUPDATE;
+;;    BYTE        RGBRESERVED[32];
+;;} PAINTSTRUCT, *PPAINTSTRUCT, *NPPAINTSTRUCT, *LPPAINTSTRUCT;
+;;
+;;TYPEDEF STRUCT TAGCREATESTRUCTA {
+;;    LPVOID      LPCREATEPARAMS;
+;;    HINSTANCE   HINSTANCE;
+;;    HMENU       HMENU;
+;;    HWND        HWNDPARENT;
+;;    INT         CY;
+;;    INT         CX;
+;;    INT         Y;
+;;    INT         X;
+;;    LONG        STYLE;
+;;    LPCSTR      LPSZNAME;
+;;    LPCSTR      LPSZCLASS;
+;;    DWORD       DWEXSTYLE;
+;;} CREATESTRUCTA, *LPCREATESTRUCTA;
+;;TYPEDEF STRUCT TAGCREATESTRUCTW {
+;;    LPVOID      LPCREATEPARAMS;
+;;    HINSTANCE   HINSTANCE;
+;;    HMENU       HMENU;
+;;    HWND        HWNDPARENT;
+;;    INT         CY;
+;;    INT         CX;
+;;    INT         Y;
+;;    INT         X;
+;;    LONG        STYLE;
+;;    LPCWSTR     LPSZNAME;
+;;    LPCWSTR     LPSZCLASS;
+;;    DWORD       DWEXSTYLE;
+;;} CREATESTRUCTW, *LPCREATESTRUCTW;
+;;#IFDEF UNICODE
+;;TYPEDEF CREATESTRUCTW CREATESTRUCT;
+;;TYPEDEF LPCREATESTRUCTW LPCREATESTRUCT;
+;;#ELSE
+;;TYPEDEF CREATESTRUCTA CREATESTRUCT;
+;;TYPEDEF LPCREATESTRUCTA LPCREATESTRUCT;
+;;#ENDIF // UNICODE
+
+;;TYPEDEF STRUCT TAGWINDOWPLACEMENT {
+;;    UINT  LENGTH;
+;;    UINT  FLAGS;
+;;    UINT  SHOWCMD;
+;;    POINT PTMINPOSITION;
+;;    POINT PTMAXPOSITION;
+;;    RECT  RCNORMALPOSITION;
+;;} WINDOWPLACEMENT;
+;;TYPEDEF WINDOWPLACEMENT *PWINDOWPLACEMENT, *LPWINDOWPLACEMENT;
+
+(define-integrable WPF_SETMINPOSITION      #x0001)
+(define-integrable WPF_RESTORETOMAXIMIZED  #x0002)
+
+;;/*
+;; * OWNER DRAW CONTROL TYPES
+;; */
+(define-integrable ODT_MENU        1)
+(define-integrable ODT_LISTBOX     2)
+(define-integrable ODT_COMBOBOX    3)
+(define-integrable ODT_BUTTON      4)
+
+;;/*
+;; * OWNER DRAW ACTIONS
+;; */
+(define-integrable ODA_DRAWENTIRE  #x0001)
+(define-integrable ODA_SELECT      #x0002)
+(define-integrable ODA_FOCUS       #x0004)
+
+;;/*
+;; * OWNER DRAW STATE
+;; */
+(define-integrable ODS_SELECTED    #x0001)
+(define-integrable ODS_GRAYED      #x0002)
+(define-integrable ODS_DISABLED    #x0004)
+(define-integrable ODS_CHECKED     #x0008)
+(define-integrable ODS_FOCUS       #x0010)
+
+;;/*
+;; * MEASUREITEMSTRUCT FOR OWNERDRAW
+;; */
+;;TYPEDEF STRUCT TAGMEASUREITEMSTRUCT {
+;;    UINT       CTLTYPE;
+;;    UINT       CTLID;
+;;    UINT       ITEMID;
+;;    UINT       ITEMWIDTH;
+;;    UINT       ITEMHEIGHT;
+;;    DWORD      ITEMDATA;
+;;} MEASUREITEMSTRUCT, NEAR *PMEASUREITEMSTRUCT, FAR *LPMEASUREITEMSTRUCT;
+
+
+
+;;/*
+;; * DRAWITEMSTRUCT FOR OWNERDRAW
+;; */
+;;TYPEDEF STRUCT TAGDRAWITEMSTRUCT {
+;;    UINT        CTLTYPE;
+;;    UINT        CTLID;
+;;    UINT        ITEMID;
+;;    UINT        ITEMACTION;
+;;    UINT        ITEMSTATE;
+;;    HWND        HWNDITEM;
+;;    HDC         HDC;
+;;    RECT        RCITEM;
+;;    DWORD       ITEMDATA;
+;;} DRAWITEMSTRUCT, NEAR *PDRAWITEMSTRUCT, FAR *LPDRAWITEMSTRUCT;
+;;
+;;/*
+;; * DELETEITEMSTRUCT FOR OWNERDRAW
+;; */
+;;TYPEDEF STRUCT TAGDELETEITEMSTRUCT {
+;;    UINT       CTLTYPE;
+;;    UINT       CTLID;
+;;    UINT       ITEMID;
+;;    HWND       HWNDITEM;
+;;    UINT       ITEMDATA;
+;;} DELETEITEMSTRUCT, NEAR *PDELETEITEMSTRUCT, FAR *LPDELETEITEMSTRUCT;
+;;
+;;/*
+;; * COMPAREITEMSTUCT FOR OWNERDRAW SORTING
+;; */
+;;TYPEDEF STRUCT TAGCOMPAREITEMSTRUCT {
+;;    UINT        CTLTYPE;
+;;    UINT        CTLID;
+;;    HWND        HWNDITEM;
+;;    UINT        ITEMID1;
+;;    DWORD       ITEMDATA1;
+;;    UINT        ITEMID2;
+;;    DWORD       ITEMDATA2;
+;;    DWORD       DWLOCALEID;
+;;} COMPAREITEMSTRUCT, NEAR *PCOMPAREITEMSTRUCT, FAR *LPCOMPAREITEMSTRUCT;
+;;
+;;#IFNDEF NOMSG
+
+;;/*
+;; * MESSAGE FUNCTION TEMPLATES
+;; */
+;;BOOL
+;;WINAPI
+;;GETMESSAGEA(
+;;    LPMSG LPMSG,
+;;    HWND HWND ,
+;;    UINT WMSGFILTERMIN,
+;;    UINT WMSGFILTERMAX);
+;;/*
+;; * MESSAGE FUNCTION TEMPLATES
+;; */
+;;BOOL
+;;WINAPI
+;;GETMESSAGEW(
+;;    LPMSG LPMSG,
+;;    HWND HWND ,
+;;    UINT WMSGFILTERMIN,
+;;    UINT WMSGFILTERMAX);
+;;#IFDEF UNICODE
+;;#DEFINE GETMESSAGE  GETMESSAGEW
+;;#ELSE
+;;#DEFINE GETMESSAGE  GETMESSAGEA
+;;#ENDIF // !UNICODE
+;;
+;;BOOL
+;;WINAPI
+;;TRANSLATEMESSAGE(
+;;    CONST MSG *LPMSG);
+
+;;LONG
+;;WINAPI
+;;DISPATCHMESSAGEA(
+;;    CONST MSG *LPMSG);
+;;LONG
+;;WINAPI
+;;DISPATCHMESSAGEW(
+;;    CONST MSG *LPMSG);
+;;#IFDEF UNICODE
+;;#DEFINE DISPATCHMESSAGE  DISPATCHMESSAGEW
+;;#ELSE
+;;#DEFINE DISPATCHMESSAGE  DISPATCHMESSAGEA
+;;#ENDIF // !UNICODE
+
+
+;;BOOL
+;;WINAPI
+;;SETMESSAGEQUEUE(
+;;    INT CMESSAGESMAX);
+;;
+;;BOOL
+;;WINAPI
+;;PEEKMESSAGEA(
+;;    LPMSG LPMSG,
+;;    HWND HWND ,
+;;    UINT WMSGFILTERMIN,
+;;    UINT WMSGFILTERMAX,
+;;    UINT WREMOVEMSG);
+;;BOOL
+;;WINAPI
+;;PEEKMESSAGEW(
+;;    LPMSG LPMSG,
+;;    HWND HWND ,
+;;    UINT WMSGFILTERMIN,
+;;    UINT WMSGFILTERMAX,
+;;    UINT WREMOVEMSG);
+;;#IFDEF UNICODE
+;;#DEFINE PEEKMESSAGE  PEEKMESSAGEW
+;;#ELSE
+;;#DEFINE PEEKMESSAGE  PEEKMESSAGEA
+;;#ENDIF // !UNICODE
+;;
+;;/*
+;; * PEEKMESSAGE() OPTIONS
+;; */
+(define-integrable PM_NOREMOVE         #x0000)
+(define-integrable PM_REMOVE           #x0001)
+(define-integrable PM_NOYIELD          #x0002)
+
+;;#ENDIF /* !NOMSG */
+;;
+;;BOOL
+;;WINAPI
+;;REGISTERHOTKEY(
+;;    HWND HWND ,
+;;    INT ID,
+;;    UINT FSMODIFIERS,
+;;    UINT VK);
+;;
+;;BOOL
+;;WINAPI
+;;UNREGISTERHOTKEY(
+;;    HWND HWND,
+;;    INT ID);
+
+(define-integrable MOD_ALT         #x0001)
+(define-integrable MOD_CONTROL     #x0002)
+(define-integrable MOD_SHIFT       #x0004)
+
+(define-integrable IDHOT_SNAPWINDOW        -1)   ;  /* SHIFT-PRINTSCRN  */
+(define-integrable IDHOT_SNAPDESKTOP       -2)   ;  /* PRINTSCRN        */
+
+;;#IFDEF WIN_INTERNAL
+;;    #IFNDEF LSTRING
+;;    #DEFINE NOLSTRING
+;;    #ENDIF /* LSTRING */
+;;    #IFNDEF LFILEIO
+;;    #DEFINE NOLFILEIO
+;;    #ENDIF /* LFILEIO */
+;;#ENDIF /* WIN_INTERNAL */
+
+
+(define-integrable EWX_LOGOFF   0)
+(define-integrable EWX_SHUTDOWN 1)
+(define-integrable EWX_REBOOT   2)
+(define-integrable EWX_FORCE    4)
+
+
+;;#DEFINE EXITWINDOWS(DWRESERVED, CODE) EXITWINDOWSEX(EWX_LOGOFF, 0XFFFFFFFF)
+;;
+;;BOOL
+;;WINAPI
+;;EXITWINDOWSEX(
+;;    UINT UFLAGS,
+;;    DWORD DWRESERVED);
+;;
+;;BOOL
+;;WINAPI
+;;SWAPMOUSEBUTTON(
+;;    BOOL FSWAP);
+;;
+;;DWORD
+;;WINAPI
+;;GETMESSAGEPOS(
+;;    VOID);
+;;
+;;LONG
+;;WINAPI
+;;GETMESSAGETIME(
+;;    VOID);
+;;
+;;LONG
+;;WINAPI
+;;GETMESSAGEEXTRAINFO(
+;;    VOID);
+;;
+;;LRESULT
+;;WINAPI
+;;SENDMESSAGEA(
+;;    HWND HWND,
+;;    UINT MSG,
+;;    WPARAM WPARAM,
+;;    LPARAM LPARAM);
+;;LRESULT
+;;WINAPI
+;;SENDMESSAGEW(
+;;    HWND HWND,
+;;    UINT MSG,
+;;    WPARAM WPARAM,
+;;    LPARAM LPARAM);
+;;#IFDEF UNICODE
+;;#DEFINE SENDMESSAGE  SENDMESSAGEW
+;;#ELSE
+;;#DEFINE SENDMESSAGE  SENDMESSAGEA
+;;#ENDIF // !UNICODE
+;;
+;;LRESULT
+;;WINAPI
+;;SENDMESSAGETIMEOUTA(
+;;    HWND HWND,
+;;    UINT MSG,
+;;    WPARAM WPARAM,
+;;    LPARAM LPARAM,
+;;    UINT FUFLAGS,
+;;    UINT UTIMEOUT,
+;;    LPDWORD LPDWRESULT);
+;;LRESULT
+;;WINAPI
+;;SENDMESSAGETIMEOUTW(
+;;    HWND HWND,
+;;    UINT MSG,
+;;    WPARAM WPARAM,
+;;    LPARAM LPARAM,
+;;    UINT FUFLAGS,
+;;    UINT UTIMEOUT,
+;;    LPDWORD LPDWRESULT);
+;;#IFDEF UNICODE
+;;#DEFINE SENDMESSAGETIMEOUT  SENDMESSAGETIMEOUTW
+;;#ELSE
+;;#DEFINE SENDMESSAGETIMEOUT  SENDMESSAGETIMEOUTA
+;;#ENDIF // !UNICODE
+
+;;BOOL
+;;WINAPI
+;;SENDNOTIFYMESSAGEA(
+;;    HWND HWND,
+;;    UINT MSG,
+;;    WPARAM WPARAM,
+;;    LPARAM LPARAM);
+;;BOOL
+;;WINAPI
+;;SENDNOTIFYMESSAGEW(
+;;    HWND HWND,
+;;    UINT MSG,
+;;    WPARAM WPARAM,
+;;    LPARAM LPARAM);
+;;#IFDEF UNICODE
+;;#DEFINE SENDNOTIFYMESSAGE  SENDNOTIFYMESSAGEW
+;;#ELSE
+;;#DEFINE SENDNOTIFYMESSAGE  SENDNOTIFYMESSAGEA
+;;#ENDIF // !UNICODE
+
+;;BOOL
+;;WINAPI
+;;SENDMESSAGECALLBACKA(
+;;    HWND HWND,
+;;    UINT MSG,
+;;    WPARAM WPARAM,
+;;    LPARAM LPARAM,
+;;    SENDASYNCPROC LPRESULTCALLBACK,
+;;    DWORD DWDATA);
+;;BOOL
+;;WINAPI
+;;SENDMESSAGECALLBACKW(
+;;    HWND HWND,
+;;    UINT MSG,
+;;    WPARAM WPARAM,
+;;    LPARAM LPARAM,
+;;    SENDASYNCPROC LPRESULTCALLBACK,
+;;    DWORD DWDATA);
+;;#IFDEF UNICODE
+;;#DEFINE SENDMESSAGECALLBACK  SENDMESSAGECALLBACKW
+;;#ELSE
+;;#DEFINE SENDMESSAGECALLBACK  SENDMESSAGECALLBACKA
+;;#ENDIF // !UNICODE
+
+;;BOOL
+;;WINAPI
+;;POSTMESSAGEA(
+;;    HWND HWND,
+;;    UINT MSG,
+;;    WPARAM WPARAM,
+;;    LPARAM LPARAM);
+;;BOOL
+;;WINAPI
+;;POSTMESSAGEW(
+;;    HWND HWND,
+;;    UINT MSG,
+;;    WPARAM WPARAM,
+;;    LPARAM LPARAM);
+;;#IFDEF UNICODE
+;;#DEFINE POSTMESSAGE  POSTMESSAGEW
+;;#ELSE
+;;#DEFINE POSTMESSAGE  POSTMESSAGEA
+;;#ENDIF // !UNICODE
+
+;;BOOL
+;;WINAPI
+;;POSTTHREADMESSAGEA(
+;;    DWORD IDTHREAD,
+;;    UINT MSG,
+;;    WPARAM WPARAM,
+;;    LPARAM LPARAM);
+;;BOOL
+;;WINAPI
+;;POSTTHREADMESSAGEW(
+;;    DWORD IDTHREAD,
+;;    UINT MSG,
+;;    WPARAM WPARAM,
+;;    LPARAM LPARAM);
+;;#IFDEF UNICODE
+;;#DEFINE POSTTHREADMESSAGE  POSTTHREADMESSAGEW
+;;#ELSE
+;;#DEFINE POSTTHREADMESSAGE  POSTTHREADMESSAGEA
+;;#ENDIF // !UNICODE
+
+;;#DEFINE POSTAPPMESSAGEA(IDTHREAD, WMSG, WPARAM, LPARAM)\
+;;        POSTTHREADMESSAGEA((DWORD)IDTHREAD, WMSG, WPARAM, LPARAM)
+;;#DEFINE POSTAPPMESSAGEW(IDTHREAD, WMSG, WPARAM, LPARAM)\
+;;        POSTTHREADMESSAGEW((DWORD)IDTHREAD, WMSG, WPARAM, LPARAM)
+;;#IFDEF UNICODE
+;;#DEFINE POSTAPPMESSAGE  POSTAPPMESSAGEW
+;;#ELSE
+;;#DEFINE POSTAPPMESSAGE  POSTAPPMESSAGEA
+;;#ENDIF // !UNICODE
+
+;;/*
+;; * SPECIAL HWND VALUE FOR USE WITH POSTMESSAGE() AND SENDMESSAGE()
+;; */
+(define-integrable HWND_BROADCAST  #xFFFF) ;  ((HWND)0XFFFF)
+
+;;BOOL
+;;WINAPI
+;;ATTACHTHREADINPUT(
+;;    DWORD IDATTACH,
+;;    DWORD IDATTACHTO,
+;;    BOOL FATTACH);
+;;
+;;
+;;BOOL
+;;WINAPI
+;;REPLYMESSAGE(
+;;    LRESULT LRESULT);
+;;
+;;BOOL
+;;WINAPI
+;;WAITMESSAGE(
+;;    VOID);
+;;
+;;DWORD
+;;WINAPI
+;;WAITFORINPUTIDLE(
+;;    HANDLE HPROCESS,
+;;    DWORD DWMILLISECONDS);
+;;
+;;LRESULT
+;;WINAPI
+;;DEFWINDOWPROCA(
+;;    HWND HWND,
+;;    UINT MSG,
+;;    WPARAM WPARAM,
+;;    LPARAM LPARAM);
+;;LRESULT
+;;WINAPI
+;;DEFWINDOWPROCW(
+;;    HWND HWND,
+;;    UINT MSG,
+;;    WPARAM WPARAM,
+;;    LPARAM LPARAM);
+;;#IFDEF UNICODE
+;;#DEFINE DEFWINDOWPROC  DEFWINDOWPROCW
+;;#ELSE
+;;#DEFINE DEFWINDOWPROC  DEFWINDOWPROCA
+;;#ENDIF // !UNICODE
+;;
+;;VOID
+;;WINAPI
+;;POSTQUITMESSAGE(
+;;    INT NEXITCODE);
+;;
+;;#IFDEF STRICT
+;;
+;;LRESULT
+;;WINAPI
+;;CALLWINDOWPROCA(
+;;    WNDPROC LPPREVWNDFUNC,
+;;    HWND HWND,
+;;    UINT MSG,
+;;    WPARAM WPARAM,
+;;    LPARAM LPARAM);
+;;LRESULT
+;;WINAPI
+;;CALLWINDOWPROCW(
+;;    WNDPROC LPPREVWNDFUNC,
+;;    HWND HWND,
+;;    UINT MSG,
+;;    WPARAM WPARAM,
+;;    LPARAM LPARAM);
+;;#IFDEF UNICODE
+;;#DEFINE CALLWINDOWPROC  CALLWINDOWPROCW
+;;#ELSE
+;;#DEFINE CALLWINDOWPROC  CALLWINDOWPROCA
+;;#ENDIF // !UNICODE
+;;
+;;#ELSE /* !STRICT */
+;;
+;;LRESULT
+;;WINAPI
+;;CALLWINDOWPROCA(
+;;    FARPROC LPPREVWNDFUNC,
+;;    HWND HWND,
+;;    UINT MSG,
+;;    WPARAM WPARAM,
+;;    LPARAM LPARAM);
+;;LRESULT
+;;WINAPI
+;;CALLWINDOWPROCW(
+;;    FARPROC LPPREVWNDFUNC,
+;;    HWND HWND,
+;;    UINT MSG,
+;;    WPARAM WPARAM,
+;;    LPARAM LPARAM);
+;;#IFDEF UNICODE
+;;#DEFINE CALLWINDOWPROC  CALLWINDOWPROCW
+;;#ELSE
+;;#DEFINE CALLWINDOWPROC  CALLWINDOWPROCA
+;;#ENDIF // !UNICODE
+;;
+;;#ENDIF /* !STRICT */
+;;
+;;BOOL
+;;WINAPI
+;;INSENDMESSAGE(
+;;    VOID);
+;;
+;;UINT
+;;WINAPI
+;;GETDOUBLECLICKTIME(
+;;    VOID);
+;;
+;;BOOL
+;;WINAPI
+;;SETDOUBLECLICKTIME(
+;;    UINT);
+;;
+;;ATOM
+;;WINAPI
+;;REGISTERCLASSA(
+;;    CONST WNDCLASSA *LPWNDCLASS);
+;;ATOM
+;;WINAPI
+;;REGISTERCLASSW(
+;;    CONST WNDCLASSW *LPWNDCLASS);
+;;#IFDEF UNICODE
+;;#DEFINE REGISTERCLASS  REGISTERCLASSW
+;;#ELSE
+;;#DEFINE REGISTERCLASS  REGISTERCLASSA
+;;#ENDIF // !UNICODE
+;;
+;;BOOL
+;;WINAPI
+;;UNREGISTERCLASSA(
+;;    LPCSTR LPCLASSNAME,
+;;    HINSTANCE HINSTANCE);
+;;BOOL
+;;WINAPI
+;;UNREGISTERCLASSW(
+;;    LPCWSTR LPCLASSNAME,
+;;    HINSTANCE HINSTANCE);
+;;#IFDEF UNICODE
+;;#DEFINE UNREGISTERCLASS  UNREGISTERCLASSW
+;;#ELSE
+;;#DEFINE UNREGISTERCLASS  UNREGISTERCLASSA
+;;#ENDIF // !UNICODE
+;;
+;;BOOL
+;;WINAPI
+;;GETCLASSINFOA(
+;;    HINSTANCE HINSTANCE ,
+;;    LPCSTR LPCLASSNAME,
+;;    LPWNDCLASSA LPWNDCLASS);
+;;BOOL
+;;WINAPI
+;;GETCLASSINFOW(
+;;    HINSTANCE HINSTANCE ,
+;;    LPCWSTR LPCLASSNAME,
+;;    LPWNDCLASSW LPWNDCLASS);
+;;#IFDEF UNICODE
+;;#DEFINE GETCLASSINFO  GETCLASSINFOW
+;;#ELSE
+;;#DEFINE GETCLASSINFO  GETCLASSINFOA
+;;#ENDIF // !UNICODE
+
+(define-integrable CW_USEDEFAULT       #x80000000) ; ((UINT)0X80000000)
+
+;;/*
+;; * SPECIAL VALUE FOR CREATEWINDOW, ET AL.
+;; */
+(define-integrable HWND_DESKTOP        0)          ; ((HWND)0)
+
+;;HWND
+;;WINAPI
+;;CreateWindowExA(
+;;    DWORD dwExStyle,
+;;    LPCSTR lpClassName,
+;;    LPCSTR lpWindowName,
+;;    DWORD dwStyle,
+;;    int X,
+;;    int Y,
+;;    int nWidth,
+;;    int nHeight,
+;;    HWND hWndParent ,
+;;    HMENU hMenu,
+;;    HINSTANCE hInstance,
+;;    LPVOID lpParam);
+;;HWND
+;;WINAPI
+;;CreateWindowExW(
+;;    DWORD dwExStyle,
+;;    LPCWSTR lpClassName,
+;;    LPCWSTR lpWindowName,
+;;    DWORD dwStyle,
+;;    int X,
+;;    int Y,
+;;    int nWidth,
+;;    int nHeight,
+;;    HWND hWndParent ,
+;;    HMENU hMenu,
+;;    HINSTANCE hInstance,
+;;    LPVOID lpParam);
+;;#ifdef UNICODE
+;;#define CreateWindowEx  CreateWindowExW
+;;#else
+;;#define CreateWindowEx  CreateWindowExA
+;;#endif // !UNICODE
+;;
+;;#define CreateWindowA(lpClassName, lpWindowName, dwStyle, x, y,\
+;;nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)\
+;;CreateWindowExA(0L, lpClassName, lpWindowName, dwStyle, x, y,\
+;;nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)
+;;#define CreateWindowW(lpClassName, lpWindowName, dwStyle, x, y,\
+;;nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)\
+;;CreateWindowExW(0L, lpClassName, lpWindowName, dwStyle, x, y,\
+;;nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam)
+;;#ifdef UNICODE
+;;#define CreateWindow  CreateWindowW
+;;#else
+;;#define CreateWindow  CreateWindowA
+;;#endif // !UNICODE
+;;
+;;BOOL
+;;WINAPI
+;;IsWindow(
+;;    HWND hWnd);
+;;
+;;BOOL
+;;WINAPI
+;;IsMenu(
+;;    HMENU hMenu);
+;;
+;;BOOL
+;;WINAPI
+;;IsChild(
+;;    HWND hWndParent,
+;;    HWND hWnd);
+;;
+;;BOOL
+;;WINAPI
+;;DestroyWindow(
+;;    HWND hWnd);
+;;
+;;BOOL
+;;WINAPI
+;;ShowWindow(
+;;    HWND hWnd,
+;;    int nCmdShow);
+;;
+;;BOOL
+;;WINAPI
+;;FlashWindow(
+;;    HWND hWnd,
+;;    BOOL bInvert);
+;;
+;;BOOL
+;;WINAPI
+;;ShowOwnedPopups(
+;;    HWND hWnd,
+;;    BOOL fShow);
+;;
+;;BOOL
+;;WINAPI
+;;OpenIcon(
+;;    HWND hWnd);
+;;
+;;BOOL
+;;WINAPI
+;;CloseWindow(
+;;    HWND hWnd);
+;;
+;;BOOL
+;;WINAPI
+;;MoveWindow(
+;;    HWND hWnd,
+;;    int X,
+;;    int Y,
+;;    int nWidth,
+;;    int nHeight,
+;;    BOOL bRepaint);
+;;
+;;BOOL
+;;WINAPI
+;;SetWindowPos(
+;;    HWND hWnd,
+;;    HWND hWndInsertAfter ,
+;;    int X,
+;;    int Y,
+;;    int cx,
+;;    int cy,
+;;    UINT uFlags);
+;;
+;;BOOL
+;;WINAPI
+;;GetWindowPlacement(
+;;    HWND hWnd,
+;;    WINDOWPLACEMENT *lpwndpl);
+;;
+;;BOOL
+;;WINAPI
+;;SetWindowPlacement(
+;;    HWND hWnd,
+;;    CONST WINDOWPLACEMENT *lpwndpl);
+;;
+;;
+;;#ifndef NODEFERWINDOWPOS
+;;
+;;HDWP
+;;WINAPI
+;;BeginDeferWindowPos(
+;;    int nNumWindows);
+;;
+;;HDWP
+;;WINAPI
+;;DeferWindowPos(
+;;    HDWP hWinPosInfo,
+;;    HWND hWnd,
+;;    HWND hWndInsertAfter ,
+;;    int x,
+;;    int y,
+;;    int cx,
+;;    int cy,
+;;    UINT uFlags);
+;;
+;;BOOL
+;;WINAPI
+;;EndDeferWindowPos(
+;;    HDWP hWinPosInfo);
+;;
+;;#endif /* !NODEFERWINDOWPOS */
+;;
+;;BOOL
+;;WINAPI
+;;IsWindowVisible(
+;;    HWND hWnd);
+;;
+;;BOOL
+;;WINAPI
+;;IsIconic(
+;;    HWND hWnd);
+;;
+;;BOOL
+;;WINAPI
+;;AnyPopup(
+;;    VOID);
+;;
+;;BOOL
+;;WINAPI
+;;BringWindowToTop(
+;;    HWND hWnd);
+;;
+;;BOOL
+;;WINAPI
+;;IsZoomed(
+;;    HWND hWnd);
+;;
+;;/*
+;; * SetWindowPos Flags
+;; */
+(define-integrable SWP_NOSIZE          #x0001)
+(define-integrable SWP_NOMOVE          #x0002)
+(define-integrable SWP_NOZORDER        #x0004)
+(define-integrable SWP_NOREDRAW        #x0008)
+(define-integrable SWP_NOACTIVATE      #x0010)
+(define-integrable SWP_FRAMECHANGED    #x0020) ;  /* The frame changed: send WM_NCCALCSIZE */
+(define-integrable SWP_SHOWWINDOW      #x0040)
+(define-integrable SWP_HIDEWINDOW      #x0080)
+(define-integrable SWP_NOCOPYBITS      #x0100)
+(define-integrable SWP_NOOWNERZORDER   #x0200) ;  /* Don't do owner Z ordering */
+
+(define-integrable SWP_DRAWFRAME       SWP_FRAMECHANGED)
+(define-integrable SWP_NOREPOSITION    SWP_NOOWNERZORDER)
+
+
+(define-integrable HWND_TOP        0)  ;((HWND)0)
+(define-integrable HWND_BOTTOM     1)  ;((HWND)1)
+(define-integrable HWND_TOPMOST    -1)  ;((HWND)-1)
+(define-integrable HWND_NOTOPMOST  -2)  ;((HWND)-2)
+
+;;#ifndef NOCTLMGR
+
+;;#ifndef RC_INVOKED       // RC can't handle #pragmas
+;;
+;;/*
+;; * WARNING:
+;; * The following structures must NOT be DWORD padded because they are
+;; * followed by strings, etc that do not have to be DWORD aligned.
+;; */
+;;#pragma pack(2)
+
+;;typedef struct {
+;;    DWORD style;
+;;    DWORD dwExtendedStyle;
+;;    WORD cdit;
+;;    short x;
+;;    short y;
+;;    short cx;
+;;    short cy;
+;;} DLGTEMPLATE;
+;;typedef DLGTEMPLATE *LPDLGTEMPLATEA;
+;;typedef DLGTEMPLATE *LPDLGTEMPLATEW;
+;;#ifdef UNICODE
+;;typedef LPDLGTEMPLATEW LPDLGTEMPLATE;
+;;#else
+;;typedef LPDLGTEMPLATEA LPDLGTEMPLATE;
+;;#endif // UNICODE
+;;typedef CONST DLGTEMPLATE *LPCDLGTEMPLATEA;
+;;typedef CONST DLGTEMPLATE *LPCDLGTEMPLATEW;
+;;#ifdef UNICODE
+;;typedef LPCDLGTEMPLATEW LPCDLGTEMPLATE;
+;;#else
+;;typedef LPCDLGTEMPLATEA LPCDLGTEMPLATE;
+;;#endif // UNICODE
+;;
+;;/*
+;; * Dialog item template (dit)
+;; */
+;;typedef struct {
+;;    DWORD style;
+;;    DWORD dwExtendedStyle;
+;;    short x;
+;;    short y;
+;;    short cx;
+;;    short cy;
+;;    WORD id;
+;;} DLGITEMTEMPLATE;
+;;typedef DLGITEMTEMPLATE *PDLGITEMTEMPLATEA;
+;;typedef DLGITEMTEMPLATE *PDLGITEMTEMPLATEW;
+;;#ifdef UNICODE
+;;typedef PDLGITEMTEMPLATEW PDLGITEMTEMPLATE;
+;;#else
+;;typedef PDLGITEMTEMPLATEA PDLGITEMTEMPLATE;
+;;#endif // UNICODE
+;;typedef DLGITEMTEMPLATE *LPDLGITEMTEMPLATEA;
+;;typedef DLGITEMTEMPLATE *LPDLGITEMTEMPLATEW;
+;;#ifdef UNICODE
+;;typedef LPDLGITEMTEMPLATEW LPDLGITEMTEMPLATE;
+;;#else
+;;typedef LPDLGITEMTEMPLATEA LPDLGITEMTEMPLATE;
+;;#endif // UNICODE
+;;
+;;#pragma pack()      // Resume normal packing
+;;#endif  /* !RC_INVOKED */
+;;
+;;HWND
+;;WINAPI
+;;CreateDialogParamA(
+;;    HINSTANCE hInstance,
+;;    LPCSTR lpTemplateName,
+;;    HWND hWndParent ,
+;;    DLGPROC lpDialogFunc,
+;;    LPARAM dwInitParam);
+;;HWND
+;;WINAPI
+;;CreateDialogParamW(
+;;    HINSTANCE hInstance,
+;;    LPCWSTR lpTemplateName,
+;;    HWND hWndParent ,
+;;    DLGPROC lpDialogFunc,
+;;    LPARAM dwInitParam);
+;;#ifdef UNICODE
+;;#define CreateDialogParam  CreateDialogParamW
+;;#else
+;;#define CreateDialogParam  CreateDialogParamA
+;;#endif // !UNICODE
+;;
+;;HWND
+;;WINAPI
+;;CreateDialogIndirectParamA(
+;;    HINSTANCE hInstance,
+;;    LPCDLGTEMPLATEA lpTemplate,
+;;    HWND hWndParent,
+;;    DLGPROC lpDialogFunc,
+;;    LPARAM dwInitParam);
+;;HWND
+;;WINAPI
+;;CreateDialogIndirectParamW(
+;;    HINSTANCE hInstance,
+;;    LPCDLGTEMPLATEW lpTemplate,
+;;    HWND hWndParent,
+;;    DLGPROC lpDialogFunc,
+;;    LPARAM dwInitParam);
+;;#ifdef UNICODE
+;;#define CreateDialogIndirectParam  CreateDialogIndirectParamW
+;;#else
+;;#define CreateDialogIndirectParam  CreateDialogIndirectParamA
+;;#endif // !UNICODE
+
+;;#define CreateDialogA(hInstance, lpName, hWndParent, lpDialogFunc) \
+;;CreateDialogParamA(hInstance, lpName, hWndParent, lpDialogFunc, 0L)
+;;#define CreateDialogW(hInstance, lpName, hWndParent, lpDialogFunc) \
+;;CreateDialogParamW(hInstance, lpName, hWndParent, lpDialogFunc, 0L)
+;;#ifdef UNICODE
+;;#define CreateDialog  CreateDialogW
+;;#else
+;;#define CreateDialog  CreateDialogA
+;;#endif // !UNICODE
+;;
+;;#define CreateDialogIndirectA(hInstance, lpTemplate, hWndParent, lpDialogFunc) \
+;;CreateDialogIndirectParamA(hInstance, lpTemplate, hWndParent, lpDialogFunc, 0L)
+;;#define CreateDialogIndirectW(hInstance, lpTemplate, hWndParent, lpDialogFunc) \
+;;CreateDialogIndirectParamW(hInstance, lpTemplate, hWndParent, lpDialogFunc, 0L)
+;;#ifdef UNICODE
+;;#define CreateDialogIndirect  CreateDialogIndirectW
+;;#else
+;;#define CreateDialogIndirect  CreateDialogIndirectA
+;;#endif // !UNICODE
+;;
+;;int
+;;WINAPI
+;;DialogBoxParamA(
+;;    HINSTANCE hInstance,
+;;    LPCSTR lpTemplateName,
+;;    HWND hWndParent ,
+;;    DLGPROC lpDialogFunc,
+;;    LPARAM dwInitParam);
+;;int
+;;WINAPI
+;;DialogBoxParamW(
+;;    HINSTANCE hInstance,
+;;    LPCWSTR lpTemplateName,
+;;    HWND hWndParent ,
+;;    DLGPROC lpDialogFunc,
+;;    LPARAM dwInitParam);
+;;#ifdef UNICODE
+;;#define DialogBoxParam  DialogBoxParamW
+;;#else
+;;#define DialogBoxParam  DialogBoxParamA
+;;#endif // !UNICODE
+;;
+;;int
+;;WINAPI
+;;DialogBoxIndirectParamA(
+;;    HINSTANCE hInstance,
+;;    LPCDLGTEMPLATEA hDialogTemplate,
+;;    HWND hWndParent ,
+;;    DLGPROC lpDialogFunc,
+;;    LPARAM dwInitParam);
+;;int
+;;WINAPI
+;;DialogBoxIndirectParamW(
+;;    HINSTANCE hInstance,
+;;    LPCDLGTEMPLATEW hDialogTemplate,
+;;    HWND hWndParent ,
+;;    DLGPROC lpDialogFunc,
+;;    LPARAM dwInitParam);
+;;#ifdef UNICODE
+;;#define DialogBoxIndirectParam  DialogBoxIndirectParamW
+;;#else
+;;#define DialogBoxIndirectParam  DialogBoxIndirectParamA
+;;#endif // !UNICODE
+;;
+;;#define DialogBoxA(hInstance, lpTemplate, hWndParent, lpDialogFunc) \
+;;DialogBoxParamA(hInstance, lpTemplate, hWndParent, lpDialogFunc, 0L)
+;;#define DialogBoxW(hInstance, lpTemplate, hWndParent, lpDialogFunc) \
+;;DialogBoxParamW(hInstance, lpTemplate, hWndParent, lpDialogFunc, 0L)
+;;#ifdef UNICODE
+;;#define DialogBox  DialogBoxW
+;;#else
+;;#define DialogBox  DialogBoxA
+;;#endif // !UNICODE
+;;
+;;#define DialogBoxIndirectA(hInstance, lpTemplate, hWndParent, lpDialogFunc) \
+;;DialogBoxIndirectParamA(hInstance, lpTemplate, hWndParent, lpDialogFunc, 0L)
+;;#define DialogBoxIndirectW(hInstance, lpTemplate, hWndParent, lpDialogFunc) \
+;;DialogBoxIndirectParamW(hInstance, lpTemplate, hWndParent, lpDialogFunc, 0L)
+;;#ifdef UNICODE
+;;#define DialogBoxIndirect  DialogBoxIndirectW
+;;#else
+;;#define DialogBoxIndirect  DialogBoxIndirectA
+;;#endif // !UNICODE
+;;
+;;BOOL
+;;WINAPI
+;;EndDialog(
+;;    HWND hDlg,
+;;    int nResult);
+;;
+;;HWND
+;;WINAPI
+;;GetDlgItem(
+;;    HWND hDlg,
+;;    int nIDDlgItem);
+
+;;BOOL
+;;WINAPI
+;;SetDlgItemInt(
+;;    HWND hDlg,
+;;    int nIDDlgItem,
+;;    UINT uValue,
+;;    BOOL bSigned);
+;;
+;;UINT
+;;WINAPI
+;;GetDlgItemInt(
+;;    HWND hDlg,
+;;    int nIDDlgItem,
+;;    BOOL *lpTranslated,
+;;    BOOL bSigned);
+;;
+;;BOOL
+;;WINAPI
+;;SetDlgItemTextA(
+;;    HWND hDlg,
+;;    int nIDDlgItem,
+;;    LPCSTR lpString);
+;;BOOL
+;;WINAPI
+;;SetDlgItemTextW(
+;;    HWND hDlg,
+;;    int nIDDlgItem,
+;;    LPCWSTR lpString);
+;;#ifdef UNICODE
+;;#define SetDlgItemText  SetDlgItemTextW
+;;#else
+;;#define SetDlgItemText  SetDlgItemTextA
+;;#endif // !UNICODE
+;;
+;;UINT
+;;WINAPI
+;;GetDlgItemTextA(
+;;    HWND hDlg,
+;;    int nIDDlgItem,
+;;    LPSTR lpString,
+;;    int nMaxCount);
+;;UINT
+;;WINAPI
+;;GetDlgItemTextW(
+;;    HWND hDlg,
+;;    int nIDDlgItem,
+;;    LPWSTR lpString,
+;;    int nMaxCount);
+;;#ifdef UNICODE
+;;#define GetDlgItemText  GetDlgItemTextW
+;;#else
+;;#define GetDlgItemText  GetDlgItemTextA
+;;#endif // !UNICODE
+;;
+;;BOOL
+;;WINAPI
+;;CheckDlgButton(
+;;    HWND hDlg,
+;;    int nIDButton,
+;;    UINT uCheck);
+
+;;BOOL
+;;WINAPI
+;;CheckRadioButton(
+;;    HWND hDlg,
+;;    int nIDFirstButton,
+;;    int nIDLastButton,
+;;    int nIDCheckButton);
+;;
+;;UINT
+;;WINAPI
+;;IsDlgButtonChecked(
+;;    HWND hDlg,
+;;    int nIDButton);
+;;
+;;LONG
+;;WINAPI
+;;SendDlgItemMessageA(
+;;    HWND hDlg,
+;;    int nIDDlgItem,
+;;    UINT Msg,
+;;    WPARAM wParam,
+;;    LPARAM lParam);
+;;LONG
+;;WINAPI
+;;SendDlgItemMessageW(
+;;    HWND hDlg,
+;;    int nIDDlgItem,
+;;    UINT Msg,
+;;    WPARAM wParam,
+;;    LPARAM lParam);
+;;#ifdef UNICODE
+;;#define SendDlgItemMessage  SendDlgItemMessageW
+;;#else
+;;#define SendDlgItemMessage  SendDlgItemMessageA
+;;#endif // !UNICODE
+;;
+;;HWND
+;;WINAPI
+;;GetNextDlgGroupItem(
+;;    HWND hDlg,
+;;    HWND hCtl,
+;;    BOOL bPrevious);
+;;
+;;HWND
+;;WINAPI
+;;GetNextDlgTabItem(
+;;    HWND hDlg,
+;;    HWND hCtl,
+;;    BOOL bPrevious);
+;;
+;;int
+;;WINAPI
+;;GetDlgCtrlID(
+;;    HWND hWnd);
+;;
+;;long
+;;WINAPI
+;;GetDialogBaseUnits(VOID);
+;;
+;;LRESULT
+;;WINAPI
+;;DefDlgProcA(
+;;    HWND hDlg,
+;;    UINT Msg,
+;;    WPARAM wParam,
+;;    LPARAM lParam);
+;;LRESULT
+;;WINAPI
+;;DefDlgProcW(
+;;    HWND hDlg,
+;;    UINT Msg,
+;;    WPARAM wParam,
+;;    LPARAM lParam);
+;;#ifdef UNICODE
+;;#define DefDlgProc  DefDlgProcW
+;;#else
+;;#define DefDlgProc  DefDlgProcA
+;;#endif // !UNICODE
+;;
+;;/*
+;; * Window extra byted needed for private dialog classes.
+;; */
+(define DLGWINDOWEXTRA 30)
+
+;;#endif /* !NOCTLMGR */
+;;
+;;#ifndef NOMSG
+;;BOOL
+;;WINAPI
+;;CallMsgFilter(
+;;    LPMSG lpMsg,
+;;    int nCode);
+;;#endif /* !NOMSG */
+;;
+;;#ifndef NOCLIPBOARD
+;;
+;;/*
+;; * Clipboard Manager Functions
+;; */
+;;BOOL
+;;WINAPI
+;;OpenClipboard(
+;;    HWND hWndNewOwner);
+;;
+;;BOOL
+;;WINAPI
+;;CloseClipboard(
+;;    VOID);
+;;
+;;HWND
+;;WINAPI
+;;GetClipboardOwner(
+;;    VOID);
+;;
+;;HWND
+;;WINAPI
+;;SetClipboardViewer(
+;;    HWND hWndNewViewer);
+;;
+;;HWND
+;;WINAPI
+;;GetClipboardViewer(
+;;    VOID);
+;;
+;;BOOL
+;;WINAPI
+;;ChangeClipboardChain(
+;;    HWND hWndRemove,
+;;    HWND hWndNewNext);
+;;
+;;HANDLE
+;;WINAPI
+;;SetClipboardData(
+;;    UINT uFormat,
+;;    HANDLE hMem);
+;;
+;;HANDLE
+;;WINAPI
+;;    GetClipboardData(
+;;    UINT uFormat);
+;;
+;;UINT
+;;WINAPI
+;;RegisterClipboardFormatA(
+;;    LPCSTR lpszFormat);
+;;UINT
+;;WINAPI
+;;RegisterClipboardFormatW(
+;;    LPCWSTR lpszFormat);
+;;#ifdef UNICODE
+;;#define RegisterClipboardFormat  RegisterClipboardFormatW
+;;#else
+;;#define RegisterClipboardFormat  RegisterClipboardFormatA
+;;#endif // !UNICODE
+;;
+;;int
+;;WINAPI
+;;CountClipboardFormats(
+;;    VOID);
+;;
+;;UINT
+;;WINAPI
+;;EnumClipboardFormats(
+;;    UINT format);
+;;
+;;int
+;;WINAPI
+;;GetClipboardFormatNameA(
+;;    UINT format,
+;;    LPSTR lpszFormatName,
+;;    int cchMaxCount);
+;;int
+;;WINAPI
+;;GetClipboardFormatNameW(
+;;    UINT format,
+;;    LPWSTR lpszFormatName,
+;;    int cchMaxCount);
+;;#ifdef UNICODE
+;;#define GetClipboardFormatName  GetClipboardFormatNameW
+;;#else
+;;#define GetClipboardFormatName  GetClipboardFormatNameA
+;;#endif // !UNICODE
+;;
+;;BOOL
+;;WINAPI
+;;EmptyClipboard(
+;;    VOID);
+
+;;BOOL
+;;WINAPI
+;;IsClipboardFormatAvailable(
+;;    UINT format);
+;;
+;;int
+;;WINAPI
+;;GetPriorityClipboardFormat(
+;;    UINT *paFormatPriorityList,
+;;    int cFormats);
+;;
+;;HWND
+;;WINAPI
+;;GetOpenClipboardWindow(
+;;    VOID);
+;;
+;;#endif /* !NOCLIPBOARD */
+;;
+;;/*
+;; * Character Translation Routines
+;; */
+;;
+;;BOOL
+;;WINAPI
+;;CharToOemA(
+;;    LPCSTR lpszSrc,
+;;    LPSTR lpszDst);
+;;BOOL
+;;WINAPI
+;;CharToOemW(
+;;    LPCWSTR lpszSrc,
+;;    LPSTR lpszDst);
+;;#ifdef UNICODE
+;;#define CharToOem  CharToOemW
+;;#else
+;;#define CharToOem  CharToOemA
+;;#endif // !UNICODE
+;;
+;;BOOL
+;;WINAPI
+;;OemToCharA(
+;;    LPCSTR lpszSrc,
+;;    LPSTR lpszDst);
+;;BOOL
+;;WINAPI
+;;OemToCharW(
+;;    LPCSTR lpszSrc,
+;;    LPWSTR lpszDst);
+;;#ifdef UNICODE
+;;#define OemToChar  OemToCharW
+;;#else
+;;#define OemToChar  OemToCharA
+;;#endif // !UNICODE
+;;
+;;BOOL
+;;WINAPI
+;;CharToOemBuffA(
+;;    LPCSTR lpszSrc,
+;;    LPSTR lpszDst,
+;;    DWORD cchDstLength);
+;;BOOL
+;;WINAPI
+;;CharToOemBuffW(
+;;    LPCWSTR lpszSrc,
+;;    LPSTR lpszDst,
+;;    DWORD cchDstLength);
+;;#ifdef UNICODE
+;;#define CharToOemBuff  CharToOemBuffW
+;;#else
+;;#define CharToOemBuff  CharToOemBuffA
+;;#endif // !UNICODE
+;;
+;;BOOL
+;;WINAPI
+;;OemToCharBuffA(
+;;    LPCSTR lpszSrc,
+;;    LPSTR lpszDst,
+;;    DWORD cchDstLength);
+;;BOOL
+;;WINAPI
+;;OemToCharBuffW(
+;;    LPCSTR lpszSrc,
+;;    LPWSTR lpszDst,
+;;    DWORD cchDstLength);
+;;#ifdef UNICODE
+;;#define OemToCharBuff  OemToCharBuffW
+;;#else
+;;#define OemToCharBuff  OemToCharBuffA
+;;#endif // !UNICODE
+;;
+;;LPSTR
+;;WINAPI
+;;CharUpperA(
+;;    LPSTR lpsz);
+;;LPWSTR
+;;WINAPI
+;;CharUpperW(
+;;    LPWSTR lpsz);
+;;#ifdef UNICODE
+;;#define CharUpper  CharUpperW
+;;#else
+;;#define CharUpper  CharUpperA
+;;#endif // !UNICODE
+;;
+;;DWORD
+;;WINAPI
+;;CharUpperBuffA(
+;;    LPSTR lpsz,
+;;    DWORD cchLength);
+;;DWORD
+;;WINAPI
+;;CharUpperBuffW(
+;;    LPWSTR lpsz,
+;;    DWORD cchLength);
+;;#ifdef UNICODE
+;;#define CharUpperBuff  CharUpperBuffW
+;;#else
+;;#define CharUpperBuff  CharUpperBuffA
+;;#endif // !UNICODE
+;;
+;;LPSTR
+;;WINAPI
+;;CharLowerA(
+;;    LPSTR lpsz);
+;;LPWSTR
+;;WINAPI
+;;CharLowerW(
+;;    LPWSTR lpsz);
+;;#ifdef UNICODE
+;;#define CharLower  CharLowerW
+;;#else
+;;#define CharLower  CharLowerA
+;;#endif // !UNICODE
+;;
+;;DWORD
+;;WINAPI
+;;CharLowerBuffA(
+;;    LPSTR lpsz,
+;;    DWORD cchLength);
+;;DWORD
+;;WINAPI
+;;CharLowerBuffW(
+;;    LPWSTR lpsz,
+;;    DWORD cchLength);
+;;#ifdef UNICODE
+;;#define CharLowerBuff  CharLowerBuffW
+;;#else
+;;#define CharLowerBuff  CharLowerBuffA
+;;#endif // !UNICODE
+;;
+;;LPSTR
+;;WINAPI
+;;CharNextA(
+;;    LPCSTR lpsz);
+;;LPWSTR
+;;WINAPI
+;;CharNextW(
+;;    LPCWSTR lpsz);
+;;#ifdef UNICODE
+;;#define CharNext  CharNextW
+;;#else
+;;#define CharNext  CharNextA
+;;#endif // !UNICODE
+;;
+;;LPSTR
+;;WINAPI
+;;CharPrevA(
+;;    LPCSTR lpszStart,
+;;    LPCSTR lpszCurrent);
+;;LPWSTR
+;;WINAPI
+;;CharPrevW(
+;;    LPCWSTR lpszStart,
+;;    LPCWSTR lpszCurrent);
+;;#ifdef UNICODE
+;;#define CharPrev  CharPrevW
+;;#else
+;;#define CharPrev  CharPrevA
+;;#endif // !UNICODE
+;;
+;;/*
+;; * Compatibility defines for character translation routines
+;; */
+;;#define AnsiToOem CharToOemA
+;;#define OemToAnsi OemToCharA
+;;#define AnsiToOemBuff CharToOemBuffA
+;;#define OemToAnsiBuff OemToCharBuffA
+;;#define AnsiUpper CharUpperA
+;;#define AnsiUpperBuff CharUpperBuffA
+;;#define AnsiLower CharLowerA
+;;#define AnsiLowerBuff CharLowerBuffA
+;;#define AnsiNext CharNextA
+;;#define AnsiPrev CharPrevA
+;;
+;;#ifndef  NOLANGUAGE
+;;/*
+;; * Language dependent Routines
+;; */
+;;
+;;BOOL
+;;WINAPI
+;;IsCharAlphaA(
+;;    CHAR ch);
+;;BOOL
+;;WINAPI
+;;IsCharAlphaW(
+;;    WCHAR ch);
+;;#ifdef UNICODE
+;;#define IsCharAlpha  IsCharAlphaW
+;;#else
+;;#define IsCharAlpha  IsCharAlphaA
+;;#endif // !UNICODE
+;;
+;;BOOL
+;;WINAPI
+;;IsCharAlphaNumericA(
+;;    CHAR ch);
+;;BOOL
+;;WINAPI
+;;IsCharAlphaNumericW(
+;;    WCHAR ch);
+;;#ifdef UNICODE
+;;#define IsCharAlphaNumeric  IsCharAlphaNumericW
+;;#else
+;;#define IsCharAlphaNumeric  IsCharAlphaNumericA
+;;#endif // !UNICODE
+;;
+;;BOOL
+;;WINAPI
+;;IsCharUpperA(
+;;    CHAR ch);
+;;BOOL
+;;WINAPI
+;;IsCharUpperW(
+;;    WCHAR ch);
+;;#ifdef UNICODE
+;;#define IsCharUpper  IsCharUpperW
+;;#else
+;;#define IsCharUpper  IsCharUpperA
+;;#endif // !UNICODE
+;;
+;;BOOL
+;;WINAPI
+;;IsCharLowerA(
+;;    CHAR ch);
+;;BOOL
+;;WINAPI
+;;IsCharLowerW(
+;;    WCHAR ch);
+;;#ifdef UNICODE
+;;#define IsCharLower  IsCharLowerW
+;;#else
+;;#define IsCharLower  IsCharLowerA
+;;#endif // !UNICODE
+;;
+;;#endif  /* !NOLANGUAGE */
+;;
+;;HWND
+;;WINAPI
+;;SetFocus(
+;;    HWND hWnd);
+;;
+;;HWND
+;;WINAPI
+;;GetActiveWindow(
+;;    VOID);
+;;
+;;HWND
+;;WINAPI
+;;GetFocus(
+;;    VOID);
+;;
+;;UINT
+;;WINAPI
+;;GetKBCodePage(
+;;    VOID);
+;;
+;;SHORT
+;;WINAPI
+;;GetKeyState(
+;;    int nVirtKey);
+;;
+;;SHORT
+;;WINAPI
+;;GetAsyncKeyState(
+;;    int vKey);
+;;
+;;BOOL
+;;WINAPI
+;;GetKeyboardState(
+;;    PBYTE lpKeyState);
+;;
+;;BOOL
+;;WINAPI
+;;SetKeyboardState(
+;;    LPBYTE lpKeyState);
+;;
+;;int
+;;WINAPI
+;;GetKeyNameTextA(
+;;    LONG lParam,
+;;    LPSTR lpString,
+;;    int nSize
+;;    );
+;;int
+;;WINAPI
+;;GetKeyNameTextW(
+;;    LONG lParam,
+;;    LPWSTR lpString,
+;;    int nSize
+;;    );
+;;#ifdef UNICODE
+;;#define GetKeyNameText  GetKeyNameTextW
+;;#else
+;;#define GetKeyNameText  GetKeyNameTextA
+;;#endif // !UNICODE
+;;
+;;int
+;;WINAPI
+;;GetKeyboardType(
+;;    int nTypeFlag);
+;;
+;;int
+;;WINAPI
+;;ToAscii(
+;;    UINT uVirtKey,
+;;    UINT uScanCode,
+;;    PBYTE lpKeyState,
+;;    LPWORD lpChar,
+;;    UINT uFlags);
+;;
+;;int
+;;WINAPI
+;;ToUnicode(
+;;    UINT wVirtKey,
+;;    UINT wScanCode,
+;;    PBYTE lpKeyState,
+;;    LPWSTR pwszBuff,
+;;    int cchBuff,
+;;    UINT wFlags);
+;;
+;;DWORD
+;;WINAPI
+;;OemKeyScan(
+;;    WORD wOemChar);
+;;
+;;SHORT
+;;WINAPI
+;;VkKeyScanA(
+;;    CHAR ch);
+;;SHORT
+;;WINAPI
+;;VkKeyScanW(
+;;    WCHAR ch);
+;;#ifdef UNICODE
+;;#define VkKeyScan  VkKeyScanW
+;;#else
+;;#define VkKeyScan  VkKeyScanA
+;;#endif // !UNICODE
+;;
+;;#define KEYEVENTF_EXTENDEDKEY 0x0001
+;;#define KEYEVENTF_KEYUP       0x0002
+;;
+;;VOID WINAPI
+;;keybd_event(
+;;    BYTE bVk,
+;;    BYTE bScan,
+;;    DWORD dwFlags,
+;;    DWORD dwExtraInfo);
+
+(define-integrable MOUSEEVENTF_MOVE        #x0001) ;  // mouse move
+(define-integrable MOUSEEVENTF_LEFTDOWN    #x0002) ;  // left button down
+(define-integrable MOUSEEVENTF_LEFTUP      #x0004) ;  // left button up
+(define-integrable MOUSEEVENTF_RIGHTDOWN   #x0008) ;  // right button down
+(define-integrable MOUSEEVENTF_RIGHTUP     #x0010) ;  // right button up
+(define-integrable MOUSEEVENTF_MIDDLEDOWN  #x0020) ;  // middle button down
+(define-integrable MOUSEEVENTF_MIDDLEUP    #x0040) ;  // middle button up
+(define-integrable MOUSEEVENTF_ABSOLUTE    #x8000) ;  // absolute move
+
+;;VOID WINAPI
+;;mouse_event(
+;;    DWORD dwFlags,
+;;    DWORD dx,
+;;    DWORD dy,
+;;    DWORD cButtons,
+;;    DWORD dwExtraInfo);
+;;
+;;UINT
+;;WINAPI
+;;MapVirtualKeyA(
+;;    UINT uCode,
+;;    UINT uMapType);
+;;UINT
+;;WINAPI
+;;MapVirtualKeyW(
+;;    UINT uCode,
+;;    UINT uMapType);
+;;#ifdef UNICODE
+;;#define MapVirtualKey  MapVirtualKeyW
+;;#else
+;;#define MapVirtualKey  MapVirtualKeyA
+;;#endif // !UNICODE
+;;
+;;BOOL
+;;WINAPI
+;;GetInputState(
+;;    VOID);
+;;
+;;DWORD
+;;WINAPI
+;;GetQueueStatus(
+;;    UINT flags);
+;;
+;;HWND
+;;WINAPI
+;;GetCapture(
+;;    VOID);
+;;
+;;HWND
+;;WINAPI
+;;SetCapture(
+;;    HWND hWnd);
+;;
+;;BOOL
+;;WINAPI
+;;ReleaseCapture(
+;;    VOID);
+;;
+;;DWORD
+;;WINAPI
+;;MsgWaitForMultipleObjects(
+;;    DWORD nCount,
+;;    LPHANDLE pHandles,
+;;    BOOL fWaitAll,
+;;    DWORD dwMilliseconds,
+;;    DWORD dwWakeMask);
+;;
+;;/*
+;; * Queue status flags for GetQueueStatus() and MsgWaitForMultipleObjects()
+;; */
+(define-integrable QS_KEY           #x01)
+(define-integrable QS_MOUSEMOVE     #x02)
+(define-integrable QS_MOUSEBUTTON   #x04)
+(define-integrable QS_POSTMESSAGE   #x08)
+(define-integrable QS_TIMER         #x10)
+(define-integrable QS_PAINT         #x20)
+(define-integrable QS_SENDMESSAGE   #x40)
+(define-integrable QS_HOTKEY        #x80)
+
+(define-integrable QS_MOUSE        (+ QS_MOUSEMOVE
+                                      QS_MOUSEBUTTON))
+
+(define-integrable QS_INPUT        (+ QS_MOUSE
+                                      QS_KEY))
+
+(define-integrable QS_ALLEVENTS    (+ QS_INPUT
+                                      QS_POSTMESSAGE
+                                      QS_TIMER
+                                      QS_PAINT
+                                      QS_HOTKEY))
+
+;;UINT
+;;WINAPI
+;;GetSysInputMode(
+;;    VOID);
+;;
+;;/*
+;; * GetSysInputMode return values
+;; */
+(define-integrable IMD_NONE                0)
+(define-integrable IMD_MENU                1)
+(define-integrable IMD_DIALOGBOX           2)
+(define-integrable IMD_NEXTWINDOW          3)
+(define-integrable IMD_SCROLLBAR           4)
+(define-integrable IMD_TITLEBUTTONTRACK    5)
+(define-integrable IMD_MOVESIZETRACK       6)
+(define-integrable IMD_SYSERRDLG           7)
+(define-integrable IMD_DRAGOBJECT          8)
+(define-integrable IMD_DRAGDETECT          9)
+
+
+;;/*
+;; * Windows Functions
+;; */
+;;UINT
+;;WINAPI
+;;SetTimer(
+;;    HWND hWnd ,
+;;    UINT nIDEvent,
+;;    UINT uElapse,
+;;    TIMERPROC lpTimerFunc);
+;;
+;;BOOL
+;;WINAPI
+;;KillTimer(
+;;    HWND hWnd,
+;;    UINT uIDEvent);
+;;
+;;BOOL
+;;WINAPI
+;;IsWindowUnicode(
+;;    HWND hWnd);
+;;
+;;BOOL
+;;WINAPI
+;;EnableWindow(
+;;    HWND hWnd,
+;;    BOOL bEnable);
+;;
+;;BOOL
+;;WINAPI
+;;IsWindowEnabled(
+;;    HWND hWnd);
+;;
+;;HACCEL
+;;WINAPI
+;;LoadAcceleratorsA(
+;;    HINSTANCE hInstance,
+;;    LPCSTR lpTableName);
+;;HACCEL
+;;WINAPI
+;;LoadAcceleratorsW(
+;;    HINSTANCE hInstance,
+;;    LPCWSTR lpTableName);
+;;#ifdef UNICODE
+;;#define LoadAccelerators  LoadAcceleratorsW
+;;#else
+;;#define LoadAccelerators  LoadAcceleratorsA
+;;#endif // !UNICODE
+;;
+;;HACCEL
+;;WINAPI
+;;CreateAcceleratorTableA(
+;;    LPACCEL, int);
+;;HACCEL
+;;WINAPI
+;;CreateAcceleratorTableW(
+;;    LPACCEL, int);
+;;#ifdef UNICODE
+;;#define CreateAcceleratorTable  CreateAcceleratorTableW
+;;#else
+;;#define CreateAcceleratorTable  CreateAcceleratorTableA
+;;#endif // !UNICODE
+;;
+;;BOOL
+;;WINAPI
+;;DestroyAcceleratorTable(
+;;    HACCEL hAccel);
+;;
+;;int
+;;WINAPI
+;;CopyAcceleratorTableA(
+;;    HACCEL hAccelSrc,
+;;    LPACCEL lpAccelDst,
+;;    int cAccelEntries);
+;;int
+;;WINAPI
+;;CopyAcceleratorTableW(
+;;    HACCEL hAccelSrc,
+;;    LPACCEL lpAccelDst,
+;;    int cAccelEntries);
+;;#ifdef UNICODE
+;;#define CopyAcceleratorTable  CopyAcceleratorTableW
+;;#else
+;;#define CopyAcceleratorTable  CopyAcceleratorTableA
+;;#endif // !UNICODE
+;;
+;;#ifndef NOMSG
+;;int
+;;WINAPI
+;;TranslateAccelerator(
+;;    HWND hWnd,
+;;    HACCEL hAccTable,
+;;    LPMSG lpMsg);
+;;#endif /* !NOMSG */
+;;
+;;#ifndef NOSYSMETRICS
+;;
+;;/*
+;; * GetSystemMetrics() codes
+;; */
+(define-integrable SM_CXSCREEN         0)
+(define-integrable SM_CYSCREEN         1)
+(define-integrable SM_CXVSCROLL        2)
+(define-integrable SM_CYHSCROLL        3)
+(define-integrable SM_CYCAPTION        4)
+(define-integrable SM_CXBORDER         5)
+(define-integrable SM_CYBORDER         6)
+(define-integrable SM_CXDLGFRAME       7)
+(define-integrable SM_CYDLGFRAME       8)
+(define-integrable SM_CYVTHUMB         9)
+(define-integrable SM_CXHTHUMB         10)
+(define-integrable SM_CXICON           11)
+(define-integrable SM_CYICON           12)
+(define-integrable SM_CXCURSOR         13)
+(define-integrable SM_CYCURSOR         14)
+(define-integrable SM_CYMENU           15)
+(define-integrable SM_CXFULLSCREEN     16)
+(define-integrable SM_CYFULLSCREEN     17)
+(define-integrable SM_CYKANJIWINDOW    18)
+(define-integrable SM_MOUSEPRESENT     19)
+(define-integrable SM_CYVSCROLL        20)
+(define-integrable SM_CXHSCROLL        21)
+(define-integrable SM_DEBUG            22)
+(define-integrable SM_SWAPBUTTON       23)
+(define-integrable SM_RESERVED1        24)
+(define-integrable SM_RESERVED2        25)
+(define-integrable SM_RESERVED3        26)
+(define-integrable SM_RESERVED4        27)
+(define-integrable SM_CXMIN            28)
+(define-integrable SM_CYMIN            29)
+(define-integrable SM_CXSIZE           30)
+(define-integrable SM_CYSIZE           31)
+(define-integrable SM_CXFRAME          32)
+(define-integrable SM_CYFRAME          33)
+(define-integrable SM_CXMINTRACK       34)
+(define-integrable SM_CYMINTRACK       35)
+(define-integrable SM_CXDOUBLECLK       36)
+(define-integrable SM_CYDOUBLECLK       37)
+(define-integrable SM_CXICONSPACING     38)
+(define-integrable SM_CYICONSPACING     39)
+(define-integrable SM_MENUDROPALIGNMENT 40)
+(define-integrable SM_PENWINDOWS        41)
+(define-integrable SM_DBCSENABLED       42)
+(define-integrable SM_CMOUSEBUTTONS     43)
+(define-integrable SM_CMETRICS          44)
+
+;;int
+;;WINAPI
+;;GetSystemMetrics(
+;;    int nIndex);
+;;
+;;#endif /* !NOSYSMETRICS */
+;;
+;;#ifndef NOMENUS
+;;
+;;HMENU
+;;WINAPI
+;;LoadMenuA(
+;;    HINSTANCE hInstance,
+;;    LPCSTR lpMenuName);
+;;HMENU
+;;WINAPI
+;;LoadMenuW(
+;;    HINSTANCE hInstance,
+;;    LPCWSTR lpMenuName);
+;;#ifdef UNICODE
+;;#define LoadMenu  LoadMenuW
+;;#else
+;;#define LoadMenu  LoadMenuA
+;;#endif // !UNICODE
+;;
+;;HMENU
+;;WINAPI
+;;LoadMenuIndirectA(
+;;    CONST MENUTEMPLATEA *lpMenuTemplate);
+;;HMENU
+;;WINAPI
+;;LoadMenuIndirectW(
+;;    CONST MENUTEMPLATEW *lpMenuTemplate);
+;;#ifdef UNICODE
+;;#define LoadMenuIndirect  LoadMenuIndirectW
+;;#else
+;;#define LoadMenuIndirect  LoadMenuIndirectA
+;;#endif // !UNICODE
+;;
+;;HMENU
+;;WINAPI
+;;GetMenu(
+;;    HWND hWnd);
+;;
+;;BOOL
+;;WINAPI
+;;SetMenu(
+;;    HWND hWnd,
+;;    HMENU hMenu);
+;;
+;;BOOL
+;;WINAPI
+;;ChangeMenuA(
+;;    HMENU hMenu,
+;;    UINT cmd,
+;;    LPCSTR lpszNewItem,
+;;    UINT cmdInsert,
+;;    UINT flags);
+;;BOOL
+;;WINAPI
+;;ChangeMenuW(
+;;    HMENU hMenu,
+;;    UINT cmd,
+;;    LPCWSTR lpszNewItem,
+;;    UINT cmdInsert,
+;;    UINT flags);
+;;#ifdef UNICODE
+;;#define ChangeMenu  ChangeMenuW
+;;#else
+;;#define ChangeMenu  ChangeMenuA
+;;#endif // !UNICODE
+;;
+;;BOOL
+;;WINAPI
+;;HiliteMenuItem(
+;;    HWND hWnd,
+;;    HMENU hMenu,
+;;    UINT uIDHiliteItem,
+;;    UINT uHilite);
+;;
+;;int
+;;WINAPI
+;;GetMenuStringA(
+;;    HMENU hMenu,
+;;    UINT uIDItem,
+;;    LPSTR lpString,
+;;    int nMaxCount,
+;;    UINT uFlag);
+;;int
+;;WINAPI
+;;GetMenuStringW(
+;;    HMENU hMenu,
+;;    UINT uIDItem,
+;;    LPWSTR lpString,
+;;    int nMaxCount,
+;;    UINT uFlag);
+;;#ifdef UNICODE
+;;#define GetMenuString  GetMenuStringW
+;;#else
+;;#define GetMenuString  GetMenuStringA
+;;#endif // !UNICODE
+;;
+;;UINT
+;;WINAPI
+;;GetMenuState(
+;;    HMENU hMenu,
+;;    UINT uId,
+;;    UINT uFlags);
+;;
+;;BOOL
+;;WINAPI
+;;DrawMenuBar(
+;;    HWND hWnd);
+;;
+;;HMENU
+;;WINAPI
+;;GetSystemMenu(
+;;    HWND hWnd,
+;;    BOOL bRevert);
+;;
+;;HMENU
+;;WINAPI
+;;CreateMenu(
+;;    VOID);
+;;
+;;HMENU
+;;WINAPI
+;;CreatePopupMenu(
+;;    VOID);
+;;
+;;BOOL
+;;WINAPI
+;;DestroyMenu(
+;;    HMENU hMenu);
+;;
+;;DWORD
+;;WINAPI
+;;CheckMenuItem(
+;;    HMENU hMenu,
+;;    UINT uIDCheckItem,
+;;    UINT uCheck);
+;;
+;;BOOL
+;;WINAPI
+;;EnableMenuItem(
+;;    HMENU hMenu,
+;;    UINT uIDEnableItem,
+;;    UINT uEnable);
+;;
+;;HMENU
+;;WINAPI
+;;GetSubMenu(
+;;    HMENU hMenu,
+;;    int nPos);
+;;
+;;UINT
+;;WINAPI
+;;GetMenuItemID(
+;;    HMENU hMenu,
+;;    int nPos);
+;;
+;;int
+;;WINAPI
+;;GetMenuItemCount(
+;;    HMENU hMenu);
+;;
+;;BOOL
+;;WINAPI
+;;InsertMenuA(
+;;    HMENU hMenu,
+;;    UINT uPosition,
+;;    UINT uFlags,
+;;    UINT uIDNewItem,
+;;    LPCSTR lpNewItem
+;;    );
+;;BOOL
+;;WINAPI
+;;InsertMenuW(
+;;    HMENU hMenu,
+;;    UINT uPosition,
+;;    UINT uFlags,
+;;    UINT uIDNewItem,
+;;    LPCWSTR lpNewItem
+;;    );
+;;#ifdef UNICODE
+;;#define InsertMenu  InsertMenuW
+;;#else
+;;#define InsertMenu  InsertMenuA
+;;#endif // !UNICODE
+;;
+;;BOOL
+;;WINAPI
+;;AppendMenuA(
+;;    HMENU hMenu,
+;;    UINT uFlags,
+;;    UINT uIDNewItem,
+;;    LPCSTR lpNewItem
+;;    );
+;;BOOL
+;;WINAPI
+;;AppendMenuW(
+;;    HMENU hMenu,
+;;    UINT uFlags,
+;;    UINT uIDNewItem,
+;;    LPCWSTR lpNewItem
+;;    );
+;;#ifdef UNICODE
+;;#define AppendMenu  AppendMenuW
+;;#else
+;;#define AppendMenu  AppendMenuA
+;;#endif // !UNICODE
+;;
+;;BOOL
+;;WINAPI
+;;ModifyMenuA(
+;;    HMENU hMnu,
+;;    UINT uPosition,
+;;    UINT uFlags,
+;;    UINT uIDNewItem,
+;;    LPCSTR lpNewItem
+;;    );
+;;BOOL
+;;WINAPI
+;;ModifyMenuW(
+;;    HMENU hMnu,
+;;    UINT uPosition,
+;;    UINT uFlags,
+;;    UINT uIDNewItem,
+;;    LPCWSTR lpNewItem
+;;    );
+;;#ifdef UNICODE
+;;#define ModifyMenu  ModifyMenuW
+;;#else
+;;#define ModifyMenu  ModifyMenuA
+;;#endif // !UNICODE
+;;
+;;BOOL
+;;WINAPI RemoveMenu(
+;;    HMENU hMenu,
+;;    UINT uPosition,
+;;    UINT uFlags);
+;;
+;;BOOL
+;;WINAPI
+;;DeleteMenu(
+;;    HMENU hMenu,
+;;    UINT uPosition,
+;;    UINT uFlags);
+;;
+;;BOOL
+;;WINAPI
+;;SetMenuItemBitmaps(
+;;    HMENU hMenu,
+;;    UINT uPosition,
+;;    UINT uFlags,
+;;    HBITMAP hBitmapUnchecked,
+;;    HBITMAP hBitmapChecked);
+;;
+;;LONG
+;;WINAPI
+;;GetMenuCheckMarkDimensions(
+;;    VOID);
+;;
+;;BOOL
+;;WINAPI
+;;TrackPopupMenu(
+;;    HMENU hMenu,
+;;    UINT uFlags,
+;;    int x,
+;;    int y,
+;;    int nReserved,
+;;    HWND hWnd,
+;;    CONST RECT *prcRect);
+;;
+;;/*
+;; * Flags for TrackPopupMenu
+;; */
+(define-integrable TPM_LEFTBUTTON  #x0000)
+(define-integrable TPM_RIGHTBUTTON #x0002)
+(define-integrable TPM_LEFTALIGN   #x0000)
+(define-integrable TPM_CENTERALIGN #x0004)
+(define-integrable TPM_RIGHTALIGN  #x0008)
+
+;;#endif /* !NOMENUS */
+;;
+;;BOOL
+;;WINAPI
+;;DrawIcon(
+;;    HDC hDC,
+;;    int X,
+;;    int Y,
+;;    HICON hIcon);
+;;
+;;#ifndef NODRAWTEXT
+;;
+;;/*
+;; * DrawText() Format Flags
+;; */
+(define-integrable DT_TOP              #x0000)
+(define-integrable DT_LEFT             #x0000)
+(define-integrable DT_CENTER           #x0001)
+(define-integrable DT_RIGHT            #x0002)
+(define-integrable DT_VCENTER          #x0004)
+(define-integrable DT_BOTTOM           #x0008)
+(define-integrable DT_WORDBREAK        #x0010)
+(define-integrable DT_SINGLELINE       #x0020)
+(define-integrable DT_EXPANDTABS       #x0040)
+(define-integrable DT_TABSTOP          #x0080)
+(define-integrable DT_NOCLIP           #x0100)
+(define-integrable DT_EXTERNALLEADING  #x0200)
+(define-integrable DT_CALCRECT         #x0400)
+(define-integrable DT_NOPREFIX         #x0800)
+(define-integrable DT_INTERNAL         #x1000)
+
+;;#endif /* !NODRAWTEXT */
+;;
+;;int
+;;WINAPI DrawTextA(
+;;    HDC hDC,
+;;    LPCSTR lpString,
+;;    int nCount,
+;;    LPRECT lpRect,
+;;    UINT uFormat);
+;;int
+;;WINAPI DrawTextW(
+;;    HDC hDC,
+;;    LPCWSTR lpString,
+;;    int nCount,
+;;    LPRECT lpRect,
+;;    UINT uFormat);
+;;#ifdef UNICODE
+;;#define DrawText  DrawTextW
+;;#else
+;;#define DrawText  DrawTextA
+;;#endif // !UNICODE
+;;
+;;BOOL
+;;WINAPI
+;;GrayStringA(
+;;    HDC hDC,
+;;    HBRUSH hBrush,
+;;    GRAYSTRINGPROC lpOutputFunc,
+;;    LPARAM lpData,
+;;    int nCount,
+;;    int X,
+;;    int Y,
+;;    int nWidth,
+;;    int nHeight);
+;;BOOL
+;;WINAPI
+;;GrayStringW(
+;;    HDC hDC,
+;;    HBRUSH hBrush,
+;;    GRAYSTRINGPROC lpOutputFunc,
+;;    LPARAM lpData,
+;;    int nCount,
+;;    int X,
+;;    int Y,
+;;    int nWidth,
+;;    int nHeight);
+;;#ifdef UNICODE
+;;#define GrayString  GrayStringW
+;;#else
+;;#define GrayString  GrayStringA
+;;#endif // !UNICODE
+;;
+;;LONG
+;;WINAPI
+;;TabbedTextOutA(
+;;    HDC hDC,
+;;    int X,
+;;    int Y,
+;;    LPCSTR lpString,
+;;    int nCount,
+;;    int nTabPositions,
+;;    LPINT lpnTabStopPositions,
+;;    int nTabOrigin);
+;;LONG
+;;WINAPI
+;;TabbedTextOutW(
+;;    HDC hDC,
+;;    int X,
+;;    int Y,
+;;    LPCWSTR lpString,
+;;    int nCount,
+;;    int nTabPositions,
+;;    LPINT lpnTabStopPositions,
+;;    int nTabOrigin);
+;;#ifdef UNICODE
+;;#define TabbedTextOut  TabbedTextOutW
+;;#else
+;;#define TabbedTextOut  TabbedTextOutA
+;;#endif // !UNICODE
+;;
+;;DWORD
+;;WINAPI
+;;GetTabbedTextExtentA(
+;;    HDC hDC,
+;;    LPCSTR lpString,
+;;    int nCount,
+;;    int nTabPositions,
+;;    LPINT lpnTabStopPositions);
+;;DWORD
+;;WINAPI
+;;GetTabbedTextExtentW(
+;;    HDC hDC,
+;;    LPCWSTR lpString,
+;;    int nCount,
+;;    int nTabPositions,
+;;    LPINT lpnTabStopPositions);
+;;#ifdef UNICODE
+;;#define GetTabbedTextExtent  GetTabbedTextExtentW
+;;#else
+;;#define GetTabbedTextExtent  GetTabbedTextExtentA
+;;#endif // !UNICODE
+;;
+;;BOOL
+;;WINAPI
+;;UpdateWindow(
+;;    HWND hWnd);
+;;
+;;HWND
+;;WINAPI
+;;SetActiveWindow(
+;;    HWND hWnd);
+;;
+;;HWND
+;;WINAPI
+;;GetForegroundWindow(
+;;    VOID);
+;;
+;;BOOL
+;;WINAPI
+;;SetForegroundWindow(
+;;    HWND hWnd);
+;;
+;;HWND
+;;WINAPI
+;;WindowFromDC(
+;;    HDC hDC);
+;;
+;;HDC
+;;WINAPI
+;;GetDC(
+;;    HWND hWnd);
+;;
+;;HDC
+;;WINAPI
+;;GetDCEx(
+;;    HWND hWnd ,
+;;    HRGN hrgnClip,
+;;    DWORD flags);
+;;
+;;/*
+;; * GetDCEx() flags
+;; */
+(define-integrable DCX_WINDOW           #x00000001)
+(define-integrable DCX_CACHE            #x00000002)
+(define-integrable DCX_NORESETATTRS     #x00000004)
+(define-integrable DCX_CLIPCHILDREN     #x00000008)
+(define-integrable DCX_CLIPSIBLINGS     #x00000010)
+(define-integrable DCX_PARENTCLIP       #x00000020)
+
+(define-integrable DCX_EXCLUDERGN       #x00000040)
+(define-integrable DCX_INTERSECTRGN     #x00000080)
+
+(define-integrable DCX_EXCLUDEUPDATE    #x00000100)
+(define-integrable DCX_INTERSECTUPDATE  #x00000200)
+
+(define-integrable DCX_LOCKWINDOWUPDATE #x00000400)
+
+(define-integrable DCX_NORECOMPUTE      #x00100000)
+(define-integrable DCX_VALIDATE         #x00200000)
+
+
+;;HDC
+;;WINAPI
+;;GetWindowDC(
+;;    HWND hWnd);
+;;
+;;int
+;;WINAPI
+;;ReleaseDC(
+;;    HWND hWnd,
+;;    HDC hDC);
+;;
+;;HDC
+;;WINAPI
+;;BeginPaint(
+;;    HWND hWnd,
+;;    LPPAINTSTRUCT lpPaint);
+;;
+;;BOOL
+;;WINAPI
+;;EndPaint(
+;;    HWND hWnd,
+;;    CONST PAINTSTRUCT *lpPaint);
+;;
+;;BOOL
+;;WINAPI
+;;GetUpdateRect(
+;;    HWND hWnd,
+;;    LPRECT lpRect,
+;;    BOOL bErase);
+;;
+;;int
+;;WINAPI
+;;GetUpdateRgn(
+;;    HWND hWnd,
+;;    HRGN hRgn,
+;;    BOOL bErase);
+;;
+;;int
+;;WINAPI
+;;ExcludeUpdateRgn(
+;;    HDC hDC,
+;;    HWND hWnd);
+;;
+;;BOOL
+;;WINAPI
+;;InvalidateRect(
+;;    HWND hWnd ,
+;;    CONST RECT *lpRect,
+;;    BOOL bErase);
+;;
+;;BOOL
+;;WINAPI
+;;ValidateRect(
+;;    HWND hWnd ,
+;;    CONST RECT *lpRect);
+;;
+;;BOOL
+;;WINAPI
+;;InvalidateRgn(
+;;    HWND hWnd,
+;;    HRGN hRgn,
+;;    BOOL bErase);
+;;
+;;BOOL
+;;WINAPI
+;;ValidateRgn(
+;;    HWND hWnd,
+;;    HRGN hRgn);
+;;
+;;
+;;BOOL WINAPI RedrawWindow(
+;;    HWND hWnd,
+;;    CONST RECT *lprcUpdate,
+;;    HRGN hrgnUpdate,
+;;    UINT flags);
+;;
+;;/*
+;; * RedrawWindow() flags
+;; */
+(define-integrable RDW_INVALIDATE          #x0001)
+(define-integrable RDW_INTERNALPAINT       #x0002)
+(define-integrable RDW_ERASE               #x0004)
+
+(define-integrable RDW_VALIDATE            #x0008)
+(define-integrable RDW_NOINTERNALPAINT     #x0010)
+(define-integrable RDW_NOERASE             #x0020)
+
+(define-integrable RDW_NOCHILDREN          #x0040)
+(define-integrable RDW_ALLCHILDREN         #x0080)
+
+(define-integrable RDW_UPDATENOW           #x0100)
+(define-integrable RDW_ERASENOW            #x0200)
+
+(define-integrable RDW_FRAME               #x0400)
+(define-integrable RDW_NOFRAME             #x0800)
+
+
+;;/*
+;; * LockWindowUpdate API
+;; */
+;;BOOL
+;;WINAPI
+;;LockWindowUpdate(
+;;    HWND hWndLock);
+;;
+;;BOOL
+;;WINAPI
+;;ScrollWindow(
+;;    HWND hWnd,
+;;    int XAmount,
+;;    int YAmount,
+;;    CONST RECT *lpRect,
+;;    CONST RECT *lpClipRect);
+;;
+;;BOOL
+;;WINAPI
+;;ScrollDC(
+;;    HDC hDC,
+;;    int dx,
+;;    int dy,
+;;    CONST RECT *lprcScroll,
+;;    CONST RECT *lprcClip ,
+;;    HRGN hrgnUpdate,
+;;    LPRECT lprcUpdate);
+;;
+;;int
+;;WINAPI
+;;ScrollWindowEx(
+;;    HWND hWnd,
+;;    int dx,
+;;    int dy,
+;;    CONST RECT *prcScroll,
+;;    CONST RECT *prcClip ,
+;;    HRGN hrgnUpdate,
+;;    LPRECT prcUpdate,
+;;    UINT flags);
+
+(define-integrable SW_SCROLLCHILDREN   #x0001) ;  /* Scroll children within *lprcScroll. */
+(define-integrable SW_INVALIDATE       #x0002) ;  /* Invalidate after scrolling */
+(define-integrable SW_ERASE            #x0004) ;  /* If SW_INVALIDATE, don't send WM_ERASEBACKGROUND */
+
+
+;;#ifndef NOSCROLL
+;;int
+;;WINAPI
+;;SetScrollPos(
+;;    HWND hWnd,
+;;    int nBar,
+;;    int nPos,
+;;    BOOL bRedraw);
+;;
+;;int
+;;WINAPI
+;;GetScrollPos(
+;;    HWND hWnd,
+;;    int nBar);
+;;
+;;BOOL
+;;WINAPI
+;;SetScrollRange(
+;;    HWND hWnd,
+;;    int nBar,
+;;    int nMinPos,
+;;    int nMaxPos,
+;;    BOOL bRedraw);
+;;
+;;BOOL
+;;WINAPI
+;;GetScrollRange(
+;;    HWND hWnd,
+;;    int nBar,
+;;    LPINT lpMinPos,
+;;    LPINT lpMaxPos);
+;;
+;;BOOL
+;;WINAPI
+;;ShowScrollBar(
+;;    HWND hWnd,
+;;    int wBar,
+;;    BOOL bShow);
+;;
+;;BOOL
+;;WINAPI
+;;EnableScrollBar(
+;;    HWND hWnd,
+;;    UINT wSBflags,
+;;    UINT wArrows);
+;;
+;;
+;;/*
+;; * EnableScrollBar() flags
+;; */
+(define-integrable ESB_ENABLE_BOTH     #x0000)
+(define-integrable ESB_DISABLE_BOTH    #x0003)
+
+(define-integrable ESB_DISABLE_LEFT    #x0001)
+(define-integrable ESB_DISABLE_RIGHT   #x0002)
+
+(define-integrable ESB_DISABLE_UP      #x0001)
+(define-integrable ESB_DISABLE_DOWN    #x0002)
+
+(define-integrable ESB_DISABLE_LTUP    ESB_DISABLE_LEFT)
+(define-integrable ESB_DISABLE_RTDN    ESB_DISABLE_RIGHT)
+
+
+;;#endif  /* !NOSCROLL */
+;;
+;;BOOL
+;;WINAPI
+;;SetPropA(
+;;    HWND hWnd,
+;;    LPCSTR lpString,
+;;    HANDLE hData);
+;;BOOL
+;;WINAPI
+;;SetPropW(
+;;    HWND hWnd,
+;;    LPCWSTR lpString,
+;;    HANDLE hData);
+;;#ifdef UNICODE
+;;#define SetProp  SetPropW
+;;#else
+;;#define SetProp  SetPropA
+;;#endif // !UNICODE
+;;
+;;HANDLE
+;;WINAPI
+;;GetPropA(
+;;    HWND hWnd,
+;;    LPCSTR lpString);
+;;HANDLE
+;;WINAPI
+;;GetPropW(
+;;    HWND hWnd,
+;;    LPCWSTR lpString);
+;;#ifdef UNICODE
+;;#define GetProp  GetPropW
+;;#else
+;;#define GetProp  GetPropA
+;;#endif // !UNICODE
+;;
+;;HANDLE
+;;WINAPI
+;;RemovePropA(
+;;    HWND hWnd,
+;;    LPCSTR lpString);
+;;HANDLE
+;;WINAPI
+;;RemovePropW(
+;;    HWND hWnd,
+;;    LPCWSTR lpString);
+;;#ifdef UNICODE
+;;#define RemoveProp  RemovePropW
+;;#else
+;;#define RemoveProp  RemovePropA
+;;#endif // !UNICODE
+;;
+;;int
+;;WINAPI
+;;EnumPropsExA(
+;;    HWND hWnd,
+;;    PROPENUMPROC lpEnumFunc,
+;;    LPARAM lParam);
+;;int
+;;WINAPI
+;;EnumPropsExW(
+;;    HWND hWnd,
+;;    PROPENUMPROC lpEnumFunc,
+;;    LPARAM lParam);
+;;#ifdef UNICODE
+;;#define EnumPropsEx  EnumPropsExW
+;;#else
+;;#define EnumPropsEx  EnumPropsExA
+;;#endif // !UNICODE
+;;
+;;int
+;;WINAPI
+;;EnumPropsA(
+;;    HWND hWnd,
+;;    PROPENUMPROC lpEnumFunc);
+;;int
+;;WINAPI
+;;EnumPropsW(
+;;    HWND hWnd,
+;;    PROPENUMPROC lpEnumFunc);
+;;#ifdef UNICODE
+;;#define EnumProps  EnumPropsW
+;;#else
+;;#define EnumProps  EnumPropsA
+;;#endif // !UNICODE
+;;
+;;BOOL
+;;WINAPI
+;;SetWindowTextA(
+;;    HWND hWnd,
+;;    LPCSTR lpString);
+;;BOOL
+;;WINAPI
+;;SetWindowTextW(
+;;    HWND hWnd,
+;;    LPCWSTR lpString);
+;;#ifdef UNICODE
+;;#define SetWindowText  SetWindowTextW
+;;#else
+;;#define SetWindowText  SetWindowTextA
+;;#endif // !UNICODE
+;;
+;;int
+;;WINAPI
+;;GetWindowTextA(
+;;    HWND hWnd,
+;;    LPSTR lpString,
+;;    int nMaxCount);
+;;int
+;;WINAPI
+;;GetWindowTextW(
+;;    HWND hWnd,
+;;    LPWSTR lpString,
+;;    int nMaxCount);
+;;#ifdef UNICODE
+;;#define GetWindowText  GetWindowTextW
+;;#else
+;;#define GetWindowText  GetWindowTextA
+;;#endif // !UNICODE
+;;
+;;int
+;;WINAPI
+;;GetWindowTextLengthA(
+;;    HWND hWnd);
+;;int
+;;WINAPI
+;;GetWindowTextLengthW(
+;;    HWND hWnd);
+;;#ifdef UNICODE
+;;#define GetWindowTextLength  GetWindowTextLengthW
+;;#else
+;;#define GetWindowTextLength  GetWindowTextLengthA
+;;#endif // !UNICODE
+;;
+;;BOOL
+;;WINAPI
+;;GetClientRect(
+;;    HWND hWnd,
+;;    LPRECT lpRect);
+;;
+;;BOOL
+;;WINAPI
+;;GetWindowRect(
+;;    HWND hWnd,
+;;    LPRECT lpRect);
+;;
+;;BOOL
+;;WINAPI
+;;AdjustWindowRect(
+;;    LPRECT lpRect,
+;;    DWORD dwStyle,
+;;    BOOL bMenu);
+;;
+;;BOOL
+;;WINAPI
+;;AdjustWindowRectEx(
+;;    LPRECT lpRect,
+;;    DWORD dwStyle,
+;;    BOOL bMenu,
+;;    DWORD dwExStyle);
+;;
+;;#ifndef NOMB
+;;
+;;/*
+;; * MessageBox() Flags
+;; */
+(define-integrable MB_OK                       #x00000000)
+(define-integrable MB_OKCANCEL                 #x00000001)
+(define-integrable MB_ABORTRETRYIGNORE         #x00000002)
+(define-integrable MB_YESNOCANCEL              #x00000003)
+(define-integrable MB_YESNO                    #x00000004)
+(define-integrable MB_RETRYCANCEL              #x00000005)
+
+(define-integrable MB_ICONHAND                 #x00000010)
+(define-integrable MB_ICONQUESTION             #x00000020)
+(define-integrable MB_ICONEXCLAMATION          #x00000030)
+(define-integrable MB_ICONASTERISK             #x00000040)
+
+(define-integrable MB_ICONINFORMATION          MB_ICONASTERISK)
+(define-integrable MB_ICONSTOP                 MB_ICONHAND)
+
+(define-integrable MB_DEFBUTTON1               #x00000000)
+(define-integrable MB_DEFBUTTON2               #x00000100)
+(define-integrable MB_DEFBUTTON3               #x00000200)
+
+(define-integrable MB_APPLMODAL                #x00000000)
+(define-integrable MB_SYSTEMMODAL              #x00001000)
+(define-integrable MB_TASKMODAL                #x00002000)
+
+(define-integrable MB_NOFOCUS                  #x00008000)
+(define-integrable MB_SETFOREGROUND            #x00010000)
+(define-integrable MB_DEFAULT_DESKTOP_ONLY     #x00020000)
+
+(define-integrable MB_TYPEMASK                 #x0000000F)
+(define-integrable MB_ICONMASK                 #x000000F0)
+(define-integrable MB_DEFMASK                  #x00000F00)
+(define-integrable MB_MODEMASK                 #x00003000)
+(define-integrable MB_MISCMASK                 #x0000C000)
+
+;;int
+;;WINAPI
+;;MessageBoxA(
+;;    HWND hWnd ,
+;;    LPCSTR lpText,
+;;    LPCSTR lpCaption ,
+;;    UINT uType);
+;;int
+;;WINAPI
+;;MessageBoxW(
+;;    HWND hWnd ,
+;;    LPCWSTR lpText,
+;;    LPCWSTR lpCaption ,
+;;    UINT uType);
+;;#ifdef UNICODE
+;;#define MessageBox  MessageBoxW
+;;#else
+;;#define MessageBox  MessageBoxA
+;;#endif // !UNICODE
+;;
+;;int
+;;WINAPI
+;;MessageBoxExA(
+;;    HWND hWnd ,
+;;    LPCSTR lpText,
+;;    LPCSTR lpCaption ,
+;;    UINT uType,
+;;    WORD wLanguageId);
+;;int
+;;WINAPI
+;;MessageBoxExW(
+;;    HWND hWnd ,
+;;    LPCWSTR lpText,
+;;    LPCWSTR lpCaption ,
+;;    UINT uType,
+;;    WORD wLanguageId);
+;;#ifdef UNICODE
+;;#define MessageBoxEx  MessageBoxExW
+;;#else
+;;#define MessageBoxEx  MessageBoxExA
+;;#endif // !UNICODE
+;;
+;;BOOL
+;;WINAPI
+;;MessageBeep(
+;;    UINT uType);
+;;
+;;#endif /* !NOMB */
+;;
+;;int
+;;WINAPI
+;;ShowCursor(
+;;    BOOL bShow);
+;;
+;;BOOL
+;;WINAPI
+;;SetCursorPos(
+;;    int X,
+;;    int Y);
+;;
+;;HCURSOR
+;;WINAPI
+;;SetCursor(
+;;    HCURSOR hCursor);
+;;
+;;BOOL
+;;WINAPI
+;;GetCursorPos(
+;;    LPPOINT lpPoint);
+;;
+;;BOOL
+;;WINAPI
+;;ClipCursor(
+;;    CONST RECT *lpRect);
+;;
+;;BOOL
+;;WINAPI
+;;GetClipCursor(
+;;    LPRECT lpRect);
+;;
+;;HCURSOR
+;;WINAPI
+;;GetCursor(
+;;    VOID);
+;;
+;;BOOL
+;;WINAPI
+;;CreateCaret(
+;;    HWND hWnd,
+;;    HBITMAP hBitmap ,
+;;    int nWidth,
+;;    int nHeight);
+;;
+;;UINT
+;;WINAPI
+;;GetCaretBlinkTime(
+;;    VOID);
+;;
+;;BOOL
+;;WINAPI
+;;SetCaretBlinkTime(
+;;    UINT uMSeconds);
+;;
+;;BOOL
+;;WINAPI
+;;DestroyCaret(
+;;    VOID);
+;;
+;;BOOL
+;;WINAPI
+;;HideCaret(
+;;    HWND hWnd);
+;;
+;;BOOL
+;;WINAPI
+;;ShowCaret(
+;;    HWND hWnd);
+;;
+;;BOOL
+;;WINAPI
+;;SetCaretPos(
+;;    int X,
+;;    int Y);
+;;
+;;BOOL
+;;WINAPI
+;;GetCaretPos(
+;;    LPPOINT lpPoint);
+;;
+;;BOOL
+;;WINAPI
+;;ClientToScreen(
+;;    HWND hWnd,
+;;    LPPOINT lpPoint);
+;;
+;;BOOL
+;;WINAPI
+;;ScreenToClient(
+;;    HWND hWnd,
+;;    LPPOINT lpPoint);
+;;
+;;int
+;;WINAPI
+;;MapWindowPoints(
+;;    HWND hWndFrom,
+;;    HWND hWndTo,
+;;    LPPOINT lpPoints,
+;;    UINT cPoints);
+;;
+;;HWND
+;;WINAPI
+;;WindowFromPoint(
+;;    POINT Point);
+;;
+;;HWND
+;;WINAPI
+;;ChildWindowFromPoint(
+;;    HWND hWndParent,
+;;    POINT Point);
+;;
+;;#ifndef NOCOLOR
+;;
+;;/*
+;; * Color Types
+;; */
+(define-integrable CTLCOLOR_MSGBOX         0)
+(define-integrable CTLCOLOR_EDIT           1)
+(define-integrable CTLCOLOR_LISTBOX        2)
+(define-integrable CTLCOLOR_BTN            3)
+(define-integrable CTLCOLOR_DLG            4)
+(define-integrable CTLCOLOR_SCROLLBAR      5)
+(define-integrable CTLCOLOR_STATIC         6)
+(define-integrable CTLCOLOR_MAX            8)  ;     /* three bits max */
+
+(define-integrable COLOR_SCROLLBAR         0)
+(define-integrable COLOR_BACKGROUND        1)
+(define-integrable COLOR_ACTIVECAPTION     2)
+(define-integrable COLOR_INACTIVECAPTION   3)
+(define-integrable COLOR_MENU              4)
+(define-integrable COLOR_WINDOW            5)
+(define-integrable COLOR_WINDOWFRAME       6)
+(define-integrable COLOR_MENUTEXT          7)
+(define-integrable COLOR_WINDOWTEXT        8)
+(define-integrable COLOR_CAPTIONTEXT       9)
+(define-integrable COLOR_ACTIVEBORDER      10)
+(define-integrable COLOR_INACTIVEBORDER    11)
+(define-integrable COLOR_APPWORKSPACE      12)
+(define-integrable COLOR_HIGHLIGHT         13)
+(define-integrable COLOR_HIGHLIGHTTEXT     14)
+(define-integrable COLOR_BTNFACE           15)
+(define-integrable COLOR_BTNSHADOW         16)
+(define-integrable COLOR_GRAYTEXT          17)
+(define-integrable COLOR_BTNTEXT           18)
+(define-integrable COLOR_INACTIVECAPTIONTEXT 19)
+(define-integrable COLOR_BTNHIGHLIGHT      20)
+
+;;DWORD
+;;WINAPI
+;;GetSysColor(
+;;    int nIndex);
+;;
+;;BOOL
+;;WINAPI
+;;SetSysColors(
+;;    int cElements,
+;;    CONST INT * lpaElements,
+;;    CONST COLORREF * lpaRgbValues);
+;;
+;;#endif /* !NOCOLOR */
+;;
+;;BOOL
+;;WINAPI
+;;DrawFocusRect(
+;;    HDC hDC,
+;;    CONST RECT * lprc);
+;;
+;;int
+;;WINAPI
+;;FillRect(
+;;    HDC hDC,
+;;    CONST RECT *lprc,
+;;    HBRUSH hbr);
+;;
+;;int
+;;WINAPI
+;;FrameRect(
+;;    HDC hDC,
+;;    CONST RECT *lprc,
+;;    HBRUSH hbr);
+;;
+;;BOOL
+;;WINAPI
+;;InvertRect(
+;;    HDC hDC,
+;;    CONST RECT *lprc);
+;;
+;;BOOL
+;;WINAPI
+;;SetRect(
+;;    LPRECT lprc,
+;;    int xLeft,
+;;    int yTop,
+;;    int xRight,
+;;    int yBottom);
+;;
+;;BOOL
+;;WINAPI
+;;    SetRectEmpty(
+;;    LPRECT lprc);
+;;
+;;BOOL
+;;WINAPI
+;;CopyRect(
+;;    LPRECT lprcDst,
+;;    CONST RECT *lprcSrc);
+;;
+;;BOOL
+;;WINAPI
+;;InflateRect(
+;;    LPRECT lprc,
+;;    int dx,
+;;    int dy);
+;;
+;;BOOL
+;;WINAPI
+;;IntersectRect(
+;;    LPRECT lprcDst,
+;;    CONST RECT *lprcSrc1,
+;;    CONST RECT *lprcSrc2);
+;;
+;;BOOL
+;;WINAPI
+;;UnionRect(
+;;    LPRECT lprcDst,
+;;    CONST RECT *lprcSrc1,
+;;    CONST RECT *lprcSrc2);
+;;
+;;BOOL
+;;WINAPI
+;;SubtractRect(
+;;    LPRECT lprcDst,
+;;    CONST RECT *lprcSrc1,
+;;    CONST RECT *lprcSrc2);
+;;
+;;BOOL
+;;WINAPI
+;;OffsetRect(
+;;    LPRECT lprc,
+;;    int dx,
+;;    int dy);
+;;
+;;BOOL
+;;WINAPI
+;;IsRectEmpty(
+;;    CONST RECT *lprc);
+;;
+;;BOOL
+;;WINAPI
+;;EqualRect(
+;;    CONST RECT *lprc1,
+;;    CONST RECT *lprc2);
+;;
+;;BOOL
+;;WINAPI
+;;PtInRect(
+;;    CONST RECT *lprc,
+;;    POINT pt);
+;;
+;;#ifndef NOWINOFFSETS
+;;
+;;WORD
+;;WINAPI
+;;GetWindowWord(
+;;    HWND hWnd,
+;;    int nIndex);
+;;
+;;WORD
+;;WINAPI
+;;SetWindowWord(
+;;    HWND hWnd,
+;;    int nIndex,
+;;    WORD wNewWord);
+;;
+;;LONG
+;;WINAPI
+;;GetWindowLongA(
+;;    HWND hWnd,
+;;    int nIndex);
+;;LONG
+;;WINAPI
+;;GetWindowLongW(
+;;    HWND hWnd,
+;;    int nIndex);
+;;#ifdef UNICODE
+;;#define GetWindowLong  GetWindowLongW
+;;#else
+;;#define GetWindowLong  GetWindowLongA
+;;#endif // !UNICODE
+;;
+;;LONG
+;;WINAPI
+;;SetWindowLongA(
+;;    HWND hWnd,
+;;    int nIndex,
+;;    LONG dwNewLong);
+;;LONG
+;;WINAPI
+;;SetWindowLongW(
+;;    HWND hWnd,
+;;    int nIndex,
+;;    LONG dwNewLong);
+;;#ifdef UNICODE
+;;#define SetWindowLong  SetWindowLongW
+;;#else
+;;#define SetWindowLong  SetWindowLongA
+;;#endif // !UNICODE
+;;
+;;WORD
+;;WINAPI
+;;GetClassWord(
+;;    HWND hWnd,
+;;    int nIndex);
+;;
+;;WORD
+;;WINAPI
+;;SetClassWord(
+;;    HWND hWnd,
+;;    int nIndex,
+;;    WORD wNewWord);
+;;
+;;DWORD
+;;WINAPI
+;;GetClassLongA(
+;;    HWND hWnd,
+;;    int nIndex);
+;;DWORD
+;;WINAPI
+;;GetClassLongW(
+;;    HWND hWnd,
+;;    int nIndex);
+;;#ifdef UNICODE
+;;#define GetClassLong  GetClassLongW
+;;#else
+;;#define GetClassLong  GetClassLongA
+;;#endif // !UNICODE
+;;
+;;DWORD
+;;WINAPI
+;;SetClassLongA(
+;;    HWND hWnd,
+;;    int nIndex,
+;;    LONG dwNewLong);
+;;DWORD
+;;WINAPI
+;;SetClassLongW(
+;;    HWND hWnd,
+;;    int nIndex,
+;;    LONG dwNewLong);
+;;#ifdef UNICODE
+;;#define SetClassLong  SetClassLongW
+;;#else
+;;#define SetClassLong  SetClassLongA
+;;#endif // !UNICODE
+;;
+;;#endif /* !NOWINOFFSETS */
+;;
+;;HWND
+;;WINAPI
+;;GetDesktopWindow(
+;;    VOID);
+;;
+;;BOOL
+;;WINAPI
+;;SetDeskWallpaper(
+;;    LPCSTR lpString);
+;;
+;;HWND
+;;WINAPI
+;;GetParent(
+;;    HWND hWnd);
+;;
+;;HWND
+;;WINAPI
+;;SetParent(
+;;    HWND hWndChild,
+;;    HWND hWndNewParent);
+;;
+;;BOOL
+;;WINAPI
+;;EnumChildWindows(
+;;    HWND hWndParent,
+;;    WNDENUMPROC lpEnumFunc,
+;;    LPARAM lParam);
+;;
+;;HWND
+;;WINAPI
+;;FindWindowA(
+;;    LPCSTR lpClassName ,
+;;    LPCSTR lpWindowName);
+;;HWND
+;;WINAPI
+;;FindWindowW(
+;;    LPCWSTR lpClassName ,
+;;    LPCWSTR lpWindowName);
+;;#ifdef UNICODE
+;;#define FindWindow  FindWindowW
+;;#else
+;;#define FindWindow  FindWindowA
+;;#endif // !UNICODE
+;;
+;;BOOL
+;;WINAPI
+;;EnumWindows(
+;;    WNDENUMPROC lpEnumFunc,
+;;    LPARAM lParam);
+;;
+;;BOOL
+;;WINAPI
+;;EnumThreadWindows(
+;;    DWORD dwThreadId,
+;;    WNDENUMPROC lpfn,
+;;    LPARAM lParam);
+;;
+;;#define EnumTaskWindows(hTask, lpfn, lParam) EnumThreadWindows((DWORD)hTask, lpfn, lParam)
+;;
+;;int
+;;WINAPI
+;;GetClassNameA(
+;;    HWND hWnd,
+;;    LPSTR lpClassName,
+;;    int nMaxCount);
+;;int
+;;WINAPI
+;;GetClassNameW(
+;;    HWND hWnd,
+;;    LPWSTR lpClassName,
+;;    int nMaxCount);
+;;#ifdef UNICODE
+;;#define GetClassName  GetClassNameW
+;;#else
+;;#define GetClassName  GetClassNameA
+;;#endif // !UNICODE
+;;
+;;HWND
+;;WINAPI
+;;GetTopWindow(
+;;    HWND hWnd);
+;;
+;;#define GetNextWindow(hWnd, wCmd) GetWindow(hWnd, wCmd)
+;;#define GetSysModalWindow() (NULL)
+;;#define SetSysModalWindow(hWnd) (NULL)
+;;
+;;DWORD
+;;WINAPI
+;;GetWindowThreadProcessId(
+;;    HWND hWnd,
+;;    LPDWORD lpdwProcessId);
+;;
+;;#define GetWindowTask(hWnd) \
+;;        ((HANDLE)GetWindowThreadProcessId(hWnd, NULL))
+;;
+;;HWND
+;;WINAPI
+;;GetLastActivePopup(
+;;    HWND hWnd);
+;;
+;;/*
+;; * GetWindow() Constants
+;; */
+(define-integrable GW_HWNDFIRST        0)
+(define-integrable GW_HWNDLAST         1)
+(define-integrable GW_HWNDNEXT         2)
+(define-integrable GW_HWNDPREV         3)
+(define-integrable GW_OWNER            4)
+(define-integrable GW_CHILD            5)
+(define-integrable GW_MAX              5)
+
+;;HWND
+;;WINAPI
+;;GetWindow(
+;;    HWND hWnd,
+;;    UINT uCmd);
+;;
+;;#ifndef NOWH
+;;
+;;#ifdef STRICT
+;;
+;;HHOOK
+;;WINAPI
+;;SetWindowsHookA(
+;;    int nFilterType,
+;;    HOOKPROC pfnFilterProc);
+;;HHOOK
+;;WINAPI
+;;SetWindowsHookW(
+;;    int nFilterType,
+;;    HOOKPROC pfnFilterProc);
+;;#ifdef UNICODE
+;;#define SetWindowsHook  SetWindowsHookW
+;;#else
+;;#define SetWindowsHook  SetWindowsHookA
+;;#endif // !UNICODE
+;;
+;;#else /* !STRICT */
+;;
+;;HOOKPROC
+;;WINAPI
+;;SetWindowsHookA(
+;;    int nFilterType,
+;;    HOOKPROC pfnFilterProc);
+;;HOOKPROC
+;;WINAPI
+;;SetWindowsHookW(
+;;    int nFilterType,
+;;    HOOKPROC pfnFilterProc);
+;;#ifdef UNICODE
+;;#define SetWindowsHook  SetWindowsHookW
+;;#else
+;;#define SetWindowsHook  SetWindowsHookA
+;;#endif // !UNICODE
+;;
+;;#endif /* !STRICT */
+;;
+;;BOOL
+;;WINAPI
+;;UnhookWindowsHook(
+;;    int nCode,
+;;    HOOKPROC pfnFilterProc);
+;;
+;;HHOOK
+;;WINAPI
+;;SetWindowsHookExA(
+;;    int idHook,
+;;    HOOKPROC lpfn,
+;;    HINSTANCE hmod,
+;;    DWORD dwThreadId);
+;;HHOOK
+;;WINAPI
+;;SetWindowsHookExW(
+;;    int idHook,
+;;    HOOKPROC lpfn,
+;;    HINSTANCE hmod,
+;;    DWORD dwThreadId);
+;;#ifdef UNICODE
+;;#define SetWindowsHookEx  SetWindowsHookExW
+;;#else
+;;#define SetWindowsHookEx  SetWindowsHookExA
+;;#endif // !UNICODE
+;;
+;;BOOL
+;;WINAPI
+;;UnhookWindowsHookEx(
+;;    HHOOK hhk);
+;;
+;;LRESULT
+;;WINAPI CallNextHookEx(
+;;    HHOOK hhk,
+;;    int nCode,
+;;    WPARAM wParam,
+;;    LPARAM lParam);
+;;
+;;/*
+;; * Macros for source-level compatibility with old functions.
+;; */
+;;#ifdef STRICT
+;;#define DefHookProc(nCode, wParam, lParam, phhk)\
+;;        CallNextHookEx(*phhk, nCode, wParam, lParam)
+;;#else
+;;#define DefHookProc(nCode, wParam, lParam, phhk)\
+;;        CallNextHookEx((HHOOK)*phhk, nCode, wParam, lParam)
+;;#endif // STRICT
+;;
+;;#endif /* !NOWH */
+;;
+;;#ifndef NOMENUS
+;;
+;;/*
+;; * Menu flags for Add/Check/EnableMenuItem()
+;; */
+(define-integrable MF_INSERT          #x00000000)
+(define-integrable MF_CHANGE          #x00000080)
+(define-integrable MF_APPEND          #x00000100)
+(define-integrable MF_DELETE          #x00000200)
+(define-integrable MF_REMOVE          #x00001000)
+
+(define-integrable MF_BYCOMMAND       #x00000000)
+(define-integrable MF_BYPOSITION      #x00000400)
+
+(define-integrable MF_SEPARATOR       #x00000800)
+
+(define-integrable MF_ENABLED         #x00000000)
+(define-integrable MF_GRAYED          #x00000001)
+(define-integrable MF_DISABLED        #x00000002)
+
+(define-integrable MF_UNCHECKED       #x00000000)
+(define-integrable MF_CHECKED         #x00000008)
+(define-integrable MF_USECHECKBITMAPS #x00000200)
+
+(define-integrable MF_STRING          #x00000000)
+(define-integrable MF_BITMAP          #x00000004)
+(define-integrable MF_OWNERDRAW       #x00000100)
+
+(define-integrable MF_POPUP           #x00000010)
+(define-integrable MF_MENUBARBREAK    #x00000020)
+(define-integrable MF_MENUBREAK       #x00000040)
+
+(define-integrable MF_UNHILITE        #x00000000)
+(define-integrable MF_HILITE          #x00000080)
+
+(define-integrable MF_SYSMENU         #x00002000)
+(define-integrable MF_HELP            #x00004000)
+(define-integrable MF_MOUSESELECT     #x00008000)
+
+
+;;/*
+;; * Menu item resource format
+;; */
+;;typedef struct {
+;;    WORD versionNumber;
+;;    WORD offset;
+;;} MENUITEMTEMPLATEHEADER;
+;;
+;;typedef struct {
+;;    WORD mtOption;
+;;    WORD mtID;
+;;    char mtString[1];
+;;} MENUITEMTEMPLATE;
+;;
+;;#define MF_END             0x00000080L
+;;
+;;#endif /* !NOMENUS */
+;;
+;;#ifndef NOSYSCOMMANDS
+;;
+;;/*
+;; * System Menu Command Values
+;; */
+(define-integrable SC_SIZE         #xF000)
+(define-integrable SC_MOVE         #xF010)
+(define-integrable SC_MINIMIZE     #xF020)
+(define-integrable SC_MAXIMIZE     #xF030)
+(define-integrable SC_NEXTWINDOW   #xF040)
+(define-integrable SC_PREVWINDOW   #xF050)
+(define-integrable SC_CLOSE        #xF060)
+(define-integrable SC_VSCROLL      #xF070)
+(define-integrable SC_HSCROLL      #xF080)
+(define-integrable SC_MOUSEMENU    #xF090)
+(define-integrable SC_KEYMENU      #xF100)
+(define-integrable SC_ARRANGE      #xF110)
+(define-integrable SC_RESTORE      #xF120)
+(define-integrable SC_TASKLIST     #xF130)
+(define-integrable SC_SCREENSAVE   #xF140)
+(define-integrable SC_HOTKEY       #xF150)
+
+;;/*
+;; * Obsolete names
+;; */
+(define-integrable SC_ICON         SC_MINIMIZE)
+(define-integrable SC_ZOOM         SC_MAXIMIZE)
+
+;;#endif /* !NOSYSCOMMANDS */
+;;
+;;/*
+;; * Resource Loading Routines
+;; */
+;;
+;;HBITMAP
+;;WINAPI
+;;LoadBitmapA(
+;;    HINSTANCE hInstance,
+;;    LPCSTR lpBitmapName);
+;;HBITMAP
+;;WINAPI
+;;LoadBitmapW(
+;;    HINSTANCE hInstance,
+;;    LPCWSTR lpBitmapName);
+;;#ifdef UNICODE
+;;#define LoadBitmap  LoadBitmapW
+;;#else
+;;#define LoadBitmap  LoadBitmapA
+;;#endif // !UNICODE
+;;
+;;HCURSOR
+;;WINAPI
+;;LoadCursorA(
+;;    HINSTANCE hInstance,
+;;    LPCSTR lpCursorName);
+;;HCURSOR
+;;WINAPI
+;;LoadCursorW(
+;;    HINSTANCE hInstance,
+;;    LPCWSTR lpCursorName);
+;;#ifdef UNICODE
+;;#define LoadCursor  LoadCursorW
+;;#else
+;;#define LoadCursor  LoadCursorA
+;;#endif // !UNICODE
+;;
+;;HCURSOR
+;;WINAPI
+;;CreateCursor(
+;;    HINSTANCE hInst,
+;;    int xHotSpot,
+;;    int yHotSpot,
+;;    int nWidth,
+;;    int nHeight,
+;;    CONST VOID *pvANDPlane,
+;;    CONST VOID *pvXORPlane);
+;;
+;;BOOL
+;;WINAPI
+;;DestroyCursor(
+;;    HCURSOR hCursor);
+;;
+;;#define CopyCursor(pcur) ((HCURSOR)CopyIcon((HICON)(pcur)))
+;;
+;;/*
+;; * Standard Cursor IDs
+;; */
+(define-integrable IDC_ARROW           32512)
+(define-integrable IDC_IBEAM           32513)
+(define-integrable IDC_WAIT            32514)
+(define-integrable IDC_CROSS           32515)
+(define-integrable IDC_UPARROW         32516)
+(define-integrable IDC_SIZE            32640)
+(define-integrable IDC_ICON            32641)
+(define-integrable IDC_SIZENWSE        32642)
+(define-integrable IDC_SIZENESW        32643)
+(define-integrable IDC_SIZEWE          32644)
+(define-integrable IDC_SIZENS          32645)
+(define-integrable IDC_SIZEALL         32646) ; //not in win3.1
+(define-integrable IDC_NO              32648) ; //not in win3.1
+(define-integrable IDC_APPSTARTING     32650) ; //not in win3.1
+
+;;typedef struct _ICONINFO {
+;;    BOOL    fIcon;
+;;    DWORD   xHotspot;
+;;    DWORD   yHotspot;
+;;    HBITMAP hbmMask;
+;;    HBITMAP hbmColor;
+;;} ICONINFO;
+;;typedef ICONINFO *PICONINFO;
+;;
+;;HICON
+;;WINAPI
+;;LoadIconA(
+;;    HINSTANCE hInstance,
+;;    LPCSTR lpIconName);
+;;HICON
+;;WINAPI
+;;LoadIconW(
+;;    HINSTANCE hInstance,
+;;    LPCWSTR lpIconName);
+;;#ifdef UNICODE
+;;#define LoadIcon  LoadIconW
+;;#else
+;;#define LoadIcon  LoadIconA
+;;#endif // !UNICODE
+;;
+;;HICON
+;;WINAPI
+;;CreateIcon(
+;;    HINSTANCE hInstance,
+;;    int nWidth,
+;;    int nHeight,
+;;    BYTE cPlanes,
+;;    BYTE cBitsPixel,
+;;    CONST BYTE *lpbANDbits,
+;;    CONST BYTE *lpbXORbits);
+;;
+;;BOOL
+;;WINAPI
+;;DestroyIcon(
+;;    HICON hIcon);
+;;
+;;int
+;;WINAPI
+;;LookupIconIdFromDirectory(
+;;    PBYTE presbits,
+;;    BOOL fIcon);
+;;
+;;HICON
+;;WINAPI
+;;CreateIconFromResource(
+;;    PBYTE presbits,
+;;    DWORD dwResSize,
+;;    BOOL fIcon,
+;;    DWORD dwVer);
+;;
+;;HICON
+;;WINAPI
+;;CreateIconIndirect(
+;;    PICONINFO piconinfo);
+;;
+;;HICON
+;;WINAPI
+;;CopyIcon(
+;;    HICON hIcon);
+;;
+;;BOOL
+;;WINAPI
+;;GetIconInfo(
+;;    HICON hIcon,
+;;    PICONINFO piconinfo);
+;;
+;;#ifdef OEMRESOURCE
+;;
+;;/*
+;; * OEM Resource Ordinal Numbers
+;; */
+(define-integrable OBM_CLOSE           32754)
+(define-integrable OBM_UPARROW         32753)
+(define-integrable OBM_DNARROW         32752)
+(define-integrable OBM_RGARROW         32751)
+(define-integrable OBM_LFARROW         32750)
+(define-integrable OBM_REDUCE          32749)
+(define-integrable OBM_ZOOM            32748)
+(define-integrable OBM_RESTORE         32747)
+(define-integrable OBM_REDUCED         32746)
+(define-integrable OBM_ZOOMD           32745)
+(define-integrable OBM_RESTORED        32744)
+(define-integrable OBM_UPARROWD        32743)
+(define-integrable OBM_DNARROWD        32742)
+(define-integrable OBM_RGARROWD        32741)
+(define-integrable OBM_LFARROWD        32740)
+(define-integrable OBM_MNARROW         32739)
+(define-integrable OBM_COMBO           32738)
+(define-integrable OBM_UPARROWI        32737)
+(define-integrable OBM_DNARROWI        32736)
+(define-integrable OBM_RGARROWI        32735)
+(define-integrable OBM_LFARROWI        32734)
+
+(define-integrable OBM_OLD_CLOSE       32767)
+(define-integrable OBM_SIZE            32766)
+(define-integrable OBM_OLD_UPARROW     32765)
+(define-integrable OBM_OLD_DNARROW     32764)
+(define-integrable OBM_OLD_RGARROW     32763)
+(define-integrable OBM_OLD_LFARROW     32762)
+(define-integrable OBM_BTSIZE          32761)
+(define-integrable OBM_CHECK           32760)
+(define-integrable OBM_CHECKBOXES      32759)
+(define-integrable OBM_BTNCORNERS      32758)
+(define-integrable OBM_OLD_REDUCE      32757)
+(define-integrable OBM_OLD_ZOOM        32756)
+(define-integrable OBM_OLD_RESTORE     32755)
+
+(define-integrable OCR_NORMAL          32512)
+(define-integrable OCR_IBEAM           32513)
+(define-integrable OCR_WAIT            32514)
+(define-integrable OCR_CROSS           32515)
+(define-integrable OCR_UP              32516)
+(define-integrable OCR_SIZE            32640)
+(define-integrable OCR_ICON            32641)
+(define-integrable OCR_SIZENWSE        32642)
+(define-integrable OCR_SIZENESW        32643)
+(define-integrable OCR_SIZEWE          32644)
+(define-integrable OCR_SIZENS          32645)
+(define-integrable OCR_SIZEALL         32646)
+(define-integrable OCR_ICOCUR          32647)
+(define-integrable OCR_NO              32648) ;  //not in win3.1
+
+(define-integrable OIC_SAMPLE          32512)
+(define-integrable OIC_HAND            32513)
+(define-integrable OIC_QUES            32514)
+(define-integrable OIC_BANG            32515)
+(define-integrable OIC_NOTE            32516)
+
+;;#endif /* OEMRESOURCE */
+
+(define-integrable ORD_LANGDRIVER    1)   ;     /* The ordinal number for the entry point of
+;;                                              ** language drivers.
+;;                                              */
+;;
+;;#ifndef NOICONS
+;;
+;;/*
+;; * Standard Icon IDs
+;; */
+(define-integrable IDI_APPLICATION   32512)
+(define-integrable IDI_HAND          32513)
+(define-integrable IDI_QUESTION      32514)
+(define-integrable IDI_EXCLAMATION   32515)
+(define-integrable IDI_ASTERISK      32516)
+
+;;#endif /* !NOICONS */
+;;
+;;int
+;;WINAPI
+;;LoadStringA(
+;;    HINSTANCE hInstance,
+;;    UINT uID,
+;;    LPSTR lpBuffer,
+;;    int nBufferMax);
+;;int
+;;WINAPI
+;;LoadStringW(
+;;    HINSTANCE hInstance,
+;;    UINT uID,
+;;    LPWSTR lpBuffer,
+;;    int nBufferMax);
+;;#ifdef UNICODE
+;;#define LoadString  LoadStringW
+;;#else
+;;#define LoadString  LoadStringA
+;;#endif // !UNICODE
+;;
+;;/*
+;; * Dialog Box Command IDs
+;; */
+(define-integrable IDOK                1)
+(define-integrable IDCANCEL            2)
+(define-integrable IDABORT             3)
+(define-integrable IDRETRY             4)
+(define-integrable IDIGNORE            5)
+(define-integrable IDYES               6)
+(define-integrable IDNO                7)
+
+;;#ifndef NOCTLMGR
+;;
+;;/*
+;; * Control Manager Structures and Definitions
+;; */
+;;
+;;#ifndef NOWINSTYLES
+;;
+;;/*
+;; * Edit Control Styles
+;; */
+(define-integrable ES_LEFT             #x0000)
+(define-integrable ES_CENTER           #x0001)
+(define-integrable ES_RIGHT            #x0002)
+(define-integrable ES_MULTILINE        #x0004)
+(define-integrable ES_UPPERCASE        #x0008)
+(define-integrable ES_LOWERCASE        #x0010)
+(define-integrable ES_PASSWORD         #x0020)
+(define-integrable ES_AUTOVSCROLL      #x0040)
+(define-integrable ES_AUTOHSCROLL      #x0080)
+(define-integrable ES_NOHIDESEL        #x0100)
+(define-integrable ES_OEMCONVERT       #x0400)
+(define-integrable ES_READONLY         #x0800)
+(define-integrable ES_WANTRETURN       #x1000)
+
+
+;;#endif /* !NOWINSTYLES */
+;;
+;;/*
+;; * Edit Control Notification Codes
+;; */
+(define-integrable EN_SETFOCUS         #x0100)
+(define-integrable EN_KILLFOCUS        #x0200)
+(define-integrable EN_CHANGE           #x0300)
+(define-integrable EN_UPDATE           #x0400)
+(define-integrable EN_ERRSPACE         #x0500)
+(define-integrable EN_MAXTEXT          #x0501)
+(define-integrable EN_HSCROLL          #x0601)
+(define-integrable EN_VSCROLL          #x0602)
+
+;;#ifndef NOWINMESSAGES
+;;
+;;/*
+;; * Edit Control Messages
+;; */
+(define-integrable EM_GETSEL               #x00B0)
+(define-integrable EM_SETSEL               #x00B1)
+(define-integrable EM_GETRECT              #x00B2)
+(define-integrable EM_SETRECT              #x00B3)
+(define-integrable EM_SETRECTNP            #x00B4)
+(define-integrable EM_SCROLL               #x00B5)
+(define-integrable EM_LINESCROLL           #x00B6)
+(define-integrable EM_SCROLLCARET          #x00B7)
+(define-integrable EM_GETMODIFY            #x00B8)
+(define-integrable EM_SETMODIFY            #x00B9)
+(define-integrable EM_GETLINECOUNT         #x00BA)
+(define-integrable EM_LINEINDEX            #x00BB)
+(define-integrable EM_SETHANDLE            #x00BC)
+(define-integrable EM_GETHANDLE            #x00BD)
+(define-integrable EM_GETTHUMB             #x00BE)
+(define-integrable EM_LINELENGTH           #x00C1)
+(define-integrable EM_REPLACESEL           #x00C2)
+(define-integrable EM_GETLINE              #x00C4)
+(define-integrable EM_LIMITTEXT            #x00C5)
+(define-integrable EM_CANUNDO              #x00C6)
+(define-integrable EM_UNDO                 #x00C7)
+(define-integrable EM_FMTLINES             #x00C8)
+(define-integrable EM_LINEFROMCHAR         #x00C9)
+(define-integrable EM_SETTABSTOPS          #x00CB)
+(define-integrable EM_SETPASSWORDCHAR      #x00CC)
+(define-integrable EM_EMPTYUNDOBUFFER      #x00CD)
+(define-integrable EM_GETFIRSTVISIBLELINE  #x00CE)
+(define-integrable EM_SETREADONLY          #x00CF)
+(define-integrable EM_SETWORDBREAKPROC     #x00D0)
+(define-integrable EM_GETWORDBREAKPROC     #x00D1)
+(define-integrable EM_GETPASSWORDCHAR      #x00D2)
+
+;;#endif /* !NOWINMESSAGES */
+;;
+;;/*
+;; * EDITWORDBREAKPROC code values
+;; */
+(define-integrable WB_LEFT            0)
+(define-integrable WB_RIGHT           1)
+(define-integrable WB_ISDELIMITER     2)
+
+;;/*
+;; * Button Control Styles
+;; */
+(define-integrable BS_PUSHBUTTON      #x00)
+(define-integrable BS_DEFPUSHBUTTON   #x01)
+(define-integrable BS_CHECKBOX        #x02)
+(define-integrable BS_AUTOCHECKBOX    #x03)
+(define-integrable BS_RADIOBUTTON     #x04)
+(define-integrable BS_3STATE          #x05)
+(define-integrable BS_AUTO3STATE      #x06)
+(define-integrable BS_GROUPBOX        #x07)
+(define-integrable BS_USERBUTTON      #x08)
+(define-integrable BS_AUTORADIOBUTTON #x09)
+(define-integrable BS_OWNERDRAW       #x0B)
+(define-integrable BS_LEFTTEXT        #x20)
+
+
+;;/*
+;; * User Button Notification Codes
+;; */
+(define-integrable BN_CLICKED         0)
+(define-integrable BN_PAINT           1)
+(define-integrable BN_HILITE          2)
+(define-integrable BN_UNHILITE        3)
+(define-integrable BN_DISABLE         4)
+(define-integrable BN_DOUBLECLICKED   5)
+
+;;/*
+;; * Button Control Messages
+;; */
+(define-integrable BM_GETCHECK        #x00F0)
+(define-integrable BM_SETCHECK        #x00F1)
+(define-integrable BM_GETSTATE        #x00F2)
+(define-integrable BM_SETSTATE        #x00F3)
+(define-integrable BM_SETSTYLE        #x00F4)
+
+;;/*
+;; * Static Control Constants
+;; */
+(define-integrable SS_LEFT            #x00)
+(define-integrable SS_CENTER          #x01)
+(define-integrable SS_RIGHT           #x02)
+(define-integrable SS_ICON            #x03)
+(define-integrable SS_BLACKRECT       #x04)
+(define-integrable SS_GRAYRECT        #x05)
+(define-integrable SS_WHITERECT       #x06)
+(define-integrable SS_BLACKFRAME      #x07)
+(define-integrable SS_GRAYFRAME       #x08)
+(define-integrable SS_WHITEFRAME      #x09)
+(define-integrable SS_USERITEM        #x0A)
+(define-integrable SS_SIMPLE          #x0B)
+(define-integrable SS_LEFTNOWORDWRAP  #x0C)
+(define-integrable SS_NOPREFIX        #x80)  ;    /* Don't do "&" character translation */
+
+;;#ifndef NOWINMESSAGES
+;;/*
+;; * Static Control Mesages
+;; */
+(define-integrable STM_SETICON        #x170)
+(define-integrable STM_GETICON        #x171)
+(define-integrable STM_MSGMAX         #x172)
+;;#endif /* !NOWINMESSAGES */
+
+;;/*
+;; * Dialog window class
+;; */
+(define-integrable WC_DIALOG       #x8002)  ;    (MAKEINTATOM(0x8002))
+
+;;/*
+;; * Get/SetWindowWord/Long offsets for use with WC_DIALOG windows
+;; */
+(define-integrable DWL_MSGRESULT   0)
+(define-integrable DWL_DLGPROC     4)
+(define-integrable DWL_USER        8)
+
+;;/*
+;; * Dialog Manager Routines
+;; */
+;;
+;;#ifndef NOMSG
+;;BOOL
+;;WINAPI
+;;IsDialogMessage(
+;;    HWND hDlg,
+;;    LPMSG lpMsg);
+;;#endif /* !NOMSG */
+;;
+;;BOOL
+;;WINAPI
+;;MapDialogRect(
+;;    HWND hDlg,
+;;    LPRECT lpRect);
+;;
+;;int
+;;WINAPI
+;;DlgDirListA(
+;;    HWND hDlg,
+;;    LPSTR lpPathSpec,
+;;    int nIDListBox,
+;;    int nIDStaticPath,
+;;    UINT uFileType);
+;;int
+;;WINAPI
+;;DlgDirListW(
+;;    HWND hDlg,
+;;    LPWSTR lpPathSpec,
+;;    int nIDListBox,
+;;    int nIDStaticPath,
+;;    UINT uFileType);
+;;#ifdef UNICODE
+;;#define DlgDirList  DlgDirListW
+;;#else
+;;#define DlgDirList  DlgDirListA
+;;#endif // !UNICODE
+;;
+;;/*
+;; * DlgDirList, DlgDirListComboBox flags values
+;; */
+(define-integrable DDL_READWRITE       #x0000)
+(define-integrable DDL_READONLY        #x0001)
+(define-integrable DDL_HIDDEN          #x0002)
+(define-integrable DDL_SYSTEM          #x0004)
+(define-integrable DDL_DIRECTORY       #x0010)
+(define-integrable DDL_ARCHIVE         #x0020)
+
+(define-integrable DDL_POSTMSGS        #x2000)
+(define-integrable DDL_DRIVES          #x4000)
+(define-integrable DDL_EXCLUSIVE       #x8000)
+
+
+;;BOOL
+;;WINAPI
+;;DlgDirSelectExA(
+;;    HWND hDlg,
+;;    LPSTR lpString,
+;;    int nCount,
+;;    int nIDListBox);
+;;BOOL
+;;WINAPI
+;;DlgDirSelectExW(
+;;    HWND hDlg,
+;;    LPWSTR lpString,
+;;    int nCount,
+;;    int nIDListBox);
+;;#ifdef UNICODE
+;;#define DlgDirSelectEx  DlgDirSelectExW
+;;#else
+;;#define DlgDirSelectEx  DlgDirSelectExA
+;;#endif // !UNICODE
+;;
+;;int
+;;WINAPI
+;;DlgDirListComboBoxA(
+;;    HWND hDlg,
+;;    LPSTR lpPathSpec,
+;;    int nIDComboBox,
+;;    int nIDStaticPath,
+;;    UINT uFiletype);
+;;int
+;;WINAPI
+;;DlgDirListComboBoxW(
+;;    HWND hDlg,
+;;    LPWSTR lpPathSpec,
+;;    int nIDComboBox,
+;;    int nIDStaticPath,
+;;    UINT uFiletype);
+;;#ifdef UNICODE
+;;#define DlgDirListComboBox  DlgDirListComboBoxW
+;;#else
+;;#define DlgDirListComboBox  DlgDirListComboBoxA
+;;#endif // !UNICODE
+;;
+;;BOOL
+;;WINAPI
+;;DlgDirSelectComboBoxExA(
+;;    HWND hDlg,
+;;    LPSTR lpString,
+;;    int nCount,
+;;    int nIDComboBox);
+;;BOOL
+;;WINAPI
+;;DlgDirSelectComboBoxExW(
+;;    HWND hDlg,
+;;    LPWSTR lpString,
+;;    int nCount,
+;;    int nIDComboBox);
+;;#ifdef UNICODE
+;;#define DlgDirSelectComboBoxEx  DlgDirSelectComboBoxExW
+;;#else
+;;#define DlgDirSelectComboBoxEx  DlgDirSelectComboBoxExA
+;;#endif // !UNICODE
+;;
+;;/*
+;; * Dialog Styles
+;; */
+(define-integrable DS_ABSALIGN         #x01)
+(define-integrable DS_SYSMODAL         #x02)
+(define-integrable DS_LOCALEDIT        #x20)  ;   /* Edit items get Local storage. */
+(define-integrable DS_SETFONT          #x40)  ;   /* User specified font for Dlg controls */
+(define-integrable DS_MODALFRAME       #x80)  ;   /* Can be combined with WS_CAPTION  */
+(define-integrable DS_NOIDLEMSG        #x100) ;   /* WM_ENTERIDLE message will not be sent */
+(define-integrable DS_SETFOREGROUND    #x200) ;   //not in win3.1
+
+(define-integrable DM_GETDEFID         (+ WM_USER 0))
+(define-integrable DM_SETDEFID         (+ WM_USER 1))
+
+;;/*
+;; * Returned in HIWORD() of DM_GETDEFID result if msg is supported
+;; */
+(define-integrable DC_HASDEFID         #x534B)
+
+;;/*
+;; * Dialog Codes
+;; */
+(define-integrable DLGC_WANTARROWS     #x0001) ;      /* Control wants arrow keys         */
+(define-integrable DLGC_WANTTAB        #x0002) ;      /* Control wants tab keys           */
+(define-integrable DLGC_WANTALLKEYS    #x0004) ;      /* Control wants all keys           */
+(define-integrable DLGC_WANTMESSAGE    #x0004) ;      /* Pass message to control          */
+(define-integrable DLGC_HASSETSEL      #x0008) ;      /* Understands EM_SETSEL message    */
+(define-integrable DLGC_DEFPUSHBUTTON  #x0010) ;      /* Default pushbutton               */
+(define-integrable DLGC_UNDEFPUSHBUTTON #x0020) ;     /* Non-default pushbutton           */
+(define-integrable DLGC_RADIOBUTTON    #x0040) ;      /* Radio button                     */
+(define-integrable DLGC_WANTCHARS      #x0080) ;      /* Want WM_CHAR messages            */
+(define-integrable DLGC_STATIC         #x0100) ;      /* Static item: don't include       */
+(define-integrable DLGC_BUTTON         #x2000) ;      /* Button item: can be checked      */
+
+(define-integrable LB_CTLCODE          0)
+
+;;/*
+;; * Listbox Return Values
+;; */
+(define-integrable LB_OKAY             0)
+(define-integrable LB_ERR              -1)
+(define-integrable LB_ERRSPACE         -2)
+
+;;/*
+;;**  The idStaticPath parameter to DlgDirList can have the following values
+;;**  ORed if the list box should show other details of the files along with
+;;**  the name of the files;
+;;*/
+;;                                  /* all other details also will be returned */
+;;
+;;
+;;/*
+;; * Listbox Notification Codes
+;; */
+(define-integrable LBN_ERRSPACE        -2)
+(define-integrable LBN_SELCHANGE       1)
+(define-integrable LBN_DBLCLK          2)
+(define-integrable LBN_SELCANCEL       3)
+(define-integrable LBN_SETFOCUS        4)
+(define-integrable LBN_KILLFOCUS       5)
+
+
+
+;;#ifndef NOWINMESSAGES
+;;
+;;/*
+;; * Listbox messages
+;; */
+(define-integrable LB_ADDSTRING            #x0180)
+(define-integrable LB_INSERTSTRING         #x0181)
+(define-integrable LB_DELETESTRING         #x0182)
+(define-integrable LB_SELITEMRANGEEX       #x0183)
+(define-integrable LB_RESETCONTENT         #x0184)
+(define-integrable LB_SETSEL               #x0185)
+(define-integrable LB_SETCURSEL            #x0186)
+(define-integrable LB_GETSEL               #x0187)
+(define-integrable LB_GETCURSEL            #x0188)
+(define-integrable LB_GETTEXT              #x0189)
+(define-integrable LB_GETTEXTLEN           #x018A)
+(define-integrable LB_GETCOUNT             #x018B)
+(define-integrable LB_SELECTSTRING         #x018C)
+(define-integrable LB_DIR                  #x018D)
+(define-integrable LB_GETTOPINDEX          #x018E)
+(define-integrable LB_FINDSTRING           #x018F)
+(define-integrable LB_GETSELCOUNT          #x0190)
+(define-integrable LB_GETSELITEMS          #x0191)
+(define-integrable LB_SETTABSTOPS          #x0192)
+(define-integrable LB_GETHORIZONTALEXTENT  #x0193)
+(define-integrable LB_SETHORIZONTALEXTENT  #x0194)
+(define-integrable LB_SETCOLUMNWIDTH       #x0195)
+(define-integrable LB_ADDFILE              #x0196)
+(define-integrable LB_SETTOPINDEX          #x0197)
+(define-integrable LB_GETITEMRECT          #x0198)
+(define-integrable LB_GETITEMDATA          #x0199)
+(define-integrable LB_SETITEMDATA          #x019A)
+(define-integrable LB_SELITEMRANGE         #x019B)
+(define-integrable LB_SETANCHORINDEX       #x019C)
+(define-integrable LB_GETANCHORINDEX       #x019D)
+(define-integrable LB_SETCARETINDEX        #x019E)
+(define-integrable LB_GETCARETINDEX        #x019F)
+(define-integrable LB_SETITEMHEIGHT        #x01A0)
+(define-integrable LB_GETITEMHEIGHT        #x01A1)
+(define-integrable LB_FINDSTRINGEXACT      #x01A2)
+(define-integrable LB_SETLOCALE            #x01A5)
+(define-integrable LB_GETLOCALE            #x01A6)
+(define-integrable LB_SETCOUNT             #x01A7)
+(define-integrable LB_MSGMAX               #x01A8)
+
+;;#endif /* !NOWINMESSAGES */
+;;
+;;#ifndef NOWINSTYLES
+;;
+;;/*
+;; * Listbox Styles
+;; */
+(define-integrable LBS_NOTIFY            #x0001)
+(define-integrable LBS_SORT              #x0002)
+(define-integrable LBS_NOREDRAW          #x0004)
+(define-integrable LBS_MULTIPLESEL       #x0008)
+(define-integrable LBS_OWNERDRAWFIXED    #x0010)
+(define-integrable LBS_OWNERDRAWVARIABLE #x0020)
+(define-integrable LBS_HASSTRINGS        #x0040)
+(define-integrable LBS_USETABSTOPS       #x0080)
+(define-integrable LBS_NOINTEGRALHEIGHT  #x0100)
+(define-integrable LBS_MULTICOLUMN       #x0200)
+(define-integrable LBS_WANTKEYBOARDINPUT #x0400)
+(define-integrable LBS_EXTENDEDSEL       #x0800)
+(define-integrable LBS_DISABLENOSCROLL   #x1000)
+(define-integrable LBS_NODATA            #x2000)
+(define-integrable LBS_STANDARD          (+ LBS_NOTIFY LBS_SORT WS_VSCROLL WS_BORDER))
+
+;;#endif /* !NOWINSTYLES */
+;;
+;;
+;;/*
+;; * Combo Box return Values
+;; */
+(define-integrable CB_OKAY             0)
+(define-integrable CB_ERR              -1)
+(define-integrable CB_ERRSPACE         -2)
+
+
+;;/*
+;; * Combo Box Notification Codes
+;; */
+(define-integrable CBN_ERRSPACE        -1)
+(define-integrable CBN_SELCHANGE       1)
+(define-integrable CBN_DBLCLK          2)
+(define-integrable CBN_SETFOCUS        3)
+(define-integrable CBN_KILLFOCUS       4)
+(define-integrable CBN_EDITCHANGE      5)
+(define-integrable CBN_EDITUPDATE      6)
+(define-integrable CBN_DROPDOWN        7)
+(define-integrable CBN_CLOSEUP         8)
+(define-integrable CBN_SELENDOK        9)
+(define-integrable CBN_SELENDCANCEL    10)
+
+;;/*
+;; * Combo Box styles
+;; */
+;;#ifndef NOWINSTYLES
+(define-integrable CBS_SIMPLE            #x0001)
+(define-integrable CBS_DROPDOWN          #x0002)
+(define-integrable CBS_DROPDOWNLIST      #x0003)
+(define-integrable CBS_OWNERDRAWFIXED    #x0010)
+(define-integrable CBS_OWNERDRAWVARIABLE #x0020)
+(define-integrable CBS_AUTOHSCROLL       #x0040)
+(define-integrable CBS_OEMCONVERT        #x0080)
+(define-integrable CBS_SORT              #x0100)
+(define-integrable CBS_HASSTRINGS        #x0200)
+(define-integrable CBS_NOINTEGRALHEIGHT  #x0400)
+(define-integrable CBS_DISABLENOSCROLL   #x0800)
+;;#endif  /* !NOWINSTYLES */
+
+
+;;/*
+;; * Combo Box messages
+;; */
+;;#ifndef NOWINMESSAGES
+(define-integrable CB_GETEDITSEL               #x0140)
+(define-integrable CB_LIMITTEXT                #x0141)
+(define-integrable CB_SETEDITSEL               #x0142)
+(define-integrable CB_ADDSTRING                #x0143)
+(define-integrable CB_DELETESTRING             #x0144)
+(define-integrable CB_DIR                      #x0145)
+(define-integrable CB_GETCOUNT                 #x0146)
+(define-integrable CB_GETCURSEL                #x0147)
+(define-integrable CB_GETLBTEXT                #x0148)
+(define-integrable CB_GETLBTEXTLEN             #x0149)
+(define-integrable CB_INSERTSTRING             #x014A)
+(define-integrable CB_RESETCONTENT             #x014B)
+(define-integrable CB_FINDSTRING               #x014C)
+(define-integrable CB_SELECTSTRING             #x014D)
+(define-integrable CB_SETCURSEL                #x014E)
+(define-integrable CB_SHOWDROPDOWN             #x014F)
+(define-integrable CB_GETITEMDATA              #x0150)
+(define-integrable CB_SETITEMDATA              #x0151)
+(define-integrable CB_GETDROPPEDCONTROLRECT    #x0152)
+(define-integrable CB_SETITEMHEIGHT            #x0153)
+(define-integrable CB_GETITEMHEIGHT            #x0154)
+(define-integrable CB_SETEXTENDEDUI            #x0155)
+(define-integrable CB_GETEXTENDEDUI            #x0156)
+(define-integrable CB_GETDROPPEDSTATE          #x0157)
+(define-integrable CB_FINDSTRINGEXACT          #x0158)
+(define-integrable CB_SETLOCALE                #x0159)
+(define-integrable CB_GETLOCALE                #x015a)
+(define-integrable CB_MSGMAX                   #x015b)
+;;#endif  /* !NOWINMESSAGES */
+
+
+
+;;#ifndef NOWINSTYLES
+;;
+;;/*
+;; * Scroll Bar Styles
+;; */
+(define-integrable SBS_HORZ                    #x0000)
+(define-integrable SBS_VERT                    #x0001)
+(define-integrable SBS_TOPALIGN                #x0002)
+(define-integrable SBS_LEFTALIGN               #x0002)
+(define-integrable SBS_BOTTOMALIGN             #x0004)
+(define-integrable SBS_RIGHTALIGN              #x0004)
+(define-integrable SBS_SIZEBOXTOPLEFTALIGN     #x0002)
+(define-integrable SBS_SIZEBOXBOTTOMRIGHTALIGN #x0004)
+(define-integrable SBS_SIZEBOX                 #x0008)
+;;#endif /* !NOWINSTYLES */
+
+;;/*
+;; * Scroll bar messages
+;; */
+;;#ifndef NOWINMESSAGES
+(define-integrable SBM_SETPOS                  #x00E0)  ;   //not in win3.1
+(define-integrable SBM_GETPOS                  #x00E1)  ;   //not in win3.1
+(define-integrable SBM_SETRANGE                #x00E2)  ;   //not in win3.1
+(define-integrable SBM_SETRANGEREDRAW          #x00E6)  ;   //not in win3.1
+(define-integrable SBM_GETRANGE                #x00E3)  ;   //not in win3.1
+(define-integrable SBM_ENABLE_ARROWS           #x00E4)  ;   //not in win3.1
+;;#endif /* !NOWINMESSAGES */
+;;#endif /* !NOCTLMGR */
+
+;;#ifndef NOMDI
+
+;;/*
+;; * MDI client style bits
+;; */
+(define-integrable MDIS_ALLCHILDSTYLES    #x0001)
+
+;;/*
+;; * wParam Flags for WM_MDITILE and WM_MDICASCADE messages.
+;; */
+(define-integrable MDITILE_VERTICAL       #x0000)  ;   //not in win3.1
+(define-integrable MDITILE_HORIZONTAL     #x0001)  ;   //not in win3.1
+(define-integrable MDITILE_SKIPDISABLED   #x0002)  ;   //not in win3.1
+
+;;typedef struct tagMDICREATESTRUCTA {
+;;    LPCSTR   szClass;
+;;    LPCSTR   szTitle;
+;;    HANDLE hOwner;
+;;    int x;
+;;    int y;
+;;    int cx;
+;;    int cy;
+;;    DWORD style;
+;;    LPARAM lParam;        /* app-defined stuff */
+;;} MDICREATESTRUCTA, *LPMDICREATESTRUCTA;
+;;typedef struct tagMDICREATESTRUCTW {
+;;    LPCWSTR  szClass;
+;;    LPCWSTR  szTitle;
+;;    HANDLE hOwner;
+;;    int x;
+;;    int y;
+;;    int cx;
+;;    int cy;
+;;    DWORD style;
+;;    LPARAM lParam;        /* app-defined stuff */
+;;} MDICREATESTRUCTW, *LPMDICREATESTRUCTW;
+;;#ifdef UNICODE
+;;typedef MDICREATESTRUCTW MDICREATESTRUCT;
+;;typedef LPMDICREATESTRUCTW LPMDICREATESTRUCT;
+;;#else
+;;typedef MDICREATESTRUCTA MDICREATESTRUCT;
+;;typedef LPMDICREATESTRUCTA LPMDICREATESTRUCT;
+;;#endif // UNICODE
+;;
+;;typedef struct tagCLIENTCREATESTRUCT {
+;;    HANDLE hWindowMenu;
+;;    UINT idFirstChild;
+;;} CLIENTCREATESTRUCT, *LPCLIENTCREATESTRUCT;
+;;
+;;LRESULT
+;;WINAPI
+;;DefFrameProcA(
+;;    HWND hWnd,
+;;    HWND hWndMDIClient ,
+;;    UINT uMsg,
+;;    WPARAM wParam,
+;;    LPARAM lParam);
+;;LRESULT
+;;WINAPI
+;;DefFrameProcW(
+;;    HWND hWnd,
+;;    HWND hWndMDIClient ,
+;;    UINT uMsg,
+;;    WPARAM wParam,
+;;    LPARAM lParam);
+;;#ifdef UNICODE
+;;#define DefFrameProc  DefFrameProcW
+;;#else
+;;#define DefFrameProc  DefFrameProcA
+;;#endif // !UNICODE
+;;
+;;LRESULT
+;;WINAPI
+;;DefMDIChildProcA(
+;;    HWND hWnd,
+;;    UINT uMsg,
+;;    WPARAM wParam,
+;;    LPARAM lParam);
+;;LRESULT
+;;WINAPI
+;;DefMDIChildProcW(
+;;    HWND hWnd,
+;;    UINT uMsg,
+;;    WPARAM wParam,
+;;    LPARAM lParam);
+;;#ifdef UNICODE
+;;#define DefMDIChildProc  DefMDIChildProcW
+;;#else
+;;#define DefMDIChildProc  DefMDIChildProcA
+;;#endif // !UNICODE
+;;
+;;#ifndef NOMSG
+;;BOOL
+;;WINAPI
+;;TranslateMDISysAccel(
+;;    HWND hWndClient,
+;;    LPMSG lpMsg);
+;;#endif /* !NOMSG */
+;;
+;;UINT
+;;WINAPI
+;;ArrangeIconicWindows(
+;;    HWND hWnd);
+;;
+;;HWND
+;;WINAPI
+;;CreateMDIWindowA(
+;;    LPSTR lpClassName,
+;;    LPSTR lpWindowName,
+;;    DWORD dwStyle,
+;;    int X,
+;;    int Y,
+;;    int nWidth,
+;;    int nHeight,
+;;    HWND hWndParent,
+;;    HINSTANCE hInstance,
+;;    LPARAM lParam
+;;    );
+;;HWND
+;;WINAPI
+;;CreateMDIWindowW(
+;;    LPWSTR lpClassName,
+;;    LPWSTR lpWindowName,
+;;    DWORD dwStyle,
+;;    int X,
+;;    int Y,
+;;    int nWidth,
+;;    int nHeight,
+;;    HWND hWndParent,
+;;    HINSTANCE hInstance,
+;;    LPARAM lParam
+;;    );
+;;#ifdef UNICODE
+;;#define CreateMDIWindow  CreateMDIWindowW
+;;#else
+;;#define CreateMDIWindow  CreateMDIWindowA
+;;#endif // !UNICODE
+;;
+;;#endif /* !NOMDI */
+;;#endif /* !NOUSER */
+;;
+;;/****** Help support ********************************************************/
+;;
+;;#ifndef NOHELP
+;;
+;;typedef DWORD HELPPOLY;
+;;typedef struct tagMULTIKEYHELPA {
+;;    DWORD mkSize;
+;;    CHAR   mkKeylist;
+;;    CHAR   szKeyphrase[1];
+;;} MULTIKEYHELPA, *PMULTIKEYHELPA, *LPMULTIKEYHELPA;
+;;typedef struct tagMULTIKEYHELPW {
+;;    DWORD mkSize;
+;;    WCHAR  mkKeylist;
+;;    WCHAR  szKeyphrase[1];
+;;} MULTIKEYHELPW, *PMULTIKEYHELPW, *LPMULTIKEYHELPW;
+;;#ifdef UNICODE
+;;typedef MULTIKEYHELPW MULTIKEYHELP;
+;;typedef PMULTIKEYHELPW PMULTIKEYHELP;
+;;typedef LPMULTIKEYHELPW LPMULTIKEYHELP;
+;;#else
+;;typedef MULTIKEYHELPA MULTIKEYHELP;
+;;typedef PMULTIKEYHELPA PMULTIKEYHELP;
+;;typedef LPMULTIKEYHELPA LPMULTIKEYHELP;
+;;#endif // UNICODE
+;;
+;;typedef struct tagHELPWININFOA {
+;;    int  wStructSize;
+;;    int  x;
+;;    int  y;
+;;    int  dx;
+;;    int  dy;
+;;    int  wMax;
+;;    CHAR   rgchMember[2];
+;;} HELPWININFOA, *PHELPWININFOA, *LPHELPWININFOA;
+;;typedef struct tagHELPWININFOW {
+;;    int  wStructSize;
+;;    int  x;
+;;    int  y;
+;;    int  dx;
+;;    int  dy;
+;;    int  wMax;
+;;    WCHAR  rgchMember[2];
+;;} HELPWININFOW, *PHELPWININFOW, *LPHELPWININFOW;
+;;#ifdef UNICODE
+;;typedef HELPWININFOW HELPWININFO;
+;;typedef PHELPWININFOW PHELPWININFO;
+;;typedef LPHELPWININFOW LPHELPWININFO;
+;;#else
+;;typedef HELPWININFOA HELPWININFO;
+;;typedef PHELPWININFOA PHELPWININFO;
+;;typedef LPHELPWININFOA LPHELPWININFO;
+;;#endif // UNICODE
+;;
+;;/*
+;; * Commands to pass to WinHelp()
+;; */
+(define-integrable HELP_CONTEXT      #x0001) ;   /* Display topic in ulTopic */
+(define-integrable HELP_QUIT         #x0002) ;   /* Terminate help */
+(define-integrable HELP_INDEX        #x0003) ;   /* Display index */
+(define-integrable HELP_CONTENTS     #x0003)
+(define-integrable HELP_HELPONHELP   #x0004) ;   /* Display help on using help */
+(define-integrable HELP_SETINDEX     #x0005) ;   /* Set current Index for multi index help */
+(define-integrable HELP_SETCONTENTS  #x0005)
+(define-integrable HELP_CONTEXTPOPUP #x0008)
+(define-integrable HELP_FORCEFILE    #x0009)
+(define-integrable HELP_KEY          #x0101) ;   /* Display topic for keyword in offabData */
+(define-integrable HELP_COMMAND      #x0102)
+(define-integrable HELP_PARTIALKEY   #x0105)
+(define-integrable HELP_MULTIKEY     #x0201)
+(define-integrable HELP_SETWINPOS    #x0203)
+
+
+;;BOOL
+;;WINAPI
+;;WinHelpA(
+;;    HWND hWndMain,
+;;    LPCSTR lpszHelp,
+;;    UINT uCommand,
+;;    DWORD dwData
+;;    );
+;;BOOL
+;;WINAPI
+;;WinHelpW(
+;;    HWND hWndMain,
+;;    LPCWSTR lpszHelp,
+;;    UINT uCommand,
+;;    DWORD dwData
+;;    );
+;;#ifdef UNICODE
+;;#define WinHelp  WinHelpW
+;;#else
+;;#define WinHelp  WinHelpA
+;;#endif // !UNICODE
+;;
+;;#endif /* !NOHELP */
+;;
+;;#ifndef NOSYSPARAMSINFO
+;;/*
+;; * Parameter for SystemParametersInfo()
+;; */
+
+(define-integrable SPI_GETBEEP                 1)
+(define-integrable SPI_SETBEEP                 2)
+(define-integrable SPI_GETMOUSE                3)
+(define-integrable SPI_SETMOUSE                4)
+(define-integrable SPI_GETBORDER               5)
+(define-integrable SPI_SETBORDER               6)
+(define-integrable SPI_GETKEYBOARDSPEED       10)
+(define-integrable SPI_SETKEYBOARDSPEED       11)
+(define-integrable SPI_LANGDRIVER             12)
+(define-integrable SPI_ICONHORIZONTALSPACING  13)
+(define-integrable SPI_GETSCREENSAVETIMEOUT   14)
+(define-integrable SPI_SETSCREENSAVETIMEOUT   15)
+(define-integrable SPI_GETSCREENSAVEACTIVE    16)
+(define-integrable SPI_SETSCREENSAVEACTIVE    17)
+(define-integrable SPI_GETGRIDGRANULARITY     18)
+(define-integrable SPI_SETGRIDGRANULARITY     19)
+(define-integrable SPI_SETDESKWALLPAPER       20)
+(define-integrable SPI_SETDESKPATTERN         21)
+(define-integrable SPI_GETKEYBOARDDELAY       22)
+(define-integrable SPI_SETKEYBOARDDELAY       23)
+(define-integrable SPI_ICONVERTICALSPACING    24)
+(define-integrable SPI_GETICONTITLEWRAP       25)
+(define-integrable SPI_SETICONTITLEWRAP       26)
+(define-integrable SPI_GETMENUDROPALIGNMENT   27)
+(define-integrable SPI_SETMENUDROPALIGNMENT   28)
+(define-integrable SPI_SETDOUBLECLKWIDTH      29)
+(define-integrable SPI_SETDOUBLECLKHEIGHT     30)
+(define-integrable SPI_GETICONTITLELOGFONT    31)
+(define-integrable SPI_SETDOUBLECLICKTIME     32)
+(define-integrable SPI_SETMOUSEBUTTONSWAP     33)
+(define-integrable SPI_SETICONTITLELOGFONT    34)
+(define-integrable SPI_GETFASTTASKSWITCH      35)
+(define-integrable SPI_SETFASTTASKSWITCH      36)
+
+;;/*
+;; * Flags
+;; */
+(define-integrable SPIF_UPDATEINIFILE    #x0001)
+(define-integrable SPIF_SENDWININICHANGE #x0002)
+
+
+;;BOOL
+;;WINAPI
+;;SystemParametersInfoA(
+;;    UINT uiAction,
+;;    UINT uiParam,
+;;    PVOID pvParam,
+;;    UINT fWinIni);
+;;BOOL
+;;WINAPI
+;;SystemParametersInfoW(
+;;    UINT uiAction,
+;;    UINT uiParam,
+;;    PVOID pvParam,
+;;    UINT fWinIni);
+;;#ifdef UNICODE
+;;#define SystemParametersInfo  SystemParametersInfoW
+;;#else
+;;#define SystemParametersInfo  SystemParametersInfoA
+;;#endif // !UNICODE
+;;
+;;#endif  /* !NOSYSPARAMSINFO  */
+;;
+;;
+;;#ifdef __cplusplus
+;;}
+;;#endif  /* __cplusplus */
+;;
+;;#endif /* !_WINUSER_ */
diff --git a/v7/src/win32/wt_user.scm b/v7/src/win32/wt_user.scm
new file mode 100644 (file)
index 0000000..5e57c17
--- /dev/null
@@ -0,0 +1,165 @@
+#| -*-Scheme-*-
+
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/win32/wt_user.scm,v 1.1 1993/09/20 01:13:04 adams Exp $
+
+Copyright (c) 1993 Massachusetts Institute of Technology
+
+This material was developed by the Scheme project at the Massachusetts
+Institute of Technology, Department of Electrical Engineering and
+Computer Science.  Permission to copy this software, to redistribute
+it, and to use it for any purpose is granted, subject to the following
+restrictions and understandings.
+
+1. Any copy made of this software must include this copyright notice
+in full.
+
+2. Users of this software agree to make their best efforts (a) to
+return to the MIT Scheme project any improvements or extensions that
+they make, so that these may be included in future releases; and (b)
+to inform MIT of noteworthy uses of this software.
+
+3. All materials developed as a consequence of the use of this
+software shall duly acknowledge such use, in accordance with the usual
+standards of acknowledging credit in academic research.
+
+4. MIT has made no warrantee or representation that the operation of
+this software will be error-free, and MIT is under no obligation to
+provide any services, by way of maintenance, update, or otherwise.
+
+5. In conjunction with products arising from the use of this material,
+there shall be no use of the name of the Massachusetts Institute of
+Technology nor of any adaptation thereof in any advertising,
+promotional, or sales literature without prior written consent from
+MIT in each case. |#
+
+;;
+;; common win32 types
+
+(declare (usual-integrations))
+
+
+(define-integrable int32-offset-ref   
+          (make-primitive-procedure 'int32-offset-ref))
+(define-integrable int32-offset-set!  
+          (make-primitive-procedure 'int32-offset-set!))
+(define-integrable uint32-offset-ref  
+          (make-primitive-procedure 'uint32-offset-ref))
+(define-integrable uint32-offset-set! 
+          (make-primitive-procedure 'uint32-offset-set!))
+
+(define-integrable byte-offset-ref  vector-8b-ref)         
+(define-integrable byte-offset-set! vector-8b-set!)        
+
+(define-integrable (loword dword)  (modulo dword 65536))
+(define-integrable (hiword dword)  (integer-floor dword 65536))
+
+(define-integrable (int->bool i) (not (= i 0)))
+(define-integrable (bool->int b) (if b 1 0))
+
+;;typedef struct tagRECT {    /* rc */
+;;    LONG left;
+;;    LONG top;
+;;    LONG right;
+;;    LONG bottom;
+;;} RECT;
+
+(define-structure (rect (conc-name rect/)
+                        (constructor %make-rect))
+  mem)
+
+(define-integrable (rect/left r)   (int32-offset-ref (rect/mem r) 0))
+(define-integrable (rect/top r)    (int32-offset-ref (rect/mem r) 4))
+(define-integrable (rect/right r)  (int32-offset-ref (rect/mem r) 8))
+(define-integrable (rect/bottom r) (int32-offset-ref (rect/mem r) 12))
+
+(define-integrable (set-rect/left! r v)   (int32-offset-set! (rect/mem r) 0 v))
+(define-integrable (set-rect/top! r v)    (int32-offset-set! (rect/mem r) 4 v))
+(define-integrable (set-rect/right! r v)  (int32-offset-set! (rect/mem r) 8 v))
+(define-integrable (set-rect/bottom! r v) (int32-offset-set! (rect/mem r) 12 v))
+
+(define (make-rect left top right bottom)
+  (define r (%make-rect (make-string 16)))
+  (set-rect/left!   r left)
+  (set-rect/top!    r top)
+  (set-rect/right!  r right)
+  (set-rect/bottom! r bottom)
+  r)
+
+(define-windows-type RECT
+  (lambda (thing) (or (eq? thing #f) (rect? thing)))
+  (lambda (thing) (and thing (rect/mem r)))
+  #f
+  #f)
+
+;;typedef struct tagPAINTSTRUCT { /* ps */
+;;    HDC  hdc;
+;;    BOOL fErase;
+;;    RECT rcPaint;
+;;    BOOL fRestore;
+;;    BOOL fIncUpdate;
+;;    BYTE rgbReserved[32];
+;;} PAINTSTRUCT;
+
+
+(define-structure (paintstruct (conc-name paintstruct/)
+                        (constructor %make-paintstruct))
+  mem)
+
+(define-integrable (paintstruct/hdc r)
+  (uint32-offset-ref (paintstruct/mem r) 0))
+(define-integrable (paintstruct/f-erase r)
+  (int->bool (int32-offset-ref (paintstruct/mem r) 4)))
+(define-integrable (paintstruct/rc-paint/left r)
+  (int32-offset-ref (paintstruct/mem r) 8))
+(define-integrable (paintstruct/rc-paint/top r)
+  (int32-offset-ref (paintstruct/mem r) 12))
+(define-integrable (paintstruct/rc-paint/right r)
+  (int32-offset-ref (paintstruct/mem r) 16))
+(define-integrable (paintstruct/rc-paint/bottom r)
+  (int32-offset-ref (paintstruct/mem r) 20))
+(define-integrable (paintstruct/f-restore r)
+  (int->bool (byte-offset-ref (paintstruct/mem r) 24)))
+(define-integrable (paintstruct/f-inc-update r)
+  (int->bool (byte-offset-ref (paintstruct/mem r) 28)))
+
+(define-integrable (set-paintstruct/hdc! r v)
+  (uint32-offset-set! (paintstruct/mem r) 0 v))
+(define-integrable (set-paintstruct/f-erase! r v)
+  (byte-offset-set! (paintstruct/mem r) 4 (bool->int v)))
+(define-integrable (set-paintstruct/rc-paint/left! r v)
+  (int32-offset-set! (paintstruct/mem r) 8 v))
+(define-integrable (set-paintstruct/rc-paint/top! r v)
+  (int32-offset-set! (paintstruct/mem r) 12 v))
+(define-integrable (set-paintstruct/rc-paint/right! r v)
+  (int32-offset-set! (paintstruct/mem r) 16 v))
+(define-integrable (set-paintstruct/rc-paint/bottom! r v)
+  (int32-offset-set! (paintstruct/mem r) 20 v))
+(define-integrable (set-paintstruct/f-restore! r v)
+  (byte-offset-set! (paintstruct/mem r) 24 (bool->int v)))
+(define-integrable (set-paintstruct/f-erase! r v)
+  (byte-offset-set! (paintstruct/mem r) 28 (bool->int v)))
+
+(define (make-paintstruct)
+  (define r (%make-paintstruct (make-string 64)))
+  r)
+
+(define-windows-type paintstruct
+  paintstruct?
+  paintstruct/mem
+  #f
+  #f)
+
+(define (pp-paintstruct r)
+  (define (pp-field name accessor)
+    (newline)(display "(") (display name) (display " ") (display (accessor r)) (display ")") )
+  (pp r)
+  (pp-field 'hdc paintstruct/hdc)
+  (pp-field 'f-erase paintstruct/f-erase)
+  (pp-field 'rc-paint/left paintstruct/rc-paint/left)
+  (pp-field 'rc-paint/top paintstruct/rc-paint/top)
+  (pp-field 'rc-paint/right paintstruct/rc-paint/right)
+  (pp-field 'rc-paint/bottom paintstruct/rc-paint/bottom)
+  (pp-field 'f-restore paintstruct/f-restore)
+  (pp-field 'f-inc-update paintstruct/f-inc-update)
+)
+