-
Notifications
You must be signed in to change notification settings - Fork 3
/
RCDefines.asm
212 lines (185 loc) · 5.01 KB
/
RCDefines.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
.CODE
AddDefine Proc Uses ESI lpProMem:DWORD,lpName:DWORD,lpValue:DWORD
MOV ESI,lpProMem
.While [ESI].DEFINE.szName || [ESI].DEFINE.dwValue
ADD ESI,SizeOf DEFINE
.EndW
Invoke lstrcpyn,ADDR [ESI].DEFINE.szName,lpName,65
;INC [ESI].DEFINE.ReferenceCount ;<---------Look:Commented
MOV EAX,lpValue
.If WORD PTR [EAX]=='x0'
ADD EAX,2
Invoke HexToBin,EAX
.Else
Invoke DecToBin,EAX
.EndIf
MOV [ESI].DEFINE.dwValue,EAX
RET
AddDefine EndP
;UpdateDefines Proc Uses EDI EBX lpName:DWORD, dwValue:DWORD
;Local tvi :TVITEM
; MOV tvi._mask,TVIF_PARAM
;
; ;Get Resources (Bitmaps,Icons,etc)
; .If lpResourcesMem
; MOV EDI,lpResourcesMem
; .While [EDI].RESOURCEMEM.szFile
; Invoke lstrcmpi,lpName,ADDR [EDI].RESOURCEMEM.szName
; .If !EAX
; MOV EAX,dwValue
; MOV [EDI].RESOURCEMEM.Value,EAX
; .EndIf
; ADD EDI,SizeOf RESOURCEMEM
; .EndW
; .EndIf
;
;
; ;Get Menus
; ;---------
; .If hMenusParentItem
; Invoke SendMessage,hOthersTree,TVM_GETNEXTITEM,TVGN_CHILD,hMenusParentItem
; @@:
; ;----------
; .If EAX ;This is a Menu hItem
; ;PrintHex EAX
; MOV EBX,EAX
; MOV tvi.hItem,EBX
; Invoke SendMessage,hOthersTree,TVM_GETITEM,0,ADDR tvi
; MOV EDI,tvi.lParam; is the Menu memory
; ;PrintHex EDI
; Invoke lstrcmpi,lpName,ADDR [EDI].MNUHEAD.szMenuName
; ;PrintHex EAX
; LEA edx,[EDI].MNUHEAD.szMenuName
; PrintStringByAddr EDX
; .If !EAX
; MOV EAX,dwValue
; MOV [EDI].MNUHEAD.MenuID,EAX
; .EndIf
;
; ;Menu Items go here
; ADD EDI,SizeOf MNUHEAD
; .While [EDI].MNUITEM.Flag
; Invoke lstrcmpi,lpName,ADDR [EDI].MNUITEM.szName
; .If !EAX
; MOV EAX,dwValue
; MOV [EDI].MNUITEM.ID,EAX
; .EndIf
; ADD EDI,SizeOf MNUITEM
; .EndW
; ;Get the next menu
; Invoke SendMessage,hOthersTree,TVM_GETNEXTITEM,TVGN_NEXT,EBX
; JMP @B
; .EndIf
; .EndIf
;
;
; RET
;UpdateDefines EndP
;This is Add a new Define or Replace a deleted Define with a new one
AddOrReplaceDefine Proc Uses ESI lpName:DWORD, lpValue:DWORD
Local Buffer[256] :BYTE
MOV ESI,lpName
.If BYTE PTR [ESI]!=0 ;<----------------Very Important
;MOV bDefineChanged,FALSE
MOV ESI,lpDefinesMem
.While [ESI].DEFINE.szName || [ESI].DEFINE.dwValue
Invoke lstrcmpi,lpName,ADDR [ESI].DEFINE.szName
.If !EAX ;Already defined
.If [ESI].DEFINE.ReferenceCount
MOV EAX,lpValue
.If WORD PTR [EAX]=='x0'
ADD EAX,2
Invoke HexToBin,EAX
.Else
Invoke DecToBin,EAX
.EndIf
.If EAX!=[ESI].DEFINE.dwValue
PUSH EBX
LEA EBX,Buffer
Invoke lstrcpy,EBX,ADDR [ESI].DEFINE.szName
;" is already defined as "
Invoke lstrcat,EBX,Offset szIsAlreadyDefinedAs
Invoke lstrlen,EBX
ADD EAX,EBX
Invoke BinToDec,[ESI].DEFINE.dwValue,EAX
Invoke lstrlen,EBX
ADD EAX,EBX
;". Do you want to change it?"
Invoke lstrcat,EAX,Offset szDoYouWantToChangeIt
Invoke EnableAllDockWindows,FALSE
Invoke EnableWindow, hFind, FALSE
Invoke MessageBox,WinAsmHandles.hMain,EBX,Offset szAppName,MB_YESNO + MB_ICONWARNING + MB_TASKMODAL
POP EBX
PUSH EAX
Invoke EnableAllDockWindows,TRUE
Invoke EnableWindow, hFind, TRUE
POP EAX
.If EAX==IDYES
JMP SetValue
.EndIf
.EndIf
JMP Ex
.Else
JMP SetValue
.EndIf
.Else
ADD ESI,SizeOf DEFINE
.EndIf
.EndW
.While [ESI].DEFINE.szName || [ESI].DEFINE.dwValue
.If [ESI].DEFINE.ReferenceCount==0
.Break
.EndIf
ADD ESI,SizeOf DEFINE
.EndW
Invoke lstrcpyn,ADDR [ESI].DEFINE.szName,lpName,65
SetValue:
;--------
MOV EAX,lpValue
.If WORD PTR [EAX]=='x0'
ADD EAX,2
Invoke HexToBin,EAX
.Else
Invoke DecToBin,EAX
.EndIf
MOV [ESI].DEFINE.dwValue,EAX
Ex:
INC [ESI].DEFINE.ReferenceCount
.EndIf
RET
AddOrReplaceDefine EndP
DeleteDefine Proc Uses ESI lpName:DWORD;,lpValue:DWORD
MOV ESI,lpDefinesMem
.While [ESI].DEFINE.szName || [ESI].DEFINE.dwValue
Invoke lstrcmp,lpName,ADDR [ESI].DEFINE.szName
.If !EAX && [ESI].DEFINE.ReferenceCount
MOV EDX,[ESI].DEFINE.ReferenceCount
DEC [ESI].DEFINE.ReferenceCount
.Break
.EndIf
ADD ESI,SizeOf DEFINE
.EndW
RET
DeleteDefine EndP
ParseDefine Proc Uses ESI lpRCMem:DWORD,lpProMem:DWORD
MOV ESI,lpRCMem
Invoke GetWord,Offset NameBuffer,ESI
ADD ESI,EAX
Invoke GetWord,Offset ThisWord,ESI
;Do not add EAX to ESI YET
;ADD ESI,EAX
.If (ThisWord[0] < "0" || ThisWord[0] > "9") && ThisWord[0]!="-"
;Since there are VALID define statements that don't have numerical part
;then : DO NOT add NameBuffer to the defines memory
;PrintText "This is not a number"
;XOR EAX,EAX
;RET
.Else
;This is considered to be a vaild Define statement that has a numerical part too
ADD ESI,EAX
Invoke AddDefine,lpProMem,Offset NameBuffer,Offset ThisWord
.EndIf
MOV EAX,ESI
SUB EAX,lpRCMem
RET
ParseDefine EndP