1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_desktop.hxx"
32 #pragma warning(push, 1)
40 #include "setup_main.hxx"
42 //--------------------------------------------------------------------------
44 void __cdecl
newhandler()
46 throw std::bad_alloc();
50 //--------------------------------------------------------------------------
54 m_uiRet
= ERROR_SUCCESS
;
57 OSVERSIONINFO sInfoOS
;
59 ZeroMemory( &sInfoOS
, sizeof(OSVERSIONINFO
) );
60 sInfoOS
.dwOSVersionInfoSize
= sizeof( OSVERSIONINFO
);
62 GetVersionEx( &sInfoOS
);
64 m_nOSVersion
= sInfoOS
.dwMajorVersion
;
65 m_nMinorVersion
= sInfoOS
.dwMinorVersion
;
66 m_bIsWin9x
= ( VER_PLATFORM_WIN32_NT
!= sInfoOS
.dwPlatformId
);
67 m_bNeedReboot
= false;
68 m_bAdministrative
= false;
71 //--------------------------------------------------------------------------
77 //--------------------------------------------------------------------------
78 //--------------------------------------------------------------------------
79 //--------------------------------------------------------------------------
81 extern "C" int __stdcall
WinMain( HINSTANCE hInst
, HINSTANCE
, LPSTR
, int )
84 OSVERSIONINFO sInfoOS
;
86 ZeroMemory( &sInfoOS
, sizeof(OSVERSIONINFO
) );
87 sInfoOS
.dwOSVersionInfoSize
= sizeof( OSVERSIONINFO
);
89 GetVersionEx( &sInfoOS
);
91 boolean bIsWin9x
= ( VER_PLATFORM_WIN32_NT
!= sInfoOS
.dwPlatformId
);
96 pSetup
= Create_SetupAppA();
98 pSetup
= Create_SetupAppW();
102 if ( ! pSetup
->Initialize( hInst
) )
103 throw pSetup
->GetError();
105 if ( pSetup
->AlreadyRunning() )
106 throw (UINT
) ERROR_INSTALL_ALREADY_RUNNING
;
108 if ( ! pSetup
->ReadProfile() )
109 throw pSetup
->GetError();
111 if ( ! pSetup
->CheckVersion() )
112 throw pSetup
->GetError();
114 if ( ! pSetup
->IsAdminInstall() )
115 if ( ! pSetup
->GetPatches() )
116 throw pSetup
->GetError();
118 // CheckForUpgrade() has to be called after calling GetPatches()!
119 if ( ! pSetup
->CheckForUpgrade() )
120 throw pSetup
->GetError();
124 if ( ! pSetup
->ChooseLanguage( nLanguage
) )
125 throw pSetup
->GetError();
127 if ( ! pSetup
->Install( nLanguage
) )
128 throw pSetup
->GetError();
130 catch ( std::bad_alloc
)
132 pSetup
->DisplayError( ERROR_OUTOFMEMORY
);
136 pSetup
->DisplayError( nErr
);
139 int nRet
= pSetup
->GetError();