1 | #include "../BasicCompiler_Common/common.h"
|
---|
2 |
|
---|
3 | //デバッグ用
|
---|
4 | #include "../BasicCompiler_Common/debug.h"
|
---|
5 |
|
---|
6 | //変数リストのツリーハンドル
|
---|
7 | HWND hVarTree_Global,hVarTree_Local,hVarTree_This;
|
---|
8 |
|
---|
9 | int VarList_Array(HWND hVarTree,HTREEITEM hParent,LONG_PTR offset,int type,int *SubScripts,LONG_PTR lpIndex);
|
---|
10 | void VarList_Member(HWND hVarTree,HTREEITEM hParent,LONG_PTR pTopOffset,CClass *pobj_c,BOOL bPtr);
|
---|
11 | void VarList_Insert(HWND hVarTree,TV_INSERTSTRUCT *lptv,char *VarName,int type,LONG_PTR offset,LONG_PTR lpIndex){
|
---|
12 | extern HANDLE hDebugProcess;
|
---|
13 | int i2;
|
---|
14 | char temporary[255],temp2[255];
|
---|
15 | LONG_PTR pData;
|
---|
16 | SIZE_T stAccBytes;
|
---|
17 | double dbl;
|
---|
18 | float flt;
|
---|
19 | WORD wData;
|
---|
20 | BYTE byteData;
|
---|
21 | HTREEITEM hParent;
|
---|
22 | _int64 i64data;
|
---|
23 |
|
---|
24 | if(type==DEF_OBJECT){
|
---|
25 | sprintf(lptv->item.pszText,"%s %s(&H%X)",VarName,STRING_OBJECT,(DWORD64)offset);
|
---|
26 | lptv->item.iImage=1;
|
---|
27 | lptv->item.iSelectedImage=1;
|
---|
28 | hParent=TreeView_InsertItem(hVarTree,lptv);
|
---|
29 |
|
---|
30 | VarList_Member(hVarTree,hParent,offset,(CClass *)lpIndex,0);
|
---|
31 | return;
|
---|
32 | }
|
---|
33 | if(type==DEF_PTR_OBJECT){
|
---|
34 | i2=ReadProcessMemory(hDebugProcess,(void *)offset,&pData,sizeof(void *),&stAccBytes);
|
---|
35 |
|
---|
36 | sprintf(lptv->item.pszText,"%s %s(&H%X)",VarName,STRING_POINTEROFOBJECT,(DWORD64)pData);
|
---|
37 | lptv->item.iImage=4;
|
---|
38 | lptv->item.iSelectedImage=4;
|
---|
39 | hParent=TreeView_InsertItem(hVarTree,lptv);
|
---|
40 |
|
---|
41 | if(i2) VarList_Member(hVarTree,hParent,pData,(CClass *)lpIndex,1);
|
---|
42 | return;
|
---|
43 | }
|
---|
44 | else{
|
---|
45 | if(type==DEF_PTR_BYTE){
|
---|
46 | if(ReadProcessMemory(hDebugProcess,(void *)offset,&pData,sizeof(void *),&stAccBytes)){
|
---|
47 | for(i2=0;;i2++){
|
---|
48 | if(!ReadProcessMemory(hDebugProcess,(void *)(pData+i2),&temporary[i2],1,&stAccBytes)){
|
---|
49 | i2=-1;
|
---|
50 | break;
|
---|
51 | }
|
---|
52 | if(temporary[i2]=='\0') break;
|
---|
53 | if(i2==64){
|
---|
54 | lstrcpy(temporary+i2,"...");
|
---|
55 | break;
|
---|
56 | }
|
---|
57 | }
|
---|
58 | if(i2==-1) sprintf(lptv->item.pszText,"%s %d(&H%X)",VarName,(DWORD64)pData,(DWORD64)pData);
|
---|
59 | else sprintf(lptv->item.pszText,"%s %d(&H%X) \"%s\"",VarName,(DWORD64)pData,(DWORD64)pData,temporary);
|
---|
60 | }
|
---|
61 | else sprintf(lptv->item.pszText,"%s %s",VarName,STRING_CANNOTACCESS);
|
---|
62 | }
|
---|
63 | else if(type==DEF_DOUBLE){
|
---|
64 | if(ReadProcessMemory(hDebugProcess,(void *)offset,&dbl,sizeof(double),&stAccBytes)){
|
---|
65 | sprintf(lptv->item.pszText,"%s %.15g",VarName,dbl);
|
---|
66 | }
|
---|
67 | else sprintf(lptv->item.pszText,"%s %s",VarName,STRING_CANNOTACCESS);
|
---|
68 | }
|
---|
69 | else if(type==DEF_SINGLE){
|
---|
70 | if(ReadProcessMemory(hDebugProcess,(void *)offset,&flt,sizeof(float),&stAccBytes)){
|
---|
71 | sprintf(lptv->item.pszText,"%s %.6g",VarName,flt);
|
---|
72 | }
|
---|
73 | else sprintf(lptv->item.pszText,"%s %s",VarName,STRING_CANNOTACCESS);
|
---|
74 | }
|
---|
75 | else if(type==DEF_INT64){
|
---|
76 | _int64 i64data;
|
---|
77 | if(ReadProcessMemory(hDebugProcess,(void *)offset,&i64data,sizeof(_int64),&stAccBytes)){
|
---|
78 | _i64toa(i64data,temporary,10);
|
---|
79 | _i64toa(i64data,temp2,16);
|
---|
80 | CharUpper(temp2);
|
---|
81 | sprintf(lptv->item.pszText,"%s %s(&H%s)",VarName,temporary,temp2);
|
---|
82 | }
|
---|
83 | else sprintf(lptv->item.pszText,"%s %s",VarName,STRING_CANNOTACCESS);
|
---|
84 | }
|
---|
85 | else if(type==DEF_QWORD||IsPtrType(type)){
|
---|
86 | if(ReadProcessMemory(hDebugProcess,(void *)offset,&i64data,sizeof(_int64),&stAccBytes)){
|
---|
87 | _ui64toa(i64data,temporary,10);
|
---|
88 | _ui64toa(i64data,temp2,16);
|
---|
89 | CharUpper(temp2);
|
---|
90 | sprintf(lptv->item.pszText,"%s %s(&H%s)",VarName,temporary,temp2);
|
---|
91 | }
|
---|
92 | else sprintf(lptv->item.pszText,"%s %s",VarName,STRING_CANNOTACCESS);
|
---|
93 | }
|
---|
94 | else if(type==DEF_LONG){
|
---|
95 | if(ReadProcessMemory(hDebugProcess,(void *)offset,&i64data,sizeof(_int64),&stAccBytes)){
|
---|
96 | sprintf(lptv->item.pszText,"%s %d(&H%X)",VarName,i64data,i64data);
|
---|
97 | }
|
---|
98 | else sprintf(lptv->item.pszText,"%s %s",VarName,STRING_CANNOTACCESS);
|
---|
99 | }
|
---|
100 | else if(type==DEF_DWORD){
|
---|
101 | if(ReadProcessMemory(hDebugProcess,(void *)offset,&i64data,sizeof(_int64),&stAccBytes)){
|
---|
102 | sprintf(lptv->item.pszText,"%s %u(&H%X)",VarName,i64data,i64data);
|
---|
103 | }
|
---|
104 | else sprintf(lptv->item.pszText,"%s %s",VarName,STRING_CANNOTACCESS);
|
---|
105 | }
|
---|
106 | else if(type==DEF_INTEGER){
|
---|
107 | if(ReadProcessMemory(hDebugProcess,(void *)offset,&wData,sizeof(WORD),&stAccBytes)){
|
---|
108 | sprintf(lptv->item.pszText,"%s %d(&H%X)",VarName,(short)wData,(short)wData);
|
---|
109 | }
|
---|
110 | else sprintf(lptv->item.pszText,"%s %s",VarName,STRING_CANNOTACCESS);
|
---|
111 | }
|
---|
112 | else if(type==DEF_WORD){
|
---|
113 | if(ReadProcessMemory(hDebugProcess,(void *)offset,&wData,sizeof(WORD),&stAccBytes)){
|
---|
114 | sprintf(lptv->item.pszText,"%s %u(&H%X)",VarName,wData,wData);
|
---|
115 | }
|
---|
116 | else sprintf(lptv->item.pszText,"%s %s",VarName,STRING_CANNOTACCESS);
|
---|
117 | }
|
---|
118 | else if(type==DEF_CHAR){
|
---|
119 | if(ReadProcessMemory(hDebugProcess,(void *)offset,&byteData,sizeof(BYTE),&stAccBytes)){
|
---|
120 | temporary[0]=byteData;
|
---|
121 | temporary[1]=0;
|
---|
122 | sprintf(lptv->item.pszText,"%s %d(&H%X)'%s'",VarName,(char)byteData,byteData,temporary);
|
---|
123 | }
|
---|
124 | else sprintf(lptv->item.pszText,"%s %s",VarName,STRING_CANNOTACCESS);
|
---|
125 | }
|
---|
126 | else if(type==DEF_BYTE){
|
---|
127 | if(ReadProcessMemory(hDebugProcess,(void *)offset,&byteData,sizeof(BYTE),&stAccBytes)){
|
---|
128 | temporary[0]=byteData;
|
---|
129 | temporary[1]=0;
|
---|
130 | sprintf(lptv->item.pszText,"%s %d(&H%X)'%s'",VarName,byteData,byteData,temporary);
|
---|
131 | }
|
---|
132 | else sprintf(lptv->item.pszText,"%s %s",VarName,STRING_CANNOTACCESS);
|
---|
133 | }
|
---|
134 | lptv->item.iImage=2;
|
---|
135 | lptv->item.iSelectedImage=2;
|
---|
136 | }
|
---|
137 | TreeView_InsertItem(hVarTree,lptv);
|
---|
138 | }
|
---|
139 | void VarList_Member(HWND hVarTree,HTREEITEM hParent,LONG_PTR pTopOffset,CClass *pobj_c,BOOL bPtr){
|
---|
140 | int i,i2;
|
---|
141 | char VarData[VN_SIZE],VarName[VN_SIZE];
|
---|
142 | TV_INSERTSTRUCT tv;
|
---|
143 |
|
---|
144 | memset(&tv,0,sizeof(TV_INSERTSTRUCT));
|
---|
145 | tv.hInsertAfter=TVI_LAST;
|
---|
146 | tv.item.mask=TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
|
---|
147 | tv.hParent=hParent;
|
---|
148 | tv.item.pszText=VarData;
|
---|
149 |
|
---|
150 | for(i=0;i<pobj_c->iMemberNum;i++){
|
---|
151 | if(bPtr){
|
---|
152 | lstrcpy(VarName,"->");
|
---|
153 | lstrcat(VarName,pobj_c->ppobj_Member[i]->name);
|
---|
154 | }
|
---|
155 | else{
|
---|
156 | lstrcpy(VarName,".");
|
---|
157 | lstrcat(VarName,pobj_c->ppobj_Member[i]->name);
|
---|
158 | }
|
---|
159 |
|
---|
160 | LONG_PTR offset;
|
---|
161 | offset=GetSizeOfClassMember(pobj_c,pobj_c->ppobj_Member[i]->name,&i2);
|
---|
162 |
|
---|
163 | if(pobj_c->ppobj_Member[i]->SubScripts[0]!=-1){
|
---|
164 | //構造体内の配列
|
---|
165 | sprintf(VarData,"%s %s(&H%X)",VarName,STRING_ARRAY,pTopOffset+offset);
|
---|
166 | tv.item.iImage=0;
|
---|
167 | tv.item.iSelectedImage=0;
|
---|
168 | hParent=TreeView_InsertItem(hVarTree,&tv);
|
---|
169 |
|
---|
170 | i2=VarList_Array(hVarTree,hParent,
|
---|
171 | pTopOffset+offset,
|
---|
172 | pobj_c->ppobj_Member[i]->TypeInfo.type,
|
---|
173 | pobj_c->ppobj_Member[i]->SubScripts,
|
---|
174 | pobj_c->ppobj_Member[i]->TypeInfo.u.lpIndex);
|
---|
175 | }
|
---|
176 | else{
|
---|
177 | //メンバ変数
|
---|
178 | VarList_Insert(hVarTree,
|
---|
179 | &tv,
|
---|
180 | VarName,
|
---|
181 | pobj_c->ppobj_Member[i]->TypeInfo.type,
|
---|
182 | pTopOffset+offset,
|
---|
183 | pobj_c->ppobj_Member[i]->TypeInfo.u.lpIndex);
|
---|
184 | }
|
---|
185 | }
|
---|
186 | }
|
---|
187 | int VarList_Array(HWND hVarTree,HTREEITEM hParent,LONG_PTR offset,int type,int *SubScripts,LONG_PTR lpIndex){
|
---|
188 | int i,i2,i3,ElementNum,MemCounter,UseCount[255],TypeSize;
|
---|
189 | char temporary[VN_SIZE],temp2[DIGIT_SIZE];
|
---|
190 |
|
---|
191 | TV_INSERTSTRUCT tv;
|
---|
192 | memset(&tv,0,sizeof(TV_INSERTSTRUCT));
|
---|
193 | tv.hInsertAfter=TVI_LAST;
|
---|
194 | tv.item.mask=TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
|
---|
195 | tv.hParent=hParent;
|
---|
196 | tv.item.pszText=temporary;
|
---|
197 |
|
---|
198 | TypeSize=GetTypeSize(type,lpIndex);
|
---|
199 |
|
---|
200 | for(i=0;i<255;i++){
|
---|
201 | if(SubScripts[i]==-1) break;
|
---|
202 | UseCount[i]=0;
|
---|
203 | }
|
---|
204 | UseCount[i]=-2;
|
---|
205 | MemCounter=0;
|
---|
206 | while(1){
|
---|
207 | UseCount[i]++;
|
---|
208 | for(ElementNum=0;SubScripts[i-ElementNum]<UseCount[i-ElementNum];ElementNum++){
|
---|
209 | UseCount[i-ElementNum]=0;
|
---|
210 | if(i-ElementNum-1<0) return MemCounter;
|
---|
211 | UseCount[i-ElementNum-1]++;
|
---|
212 | }
|
---|
213 |
|
---|
214 | if(MemCounter<50){
|
---|
215 | temporary[0]='[';
|
---|
216 | temporary[1]=0;
|
---|
217 | for(i2=0;i2<i;i2++){
|
---|
218 | sprintf(temp2,"%d",UseCount[i2]);
|
---|
219 | lstrcat(temporary,temp2);
|
---|
220 | lstrcat(temporary,",");
|
---|
221 | }
|
---|
222 | i3=lstrlen(temporary);
|
---|
223 | temporary[i3-1]=']';
|
---|
224 | temporary[i3]=0;
|
---|
225 |
|
---|
226 | VarList_Insert(hVarTree,&tv,temporary,type,
|
---|
227 | offset+MemCounter*TypeSize,
|
---|
228 | lpIndex);
|
---|
229 | }
|
---|
230 |
|
---|
231 | MemCounter++;
|
---|
232 | if(MemCounter==50){
|
---|
233 | lstrcpy(tv.item.pszText,"...");
|
---|
234 | TreeView_InsertItem(hVarTree,&tv);
|
---|
235 | }
|
---|
236 | }
|
---|
237 | return 0;
|
---|
238 | }
|
---|
239 | void RefreshGlobalVar(void){
|
---|
240 | extern DWORD ImageBase;
|
---|
241 | int i;
|
---|
242 | char temporary[VN_SIZE];
|
---|
243 | TV_INSERTSTRUCT tv;
|
---|
244 | HTREEITEM hParent;
|
---|
245 |
|
---|
246 | TreeView_DeleteAllItems(hVarTree_Global);
|
---|
247 |
|
---|
248 | memset(&tv,0,sizeof(TV_INSERTSTRUCT));
|
---|
249 | tv.hInsertAfter=TVI_LAST;
|
---|
250 | tv.item.mask=TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
|
---|
251 | tv.hParent=TVI_ROOT;
|
---|
252 | tv.item.pszText=temporary;
|
---|
253 |
|
---|
254 | extern HANDLE hDebugProcess;
|
---|
255 | extern int MemPos_RWSection;
|
---|
256 | extern int MaxGlobalVarNum;
|
---|
257 | extern VARIABLE *GlobalVar;
|
---|
258 |
|
---|
259 | for(i=0;i<MaxGlobalVarNum;i++){
|
---|
260 | VARIABLE *pVar=&GlobalVar[i];
|
---|
261 |
|
---|
262 | //スコープ外の場合は無視
|
---|
263 | if(pVar->ScopeLevel!=0){
|
---|
264 | if(rva_to_real(pVar->ScopeStartAddress) <= pobj_dti->lplpObp[0] &&
|
---|
265 | pobj_dti->lplpObp[0] < rva_to_real(pVar->ScopeEndAddress)){
|
---|
266 | //範囲内
|
---|
267 | }
|
---|
268 | else{
|
---|
269 | //範囲外
|
---|
270 | continue;
|
---|
271 | }
|
---|
272 | }
|
---|
273 |
|
---|
274 |
|
---|
275 | if(!pobj_nv->bShow_DefaultSystem_Var){
|
---|
276 | if(memcmp(pVar->name,"_System_",8)==0||
|
---|
277 | memcmp(pVar->name,"_DebugSys_",10)==0||
|
---|
278 | memcmp(pVar->name,"_PromptSys_",11)==0) continue;
|
---|
279 | }
|
---|
280 | if(!pobj_nv->bShow_Rad_Var){
|
---|
281 | if(memcmp(pVar->name,"_RadSys_",8)==0) continue;
|
---|
282 | }
|
---|
283 | if(!pobj_nv->bShow_GUID_Var){
|
---|
284 | if(memcmp(pVar->name,"GUID_",5)==0||
|
---|
285 | memcmp(pVar->name,"IID_",4)==0||
|
---|
286 | memcmp(pVar->name,"CLSID_",6)==0) continue;
|
---|
287 | }
|
---|
288 |
|
---|
289 | //静的メンバ
|
---|
290 | if(strstr(pVar->name,".")) continue;
|
---|
291 |
|
---|
292 | if(pVar->bArray){
|
---|
293 | sprintf(temporary,"%s %s(&H%X)",
|
---|
294 | pVar->name,
|
---|
295 | STRING_ARRAY,
|
---|
296 | ImageBase+MemPos_RWSection+pVar->offset);
|
---|
297 | tv.item.iImage=0;
|
---|
298 | tv.item.iSelectedImage=0;
|
---|
299 | hParent=TreeView_InsertItem(hVarTree_Global,&tv);
|
---|
300 |
|
---|
301 | VarList_Array(hVarTree_Global,hParent,
|
---|
302 | (LONG_PTR)(ImageBase+MemPos_RWSection+pVar->offset),
|
---|
303 | pVar->type,
|
---|
304 | pVar->SubScripts,
|
---|
305 | pVar->u.index);
|
---|
306 | }
|
---|
307 | else{
|
---|
308 | VarList_Insert(hVarTree_Global,
|
---|
309 | &tv,
|
---|
310 | pVar->name,
|
---|
311 | pVar->type,
|
---|
312 | (LONG_PTR)(ImageBase+MemPos_RWSection+pVar->offset),
|
---|
313 | pVar->u.index);
|
---|
314 | }
|
---|
315 | }
|
---|
316 | }
|
---|
317 | void RefreshLocalVar(void){
|
---|
318 | int i,i2,i3,sw;
|
---|
319 | char temporary[VN_SIZE];
|
---|
320 | TV_INSERTSTRUCT tv;
|
---|
321 | HTREEITEM hParent;
|
---|
322 | LONG_PTR offset;
|
---|
323 | SIZE_T stAccBytes;
|
---|
324 | LONG_PTR lpData;
|
---|
325 |
|
---|
326 | TreeView_DeleteAllItems(hVarTree_Local);
|
---|
327 |
|
---|
328 | memset(&tv,0,sizeof(TV_INSERTSTRUCT));
|
---|
329 | tv.hInsertAfter=TVI_LAST;
|
---|
330 | tv.item.mask=TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
|
---|
331 | tv.hParent=TVI_ROOT;
|
---|
332 | tv.item.pszText=temporary;
|
---|
333 |
|
---|
334 | extern HANDLE hDebugProcess;
|
---|
335 | extern HWND hDebugWnd;
|
---|
336 | i2=(int)SendDlgItemMessage(hDebugWnd,IDC_PROCCOMBO,CB_GETCURSEL,0,0);
|
---|
337 | i2=pobj_dti->iProcLevel-i2;
|
---|
338 |
|
---|
339 | if(pobj_dti->lplpSpBase[i2]==0) return;
|
---|
340 |
|
---|
341 | extern SUBINFO **ppSubHash;
|
---|
342 | SUBINFO *psi;
|
---|
343 | for(i3=0,sw=0;i3<MAX_HASH;i3++){
|
---|
344 | psi=ppSubHash[i3];
|
---|
345 | while(psi){
|
---|
346 | if(rva_to_real(psi->CompileAddress) <= pobj_dti->lplpObp[i2] &&
|
---|
347 | pobj_dti->lplpObp[i2] < rva_to_real(psi->EndOpAddr)){
|
---|
348 | sw=1;
|
---|
349 | break;
|
---|
350 | }
|
---|
351 |
|
---|
352 | psi=psi->pNextData;
|
---|
353 | }
|
---|
354 | if(sw) break;
|
---|
355 | }
|
---|
356 | if(!psi) return;
|
---|
357 |
|
---|
358 | for(i=0;i<psi->VarNum;i++){
|
---|
359 | VARIABLE *pVar=&psi->pVar[i];
|
---|
360 |
|
---|
361 | //スコープ外の場合は無視
|
---|
362 | if(pVar->ScopeLevel!=0){
|
---|
363 | if(rva_to_real(pVar->ScopeStartAddress) <= pobj_dti->lplpObp[i2] &&
|
---|
364 | pobj_dti->lplpObp[i2] < rva_to_real(pVar->ScopeEndAddress)){
|
---|
365 | //範囲内
|
---|
366 | }
|
---|
367 | else{
|
---|
368 | //範囲外
|
---|
369 | continue;
|
---|
370 | }
|
---|
371 | }
|
---|
372 |
|
---|
373 | if(pVar->bArray){
|
---|
374 | sprintf(temporary,"%s %s(&H%X)",
|
---|
375 | pVar->name,
|
---|
376 | STRING_ARRAY,
|
---|
377 | pobj_dti->lplpSpBase[i2]+pVar->offset);
|
---|
378 | tv.item.iImage=0;
|
---|
379 | tv.item.iSelectedImage=0;
|
---|
380 | hParent=TreeView_InsertItem(hVarTree_Local,&tv);
|
---|
381 |
|
---|
382 | VarList_Array(hVarTree_Local,hParent,
|
---|
383 | pobj_dti->lplpSpBase[i2]+pVar->offset,
|
---|
384 | pVar->type,
|
---|
385 | pVar->SubScripts,
|
---|
386 | pVar->u.index);
|
---|
387 | }
|
---|
388 | else{
|
---|
389 | offset=pobj_dti->lplpSpBase[i2]+pVar->offset;
|
---|
390 | if(pVar->fRef){
|
---|
391 | ReadProcessMemory(hDebugProcess,(void *)offset,&lpData,sizeof(LONG_PTR),&stAccBytes);
|
---|
392 | offset=lpData;
|
---|
393 | }
|
---|
394 | VarList_Insert(hVarTree_Local,&tv,
|
---|
395 | pVar->name,
|
---|
396 | pVar->type,
|
---|
397 | offset,
|
---|
398 | pVar->u.index);
|
---|
399 | }
|
---|
400 | }
|
---|
401 |
|
---|
402 |
|
---|
403 |
|
---|
404 | /////////////////////////////
|
---|
405 | // Thisオブジェクトのリスト
|
---|
406 | /////////////////////////////
|
---|
407 |
|
---|
408 | TreeView_DeleteAllItems(hVarTree_This);
|
---|
409 | if(!psi->pobj_ParentClass) return;
|
---|
410 |
|
---|
411 | //Thisポインタを取得
|
---|
412 | LONG_PTR pThis;
|
---|
413 | for(i=0;i<psi->VarNum;i++){
|
---|
414 | if(lstrcmp(psi->pVar[i].name,"_System_LocalThis")==0) break;
|
---|
415 | }
|
---|
416 | if(i==psi->VarNum) return;
|
---|
417 | lpData=pobj_dti->lplpSpBase[i2]+psi->pVar[i].offset;
|
---|
418 | ReadProcessMemory(hDebugProcess,(void *)lpData,&pThis,sizeof(LONG_PTR),&stAccBytes);
|
---|
419 |
|
---|
420 | for(i=0;i<psi->pobj_ParentClass->iMemberNum;i++){
|
---|
421 | offset=GetSizeOfClassMember(psi->pobj_ParentClass,psi->pobj_ParentClass->ppobj_Member[i]->name,&i2);
|
---|
422 |
|
---|
423 | if(psi->pobj_ParentClass->ppobj_Member[i]->SubScripts[0]!=-1){
|
---|
424 | //配列
|
---|
425 | sprintf(temporary,"%s %s(&H%X)",
|
---|
426 | psi->pobj_ParentClass->ppobj_Member[i]->name,
|
---|
427 | STRING_ARRAY,
|
---|
428 | (DWORD64)offset);
|
---|
429 | tv.item.iImage=0;
|
---|
430 | tv.item.iSelectedImage=0;
|
---|
431 | hParent=TreeView_InsertItem(hVarTree_This,&tv);
|
---|
432 |
|
---|
433 | VarList_Array(hVarTree_This,hParent,
|
---|
434 | pThis+offset,
|
---|
435 | psi->pobj_ParentClass->ppobj_Member[i]->TypeInfo.type,
|
---|
436 | psi->pobj_ParentClass->ppobj_Member[i]->SubScripts,
|
---|
437 | psi->pobj_ParentClass->ppobj_Member[i]->TypeInfo.u.lpIndex);
|
---|
438 | }
|
---|
439 | else{
|
---|
440 | VarList_Insert(hVarTree_This,&tv,
|
---|
441 | psi->pobj_ParentClass->ppobj_Member[i]->name,
|
---|
442 | psi->pobj_ParentClass->ppobj_Member[i]->TypeInfo.type,
|
---|
443 | pThis+offset,
|
---|
444 | psi->pobj_ParentClass->ppobj_Member[i]->TypeInfo.u.lpIndex);
|
---|
445 | }
|
---|
446 | }
|
---|
447 | }
|
---|
448 | void RefreshGlobalVar_with_WindowLock(void){
|
---|
449 | extern HWND hDebugWnd;
|
---|
450 |
|
---|
451 | //処理時間を短くするため、一時的に非表示にする
|
---|
452 | LockWindowUpdate(hDebugWnd);
|
---|
453 | ShowWindow(GetParent(hVarTree_Global),SW_HIDE);
|
---|
454 |
|
---|
455 | //リフレッシュ
|
---|
456 | RefreshGlobalVar();
|
---|
457 |
|
---|
458 | LockWindowUpdate(NULL);
|
---|
459 | ShowWindow(GetParent(hVarTree_Global),SW_SHOW);
|
---|
460 | }
|
---|
461 | void RefreshLocalVar_with_WindowLock(void){
|
---|
462 | extern HWND hDebugWnd;
|
---|
463 |
|
---|
464 | //処理時間を短くするため、一時的に非表示にする
|
---|
465 | LockWindowUpdate(hDebugWnd);
|
---|
466 | ShowWindow(GetParent(hVarTree_Local),SW_HIDE);
|
---|
467 |
|
---|
468 | //リフレッシュ
|
---|
469 | RefreshLocalVar();
|
---|
470 |
|
---|
471 | LockWindowUpdate(NULL);
|
---|
472 | ShowWindow(GetParent(hVarTree_Local),SW_SHOW);
|
---|
473 | }
|
---|
474 |
|
---|
475 | void SetCalcToWatchList(HWND hListView,int iItem,char *buffer){
|
---|
476 | int i;
|
---|
477 | char temporary[255],temp2[255];
|
---|
478 |
|
---|
479 | //エスケープシーケンスをセット
|
---|
480 | SetEscapeSequenceFormat(buffer);
|
---|
481 |
|
---|
482 | KillStringSpaces(buffer);
|
---|
483 |
|
---|
484 | //カッコを相互チェック
|
---|
485 | if(!CheckParenthesis2(buffer)){
|
---|
486 | ListView_SetItemText(hListView,iItem,1,"式の解析に失敗");
|
---|
487 | return;
|
---|
488 | }
|
---|
489 |
|
---|
490 | double dbl;
|
---|
491 | _int64 i64data;
|
---|
492 | i=StaticCalculation(true, buffer,0,&i64data,0,1);
|
---|
493 | if(IsRealNumberType(i)){
|
---|
494 | memcpy(&dbl,&i64data,sizeof(double));
|
---|
495 | }
|
---|
496 |
|
---|
497 | if(i==0){
|
---|
498 | ListView_SetItemText(hListView,iItem,1,"式の解析に失敗");
|
---|
499 | }
|
---|
500 | else if(i==-1){
|
---|
501 | ListView_SetItemText(hListView,iItem,1,"アクセスできません");
|
---|
502 | }
|
---|
503 | else{
|
---|
504 | if(IsRealNumberType(i))
|
---|
505 | sprintf(temporary,"%.15g (&H%08X)",dbl,(int)dbl);
|
---|
506 | else if(Is64Type(i)){
|
---|
507 | _i64toa(i64data,temporary,10);
|
---|
508 | _i64toa(i64data,temp2,16);
|
---|
509 | CharUpper(temp2);
|
---|
510 | sprintf(temporary+lstrlen(temporary)," (&H%s)",temp2);
|
---|
511 | }
|
---|
512 | else sprintf(temporary,"%d (&H%08X)",(long)i64data,(long)i64data);
|
---|
513 |
|
---|
514 | ListView_SetItemText(hListView,iItem,1,temporary);
|
---|
515 | }
|
---|
516 | }
|
---|
517 | void RefreshWatchList(void){
|
---|
518 | extern HWND hDebugWnd;
|
---|
519 | HWND hListView;
|
---|
520 | int i,i2;
|
---|
521 | char temporary[VN_SIZE];
|
---|
522 |
|
---|
523 | hListView=GetDlgItem(hDebugWnd,IDC_WATCHLIST);
|
---|
524 | i2=ListView_GetItemCount(hListView);
|
---|
525 | for(i=0;i<i2-1;i++){
|
---|
526 | ListView_GetItemText(hListView,i,0,temporary,VN_SIZE);
|
---|
527 |
|
---|
528 | //演算結果を表示
|
---|
529 | SetCalcToWatchList(hListView,i,temporary);
|
---|
530 | }
|
---|
531 | }
|
---|
532 |
|
---|
533 | BOOL SetDebugProcCombo(HWND hProcCombo){
|
---|
534 | int i2,i3;
|
---|
535 | char temporary[255];
|
---|
536 |
|
---|
537 | extern DWORD ImageBase;
|
---|
538 | extern int MemPos_CodeSection;
|
---|
539 |
|
---|
540 | //行番号情報
|
---|
541 | extern int MaxLineInfoNum;
|
---|
542 | extern LINEINFO *pLineInfo;
|
---|
543 | for(i3=0;i3<(int)pobj_dti->iProcLevel+1;i3++){
|
---|
544 | for(i2=0;i2<MaxLineInfoNum-1;i2++){
|
---|
545 | if((DWORD64)(pLineInfo[i2].TopObp+ImageBase+MemPos_CodeSection)<=pobj_dti->lplpObp[i3]&&
|
---|
546 | pobj_dti->lplpObp[i3]<=(DWORD64)(pLineInfo[i2+1].TopObp+ImageBase+MemPos_CodeSection)) break;
|
---|
547 | }
|
---|
548 | if(i2==MaxLineInfoNum) pobj_dti->lpdwCp[i3]=-1;
|
---|
549 | else pobj_dti->lpdwCp[i3]=pLineInfo[i2].TopCp;
|
---|
550 | }
|
---|
551 | for(i3=0;i3<(int)pobj_dti->iProcLevel+1;i3++){
|
---|
552 | if(pobj_dti->lpdwCp[i3]==-1){
|
---|
553 | pobj_dti->iProcLevel--;
|
---|
554 | for(i2=i3;i2<(int)pobj_dti->iProcLevel+1;i2++){
|
---|
555 | pobj_dti->lplpObp[i2]=pobj_dti->lplpObp[i2+1];
|
---|
556 | pobj_dti->lplpSpBase[i2]=pobj_dti->lplpSpBase[i2+1];
|
---|
557 | pobj_dti->lpdwCp[i2]=pobj_dti->lpdwCp[i2+1];
|
---|
558 | }
|
---|
559 | i3--;
|
---|
560 | continue;
|
---|
561 | }
|
---|
562 | }
|
---|
563 |
|
---|
564 | if(!GetLineNum(pobj_dti->lpdwCp[pobj_dti->iProcLevel],&i2,temporary)){
|
---|
565 | extern HWND hMainDlg;
|
---|
566 | //"デバッグ情報の取得に失敗"
|
---|
567 | MessageBox(hMainDlg,STRING_DEBUG_FAILED,"ActiveBasic error",MB_OK);
|
---|
568 | return 0;
|
---|
569 | }
|
---|
570 | ShowErrorLine(i2,temporary);
|
---|
571 |
|
---|
572 | //プロシージャ コンボボックス
|
---|
573 | extern SUBINFO **ppSubHash;
|
---|
574 | SUBINFO *psi;
|
---|
575 | int sw;
|
---|
576 | SendMessage(hProcCombo,CB_RESETCONTENT,0,0);
|
---|
577 | for(i2=pobj_dti->iProcLevel;i2>=0;i2--){
|
---|
578 | for(i3=0,sw=0;i3<MAX_HASH;i3++){
|
---|
579 | psi=ppSubHash[i3];
|
---|
580 | while(psi){
|
---|
581 | if(rva_to_real(psi->CompileAddress) <= pobj_dti->lplpObp[i2] &&
|
---|
582 | pobj_dti->lplpObp[i2] < rva_to_real(psi->EndOpAddr)){
|
---|
583 | lstrcpy(temporary,psi->name);
|
---|
584 | sw=1;
|
---|
585 | break;
|
---|
586 | }
|
---|
587 | psi=psi->pNextData;
|
---|
588 | }
|
---|
589 | if(sw) break;
|
---|
590 | }
|
---|
591 | if(!psi){
|
---|
592 | if(i2==0){
|
---|
593 | lstrcpy(temporary,"Global");
|
---|
594 | pobj_dti->lplpSpBase[i2]=0;
|
---|
595 | }
|
---|
596 | else lstrcpy(temporary,"error");
|
---|
597 | }
|
---|
598 | SendMessage(hProcCombo,CB_ADDSTRING,0,(LPARAM)temporary);
|
---|
599 | }
|
---|
600 | SendMessage(hProcCombo,CB_SETCURSEL,0,0);
|
---|
601 |
|
---|
602 | return pobj_dti->iProcLevel;
|
---|
603 | }
|
---|
604 |
|
---|
605 | //IDC_THREADCOMBOプロシージャ
|
---|
606 | LRESULT CALLBACK ThreadComboProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
|
---|
607 | extern WNDPROC OldThreadComboProc;
|
---|
608 | int i2;
|
---|
609 | DWORD dwThreadID;
|
---|
610 | char temporary[255];
|
---|
611 |
|
---|
612 | switch(message){
|
---|
613 | case WM_COMMAND:
|
---|
614 | if(HIWORD(wParam)==CBN_SELCHANGE){
|
---|
615 | SendMessage(hwnd,CB_GETLBTEXT,SendMessage(hwnd,CB_GETCURSEL,0,0),(LPARAM)temporary);
|
---|
616 | sscanf(temporary+2,"%X",&dwThreadID);
|
---|
617 |
|
---|
618 | extern DWORD _DebugSys_dwThreadID[256];
|
---|
619 | i2=0;
|
---|
620 | while(_DebugSys_dwThreadID[i2]!=dwThreadID) i2++;
|
---|
621 |
|
---|
622 | //次回のステップ実行対象を指定
|
---|
623 | extern int NextStepThreadNum;
|
---|
624 | NextStepThreadNum=i2;
|
---|
625 |
|
---|
626 | //スレッド情報をリフレッシュ
|
---|
627 | pobj_dti->Reflesh(i2);
|
---|
628 |
|
---|
629 | SetDebugProcCombo(GetDlgItem(GetParent(hwnd),IDC_PROCCOMBO));
|
---|
630 |
|
---|
631 | SendDlgItemMessage(GetParent(hwnd),IDC_PROCCOMBO,WM_COMMAND,MAKELONG(0,CBN_SELCHANGE),0);
|
---|
632 | }
|
---|
633 | break;
|
---|
634 | }
|
---|
635 | return CallWindowProc(OldThreadComboProc,hwnd,message,wParam,lParam);
|
---|
636 | }
|
---|
637 | //IDC_PROCCOMBOプロシージャ
|
---|
638 | LRESULT CALLBACK ProcComboProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
|
---|
639 | extern WNDPROC OldProcComboProc;
|
---|
640 | int i2,i3;
|
---|
641 | char temporary[MAX_PATH];
|
---|
642 |
|
---|
643 | switch(message){
|
---|
644 | case WM_COMMAND:
|
---|
645 | if(HIWORD(wParam)==CBN_SELCHANGE){
|
---|
646 | i2=(int)SendMessage(hwnd,CB_GETCURSEL,0,0);
|
---|
647 | GetLineNum(pobj_dti->lpdwCp[pobj_dti->iProcLevel-i2],&i3,temporary);
|
---|
648 | ShowErrorLine(i3,temporary);
|
---|
649 |
|
---|
650 | RefreshLocalVar_with_WindowLock();
|
---|
651 | }
|
---|
652 | break;
|
---|
653 | }
|
---|
654 | return CallWindowProc(OldProcComboProc,hwnd,message,wParam,lParam);
|
---|
655 | }
|
---|
656 | void InitVarList(DWORD dwThreadId){
|
---|
657 | extern HWND hDebugWnd;
|
---|
658 | int i2,i3,i5;
|
---|
659 | char temporary[255];
|
---|
660 |
|
---|
661 |
|
---|
662 | //スレッド
|
---|
663 | SendDlgItemMessage(hDebugWnd,IDC_THREADCOMBO,CB_RESETCONTENT,0,0);
|
---|
664 | extern DWORD _DebugSys_dwThreadID[256];
|
---|
665 | for(i2=0;i2<256;i2++){
|
---|
666 | if(_DebugSys_dwThreadID[i2]){
|
---|
667 | sprintf(temporary,"&H%08X",_DebugSys_dwThreadID[i2]);
|
---|
668 | SendDlgItemMessage(hDebugWnd,IDC_THREADCOMBO,CB_ADDSTRING,0,(LPARAM)temporary);
|
---|
669 | if(_DebugSys_dwThreadID[i2]==dwThreadId){
|
---|
670 | extern int NextStepThreadNum;
|
---|
671 | NextStepThreadNum=i2;
|
---|
672 | }
|
---|
673 | }
|
---|
674 | }
|
---|
675 | sprintf(temporary,"&H%08X",dwThreadId);
|
---|
676 | i5=(int)SendDlgItemMessage(hDebugWnd,IDC_THREADCOMBO,CB_FINDSTRING,0,(LPARAM)temporary);
|
---|
677 | SendDlgItemMessage(hDebugWnd,IDC_THREADCOMBO,CB_SETCURSEL,i5,0);
|
---|
678 |
|
---|
679 | i2=SetDebugProcCombo(GetDlgItem(hDebugWnd,IDC_PROCCOMBO));
|
---|
680 |
|
---|
681 |
|
---|
682 | ///////////////////////////////////////////////
|
---|
683 | // 実行中のプロシージャのローカル変数をセット
|
---|
684 | ///////////////////////////////////////////////
|
---|
685 |
|
---|
686 | extern VARIABLE *LocalVar;
|
---|
687 | extern int MaxLocalVarNum;
|
---|
688 | int sw;
|
---|
689 |
|
---|
690 | MaxLocalVarNum=0;
|
---|
691 |
|
---|
692 | i2=(int)SendDlgItemMessage(hDebugWnd,IDC_PROCCOMBO,CB_GETCURSEL,0,0);
|
---|
693 | i2=pobj_dti->iProcLevel-i2;
|
---|
694 |
|
---|
695 | if(pobj_dti->lplpSpBase[i2]){
|
---|
696 | extern SUBINFO **ppSubHash;
|
---|
697 | SUBINFO *psi;
|
---|
698 | for(i3=0,sw=0;i3<MAX_HASH;i3++){
|
---|
699 | psi=ppSubHash[i3];
|
---|
700 | while(psi){
|
---|
701 | if(rva_to_real(psi->CompileAddress) <= pobj_dti->lplpObp[i2] &&
|
---|
702 | pobj_dti->lplpObp[i2] < rva_to_real(psi->EndOpAddr)){
|
---|
703 | sw=1;
|
---|
704 | break;
|
---|
705 | }
|
---|
706 |
|
---|
707 | psi=psi->pNextData;
|
---|
708 | }
|
---|
709 | if(sw) break;
|
---|
710 | }
|
---|
711 |
|
---|
712 |
|
---|
713 | if(psi){
|
---|
714 | LocalVar=psi->pVar;
|
---|
715 | MaxLocalVarNum=psi->VarNum;
|
---|
716 |
|
---|
717 | pobj_CompilingClass=psi->pobj_ParentClass;
|
---|
718 | }
|
---|
719 | }
|
---|
720 |
|
---|
721 |
|
---|
722 | ////////////////////////
|
---|
723 | // 変数リストを再表示
|
---|
724 | ////////////////////////
|
---|
725 |
|
---|
726 | //処理時間を短くするため、一時的に非表示にする
|
---|
727 | LockWindowUpdate(hDebugWnd);
|
---|
728 | ShowWindow(GetParent(hVarTree_Global),SW_HIDE);
|
---|
729 | ShowWindow(GetDlgItem(hDebugWnd,IDC_WATCHLIST),SW_HIDE);
|
---|
730 |
|
---|
731 | //リフレッシュ
|
---|
732 | RefreshLocalVar();
|
---|
733 | RefreshGlobalVar();
|
---|
734 | RefreshWatchList();
|
---|
735 |
|
---|
736 | LockWindowUpdate(NULL);
|
---|
737 | ShowWindow(GetParent(hVarTree_Global),SW_SHOW);
|
---|
738 | ShowWindow(GetDlgItem(hDebugWnd,IDC_WATCHLIST),SW_SHOW);
|
---|
739 | }
|
---|
740 |
|
---|
741 |
|
---|
742 |
|
---|
743 |
|
---|
744 | //////////////////////////////////////
|
---|
745 | // エディタに埋め込み表示のデバッガ
|
---|
746 | //////////////////////////////////////
|
---|
747 |
|
---|
748 | BOOL CALLBACK DebuggerButtonsProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
|
---|
749 | extern HINSTANCE hInst;
|
---|
750 | extern DWORD dwStepRun;
|
---|
751 |
|
---|
752 | //デバッガ用ツールバー
|
---|
753 | #define BMPNUM_DEBUGGERTOOLBAR 3
|
---|
754 | #define BTNNUM_DEBUGGERTOOLBAR 4
|
---|
755 | TBBUTTON DebuggerToolBar[]={
|
---|
756 | {0,IDC_DEBUG_START,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},
|
---|
757 | {0,0,TBSTATE_ENABLED,TBSTYLE_SEP,0,0},
|
---|
758 | {1,IDC_DEBUG_STEPOVER,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},
|
---|
759 | {2,IDC_DEBUG_STEPIN,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0},
|
---|
760 | };
|
---|
761 | TOOLTIPTEXT *pTipText;
|
---|
762 |
|
---|
763 | static HIMAGELIST hImageList,hImageList_Disabled;
|
---|
764 |
|
---|
765 | switch(message){
|
---|
766 | case WM_INITDIALOG:
|
---|
767 | //ツールバーを生成
|
---|
768 | extern HWND hDebuggerToolbar;
|
---|
769 | hDebuggerToolbar=CreateToolbarEx(hwnd,WS_CHILD|WS_VISIBLE|CCS_NODIVIDER|TBSTYLE_FLAT|TBSTYLE_TOOLTIPS|WS_CLIPSIBLINGS,
|
---|
770 | NULL,
|
---|
771 | 0,0,0,
|
---|
772 | DebuggerToolBar,
|
---|
773 | BTNNUM_DEBUGGERTOOLBAR, /*アイテムの個数*/
|
---|
774 | 0,0,16,15,sizeof(TBBUTTON));
|
---|
775 |
|
---|
776 | hImageList = ImageList_LoadImage(hInst, MAKEINTRESOURCE(IDR_DEBUGGERTOOLBAR),
|
---|
777 | 16, 0, RGB(192,192,192),IMAGE_BITMAP, LR_CREATEDIBSECTION);
|
---|
778 | SendMessage(hDebuggerToolbar, TB_SETIMAGELIST, 0, (LPARAM)hImageList);
|
---|
779 | hImageList_Disabled = ImageList_LoadImage(hInst, MAKEINTRESOURCE(IDR_DEBUGGERTOOLBAR_DISABLED),
|
---|
780 | 16, 0, RGB(192,192,192),IMAGE_BITMAP, LR_CREATEDIBSECTION);
|
---|
781 | SendMessage(hDebuggerToolbar, TB_SETDISABLEDIMAGELIST, 0, (LPARAM)hImageList_Disabled);
|
---|
782 |
|
---|
783 | break;
|
---|
784 | case WM_COMMAND:
|
---|
785 | switch(LOWORD(wParam)){
|
---|
786 | case IDC_DEBUG_START:
|
---|
787 | DestroyWindow(GetParent(hwnd));
|
---|
788 | return 1;
|
---|
789 | case IDC_DEBUG_STEPIN:
|
---|
790 | dwStepRun=1;
|
---|
791 | return 1;
|
---|
792 | case IDC_DEBUG_STEPOVER:
|
---|
793 | dwStepRun=2;
|
---|
794 | return 1;
|
---|
795 | }
|
---|
796 | break;
|
---|
797 | case WM_NOTIFY:
|
---|
798 | pTipText=(TOOLTIPTEXT *)lParam;
|
---|
799 | if(pTipText->hdr.code==TTN_NEEDTEXT){
|
---|
800 | //ツールチップを表示
|
---|
801 | switch(pTipText->hdr.idFrom){
|
---|
802 | case IDC_DEBUG_START:
|
---|
803 | pTipText->lpszText="実行";
|
---|
804 | break;
|
---|
805 | case IDC_DEBUG_STEPOVER:
|
---|
806 | pTipText->lpszText="ステップ アウト";
|
---|
807 | break;
|
---|
808 | case IDC_DEBUG_STEPIN:
|
---|
809 | pTipText->lpszText="ステップ イン";
|
---|
810 | break;
|
---|
811 | }
|
---|
812 | }
|
---|
813 | break;
|
---|
814 | case WM_SIZE:
|
---|
815 | MoveWindow(hDebuggerToolbar,0,0,LOWORD(lParam),HIWORD(lParam),1);
|
---|
816 | return 1;
|
---|
817 |
|
---|
818 | case WM_DESTROY:
|
---|
819 | ImageList_Destroy(hImageList);
|
---|
820 | ImageList_Destroy(hImageList_Disabled);
|
---|
821 | return 1;
|
---|
822 | }
|
---|
823 | return 0;
|
---|
824 | }
|
---|
825 |
|
---|
826 | WNDPROC OldTabProc;
|
---|
827 | LRESULT CALLBACK TabProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
|
---|
828 | extern HINSTANCE hInst;
|
---|
829 |
|
---|
830 | static HMENU hDummyMenu,hMenu=0;
|
---|
831 |
|
---|
832 | switch(message){
|
---|
833 | case WM_CONTEXTMENU:
|
---|
834 | if(hMenu==0){
|
---|
835 | hDummyMenu=LoadMenu(hInst,MAKEINTRESOURCE(IDR_DEBUGGER_VARLIST_MENU));
|
---|
836 | hMenu=GetSubMenu(hDummyMenu,0);
|
---|
837 | }
|
---|
838 |
|
---|
839 | MENUITEMINFO mi;
|
---|
840 | mi.cbSize=sizeof(MENUITEMINFO);
|
---|
841 | mi.fMask=MIIM_STATE;
|
---|
842 | mi.fState=MFS_CHECKED;
|
---|
843 |
|
---|
844 | if(pobj_nv->bShow_DefaultSystem_Var)
|
---|
845 | SetMenuItemInfo(hMenu,IDM_SHOW_DEFAULTSYSTEM_VAR,0,&mi);
|
---|
846 | if(pobj_nv->bShow_Rad_Var)
|
---|
847 | SetMenuItemInfo(hMenu,IDM_SHOW_RAD_VAR,0,&mi);
|
---|
848 | if(pobj_nv->bShow_GUID_Var)
|
---|
849 | SetMenuItemInfo(hMenu,IDM_SHOW_GUID_VAR,0,&mi);
|
---|
850 |
|
---|
851 | TrackPopupMenu(hMenu,TPM_LEFTALIGN,LOWORD(lParam),HIWORD(lParam),0,hwnd,0);
|
---|
852 |
|
---|
853 | break;
|
---|
854 | case WM_COMMAND:
|
---|
855 | mi.cbSize=sizeof(MENUITEMINFO);
|
---|
856 | mi.fMask=MIIM_STATE;
|
---|
857 | switch(LOWORD(wParam)){
|
---|
858 | case IDM_SHOW_DEFAULTSYSTEM_VAR:
|
---|
859 | if(pobj_nv->bShow_DefaultSystem_Var){
|
---|
860 | pobj_nv->bShow_DefaultSystem_Var=0;
|
---|
861 | mi.fState=MFS_UNCHECKED;
|
---|
862 | }
|
---|
863 | else{
|
---|
864 | pobj_nv->bShow_DefaultSystem_Var=1;
|
---|
865 | mi.fState=MFS_CHECKED;
|
---|
866 | }
|
---|
867 | SetMenuItemInfo(hMenu,IDM_SHOW_DEFAULTSYSTEM_VAR,0,&mi);
|
---|
868 | RefreshGlobalVar_with_WindowLock();
|
---|
869 | break;
|
---|
870 | case IDM_SHOW_RAD_VAR:
|
---|
871 | if(pobj_nv->bShow_Rad_Var){
|
---|
872 | pobj_nv->bShow_Rad_Var=0;
|
---|
873 | mi.fState=MFS_UNCHECKED;
|
---|
874 | }
|
---|
875 | else{
|
---|
876 | pobj_nv->bShow_Rad_Var=1;
|
---|
877 | mi.fState=MFS_CHECKED;
|
---|
878 | }
|
---|
879 | SetMenuItemInfo(hMenu,IDM_SHOW_RAD_VAR,0,&mi);
|
---|
880 | RefreshGlobalVar_with_WindowLock();
|
---|
881 | break;
|
---|
882 | case IDM_SHOW_GUID_VAR:
|
---|
883 | if(pobj_nv->bShow_GUID_Var){
|
---|
884 | pobj_nv->bShow_GUID_Var=0;
|
---|
885 | mi.fState=MFS_UNCHECKED;
|
---|
886 | }
|
---|
887 | else{
|
---|
888 | pobj_nv->bShow_GUID_Var=1;
|
---|
889 | mi.fState=MFS_CHECKED;
|
---|
890 | }
|
---|
891 | SetMenuItemInfo(hMenu,IDM_SHOW_GUID_VAR,0,&mi);
|
---|
892 | RefreshGlobalVar_with_WindowLock();
|
---|
893 | break;
|
---|
894 | }
|
---|
895 | break;
|
---|
896 | case WM_DESTROY:
|
---|
897 | DestroyMenu(hMenu);
|
---|
898 | hMenu=0;
|
---|
899 | break;
|
---|
900 | }
|
---|
901 | return CallWindowProc(OldTabProc,hwnd,message,wParam,lParam);
|
---|
902 | }
|
---|
903 |
|
---|
904 | BOOL CALLBACK DlgDebugger(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
|
---|
905 | extern HANDLE hHeap;
|
---|
906 | extern HINSTANCE hInst;
|
---|
907 | extern DWORD dwStepRun;
|
---|
908 | extern double width_ratio_VarList;
|
---|
909 | RECT rect;
|
---|
910 | int i,i2,i3;
|
---|
911 | char temporary[VN_SIZE];
|
---|
912 | LV_DISPINFO *lvinfo;
|
---|
913 | LVITEM ListView_Item;
|
---|
914 |
|
---|
915 | static POINT pos_VarList;
|
---|
916 | static POINT pos_WatchList;
|
---|
917 |
|
---|
918 | switch(message){
|
---|
919 | case WM_INITDIALOG:
|
---|
920 | extern HWND hDebugWnd;
|
---|
921 | hDebugWnd=hwnd;
|
---|
922 |
|
---|
923 | //変数リストの初期位置を取得
|
---|
924 | GetWindowRect(GetDlgItem(hwnd,IDC_VARPOS),&rect);
|
---|
925 | pos_VarList.x=rect.left;
|
---|
926 | pos_VarList.y=rect.top;
|
---|
927 | ScreenToClient(hwnd,&pos_VarList);
|
---|
928 |
|
---|
929 | //ウォッチリストの初期位置を取得
|
---|
930 | pos_WatchList.x=pos_VarList.x+(rect.right-rect.left)+LEVER_THICK;
|
---|
931 | pos_WatchList.y=0;
|
---|
932 |
|
---|
933 | //ツールバーのベースウィンドウを生成
|
---|
934 | static HWND hBase_ToolBar;
|
---|
935 | hBase_ToolBar=CreateDialog(hInst,MAKEINTRESOURCE(IDD_DEBUGGER_TOOLBARBASE),hwnd,(DLGPROC)DebuggerButtonsProc);
|
---|
936 | MoveWindow(hBase_ToolBar,50,0,20*BTNNUM_DEBUGGERTOOLBAR,22,1);
|
---|
937 |
|
---|
938 | extern WNDPROC OldThreadComboProc;
|
---|
939 | OldThreadComboProc=(WNDPROC)GetWindowLongPtr(GetDlgItem(hwnd,IDC_THREADCOMBO),GWLP_WNDPROC);
|
---|
940 | SetWindowLongPtr(GetDlgItem(hwnd,IDC_THREADCOMBO),GWLP_WNDPROC,(LONG_PTR)ThreadComboProc);
|
---|
941 |
|
---|
942 | extern WNDPROC OldProcComboProc;
|
---|
943 | OldProcComboProc=(WNDPROC)GetWindowLongPtr(GetDlgItem(hwnd,IDC_PROCCOMBO),GWLP_WNDPROC);
|
---|
944 | SetWindowLongPtr(GetDlgItem(hwnd,IDC_PROCCOMBO),GWLP_WNDPROC,(LONG_PTR)ProcComboProc);
|
---|
945 |
|
---|
946 |
|
---|
947 | ///////////////////////////
|
---|
948 | // タブコントロールを生成
|
---|
949 | ///////////////////////////
|
---|
950 |
|
---|
951 | static HWND hTab;
|
---|
952 | HFONT hFont;
|
---|
953 | hFont=(HFONT)SendMessage(hwnd,WM_GETFONT,0,0);
|
---|
954 | hTab=CreateWindow(WC_TABCONTROL,NULL,
|
---|
955 | WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE,
|
---|
956 | 0,0,0,0,hwnd,0,hInst,0);
|
---|
957 | SendMessage(hTab,WM_SETFONT,(WPARAM)hFont,0);
|
---|
958 | OldTabProc=(WNDPROC)GetWindowLongPtr(hTab,GWLP_WNDPROC);
|
---|
959 | SetWindowLongPtr(hTab,GWLP_WNDPROC,(LONG_PTR)TabProc);
|
---|
960 |
|
---|
961 | //タブを設定
|
---|
962 | TC_ITEM tcItem;
|
---|
963 | tcItem.mask=TCIF_TEXT;
|
---|
964 | tcItem.pszText="グローバル";
|
---|
965 | SendMessage(hTab,TCM_INSERTITEM,0,(LPARAM)&tcItem);
|
---|
966 | tcItem.mask=TCIF_TEXT;
|
---|
967 | tcItem.pszText="ローカル";
|
---|
968 | SendMessage(hTab,TCM_INSERTITEM,1,(LPARAM)&tcItem);
|
---|
969 | tcItem.mask=TCIF_TEXT;
|
---|
970 | tcItem.pszText="This";
|
---|
971 | SendMessage(hTab,TCM_INSERTITEM,2,(LPARAM)&tcItem);
|
---|
972 |
|
---|
973 | //グローバル変数リストのツリーを作成
|
---|
974 | hVarTree_Global=CreateWindowEx(WS_EX_CLIENTEDGE,WC_TREEVIEW,"",
|
---|
975 | WS_CHILD|TVS_HASLINES|TVS_HASBUTTONS|TVS_LINESATROOT|TVS_SHOWSELALWAYS,
|
---|
976 | 0,0,0,0,
|
---|
977 | hTab,0,hInst,0);
|
---|
978 |
|
---|
979 | //ローカル変数リストのツリーを作成
|
---|
980 | hVarTree_Local=CreateWindowEx(WS_EX_CLIENTEDGE,WC_TREEVIEW,"",
|
---|
981 | WS_CHILD|TVS_HASLINES|TVS_HASBUTTONS|TVS_LINESATROOT|TVS_SHOWSELALWAYS,
|
---|
982 | 0,0,0,0,
|
---|
983 | hTab,0,hInst,0);
|
---|
984 |
|
---|
985 | //This変数リストのツリーを作成
|
---|
986 | hVarTree_This=CreateWindowEx(WS_EX_CLIENTEDGE,WC_TREEVIEW,"",
|
---|
987 | WS_CHILD|TVS_HASLINES|TVS_HASBUTTONS|TVS_LINESATROOT|TVS_SHOWSELALWAYS,
|
---|
988 | 0,0,0,0,
|
---|
989 | hTab,0,hInst,0);
|
---|
990 |
|
---|
991 | ShowWindow(hVarTree_Global,SW_SHOW);
|
---|
992 |
|
---|
993 |
|
---|
994 | //イメージリスト読み込み、設定
|
---|
995 | static HIMAGELIST hVariOrderImageList;
|
---|
996 | hVariOrderImageList=ImageList_Create(16,16,ILC_COLOR4|ILC_MASK,4,0);
|
---|
997 | ImageList_AddIcon(hVariOrderImageList,LoadIcon(hInst,MAKEINTRESOURCE(IDI_VARARRAY)));
|
---|
998 | ImageList_AddIcon(hVariOrderImageList,LoadIcon(hInst,MAKEINTRESOURCE(IDI_VARSTRUCT)));
|
---|
999 | ImageList_AddIcon(hVariOrderImageList,LoadIcon(hInst,MAKEINTRESOURCE(IDI_VARDATA)));
|
---|
1000 | ImageList_AddIcon(hVariOrderImageList,LoadIcon(hInst,MAKEINTRESOURCE(IDI_VARSTR)));
|
---|
1001 | ImageList_AddIcon(hVariOrderImageList,LoadIcon(hInst,MAKEINTRESOURCE(IDI_VARPTRSTRUCT)));
|
---|
1002 | TreeView_SetImageList(hVarTree_Global,hVariOrderImageList,TVSIL_NORMAL);
|
---|
1003 | TreeView_SetImageList(hVarTree_Local,hVariOrderImageList,TVSIL_NORMAL);
|
---|
1004 | TreeView_SetImageList(hVarTree_This,hVariOrderImageList,TVSIL_NORMAL);
|
---|
1005 |
|
---|
1006 |
|
---|
1007 | /////////////////////////
|
---|
1008 | // ウォッチリスト
|
---|
1009 | /////////////////////////
|
---|
1010 |
|
---|
1011 | //コラムの設定
|
---|
1012 | static HWND hListView;
|
---|
1013 | LV_COLUMN ListView_Column;
|
---|
1014 | DWORD dwStyle;
|
---|
1015 |
|
---|
1016 | hListView=GetDlgItem(hwnd,IDC_WATCHLIST);
|
---|
1017 | GetClientRect(hListView,&rect);
|
---|
1018 | dwStyle=ListView_GetExtendedListViewStyle(hListView);
|
---|
1019 | dwStyle|=LVS_EX_FULLROWSELECT;
|
---|
1020 | ListView_SetExtendedListViewStyle(hListView,dwStyle);
|
---|
1021 |
|
---|
1022 | ListView_Column.mask=LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
|
---|
1023 | ListView_Column.fmt=LVCFMT_LEFT;
|
---|
1024 |
|
---|
1025 | extern int width_WatchColumn_Expression;
|
---|
1026 | ListView_Column.cx=width_WatchColumn_Expression;
|
---|
1027 | ListView_Column.pszText="ウォッチ式";
|
---|
1028 | ListView_Column.iSubItem=0;
|
---|
1029 | ListView_InsertColumn(hListView,0,&ListView_Column);
|
---|
1030 |
|
---|
1031 | extern int width_WatchColumn_Value;
|
---|
1032 | ListView_Column.cx=width_WatchColumn_Value;
|
---|
1033 | ListView_Column.pszText="値";
|
---|
1034 | ListView_Column.iSubItem=1;
|
---|
1035 | ListView_InsertColumn(hListView,1,&ListView_Column);
|
---|
1036 |
|
---|
1037 | //アイテムの設定
|
---|
1038 | ListView_Item.mask=LVIF_TEXT;
|
---|
1039 | ListView_Item.iSubItem=0;
|
---|
1040 | for(i=0;i<pobj_nv->WatchNum;i++){
|
---|
1041 | ListView_Item.pszText=pobj_nv->ppWatchStr[i];
|
---|
1042 | ListView_Item.iItem=i;
|
---|
1043 | ListView_InsertItem(hListView,&ListView_Item);
|
---|
1044 | }
|
---|
1045 | ListView_Item.pszText="...";
|
---|
1046 | ListView_Item.iItem=i;
|
---|
1047 | ListView_InsertItem(hListView,&ListView_Item);
|
---|
1048 |
|
---|
1049 |
|
---|
1050 | ///////////////////////
|
---|
1051 | // 変数リストの初期化
|
---|
1052 | ///////////////////////
|
---|
1053 | InitVarList((DWORD)lParam);
|
---|
1054 |
|
---|
1055 | break;
|
---|
1056 | case WM_NOTIFY:
|
---|
1057 | NMHDR *hdr;
|
---|
1058 | hdr=(NMHDR *)lParam;
|
---|
1059 | if(hdr->hwndFrom==hTab&&hdr->code==TCN_SELCHANGE){
|
---|
1060 | i=TabCtrl_GetCurSel(hTab);
|
---|
1061 |
|
---|
1062 | if(i==0){
|
---|
1063 | //グローバル変数を表示
|
---|
1064 | ShowWindow(hVarTree_Global,SW_SHOW);
|
---|
1065 | ShowWindow(hVarTree_Local,SW_HIDE);
|
---|
1066 | ShowWindow(hVarTree_This,SW_HIDE);
|
---|
1067 | }
|
---|
1068 | else if(i==1){
|
---|
1069 | //ローカル変数を表示
|
---|
1070 | ShowWindow(hVarTree_Global,SW_HIDE);
|
---|
1071 | ShowWindow(hVarTree_Local,SW_SHOW);
|
---|
1072 | ShowWindow(hVarTree_This,SW_HIDE);
|
---|
1073 | }
|
---|
1074 | else if(i==2){
|
---|
1075 | //This変数を表示
|
---|
1076 | ShowWindow(hVarTree_Global,SW_HIDE);
|
---|
1077 | ShowWindow(hVarTree_Local,SW_HIDE);
|
---|
1078 | ShowWindow(hVarTree_This,SW_SHOW);
|
---|
1079 | }
|
---|
1080 | }
|
---|
1081 |
|
---|
1082 | if(hdr->hwndFrom==hListView){
|
---|
1083 | lvinfo=(LV_DISPINFO *)hdr;
|
---|
1084 | if(hdr->code==NM_DBLCLK){
|
---|
1085 | i2=ListView_GetItemCount(hListView);
|
---|
1086 | for(i=0;i<i2;i++){
|
---|
1087 | if(ListView_GetItemState(hListView,i,LVIS_SELECTED)) break;
|
---|
1088 | }
|
---|
1089 | if(i==i2) break;
|
---|
1090 |
|
---|
1091 | ListView_EditLabel(hListView,i);
|
---|
1092 | }
|
---|
1093 |
|
---|
1094 | static HWND hEdit;
|
---|
1095 | if(hdr->code==LVN_BEGINLABELEDIT){
|
---|
1096 | hEdit=ListView_GetEditControl(hListView);
|
---|
1097 |
|
---|
1098 | GetWindowText(hEdit,temporary,VN_SIZE);
|
---|
1099 | if(lstrcmp(temporary,"...")==0) SetWindowText(hEdit,"");
|
---|
1100 | }
|
---|
1101 | if(hdr->code==LVN_ENDLABELEDIT){
|
---|
1102 | GetWindowText(hEdit,temporary,VN_SIZE);
|
---|
1103 | if(temporary[0]=='\0'){
|
---|
1104 | if(ListView_GetItemCount(hListView)-1==lvinfo->item.iItem) break;
|
---|
1105 |
|
---|
1106 | //空白入力の場合はそのアイテムを削除する
|
---|
1107 | ListView_DeleteItem(hListView,lvinfo->item.iItem);
|
---|
1108 | break;
|
---|
1109 | }
|
---|
1110 | ListView_SetItemText(hListView,lvinfo->item.iItem,0,temporary);
|
---|
1111 |
|
---|
1112 | //演算結果を表示
|
---|
1113 | SetCalcToWatchList(hListView,lvinfo->item.iItem,temporary);
|
---|
1114 |
|
---|
1115 | if(lvinfo->item.iItem==ListView_GetItemCount(hListView)-1){
|
---|
1116 | //リストアイテムを追加
|
---|
1117 | ListView_Item.mask=LVIF_TEXT;
|
---|
1118 | ListView_Item.pszText="...";
|
---|
1119 | ListView_Item.iItem=lvinfo->item.iItem+1;
|
---|
1120 | ListView_Item.iSubItem=0;
|
---|
1121 | ListView_InsertItem(hListView,&ListView_Item);
|
---|
1122 | }
|
---|
1123 | }
|
---|
1124 |
|
---|
1125 | if(hdr->code==LVN_KEYDOWN){
|
---|
1126 | LV_KEYDOWN *plvKeydown;
|
---|
1127 | plvKeydown=(LV_KEYDOWN *)hdr;
|
---|
1128 | if(plvKeydown->wVKey==VK_DELETE){
|
---|
1129 | i2=ListView_GetItemCount(hListView);
|
---|
1130 | for(i=i2-2;i>=0;i--){
|
---|
1131 | if(ListView_GetItemState(hListView,i,LVIS_SELECTED)){
|
---|
1132 | ListView_DeleteItem(hListView,i);
|
---|
1133 | i3=i;
|
---|
1134 | }
|
---|
1135 | }
|
---|
1136 |
|
---|
1137 | ListView_SetItemState(hListView,i3,LVIS_SELECTED,LVIS_SELECTED);
|
---|
1138 | }
|
---|
1139 | }
|
---|
1140 | }
|
---|
1141 | break;
|
---|
1142 |
|
---|
1143 | case WM_SIZE:
|
---|
1144 | //変数リストの位置
|
---|
1145 | int width_VarList;
|
---|
1146 | width_VarList=
|
---|
1147 | (int)((double)(LOWORD(lParam)-pos_VarList.x)*width_ratio_VarList);
|
---|
1148 |
|
---|
1149 | MoveWindow(hTab,
|
---|
1150 | pos_VarList.x,
|
---|
1151 | pos_VarList.y,
|
---|
1152 | width_VarList,
|
---|
1153 | HIWORD(lParam)-pos_VarList.y,
|
---|
1154 | 1);
|
---|
1155 |
|
---|
1156 | GetClientRect(hTab,&rect);
|
---|
1157 | TabCtrl_AdjustRect(hTab,FALSE,&rect);
|
---|
1158 | rect.left-=2;
|
---|
1159 | rect.right++;
|
---|
1160 | rect.bottom++;
|
---|
1161 |
|
---|
1162 | MoveWindow(hVarTree_Global,
|
---|
1163 | rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top,1);
|
---|
1164 | MoveWindow(hVarTree_Local,
|
---|
1165 | rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top,1);
|
---|
1166 | MoveWindow(hVarTree_This,
|
---|
1167 | rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top,1);
|
---|
1168 |
|
---|
1169 | pos_WatchList.x=pos_VarList.x+width_VarList+LEVER_THICK;
|
---|
1170 | pos_WatchList.y=0;
|
---|
1171 |
|
---|
1172 | //ウォッチリストの位置
|
---|
1173 | MoveWindow(GetDlgItem(hwnd,IDC_WATCHLIST),
|
---|
1174 | pos_WatchList.x,
|
---|
1175 | pos_WatchList.y,
|
---|
1176 | LOWORD(lParam)-pos_WatchList.x,
|
---|
1177 | HIWORD(lParam)-pos_WatchList.y,
|
---|
1178 | 1);
|
---|
1179 |
|
---|
1180 | return 1;
|
---|
1181 |
|
---|
1182 | case WM_VARLIST_CLOSE:
|
---|
1183 | DestroyWindow(hwnd);
|
---|
1184 | return 1;
|
---|
1185 | case WM_DESTROY:
|
---|
1186 | ImageList_Destroy(hVariOrderImageList);
|
---|
1187 |
|
---|
1188 |
|
---|
1189 | //////////////////////////////////////////////////////////////
|
---|
1190 | // ウォッチリストの以前の内容を破棄し、新しい内容に書き換える
|
---|
1191 | //////////////////////////////////////////////////////////////
|
---|
1192 |
|
---|
1193 | for(i=0;i<pobj_nv->WatchNum;i++){
|
---|
1194 | HeapDefaultFree(pobj_nv->ppWatchStr[i]);
|
---|
1195 | }
|
---|
1196 | HeapDefaultFree(pobj_nv->ppWatchStr);
|
---|
1197 |
|
---|
1198 | pobj_nv->WatchNum=ListView_GetItemCount(hListView)-1;
|
---|
1199 | pobj_nv->ppWatchStr=(char **)HeapAlloc(hHeap,0,pobj_nv->WatchNum*sizeof(char *)+1);
|
---|
1200 | for(i=0;i<pobj_nv->WatchNum;i++){
|
---|
1201 | ListView_GetItemText(hListView,i,0,temporary,VN_SIZE);
|
---|
1202 | pobj_nv->ppWatchStr[i]=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
|
---|
1203 | lstrcpy(pobj_nv->ppWatchStr[i],temporary);
|
---|
1204 | }
|
---|
1205 |
|
---|
1206 |
|
---|
1207 | //////////////////////////////
|
---|
1208 | // デバッグダイアログを破棄
|
---|
1209 | //////////////////////////////
|
---|
1210 |
|
---|
1211 | hDebugWnd=0;
|
---|
1212 |
|
---|
1213 | extern BOOL bClipCompileView;
|
---|
1214 | if(bClipCompileView){
|
---|
1215 | extern HWND hOwnerEditor;
|
---|
1216 | SendMessage(hOwnerEditor,WM_DESTROYDEBUGGERVIEW,0,0);
|
---|
1217 | }
|
---|
1218 |
|
---|
1219 | return 1;
|
---|
1220 |
|
---|
1221 |
|
---|
1222 |
|
---|
1223 | ///////////////////////
|
---|
1224 | // デバッグコマンド
|
---|
1225 | ///////////////////////
|
---|
1226 |
|
---|
1227 | case WM_DEBUG_CONTINUE:
|
---|
1228 | DestroyWindow(hwnd);
|
---|
1229 | return 1;
|
---|
1230 | case WM_STEP_IN:
|
---|
1231 | Debugger_StepIn();
|
---|
1232 | return 1;
|
---|
1233 | case WM_STEP_OVER:
|
---|
1234 | Debugger_StepOver();
|
---|
1235 | return 1;
|
---|
1236 | case WM_STEP_CURSOR:
|
---|
1237 | Debugger_StepCursor();
|
---|
1238 | return 1;
|
---|
1239 | }
|
---|
1240 | return 0;
|
---|
1241 | }
|
---|
1242 |
|
---|
1243 |
|
---|
1244 |
|
---|
1245 |
|
---|
1246 | //////////////////////////////////
|
---|
1247 | // ポップアップ表示の変数リスト
|
---|
1248 | //////////////////////////////////
|
---|
1249 |
|
---|
1250 | BOOL CALLBACK DlgVarList(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
|
---|
1251 | extern HANDLE hHeap;
|
---|
1252 | extern HINSTANCE hInst;
|
---|
1253 | extern DWORD dwStepRun;
|
---|
1254 | RECT rect;
|
---|
1255 | POINT pos;
|
---|
1256 | SIZE size;
|
---|
1257 |
|
---|
1258 | switch(message){
|
---|
1259 | case WM_INITDIALOG:
|
---|
1260 | extern HWND hDebugWnd;
|
---|
1261 | hDebugWnd=hwnd;
|
---|
1262 |
|
---|
1263 | pos.x=pobj_nv->VarDlgRect.left;
|
---|
1264 | pos.y=pobj_nv->VarDlgRect.top;
|
---|
1265 | size.cx=pobj_nv->VarDlgRect.right-pobj_nv->VarDlgRect.left;
|
---|
1266 | size.cy=pobj_nv->VarDlgRect.bottom-pobj_nv->VarDlgRect.top;
|
---|
1267 | MoveWindow(hwnd,pos.x,pos.y,size.cx,size.cy,1);
|
---|
1268 |
|
---|
1269 | extern WNDPROC OldThreadComboProc;
|
---|
1270 | OldThreadComboProc=(WNDPROC)GetWindowLongPtr(GetDlgItem(hwnd,IDC_THREADCOMBO),GWLP_WNDPROC);
|
---|
1271 | SetWindowLongPtr(GetDlgItem(hwnd,IDC_THREADCOMBO),GWLP_WNDPROC,(LONG_PTR)ThreadComboProc);
|
---|
1272 |
|
---|
1273 | extern WNDPROC OldProcComboProc;
|
---|
1274 | OldProcComboProc=(WNDPROC)GetWindowLongPtr(GetDlgItem(hwnd,IDC_PROCCOMBO),GWLP_WNDPROC);
|
---|
1275 | SetWindowLongPtr(GetDlgItem(hwnd,IDC_PROCCOMBO),GWLP_WNDPROC,(LONG_PTR)ProcComboProc);
|
---|
1276 |
|
---|
1277 | //イメージリスト読み込み、設定
|
---|
1278 | static HIMAGELIST hVariOrderImageList;
|
---|
1279 | hVariOrderImageList=ImageList_Create(16,16,ILC_COLOR4|ILC_MASK,4,0);
|
---|
1280 | ImageList_AddIcon(hVariOrderImageList,LoadIcon(hInst,MAKEINTRESOURCE(IDI_VARARRAY)));
|
---|
1281 | ImageList_AddIcon(hVariOrderImageList,LoadIcon(hInst,MAKEINTRESOURCE(IDI_VARSTRUCT)));
|
---|
1282 | ImageList_AddIcon(hVariOrderImageList,LoadIcon(hInst,MAKEINTRESOURCE(IDI_VARDATA)));
|
---|
1283 | ImageList_AddIcon(hVariOrderImageList,LoadIcon(hInst,MAKEINTRESOURCE(IDI_VARSTR)));
|
---|
1284 | ImageList_AddIcon(hVariOrderImageList,LoadIcon(hInst,MAKEINTRESOURCE(IDI_VARPTRSTRUCT)));
|
---|
1285 | TreeView_SetImageList(GetDlgItem(hwnd,IDC_VARTREE),hVariOrderImageList,TVSIL_NORMAL);
|
---|
1286 |
|
---|
1287 | InitVarList((DWORD)lParam);
|
---|
1288 | break;
|
---|
1289 | case WM_COMMAND:
|
---|
1290 | switch(LOWORD(wParam)){
|
---|
1291 | case IDCANCEL:
|
---|
1292 | DestroyWindow(hwnd);
|
---|
1293 | return 1;
|
---|
1294 | case IDC_STEPIN:
|
---|
1295 | dwStepRun=1;
|
---|
1296 | return 1;
|
---|
1297 | case IDC_STEPOVER:
|
---|
1298 | dwStepRun=2;
|
---|
1299 | return 1;
|
---|
1300 | }
|
---|
1301 | break;
|
---|
1302 | case WM_SIZE:
|
---|
1303 | GetWindowRect(GetDlgItem(hwnd,IDC_VARTREE),&rect);
|
---|
1304 | pos.x=rect.left;
|
---|
1305 | pos.y=rect.top;
|
---|
1306 | ScreenToClient(hwnd,&pos);
|
---|
1307 | MoveWindow(GetDlgItem(hwnd,IDC_VARTREE),0,pos.y,LOWORD(lParam),HIWORD(lParam)-pos.y,TRUE);
|
---|
1308 | SetWindowPos(GetDlgItem(hwnd,IDCANCEL),0,LOWORD(lParam)-91,9,0,0,SWP_NOSIZE);
|
---|
1309 | return 1;
|
---|
1310 | case WM_VARLIST_CLOSE:
|
---|
1311 | DestroyWindow(hwnd);
|
---|
1312 | return 1;
|
---|
1313 | case WM_DESTROY:
|
---|
1314 | ImageList_Destroy(hVariOrderImageList);
|
---|
1315 |
|
---|
1316 | GetWindowRect(hwnd,&pobj_nv->VarDlgRect);
|
---|
1317 |
|
---|
1318 | hDebugWnd=0;
|
---|
1319 |
|
---|
1320 | return 1;
|
---|
1321 | }
|
---|
1322 | return 0;
|
---|
1323 | }
|
---|