1 /* Copyright (C) 2011 TigerVNC Team.  All Rights Reserved.
2  *
3  * This is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  *
8  * This software is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this software; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
16  * USA.
17  */
18 
19 #ifndef OS_W32TIGER_H
20 #define OS_W32TIGER_H
21 
22 #ifdef WIN32
23 
24 #include <windows.h>
25 #include <wininet.h>
26 #include <shlobj.h>
27 #include <shlguid.h>
28 #include <wininet.h>
29 
30 
31 /* Windows has different names for these */
32 #define strcasecmp _stricmp
33 #define strncasecmp _strnicmp
34 
35 
36 /* MSLLHOOKSTRUCT structure*/
37 #ifndef LLMHF_INJECTED
38 #define LLMHF_INJECTED          0x00000001
39 #endif
40 
41 
42 /* IActiveDesktop. As of 2011-10-12, MinGW does not define
43    IActiveDesktop in any way (see tracker 2877129), while MinGW64 is
44    broken: has the headers but not the lib symbols. */
45 #ifndef HAVE_ACTIVE_DESKTOP_H
46 extern const GUID CLSID_ActiveDesktop;
47 extern const GUID IID_IActiveDesktop;
48 
49 /* IActiveDesktop::AddUrl */
50 #define ADDURL_SILENT		0x0001
51 
52 /* IActiveDesktop::AddDesktopItemWithUI */
53 #define DTI_ADDUI_DEFAULT	0x00000000
54 #define DTI_ADDUI_DISPSUBWIZARD	0x00000001
55 #define DTI_ADDUI_POSITIONITEM	0x00000002
56 
57 /* IActiveDesktop::ModifyDesktopItem */
58 #define COMP_ELEM_TYPE		0x00000001
59 #define COMP_ELEM_CHECKED	0x00000002
60 #define COMP_ELEM_DIRTY		0x00000004
61 #define COMP_ELEM_NOSCROLL	0x00000008
62 #define COMP_ELEM_POS_LEFT	0x00000010
63 #define COMP_ELEM_POS_TOP	0x00000020
64 #define COMP_ELEM_SIZE_WIDTH	0x00000040
65 #define COMP_ELEM_SIZE_HEIGHT	0x00000080
66 #define COMP_ELEM_POS_ZINDEX	0x00000100
67 #define COMP_ELEM_SOURCE	0x00000200
68 #define COMP_ELEM_FRIENDLYNAME	0x00000400
69 #define COMP_ELEM_SUBSCRIBEDURL	0x00000800
70 #define COMP_ELEM_ORIGINAL_CSI	0x00001000
71 #define COMP_ELEM_RESTORED_CSI	0x00002000
72 #define COMP_ELEM_CURITEMSTATE	0x00004000
73 #define COMP_ELEM_ALL		0x00007FFF /* OR-ed all COMP_ELEM_ */
74 
75 /* IActiveDesktop::GetWallpaper */
76 #define AD_GETWP_BMP		0x00000000
77 #define AD_GETWP_IMAGE		0x00000001
78 #define AD_GETWP_LAST_APPLIED	0x00000002
79 
80 /* IActiveDesktop::ApplyChanges */
81 #define AD_APPLY_SAVE		0x00000001
82 #define AD_APPLY_HTMLGEN	0x00000002
83 #define AD_APPLY_REFRESH	0x00000004
84 #define AD_APPLY_ALL		0x00000007 /* OR-ed three AD_APPLY_ above */
85 #define AD_APPLY_FORCE		0x00000008
86 #define AD_APPLY_BUFFERED_REFRESH 0x00000010
87 #define AD_APPLY_DYNAMICREFRESH	0x00000020
88 
89 /* Structures for IActiveDesktop */
90 typedef struct {
91 	DWORD dwSize;
92 	int iLeft;
93 	int iTop;
94 	DWORD dwWidth;
95 	DWORD dwHeight;
96 	DWORD dwItemState;
97 } COMPSTATEINFO, *LPCOMPSTATEINFO;
98 typedef const COMPSTATEINFO *LPCCOMPSTATEINFO;
99 
100 typedef struct {
101 	DWORD dwSize;
102 	int iLeft;
103 	int iTop;
104 	DWORD dwWidth;
105 	DWORD dwHeight;
106 	int izIndex;
107 	BOOL fCanResize;
108 	BOOL fCanResizeX;
109 	BOOL fCanResizeY;
110 	int iPreferredLeftPercent;
111 	int iPreferredTopPercent;
112 } COMPPOS, *LPCOMPPOS;
113 typedef const COMPPOS *LPCCOMPPOS;
114 
115 typedef struct {
116 	DWORD dwSize;
117 	DWORD dwID;
118 	int iComponentType;
119 	BOOL fChecked;
120 	BOOL fDirty;
121 	BOOL fNoScroll;
122 	COMPPOS cpPos;
123 	WCHAR wszFriendlyName[MAX_PATH];
124 	WCHAR wszSource[INTERNET_MAX_URL_LENGTH];
125 	WCHAR wszSubscribedURL[INTERNET_MAX_URL_LENGTH];
126 	DWORD dwCurItemState;
127 	COMPSTATEINFO csiOriginal;
128 	COMPSTATEINFO csiRestored;
129 } COMPONENT, *LPCOMPONENT;
130 typedef const COMPONENT *LPCCOMPONENT;
131 
132 typedef struct {
133 	DWORD dwSize;
134 	BOOL fEnableComponents;
135 	BOOL fActiveDesktop;
136 } COMPONENTSOPT, *LPCOMPONENTSOPT;
137 typedef const COMPONENTSOPT *LPCCOMPONENTSOPT;
138 
139 typedef struct {
140     DWORD dwSize;
141     DWORD dwStyle;
142 } WALLPAPEROPT, *LPWALLPAPEROPT;
143 typedef const WALLPAPEROPT *LPCWALLPAPEROPT;
144 
145 /* WALLPAPEROPT styles */
146 #define WPSTYLE_CENTER		0x0
147 #define WPSTYLE_TILE		0x1
148 #define WPSTYLE_STRETCH		0x2
149 #define WPSTYLE_MAX		0x3
150 
151 /* Those two are defined in Windows 7 and newer, we don't need them now */
152 #if 0
153 #define WPSTYLE_KEEPASPECT	0x3
154 #define WPSTYLE_CROPTOFIT	0x4
155 #endif
156 
157 #define INTERFACE IActiveDesktop
DECLARE_INTERFACE_(IActiveDesktop,IUnknown)158 DECLARE_INTERFACE_(IActiveDesktop, IUnknown)
159 {
160 	STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE;
161 	STDMETHOD_(ULONG,AddRef)(THIS) PURE;
162 	STDMETHOD_(ULONG,Release)(THIS) PURE;
163 	STDMETHOD(AddDesktopItem)(THIS_ LPCOMPONENT,DWORD) PURE;
164 	STDMETHOD(AddDesktopItemWithUI)(THIS_ HWND,LPCOMPONENT,DWORD) PURE;
165 	STDMETHOD(AddUrl)(THIS_ HWND,LPCWSTR,LPCOMPONENT,DWORD) PURE;
166 	STDMETHOD(ApplyChanges)(THIS_ DWORD) PURE;
167 	STDMETHOD(GenerateDesktopItemHtml)(THIS_ LPCWSTR,LPCOMPONENT,DWORD) PURE;
168 	STDMETHOD(GetDesktopItem)(THIS_ int,LPCOMPONENT,DWORD) PURE;
169 	STDMETHOD(GetDesktopItemByID)(THIS_ DWORD,LPCOMPONENT,DWORD) PURE;
170 	STDMETHOD(GetDesktopItemBySource)(THIS_ LPCWSTR,LPCOMPONENT,DWORD) PURE;
171 	STDMETHOD(GetDesktopItemCount)(THIS_ LPINT,DWORD) PURE;
172 	STDMETHOD(GetDesktopItemOptions)(THIS_ LPCOMPONENTSOPT,DWORD) PURE;
173 	STDMETHOD(GetPattern)(THIS_ LPWSTR,UINT,DWORD) PURE;
174 	STDMETHOD(GetWallpaper)(THIS_ LPWSTR,UINT,DWORD) PURE;
175 	STDMETHOD(GetWallpaperOptions)(THIS_ LPWALLPAPEROPT,DWORD) PURE;
176 	STDMETHOD(ModifyDesktopItem)(THIS_ LPCCOMPONENT,DWORD) PURE;
177 	STDMETHOD(RemoveDesktopItem)(THIS_ LPCCOMPONENT,DWORD) PURE;
178 	STDMETHOD(SetDesktopItemOptions)(THIS_ LPCCOMPONENTSOPT,DWORD) PURE;
179 	STDMETHOD(SetPattern)(THIS_ LPCWSTR,DWORD) PURE;
180 	STDMETHOD(SetWallpaper)(THIS_ LPCWSTR,DWORD) PURE;
181 	STDMETHOD(SetWallpaperOptions)(THIS_ LPCWALLPAPEROPT,DWORD) PURE;
182 };
183 #undef INTERFACE
184 #endif /* HAVE_ACTIVE_DESKTOP_H */
185 
186 #endif /* WIN32 */
187 #endif /* OS_W32TIGER_H */
188