1/*
2  Copyright (c) 1990-2005 Info-ZIP.  All rights reserved.
3
4  See the accompanying file LICENSE, version 2000-Apr-09 or later
5  (the contents of which are also included in unzip.h) for terms of use.
6  If, for some reason, these files are missing, the Info-ZIP license
7  also may be found at:  ftp://ftp.info-zip.org/pub/infozip/license.html
8*/
9//******************************************************************************
10//
11// File:        WINMAIN.H
12//
13// Description: This module contains all the Windows specific declarations for
14//              Pocket UnZip.  See WINMAIN.CPP for a more detailed description
15//              and the actual implementation.
16//
17// Copyright:   All the source files for Pocket UnZip, except for components
18//              written by the Info-ZIP group, are copyrighted 1997 by Steve P.
19//              Miller.  The product "Pocket UnZip" itself is property of the
20//              author and cannot be altered in any way without written consent
21//              from Steve P. Miller.
22//
23// Disclaimer:  All project files are provided "as is" with no guarantee of
24//              their correctness.  The authors are not liable for any outcome
25//              that is the result of using this source.  The source for Pocket
26//              UnZip has been placed in the public domain to help provide an
27//              understanding of its implementation.  You are hereby granted
28//              full permission to use this source in any way you wish, except
29//              to alter Pocket UnZip itself.  For comments, suggestions, and
30//              bug reports, please write to stevemil@pobox.com.
31//
32//
33// Date      Name          History
34// --------  ------------  -----------------------------------------------------
35// 02/01/97  Steve Miller  Created (Version 1.0 using Info-ZIP UnZip 5.30)
36//
37//******************************************************************************
38
39#ifndef __WINMAIN_H__
40#define __WINMAIN_H__
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46//******************************************************************************
47//***** Constants / Macros
48//******************************************************************************
49
50#define MRU_MAX_FILE                       4  // Should not exceed 9
51#define MRU_START_ID                     501
52
53#define WM_PRIVATE                    0x9999
54#define MSG_SUBCLASS_DIALOG                1
55#define MSG_INIT_DIALOG                    2
56#define MSG_ADD_TEXT_TO_EDIT               3
57#define MSG_PROMPT_TO_REPLACE              4
58#define MSG_PROMPT_FOR_PASSWORD            5
59#define MSG_UPDATE_PROGRESS_PARTIAL        6
60#define MSG_UPDATE_PROGRESS_COMPLETE       7
61#define MSG_OPERATION_COMPLETE             8
62
63#define IDC_SAVE_FILE_LIST                12
64#define IDC_SAVE_NAME_PROMPT            1023
65#define IDC_SAVE_NAME_EDIT              1021
66#define IDC_SAVE_TYPE_PROMPT            1022
67#define IDC_SAVE_TYPE_LIST              1020
68
69#define PROGRESS_MAX                   32768
70
71#define ZFILE_ATTRIBUTE_VOLUME    0x00000008
72#define ZFILE_ATTRIBUTE_ENCRYPTED 0x10000000
73#define ZFILE_ATTRIBUTE_COMMENT   0x20000000
74
75#define IMAGE_VOLUME                       0
76#define IMAGE_FOLDER                       1
77#define IMAGE_APPLICATION                  2
78#define IMAGE_GENERIC                      3
79
80
81#ifndef OFN_NOVALIDATE
82#define OFN_NOVALIDATE               0x00000100
83#endif
84
85#ifndef LVS_EX_FULLROWSELECT
86#define LVS_EX_FULLROWSELECT      0x00000020
87#endif
88
89// LVM_SETEXTENDEDLISTVIEWSTYLE came after VC 4.0
90#ifndef LVM_SETEXTENDEDLISTVIEWSTYLE
91#define LVM_SETEXTENDEDLISTVIEWSTYLE (LVM_FIRST + 54)
92#endif
93
94// LVM_GETEXTENDEDLISTVIEWSTYLE came after VC 4.0
95#ifndef LVM_GETEXTENDEDLISTVIEWSTYLE
96#define LVM_GETEXTENDEDLISTVIEWSTYLE (LVM_FIRST + 55)
97#endif
98
99#ifdef _WIN32_WCE
100#define CheckDlgButton(hDlg, ctrl, fChecked) \
101           SendDlgItemMessage(hDlg, ctrl, BM_SETCHECK, fChecked, 0)
102#define IsDlgButtonChecked(hDlg, ctrl) \
103           SendDlgItemMessage(hDlg, ctrl, BM_GETCHECK, 0, 0)
104#endif
105
106//******************************************************************************
107//***** Types and Structures
108//******************************************************************************
109
110typedef struct _FILE_TYPE_NODE {
111   struct _FILE_TYPE_NODE *pNext;
112   int                     image;
113   CHAR                    szExtAndDesc[2];
114} FILE_TYPE_NODE, *LPFILE_TYPE_NODE;
115
116typedef struct _FILE_NODE {
117   zusz_t          uzSize;
118   zusz_t          uzCompressedSize;
119   DWORD           dwModified;
120   DWORD           dwAttributes;
121   DWORD           dwCRC;
122   LPCSTR          szComment;
123   LPCSTR          szType;
124   CHAR            szPathAndMethod[2];
125} FILE_NODE, *LPFILE_NODE;
126
127typedef struct _COLUMN {
128   LPTSTR szName;
129   int    format;
130} COLUMN, *LPCOLUMN;
131
132
133//******************************************************************************
134//***** Exported Function Prototypes
135//******************************************************************************
136
137void AddFileToListView(FILE_NODE *pFile);
138LPCSTR GetFileFromPath(LPCSTR szPath);
139void ForwardSlashesToBackSlashesA(LPSTR szBuffer);
140
141
142//******************************************************************************
143//***** Global Variables
144//******************************************************************************
145
146#ifdef GLOBAL_DECLARE
147#undef GLOBAL_DECLARE
148#undef GLOBAL_INIT
149#endif
150
151#ifdef __WINMAIN_CPP__
152   #define GLOBAL_DECLARE
153   #define GLOBAL_INIT(value) =value
154#else
155   #define GLOBAL_DECLARE extern
156   #define GLOBAL_INIT(value)
157#endif
158
159GLOBAL_DECLARE HINSTANCE g_hInst                GLOBAL_INIT(NULL);
160GLOBAL_DECLARE HWND      g_hWndMain             GLOBAL_INIT(NULL);
161GLOBAL_DECLARE HWND      g_hWndEdit             GLOBAL_INIT(NULL);
162GLOBAL_DECLARE HWND      g_hDlgProgress         GLOBAL_INIT(NULL);
163GLOBAL_DECLARE CHAR      g_szZipFile[_MAX_PATH] GLOBAL_INIT("");
164
165#ifdef __cplusplus
166} // extern "C"
167#endif
168
169#endif // __WINMAIN_H__
170