+ All Categories
Home > Documents > Td Win32asm 610.Asm

Td Win32asm 610.Asm

Date post: 04-Mar-2016
Category:
Upload: z4rm4r
View: 220 times
Download: 0 times
Share this document with a friend
Description:
TestDepartment assembly programming low levelTestDepartment assembly programming low level
13
7/21/2019 Td Win32asm 610.Asm http://slidepdf.com/reader/full/td-win32asm-610asm 1/13 td_win32asm_610.asm ;============================================================================== ; Test Department's WINDOWS 32 BIT x86 ASSEMBLY example's 610 ;============================================================================== ;============================================================================== ; ==> Part 610 : Extracting icons from a file and execute a control panel. ;------------------------------------------------------------------------------ ;On WM_CREATE we create a ListView window with the LVS_REPORT and the ;LVS_SORTASCENDING style. ;We set the colors for the ListView control, set the column header and ;create an Imagelist. ;We create a Button with the WS_EX_WINDOWEDGE and WS_EX_CLIENTEDGE dwExStyle. ; ;On WM_COMMAND we test if the button is clicked and call the File Routine. ;In this routine we extract the icons from the founded files and assign it ;to the Imagelist. ; ;On WM_NOTIFY in response to a doubleclick inside the ListView window ;we execute the choosen program via API ShellExecute. ; ;An extra info from the MicroSoft help file: ;-------------------------------------------- ;You can set a background image to a ListView control via LVM_SETBKIMAGE. ;You must use OLE COM objects !?, where do you go today ? ;LVM_SETBKIMAGE wParam = 0, lParam = (LPARAM)(LPLVBKIMAGE) plvbki ;The list view control uses OLE/COM to manipulate the background images. ;The calling application must call CoInitialize or OleInitialize before ;sending this message. It is best to call one of these functions when the ;application is initialized and call either CoUninitialize or OleUninitialize ;when the application is terminating. ;Hд ? ; ; ; ; Test Department [email protected] ;============================================================================== ; Assembler directives ;------------------------------------------------------------------------------ .386 ; specifies the processor our program want run on .Model Flat ,StdCall ; always the same for Win9x (32 Bit) option casemap:none ; case sensitive !!! ;============================================================================== ; Include all files where API functins resist you want use, set correct path ;------------------------------------------------------------------------------ includelib kernel32.lib includelib user32.lib includelib gdi32.lib includelib comctl32.lib includelib shell32.lib ;============================================================================== Page 1
Transcript
Page 1: Td Win32asm 610.Asm

7/21/2019 Td Win32asm 610.Asm

http://slidepdf.com/reader/full/td-win32asm-610asm 1/13

td_win32asm_610.asm;==============================================================================; Test Department's WINDOWS 32 BIT x86 ASSEMBLY example's 610;==============================================================================

;==============================================================================; ==> Part 610 : Extracting icons from a file and execute a control panel.;------------------------------------------------------------------------------

;On WM_CREATE we create a ListView window with the LVS_REPORT and the;LVS_SORTASCENDING style.;We set the colors for the ListView control, set the column header and;create an Imagelist.;We create a Button with the WS_EX_WINDOWEDGE and WS_EX_CLIENTEDGE dwExStyle.;;On WM_COMMAND we test if the button is clicked and call the File Routine.;In this routine we extract the icons from the founded files and assign it;to the Imagelist.;

;On WM_NOTIFY in response to a doubleclick inside the ListView window;we execute the choosen program via API ShellExecute.;;An extra info from the MicroSoft help file:;--------------------------------------------;You can set a background image to a ListView control via LVM_SETBKIMAGE.;You must use OLE COM objects !?, where do you go today ?;LVM_SETBKIMAGE wParam = 0, lParam = (LPARAM)(LPLVBKIMAGE) plvbki;The list view control uses OLE/COM to manipulate the background images.;The calling application must call CoInitialize or OleInitialize before;sending this message. It is best to call one of these functions when the

;application is initialized and call either CoUninitialize or OleUninitialize;when the application is terminating.;Hд ?;;;; Test Department [email protected]

;==============================================================================; Assembler directives

;------------------------------------------------------------------------------.386 ; specifies the processor our program want run on.Model Flat ,StdCall ; always the same for Win9x (32 Bit)option casemap:none ; case sensitive !!!

;==============================================================================; Include all files where API functins resist you want use, set correct path;------------------------------------------------------------------------------includelib kernel32.libincludelib user32.libincludelib gdi32.lib

includelib comctl32.libincludelib shell32.lib

;==============================================================================

Page 1

Page 2: Td Win32asm 610.Asm

7/21/2019 Td Win32asm 610.Asm

http://slidepdf.com/reader/full/td-win32asm-610asm 2/13

Page 3: Td Win32asm 610.Asm

7/21/2019 Td Win32asm 610.Asm

http://slidepdf.com/reader/full/td-win32asm-610asm 3/13

Page 4: Td Win32asm 610.Asm

7/21/2019 Td Win32asm 610.Asm

http://slidepdf.com/reader/full/td-win32asm-610asm 4/13

td_win32asm_610.asmLVI_mask dd ? ;look into Win32.hlpLVI_iItem dd ?LVI_iSubItem dd ?LVI_state dd ?LVI_stateMask dd ?LVI_pszText dd ?LVI_cchTextMax dd ?

LVI_iImage dd ?LVI_lParam dd ?

align 4; - LV_COLUMN structure -LVC_mask dd ? ;look into Win32.hlpLVC_fmt dd ?LVC_cx dd ?LVC_pszText dd ?LVC_cchTextMax dd ?

LVC_iSubItem dd ?align 4; - WIN32_FIND_DATA Structure -dwFileAttributes dd ? ;file attributes of the file foundftCreationTime dd ? ;FILETIME structure, file creation time  dd ?ftLastAccessTime dd ? ;FILETIME structure, file access time  dd ?ftLastWriteTime dd ? ;FILETIME structure, file write time  dd ?

nFileSizeHigh dd ? ;high-order DWORD, file size in bytesnFileSizeLow dd ? ;low-order DWORD, file size in bytesdwReserved0 dd ? ;reserved for future usedwReserved1 dd ? ;reserved for future usecFileName db 104h dup (?) ;null-terminated stringname of the filecAlternateFileName db 14 dup (?) ;classic 8.3 (filename.ext) filename

;==============================================================================; .CODE = our code area starts here Main=label of our program code;------------------------------------------------------------------------------

.CodeMain:

;==============================================================================; Always get your program ID first (API=GetModuleHandleA);------------------------------------------------------------------------------push 0h ;lpModuleHandle, 0=get program handlecall GetModuleHandleA ;- API Function -mov hInstance,eax ;return value in eax=handle of program

;==============================================================================

; ListView class seems to be part of common controls, force to init...;------------------------------------------------------------------------------call InitCommonControls ;- API Function -

Page 4

Page 5: Td Win32asm 610.Asm

7/21/2019 Td Win32asm 610.Asm

http://slidepdf.com/reader/full/td-win32asm-610asm 5/13

Page 6: Td Win32asm 610.Asm

7/21/2019 Td Win32asm 610.Asm

http://slidepdf.com/reader/full/td-win32asm-610asm 6/13

Page 7: Td Win32asm 610.Asm

7/21/2019 Td Win32asm 610.Asm

http://slidepdf.com/reader/full/td-win32asm-610asm 7/13

Page 8: Td Win32asm 610.Asm

7/21/2019 Td Win32asm 610.Asm

http://slidepdf.com/reader/full/td-win32asm-610asm 8/13

Page 9: Td Win32asm 610.Asm

7/21/2019 Td Win32asm 610.Asm

http://slidepdf.com/reader/full/td-win32asm-610asm 9/13

Page 10: Td Win32asm 610.Asm

7/21/2019 Td Win32asm 610.Asm

http://slidepdf.com/reader/full/td-win32asm-610asm 10/13

Page 11: Td Win32asm 610.Asm

7/21/2019 Td Win32asm 610.Asm

http://slidepdf.com/reader/full/td-win32asm-610asm 11/13

Page 12: Td Win32asm 610.Asm

7/21/2019 Td Win32asm 610.Asm

http://slidepdf.com/reader/full/td-win32asm-610asm 12/13

Page 13: Td Win32asm 610.Asm

7/21/2019 Td Win32asm 610.Asm

http://slidepdf.com/reader/full/td-win32asm-610asm 13/13

td_win32asm_610.asmpush 0h ;wParam, set to 0push 1007h ;uMsg, LVM_FIRST=1000h | LVM_INSERTITEM=7push hWnd_Listview ;hwnd, handle of destination windowcall SendMessageA ;- API Function -inc counter ;My_GetFileControls_Next:;------------------------------------------------------------------------------

; API "FindNextFile" continues file search from previous call to FindFirstFile;------------------------------------------------------------------------------push OFFSET dwFileAttributes ;lpFindFileData, address of returned infospush h_findfile ;hFindFile, handle of searchcall FindNextFileA ;- API Function -cmp eax,1h ;success ?je My_GetFileControls_Loop ;loopMy_GetFileControls_Return:;------------------------------------------------------------------------------; API "FindClose" closes the specified search handle.;------------------------------------------------------------------------------push h_findfile ;hFindFile, handle of searchcall FindClose ;- API Function -ret;******************************************************************************

;==============================================================================; end Main = end of our program code;------------------------------------------------------------------------------end Main ;end of our program code, entry point

;==============================================================================; To create the exe file use this commands with your Microsoft Assembler/Linker;------------------------------------------------------------------------------; ml.exe /c /coff td_win32asm_610.asm ;asm command; rc.exe /v rsrc.rc ;rc command; cvtres.exe /machine:ix86 rsrc.res; link.exe /subsystem:windows td_win32asm_610.obj rsrc.obj ;link command;==============================================================================

Page 13


Recommended