main.h 3.57 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/*
 * OleView (main.h)
 *
 * Copyright 2006 Piotr Caban
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 */

#define COBJMACROS

23 24 25
#include <windows.h>
#include <winreg.h>
#include <commctrl.h>
26
#include <commdlg.h>
27 28
#include <unknwn.h>

29 30 31 32 33 34
#ifdef NONAMELESSUNION
# define U(x)  (x).u
#else
# define U(x)  (x)
#endif

35 36 37
#include "resource.h"

#define MAX_LOAD_STRING 256
Piotr Caban's avatar
Piotr Caban committed
38
#define MAX_WINDOW_WIDTH 30000
39 40
#define MIN_FUNC_ID 0x60000000
#define MIN_VAR_ID 0x40000000
41
#define TAB_SIZE 4
42 43

#define STATUS_WINDOW 2000
44
#define TREE_WINDOW 2001
45
#define TAB_WINDOW 2002
46
#define TYPELIB_TREE 2003
47 48 49 50 51 52

/*ItemInfo flags */
#define REGTOP 1
#define REGPATH 2
#define SHOWALL 4
#define INTERFACE 8
53 54 55 56

typedef struct
{
    HWND hMainWnd;
Piotr Caban's avatar
Piotr Caban committed
57
    HWND hPaneWnd;
58 59
    HWND hStatusBar;
    HWND hToolBar;
60 61
    HWND hTree;
    HWND hDetails;
62
    HWND hTypeLibWnd;
63
    HINSTANCE hMainInst;
64
    BOOL bExpert;
65
    DWORD dwClsCtx;
66
    WCHAR wszMachineName[MAX_LOAD_STRING];
67 68
}GLOBALS;

Piotr Caban's avatar
Piotr Caban committed
69 70 71 72 73 74 75 76 77 78 79
typedef struct
{
    HWND left;
    HWND right;
    INT pos;
    INT size;
    INT width;
    INT height;
    INT last;
}PANE;

80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
typedef struct
{
    /* Main TreeView entries: */
    HTREEITEM hOC;    /* Object Classes */
    HTREEITEM hGBCC;  /* Grouped by Component Category */
    HTREEITEM hO1O;   /* OLE 1.0 Objects */
    HTREEITEM hCLO;   /* COM Library Objects */
    HTREEITEM hAO;    /* All Objects */
    HTREEITEM hAID;   /* Application IDs */
    HTREEITEM hTL;    /* Type Libraries */
    HTREEITEM hI;     /* Interfaces */
}TREE;

typedef struct
{
    CHAR cFlag;
    WCHAR info[MAX_LOAD_STRING];
    WCHAR clsid[MAX_LOAD_STRING];
98
    WCHAR path[MAX_LOAD_STRING];
99 100 101 102
    BOOL loaded;
    IUnknown *pU;
}ITEM_INFO;

103 104 105 106 107 108 109
typedef struct
{
    HWND hStatic;
    HWND hTab;
    HWND hReg;
}DETAILS;

110 111 112 113 114
typedef struct
{
    HWND hPaneWnd;
    HWND hTree;
    HWND hEdit;
115
    HWND hStatusBar;
116
    WCHAR wszFileName[MAX_LOAD_STRING];
117 118
}TYPELIB;

119 120 121
typedef struct
{
    WCHAR *idl;
122
    WCHAR wszInsertAfter[MAX_LOAD_STRING];
123
    INT idlLen;
124
    BOOL bPredefine;
125
    BOOL bHide;
126 127
}TYPELIB_DATA;

128
extern GLOBALS globals;
129
extern TREE tree;
130
extern TYPELIB typelib;
Piotr Caban's avatar
Piotr Caban committed
131 132

/* Predefinitions: */
133 134 135 136
/* details.c */
HWND CreateDetailsWindow(HINSTANCE hInst);
void RefreshDetails(HTREEITEM item);

137 138 139
/* oleview.c */
void RefreshMenu(HTREEITEM item);

Piotr Caban's avatar
Piotr Caban committed
140 141
/* pane.c */
BOOL CreatePanedWindow(HWND hWnd, HWND *hWndCreated, HINSTANCE hInst);
142
BOOL PaneRegisterClassW(void);
143 144 145
void SetLeft(HWND hParent, HWND hWnd);
void SetRight(HWND hParent, HWND hWnd);

146
/* tree.c */
147
void EmptyTree(void);
148 149
void AddTreeEx(void);
void AddTree(void);
150
HWND CreateTreeWindow(HINSTANCE hInst);
151
BOOL CreateRegPath(HTREEITEM item, WCHAR *buffer, int bufSize);
152
void CreateInst(HTREEITEM item, WCHAR *wszMachineName);
153
void ReleaseInst(HTREEITEM item);
154

155
/* typelib.c */
156
BOOL CreateTypeLibWindow(HINSTANCE hInst, WCHAR *wszFileName);
157
BOOL TypeLibRegisterClassW(void);
158
void UpdateData(HTREEITEM item);
159 160

/* interface.c */
161 162
BOOL IsInterface(HTREEITEM item);
void InterfaceViewer(HTREEITEM item);