Author Topic: ole32.lib  (Read 752 times)

six_L

  • Member
  • **
  • Posts: 134
ole32.lib
« on: May 08, 2018, 11:50:26 PM »
Do you have the ole32.lib(win64) which includes _imp__CoCreateInstance@20 ?
i hope you upload it on here attachment.

jj2007

  • Member
  • *****
  • Posts: 8598
  • Assembler is fun ;-)
    • MasmBasic
Re: ole32.lib
« Reply #1 on: May 09, 2018, 12:14:20 AM »
Masm64 SDK: \Masm32\lib64\ole32.lib

six_L

  • Member
  • **
  • Posts: 134
Re: ole32.lib
« Reply #2 on: May 09, 2018, 12:51:01 AM »
thanks your response。
Quote
Masm64 SDK: \Masm32\lib64\ole32.lib
no _imp__CoCreateInstance@20

Vortex

  • Member
  • *****
  • Posts: 1821
Re: ole32.lib
« Reply #3 on: May 09, 2018, 02:06:02 AM »
Hi six_L,

If we are talking about Win64 programming, the decorated symbol _imp__CoCreateInstance@20 is not valid as the default calling x64 convention if fastcall. You would expect this one from the VS2010 Express installation : C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib\x64\Ole32.Lib exports CoCreateInstance

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 5629
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: ole32.lib
« Reply #4 on: May 09, 2018, 02:17:29 AM »
Both in OLE32.LIB and INC.


externdef __imp_CoCreateInstance:PPROC
CoCreateInstance equ <__imp_CoCreateInstance>

externdef __imp_CoCreateInstanceEx:PPROC
CoCreateInstanceEx equ <__imp_CoCreateInstanceEx>
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

six_L

  • Member
  • **
  • Posts: 134
Re: ole32.lib
« Reply #5 on: May 11, 2018, 09:24:04 PM »
Hi,Vortex
thanks yout respone.
Quote
the decorated symbol _imp__CoCreateInstance@20 is not valid as the default calling x64 convention if fastcall.
this is the cause of the problem.i can't find the VS2010 Express on internet,use the another method.i'm testing your codes "SetWallpaper.asm",the codes can't work rightly,it setted my Wallpaper into black.
Code: [Select]
option casemap:none
option win64:3
;option frame:auto
;option fieldalign:8
;¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
include \UASM64\include\windows.inc

includelib \UASM64\Lib\kernel32.lib
includelib \UASM64\Lib\user32.lib
includelib \UASM64\Lib\ole32.lib
;¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
COMINTERFACE IActiveDesktop

CVIRTUAL  ApplyChanges ,DWORD, :DWORD
CVIRTUAL  GetWallpaper ,DWORD, :PTR, :DWORD, :DWORD
CVIRTUAL  SetWallpaper ,DWORD, :PTR, :DWORD
CVIRTUAL  GetWallpaperOptions ,DWORD, :DWORD, :DWORD
CVIRTUAL  SetWallpaperOptions ,DWORD,:PTR,:DWORD
CVIRTUAL  GetPattern  ,DWORD,:PTR, :DWORD, :DWORD
CVIRTUAL  SetPattern ,DWORD, :PTR, :DWORD
CVIRTUAL  GetDesktopItemOptions ,DWORD, :DWORD, :DWORD
CVIRTUAL  SetDesktopItemOptions ,DWORD, :DWORD, :DWORD
CVIRTUAL  AddDesktopItem ,DWORD, :DWORD, :DWORD
CVIRTUAL  AddDesktopItemWithUI ,DWORD, :DWORD, :DWORD, :DWORD
CVIRTUAL  ModifyDesktopItem ,DWORD, :DWORD, :DWORD
CVIRTUAL  RemoveDesktopItem ,DWORD, :DWORD, :DWORD
CVIRTUAL  GetDesktopItemCount ,DWORD, :DWORD, :DWORD
CVIRTUAL  GetDesktopItem ,DWORD, :DWORD, :DWORD, :DWORD
CVIRTUAL  GetDesktopItemByID ,DWORD, :PTR, :DWORD, :DWORD
CVIRTUAL  GenerateDesktopItemHtml ,DWORD, :PTR, :DWORD, :DWORD
CVIRTUAL  AddUrl ,DWORD, :DWORD, :PTR, :DWORD, :DWORD
CVIRTUAL  GetDesktopItemBySource ,DWORD, :PTR, :DWORD, :DWORD

ENDCOMINTERFACE

WPSTYLE_CENTER              equ 0
AD_APPLY_ALL                equ 7
CLSCTX_INPROC_SERVER        equ 1
NULL                        equ 0

WALLPAPEROPT STRUCT
dwSize     dd ?
dwStyle    dd ?
WALLPAPEROPT ENDS

GUID    STRUCT
Data1   dd ?
Data2   dw ?
Data3   dw ?
Data4   db 8 dup(?)
GUID ENDS

sCLSID_IActiveDesktop   TEXTEQU <{075048700h,0EF1Fh,011D0h,{098h,088h,00h,060h,097h,0DEh,0ACh,0F9h}}>
sIID_IActiveDesktop     TEXTEQU <{0F490EB00h,01240h,011D1h,{098h,088h,00h,060h,097h,0DEh,0ACh,0F9h}}>
;¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
;externdef __imp_CoCreateInstance:PPROC
;CoCreateInstance equ <__imp_CoCreateInstance>

;externdef __imp_CoCreateInstanceEx:PPROC
;CoCreateInstanceEx equ <__imp_CoCreateInstanceEx>

LPad TYPEDEF PTR IActiveDesktop
OPTION LITERALS:ON

_PCoCreateInstance typedef proto :qword,:qword,:qword,:qword,:qword
PCoCreateInstance typedef ptr _PCoCreateInstance
;¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
.data
CLSID_IActiveDesktop    GUID sCLSID_IActiveDesktop
IID_IActiveDesktop      GUID sIID_IActiveDesktop

DesktopImg dw "j","2",".","b","m","p",0,0
;DesktopImg dw "j2.bmp",0
pAD LPad 0
hole32_dll dq 0
;¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
.data?
wpo WALLPAPEROPT <>
_CoCreateInstance PCoCreateInstance ?
;¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
.code
;¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
getaddr_CoCreateInstance PROC
invoke LoadLibrary,CStr("ole32.dll")
.if rax
mov hole32_dll,rax
invoke GetProcAddress,hole32_dll,CStr("CoCreateInstance")
mov _CoCreateInstance,rax
.else
invoke MessageBox,NULL,CStr("ole32.dll load Failed"),CStr("LoadLibrary"),MB_OK
.endif
ret
getaddr_CoCreateInstance ENDP
;¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
start PROC
LOCAL uEdbuffer[260]:BYTE

invoke   getaddr_CoCreateInstance
.if _CoCreateInstance != 0

invoke   CoInitialize,NULL

invoke   _CoCreateInstance,ADDR CLSID_IActiveDesktop, NULL,CLSCTX_INPROC_SERVER,\
ADDR IID_IActiveDesktop,ADDR pAD           

mov      rdx,OFFSET wpo
mov      WALLPAPEROPT.dwSize[rdx],SIZEOF(WALLPAPEROPT)
mov      WALLPAPEROPT.dwStyle[rdx],WPSTYLE_CENTER

;invoke MultiByteToWideChar,CP_ACP,0,CStr("j2.bmp"),-1,addr uEdbuffer,260
;_VINVOKE pAD,IActiveDesktop,SetWallpaper,addr uEdbuffer,0
;_VINVOKE pAD,IActiveDesktop,SetWallpaper,CStr("j2.jpg"),0
_VINVOKE pAD,IActiveDesktop,SetWallpaper,addr DesktopImg,0
.if rax!=S_OK
invoke MessageBox,NULL,CStr("SetWallpaper Failed"),CStr("IActiveDesktop"),MB_OK
.endif
_VINVOKE pAD,IActiveDesktop,SetWallpaperOptions,ADDR wpo,0
_VINVOKE pAD,IActiveDesktop,ApplyChanges,AD_APPLY_ALL
_VINVOKE pAD,IActiveDesktop,Release

invoke   CoUninitialize
.endif
invoke FreeLibrary,hole32_dll

invoke  ExitProcess,0

start ENDP
;¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

end
Using the Active Desktop Object
[This feature is supported only under Windows XP or earlier. ]

This article contains information on the ActiveDesktop object that is part of the Windows Shell API. This object, through its IActiveDesktop interface, enables you to add, remove, and change items on the desktop.

Hi,hutch--
thanks yout respone.

AW

  • Member
  • *****
  • Posts: 1392
  • Let's Make ASM Great Again!
Re: ole32.lib
« Reply #6 on: May 12, 2018, 02:57:28 AM »
You don't need  VS2010 Express and the  OLE32.LIB that comes with Masm32/64-bit is all right.

The problem is that you are including Windows.inc from the HJWASM\JWASM\UASM WinInc distribution which has a few problems, namely it includes ObjBase.inc which defines:

proto_ typedef proto WINSTDCALLCONV  :REFCLSID, :LPUNKNOWN, :DWORD, :REFIID, :ptr LPVOID
externdef WINSTDCALLCONV _imp__CoCreateInstance@20: ptr proto_CoCreateInstance
CoCreateInstance equ <_imp__CoCreateInstance@20>

What you need to do in Objbase.inc is:
; proto_ typedef proto WINSTDCALLCONV  :REFCLSID, :LPUNKNOWN, :DWORD, :REFIID, :ptr LPVOID
; externdef WINSTDCALLCONV _imp__CoCreateInstance@20: ptr proto_CoCreateInstance
; CoCreateInstance equ <_imp__CoCreateInstance@20>

Then in your source code simply use this prototype:
CoCreateInstance proto :ptr, :ptr, :dword, :ptr, :ptr

No need for loadlibrary, getprocaddresses and all typedefes and things like that.

Vortex

  • Member
  • *****
  • Posts: 1821
Re: ole32.lib
« Reply #7 on: May 12, 2018, 03:25:49 AM »
Hi six_L,

I am sending the SetWallpaper example rebuilt with UASM 2.46.10 64-bit. You don't need VS2010, it was just an example to display the exported symbols ( they are not decorated. )

Building the example :

Code: [Select]
\uasm64\uasm64.exe -win64 SetWallpaper.asm

\PellesC\bin\polink /SUBSYSTEM:CONSOLE /ENTRY:start /LARGEADDRESSAWARE /LIBPATH:H:\masm32\lib64 SetWallpaper.obj

You can use Hutch's import libraries for Masm64 programming.

Code: [Select]
option casemap:none
option win64:3

include     SetWallpaper.inc
includelib  kernel32.lib
includelib  ole32.lib

LPad TYPEDEF PTR IActiveDesktop

OPTION LITERALS:ON

.data

CLSID_IActiveDesktop    GUID sCLSID_IActiveDesktop
IID_IActiveDesktop      GUID sIID_IActiveDesktop

DesktopImg  dw "test.bmp",0
pAD         LPad 0

.data?

wpo             WALLPAPEROPT <>

.code

start PROC

    invoke      CoInitialize,NULL

    invoke      CoCreateInstance,ADDR CLSID_IActiveDesktop,\
                NULL,CLSCTX_INPROC_SERVER,\
                ADDR IID_IActiveDesktop,ADDR pAD           

    mov         rdx,OFFSET wpo
    mov         WALLPAPEROPT.dwSize[rdx],SIZEOF(WALLPAPEROPT)
    mov         WALLPAPEROPT.dwStyle[rdx],WPSTYLE_CENTER

    _VINVOKE    pAD,IActiveDesktop,SetWallpaper,ADDR DesktopImg,0
    _VINVOKE    pAD,IActiveDesktop,SetWallpaperOptions,ADDR wpo,0
    _VINVOKE    pAD,IActiveDesktop,ApplyChanges,AD_APPLY_ALL
    _VINVOKE    pAD,IActiveDesktop,Release

    invoke      CoUninitialize
    invoke      ExitProcess,0

start ENDP

END start

The include file containing all the definitions and equates :

Code: [Select]
COMINTERFACE IActiveDesktop

CVIRTUAL  ApplyChanges ,DWORD, :DWORD
CVIRTUAL  GetWallpaper ,DWORD, :PTR, :DWORD, :DWORD
CVIRTUAL  SetWallpaper ,DWORD, :PTR, :DWORD
CVIRTUAL  GetWallpaperOptions ,DWORD, :DWORD, :DWORD
CVIRTUAL  SetWallpaperOptions ,DWORD,:PTR,:DWORD
CVIRTUAL  GetPattern  ,DWORD,:PTR, :DWORD, :DWORD
CVIRTUAL  SetPattern ,DWORD, :PTR, :DWORD
CVIRTUAL  GetDesktopItemOptions ,DWORD, :DWORD, :DWORD
CVIRTUAL  SetDesktopItemOptions ,DWORD, :DWORD, :DWORD
CVIRTUAL  AddDesktopItem ,DWORD, :DWORD, :DWORD
CVIRTUAL  AddDesktopItemWithUI ,DWORD, :DWORD, :DWORD, :DWORD
CVIRTUAL  ModifyDesktopItem ,DWORD, :DWORD, :DWORD
CVIRTUAL  RemoveDesktopItem ,DWORD, :DWORD, :DWORD
CVIRTUAL  GetDesktopItemCount ,DWORD, :DWORD, :DWORD
CVIRTUAL  GetDesktopItem ,DWORD, :DWORD, :DWORD, :DWORD
CVIRTUAL  GetDesktopItemByID ,DWORD, :PTR, :DWORD, :DWORD
CVIRTUAL  GenerateDesktopItemHtml ,DWORD, :PTR, :DWORD, :DWORD
CVIRTUAL  AddUrl ,DWORD, :DWORD, :PTR, :DWORD, :DWORD
CVIRTUAL  GetDesktopItemBySource ,DWORD, :PTR, :DWORD, :DWORD

ENDCOMINTERFACE

WPSTYLE_CENTER              equ 0
AD_APPLY_ALL                equ 7
CLSCTX_INPROC_SERVER        equ 1
NULL                        equ 0

WALLPAPEROPT STRUCT
 dwSize     dd ?
 dwStyle    dd ?
WALLPAPEROPT ENDS

GUID    STRUCT
    Data1   dd ?
    Data2   dw ?
    Data3   dw ?
    Data4   db 8 dup(?)
GUID ENDS

ExitProcess PROTO :QWORD
CoCreateInstance PROTO :QWORD,:QWORD,:QWORD,:QWORD,:QWORD
CoInitialize PROTO :QWORD
CoUninitialize PROTO

sCLSID_IActiveDesktop       TEXTEQU <{075048700h,0EF1Fh,011D0h,{098h,088h,00h,060h,097h,0DEh,0ACh,0F9h}}>
sIID_IActiveDesktop         TEXTEQU <{0F490EB00h,01240h,011D1h,{098h,088h,00h,060h,097h,0DEh,0ACh,0F9h}}>

six_L

  • Member
  • **
  • Posts: 134
Re: ole32.lib
« Reply #8 on: May 12, 2018, 08:04:55 PM »
Hi,aw27
Code: [Select]
Objbase.inc is:
; proto_ typedef proto WINSTDCALLCONV  :REFCLSID, :LPUNKNOWN, :DWORD, :REFIID, :ptr LPVOID
; externdef WINSTDCALLCONV _imp__CoCreateInstance@20: ptr proto_CoCreateInstance
; CoCreateInstance equ <_imp__CoCreateInstance@20>

Then in your source code simply use this prototype:
CoCreateInstance proto :ptr, :ptr, :dword, :ptr, :ptr
this is ok when i use "uasm64.exe -win64" and "link /ENTRY:start /SUBSYSTEM:windows /MACHINE:X64".
thanks you.

Hi,Vortex
Thanks you.
the wallpaper has setted by three background modes(Picture,Slide show,Pure color),the "SetWallpaper.exe(SetWallPaper64b)" sets the wallpaper into "Pure color",not the test.bmp.

Vortex

  • Member
  • *****
  • Posts: 1821
Re: ole32.lib
« Reply #9 on: May 12, 2018, 08:28:47 PM »
Hi six_L,

I tested my code on Windows XP 64-bit. I will repeat it on Windows 7.

six_L

  • Member
  • **
  • Posts: 134
Re: ole32.lib
« Reply #10 on: May 13, 2018, 12:45:13 AM »
Hi,Vortex
Thanks you.
OS:windows 10 pro 64-bit
ver:1709 16299.431

Vortex

  • Member
  • *****
  • Posts: 1821
Re: ole32.lib
« Reply #11 on: May 23, 2018, 05:47:51 AM »
Hi six_L,

Adding this line solved the problem :

Code: [Select]
invoke      GetFullPathName,ADDR DesktopImg,256,ADDR buffer,0

six_L

  • Member
  • **
  • Posts: 134
Re: ole32.lib
« Reply #12 on: May 23, 2018, 12:27:57 PM »
Hi,Vortex
the codes work rightly.this is a frist 64-bit codes about COM.
thank you very much.
Code: [Select]
option casemap:none
option win64:3

include \UASM64\include\windows.inc

includelib \UASM64\Lib\kernel32.lib
includelib \UASM64\Lib\ole32.lib

COMINTERFACE IActiveDesktop

CVIRTUAL  ApplyChanges ,DWORD, :DWORD
CVIRTUAL  GetWallpaper ,DWORD, :PTR, :DWORD, :DWORD
CVIRTUAL  SetWallpaper ,DWORD, :PTR, :DWORD
CVIRTUAL  GetWallpaperOptions ,DWORD, :DWORD, :DWORD
CVIRTUAL  SetWallpaperOptions ,DWORD,:PTR,:DWORD
CVIRTUAL  GetPattern  ,DWORD,:PTR, :DWORD, :DWORD
CVIRTUAL  SetPattern ,DWORD, :PTR, :DWORD
CVIRTUAL  GetDesktopItemOptions ,DWORD, :DWORD, :DWORD
CVIRTUAL  SetDesktopItemOptions ,DWORD, :DWORD, :DWORD
CVIRTUAL  AddDesktopItem ,DWORD, :DWORD, :DWORD
CVIRTUAL  AddDesktopItemWithUI ,DWORD, :DWORD, :DWORD, :DWORD
CVIRTUAL  ModifyDesktopItem ,DWORD, :DWORD, :DWORD
CVIRTUAL  RemoveDesktopItem ,DWORD, :DWORD, :DWORD
CVIRTUAL  GetDesktopItemCount ,DWORD, :DWORD, :DWORD
CVIRTUAL  GetDesktopItem ,DWORD, :DWORD, :DWORD, :DWORD
CVIRTUAL  GetDesktopItemByID ,DWORD, :PTR, :DWORD, :DWORD
CVIRTUAL  GenerateDesktopItemHtml ,DWORD, :PTR, :DWORD, :DWORD
CVIRTUAL  AddUrl ,DWORD, :DWORD, :PTR, :DWORD, :DWORD
CVIRTUAL  GetDesktopItemBySource ,DWORD, :PTR, :DWORD, :DWORD

ENDCOMINTERFACE

WPSTYLE_CENTER              equ 0
AD_APPLY_ALL                equ 7
CLSCTX_INPROC_SERVER        equ 1
NULL                        equ 0

WALLPAPEROPT STRUCT
dwSize     dd ?
dwStyle    dd ?
WALLPAPEROPT ENDS

GUID    STRUCT
Data1   dd ?
Data2   dw ?
Data3   dw ?
Data4   db 8 dup(?)
GUID ENDS

CoCreateInstance PROTO :QWORD,:QWORD,:QWORD,:QWORD,:QWORD

sCLSID_IActiveDesktop   TEXTEQU <{075048700h,0EF1Fh,011D0h,{098h,088h,00h,060h,097h,0DEh,0ACh,0F9h}}>
sIID_IActiveDesktop     TEXTEQU <{0F490EB00h,01240h,011D1h,{098h,088h,00h,060h,097h,0DEh,0ACh,0F9h}}>

LPad TYPEDEF PTR IActiveDesktop
OPTION LITERALS:ON

.data
CLSID_IActiveDesktop    GUID sCLSID_IActiveDesktop
IID_IActiveDesktop      GUID sIID_IActiveDesktop

DesktopImg db "j2.bmp",0
pAD LPad 0

.data?
wpo             WALLPAPEROPT <>
buffer          db 256 dup(?)

.code

start PROC
LOCAL uEdbuffer[1024]:BYTE

invoke   CoInitialize,NULL

invoke   CoCreateInstance,ADDR CLSID_IActiveDesktop, NULL,CLSCTX_INPROC_SERVER,\
         ADDR IID_IActiveDesktop,ADDR pAD           

mov      rdx,OFFSET wpo
mov      WALLPAPEROPT.dwSize[rdx],SIZEOF(WALLPAPEROPT)
mov      WALLPAPEROPT.dwStyle[rdx],WPSTYLE_CENTER

invoke   GetFullPathName,ADDR DesktopImg,256,ADDR buffer,0
invoke MultiByteToWideChar,CP_ACP,0,ADDR buffer,-1,addr uEdbuffer,1024

_VINVOKE pAD,IActiveDesktop,SetWallpaper,ADDR uEdbuffer,0
_VINVOKE pAD,IActiveDesktop,SetWallpaperOptions,ADDR wpo,0
_VINVOKE pAD,IActiveDesktop,ApplyChanges,AD_APPLY_ALL
_VINVOKE pAD,IActiveDesktop,Release

invoke   CoUninitialize
invoke   ExitProcess,0

start ENDP

end

Quote
WPSTYLE_CENTER (0x0)

0x0. Center the wallpaper image in its original size, filling the remaining area with a solid background color if image is smaller than screen or cropping image if image is larger.

WPSTYLE_TILE (0x1)

0x1. Tile the wallpaper image, starting in the upper left corner of the screen. This uses the image in its original size.

WPSTYLE_STRETCH (0x2)

0x2. Stretch the image to cover the full screen. This can result in distortion of the image as the image's aspect ratio is not retained.

WPSTYLE_KEEPASPECT (0x3)

0x3. Introduced in Windows 7. Enlarge or shrink the image to fill the screen, retaining the aspect ratio of the original image. If necessary, the image is padded either on the top and bottom or on the right and left with the background color to fill any screen area not covered by the image.

WPSTYLE_CROPTOFIT (0x4)

0x4. Introduced in Windows 7. Enlarge or shrink the image to fill the screen, retaining the aspect ratio of the original image. If necessary, the image is cropped either on the top and bottom or on the left and right as necessary to fit the screen.

WPSTYLE_SPAN (0x5)

0x5. Introduced in Windows 8. Spans the wallpaper across multiple monitors. When this value is set, the WPSTYLE_MAX value must also be set.

WPSTYLE_MAX

The maximum legitimate value of these flags, used for validation purposes.
[edit]: attached the source code.
« Last Edit: May 25, 2018, 08:42:44 PM by six_L »

Vortex

  • Member
  • *****
  • Posts: 1821
Re: ole32.lib
« Reply #13 on: May 24, 2018, 03:13:44 AM »
Hi six_L,

Thanks. It looks like that Windows 7 and above are sensitive about the full paths. XP didn't seem to care about it my tests.