begin process at 2012 05 27 19:15:03
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Api Windows

 > [MASM32] KEYGEN TEMPLATE

[MASM32] KEYGEN TEMPLATE


 Information sur la source

Note :
8,8 / 10 - par 5 personnes
8,80 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10
Catégorie :Api Windows Classé sous :keygen, masm32, keygenning Niveau :Débutant Date de création :18/01/2004 Date de mise à jour :02/02/2008 12:55:01 Vu / téléchargé :17 874 / 1 206

Auteur : Dean

Ecrire un message privé
Commentaire sur cette source (0)
Ajouter un commentaire et/ou une note

 Description

Cliquez pour voir la capture en taille normale
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.

 Fichier Zip

Les Membres Club peuvent télécharger directement un fichier contenu dans le zip sans télécharger le zip en entier !

Télécharger le zip


 Historique

02 février 2008 12:55:01 :
J'ai enlevé le mail (spam)

 Sources du même auteur

Source avec Zip [WIN32ASM] ARGUMENTS LIGNE DE COMMANDE
Source avec Zip Source avec une capture [MASM32] CRACK (PATCH)

 Sources de la même categorie

Source avec Zip Source avec une capture BODY_ROTATION BASÉ SUR LE TRAVAIL DE TOM par jose2pepe
Source avec Zip Source avec une capture FROM TOM'S CUBE_ROTATION AND CUBE_5 CUBE COLOR RENDERIZED par jose2pepe
Source avec Zip REUTILISER N'IMPORTE QUEL PROGRAMME EX:WORDPAD par ToutEnMasm
Source avec Zip CRÉER DES TABLEAUX DE DONNÉES DE MANIÈRE DYNAMIQUE par ToutEnMasm
Source avec Zip AFFICHAGE DATE ET HEURE AVEC DES BITMAPS par jejamar

 Sources en rapport avec celle ci

Source avec Zip ECRIRE DANS BDR, DEMO MINIMALE (WIN32) par BruNews
Source avec Zip Source avec une capture RESOLUTION DE SUDOKU par noel70
Source avec Zip OBTENIR LA VERSION DU SYSTEME,SON ENVIRONNEMENT,LE SERVICE P... par ToutEnMasm
Source avec Zip CONNECTIONS INTERNET HTTP.. DIAL-UP CONNECTIONS par ToutEnMasm
Source avec Zip Source avec une capture SOLITAIRE EN MASM32 POUR WINDOWS par BLUEBIBUBBLE

Commentaires et avis

Aucun commentaire pour le moment.

 Ajouter un commentaire


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


Nos sponsors


Sondage...

CalendriCode

Mai 2012
LMMJVSD
 123456
78910111213
14151617181920
21222324252627
28293031   

Consulter la suite du CalendriCode

A découvrir



 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,562 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales