xref: /aoo41x/main/desktop/win32/source/setup/setup.hxx (revision 0a1e2f0e)
1*0a1e2f0eSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*0a1e2f0eSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*0a1e2f0eSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*0a1e2f0eSAndrew Rist  * distributed with this work for additional information
6*0a1e2f0eSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*0a1e2f0eSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*0a1e2f0eSAndrew Rist  * "License"); you may not use this file except in compliance
9*0a1e2f0eSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*0a1e2f0eSAndrew Rist  *
11*0a1e2f0eSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*0a1e2f0eSAndrew Rist  *
13*0a1e2f0eSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*0a1e2f0eSAndrew Rist  * software distributed under the License is distributed on an
15*0a1e2f0eSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*0a1e2f0eSAndrew Rist  * KIND, either express or implied.  See the License for the
17*0a1e2f0eSAndrew Rist  * specific language governing permissions and limitations
18*0a1e2f0eSAndrew Rist  * under the License.
19*0a1e2f0eSAndrew Rist  *
20*0a1e2f0eSAndrew Rist  *************************************************************/
21*0a1e2f0eSAndrew Rist 
22*0a1e2f0eSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include "setup_main.hxx"
25cdf0e10cSrcweir 
26cdf0e10cSrcweir //--------------------------------------------------------------------------
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #ifdef SetupAppX
29cdf0e10cSrcweir  #undef SetupAppX
30cdf0e10cSrcweir #endif
31cdf0e10cSrcweir 
32cdf0e10cSrcweir #ifdef Create_SetupAppX
33cdf0e10cSrcweir  #undef Create_SetupAppX
34cdf0e10cSrcweir #endif
35cdf0e10cSrcweir 
36cdf0e10cSrcweir #ifdef LanguageDataX
37cdf0e10cSrcweir  #undef LanguageDataX
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir 
40cdf0e10cSrcweir 
41cdf0e10cSrcweir #ifdef UNICODE
42cdf0e10cSrcweir  #define SetupAppX          SetupAppW
43cdf0e10cSrcweir  #define Create_SetupAppX   Create_SetupAppW
44cdf0e10cSrcweir  #define LanguageDataX      LanguageDataW
45cdf0e10cSrcweir #else
46cdf0e10cSrcweir  #define SetupAppX          SetupAppA
47cdf0e10cSrcweir  #define Create_SetupAppX   Create_SetupAppA
48cdf0e10cSrcweir  #define LanguageDataX      LanguageDataA
49cdf0e10cSrcweir #endif
50cdf0e10cSrcweir 
51cdf0e10cSrcweir //--------------------------------------------------------------------------
52cdf0e10cSrcweir 
53cdf0e10cSrcweir struct LanguageDataX
54cdf0e10cSrcweir {
55cdf0e10cSrcweir     long    m_nLanguageID;
56cdf0e10cSrcweir     LPTSTR  m_pTransform;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir      LanguageDataX( LPTSTR pData );
59cdf0e10cSrcweir     ~LanguageDataX();
60cdf0e10cSrcweir };
61cdf0e10cSrcweir 
62cdf0e10cSrcweir //--------------------------------------------------------------------------
63cdf0e10cSrcweir 
64cdf0e10cSrcweir class SetupAppX : public SetupApp
65cdf0e10cSrcweir {
66cdf0e10cSrcweir     HINSTANCE   m_hInst;
67cdf0e10cSrcweir     HANDLE      m_hMapFile;
68cdf0e10cSrcweir     LPTSTR      m_pAppTitle;
69cdf0e10cSrcweir     LPTSTR      m_pCmdLine;
70cdf0e10cSrcweir     LPTSTR      m_pDatabase;
71cdf0e10cSrcweir     LPTSTR      m_pReqVersion;
72cdf0e10cSrcweir     LPTSTR      m_pProductName;
73cdf0e10cSrcweir     LPTSTR      m_pAdvertise;
74cdf0e10cSrcweir     LPTSTR      m_pTmpName;
75cdf0e10cSrcweir     LPTSTR      m_pErrorText;
76cdf0e10cSrcweir     LPTSTR      m_pModuleFile;
77cdf0e10cSrcweir     LPTSTR      m_pPatchFiles;
78cdf0e10cSrcweir     LPCTSTR     m_pUpgradeKey;
79cdf0e10cSrcweir     LPCTSTR     m_pProductVersion;
80cdf0e10cSrcweir     int        *m_pMSIErrorCode;
81cdf0e10cSrcweir 
82cdf0e10cSrcweir     boolean     m_bQuiet            : 1;
83cdf0e10cSrcweir     boolean     m_bIgnoreAlreadyRunning : 1;
84cdf0e10cSrcweir     boolean     m_bRegNoMsoTypes :1;
85cdf0e10cSrcweir     boolean     m_bRegAllMsoTypes :1;
86cdf0e10cSrcweir     boolean     m_bIsMinorUpgrade :1;
87cdf0e10cSrcweir     boolean     m_bSupportsPatch :1;
88cdf0e10cSrcweir 
89cdf0e10cSrcweir     FILE       *m_pLogFile;
90cdf0e10cSrcweir 
91cdf0e10cSrcweir     long            m_nLanguageID;
92cdf0e10cSrcweir     long            m_nLanguageCount;
93cdf0e10cSrcweir     LanguageDataX** m_ppLanguageList;
94cdf0e10cSrcweir 
95cdf0e10cSrcweir private:
96cdf0e10cSrcweir 
97cdf0e10cSrcweir     boolean     GetPathToFile( TCHAR* pFileName, TCHAR **pPath );
98cdf0e10cSrcweir     LPCTSTR     GetPathToMSI();
99cdf0e10cSrcweir 
100cdf0e10cSrcweir     int         GetNameValue( TCHAR* pLine, TCHAR **pName, TCHAR **pValue );
101cdf0e10cSrcweir     boolean     GetProfileSection( LPCTSTR pFileName, LPCTSTR pSection,
102cdf0e10cSrcweir                                    DWORD& rSize, LPTSTR *pRetBuf );
103cdf0e10cSrcweir     LPTSTR      CopyIniFile( LPCTSTR pIniFile );
104cdf0e10cSrcweir     void        ConvertNewline( LPTSTR pText ) const;
105cdf0e10cSrcweir 
106cdf0e10cSrcweir     boolean     LaunchInstaller( LPCTSTR pParam );
107cdf0e10cSrcweir     HMODULE     LoadMsiLibrary();
108cdf0e10cSrcweir     DWORD       WaitForProcess( HANDLE hHandle );
109cdf0e10cSrcweir 
110cdf0e10cSrcweir     boolean     GetCmdLineParameters( LPTSTR *pCmdLine );
111cdf0e10cSrcweir     DWORD       GetNextArgument( LPCTSTR pStr, LPTSTR *pArg,
112cdf0e10cSrcweir                                  LPTSTR *pNext, boolean bStripQuotes = false );
113cdf0e10cSrcweir     boolean     IsAdmin();
114cdf0e10cSrcweir 
115cdf0e10cSrcweir     boolean     GetCommandLine();
116cdf0e10cSrcweir 
117cdf0e10cSrcweir     boolean     IsTerminalServerInstalled() const;
118cdf0e10cSrcweir     void        AddFileToPatchList( TCHAR* pPath, TCHAR* pFile );
119cdf0e10cSrcweir     boolean     IsPatchInstalled( TCHAR* pBaseDir, TCHAR* pFileName );
120cdf0e10cSrcweir     boolean     InstallRuntimes( TCHAR* pProductCode, TCHAR* pFileName );
121cdf0e10cSrcweir 
122cdf0e10cSrcweir public:
123cdf0e10cSrcweir                     SetupAppX();
124cdf0e10cSrcweir                    ~SetupAppX();
125cdf0e10cSrcweir 
126cdf0e10cSrcweir     virtual boolean Initialize( HINSTANCE hInst );
127cdf0e10cSrcweir     virtual boolean AlreadyRunning() const;
128cdf0e10cSrcweir     virtual boolean ReadProfile();
129cdf0e10cSrcweir     virtual boolean GetPatches();
130cdf0e10cSrcweir     virtual boolean ChooseLanguage( long& rLanguage );
131cdf0e10cSrcweir     virtual boolean CheckVersion();
132cdf0e10cSrcweir     virtual boolean CheckForUpgrade();
133cdf0e10cSrcweir     virtual boolean InstallRuntimes();
134cdf0e10cSrcweir     virtual boolean Install( long nLanguage );
135cdf0e10cSrcweir 
136cdf0e10cSrcweir     virtual UINT    GetError() const;
137cdf0e10cSrcweir     virtual void    DisplayError( UINT nErr ) const;
138cdf0e10cSrcweir 
139cdf0e10cSrcweir     void            Log( LPCTSTR pMessage, LPCTSTR pText = NULL ) const;
140cdf0e10cSrcweir 
GetLanguageCount() const141cdf0e10cSrcweir     long            GetLanguageCount() const { return m_nLanguageCount; }
142cdf0e10cSrcweir     long            GetLanguageID( long nIndex ) const;
143cdf0e10cSrcweir     void            GetLanguageName( long nLanguage, LPTSTR sName ) const;
144cdf0e10cSrcweir 
GetAppTitle() const145cdf0e10cSrcweir     LPCTSTR         GetAppTitle() const { return m_pAppTitle; }
146cdf0e10cSrcweir     LPTSTR          SetProdToAppTitle( LPCTSTR pProdName );
GetHInst() const147cdf0e10cSrcweir     HINSTANCE       GetHInst() const { return m_hInst; }
148cdf0e10cSrcweir };
149cdf0e10cSrcweir 
150cdf0e10cSrcweir //--------------------------------------------------------------------------
151