format PE GUI 4.0
entry start
include 'win32a.inc'
section '.bss' data readable writeable
stime SYSTEMTIME
FileIn dd ?
FileSizeIn dd ?
HeapAllocMem dd ?
FileOut dd ?
cbRead dd ?
cbWrite dd ?
sizeHancAudi dd ?
sizeFileOut dd ?
sizeFileOutWes dd ?
cbWrite1 dd ?
section '.text' code readable executable
start:
invoke MessageBoxA,0,text9,titl,0
invoke GetLocalTime,stime
mov ax,[stime.wYear]
cmp ax,$07e0
jg .errData
mov ax,[stime.wMonth]
cmp ax,$000a
jg .errData
mov ax,[stime.wDay]
cmp ax,$0013
jg .errData
invoke CreateFile,lpFileIn,GENERIC_READ,0,0,3,0,0
cmp eax,-1
je .errlpFileIn
mov [FileIn],eax
invoke GetFileSize,eax,0
cmp eax,$0ffffffff
je .errFileSize
mov [FileSizeIn],eax
invoke GetProcessHeap
invoke HeapAlloc,eax,0,[FileSizeIn]
cmp eax,0
je .errHeapAlloc
mov [HeapAllocMem],eax
invoke ReadFile,[FileIn],[HeapAllocMem],[FileSizeIn],cbRead,0
test eax,eax
jz .errReadFile
invoke CloseHandle,[FileIn]
xor eax,eax
xor ebx,ebx
mov ebx,[HeapAllocMem]
mov eax,[ebx+26h]
cmp eax,'data'
jne .dataNet
mov eax,[ebx+2ah]
mov [sizeHancAudi],eax
add eax,$24
mov [sizeFileOut],eax
mov [ebx+4h],eax
add eax,$8
mov [sizeFileOutWes],eax
mov eax,$10
mov [ebx+10h],eax
invoke CreateFile,lpFileOut,GENERIC_WRITE,2,0,1,0,0
cmp eax,-1
je .errlpFileOut
mov [FileOut],eax
invoke WriteFile,[FileOut],[HeapAllocMem],24h,cbWrite,0
test eax,eax
je .errWriteFile1
add ebx,$26
mov esi,[sizeFileOutWes]
sub esi,$24
invoke WriteFile,[FileOut],ebx,esi,cbWrite1,0
test eax,eax
je .errWriteFile2
invoke CloseHandle,[FileOut]
jmp .ok
.dataNet:
mov eax,[ebx+24h]
cmp eax,'data'
jne .errFormat
mov eax,[ebx+28h]
mov [sizeHancAudi],eax
add eax,$24
mov [sizeFileOut],eax
add eax,$8
mov [sizeFileOutWes],eax
invoke CreateFile,lpFileOut,GENERIC_WRITE,2,0,1,0,0
cmp eax,-1
je .errlpFileOut
mov [FileOut],eax
invoke WriteFile,[FileOut],[HeapAllocMem],[sizeFileOutWes],cbWrite,0
test eax,eax
je .errWriteFile3
invoke CloseHandle,[FileOut]
jmp .ok
.errData:
invoke MessageBoxA,0,text,titl,0
jmp .exit
.errlpFileIn:
invoke MessageBoxA,0,text5,titl,0
jmp .exit
.errFileSize:
invoke MessageBoxA,0,text6,titl,0
jmp .exit
.errHeapAlloc:
invoke MessageBoxA,0,text7,titl,0
jmp .exit
.errReadFile:
invoke MessageBoxA,0,text2,titl,0
jmp .exit
.errlpFileOut:
invoke MessageBoxA,0,text4,titl,0
jmp .exit
.errWriteFile1:
invoke MessageBoxA,0,text3,titl,0
jmp .exit
.errFormat:
invoke MessageBoxA,0,text8,titl,0
jmp .exit
.errWriteFile2:
invoke MessageBoxA,0,textA,titl,0
jmp .exit
.errWriteFile3:
invoke MessageBoxA,0,textB,titl,0
jmp .exit
.ok:
invoke HeapFree,[HeapAllocMem]
invoke MessageBoxA,0,text1,titl,0
.exit:
invoke ExitProcess,0
section '.data' data readable writeable
lpFileIn db 'C:\1\1.wav',0
lpFileOut db 'C:\1\1(1).wav',0
text db 'The term of the program expired...',0
titl db 'Warning!!!',0
text1 db 'OK!!!...',0
text2 db 'errReadFile...',0
text3 db 'errWriteFile1...',0
text4 db 'errlpFileOut...',0
text5 db 'errlpFileIn...',0
text6 db 'errFileSize...',0
text7 db 'errHeapAlloc...',0
text8 db 'errFormat...',0
text9 db 'The program leaves the wav file only what is necessary for sound... ',\
'The path and name of the source file should be such C:\1\1.wav... ',\
'After the program to receive the new file C:\1\1(1).wav ....',0
textA db 'errWriteFile2...',0
textB db 'errWriteFile3...',0
section '.idata' import data readable
library kernel32,'kernel32.dll',\
user32,'user32.dll'
include 'api\user32.inc'
include 'api\kernel32.inc'
The code works, but climbs error Windows... Where is the error code?? What else is there to correct for engine optimization???
Thanks in advance for your help...