Ребята, тут две программы слепленные как попало помогите прокомментировать...
а тут все что смог прокомментировать
.486 ; директива определения типа микропроцессора .model flat, stdcall ; задание типов памяти option casemap :none ; чувствительны к регистру include base.inc include shell32.inc includelib shell32.lib .data ; директива определения данных WM_SHELLNOTIFY equ WM_USER+5 note NOTIFYICONDATA <> hPopupMenu dd 0 hMenu dd 0 About db "About",0 aName db "Автор: Долматов Андрей",0ah,0dh,"КИТ - 29 А",0 Caption db "Remove Hardware",0 usbName db "Remove Hardware",0 ShowString db "S&how Window",0 ExitString db "E&xit Program",0 hWnd dd 0 aColum1 db '#',0 aColum2 db 'Name',0 aColum3 db 'Removeable',0 aColum4 db 'Device ID',0 aRemoveable db 'REMOVEABLE',0 fFiltering dd 1 temp dd 0 params MSGBOXPARAMS <> GUID_REMOVEABLE dd 53F5630Dh dw 0B6BFh dw 11D0h db 94h, 0F2h, 0, 0A0h, 0C9h, 1Eh, 0FBh, 8Bh dnDevInst dd 0 DevLen dd 0 aBuffer db 200 dup (0) aDeviceId db 200 dup (0) Status dd 0 ProblemNum dd 0 aTempStr db 200 dup (0) lvc LV_COLUMN <> lvi LV_ITEM <> CM_LOCATE_DEVNODE_NORMAL equ 0 CM_DRP_DEVICEDESC equ 01h CM_DRP_FRIENDLYNAME equ 0Dh DN_REMOVABLE equ 4000h CR_NO_SUCH_DEVNODE equ 0dh CR_SUCCESS equ 0 .code start: invoke GetModuleHandle, NULL mov hInstance, eax invoke DialogBoxParam, hInstance, 101, 0, ADDR DlgProc, 0 invoke ExitProcess, eax invoke InitCommonControls ; ----------------------------------------------------------------------- AddItemDev proc invoke dwtoa,lvi.iItem,addr aTempStr lea eax, aTempStr mov lvi.pszText, eax mov lvi.iSubItem, 0 invoke SendDlgItemMessage,hWnd,1005,LVM_INSERTITEM, 1, addr lvi lea eax, aBuffer mov lvi.pszText, eax mov lvi.iSubItem, 1 invoke SendDlgItemMessage,hWnd,1005,LVM_SETITEMTEXT, lvi.iItem, addr lvi .if (Status & DN_REMOVABLE) invoke lstrcpy,addr aTempStr,addr aRemoveable .else mov aTempStr[0],0 .endif lea eax, aTempStr mov lvi.pszText, eax mov lvi.iSubItem, 2 invoke SendDlgItemMessage,hWnd,1005,LVM_SETITEMTEXT, lvi.iItem, addr lvi lea eax, aDeviceId mov lvi.pszText, eax mov lvi.iSubItem, 3 invoke SendDlgItemMessage,hWnd,1005,LVM_SETITEMTEXT, lvi.iItem, addr lvi invoke AppendMenu,hMenu,MF_STRING,IDM_OK,addr aDeviceId add lvi.iItem,1 Ret AddItemDev EndP ; ----------------------------------------------------------------------- EnumDevice proc dDevInst:DWORD LOCAL NewDevInst:DWORD LOCAL len :DWORD ;Получение статуса устройства invoke CM_Get_DevNode_Status,addr Status,addr ProblemNum,dDevInst,0 ;Получение идентификатора устройства invoke CM_Get_Device_ID_Size,addr DevLen,dDevInst,0 inc DevLen invoke CM_Get_Device_ID,dDevInst,addr aDeviceId,DevLen,0 ;Получение описания устройства mov len,sizeof aBuffer invoke CM_Get_DevNode_Registry_Property,dDevInst,CM_DRP_FRIENDLYNAME,0,addr aBuffer, addr len,0 .if eax!=CR_SUCCESS invoke CM_Get_DevNode_Registry_Property,dDevInst,CM_DRP_DEVICEDESC,0,addr aBuffer, addr len,0 .endif .if eax!=CR_SUCCESS mov aBuffer[0],0 .endif ;выводим информацию .if fFiltering==1 .if (Status & DN_REMOVABLE) invoke AddItemDev .endif .else invoke AddItemDev .endif ;ищем потомков invoke CM_Get_Child,addr NewDevInst,dDevInst,0 .if eax == CR_SUCCESS invoke EnumDevice,NewDevInst .endif ;ищем соседей invoke CM_Get_Sibling,addr NewDevInst,dDevInst,0 .if eax == CR_SUCCESS invoke EnumDevice,NewDevInst .endif Ret EnumDevice EndP ; ----------------------------------------------------------------------- DlgProc proc hWin :DWORD,uMsg :DWORD,wParam :DWORD,lParam :DWORD LOCAL pt:POINT ; ----------------------------------------------------------------------- .if uMsg == WM_INITDIALOG mov eax,hWin mov hWnd,eax invoke LoadIcon,hInstance,500 invoke SetClassLong,hWin,GCL_HICON,eax invoke SendDlgItemMessage,hWin,1005, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT or LVS_EX_FLATSB; or LVS_EX_CHECKBOXES ;Создаем шапку mov lvc.imask, LVCF_TEXT or LVCF_WIDTH; or LVCF_FMT mov lvc.pszText, offset aColum1 mov lvc.lx, 50 invoke SendDlgItemMessage,hWin,1005,LVM_INSERTCOLUMN,1, addr lvc mov lvc.pszText, offset aColum2 mov lvc.lx, 275 invoke SendDlgItemMessage,hWin,1005,LVM_INSERTCOLUMN,2, addr lvc mov lvc.pszText, offset aColum3 mov lvc.lx, 80 invoke SendDlgItemMessage,hWin,1005,LVM_INSERTCOLUMN,3, addr lvc mov lvc.pszText, offset aColum4 mov lvc.lx, 250 invoke SendDlgItemMessage,hWin,1005,LVM_INSERTCOLUMN,4, addr lvc mov lvi.iItem, 0 mov lvi.imask, LVIF_TEXT ;or LVIF_PARAM; or LVIF_STATE ;------------------------------------------------------------------------------------------------------- invoke CreatePopupMenu mov hMenu,eax ;------------------------------------------------------------------------------------------------------ invoke CM_Locate_DevNode,addr dnDevInst,CM_LOCATE_DEVNODE_NORMAL,0 ;получаем корневой элемент invoke EnumDevice,dnDevInst ;запускаем обход дерева ;-------------------------------------------------------- invoke CreatePopupMenu mov hPopupMenu,eax invoke AppendMenu,hPopupMenu,MF_STRING,IDM_SHOW,addr ShowString invoke AppendMenu,hPopupMenu, MF_SEPARATOR,0,0 invoke AppendMenu,hPopupMenu,MF_STRING,IDM_ABOUT, addr About invoke AppendMenu,hPopupMenu,MF_SEPARATOR,0,0 invoke AppendMenu,hPopupMenu,MF_STRING,IDM_EXIT,addr ExitString ;-------------------------------------------------------- invoke SendMessage,hWin,WM_SIZE,SIZE_MINIMIZED,0 ; ----------------------------------------------------------------------- .elseif uMsg == WM_NOTIFY mov ebx, lParam .if [ebx.NMHDR].code == NM_CLICK invoke SendDlgItemMessage,hWnd,1005,LVM_GETNEXTITEM,-1,LVNI_FOCUSED mov lvi.iItem, eax mov lvi.iSubItem, 1 mov lvi.imask, LVIF_TEXT lea eax, aBuffer mov lvi.pszText, eax mov lvi.cchTextMax, 200 invoke SendDlgItemMessage,hWnd,1005,LVM_GETITEM, 0, addr lvi invoke SendDlgItemMessage,hWnd,1001,WM_SETTEXT,0,addr aBuffer invoke SendDlgItemMessage,hWnd,1005,LVM_GETNEXTITEM,-1,LVNI_FOCUSED mov lvi.iItem, eax mov lvi.iSubItem, 3 mov lvi.imask, LVIF_TEXT lea eax, aBuffer mov lvi.pszText, eax mov lvi.cchTextMax, 200 invoke SendDlgItemMessage,hWnd,1005,LVM_GETITEM, 0, addr lvi invoke SendDlgItemMessage,hWnd,1002,WM_SETTEXT,0,addr aBuffer .endif ; ----------------------------------------------------------------------- .elseif uMsg == WM_COMMAND .if wParam == IDC_OK invoke SendDlgItemMessage,hWnd,1002,WM_GETTEXTLENGTH,0,0 inc eax mov edx,eax invoke SendDlgItemMessage,hWnd,1002,WM_GETTEXT,edx,addr aBuffer invoke CM_Locate_DevNode,addr dnDevInst, addr aBuffer, CM_LOCATE_DEVNODE_NORMAL ;по идентификатору устройства узнаем его дескриптор invoke CM_Request_Device_Eject,dnDevInst, NULL, NULL, NULL, NULL .elseif wParam == IDC_IDCANCEL invoke Shell_NotifyIcon,NIM_DELETE,addr note invoke EndDialog,hWin,0 .elseif wParam == IDC_REFRESH invoke SendDlgItemMessage,hWnd,1005,LVM_DELETEALLITEMS,0,0 mov lvi.iItem, 0 mov lvi.imask, LVIF_TEXT invoke CM_Locate_DevNode,addr dnDevInst,NULL,CM_LOCATE_DEVNODE_NORMAL invoke DeleteMenu,hMenu,IDM_OK,MF_BYCOMMAND invoke DeleteMenu,hMenu,IDM_OK,MF_BYCOMMAND invoke DeleteMenu,hMenu,IDM_OK,MF_BYCOMMAND invoke DeleteMenu,hMenu,IDM_OK,MF_BYCOMMAND invoke DeleteMenu,hMenu,IDM_OK,MF_BYCOMMAND invoke EnumDevice,dnDevInst .elseif wParam==IDM_OK invoke GetMenuString,hMenu,IDM_OK,addr aTempStr,100,0 invoke CM_Locate_DevNode,addr dnDevInst, addr aTempStr, CM_LOCATE_DEVNODE_NORMAL invoke CM_Request_Device_Eject,dnDevInst, NULL, NULL, NULL, NULL .elseif wParam == IDM_SHOW ;------------------------------------------------ invoke ShowWindow,hWin,SW_SHOW .elseif wParam==IDM_ABOUT mov params.cbSize,sizeof MSGBOXPARAMS mov params.hwndOwner,0 invoke GetModuleHandle,0 mov params.lpszText,offset aName mov params.hInstance,eax mov params.lpszCaption,offset Caption mov params.dwStyle,MB_USERICON+MB_OK mov params.lpszIcon,IDI_ICON mov params.dwContextHelpId,0 mov params.lpfnMsgBoxCallback,0 mov params.dwLanguageId,LANG_NEUTRAL invoke MessageBoxIndirectA,addr params .elseif wParam==IDM_EXIT invoke Shell_NotifyIcon,NIM_DELETE,addr note invoke EndDialog,hWin,0 .endif .elseif uMsg == WM_SIZE ;-------------------------------------------------------- .if wParam == SIZE_MINIMIZED mov note.cbSize,sizeof NOTIFYICONDATA push hWin pop note.hwnd mov note.uID,IDI_TRAY mov note.uFlags,NIF_ICON+NIF_MESSAGE+NIF_TIP mov note.uCallbackMessage,WM_SHELLNOTIFY invoke LoadIcon,hInstance,500 mov note.hIcon,eax invoke lstrcpy,addr note.szTip,addr usbName invoke ShowWindow,hWin,SW_HIDE invoke Shell_NotifyIcon,NIM_ADD,addr note .endif .elseif uMsg == WM_SHELLNOTIFY ;-------------------------------------------------------- .if wParam == IDI_TRAY .if lParam==WM_RBUTTONDOWN invoke GetCursorPos,addr pt invoke SetForegroundWindow,hWin invoke TrackPopupMenu,hPopupMenu,TPM_RIGHTALIGN,pt.x,pt.y,0,hWin,0 invoke PostMessage,hWin,WM_NULL,0,0 .elseif lParam==WM_LBUTTONDBLCLK invoke ShowWindow,hWin,SW_SHOW .elseif lParam==WM_LBUTTONDOWN invoke GetCursorPos,addr pt invoke SetForegroundWindow,hWin invoke TrackPopupMenu,hMenu,TPM_RIGHTALIGN,pt.x,pt.y,0,hWin,0 invoke PostMessage,hWin,WM_NULL,0,0 .endif .endif .elseif uMsg == WM_CLOSE invoke ShowWindow,hWin,SW_HIDE .endif xor eax,eax ret DlgProc endp end start
Кто возьмется отпишитесь пожалуйста.
Сообщение отредактировано: FDrum - 18.01.2011 2:20