⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 parserc.asm

📁 汇编资源编辑器
💻 ASM
📖 第 1 页 / 共 4 页
字号:

ConvY:
	cdq
	mov		ecx,fntht
	imul	ecx
	mov		ecx,buy
	imul	ecx
	mov		ecx,dfntht
	idiv	ecx
	cdq
	mov		ecx,8
	idiv	ecx
	retn

SnapY:
	mov		ecx,Gridcy
	.if sdword ptr eax>0
		add		eax,ecx
		dec		eax
	.else
		sub		eax,ecx
		inc		eax
	.endif
	cdq
	idiv	ecx
	imul	ecx
	retn

ConvertSize endp

ConvNum proc lpProMem:DWORD,lpBuff:DWORD

	mov		eax,lpBuff
	.if word ptr [eax]=='x0'
		add		eax,2
		invoke HexToBin,eax
	.elseif (byte ptr [eax]>='0' && byte ptr [eax]<='9') || byte ptr [eax]=='-'
		invoke ResEdDecToBin,eax
	.else
		invoke FindName,lpProMem,eax
	.endif
	ret

ConvNum endp

GetNum proc lpProMem:DWORD

	invoke GetWord,offset wordbuff,esi
	mov		ecx,eax
	invoke IsBegin,offset wordbuff
	or		eax,eax
	jz		Ex
	invoke IsEnd,offset wordbuff
	or		eax,eax
	jz		Ex
	add		esi,ecx
	invoke ConvNum,lpProMem,offset wordbuff
  Ex:
	ret

GetNum endp

FindStyle proc uses ebx esi,lpWord:DWORD,lpStyles:DWORD

	mov		esi,lpStyles
	.while byte ptr [esi+4]
		mov		ebx,[esi]
		invoke lstrcmp,addr [esi+4],lpWord
		.if !eax
			mov		eax,ebx
			jmp		Ex
		.endif
		invoke lstrlen,addr [esi+4]
		lea		esi,[esi+eax+4+1]
	.endw
	xor		eax,eax
  Ex:
	ret

FindStyle endp

GetStyle proc uses ebx esi edi,lpRCMem:DWORD,lpStyles:DWORD

	xor		ebx,ebx
	mov		esi,lpRCMem
	invoke GetWord,offset wordbuff,esi
	push	eax
	invoke lstrcmpi,offset wordbuff,offset szNOT
	pop		ecx
	.if !eax
		add		esi,ecx
		invoke GetWord,offset wordbuff,esi
		add		esi,eax
	.endif
	.while TRUE
		mov		edi,esi
		invoke GetWord,offset wordbuff,esi
		mov		ecx,eax
		invoke IsBegin,offset wordbuff
		or		eax,eax
		jz		Ex
		invoke IsEnd,offset wordbuff
		or		eax,eax
		jz		Ex
		add		esi,ecx
		push	edx
		.if word ptr wordbuff=='x0'
			invoke HexToBin,offset wordbuff+2
		.else
			invoke FindStyle,offset wordbuff,lpStyles
		.endif
		or		ebx,eax
		pop		edx
		.break .if dl==',' || dl==0Dh
	.endw
  Ex:
	mov		edx,ebx
	mov		eax,esi
	sub		eax,lpRCMem
	ret

GetStyle endp

ParseControl proc uses ebx esi edi,lpRCMem:DWORD,lpDlgMem:DWORD,nTab:DWORD,lpProMem:DWORD

	mov		esi,lpRCMem
	mov		edi,lpDlgMem
	;Flag handle
	mov		[edi].DIALOG.hwnd,TRUE
	;Tab
	mov		eax,nTab
	mov		[edi].DIALOG.tab,eax
	;Caption
	invoke GetWord,offset wordbuff,esi
	add		esi,eax
	invoke UnQuoteWord,offset wordbuff
	invoke lstrcpy,addr [edi].DIALOG.caption,offset wordbuff
	invoke GetWord,offset wordbuff,esi
	add		esi,eax
	invoke GetName,lpProMem,offset wordbuff,addr [edi].DIALOG.idname,addr [edi].DIALOG.id
	;Class
	invoke GetWord,offset namebuff,esi
	add		esi,eax
	invoke UnQuoteWord,offset namebuff
	;Style
	invoke GetStyle,esi,offset styledef
	add		esi,eax
	mov		[edi].DIALOG.style,edx
	;Pos & Size
	invoke GetNum,lpProMem
	mov		[edi].DIALOG.dux,eax
	mov		[edi].DIALOG.x,eax
	invoke GetNum,lpProMem
	mov		[edi].DIALOG.duy,eax
	mov		[edi].DIALOG.y,eax
	invoke GetNum,lpProMem
	mov		[edi].DIALOG.duccx,eax
	mov		[edi].DIALOG.ccx,eax
	invoke GetNum,lpProMem
	mov		[edi].DIALOG.duccy,eax
	mov		[edi].DIALOG.ccy,eax
	movzx	eax,byte ptr [esi]
	.if eax!=0Dh
		;ExStyle
		invoke GetStyle,esi,offset exstyledef
		add		esi,eax
		mov		[edi].DIALOG.exstyle,edx
		movzx	eax,byte ptr [esi]
		.if eax!=0Dh
			;HelpID
			invoke GetNum,lpProMem
		.endif
	.endif
	invoke lstrcmpi,offset namebuff,offset szEditClass
	.if !eax
		;Edit
		mov		[edi].DIALOG.ntype,1
		jmp		Ex
	.endif
	invoke lstrcmpi,offset namebuff,offset szStaticClass
	.if !eax
		;Static
		mov		eax,[edi].DIALOG.style
		and		eax,SS_TYPEMASK
		.if eax==SS_ICON || eax==SS_BITMAP
			;Image
			mov		[edi].DIALOG.ntype,17
		.elseif (eax>=SS_BLACKRECT && eax<=SS_WHITEFRAME) || (eax>=SS_ETCHEDHORZ && eax<=SS_ETCHEDFRAME) || eax==SS_OWNERDRAW
			;Shape
			mov		[edi].DIALOG.ntype,25
		.else
			;Static
			mov		[edi].DIALOG.ntype,2
		.endif
		jmp		Ex
	.endif
	invoke lstrcmpi,offset namebuff,offset szButtonClass
	.if !eax
		;Button
		mov		eax,[edi].DIALOG.style
		and		eax,0Fh
		mov		edx,4
		.if eax==BS_GROUPBOX
			mov		edx,3
		.elseif eax==BS_AUTOCHECKBOX
			mov		edx,5
		.elseif eax==BS_AUTORADIOBUTTON
			mov		edx,6
		.endif
		mov		[edi].DIALOG.ntype,edx
		jmp		Ex
	.endif
	invoke lstrcmpi,offset namebuff,offset szComboBoxClass
	.if !eax
		;ComboBox
		mov		[edi].DIALOG.ntype,7
		jmp		Ex
	.endif
	invoke lstrcmpi,offset namebuff,offset szListBoxClass
	.if !eax
		;ListBox
		mov		[edi].DIALOG.ntype,8
		jmp		Ex
	.endif
	invoke lstrcmpi,offset namebuff,offset szScrollBarClass
	.if !eax
		;ScrollBar
		mov		edx,[edi].DIALOG.style
		and		edx,SBS_VERT
		add		edx,9
		mov		[edi].DIALOG.ntype,edx
		jmp		Ex
	.endif
	invoke lstrcmpi,offset namebuff,offset szTabControlClass
	.if !eax
		;TabControl
		mov		[edi].DIALOG.ntype,11
		jmp		Ex
	.endif
	invoke lstrcmpi,offset namebuff,offset szProgressBarClass
	.if !eax
		;ProgressBar
		mov		[edi].DIALOG.ntype,12
		jmp		Ex
	.endif
	invoke lstrcmpi,offset namebuff,offset szTreeViewClass
	.if !eax
		;TreeView
		mov		[edi].DIALOG.ntype,13
		jmp		Ex
	.endif
	invoke lstrcmpi,offset namebuff,offset szListViewClass
	.if !eax
		;ListView
		mov		[edi].DIALOG.ntype,14
		jmp		Ex
	.endif
	invoke lstrcmpi,offset namebuff,offset szTrackBarClass
	.if !eax
		;TrackBar
		mov		[edi].DIALOG.ntype,15
		jmp		Ex
	.endif
	invoke lstrcmpi,offset namebuff,offset szUpDownClass
	.if !eax
		;UpDown
		mov		[edi].DIALOG.ntype,16
		jmp		Ex
	.endif
	invoke lstrcmpi,offset namebuff,offset szToolBarClass
	.if !eax
		;ToolBar
		mov		[edi].DIALOG.ntype,18
		jmp		Ex
	.endif
	invoke lstrcmpi,offset namebuff,offset szStatusBarClass
	.if !eax
		;StatusBar
		mov		[edi].DIALOG.ntype,19
		jmp		Ex
	.endif
	invoke lstrcmpi,offset namebuff,offset szDateTimeClass
	.if !eax
		;DateTime
		mov		[edi].DIALOG.ntype,20
		jmp		Ex
	.endif
	invoke lstrcmpi,offset namebuff,offset szMonthViewClass
	.if !eax
		;MonthView
		mov		[edi].DIALOG.ntype,21
		jmp		Ex
	.endif
	invoke lstrcmpi,offset namebuff,offset szRichEditClass
	.if !eax
		;RichEdit
		mov		[edi].DIALOG.ntype,22
		jmp		Ex
	.endif
	invoke lstrcmpi,offset namebuff,offset szComboBoxExClass
	.if !eax
		;ComboBoxEx
		mov		[edi].DIALOG.ntype,24
		jmp		Ex
	.endif
	invoke lstrcmpi,offset namebuff,offset szIPAddressClass
	.if !eax
		;IPAddress
		mov		[edi].DIALOG.ntype,26
		jmp		Ex
	.endif
	invoke lstrcmpi,offset namebuff,offset szAnimateClass
	.if !eax
		;AnimateControl
		mov		[edi].DIALOG.ntype,27
		jmp		Ex
	.endif
	invoke lstrcmpi,offset namebuff,offset szHotKeyClass
	.if !eax
		;HotKey
		mov		[edi].DIALOG.ntype,28
		jmp		Ex
	.endif
	invoke lstrcmpi,offset namebuff,offset szPagerClass
	.if !eax
		;PagerControl
		mov		edx,[edi].DIALOG.style
		and		edx,PGS_HORZ
		neg		edx
		add		edx,30
		mov		[edi].DIALOG.ntype,edx
		jmp		Ex
	.endif
	invoke lstrcmpi,offset namebuff,offset szReBarClass
	.if !eax
		;ReBar
		mov		[edi].DIALOG.ntype,31
		jmp		Ex
	.endif
	invoke lstrcmpi,offset namebuff,offset szHeaderClass
	.if !eax
		;Header
		mov		[edi].DIALOG.ntype,32
		jmp		Ex
	.endif
	mov		ebx,offset custtypes
	.while [ebx].TYPES.ID
		invoke lstrcmpi,offset namebuff,[ebx].TYPES.lpclass
		.if !eax
			;Custom control
			mov		eax,ebx
			sub		eax,offset custtypes
			mov		ecx,sizeof TYPES
			xor		edx,edx
			div		ecx
			add		eax,NoOfButtons
			mov		[edi].DIALOG.ntype,eax
			jmp		Ex
		.endif
		add		ebx,sizeof TYPES
	.endw
	;UserControl
	;Copy class to caption
	invoke lstrcpy,addr [edi].DIALOG.caption,offset namebuff
	mov		[edi].DIALOG.ntype,23
	jmp		Ex
  Ex:
	mov		eax,esi
	sub		eax,lpRCMem
	ret

ParseControl endp

ParseControlType proc uses esi edi,nType:DWORD,nStyle:DWORD,nExStyle:DWORD,lpRCMem:DWORD,lpDlgMem:DWORD,nTab:DWORD,lpProMem:DWORD

	mov		esi,lpRCMem
	mov		edi,lpDlgMem
	;Flag handle
	mov		[edi].DIALOG.hwnd,TRUE
	;Tab
	mov		eax,nTab
	mov		[edi].DIALOG.tab,eax
	;Type
	mov		eax,nType
	mov		[edi].DIALOG.ntype,eax
	;Style
	mov		eax,nStyle
	or		eax,WS_CHILD or WS_VISIBLE
	mov		[edi].DIALOG.style,eax
	mov		eax,nExStyle
	mov		[edi].DIALOG.exstyle,eax
	.if byte ptr [esi]=='"'
		;Caption
		invoke GetWord,offset wordbuff,esi
		add		esi,eax
		invoke UnQuoteWord,offset wordbuff
		invoke lstrcpy,addr [edi].DIALOG.caption,offset wordbuff
	.endif
	;Name / ID
	invoke GetWord,offset wordbuff,esi
	add		esi,eax
	invoke GetName,lpProMem,offset wordbuff,addr [edi].DIALOG.idname,addr [edi].DIALOG.id
	;Pos & Size
	invoke GetNum,lpProMem
	mov		[edi].DIALOG.dux,eax
	mov		[edi].DIALOG.x,eax
	invoke GetNum,lpProMem
	mov		[edi].DIALOG.duy,eax
	mov		[edi].DIALOG.y,eax
	invoke GetNum,lpProMem
	mov		[edi].DIALOG.duccx,eax
	mov		[edi].DIALOG.ccx,eax
	invoke GetNum,lpProMem
	mov		[edi].DIALOG.duccy,eax
	mov		[edi].DIALOG.ccy,eax
	movzx	eax,byte ptr [esi]
	.if eax!=0Dh
		;Style
		invoke GetStyle,esi,offset styledef
		add		esi,eax
		and		dword ptr [edi].DIALOG.style,0FFFF0000h			
		or		[edi].DIALOG.style,edx
		movzx	eax,byte ptr [esi]
		.if eax!=0Dh
			;ExStyle
			invoke GetStyle,esi,offset exstyledef
			add		esi,eax
			.if !edx
				mov		edx,nExStyle
			.endif
			mov		[edi].DIALOG.exstyle,edx
		.endif
	.endif
	mov		eax,[edi].DIALOG.style
	and		eax,SBS_VERT
	.if nType==9 && eax==SBS_VERT
		mov		[edi].DIALOG.ntype,10
	.endif
	mov		eax,esi
	sub		eax,lpRCMem
	ret

ParseControlType endp

ParseControls proc lpProMem:DWORD
	LOCAL	nTab:DWORD

	mov		nTab,-1
	lea		edi,[edi+sizeof DLGHEAD]
	xor		eax,eax
  Nxt:
	add		esi,eax
	add		edi,sizeof DIALOG
	inc		nTab
  @@:
	invoke GetWord,offset wordbuff,esi
	add		esi,eax
	invoke lstrcmpi,offset wordbuff,offset szCONTROL
	.if !eax
		invoke ParseControl,esi,edi,nTab,lpProMem
		jmp		Nxt
	.endif
	invoke lstrcmpi,offset wordbuff,offset szEDITTEXT
	.if !eax
		invoke ParseControlType,1,ES_LEFT or WS_TABSTOP,WS_EX_CLIENTEDGE,esi,edi,nTab,lpProMem
		jmp		Nxt
	.endif
	invoke lstrcmpi,offset wordbuff,offset szLTEXT
	.if !eax
		invoke ParseControlType,2,SS_LEFT or WS_GROUP,0,esi,edi,nTab,lpProMem
		jmp		Nxt
	.endif
	invoke lstrcmpi,offset wordbuff,offset szCTEXT
	.if !eax
		invoke ParseControlType,2,SS_CENTER or WS_GROUP,0,esi,edi,nTab,lpProMem
		jmp		Nxt
	.endif
	invoke lstrcmpi,offset wordbuff,offset szRTEXT
	.if !eax
		invoke ParseControlType,2,SS_RIGHT or WS_GROUP,0,esi,edi,nTab,lpProMem
		jmp		Nxt
	.endif
	invoke lstrcmpi,offset wordbuff,offset szICON
	.if !eax
		invoke ParseControlType,17,SS_ICON or SS_CENTERIMAGE,0,esi,edi,nTab,lpProMem
		jmp		Nxt
	.endif
	invoke lstrcmpi,offset wordbuff,offset szGROUPBOX
	.if !eax
		invoke ParseControlType,3,BS_GROUPBOX,0,esi,edi,nTab,lpProMem
		jmp		Nxt
	.endif
	invoke lstrcmpi,offset wordbuff,offset szPUSHBUTTON
	.if !eax
		invoke ParseControlType,4,BS_PUSHBUTTON or WS_TABSTOP,0,esi,edi,nTab,lpProMem
		jmp		Nxt
	.endif
	invoke lstrcmpi,offset wordbuff,offset szDEFPUSHBUTTON
	.if !eax
		invoke ParseControlType,4,BS_DEFPUSHBUTTON or WS_TABSTOP,0,esi,edi,nTab,lpProMem
		jmp		Nxt
	.endif
	invoke lstrcmpi,offset wordbuff,offset szAUTOCHECKBOX
	.if !eax
		invoke ParseControlType,5,BS_AUTOCHECKBOX or WS_TABSTOP,0,esi,edi,nTab,lpProMem
		jmp		Nxt
	.endif
	invoke lstrcmpi,offset wordbuff,offset szAUTORADIOBUTTON
	.if !eax
		invoke ParseControlType,6,BS_AUTORADIOBUTTON or WS_TABSTOP,0,esi,edi,nTab,lpProMem
		jmp		Nxt
	.endif
	invoke lstrcmpi,offset wordbuff,offset szCOMBOBOX
	.if !eax
		invoke ParseControlType,7,CBS_SIMPLE or WS_TABSTOP,0,esi,edi,nTab,lpProMem
		jmp		Nxt
	.endif
	invoke lstrcmpi,offset wordbuff,offset szLISTBOX
	.if !eax
		invoke ParseControlType,8,LBS_NOTIFY,WS_EX_CLIENTEDGE,esi,edi,nTab,lpProMem
		jmp		Nxt
	.endif
	invoke lstrcmpi,offset wordbuff,offset szSCROLLBAR
	.if !eax
		invoke ParseControlType,9,SBS_HORZ,0,esi,edi,nTab,lpProMem
		jmp		Nxt
	.endif
;	invoke lstrcmpi,offset wordbuff,offset sz
;	.if !eax
;		invoke ParseControlType,,,esi,edi,nTab,lpProMem
;		jmp		Nxt
;	.endif

	invoke lstrcmpi,offset wordbuff,offset szENDSHORT
	or		eax,eax
	je		Ex
	invoke lstrcmpi,offset wordbuff,offset szEND
	or		eax,eax

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -