Accueil > > > [MASM32] KEYGEN TEMPLATE
[MASM32] KEYGEN TEMPLATE
Information sur la source
Description
Il s'agit d'un modèle de keygenerator que vous pouvez librement réutiliser, par exemple pour vos solutions de crackmes... Le code inclut un exemple d'implémentation de player de modules XM et la création d'ownerdrawn buttons. Pour conclure, je tiens à préciser que ce tout cela n'a rien d'illégal ! Aucune routine de génération pour une application commerciale quelconque n'a été incluse.
Source
- ; Keygen template
- ; ==============================================================================
- ; Author : Canterwood
- ; Website: http://kickme.to/canterwood
- ; IDE : MASM32 8
- ; ==============================================================================
- ; v2.2.1 [16.01.2004]
-
- .486
- .model flat, stdcall
- option casemap: none
-
- ; Lib functions
- ; ------------------------------------------------------------------------------
- include \\\\masm32\\\\include\\\\windows.inc
- include \\\\masm32\\\\include\\\\user32.inc
- include \\\\masm32\\\\include\\\\kernel32.inc
- include \\\\masm32\\\\include\\\\gdi32.inc
- include mfmplayer.inc ; XM player (thanks to Lise_Grim)
-
- includelib \\\\masm32\\\\lib\\\\user32.lib
- includelib \\\\masm32\\\\lib\\\\kernel32.lib
- includelib \\\\masm32\\\\lib\\\\gdi32.lib
- includelib mfmplayer.lib
-
- ; Additional libs
-
- ; ------------------------------------------------------------------------------
-
- ; Functions
- ; ------------------------------------------------------------------------------
- DialogProc PROTO : HWND, : UINT, : WPARAM, : LPARAM
- IdProc PROTO : HWND, : UINT, : WPARAM, : LPARAM
- InfoProc PROTO : HWND, : UINT, : WPARAM, : LPARAM
- DrawItem PROTO : HWND, : LPARAM
- KeygenProc PROTO : HWND
- ; ------------------------------------------------------------------------------
-
- .const
-
- ; Resource ids
- ; ------------------------------------------------------------------------------
- IDD_KEYGEN equ 100
- IDD_INFO equ 101
-
- IDI_KEYGEN equ 200
-
- IDC_TITLE equ 400
- IDC_ID equ 401
- IDC_GENERATE equ 402
- IDC_COPY equ 403
- IDC_EXIT equ 404
- IDC_NAME equ 405
- IDC_SERIAL equ 406
- IDC_INFO equ 407
- IDC_CLOSE equ 408
-
- IDM_KEYGEN equ 500
- ; ------------------------------------------------------------------------------
-
- ; Colors
- ; ------------------------------------------------------------------------------
- CR_BACKGROUND equ 00333366h
- CR_FOREGROUND equ 00333399h
- CR_HIGHLIGHT equ 00CCCCFFh
- CR_INPUT equ 003300CCh
- CR_INPUT2 equ 003300FFh
- CR_TEXT equ 009999FFh
- ; ------------------------------------------------------------------------------
-
- .data
-
- ; Keygen parameters
- ; ------------------------------------------------------------------------------
-
- ; Required data
- sId TCHAR "#?", 0
- sTitle TCHAR "Canterwood Reverseme #0 keygen", 0
- sDefaultName TCHAR "Canterwood", 0
- sInfo TCHAR "Canterwood Reverseme #0 keygen", 10, 13
- TCHAR "Protection: mirror effect", 10, 13
- TCHAR 10, 13
- TCHAR "Author: Canterwood", 10, 13
- TCHAR "WWW: http://kickme.to/canterwood", 10, 13
- TCHAR 10, 13
- TCHAR "Thanks to: +Analyst, Iczelion, ShmeitCorp, Lise_Grim, +Christal", 10, 13
- TCHAR "Greetings: NGEN, FFF, RIF, e!", 10, 13
- TCHAR 10, 13
- TCHAR "Music: Remember - Unknown", 10, 13
- TCHAR "Image: Tarantula Nebula - Hubble Heritage", 0
-
- ; Keygen definided-variables
- sValidError TCHAR "You must enter a name.", 0
-
- .data?
-
- ; Required data
- sName CHAR 20h dup(?)
- sSerial CHAR 60h dup(?)
-
- ; Keygen undefinided-variables
-
- ; ------------------------------------------------------------------------------
-
- hInstance HINSTANCE ?
-
- hIcon HICON ?
- hIdCursor HCURSOR ?
-
- ; Brushes & pens
- hBgColor HBRUSH ?
- hFgColor HBRUSH ?
- hInColor HBRUSH ?
- hIn2Color HBRUSH ?
- hEdge HPEN ?
-
- ; Font & text
- BoldFont LOGFONT <?>
- sBtnText TCHAR 16 dup(?)
-
- ; Music
- nMusicSize DWORD ?
- pMusic LPVOID ?
-
- DefIdProc WNDPROC ?
-
- .code
-
- start:
-
- INVOKE GetModuleHandle, NULL
- mov hInstance, eax
-
- ; Load icon & cursor
- INVOKE LoadIcon, eax, IDI_KEYGEN
- mov hIcon, eax
- INVOKE LoadCursor, NULL, IDC_HAND
- mov hIdCursor, eax
-
- ; Create brushes for custom colors
- INVOKE CreateSolidBrush, CR_BACKGROUND
- mov hBgColor, eax
- INVOKE CreateSolidBrush, CR_FOREGROUND
- mov hFgColor, eax
- INVOKE CreateSolidBrush, CR_INPUT
- mov hInColor, eax
- INVOKE CreateSolidBrush, CR_INPUT2
- mov hIn2Color, eax
- INVOKE CreatePen, PS_INSIDEFRAME, 1, CR_FOREGROUND
- mov hEdge, eax
-
- ; Load the music
- push esi
- INVOKE FindResource, hInstance, IDM_KEYGEN, RT_RCDATA
- push eax
- INVOKE SizeofResource, hInstance, eax
- mov nMusicSize, eax
- pop eax
- INVOKE LoadResource, hInstance, eax
- INVOKE LockResource, eax
- mov esi, eax
- mov eax, nMusicSize
- add eax, SIZEOF nMusicSize
- INVOKE GlobalAlloc, GPTR, eax
- mov pMusic, eax
- mov ecx, nMusicSize
- mov dword ptr [eax], ecx
- add eax, SIZEOF nMusicSize
- mov edi, eax
- rep movsb
- pop esi
-
- ; Show the dialog box
- INVOKE DialogBoxParam, hInstance, IDD_KEYGEN, NULL, ADDR DialogProc, 0
-
- ; Restore the memory used for the music
- INVOKE GlobalFree, pMusic
-
- ; Restore the memory used for graphic objects
- INVOKE DeleteObject, hEdge
- INVOKE DeleteObject, hInColor
- INVOKE DeleteObject, hIn2Color
- INVOKE DeleteObject, hFgColor
- INVOKE DeleteObject, hBgColor
-
- ; Exit the program
- INVOKE ExitProcess, 0
-
- ; Dialog procedure
- ; ------------------------------------------------------------------------------
- DialogProc PROC hWnd: HWND, uMsg: UINT, wParam: WPARAM, lParam: LPARAM
-
- .IF uMsg == WM_CTLCOLORDLG
- mov eax, hBgColor
- ret
- .ELSEIF uMsg == WM_CTLCOLORSTATIC
- INVOKE GetDlgCtrlID, lParam
-
- .IF eax == IDC_TITLE
- INVOKE SendMessage, hWnd, WM_GETFONT, 0, 0
- INVOKE GetObject, eax, SIZEOF LOGFONT, ADDR BoldFont
- mov BoldFont.lfWeight, FW_BOLD
- mov BoldFont.lfItalic, TRUE
- INVOKE CreateFontIndirect, ADDR BoldFont
- INVOKE SelectObject, wParam, eax
-
- INVOKE SetBkMode, wParam, TRANSPARENT
- INVOKE SetTextColor, wParam, CR_HIGHLIGHT
- mov eax, hFgColor
- ret
- .ELSE
- INVOKE SetBkMode, wParam, TRANSPARENT
-
- .IF eax == IDC_SERIAL
- INVOKE SetTextColor, wParam, CR_HIGHLIGHT
- .ELSE
- INVOKE SetTextColor, wParam, CR_TEXT
- .ENDIF
-
- mov eax, hBgColor
- ret
- .ENDIF
-
- .ELSEIF uMsg == WM_CTLCOLOREDIT
- INVOKE SetBkMode, wParam, TRANSPARENT
- INVOKE SetTextColor, wParam, CR_HIGHLIGHT
- mov eax, hInColor
- ret
- .ELSEIF uMsg == WM_DRAWITEM
- INVOKE DrawItem, hWnd, lParam
- .ELSEIF uMsg == WM_LBUTTONDOWN
- INVOKE SendMessage, hWnd, WM_NCLBUTTONDOWN, HTCAPTION, lParam
- .ELSEIF uMsg == WM_COMMAND
- mov eax,wParam
- mov edx,wParam
- shr edx,16
-
- .IF wParam == IDC_ID
- INVOKE DialogBoxParam, hInstance, IDD_INFO, hWnd, ADDR InfoProc, 0
- .ELSEIF (edx == EN_UPDATE && ax == IDC_NAME) || wParam == IDC_GENERATE
- INVOKE KeygenProc, hWnd
- .ELSEIF wParam == IDC_COPY
- INVOKE GetDlgItemText, hWnd, IDC_SERIAL, ADDR sSerial, SIZEOF sSerial
-
- .IF eax != 0
- INVOKE OpenClipboard, hWnd
-
- .IF eax
- INVOKE GlobalAlloc, GMEM_MOVEABLE or GMEM_DDESHARE, SIZEOF sSerial
-
- .IF eax != NULL
- push eax
- push eax
-
- INVOKE GlobalLock, eax
- mov edi, eax
- mov esi, OFFSET sSerial
- mov ecx, SIZEOF sSerial
- rep movsb
- pop eax
- INVOKE GlobalUnlock, eax
-
- INVOKE EmptyClipboard
- pop eax
- INVOKE SetClipboardData, CF_TEXT, eax
- .ENDIF
-
- INVOKE CloseClipboard
- .ENDIF
-
- .ENDIF
-
- .ELSEIF wParam == IDC_EXIT
- INVOKE SendMessage, hWnd, WM_CLOSE, 0, 0
- .ENDIF
-
- .ELSEIF uMsg == WM_INITDIALOG
-
- ; Subclass the id control
- INVOKE GetDlgItem, hWnd, IDC_ID
- INVOKE SetWindowLong, eax, GWL_WNDPROC, ADDR IdProc
- mov DefIdProc, eax
-
- INVOKE SendMessage, hWnd, WM_SETICON, ICON_BIG, hIcon
-
- ; Set the limit for the name text field
- INVOKE SendDlgItemMessage, hWnd, IDC_NAME, EM_SETLIMITTEXT, SIZEOF sName - 1, 0
-
- INVOKE SetWindowText, hWnd, ADDR sTitle
- INVOKE SetDlgItemText, hWnd, IDC_TITLE, ADDR sTitle
- INVOKE SetDlgItemText, hWnd, IDC_ID, ADDR sId
- INVOKE SetDlgItemText, hWnd, IDC_NAME, ADDR sDefaultName
-
- INVOKE mfmPlay, pMusic
-
- INVOKE KeygenProc, hWnd
- .ELSEIF uMsg == WM_CLOSE
- INVOKE mfmPlay, 0
-
- INVOKE EndDialog, hWnd, 0
- .ENDIF
-
- xor eax, eax
- ret
- DialogProc ENDP
- ; ------------------------------------------------------------------------------
-
- ; Id procedure
- ; ------------------------------------------------------------------------------
- IdProc PROC hWnd: HWND, uMsg: UINT, wParam: WPARAM, lParam: LPARAM
-
- .IF uMsg == WM_SETCURSOR
- INVOKE SetCursor, hIdCursor
- .ELSE
- INVOKE CallWindowProc, DefIdProc, hWnd, uMsg, wParam, lParam
- ret
- .ENDIF
-
- xor eax, eax
- ret
- IdProc ENDP
- ; ------------------------------------------------------------------------------
-
- InfoProc PROC hWnd: HWND, uMsg: UINT, wParam: WPARAM, lParam: LPARAM
-
- .IF uMsg == WM_CTLCOLORDLG
- mov eax, hFgColor
- ret
- .ELSEIF uMsg == WM_CTLCOLORSTATIC
- INVOKE SetBkMode, wParam, TRANSPARENT
- INVOKE SetTextColor, wParam, CR_TEXT
- mov eax, hBgColor
- ret
- .ELSEIF uMsg == WM_DRAWITEM
- INVOKE DrawItem, hWnd, lParam
- .ELSEIF uMsg == WM_INITDIALOG
- INVOKE SetDlgItemText, hWnd, IDC_INFO, ADDR sInfo
- .ELSEIF uMsg == WM_COMMAND
-
- .IF wParam == IDC_CLOSE
- INVOKE SendMessage, hWnd, WM_CLOSE, 0, 0
- .ENDIF
-
- .ELSEIF uMsg == WM_CLOSE
- INVOKE EndDialog, hWnd, 0
- .ENDIF
-
- xor eax, eax
- ret
- InfoProc ENDP
-
- DrawItem PROC hWnd: HWND, lParam: LPARAM
- push esi
- mov esi, lParam
- assume esi: ptr DRAWITEMSTRUCT
-
- .IF [esi].itemState & ODS_SELECTED
- INVOKE SelectObject, [esi].hdc, hIn2Color
- .ELSE
- INVOKE SelectObject, [esi].hdc, hInColor
- .ENDIF
-
- INVOKE SelectObject, [esi].hdc, hEdge
-
- INVOKE FillRect, [esi].hdc, ADDR [esi].rcItem, hFgColor
- INVOKE RoundRect, [esi].hdc, [esi].rcItem.left, [esi].rcItem.top, [esi].rcItem.right, [esi].rcItem.bottom, 6, 6
-
- .IF [esi].itemState & ODS_SELECTED
- INVOKE OffsetRect, ADDR [esi].rcItem, 1, 1
- .ENDIF
-
- ; Write the text
- INVOKE GetDlgItemText, hWnd, [esi].CtlID, ADDR sBtnText, SIZEOF sBtnText
- INVOKE SetBkMode, [esi].hdc, TRANSPARENT
- INVOKE SetTextColor, [esi].hdc, CR_HIGHLIGHT
- INVOKE DrawText, [esi].hdc, ADDR sBtnText, -1, ADDR [esi].rcItem, DT_CENTER or DT_VCENTER or DT_SINGLELINE
-
- .IF [esi].itemState & ODS_SELECTED
- INVOKE OffsetRect, ADDR [esi].rcItem, -1, -1
- .ENDIF
-
- ; Draw the focus rectangle
- .IF [esi].itemState & ODS_FOCUS
- INVOKE InflateRect, ADDR [esi].rcItem, -3, -3
- ;INVOKE DrawFocusRect, [esi].hdc, ADDR [esi].rcItem
- .ENDIF
-
- assume esi:nothing
- pop esi
- mov eax, TRUE
- ret
- DrawItem ENDP
-
- ; Keygen procedure
- ; ------------------------------------------------------------------------------
- KeygenProc PROC hWnd: HWND
- push edi
- push esi
- push ebx
-
- INVOKE GetDlgItemText, hWnd, IDC_NAME, ADDR sName, SIZEOF sName
- cmp eax, 0
- je ValidityError
-
- ; Generation routine
- lea esi, sName
- lea edi, sSerial
- mov ecx, eax
- xor ebx, ebx
-
- reverse:
- mov al, byte ptr[esi+ecx-1]
- mov byte ptr[edi+ebx], al
- inc ebx
- dec ecx
- jnz reverse
-
- mov byte ptr[edi+ebx], 0
- INVOKE SetDlgItemText, hWnd, IDC_SERIAL, ADDR sSerial
- jmp EndGen
-
- ValidityError:
- INVOKE SetDlgItemText, hWnd, IDC_SERIAL, ADDR sValidError
-
- EndGen:
- pop ebx
- pop esi
- pop edi
- ret
- KeygenProc ENDP
- ; ------------------------------------------------------------------------------
-
- END start
; Keygen template
; ==============================================================================
; Author : Canterwood
; Website: http://kickme.to/canterwood
; IDE : MASM32 8
; ==============================================================================
; v2.2.1 [16.01.2004]
.486
.model flat, stdcall
option casemap: none
; Lib functions
; ------------------------------------------------------------------------------
include \\\\masm32\\\\include\\\\windows.inc
include \\\\masm32\\\\include\\\\user32.inc
include \\\\masm32\\\\include\\\\kernel32.inc
include \\\\masm32\\\\include\\\\gdi32.inc
include mfmplayer.inc ; XM player (thanks to Lise_Grim)
includelib \\\\masm32\\\\lib\\\\user32.lib
includelib \\\\masm32\\\\lib\\\\kernel32.lib
includelib \\\\masm32\\\\lib\\\\gdi32.lib
includelib mfmplayer.lib
; Additional libs
; ------------------------------------------------------------------------------
; Functions
; ------------------------------------------------------------------------------
DialogProc PROTO : HWND, : UINT, : WPARAM, : LPARAM
IdProc PROTO : HWND, : UINT, : WPARAM, : LPARAM
InfoProc PROTO : HWND, : UINT, : WPARAM, : LPARAM
DrawItem PROTO : HWND, : LPARAM
KeygenProc PROTO : HWND
; ------------------------------------------------------------------------------
.const
; Resource ids
; ------------------------------------------------------------------------------
IDD_KEYGEN equ 100
IDD_INFO equ 101
IDI_KEYGEN equ 200
IDC_TITLE equ 400
IDC_ID equ 401
IDC_GENERATE equ 402
IDC_COPY equ 403
IDC_EXIT equ 404
IDC_NAME equ 405
IDC_SERIAL equ 406
IDC_INFO equ 407
IDC_CLOSE equ 408
IDM_KEYGEN equ 500
; ------------------------------------------------------------------------------
; Colors
; ------------------------------------------------------------------------------
CR_BACKGROUND equ 00333366h
CR_FOREGROUND equ 00333399h
CR_HIGHLIGHT equ 00CCCCFFh
CR_INPUT equ 003300CCh
CR_INPUT2 equ 003300FFh
CR_TEXT equ 009999FFh
; ------------------------------------------------------------------------------
.data
; Keygen parameters
; ------------------------------------------------------------------------------
; Required data
sId TCHAR "#?", 0
sTitle TCHAR "Canterwood Reverseme #0 keygen", 0
sDefaultName TCHAR "Canterwood", 0
sInfo TCHAR "Canterwood Reverseme #0 keygen", 10, 13
TCHAR "Protection: mirror effect", 10, 13
TCHAR 10, 13
TCHAR "Author: Canterwood", 10, 13
TCHAR "WWW: http://kickme.to/canterwood", 10, 13
TCHAR 10, 13
TCHAR "Thanks to: +Analyst, Iczelion, ShmeitCorp, Lise_Grim, +Christal", 10, 13
TCHAR "Greetings: NGEN, FFF, RIF, e!", 10, 13
TCHAR 10, 13
TCHAR "Music: Remember - Unknown", 10, 13
TCHAR "Image: Tarantula Nebula - Hubble Heritage", 0
; Keygen definided-variables
sValidError TCHAR "You must enter a name.", 0
.data?
; Required data
sName CHAR 20h dup(?)
sSerial CHAR 60h dup(?)
; Keygen undefinided-variables
; ------------------------------------------------------------------------------
hInstance HINSTANCE ?
hIcon HICON ?
hIdCursor HCURSOR ?
; Brushes & pens
hBgColor HBRUSH ?
hFgColor HBRUSH ?
hInColor HBRUSH ?
hIn2Color HBRUSH ?
hEdge HPEN ?
; Font & text
BoldFont LOGFONT <?>
sBtnText TCHAR 16 dup(?)
; Music
nMusicSize DWORD ?
pMusic LPVOID ?
DefIdProc WNDPROC ?
.code
start:
INVOKE GetModuleHandle, NULL
mov hInstance, eax
; Load icon & cursor
INVOKE LoadIcon, eax, IDI_KEYGEN
mov hIcon, eax
INVOKE LoadCursor, NULL, IDC_HAND
mov hIdCursor, eax
; Create brushes for custom colors
INVOKE CreateSolidBrush, CR_BACKGROUND
mov hBgColor, eax
INVOKE CreateSolidBrush, CR_FOREGROUND
mov hFgColor, eax
INVOKE CreateSolidBrush, CR_INPUT
mov hInColor, eax
INVOKE CreateSolidBrush, CR_INPUT2
mov hIn2Color, eax
INVOKE CreatePen, PS_INSIDEFRAME, 1, CR_FOREGROUND
mov hEdge, eax
; Load the music
push esi
INVOKE FindResource, hInstance, IDM_KEYGEN, RT_RCDATA
push eax
INVOKE SizeofResource, hInstance, eax
mov nMusicSize, eax
pop eax
INVOKE LoadResource, hInstance, eax
INVOKE LockResource, eax
mov esi, eax
mov eax, nMusicSize
add eax, SIZEOF nMusicSize
INVOKE GlobalAlloc, GPTR, eax
mov pMusic, eax
mov ecx, nMusicSize
mov dword ptr [eax], ecx
add eax, SIZEOF nMusicSize
mov edi, eax
rep movsb
pop esi
; Show the dialog box
INVOKE DialogBoxParam, hInstance, IDD_KEYGEN, NULL, ADDR DialogProc, 0
; Restore the memory used for the music
INVOKE GlobalFree, pMusic
; Restore the memory used for graphic objects
INVOKE DeleteObject, hEdge
INVOKE DeleteObject, hInColor
INVOKE DeleteObject, hIn2Color
INVOKE DeleteObject, hFgColor
INVOKE DeleteObject, hBgColor
; Exit the program
INVOKE ExitProcess, 0
; Dialog procedure
; ------------------------------------------------------------------------------
DialogProc PROC hWnd: HWND, uMsg: UINT, wParam: WPARAM, lParam: LPARAM
.IF uMsg == WM_CTLCOLORDLG
mov eax, hBgColor
ret
.ELSEIF uMsg == WM_CTLCOLORSTATIC
INVOKE GetDlgCtrlID, lParam
.IF eax == IDC_TITLE
INVOKE SendMessage, hWnd, WM_GETFONT, 0, 0
INVOKE GetObject, eax, SIZEOF LOGFONT, ADDR BoldFont
mov BoldFont.lfWeight, FW_BOLD
mov BoldFont.lfItalic, TRUE
INVOKE CreateFontIndirect, ADDR BoldFont
INVOKE SelectObject, wParam, eax
INVOKE SetBkMode, wParam, TRANSPARENT
INVOKE SetTextColor, wParam, CR_HIGHLIGHT
mov eax, hFgColor
ret
.ELSE
INVOKE SetBkMode, wParam, TRANSPARENT
.IF eax == IDC_SERIAL
INVOKE SetTextColor, wParam, CR_HIGHLIGHT
.ELSE
INVOKE SetTextColor, wParam, CR_TEXT
.ENDIF
mov eax, hBgColor
ret
.ENDIF
.ELSEIF uMsg == WM_CTLCOLOREDIT
INVOKE SetBkMode, wParam, TRANSPARENT
INVOKE SetTextColor, wParam, CR_HIGHLIGHT
mov eax, hInColor
ret
.ELSEIF uMsg == WM_DRAWITEM
INVOKE DrawItem, hWnd, lParam
.ELSEIF uMsg == WM_LBUTTONDOWN
INVOKE SendMessage, hWnd, WM_NCLBUTTONDOWN, HTCAPTION, lParam
.ELSEIF uMsg == WM_COMMAND
mov eax,wParam
mov edx,wParam
shr edx,16
.IF wParam == IDC_ID
INVOKE DialogBoxParam, hInstance, IDD_INFO, hWnd, ADDR InfoProc, 0
.ELSEIF (edx == EN_UPDATE && ax == IDC_NAME) || wParam == IDC_GENERATE
INVOKE KeygenProc, hWnd
.ELSEIF wParam == IDC_COPY
INVOKE GetDlgItemText, hWnd, IDC_SERIAL, ADDR sSerial, SIZEOF sSerial
.IF eax != 0
INVOKE OpenClipboard, hWnd
.IF eax
INVOKE GlobalAlloc, GMEM_MOVEABLE or GMEM_DDESHARE, SIZEOF sSerial
.IF eax != NULL
push eax
push eax
INVOKE GlobalLock, eax
mov edi, eax
mov esi, OFFSET sSerial
mov ecx, SIZEOF sSerial
rep movsb
pop eax
INVOKE GlobalUnlock, eax
INVOKE EmptyClipboard
pop eax
INVOKE SetClipboardData, CF_TEXT, eax
.ENDIF
INVOKE CloseClipboard
.ENDIF
.ENDIF
.ELSEIF wParam == IDC_EXIT
INVOKE SendMessage, hWnd, WM_CLOSE, 0, 0
.ENDIF
.ELSEIF uMsg == WM_INITDIALOG
; Subclass the id control
INVOKE GetDlgItem, hWnd, IDC_ID
INVOKE SetWindowLong, eax, GWL_WNDPROC, ADDR IdProc
mov DefIdProc, eax
INVOKE SendMessage, hWnd, WM_SETICON, ICON_BIG, hIcon
; Set the limit for the name text field
INVOKE SendDlgItemMessage, hWnd, IDC_NAME, EM_SETLIMITTEXT, SIZEOF sName - 1, 0
INVOKE SetWindowText, hWnd, ADDR sTitle
INVOKE SetDlgItemText, hWnd, IDC_TITLE, ADDR sTitle
INVOKE SetDlgItemText, hWnd, IDC_ID, ADDR sId
INVOKE SetDlgItemText, hWnd, IDC_NAME, ADDR sDefaultName
INVOKE mfmPlay, pMusic
INVOKE KeygenProc, hWnd
.ELSEIF uMsg == WM_CLOSE
INVOKE mfmPlay, 0
INVOKE EndDialog, hWnd, 0
.ENDIF
xor eax, eax
ret
DialogProc ENDP
; ------------------------------------------------------------------------------
; Id procedure
; ------------------------------------------------------------------------------
IdProc PROC hWnd: HWND, uMsg: UINT, wParam: WPARAM, lParam: LPARAM
.IF uMsg == WM_SETCURSOR
INVOKE SetCursor, hIdCursor
.ELSE
INVOKE CallWindowProc, DefIdProc, hWnd, uMsg, wParam, lParam
ret
.ENDIF
xor eax, eax
ret
IdProc ENDP
; ------------------------------------------------------------------------------
InfoProc PROC hWnd: HWND, uMsg: UINT, wParam: WPARAM, lParam: LPARAM
.IF uMsg == WM_CTLCOLORDLG
mov eax, hFgColor
ret
.ELSEIF uMsg == WM_CTLCOLORSTATIC
INVOKE SetBkMode, wParam, TRANSPARENT
INVOKE SetTextColor, wParam, CR_TEXT
mov eax, hBgColor
ret
.ELSEIF uMsg == WM_DRAWITEM
INVOKE DrawItem, hWnd, lParam
.ELSEIF uMsg == WM_INITDIALOG
INVOKE SetDlgItemText, hWnd, IDC_INFO, ADDR sInfo
.ELSEIF uMsg == WM_COMMAND
.IF wParam == IDC_CLOSE
INVOKE SendMessage, hWnd, WM_CLOSE, 0, 0
.ENDIF
.ELSEIF uMsg == WM_CLOSE
INVOKE EndDialog, hWnd, 0
.ENDIF
xor eax, eax
ret
InfoProc ENDP
DrawItem PROC hWnd: HWND, lParam: LPARAM
push esi
mov esi, lParam
assume esi: ptr DRAWITEMSTRUCT
.IF [esi].itemState & ODS_SELECTED
INVOKE SelectObject, [esi].hdc, hIn2Color
.ELSE
INVOKE SelectObject, [esi].hdc, hInColor
.ENDIF
INVOKE SelectObject, [esi].hdc, hEdge
INVOKE FillRect, [esi].hdc, ADDR [esi].rcItem, hFgColor
INVOKE RoundRect, [esi].hdc, [esi].rcItem.left, [esi].rcItem.top, [esi].rcItem.right, [esi].rcItem.bottom, 6, 6
.IF [esi].itemState & ODS_SELECTED
INVOKE OffsetRect, ADDR [esi].rcItem, 1, 1
.ENDIF
; Write the text
INVOKE GetDlgItemText, hWnd, [esi].CtlID, ADDR sBtnText, SIZEOF sBtnText
INVOKE SetBkMode, [esi].hdc, TRANSPARENT
INVOKE SetTextColor, [esi].hdc, CR_HIGHLIGHT
INVOKE DrawText, [esi].hdc, ADDR sBtnText, -1, ADDR [esi].rcItem, DT_CENTER or DT_VCENTER or DT_SINGLELINE
.IF [esi].itemState & ODS_SELECTED
INVOKE OffsetRect, ADDR [esi].rcItem, -1, -1
.ENDIF
; Draw the focus rectangle
.IF [esi].itemState & ODS_FOCUS
INVOKE InflateRect, ADDR [esi].rcItem, -3, -3
;INVOKE DrawFocusRect, [esi].hdc, ADDR [esi].rcItem
.ENDIF
assume esi:nothing
pop esi
mov eax, TRUE
ret
DrawItem ENDP
; Keygen procedure
; ------------------------------------------------------------------------------
KeygenProc PROC hWnd: HWND
push edi
push esi
push ebx
INVOKE GetDlgItemText, hWnd, IDC_NAME, ADDR sName, SIZEOF sName
cmp eax, 0
je ValidityError
; Generation routine
lea esi, sName
lea edi, sSerial
mov ecx, eax
xor ebx, ebx
reverse:
mov al, byte ptr[esi+ecx-1]
mov byte ptr[edi+ebx], al
inc ebx
dec ecx
jnz reverse
mov byte ptr[edi+ebx], 0
INVOKE SetDlgItemText, hWnd, IDC_SERIAL, ADDR sSerial
jmp EndGen
ValidityError:
INVOKE SetDlgItemText, hWnd, IDC_SERIAL, ADDR sValidError
EndGen:
pop ebx
pop esi
pop edi
ret
KeygenProc ENDP
; ------------------------------------------------------------------------------
END start
Conclusion
Normalement, les nouvelles versions (s'il y a) se trouveront sur http://zor.org/canterwood.
Historique
- 02 février 2008 12:55:01 :
- J'ai enlevé le mail (spam)
Sources du même auteur
Sources de la même categorie
Commentaires et avis
Discussions en rapport avec ce code source dans le forum
Image jpg en Masm32 [ par phoenix1969asm ]
Tout d'abord Merci pour l'aide que vous allez m'apporterje debute est je dois dire que je nage un peu ...je souhaiterai afficher une image Jpg de mani
MASM32 et les types enumération. [ par frobinet ]
Bonjour,comment peut on traduire la séquence suivante qui provient du C en language assembleur MASM32 :enum enum_field_types { FIELD_TYPE_DECIMAL, FIE
masm32, include [ par coockiesch ]
Hello!!!Plein de bonne volonté, j'ai dl un tuto pour ASM Win32... Voici mon code:.386.MODEL FLAT, STDCALLOPTION CASEMAP : NONEINCLUDE \masm32\in
Problème sur les thèmes XP [MASM32] [ par frobinet ]
Bonjour,je recherche des infos pour appliquer les thèmes XP en assembleur pour les boutons...J'ai vu qu'il faut utiliser les fonctions OpenThemeData,D
[MASM32] Comment utiliser RECORD ? [ par frobinet ]
Bonjour,J'essaie de faire un programme simple en RS232 pour piloterun modem et je bloque sur la structure du DCB qui comportele RECORD 'fbits' qui est
La gestion de la pile dans masm32 [ par ToutEnMasm ]
Par défaut la pile d'un programme masm32 est fixé a 4096 octets soit une page.je sais comment modifier cette taille au link mais je ne sais pas commen
Scolling Text masm32 [ par Bros ]
HelloJ'aimerais bien faire un scrolling text de bas en haut en masm32 (un peu comme dans le about de emule)Quelqu'un aurait-il une idée de comment pro
segment partagé en masm32 [ par anthraxx ]
bonjour a tous,je connais l'assembleur mais je suis pas tres habitué a masm32, et je me demandais ce qu'il faut mettre pour qu'un segment donné de ma
MASM32 et Performances ???? [ par gor00 ]
Salut à tous, Je me posé une question à propos des programmes en assembleur réalisés à l'aide de MASM32. Cet outil propose plusieurs fonctions et libr
MASM32 et EDITASM ??? [ par DeAtHCrAsH ]
Salut,Je viens de faire un tour sur le site de ToutEnAsm et j'ai dl masm32.Maintenant j'aimerai apprendre le MASM mais je n'ai trouvé aucun bien struc
|
Derniers Blogs
TECHDAYS PARIS 2010 : LA BI DANS SHAREPOINT 2010TECHDAYS PARIS 2010 : LA BI DANS SHAREPOINT 2010 par ROMELARD Fabrice
Animé par: Vincent Bellet et Baptiste Giraudier La BI dans SharePoint 2010, Les nouveaux services d'application dans SP2010 et SQL Server Reporting services 2008 R2. La BI dans SharePoint est généralisée pour tous afin de permettre à tous les coll...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice TECHDAYS PARIS 2010 : PLAN DE MIGRATION VERS SHAREPOINT 2010TECHDAYS PARIS 2010 : PLAN DE MIGRATION VERS SHAREPOINT 2010 par ROMELARD Fabrice
Animé par: Arnault Nouvel et Antoine Dongois Le processus à prendre : Apprendre (découvrir la plateforme) Préparer (documenter l'historique et choisir la méthode de MAJ) Test (Test de MAJ) Implémenter (Effectuer la MAJ) Valid...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice TECHDAYS PARIS 2010 : LA PLEINIèRE DU SECOND JOURTECHDAYS PARIS 2010 : LA PLEINIèRE DU SECOND JOUR par ROMELARD Fabrice
Après un retour sur l'histoire des TechDays de Paris et le fait que ce soit le plus gros event MS au monde (du fait de sa gratuité), le président de MS France (Eric Boustoullier) a fait une présentation de la vision Microsoft pour les années à venir...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice
Forum
RE : PIC 16F84RE : PIC 16F84 par pont
Cliquez pour lire la suite par pont RE : PIC 16F84RE : PIC 16F84 par belounis
Cliquez pour lire la suite par belounis RE : PIC 16F84RE : PIC 16F84 par pont
Cliquez pour lire la suite par pont
Logiciels
DB-MAIN (9.1.0)DB-MAIN (9.1.0)DB-MAIN is a data-modeling and data-architecture tool. It is designed to help developers and anal... Cliquez pour télécharger DB-MAIN Xilisoft DPG Convertisseur (5.1.37.0120)XILISOFT DPG CONVERTISSEUR (5.1.37.0120)Xilisoft DPG Convertisseur offre aux fans de Nintendo DS une bonne solution leur permettant de dé... Cliquez pour télécharger Xilisoft DPG Convertisseur GraphicsGale (2.01.01)GRAPHICSGALE (2.01.01)GraphicsGale est un logiciel de PixelArt avec de nombreuse fonctionnalités permettant de réalisé ... Cliquez pour télécharger GraphicsGale Architecte 3D (Platinum 2010)ARCHITECTE 3D (PLATINUM 2010)Architecte 3D Platinium vous permet de concevoir facilement les plans votre future maison, de l'é... Cliquez pour télécharger Architecte 3D TeamViewer 5 (TeamViewer 5)TEAMVIEWER 5 (TEAMVIEWER 5)Dépanner un ami,expliquer une manipulation devient un jeu d'enfant.
Prise en main d'un autre ord... Cliquez pour télécharger TeamViewer 5
|