LibreOffice Module setup_native (master) 1
checkpatches.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include "shlxtmsi.hxx"
21#include <strsafe.h>
22#include <systools/win32/uwinapi.h>
23
24#ifdef DEBUG
25inline void OutputDebugStringFormatW( PCWSTR pFormat, ... )
26{
27 WCHAR buffer[1024];
28 va_list args;
29
30 va_start( args, pFormat );
31 StringCchVPrintfW( buffer, std::size(buffer), pFormat, args );
32 OutputDebugStringW( buffer );
33 va_end(args);
34}
35#else
36static void OutputDebugStringFormatW( PCWSTR, ... )
37{
38}
39#endif
40
41extern "C" __declspec(dllexport) UINT __stdcall CheckPatchList( MSIHANDLE handle )
42{
43 std::wstring sPatchList = GetMsiPropertyW( handle, L"PATCH" );
44 std::wstring sRequiredPatch = GetMsiPropertyW( handle, L"PREREQUIREDPATCH" );
45
46 OutputDebugStringFormatW( L"CheckPatchList called with PATCH=%s and PRQ=%s\n", sPatchList.c_str(), sRequiredPatch.c_str() );
47
48 if ( ( sPatchList.length() != 0 ) && ( sRequiredPatch.length() != 0 ) )
49 {
50 if ( wcsstr( sPatchList.c_str(), sRequiredPatch.c_str() ) )
51 {
52 SetMsiPropertyW( handle, L"IGNOREPREREQUIREDPATCH", L"1" );
53 OutputDebugStringFormatW( L"Set Property IgnorePrerequiredPatch!\n" );
54 }
55 }
56 return ERROR_SUCCESS;
57}
58
59/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
__declspec(dllexport) UINT __stdcall CheckPatchList(MSIHANDLE handle)
void OutputDebugStringFormatW(PCWSTR pFormat,...)
args
static std::wstring GetMsiPropertyW(MSIHANDLE handle, const std::wstring &sProperty)
Definition: shlxtmsi.hxx:29
static void SetMsiPropertyW(MSIHANDLE handle, const std::wstring &sProperty, const std::wstring &sValue)
Definition: shlxtmsi.hxx:47