The MASM Forum

General => The Campus => Topic started by: Mikl__ on June 15, 2017, 12:58:34 AM

Title: ShellExecute and Registry
Post by: Mikl__ on June 15, 2017, 12:58:34 AM
The simplest program that starts playing a video file
include win64a.inc
.code
WinMain proc
sub esp,7*8
mov qword ptr [rsp + 28h],SW_SHOWNORMAL
xor ecx,ecx
mov [rsp + 20h],rcx
xor r9d,r9d
mov r8d,offset szFilm
mov edx,offset szNoTxt
invoke ShellExecute
invoke ExitProcess,0
WinMain endp
SzFilm db 'movie3.wmv'
SzNoTxt db 0
end
Inside ShellExecute is ShellExecuteEx, to which the structure address of the SHELLEXECUTEINFO type is passed
include win64a.inc
.code
WinMain proc
sub esp,7*8
mov ecx,offset sie
invoke ShellExecuteEx
invoke ExitProcess,0
WinMain endp
sie dd 70h, 1500h, 0, 0
dq szNoTxt
dq szFilm
dq 0,0
dd 1,0
dq 7 dup (0)
szFilm db 'movie3.wmv'
szNoTxt db 0
end
But what is inside ShellExecuteEx? It is intuitively clear what is happening
Tell me what branches of the registry I need to watch and analyze, so that the program has a universal application?
Title: Re: ShellExecute and Registry
Post by: jj2007 on June 15, 2017, 06:11:21 AM
Quote from: Mikl__ on June 15, 2017, 12:58:34 AMTell me what branches of the registry I need to watch and analyze, so that the program has a universal application?

It's not that simple. Some time ago I posted a proggie (http://masm32.com/board/index.php?topic=94.msg67665#msg67665) that is supposed to play videos.

The good news is that on my Win7-64 it can handle wmv, mkv, webm, swf, flv, mp4, mpg, avi and asf. Plus the audio formats cda, mp3, mid and wav.

The bad news is that on your pc it may handle nothing at all. It depends entirely on the codecs installed. I have worked hard to understand this business, and all I can say is that it is an incredible mess :eusa_boohoo:

My proggie uses DirectShow. Before I tried the older MCI, and all I can is "they are different". They are both from Microsoft, but codecs that work on MCI will not work with DShow and vice versa. It is really a can of worms.

What you achieve with ShellExecute is simply to launch the player (WMP or third party, e.g. VLC or FLV) that the user associated with a particular ending. Example:include \masm32\MasmBasic\MasmBasic.inc
  Init
  ShEx "sample.swf"
EndOfCode


If the file exists, after a few seconds Firefox opens and shows me a boring blank page with "Activate Adobe Flash" in the middle. If I click on that link, FF asks me again if I want to allow Flash to run, and if I agree (I shouldn't :bgrin:), after a while I can see the video. Great.

In this respect, DShow is more versatile because it picks automatically a codec if it is installed, i.e. no user intervention needed; and you can construct your own GUI around it.