The MASM Forum Archive 2004 to 2012

General Forums => The Laboratory => Topic started by: ToutEnMasm on November 22, 2010, 01:40:30 PM

Title: shimgvw dll who show images in the explorer
Post by: ToutEnMasm on November 22, 2010, 01:40:30 PM

This dll have some functions who can be (perhaps) useful in asm.
I have tried this:
Quote
   invoke LoadLibrary,addr pathshimgvw
   mov Hmodule,eax
   invoke GetProcAddress,Hmodule,addr szImageView_Fullscreen
   mov HImageView_Fullscreen,eax
   invoke AtoU,addr pathimage   ;ascii to unicode
   mov    pszupathimage,eax
   ;invoke ImageView_Fullscreen,hwnd,hInstance,pszupathimage,SW_NORMAL
   invoke ImageView_Fullscreen,NULL,hInstance,psupathimage,SW_NORMAL
The functions of the dll are undocumented.
Not really very successful ,is someone have made others tests ?

Title: Re: shimgvw dll who show images in the explorer
Post by: ToutEnMasm on November 22, 2010, 03:32:20 PM

I answer myself
The dll as the same need as ShellExecute
Quote
invoke CoInitializeEx,NULL, COINIT_APARTMENTTHREADED OR COINIT_DISABLE_OLE1DDE   
and ..it's work
To have the full set of functions,use dumpbin (c++ express) with /EXPORTS option.
Title: Re: shimgvw dll who show images in the explorer
Post by: Vortex on November 22, 2010, 07:49:46 PM
Hi ToutEnMasm,

Thanks for the info. Here is a quick example :


.386
.model flat,stdcall
option casemap:none

include     \masm32\include\windows.inc
include     \masm32\include\kernel32.inc

includelib  \masm32\lib\kernel32.lib
includelib  shimgvw.lib

UnicodeStr              PROTO :DWORD,:DWORD         
ImageView_Fullscreen    PROTO :DWORD,:DWORD,:DWORD,:DWORD


.data

file    db '\forum.jpg',0

.data?

CurDir  db 64 dup(?)
buffer  db 200 dup(?)

.code

start:

    invoke  GetCurrentDirectory,64,ADDR CurDir
    invoke  lstrcat,ADDR CurDir,ADDR file

    invoke  UnicodeStr,ADDR CurDir,ADDR buffer

    invoke  GetModuleHandle,0
    invoke  ImageView_Fullscreen,NULL,eax,ADDR buffer,SW_NORMAL

    invoke  ExitProcess,0

END start
Title: Re: shimgvw dll who show images in the explorer
Post by: jj2007 on November 23, 2010, 11:09:56 PM
One more example from the new MasmBasic version (http://www.masm32.com/board/index.php?topic=12460.msg95703#msg95703), using dynamic loading:

include \masm32\MasmBasic\MasmBasic.inc ; use the MasmBasic library (includes Masm32, too)
Init ; initialise the app
Dll "shimgvw" ; load the Windows Picture and Fax Viewer Library
Declare ImageView_Fullscreen, 4 ; ImageView_Fullscreen expects 4 dwords
void ImageView_Fullscreen(0, 0, wCL$(1), SW_SHOW) ; wCL$: wide version of the commandline
Err$(1) ; there is no retval, so we have to test for errors
Exit ; do a clean exit, inter alia FreeLibrary
end start


Apparently, the shimgvw DLL ignores the SW_ parameter. The app always uses the last mode and position selected by the user, at least on Win XP SP2. Since there is also no valid return value, Err$(1) uses GetLastError to test for problems.
GetModuleHandle seems not to be necessary.
Title: Re: shimgvw dll who show images in the explorer
Post by: Antariy on November 23, 2010, 11:16:51 PM
invoke WinExec,CTXT("rundll32.exe shimgvw.dll,ImageView_Fullscreen ThePictureFile.Jpg"),1