NO

Author Topic: Image viewer  (Read 244 times)

Offline Vortex

  • Member
  • *
  • Posts: 857
    • http://www.vortex.masmcode.com
Image viewer
« on: October 26, 2024, 08:39:06 PM »
A quick example of running the image viewer to display an image :

Code: [Select]
include     ImageView.inc
include     CstrMacro.asm       

.data?

CurDir      db 64 dup(?)
buffer      db 200 dup(?)
hLib        dd ?
hModule     dd ?

.code

start:

    invoke  GetModuleHandle,0
    mov     hModule,eax
   
    invoke  GetCurrentDirectory,64,ADDR CurDir
    invoke  lstrcat,ADDR CurDir,@Cstr("\ForumLogo.png")

    invoke  UnicodeStr,ADDR CurDir,ADDR buffer

    invoke  LoadLibrary,@Cstr("shimgvw.dll")
    mov     hLib,eax

    invoke  GetProcAddress,eax,\
            @Cstr("ImageView_Fullscreen")

    push    SW_NORMAL
    push    OFFSET buffer
    push    hModule
    push    0
    call    eax

    invoke  FreeLibrary,hLib

    invoke  ExitProcess,0

UnicodeStr  PROC USES esi src:DWORD,dest:DWORD

    mov     esi,src
    mov     edx,dest
    xor     eax,eax
    sub     eax,1
@@:
    add     eax,1
    movzx   ecx,BYTE PTR [esi+eax]
    mov     WORD PTR [edx+eax*2],cx
    test    ecx,ecx
    jnz     @b
    ret

UnicodeStr  ENDP

END start
Code it... That's all...

Online HellOfMice

  • Member
  • *
  • Posts: 80
  • Never be pleased, always improve
Re: Image viewer
« Reply #1 on: Yesterday at 04:04:16 AM »
Hi Vortex,


Where can I find shimgvw.dll. The program launch the MS Photo viewer!
--------------------------------
Kenavo

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2106
Re: Image viewer
« Reply #2 on: Yesterday at 08:16:38 AM »
Windows\system32 or SysWOW64
Same with C and ANSI version
Code: [Select]
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
void __stdcall ImageView_Fullscreen(HWND, HINSTANCE, const wchar_t*, int);

void __cdecl WinMainCRTStartup(void)
{
char szBuf[MAX_PATH];
int nLen = GetCurrentDirectory(MAX_PATH, szBuf);
lstrcpy(szBuf + nLen, "\\ForumLogo.png");
HMODULE hMod = GetModuleHandle(NULL);
HMODULE hLib = LoadLibrary("shimgvw.dll");
PROC ImageView_Fullscreen = GetProcAddress(hLib, "ImageView_FullscreenA");
ImageView_Fullscreen(0, hMod, szBuf, SW_NORMAL);
ExitProcess(0);
}
May the source be with you

Offline Vortex

  • Member
  • *
  • Posts: 857
    • http://www.vortex.masmcode.com
Re: Image viewer
« Reply #3 on: Yesterday at 09:37:05 AM »
Hi HellOfMice,

This DLL is a component of Windows installation :

Code: [Select]
C:\Windows\System32\shimgvw.dll

shimgvw.dll is the MS Photo viewer application.

Hi Timo,

Thanks for your code.

Code it... That's all...

Offline John Z

  • Member
  • *
  • Posts: 855
Re: Image viewer
« Reply #4 on: Yesterday at 10:09:00 AM »
Hi all,

Looks like shimgvw.dll is mainly a shell for GDIPLus and some OLE. plus a whole lot a static linkings.
 :) maybe that's what the SH in "shimgvw.dll" means  ;D

The attached doc has some details but is rather dated.

John Z

Online HellOfMice

  • Member
  • *
  • Posts: 80
  • Never be pleased, always improve
Re: Image viewer
« Reply #5 on: Yesterday at 10:26:40 AM »
Thank you everybody.
--------------------------------
Kenavo