From 66251f051eacbef056ec4723a62176cac318d06a Mon Sep 17 00:00:00 2001 From: anders_k Date: Sat, 26 Jan 2019 20:34:57 +0000 Subject: [PATCH] Added IUniformResourceLocator to COM.nsh git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7074 212acab6-be3b-0410-9dea-997c60f758d6 --- Include/Win/COM.nsh | 71 ++++++++++++++++++++++++++++++++++- Include/Win/Propkey.nsh | 83 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 153 insertions(+), 1 deletion(-) diff --git a/Include/Win/COM.nsh b/Include/Win/COM.nsh index 67399956..28628827 100644 --- a/Include/Win/COM.nsh +++ b/Include/Win/COM.nsh @@ -48,6 +48,19 @@ ${EndIf} !verbose push !verbose 3 +!define /ifndef STGM_READ 0 +!define /ifndef STGM_WRITE 1 +!define /ifndef STGM_READWRITE 2 +!define /ifndef STGM_SHARE_DENY_NONE 0x00000040 +!define /ifndef STGM_SHARE_DENY_READ 0x00000030 +!define /ifndef STGM_SHARE_DENY_WRITE 0x00000020 +!define /ifndef STGM_SHARE_EXCLUSIVE 0x00000010 +!define /ifndef STGM_PRIORITY 0x00040000 +!define /ifndef STGM_CREATE 0x00001000 +!define /ifndef STGM_CONVERT 0x00020000 +!define /ifndef STGM_FAILIFTHERE 0 +!define /ifndef STGM_DELETEONRELEASE 0x04000000 + !define /ifndef CLSCTX_INPROC_SERVER 0x1 !define /ifndef CLSCTX_INPROC_HANDLER 0x2 !define /ifndef CLSCTX_LOCAL_SERVER 0x4 @@ -101,8 +114,24 @@ ${NSISCOMIFACEDECL}IUnknown Release 2 ()i ${NSISCOMIFACEDECL}IPersist GetClassID 3 (g)i !endif +!ifndef IID_IPersistStream +!define IID_IPersistStream {00000109-0000-0000-C000-000000000046} ; IPersist> +${NSISCOMIFACEDECL}IPersistStream IsDirty 4 ()i +${NSISCOMIFACEDECL}IPersistStream Load 5 (p,i)i +${NSISCOMIFACEDECL}IPersistStream Save 6 (p,i)i +${NSISCOMIFACEDECL}IPersistStream GetSizeMax 7 (*l)i +!endif +!ifndef IID_IPersistStreamInit +!define IID_IPersistStreamInit {7FD52380-4E07-101B-AE2D-08002B2EC713} ; IPersist> +${NSISCOMIFACEDECL}IPersistStreamInit IsDirty 4 ()i +${NSISCOMIFACEDECL}IPersistStreamInit Load 5 (p,i)i +${NSISCOMIFACEDECL}IPersistStreamInit Save 6 (p,i)i +${NSISCOMIFACEDECL}IPersistStreamInit GetSizeMax 7 (*l)i +${NSISCOMIFACEDECL}IPersistStreamInit InitNew 8 ()i +!endif + !ifndef IID_IPersistFile -!define IID_IPersistFile {0000010b-0000-0000-C000-000000000046} +!define IID_IPersistFile {0000010b-0000-0000-C000-000000000046} ; IPersist> ${NSISCOMIFACEDECL}IPersistFile IsDirty 4 ()i ${NSISCOMIFACEDECL}IPersistFile Load 5 (w,i)i ${NSISCOMIFACEDECL}IPersistFile Save 6 (w,i)i @@ -212,6 +241,30 @@ ${NSISCOMIFACEDECL}IPropertyStore SetValue 6 (p,p)i ${NSISCOMIFACEDECL}IPropertyStore Commit 7 ()i !endif +!ifndef IID_IPropertyStorage +!define IID_IPropertyStorage {00000138-0000-0000-C000-000000000046} +${NSISCOMIFACEDECL}IPropertyStorage ReadMultiple 3 (i,p,p)i +${NSISCOMIFACEDECL}IPropertyStorage WriteMultiple 4 (i,p,p,i)i +${NSISCOMIFACEDECL}IPropertyStorage DeleteMultiple 5 (i,p)i +${NSISCOMIFACEDECL}IPropertyStorage ReadPropertyNames 6 (p,p)i +${NSISCOMIFACEDECL}IPropertyStorage WritePropertyNames 7 (i,p,p)i +${NSISCOMIFACEDECL}IPropertyStorage DeletePropertyNames 8 (i,p)i +${NSISCOMIFACEDECL}IPropertyStorage Commit 9 (i)i ; Note: Some implementations might return E_NOTIMPL +${NSISCOMIFACEDECL}IPropertyStorage Revert 10 ()i +${NSISCOMIFACEDECL}IPropertyStorage Enum 11 (*p)i +${NSISCOMIFACEDECL}IPropertyStorage SetTimes 12 (p,p,p)i +${NSISCOMIFACEDECL}IPropertyStorage SetClass 13 (g)i +${NSISCOMIFACEDECL}IPropertyStorage Stat 14 (p)i +!endif + +!ifndef IID_IPropertySetStorage +!define IID_IPropertySetStorage {0000013A-0000-0000-C000-000000000046} +${NSISCOMIFACEDECL}IPropertySetStorage Create 3 (g,g,i,i,*p)i +${NSISCOMIFACEDECL}IPropertySetStorage Open 4 (g,i,*p)i +${NSISCOMIFACEDECL}IPropertySetStorage Delete 5 (g)i +${NSISCOMIFACEDECL}IPropertySetStorage Enum 6 (*p)i +!endif + !ifndef CLSID_ApplicationAssociationRegistration !define CLSID_ApplicationAssociationRegistration {591209c7-767b-42b2-9fba-44ee4615f2c7} !endif @@ -260,5 +313,21 @@ ${NSISCOMIFACEDECL}IGameStatisticsMgr GetGameStatistics 3 (w,i,*i,*p)i ${NSISCOMIFACEDECL}IGameStatisticsMgr RemoveGameStatistics 4 (w)i !endif +!ifndef CLSID_InternetShortcut +!define CLSID_InternetShortcut {FBF23B40-E3F0-101B-8488-00AA003E56F8} +!endif +!ifndef IID_IUniformResourceLocator +!define IID_IUniformResourceLocatorA {FBF23B80-E3F0-101B-8488-00AA003E56F8} +!define IID_IUniformResourceLocatorW {CABB0DA0-DA57-11CF-9974-0020AFD79762} +!ifdef NSIS_UNICODE +!define IID_IUniformResourceLocator ${IID_IUniformResourceLocatorW} +!else +!define IID_IUniformResourceLocator ${IID_IUniformResourceLocatorA} +!endif +${NSISCOMIFACEDECL}IUniformResourceLocator SetURL 3 (t,i)i +${NSISCOMIFACEDECL}IUniformResourceLocator GetURL 4 (*p)i +${NSISCOMIFACEDECL}IUniformResourceLocator InvokeCommand 5 (p)i +!endif + !verbose pop !endif /* __WIN_COM__INC */ diff --git a/Include/Win/Propkey.nsh b/Include/Win/Propkey.nsh index fff6f0c0..3da4703a 100644 --- a/Include/Win/Propkey.nsh +++ b/Include/Win/Propkey.nsh @@ -10,10 +10,16 @@ WTypes.h ;NOTE: This list is incomplete !define VT_EMPTY 0 !define VT_NULL 1 +!define VT_I2 2 !define VT_I4 3 !define VT_BSTR 8 !define VT_BOOL 11 +!define VT_I1 16 +!define VT_UI1 17 +!define VT_UI2 18 !define VT_UI4 19 +!define VT_I8 20 +!define VT_UI8 21 !define VT_INT 22 !define VT_UINT 23 !define VT_HRESULT 25 @@ -28,6 +34,12 @@ WTypes.h !define SYSSIZEOF_PROPERTYKEY 20 !define SYSSTRUCT_PROPERTYKEY (&g16,&i4) ;System.dll is buggy when it comes to g and forces us to specify the size +!define STGC_DEFAULT 0 +!define STGC_OVERWRITE 1 +!define STGC_ONLYIFCURRENT 2 +!define STGC_DANGEROUSLYCOMMITMERELYTODISKCACHE 4 +!define STGC_CONSOLIDATE 8 + /************************************************** PropIdl.h @@ -35,6 +47,10 @@ PropIdl.h !define SYSSIZEOF_PROPVARIANT 16 !define SYSSTRUCT_PROPVARIANT (&i2,&i6,&i8) +!define PRSPEC_LPWSTR 0 +!define PRSPEC_PROPID 1 +!define SYSSTRUCT_PROPSPEC (p,p) + /************************************************** Propkey.h @@ -47,5 +63,72 @@ Propkey.h !define PKEY_AppUserModel_StartPinOption '"{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}",12' ; VT_UI4 [Eight+] +/************************************************** +ShlGuid.h & ShlObj.h +**************************************************/ +!define FMTID_Intshcut {000214A0-0000-0000-C000-000000000046} +!define PID_IS_URL 2 ; VT_LPWSTR +!define PID_IS_HOTKEY 6 ; VT_UI2 +!define PID_IS_ICONINDEX 8 ; VT_I4 +!define PID_IS_ICONFILE 9 ; VT_LPWSTR +!define PKEY_Intshcut_Url '"${FMTID_Intshcut}",${PID_IS_URL}' ; Undocumented +!define FMTID_InternetSite {000214A1-0000-0000-C000-000000000046} +!define PID_INTSITE_LASTVISIT 4 ; VT_FILETIME +!define PID_INTSITE_VISITCOUNT 6 ; VT_UI4 + + +/************************************************** +Helper macros +**************************************************/ +!macro V_GetVT pPV sysdst +System::Call '*${pPV}(&i2.${sysdst})' +!macroend +!macro V_SetVT pPV syssrc +System::Call '*${pPV}(&i2 ${syssrc})' +!macroend +!macro V_GetI1 pPV sysdst +System::Call '*${pPV}(l,&i1.${sysdst})' +!macroend +!macro V_SetI1 pPV syssrc +System::Call '*${pPV}(l,&i1 ${syssrc})' +!macroend +!macro V_GetI2 pPV sysdst +System::Call '*${pPV}(l,&i2.${sysdst})' +!macroend +!macro V_SetI2 pPV syssrc +System::Call '*${pPV}(l,&i2 ${syssrc})' +!macroend +!macro V_GetI4 pPV sysdst +System::Call '*${pPV}(l,i.${sysdst})' +!macroend +!macro V_SetI4 pPV syssrc +System::Call '*${pPV}(l,i${syssrc})' +!macroend +!macro V_GetI8 pPV sysdst +System::Call '*${pPV}(l,l.${sysdst})' +!macroend +!macro V_SetI8 pPV syssrc +System::Call '*${pPV}(l,l${syssrc})' +!macroend +!macro V_GetPtr pPV sysdst +System::Call '*${pPV}(l,p.${sysdst})' +!macroend +!macro V_SetPtr pPV syssrc +System::Call '*${pPV}(l,p${syssrc})' +!macroend + +!macro IPropertyStorage_ReadPropById pPS ID pPV sysoutHR +System::Call '*(p${PRSPEC_PROPID},p${ID})p.s' +${IPropertyStorage::ReadMultiple} ${pPS} '(1,pss,p${pPV})${sysoutHR}' +System::Free +!macroend + +!macro IPropertyStorage_WritePropById pPS ID pPV sysoutHR +System::Call '*(p${PRSPEC_PROPID},p${ID})p.s' +${IPropertyStorage::WriteMultiple} ${pPS} '(1,pss,p${pPV},2)${sysoutHR}' +System::Free +!macroend + + !verbose pop !endif /* __WIN_PROPKEY__INC */