呵呵。发些代码,有兴趣的看看吧。美女请直接略过。- !define MYNAME `GetCDVolume`
- Name ${MYNAME}
- Caption `${MYNAME} - Demo`
- XPStyle on
- OutFile ${MYNAME}.exe
- Function .onInit
- Call GetCDVolume
- Quit
- FunctionEnd
- Function GetCDVolume
- Push $0
- Push $1
- Push $2
- Push $3
- System::Alloc ${NSIS_MAX_STRLEN}
- Pop $3
- ;;获取全部驱动器
- System::Call 'kernel32::GetLogicalDriveStringsA(i, i) i(${NSIS_MAX_STRLEN}, r3)'
- Loop:
- System::Call 'kernel32::lstrlenA(t) i(i r3) .r2'
- IntCmp $2 0 End
- System::Call 'kernel32::GetDriveTypeA(t) i(i r3) .r1'
- StrCmp $1 5 0 Next ;是否光驱
- System::Call 'kernel32::GetDiskFreeSpaceExA(t, *l, *l, *l) i(i r3, 0, .r1, 0)'
- StrCmp $1 0 +3
- StrCpy $1 "有盘"
- Goto +2
- StrCpy $1 "无盘"
- System::Call '*$3(&t${NSIS_MAX_STRLEN} .r0)' ;光驱路径
- MessageBox MB_OK|MB_TOPMOST "光驱盘符路径:$0 光驱状态:$1 "
- Next:
- ;;下一驱动器
- IntOp $3 $3 + $2
- IntOp $3 $3 + 1
- Goto Loop
- End: ;;无剩余驱动器
- System::Free $3
- Pop $3
- Pop $2
- Pop $1
- Pop $0
- FunctionEnd
- Section -Nop
- SectionEnd
复制代码 |
|