oleview: U(x) must be defined after winnt.h has had a chance to define NONAMELESSUNIO...
[wine] / programs / oleview / main.h
1 /*
2  * OleView (main.h)
3  *
4  * Copyright 2006 Piotr Caban
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #define COBJMACROS
22
23 #include <windows.h>
24 #include <winreg.h>
25 #include <commctrl.h>
26 #include <unknwn.h>
27
28 #ifdef NONAMELESSUNION
29 # define U(x)  (x).u
30 #else
31 # define U(x)  (x)
32 #endif
33
34 #include "resource.h"
35
36 #define MAX_LOAD_STRING 256
37 #define MAX_WINDOW_WIDTH 30000
38 #define MIN_FUNC_ID 0x60000000
39 #define MIN_VAR_ID 0x40000000
40
41 #define STATUS_WINDOW 2000
42 #define TREE_WINDOW 2001
43 #define TAB_WINDOW 2002
44 #define TYPELIB_TREE 2003
45
46 /*ItemInfo flags */
47 #define REGTOP 1
48 #define REGPATH 2
49 #define SHOWALL 4
50 #define INTERFACE 8
51
52 typedef struct
53 {
54     HWND hMainWnd;
55     HWND hPaneWnd;
56     HWND hStatusBar;
57     HWND hToolBar;
58     HWND hTree;
59     HWND hDetails;
60     HWND hTypeLibWnd;
61     HINSTANCE hMainInst;
62     BOOL bExpert;
63     DWORD dwClsCtx;
64     WCHAR wszMachineName[MAX_LOAD_STRING];
65 }GLOBALS;
66
67 typedef struct
68 {
69     HWND left;
70     HWND right;
71     INT pos;
72     INT size;
73     INT width;
74     INT height;
75     INT last;
76 }PANE;
77
78 typedef struct
79 {
80     /* Main TreeView entries: */
81     HTREEITEM hOC;    /* Object Classes */
82     HTREEITEM hGBCC;  /* Grouped by Component Category */
83     HTREEITEM hO1O;   /* OLE 1.0 Objects */
84     HTREEITEM hCLO;   /* COM Library Objects */
85     HTREEITEM hAO;    /* All Objects */
86     HTREEITEM hAID;   /* Application IDs */
87     HTREEITEM hTL;    /* Type Libraries */
88     HTREEITEM hI;     /* Interfaces */
89 }TREE;
90
91 typedef struct
92 {
93     CHAR cFlag;
94     WCHAR info[MAX_LOAD_STRING];
95     WCHAR clsid[MAX_LOAD_STRING];
96     WCHAR path[MAX_LOAD_STRING];
97     BOOL loaded;
98     IUnknown *pU;
99 }ITEM_INFO;
100
101 typedef struct
102 {
103     HWND hStatic;
104     HWND hTab;
105     HWND hReg;
106 }DETAILS;
107
108 typedef struct
109 {
110     HWND hPaneWnd;
111     HWND hTree;
112     HWND hEdit;
113     HWND hStatusBar;
114     WCHAR wszFileName[MAX_LOAD_STRING];
115 }TYPELIB;
116
117 typedef struct
118 {
119     WCHAR *idl;
120     WCHAR wszInsertAfter[MAX_LOAD_STRING];
121     INT idlLen;
122     BOOL bPredefine;
123 }TYPELIB_DATA;
124
125 extern GLOBALS globals;
126 extern TREE tree;
127 extern TYPELIB typelib;
128
129 /* Predefinitions: */
130 /* details.c */
131 HWND CreateDetailsWindow(HINSTANCE hInst);
132 void RefreshDetails(HTREEITEM item);
133
134 /* oleview.c */
135 void RefreshMenu(HTREEITEM item);
136
137 /* pane.c */
138 BOOL CreatePanedWindow(HWND hWnd, HWND *hWndCreated, HINSTANCE hInst);
139 BOOL PaneRegisterClass(void);
140 void SetLeft(HWND hParent, HWND hWnd);
141 void SetRight(HWND hParent, HWND hWnd);
142
143 /* tree.c */
144 void EmptyTree(void);
145 void AddTreeEx(void);
146 void AddTree(void);
147 HWND CreateTreeWindow(HINSTANCE hInst);
148 BOOL CreateRegPath(HTREEITEM item, WCHAR *buffer, int bufSize);
149 void CreateInst(HTREEITEM item, WCHAR *wszMachineName);
150 void ReleaseInst(HTREEITEM item);
151
152 /* typelib.c */
153 BOOL CreateTypeLibWindow(HINSTANCE hInst, WCHAR *wszFileName);
154 BOOL TypeLibRegisterClass(void);
155 void UpdateData(HTREEITEM item);
156
157 /* interface.c */
158 BOOL IsInterface(HTREEITEM item);
159 void InterfaceViewer(HTREEITEM item);