NO

Author Topic: Image viewer  (Read 2592 times)

Offline Vortex

  • Member
  • *
  • Posts: 864
    • 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...

Offline HellOfMice

  • Member
  • *
  • Posts: 105
  • Never be pleased, always improve
Re: Image viewer
« Reply #1 on: October 29, 2024, 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: 2115
Re: Image viewer
« Reply #2 on: October 29, 2024, 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: 864
    • http://www.vortex.masmcode.com
Re: Image viewer
« Reply #3 on: October 29, 2024, 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: 860
Re: Image viewer
« Reply #4 on: October 29, 2024, 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

Offline HellOfMice

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