;=========================================================================== ; ; Validation constants ; DCX_VALID_L equ 004fbh DCX_VALID_H equ 00001h WS_VALID_L equ 00000h WS_VALID_H equ 0ffffh WS_EX_VALID_L equ 07fffh WS_EX_VALID_H equ 00007h GND_VALID_L equ 00003h GND_VALID_H equ 00000h DT_VALID equ 0ffffh CS_VALID equ 07fefh SWP_VALID equ 03fffh QS_VALID equ 000ffh TPM_VALID equ 0000fh RDW_VALID equ 00fffh SW_VALID equ 08007h MB_VALID equ 0b377h IDC_VALID equ 00007h MF_VALID equ 04fffh MF_CHANGE_VALID equ 05fffh EV_VALID equ 03fffh SPIF_VALID equ 00003h DDL_VALID equ 0e03fh PM_VALID equ 00003h WPF_VALID equ 00003h SB_MAX equ 3 ESB_MAX equ 3 SB_CMD_MAX equ 8 SW_MAXIMIZE equ 3 SW_MAX equ 9 SM_MAX equ 80 CTLCOLOR_MAX equ 8 COLOR_MAX equ 20 GW_MAX equ 5 WH_MIN equ -1 WH_MAX equ 10 MSGF_MAX equ 7 SPI_MAX equ 65 PWR_MAX equ 3 HHOOK_MAGIC equ ('H' or ('K' * 256)) WS_CHILD equ 4000h ;======================================================================= ; ; GDI types ; IFNDEF WOW ; ExternFP ENDIF ; ; Generate a GDI object validation macro. ; ; If nullok is 1, allow NULL. ; min & max are the allowed OBJ_* range. ; except, if specified, is an OBJ_* value within the range to reject. ; _GenHGDI macro name,nullok,htype,min,max,except name ¯o hObj,opts local badobj local objok _GenParm ,2, if VLgen IFNDEF WOW if nullok mov cx,_P_&&hObj jcxz objok push cx else push _P_&&hObj endif ; call IsGDIObject ifnb cmp al,except jz badobj endif ife min-max cmp al,min je objok else cmp al,min jb badobj cmp al,max jbe objok endif badobj: mov ax,_P_&&hObj mov bx,ERR_BAD_&htype lcall Inval_Param_ objok: ENDIF endif &endm endm OBJ_PEN equ 1 OBJ_BRUSH equ 2 OBJ_FONT equ 3 OBJ_PALETTE equ 4 OBJ_BITMAP equ 5 OBJ_RGN equ 6 OBJ_DC equ 7 OBJ_IC equ 8 OBJ_DISABLED_DC equ 9 OBJ_METADC equ 10 OBJ_METAFILE equ 11 _GenHGDI ,0,HDC,OBJ_DC,OBJ_METAFILE _GenHGDI ,1,HDC,OBJ_DC,OBJ_METAFILE _GenHGDI ,0,HPEN,OBJ_PEN,OBJ_PEN _GenHGDI ,1,HPEN,OBJ_PEN,OBJ_PEN _GenHGDI ,0,HBRUSH,OBJ_BRUSH,OBJ_BRUSH _GenHGDI ,1,HBRUSH,OBJ_BRUSH,OBJ_BRUSH _GenHGDI ,0,HFONT,OBJ_FONT,OBJ_FONT _GenHGDI ,1,HFONT,OBJ_FONT,OBJ_FONT _GenHGDI ,0,HPALETTE,OBJ_PALETTE,OBJ_PALETTE _GenHGDI ,1,HPALETTE,OBJ_PALETTE,OBJ_PALETTE _GenHGDI ,0,HBITMAP,OBJ_BITMAP,OBJ_BITMAP _GenHGDI ,1,HBITMAP,OBJ_BITMAP,OBJ_BITMAP _GenHGDI ,0,HRGN,OBJ_RGN,OBJ_RGN _GenHGDI ,1,HRGN,OBJ_RGN,OBJ_RGN P_HBITMAP01 macro hbm,opts _GenParm ,2, if VLgen IFNDEF WOW mov ax, _P_&hbm cmp ax, 1 ; allow NULL or (HBITMAP)1 jbe @F push ax push ax ; call IsGDIObject cmp al, OBJ_BITMAP pop ax jz @F mov bx,ERR_BAD_HBITMAP lcall Inval_Param_ @@: ENDIF endif endm ;============================================================================ ; ; USER types ; ExternFP ExternFP sBegin TEXT ExternNP TEMPLY!!!! ChandanC sEnd TEXT sBegin DATA IFNDEF WOW ExternW ExternW ENDIF sEnd DATA DGROUP group _DATA P_HWND macro h,opts _GenParm ,2, if VLgen IFNDEF WOW mov bx,_P_&h lcall VHWND _gensub VHWND ENDIF endif endm P_HWND0 macro h,opts _GenParm ,2, if VLgen IFNDEF WOW mov bx,_P_&h lcall VHWND0 _gensub VHWND ENDIF endif endm P_HWNDNOFAIL macro h,opts _GenParm ,2, if VLgen IFNDEF WOW lea bx, _P_&h lcall VHWNDNOFAIL _gensub VHWNDNOFAIL @@: ENDIF endif endm P_HWNDNOFAIL0 macro h,opts _GenParm ,2, if VLgen IFNDEF WOW lea bx, _P_&h lcall VHWNDNOFAIL0 _gensub VHWNDNOFAIL @@: ENDIF endif endm P_HWNDINSERT macro h,opts _GenParm ,2, if VLgen IFNDEF WOW mov bx,_P_&h inc bx inc bx cmp bx,3 ; accept HWND_TOP (0), HWND_BOTTOM (1), jbe @F ; HWND_NOTOPMOST (0xfffe) HWND_TOPMOST (0xffff) dec bx dec bx lcall VHWND _gensub VHWND @@: ENDIF endif endm P_HWNDFFFF macro h,opts _GenParm ,2, if VLgen IFNDEF WOW mov bx,_P_&h inc bx ;; accept hwnd == 0xffff jz @F dec bx lcall VHWND _gensub VHWND @@: ENDIF endif endm P_HOOK_HK macro name,opts _GenParm ,4, if VLgen IFNDEF WOW mov ax,_P_&name+2 cmp ax, HHOOK_MAGIC ; magic for unhook jz @F mov ax,_P_&name mov cx,_P_&name+2 lcall LPFN _gensub LPFN @@: ENDIF endif endm ; ; CreateWindow and CreateWindowEx HMENU parameter. If WS_CHILD, then ; hMenu is an ID, else it's a menu handle. ; P_HMENU0CW macro style, x, y, cx, cy, hwndParent, hMenu, opts local hmenu0cw_exit _GenParm