- Timestamp:
- Sep 2, 2002, 4:58:01 AM (23 years ago)
- Location:
- trunk/src/win32k/kKrnlLib/tools/pmdfrexx
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/win32k/kKrnlLib/tools/pmdfrexx/pm.cmd
r9189 r9191 37 37 when (sCmd = 'pmsemdump') then 38 38 return pmsemDump(sArgs); 39 when (sCmd = 'pmsemdumpall') then 40 return PmsemDumpAll(sArgs); 39 41 40 42 /* … … 199 201 200 202 /** 201 * Check if any of the PM sems are taken or have bogus state.203 * Dump a number of pm/gre sems. 202 204 * @returns 0 on success. -1 on error. 203 205 */ … … 214 216 if (sMem <> '') then 215 217 do 216 /* loop thru them all listing the taken/bogus ones */217 218 do i = 0 to cCount - 1 218 219 call pmsemDump1 memCopy(i * pmsemSize(), pmsemSize(), sMem); 220 end 221 end 222 else 223 say 'error: failed to read semaphore table.'; 224 return -1; 225 226 227 /** 228 * Dumps all PM/GRE sems 229 * @returns 0 on success. -1 on error. 230 */ 231 PmsemDumpAll: procedure expose(sGlobals) 232 /* read memory and do the dump */ 233 sMem = dfReadMem('pmsemaphores', 35 * pmsemSize()) 234 if (sMem <> '') then 235 do 236 do i = 0 to 34 237 call pmsemDump1 memCopy(i * pmsemSize(), pmsemSize(), sMem),, i; 219 238 end 220 239 end … … 317 336 wndStyle: procedure expose(sGlobals); parse arg sMem; return memDword(x2d('18'), sMem); 318 337 wndId: procedure expose(sGlobals); parse arg sMem; return memDword(x2d('1c'), sMem); 338 wndReserved0: procedure expose(sGlobals); parse arg sMem; return memDword(x2d('20'), sMem); 339 wndReserved1: procedure expose(sGlobals); parse arg sMem; return memDword(x2d('24'), sMem); 319 340 wndMsgQueue: procedure expose(sGlobals); parse arg sMem; return memDword(x2d('28'), sMem); 320 341 wndHWND: procedure expose(sGlobals); parse arg sMem; return memDword(x2d('2c'), sMem); … … 343 364 say ' ulStyle:' d2x(wndStyle(sMem),8); 344 365 say ' id:' d2x(wndId(sMem),8); 366 say ' Reserved0:' d2x(wndReserved0(sMem),8); 367 say ' Reserved1:' d2x(wndReserved1(sMem),8); 345 368 say ' pmqMsgQueue:' d2x(wndMsgQueue(sMem),8); 346 369 say ' hwnd:' d2x(wndHWND(sMem),8); … … 353 376 say ' ppresParams:' d2x(wndPresParams(sMem),8); 354 377 say ' pwndFocus:' d2x(wndFocus(sMem),8); 355 say ' ulWPS:' d2x(wndWPSULong(sMem),8) ;378 say ' ulWPS:' d2x(wndWPSULong(sMem),8) '('dfNear('%'d2x(wndWPSULong(sMem),8))')' 356 379 say ' pInstData:' d2x(wndInstData(sMem),8); 357 380 say ' ??:' d2x(memDword(x2d('54'), sMem),8); … … 1113 1136 if (rc = 0 & asOut.0 > 0) then 1114 1137 do 1115 parse var asOut.1 .' 'sRet; 1116 return strip(sRet); 1138 if (pos('symbols found', asOut.1) <= 0) then 1139 do 1140 parse var asOut.1 .' 'sRet; 1141 return strip(sRet); 1142 end 1117 1143 end 1118 1144 return ''; … … 1202 1228 return -1; 1203 1229 1230 1204 1231 /** 1205 1232 * Gets the blockId of a process from the dumpformatter. … … 1214 1241 do 1215 1242 /* *000b# blk fd436190 pmshell */ 1216 asOut. 0 = strip(asOut.0);1217 parse var asOut. 0.' 'sState' 'sBlockId' 'sProcName1243 asOut.2 = strip(asOut.2); 1244 parse var asOut.2 .' 'sState' 'sBlockId' 'sProcName 1218 1245 sBlockId = strip(sBlockId) /* needed??? */ 1219 if (s trip(sBlockId)<> '') then1246 if (sBlockId <> '') then 1220 1247 return sBlockId; 1221 1248 end 1222 1249 return '0'; 1250 1251 1252 /** 1253 * Gets the PTDA of a process. 1254 * @param sSlot Slot or special chars '*' and '#'. 1255 * @return Hex pointer to the PTDA. 1256 */ 1257 dfProcPTDA: procedure expose(sGlobals) 1258 parse arg iSlot 1259 Address df 'CMD' 'asOut' '.p' iSlot; 1260 if (rc = 0 & asOut.0 > 0) then 1261 do 1262 /* 0074 0033 0000 0033 0002 blk 0500 f88e6000 fe62d220 f9a0b7e8 1e9c 12 muglrqst 1263 * 000a 0001 0000 0000 000a blk 081e f8812000 ffdba880 f99f7840 1e94 00 *jitdaem 1264 * *000b# 001d 0001 001d 0001 blk 0500 f8814000 fe6270a0 f99f7b44 1e9c 01 pmshell 1265 */ 1266 i = 2; 1267 asOut.i = translate(left(asOut.i, 10), ' ', '#*') || substr(asOut.i, 11); 1268 parse var asOut.i . . . . . . . hxTSD hxPTDA hxPCB . . .; 1269 hxPTDA = strip(hxPTDA) /* needed??? */ 1270 if (hxPTDA <> '') then 1271 return hxPTDA; 1272 end 1273 return '0'; 1274 1223 1275 1224 1276 /** -
trunk/src/win32k/kKrnlLib/tools/pmdfrexx/sem.cmd
r9190 r9191 39 39 40 40 /* 41 * Windows Structures.41 * Sem32 42 42 */ 43 when (sCmd = 'wnddump') then 44 return wndDump(sArgs); 45 46 /* 47 * Window handles. 48 */ 49 when (sCmd = 'hwnd') then 50 return hwnd2PWND(sArgs); 51 52 /* 53 * PM stuff 54 */ 55 when (sCMD = 'pmstatus') then 56 return PmStatus(sArgs); 43 when (sCmd = 'sem32check') then 44 return Sem32Check(sArgs); 45 57 46 58 47 /* … … 168 157 /* lookup the index */ 169 158 iIdx = hsemGetIndex(iHandle); 159 ulSem = 0; 170 160 if (hsemIsPrivate(iHandle)) then 171 161 do /* private sem lookup */ 172 ulSem = 0; 162 ulPTDA = dfProcPTDA('#'); 163 if (dfReadDword('%'ulPTDA '+ (%ulPrTotUsed - %ptda_start)') > iIdx) then 164 ulSem = dfReadDword('%(dw(%'ulPTDA '+ (%pPrSemTbl - %ptda_start))+'d2x(iIdx*4)')'); 165 else 166 say 'error-Hsem2psem: Invalid semaphore index. ('sHSEM')' 173 167 end 174 168 else … … 192 186 if (ulSem > 0) then 193 187 do 194 Address df 'CMD' 'asOut' '.d sem32 %'||d2x(ulSem); 195 do i = 1 to asOut.0; say asOut.i; end 188 rc = sem32Dump1Ext(ulSem); 189 return 0; 190 end 191 return -1; 192 193 194 /** 195 * Dumps a sem32 structure. 196 * @param ulAddr Decimal address of the sem32 structure. 197 */ 198 sem32Dump1Ext: procedure expose(sGlobals) 199 parse arg ulAddr 200 201 Address df 'CMD' 'asOut' '.d sem32 %'||d2x(ulAddr); 202 203 do i = 1 to asOut.0; 204 if (pos('ADDR:', translate(asOut.i)) > 0) then 205 do 206 sAddr = strip(substr(asOut.i, pos(':', asOut.i) + 1)) 207 if (x2d(sAddr) > 0) then 208 asOut.i = asOut.i '('dfNear(sAddr)')'; 209 end 210 if (pos(':', asOut.i) > 0) then 211 say asOut.i; 196 212 end 197 213 return 0; 214 215 216 /** 217 * Reads a sem32 structure. 218 * @param ulAddr Decimal address of the sem32 structure. 219 */ 220 sem32Read: procedure expose(sGlobals) 221 parse arg ulAddr 222 sSem = ''; 223 Address df 'CMD' 'asOut' '.d sem32 %'||d2x(ulAddr); 224 do i = 1 to asOut.0; 225 asOut.i = strip(translate(asOut.i, '=', ': '||'0d0a'x)); 226 j = pos(' ', asOut.i); 227 do while (j > 0) 228 asOut.i = substr(asOut.i, 1, j-1) || substr(asOut.i, j+1); 229 j = pos(' ', asOut.i); 230 end 231 if (pos('=', asOut.i) > 0) then 232 do 233 sSem = sSem||';'asOut.i; 234 end 235 end 236 /*say 'dbg-sem32Read:' sSem;*/ 237 return sSem; 238 239 /* access methods */ 240 sem32IsEvent: procedure expose(sGlobals); parse arg sSem; return pos('Event;', sSem) > 0; 241 sem32IsMutex: procedure expose(sGlobals); parse arg sSem; return pos('Mutex;', sSem) > 0; 242 sem32IsPrivate: procedure expose(sGlobals); parse arg sSem; return pos('Private', sSem) > 0; 243 sem32IsShared: procedure expose(sGlobals); parse arg sSem; return pos('Shared', sSem) > 0; 244 sem32Flags: procedure expose(sGlobals); parse arg sSem; 245 i = pos('Flags', sSem); if (i > 0) then return substr(sSem, pos('=', sSem, i)+1, 4); 246 return ''; 247 sem32CreateAddr: procedure expose(sGlobals); parse arg sSem; 248 i = pos('CreateAddr', sSem); if (i > 0) then return substr(sSem, pos('=', sSem, i)+1, 4); 249 return ''; 250 sem32CallerAddr: procedure expose(sGlobals); parse arg sSem; 251 i = pos('CallerAddr', sSem); if (i > 0) then return substr(sSem, pos('=', sSem, i)+1, 4); 252 return ''; 253 sem32MuxQ: procedure expose(sGlobals); parse arg sSem; 254 i = pos('pMuxQ', sSem); if (i > 0) then return substr(sSem, pos('=', sSem, i)+1, 4); 255 return ''; 256 sem32OpenCt: procedure expose(sGlobals); parse arg sSem; 257 i = pos('OpenCount', sSem); if (i > 0) then return substr(sSem, pos('=', sSem, i)+1, 4); 258 return '00'; 259 260 sem32mtxIsOwned: procedure expose(sGlobals); parse arg sSem; return sem32mtxOwner(sSem) <> '0000'; 261 sem32mtxOwner: procedure expose(sGlobals); parse arg sSem; 262 i = pos('Owner', sSem); if (i > 0) then return substr(sSem, pos('=', sSem, i)+1, 4); 263 return '00'; 264 sem32mtxRequestCt: procedure expose(sGlobals); parse arg sSem; 265 i = pos('RequestCt', sSem); if (i > 0) then return substr(sSem, pos('=', sSem, i)+1, 4); 266 return '00'; 267 sem32mtxRequesterCt:procedure expose(sGlobals); parse arg sSem; 268 i = pos('RequesterCt', sSem);if (i > 0) then return substr(sSem, pos('=', sSem, i)+1, 4); 269 return '00'; 270 271 sem32evtIsPosted: procedure expose(sGlobals); parse arg sSem; return sem32Flags(sSem) = 'Posted'; 272 sem32evtIsReset: procedure expose(sGlobals); parse arg sSem; return sem32Flags(sSem) = 'Reset'; 273 sem32evtPostCount: procedure expose(sGlobals); parse arg sSem; 274 i = pos('PostCount', sSem); if (i > 0) then return substr(sSem, pos('=', sSem, i)+1, 4); 275 return ''; 276 277 278 /** 279 * Display all the sems which this process is holding. 280 * Only private sems are implemented currently. 281 */ 282 Sem32Check: procedure expose(sGlobals) 283 ulPTDA = dfProcPTDA('#'); 284 285 cPr = dfReadDWord('%'ulPTDA '+ (ulPrTotUsed-ptda_start)'); 286 if (cPr > 0) then 287 do 288 sPrTabMem = dfReadMem('%(dw(%'ulPTDA '+(pPrSemTbl-ptda_start)))', cPr*4); 289 if (sPrTabMem <> '') then 290 do 291 do i = 0 to cPr - 1 292 if (i // 20 = 0) then 293 say 'info:' right(i-0,length(cPr)) 'of' cPr 'private sems processed...' 294 ulSem = memDword(i*4, sPrTabMem); 295 if (ulSem >= '10000'x) then 296 do 297 sSem = sem32Read(ulSem); 298 if (sSem <> '') then 299 do 300 fOk = 1; 301 if (sem32IsMutex(sSem)) then 302 do /* mutex*/ 303 if (sem32mtxIsOwned(sSem)) then 304 fOk = 0; 305 end 306 else if (sem32IsEvent(sSem)) then 307 do /* event */ 308 if (sem32evtIsReset(sSem)) then 309 fOk = 0; 310 end 311 else fOk = 0; 312 if (\fOk) then 313 call sem32Dump1Ext ulSem; 314 end 315 end 316 end 317 end 318 else 319 say 'error-Sem32Check: failed to read private sem table.' 320 end 321 322 return 0; 323 198 324 199 325 … … 321 447 * -1 on error. 322 448 */ 323 dfReadD Word: procedure expose(sGlobals)449 dfReadDword: procedure expose(sGlobals) 324 450 parse arg sAddr 325 451 sMem = dfReadMem(sAddr, 4); … … 340 466 if (rc = 0 & asOut.0 > 0) then 341 467 do 342 parse var asOut.1 .' 'sRet; 343 return strip(sRet); 468 if (pos('symbols found', asOut.1) <= 0) then 469 do 470 parse var asOut.1 .' 'sRet; 471 return strip(sRet); 472 end 344 473 end 345 474 return ''; … … 429 558 return -1; 430 559 560 431 561 /** 432 562 * Gets the blockId of a process from the dumpformatter. … … 441 571 do 442 572 /* *000b# blk fd436190 pmshell */ 443 asOut. 0 = strip(asOut.0);444 parse var asOut. 0.' 'sState' 'sBlockId' 'sProcName573 asOut.2 = strip(asOut.2); 574 parse var asOut.2 .' 'sState' 'sBlockId' 'sProcName 445 575 sBlockId = strip(sBlockId) /* needed??? */ 446 if (s trip(sBlockId)<> '') then576 if (sBlockId <> '') then 447 577 return sBlockId; 448 578 end 449 579 return '0'; 580 581 582 /** 583 * Gets the PTDA of a process. 584 * @param sSlot Slot or special chars '*' and '#'. 585 * @return Hex pointer to the PTDA. 586 */ 587 dfProcPTDA: procedure expose(sGlobals) 588 parse arg iSlot 589 Address df 'CMD' 'asOut' '.p' iSlot; 590 if (rc = 0 & asOut.0 > 0) then 591 do 592 /* 0074 0033 0000 0033 0002 blk 0500 f88e6000 fe62d220 f9a0b7e8 1e9c 12 muglrqst 593 * 000a 0001 0000 0000 000a blk 081e f8812000 ffdba880 f99f7840 1e94 00 *jitdaem 594 * *000b# 001d 0001 001d 0001 blk 0500 f8814000 fe6270a0 f99f7b44 1e9c 01 pmshell 595 */ 596 i = 2; 597 asOut.i = translate(left(asOut.i, 10), ' ', '#*') || substr(asOut.i, 11); 598 parse var asOut.i . . . . . . . hxTSD hxPTDA hxPCB . . .; 599 hxPTDA = strip(hxPTDA) /* needed??? */ 600 if (hxPTDA <> '') then 601 return hxPTDA; 602 end 603 return '0'; 604 450 605 451 606 /**
Note:
See TracChangeset
for help on using the changeset viewer.