Author Topic: Uncle Remus Tales  (Read 56053 times)

jj2007

  • Member
  • *****
  • Posts: 12472
  • Assembler is fun ;-)
    • MasmBasic
Re: Uncle Remus Tales
« Reply #15 on: May 31, 2017, 12:24:08 AM »
But I had to write a little converter to see your cyrillic comments:

 :biggrin:

Why?

Oops, I forgot that everybody should read sources only in their own codepages. So, having an Italian OS, I am not allowed to see cyrillic comments, even if Google would be able to translate it for me, as demonstrated above. Sorry, Sir Nidud, I won't do it again 8)

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 9343
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Uncle Remus Tales
« Reply #16 on: May 31, 2017, 12:33:46 AM »
I downloaded and test it last night but gave up due to exhaustion as I had been awake too long. I could get it to run with VLC but the file was very large and the resolution very low.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

jj2007

  • Member
  • *****
  • Posts: 12472
  • Assembler is fun ;-)
    • MasmBasic
Re: Uncle Remus Tales
« Reply #17 on: May 31, 2017, 01:06:38 AM »
VLS runs it, FLV runs it but in distorted black & white.

The file output.avi is 156 MB, no sound, otherwise it wouldn't play with sysanimate32.

The control is very easy to use, just create it and then
Code: [Select]
invoke SendMessage, hAvi, ACM_OPEN, 0, pFileName
invoke SendMessage, hAvi, ACM_PLAY, -1, 0FFFF0000h

But its usage is really very limited, without sound, and working only with avi files that do not contain sound info.
Attached my dual 64/32-bit version; expects output.avi in the same folder.
« Last Edit: May 31, 2017, 03:44:34 AM by jj2007 »

nidud

  • Member
  • *****
  • Posts: 2390
    • https://github.com/nidud/asmc
Re: Uncle Remus Tales
« Reply #18 on: May 31, 2017, 01:35:54 AM »
deleted
« Last Edit: February 26, 2022, 12:31:51 AM by nidud »

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 9343
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Uncle Remus Tales
« Reply #19 on: June 02, 2017, 12:09:21 AM »
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

jj2007

  • Member
  • *****
  • Posts: 12472
  • Assembler is fun ;-)
    • MasmBasic
Re: Uncle Remus Tales
« Reply #20 on: June 02, 2017, 02:11:29 AM »
Almost unrelated:

Code: [Select]
uselib vfw32
...
invoke MCIWndCreate, hWnd, hInstance, 0, Chr$("chimes.wav")

Can't launch the program because vfw32.dll is not present.

But these files are present:
C:\Windows\SysWOW64\msvfw32.dll
C:\Windows\System32\msvfw32.dll
 ::)

TWell

  • Member
  • ****
  • Posts: 743
Re: Uncle Remus Tales
« Reply #21 on: June 02, 2017, 02:48:40 AM »
check that vfw.lib again.
SDK version of vfw.lib and msvfw.lib use MSVFW32.dll.
MCIWndCreate are in both of those libraries and it is a cdecl type ?


jj2007

  • Member
  • *****
  • Posts: 12472
  • Assembler is fun ;-)
    • MasmBasic
Re: Uncle Remus Tales
« Reply #22 on: June 02, 2017, 03:12:26 AM »
There is no \Masm32\lib\msvfw32.lib, only \Masm32\lib\vfw32.lib
And the latter produces that error message...

TWell

  • Member
  • ****
  • Posts: 743
Re: Uncle Remus Tales
« Reply #23 on: June 02, 2017, 03:18:44 AM »
So it is a broken library, make a bug report about it ;)

Correct vfw.lib have references to MSVFW32.DLL AVIFIL32.DLL AVICAP32.DLL
since 1994 ?

jj2007

  • Member
  • *****
  • Posts: 12472
  • Assembler is fun ;-)
    • MasmBasic
Re: Uncle Remus Tales
« Reply #24 on: June 02, 2017, 05:12:10 AM »
make a bug report about it ;)

Like this one?  ;)

Siekmanski

  • Member
  • *****
  • Posts: 2506
Re: Uncle Remus Tales
« Reply #25 on: June 02, 2017, 05:18:42 AM »
try this one.
Creative coders use backward thinking techniques as a strategy.

jj2007

  • Member
  • *****
  • Posts: 12472
  • Assembler is fun ;-)
    • MasmBasic
Re: Uncle Remus Tales
« Reply #26 on: June 02, 2017, 08:57:57 AM »
Nice. I wanted to extract the two files to my "Marinus" folder, and guess what? They were already there :P

Thanks anyway. In the meantime, I tested Pelle's vfw32.lib, it works, too.

Mikl__

  • Member
  • *****
  • Posts: 1203

jj2007

  • Member
  • *****
  • Posts: 12472
  • Assembler is fun ;-)
    • MasmBasic
Re: Uncle Remus Tales
« Reply #28 on: June 05, 2017, 10:08:53 AM »

Mikl__

  • Member
  • *****
  • Posts: 1203
Re: Uncle Remus Tales
« Reply #29 on: June 20, 2017, 12:47:29 PM »
Uncle Remus tales:#14 Process
asm-file
Code: [Select]
; GUI #
include win64a.inc
include advapi32.inc
includelib advapi32.lib

MI_PROCESS_CREATE equ 0
MI_PROCESS_TERMINATE equ 1
MI_EXIT equ 2
IDR_MAINMENU equ 30
WM_FINISH equ WM_USER+100h
MAX_KEY_LENGTH equ 255
MAX_VALUE_NAME equ 16383
.code
WinMain proc
local msg:MSG

      xor ebx,ebx
mov edi,offset ClassName
mov esi,IMAGE_BASE
mov ecx,offset FileName
invoke LoadCursorFromFile
push rax ;hIconSm
push rdi ;lpszClassName
push IDR_MAINMENU;lpszMenuName
push COLOR_WINDOW;hbrBackground
push 10003h ;hCursor
push rax ;hIcon
push rsi ;hInstance
push rbx ;cbClsExtra & cbWndExtra
pushaddr WndProc;lpfnWndProc
push sizeof WNDCLASSEX;cbSize & style
invoke RegisterClassEx,esp ;addr WNDCLASSEX
push rbx
push rsi ;rsi=400000h
shl esi,9 ;rsi=CW_USEDEFAULT
push rbx
push rbx
push 200
push 300
push rsi
push rsi
sub esp,20h
    invoke CreateWindowEx,WS_EX_CLIENTEDGE,edi,edi,WS_OVERLAPPEDWINDOW or WS_VISIBLE
invoke GetMenu,eax
mov hMenu,rax
    lea edi,msg
@@:    invoke GetMessage,edi,0,0,0
invoke DispatchMessage,edi
      jmp @b
WinMain endp

WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
local progStartInfo:STARTUPINFO
local hKey:qword
local lpcbData:dword
local hFile:qword
local szBuff[MAX_PATH*4]:byte

mov edi,offset processInfo
mov esi,offset proExitCode
mov hWnd,rcx
mov wParam,r8
mov lParam,r9

cmp  edx,WM_DESTROY
je   wmDESTROY
cmp  edx,WM_CREATE
je   wmCREATE
cmp  edx,WM_COMMAND
je   wmCOMMAND
cmp  edx,WM_INITMENUPOPUP
je   wmINITMENUPOPUP
cmp  edx,WM_FINISH
je   TERMINATE
cmp  edx,WM_TIMER
je   wmTIMER
leave
jmp DefWindowProc

wmDESTROY:invoke GetExitCodeProcess,[rdi+PROCESS_INFORMATION.hProcess],esi;proExitCode
cmp dword ptr [rsi],STILL_ACTIVE
jne @f
invoke TerminateProcess,[rdi+PROCESS_INFORMATION.hProcess],0
@@: invoke CloseHandle,[rdi+PROCESS_INFORMATION.hProcess]
mov [rdi+PROCESS_INFORMATION.hProcess],rbx
invoke ExitProcess,NULL
wmCREATE:
;Узнаем длительность проигрывания wmv-файла
mov [rsp+30h],rbx ;hTemplateFile
mov qword ptr [rsp+28h],FILE_ATTRIBUTE_ARCHIVE ;dwFlagsAndAttributes
mov qword ptr [rsp+20h],OPEN_EXISTING ;dwCreationDisposition
mov ecx,offset FileName1+1    ;lpFileName
invoke CreateFile,,GENERIC_READ,\    ;dwDesiredAccess
FILE_SHARE_READ or FILE_SHARE_WRITE,\;dwShareMode
0 ;lpSecurityAttributes
mov hFile,rax;handle to file
mov [rsp+20h],rbx
lea r9d,lpcbData
lea edi,szBuff
invoke ReadFile,eax,edi,100h
invoke CloseHandle,hFile
 
mov rax,qword ptr szBuff[66h];duration in 100 nSec
mov edx,3518437209
mul edx
shr edx,13
mov duration,rdx;in mSec
;----------------------------------------------------
mov edx,offset aWmv
invoke RegOpenKeyEx,HKEY_CLASSES_ROOT,,0,KEY_READ,&hKey
xor esi,esi
@@:     mov lpcbData,MAX_VALUE_NAME
invoke RegEnumValue,hKey,esi,edi,&lpcbData,NULL,NULL,NULL,NULL
or eax,eax
jnz @f
mov lpcbData,100h
mov r9d,offset szREGSZ
invoke RegQueryValueEx,hKey,edi,0,,edi,&lpcbData
add edi,lpcbData
mov eax,[rdi-5]
or eax,20202000h
cmp eax,dword ptr aWmv;'vmw.'
jz @f
inc esi
jmp @b
@@:
;Получаем имя класса------------------------------------------
lea edx,szBuff
invoke RegOpenKeyEx,HKEY_CLASSES_ROOT,,0,KEY_READ,&hKey
lea eax,szBuff
add eax,lpcbData
mov dword ptr [rax-1],'ehs\'
mov dword ptr [rax+3],'ll'
invoke RegCloseKey,hKey
invoke RegOpenKeyEx,HKEY_CLASSES_ROOT,&szBuff,0,KEY_READ,&hKey
lea eax,lpcbData
mov [rsp+28h],rax
lea eax,szBuff
add eax,lpcbData
mov edi,eax
add edi,6
mov [rsp+20h],rdi
mov lpcbData,MAX_PATH
invoke RegQueryValueEx,hKey,0,0,,,&lpcbData
or word ptr [rdi-1],605Ch;\
mov rax,'dnammoc\'
mov [rdi+4],rax
mov [rdi+12],rbx
invoke RegCloseKey,hKey
invoke RegOpenKeyEx,HKEY_CLASSES_ROOT,&szBuff,0,KEY_READ,&hKey
mov lpcbData,MAX_PATH
mov r9d,offset szREGEXPANDSZ
invoke RegQueryValueEx,hKey,0,0,,&szBuff,&lpcbData
invoke RegCloseKey,hKey
lea edi,szBuff
add edi,lpcbData
sub edi,4
invoke GetCurrentDirectory,MAX_PATH,edi
lea edi,[rdi+rax]
mov aWmv[4],'"'
mov esi,offset FileName1
mov ecx,sizeof FileName1+6
rep movsb
lea ecx,szBuff
mov edx,offset szBuff1
invoke ExpandEnvironmentStrings,,,MAX_PATH
jmp wmBYE
wmINITMENUPOPUP:invoke GetExitCodeProcess,[rdi+PROCESS_INFORMATION.hProcess],esi
or eax,eax
jz @f;GetExitCodeProcess_TRUE
cmp dword ptr [rsi],STILL_ACTIVE ;cmp proExitCode,STILL_ACTIVE
jne @f ;     GetExitCodeProcess_STILL_ACTIVE
invoke EnableMenuItem,hMenu,MI_PROCESS_CREATE,MF_GRAYED
xor r8,r8; mov r8d,MF_ENABLED=0
jmp @0
@@: invoke EnableMenuItem,hMenu,MI_PROCESS_CREATE,MF_ENABLED
mov r8d,MF_GRAYED
@0:    invoke EnableMenuItem,hMenu,MI_PROCESS_TERMINATE
jmp wmBYE
wmCOMMAND:movzx eax,word ptr wParam
or r9,r9 ;cmp lParam,0
jnz wmBYE
cmp rax,MI_EXIT
ja wmBYE
jmp  [menu_handlers+rax*8]
PROCESS_CREATE:cmp [rdi+PROCESS_INFORMATION.hProcess],rbx
je pi_hProcess_IS_0
invoke CloseHandle,[rdi+PROCESS_INFORMATION.hProcess]
mov [rdi+PROCESS_INFORMATION.hProcess],rbx
pi_hProcess_IS_0:lea esi,progStartInfo
invoke GetStartupInfo,esi
invoke CreateProcess,0,&szBuff1,\
0,\;process security attributes
0,\;primary thread security attributes
0,\;handles are inherited
NORMAL_PRIORITY_CLASS,\;creation flags
0,\;use parent's environment
0,\;use parent's current directory
rsi,\;STARTUPINFO pointer
rdi ;receives PROCESS_INFORMATION
invoke CloseHandle,[rdi+PROCESS_INFORMATION.hThread]
invoke SetTimer,hWnd,1,duration,0
jmp wmBYE
TERMINATE:invoke GetExitCodeProcess,[rdi+PROCESS_INFORMATION.hProcess],esi;proExitCode
cmp dword ptr [rsi],STILL_ACTIVE
jne proExitCode_NOT_STILL_ACTIVE;a4;
invoke TerminateProcess,[rdi+PROCESS_INFORMATION.hProcess],0
proExitCode_NOT_STILL_ACTIVE:
invoke CloseHandle,[rdi+PROCESS_INFORMATION.hProcess]
mov [rdi+PROCESS_INFORMATION.hProcess],rbx;0
invoke PostMessage,hWnd,WM_INITMENUPOPUP,NULL,NULL
invoke KillTimer,hWnd,1
jmp wmBYE
wmTIMER:invoke PostMessage,,WM_FINISH,0,0
jmp wmBYE
EXIT: invoke DestroyWindow
wmBYE:  leave
retn
menu_handlers dq PROCESS_CREATE, TERMINATE, EXIT
WndProc endp
;---------------------------------------
ClassName       db 'Uncle Remus tales:#14 Process',0
hMenu dq ?
proExitCode dq ?;process exit code
FileName db "..\Images\br_Rabbit3.cur",0
szREGSZ db 'REG_SZ',0
szREGEXPANDSZ db 'REG_EXPAND_SZ',0
FileName1 db '\movie3'
aWmv db '.wmv',0,0
processInfo PROCESS_INFORMATION <>
szBuff1 db MAX_PATH dup(?)
duration dq ?
end
rc-file
Code: [Select]
#define MI_PROCESS_CREATE 0
#define MI_PROCESS_TERMINATE 1
#define MI_EXIT 2
#define IDR_MAINMENU 30

IDR_MAINMENU MENU
{
POPUP "&Process"
        {
         MENUITEM "&Create Process",MI_PROCESS_CREATE
         MENUITEM "&Terminate Process",MI_PROCESS_TERMINATE,GRAYED
         MENUITEM SEPARATOR
         MENUITEM "E&xit",MI_EXIT
        }
}
bat-file
Code: [Select]
cls
set masm64_path=\masm56\
set filename=%~n1
call :read_settings %filename%
@echo %kind_of_file%
goto %kind_of_file%
:GUI
if exist %filename%.exe del %filename%.exe
if exist %filename%.obj del %filename%.obj
if exist errors.txt del errors.txt
%masm64_path%bin\ml64 /Cp /c /I"%masm64_path%Include" %filename%.asm >> errors.txt
if errorlevel 1 exit
if exist %1.rc (
%masm64_path%\bin\RC /r /i"%masm64_path%\Include" %filename%.rc >> errors.txt
%masm64_path%bin\link /SUBSYSTEM:WINDOWS /LIBPATH:"%masm64_path%Lib" ^
/LARGEADDRESSAWARE:NO /BASE:0x400000 /STUB:%masm64_path%bin\stubby.exe ^
/SECTION:.text,W /ALIGN:16 /entry:WinMain /MERGE:.rdata=.text ^
/fixed /nocoffgrpinfo %filename%.obj %filename%.res >> errors.txt
) else (
%masm64_path%bin\link /SUBSYSTEM:WINDOWS /LIBPATH:"%masm64_path%Lib" ^
/LARGEADDRESSAWARE:NO /BASE:0x400000 /STUB:%masm64_path%bin\stubby.exe ^
/SECTION:.text,W /ALIGN:16 /entry:WinMain /MERGE:.rdata=.text ^
/fixed /nocoffgrpinfo %filename%.obj >> errors.txt
)
if errorlevel 1 exit
if exist %1.res del %1.res
del %filename%.obj
del errors.txt
exit
:DLL
if exist %filename%.dll del %filename%.dll
%masm64_path%bin\ml64 /c /Cp /I %masm64_path%include %filename%.asm >> errors.txt
if errorlevel 1 exit
if exist %1.rc (
%masm64_path%bin\RC /r  %filename%.rc >> errors.txt
if errorlevel 1 exit
%masm64_path%bin\link /SUBSYSTEM:WINDOWS /LIBPATH:%masm64_path%lib ^
/ENTRY:DllMain /DLL /DLL /section:.bss,S /stub:%masm64_path%bin\stubby.exe  ^
%filename%.obj %filename%.res /DEF:%filename%.def >> errors.txt
) else (
%masm64_path%bin\link /SUBSYSTEM:WINDOWS /LIBPATH:%masm64_path%lib ^
/ENTRY:DllMain /DLL /DLL /section:.bss,S /stub:%masm64_path%bin\stubby.exe  ^
%filename%.obj /DEF:%filename%.def >> errors.txt
)
if errorlevel 1 exit
if exist %1.res del %1.res
del %filename%.obj
del %filename%.exp
del errors.txt
exit
:read_settings
for /f "eol=# tokens=2-3" %%A in (%filename%.asm) do (
set kind_of_file=%%A
if %%B == # exit /b )
exit /b
There is movie3.wmv in same folder with exe-file
« Last Edit: June 21, 2017, 02:29:44 AM by Mikl__ »