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 |
program Project2; uses Windows, PsAPI; procedure CvtInt; asm OR CL,CL JNZ @CvtLoop @C1: OR EAX,EAX JNS @C2 NEG EAX CALL @C2 MOV AL,'-' INC ECX DEC ESI MOV [ESI],AL RET @C2: MOV ECX,10 @CvtLoop: PUSH EDX PUSH ESI @D1: XOR EDX,EDX DIV ECX DEC ESI ADD DL,'0' CMP DL,'0'+10 JB @D2 ADD DL,('A'-'0')-10 @D2: MOV [ESI],DL OR EAX,EAX JNE @D1 POP ECX POP EDX SUB ECX,ESI SUB EDX,ECX JBE @D5 ADD ECX,EDX MOV AL,'0' SUB ESI,EDX JMP @z @zloop: MOV [ESI+EDX],AL @z: DEC EDX JNZ @zloop MOV [ESI],AL @D5: end; function IntToStr(Value: Integer): string; // FmtStr(Result, '%d', [Value]); asm PUSH ESI MOV ESI, ESP SUB ESP, 16 XOR ECX, ECX // base: 0 for signed decimal PUSH EDX // result ptr XOR EDX, EDX // zero filled field width: 0 for no leading zeros CALL CvtInt //--函数在下图 MOV EDX, ESI POP EAX // result ptr CALL System.@LStrFromPCharLen ADD ESP, 16 POP ESI end; var pid : array[0..65535] of DWORD; size: DWORD; begin if EnumProcesses(@pid, 65535, size) then MessageBox(0,PChar(IntToStr(size div SizeOf(DWORD))), '', 0); end. |
转载请注明:exchen's blog » Delphi 获取进程数