checkrunningofficelanguagepack.cxx (910823ae) checkrunningofficelanguagepack.cxx (0cf988a7)
1/**************************************************************
1/**************************************************************
2 *
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
19 *
20 *************************************************************/
21
22
23
24#define _WIN32_WINDOWS 0x0410
25
26#ifdef _MSC_VER
27#pragma warning(push, 1) /* disable warnings within system headers */

--- 48 unchanged lines hidden (view full) ---

76 DWORD nChars = 0;
77
78 if ( MsiGetProperty( handle, sProperty.c_str(), szDummy, &nChars ) == ERROR_MORE_DATA )
79 {
80 DWORD nBytes = ++nChars * sizeof(TCHAR);
81 LPTSTR buffer = reinterpret_cast<LPTSTR>(_alloca(nBytes));
82 ZeroMemory( buffer, nBytes );
83 MsiGetProperty(handle, sProperty.c_str(), buffer, &nChars);
20 *************************************************************/
21
22
23
24#define _WIN32_WINDOWS 0x0410
25
26#ifdef _MSC_VER
27#pragma warning(push, 1) /* disable warnings within system headers */

--- 48 unchanged lines hidden (view full) ---

76 DWORD nChars = 0;
77
78 if ( MsiGetProperty( handle, sProperty.c_str(), szDummy, &nChars ) == ERROR_MORE_DATA )
79 {
80 DWORD nBytes = ++nChars * sizeof(TCHAR);
81 LPTSTR buffer = reinterpret_cast<LPTSTR>(_alloca(nBytes));
82 ZeroMemory( buffer, nBytes );
83 MsiGetProperty(handle, sProperty.c_str(), buffer, &nChars);
84 result = buffer;
84 result = buffer;
85 }
86
87 return result;
88}
85 }
86
87 return result;
88}
89
89
90static inline bool IsSetMsiProperty(MSIHANDLE handle, const std::_tstring& sProperty)
90static inline bool IsSetMsiProperty(MSIHANDLE handle, const std::_tstring& sProperty)
91{
91{
92 std::_tstring value = GetMsiProperty(handle, sProperty);
93 return (value.length() > 0);
94}
95
96static inline void UnsetMsiProperty(MSIHANDLE handle, const std::_tstring& sProperty)
97{
98 MsiSetProperty(handle, sProperty.c_str(), NULL);
99}

--- 11 unchanged lines hidden (view full) ---

111
112 if ( dwFlags & MOVEFILE_DELAY_UNTIL_REBOOT )
113 {
114 CHAR szExistingFileNameA[MAX_PATH];
115 CHAR szNewFileNameA[MAX_PATH] = "NUL";
116
117 // Path names in WININIT.INI must be in short path name form
118
92 std::_tstring value = GetMsiProperty(handle, sProperty);
93 return (value.length() > 0);
94}
95
96static inline void UnsetMsiProperty(MSIHANDLE handle, const std::_tstring& sProperty)
97{
98 MsiSetProperty(handle, sProperty.c_str(), NULL);
99}

--- 11 unchanged lines hidden (view full) ---

111
112 if ( dwFlags & MOVEFILE_DELAY_UNTIL_REBOOT )
113 {
114 CHAR szExistingFileNameA[MAX_PATH];
115 CHAR szNewFileNameA[MAX_PATH] = "NUL";
116
117 // Path names in WININIT.INI must be in short path name form
118
119 if (
119 if (
120 GetShortPathNameA( lpExistingFileNameA, szExistingFileNameA, MAX_PATH ) &&
121 (!lpNewFileNameA || GetShortPathNameA( lpNewFileNameA, szNewFileNameA, MAX_PATH ))
122 )
123 {
124 CHAR szBuffer[32767]; // The buffer size must not exceed 32K
125 DWORD dwBufLen = GetPrivateProfileSectionA( RENAME_SECTION, szBuffer, elementsof(szBuffer), WININIT_FILENAME );
126
120 GetShortPathNameA( lpExistingFileNameA, szExistingFileNameA, MAX_PATH ) &&
121 (!lpNewFileNameA || GetShortPathNameA( lpNewFileNameA, szNewFileNameA, MAX_PATH ))
122 )
123 {
124 CHAR szBuffer[32767]; // The buffer size must not exceed 32K
125 DWORD dwBufLen = GetPrivateProfileSectionA( RENAME_SECTION, szBuffer, elementsof(szBuffer), WININIT_FILENAME );
126
127 CHAR szRename[MAX_PATH]; // This is enough for at most to times 67 chracters
127 CHAR szRename[MAX_PATH]; // This is enough for at most to times 67 characters
128 strcpy( szRename, szNewFileNameA );
129 strcat( szRename, "=" );
130 strcat( szRename, szExistingFileNameA );
131 size_t lnRename = strlen(szRename);
132
133 if ( dwBufLen + lnRename + 2 <= elementsof(szBuffer) )
134 {
135 CopyMemory( &szBuffer[dwBufLen], szRename, lnRename );

--- 59 unchanged lines hidden (view full) ---

195 if ( fRenameSucceeded )
196 {
197 MoveFileExImpl( sIntermediate.c_str(), sResourceFile.c_str(), 0 );
198 fSuccess = FindNextFile( hFind, &aFindFileData );
199 }
200 } while ( fSuccess && fRenameSucceeded );
201
202 if ( !fRenameSucceeded )
128 strcpy( szRename, szNewFileNameA );
129 strcat( szRename, "=" );
130 strcat( szRename, szExistingFileNameA );
131 size_t lnRename = strlen(szRename);
132
133 if ( dwBufLen + lnRename + 2 <= elementsof(szBuffer) )
134 {
135 CopyMemory( &szBuffer[dwBufLen], szRename, lnRename );

--- 59 unchanged lines hidden (view full) ---

195 if ( fRenameSucceeded )
196 {
197 MoveFileExImpl( sIntermediate.c_str(), sResourceFile.c_str(), 0 );
198 fSuccess = FindNextFile( hFind, &aFindFileData );
199 }
200 } while ( fSuccess && fRenameSucceeded );
201
202 if ( !fRenameSucceeded )
203 {
203 {
204 MsiSetProperty(handle, TEXT("OFFICERUNS"), TEXT("1"));
204 MsiSetProperty(handle, TEXT("OFFICERUNS"), TEXT("1"));
205 SetMsiErrorCode( MSI_ERROR_OFFICE_IS_RUNNING );
206 }
205 SetMsiErrorCode( MSI_ERROR_OFFICE_IS_RUNNING );
206 }
207
208 FindClose( hFind );
209 }
210
211 return ERROR_SUCCESS;
212}
213
207
208 FindClose( hFind );
209 }
210
211 return ERROR_SUCCESS;
212}
213
214
215