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

Td Win32asm 015.Asm

Date post: 02-Jun-2018
Category:
Upload: z4rm4r
View: 241 times
Download: 0 times
Share this document with a friend

of 14

Transcript
  • 8/10/2019 Td Win32asm 015.Asm

    1/14

    td_win32asm_015.asm;==============================================================================; Test Department's WINDOWS 32 BIT x86 ASSEMBLY example 015;==============================================================================

    ;==============================================================================; ==> Part 015 : ListView class and Clipboard usuage;------------------------------------------------------------------------------

    ; Hello,; today you are on your own.;; Test Department [email protected]

    ;==============================================================================; Assembler directives;------------------------------------------------------------------------------.386 ; specifies the processor our program want run on.Model Flat ,StdCall ; Flat for Win9x (32 Bit), Calling Convention

    option casemap:none ; case sensitive !;==============================================================================; Include all files where API functins resist you want use, set correct path;------------------------------------------------------------------------------include D:\Masm32\include\windows.incincludelib kernel32.libincludelib user32.libincludelib comctl32.lib

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

    ; Declaration of used API functions,take a look into WIN32.HLP and *.inc files;------------------------------------------------------------------------------GetModuleHandleA PROTO :DWORDLoadIconA PROTO :DWORD,:DWORDLoadCursorA PROTO :DWORD,:DWORDRegisterClassExA PROTO :DWORDCreateWindowExA PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD, :DWORD,:DWORD,:DWORD,:DWORD,:DWORDShowWindow PROTO :DWORD,:DWORDUpdateWindow PROTO :DWORD

    GetMessageA PROTO :DWORD,:DWORD,:DWORD,:DWORDTranslateMessage PROTO :DWORDDispatchMessageA PROTO :DWORDPostQuitMessage PROTO :DWORDDefWindowProcA PROTO :DWORD,:DWORD,:DWORD,:DWORDExitProcess PROTO :DWORDDestroyWindow PROTO :DWORDSendMessageA PROTO :DWORD,:DWORD,:DWORD,:DWORDSetFocus PROTO :DWORDlstrcpy PROTO :DWORD,:DWORDInvalidateRect PROTO :DWORD,:DWORD,:DWORD

    InitCommonControls PROTO

    CreatePopupMenu PROTOAppendMenuA PROTO :DWORD,:DWORD,:DWORD,:DWORD

    Page 1

  • 8/10/2019 Td Win32asm 015.Asm

    2/14

    td_win32asm_015.asmGetCursorPos PROTO :DWORDTrackPopupMenuEx PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORDDestroyMenu PROTO :DWORD

    GlobalAlloc PROTO :DWORD,:DWORDGlobalLock PROTO :DWORDGlobalUnlock PROTO :DWORD

    GlobalFree PROTO :DWORD

    OpenClipboard PROTO :DWORDEmptyClipboard PROTOSetClipboardData PROTO :DWORD,:DWORDCloseClipboard PROTO

    ;==============================================================================; .const = the constants area starts here,constants are defined and fixed;------------------------------------------------------------------------------

    .const; - Parameter MAIN WINDOW CallBack Procedure ( API=RegisterClassExA ) -WP1_CallBack equ [ebp+4] ;return addressWP1_hWnd equ [ebp+8] ;handle of window who receives messageWP1_uMsg equ [ebp+12] ;the message numberWP1_wParam equ [ebp+16] ;extra info about the messageWP1_lParam equ [ebp+20] ;extra info about the message

    ;==============================================================================; .Data = the data area starts here, datas are defined but not fixed;------------------------------------------------------------------------------

    .DataIconName db "TDIcon",0 ;icon name in resourceClass db "TDWinClass",0 ;name of window classWindowName db "Test Department - http://surf.to/TestD",0class_SysListView32 db "SysListView32",0 ;predefined class

    Column0 db "Column 0",0 ;Column1 db "Column 1",0 ;Column2 db "Column 2",0 ;Column3 db "Column 3",0 ;

    Item0 db "Main Item 0",0 ;Item1 db "Main Item 1",0 ;SubItem01 db "SubItem 01",0 ;SubItem02 db "SubItem 02",0 ;SubItem03 db "SubItem 03",0 ;

    MenuItem_Copy db "Copy to Clipboard",0;MenuItem_Cancel db "Cancel",0 ;

    ;==============================================================================; .Data? = the data? area starts here, not defined and not fixed

    ;------------------------------------------------------------------------------.data?hWnd_ListView dd ? ;handle listbox window,hPopup dd ? ;handle popup menu

    Page 2

  • 8/10/2019 Td Win32asm 015.Asm

    3/14

    td_win32asm_015.asmh_Memory dd ? ;handle global memory objectp_Memory dd ? ;pointer global memoryBuffer db 104h dup (?) ;buffer

    align 4; - WndClassEx Structure ( API=RegisterClassExA ) -cbSize dd ? ;size in bytes of this structure

    style dd ? ;window stylelpfnWndProc dd ? ;address of user proc functioncbclsExtra dd ? ;extra bytes to allocate set to 0cbWndExtra dd ? ;extra bytes class directive, rc filehInstance dd ? ;program handle(API=GetModuleHandleA)hIcon dd ? ;handle of icon (API=LoadIconA)hcursor dd ? ;handle of cursor (API=LoadCursor)hbrBackground dd ? ;background color, 0=transparentlpszMenuName dd ? ;name of menu class in resource filelpszClassName dd ? ;name of windows this window class

    hIconSm dd ? ;iconhandle 0=search in resource filehdcDest dd ? ;handle of dest. device context

    align 4; - Msg Structure ( API=GetMessageA ) - member POINT = POINT structurehWnd dd ? ;handle of window who receives messagemessage dd ? ;the message numberwParam dd ? ;extra info about the messagelParam dd ? ;extra info about the messagetime dd ? ;time the message was postedxpt dd ? ;cursor x-position, POINT struc

    ypt dd ? ;cursor x-position, POINT struc

    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; - _LV_ITEM structure -LVI_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 ?

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

    Page 3

  • 8/10/2019 Td Win32asm 015.Asm

    4/14

  • 8/10/2019 Td Win32asm 015.Asm

    5/14

  • 8/10/2019 Td Win32asm 015.Asm

    6/14

  • 8/10/2019 Td Win32asm 015.Asm

    7/14

  • 8/10/2019 Td Win32asm 015.Asm

    8/14

  • 8/10/2019 Td Win32asm 015.Asm

    9/14

  • 8/10/2019 Td Win32asm 015.Asm

    10/14

  • 8/10/2019 Td Win32asm 015.Asm

    11/14

  • 8/10/2019 Td Win32asm 015.Asm

    12/14

  • 8/10/2019 Td Win32asm 015.Asm

    13/14

  • 8/10/2019 Td Win32asm 015.Asm

    14/14

    td_win32asm_015.asmend 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_015.asm ;asm command; rc.exe /v rsrc.rc ;rc command

    ; cvtres.exe /machine:ix86 rsrc.res; link.exe /subsystem:windows td_win32asm_015.obj rsrc.obj ;link command;==============================================================================

    Page 14


Recommended