为方便汇编爱好者交流,程序源码贴上。
.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\advapi32.inc
includelib \masm32\lib\advapi32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \MASM32\LIB\oleaut32.lib
include \MASM32\include\oleaut32.inc
DlgProc PROTO :DWORD,:DWORD,:DWORD,:DWORD
;BOOL GetVolumeInformation(
; LPCTSTR lpRootPathName, // address of root directory of the file system
; LPTSTR lpVolumeNameBuffer, // address of name of the volume
; DWORD nVolumeNameSize, // length of lpVolumeNameBuffer
; LPDWORD lpVolumeSerialNumber, // address of volume serial number
; LPDWORD lpMaximumComponentLength, // address of system's maximum filename length
; LPDWORD lpFileSystemFlags, // address of file system flags
; LPTSTR lpFileSystemNameBuffer, // address of name of file system
; DWORD nFileSystemNameSize // length of lpFileSystemNameBuffer
; );
.data
DlgName db "MyDialog",0
AppName db "注册程序,(C)电子管 2012.07.15",0
SerialNumber1 db "12345678",0
regNumber1 dd 0,0
mesberr_1 db "注册不成功",0
mesbok_1 db "注册成功",0
mesbok_2 db "注册请与本程序作者联系",20h dup(0)
.data?
hInstance HINSTANCE ?
CommandLine LPSTR ?
regbuffer1 db 512 dup(?)
err1 dd ?
ok1 dd ?
msbx1 dd ?
getdt1 dd ?
ook1 dd ?
oer1 dd ?
oapp1 dd ?
.const
IDC_EDIT2 equ 3800
IDC_EDIT3 equ 3801
IDC_BUTTON equ 3001
IDC_EXIT equ 3002
.code
start: mov eax, MessageBox
mov msbx1,eax
mov eax,GetDlgItemText
mov getdt1,eax
invoke GetModuleHandle, NULL
mov hInstance,eax
invoke DialogBoxParam, hInstance, ADDR DlgName,NULL,addr DlgProc,NULL
invoke ExitProcess,eax
DlgProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
.IF uMsg==WM_INITDIALOG
invoke SetDlgItemText,hWnd,IDC_EDIT2,ADDR SerialNumber1