clang-cl loplugin: setup_native
Change-Id: I424164d19ba59697d39b3a3888ec2f743a3a832c Reviewed-on: https://gerrit.libreoffice.org/29853 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
@@ -47,12 +47,12 @@ typedef SC_HANDLE (__stdcall * OpenService_t)(SC_HANDLE, LPCSTR, DWORD);
|
||||
typedef BOOL (__stdcall * QueryServiceStatus_t)(SC_HANDLE, LPSERVICE_STATUS);
|
||||
typedef BOOL (__stdcall * StartService_t)(SC_HANDLE, DWORD, LPCSTR*);
|
||||
|
||||
CloseServiceHandle_t CloseServiceHandle_ = NULL;
|
||||
ControlService_t ControlService_ = NULL;
|
||||
OpenSCManager_t OpenSCManager_ = NULL;
|
||||
OpenService_t OpenService_ = NULL;
|
||||
QueryServiceStatus_t QueryServiceStatus_ = NULL;
|
||||
StartService_t StartService_ = NULL;
|
||||
CloseServiceHandle_t CloseServiceHandle_ = nullptr;
|
||||
ControlService_t ControlService_ = nullptr;
|
||||
OpenSCManager_t OpenSCManager_ = nullptr;
|
||||
OpenService_t OpenService_ = nullptr;
|
||||
QueryServiceStatus_t QueryServiceStatus_ = nullptr;
|
||||
StartService_t StartService_ = nullptr;
|
||||
|
||||
const char * const INDEXING_SERVICE_NAME = "cisvc";
|
||||
|
||||
@@ -104,7 +104,7 @@ bool StopIndexingService(SC_HANDLE hService)
|
||||
|
||||
void StartIndexingService(SC_HANDLE hService)
|
||||
{
|
||||
if (StartService_(hService, 0, NULL))
|
||||
if (StartService_(hService, 0, nullptr))
|
||||
{
|
||||
SERVICE_STATUS status;
|
||||
|
||||
@@ -171,11 +171,11 @@ extern "C" UINT __stdcall RestartIndexingService(MSIHANDLE)
|
||||
return ERROR_SUCCESS;
|
||||
|
||||
SC_HANDLE hSCManager = OpenSCManager_(
|
||||
NULL, // local machine
|
||||
NULL, // ServicesActive database
|
||||
nullptr, // local machine
|
||||
nullptr, // ServicesActive database
|
||||
SC_MANAGER_ALL_ACCESS);
|
||||
|
||||
if (hSCManager != NULL)
|
||||
if (hSCManager != nullptr)
|
||||
{
|
||||
SC_HANDLE hIndexingService = OpenService_(
|
||||
hSCManager, INDEXING_SERVICE_NAME, SERVICE_QUERY_STATUS | SERVICE_START | SERVICE_STOP);
|
||||
|
@@ -39,7 +39,7 @@ std::wstring GetOfficeInstallationPathW(MSIHANDLE handle)
|
||||
{
|
||||
sz++; // space for the final '\0'
|
||||
DWORD nbytes = sz * sizeof(WCHAR);
|
||||
PWSTR buff = reinterpret_cast<PWSTR>(_alloca(nbytes));
|
||||
PWSTR buff = static_cast<PWSTR>(_alloca(nbytes));
|
||||
ZeroMemory(buff, nbytes);
|
||||
MsiGetPropertyW(handle, L"INSTALLLOCATION", buff, &sz);
|
||||
progpath = buff;
|
||||
@@ -57,7 +57,7 @@ std::wstring GetOfficeProductNameW(MSIHANDLE handle)
|
||||
{
|
||||
sz++; // space for the final '\0'
|
||||
DWORD nbytes = sz * sizeof(WCHAR);
|
||||
PWSTR buff = reinterpret_cast<PWSTR>(_alloca(nbytes));
|
||||
PWSTR buff = static_cast<PWSTR>(_alloca(nbytes));
|
||||
ZeroMemory(buff, nbytes);
|
||||
MsiGetPropertyW(handle, L"ProductName", buff, &sz);
|
||||
productname = buff;
|
||||
@@ -75,7 +75,7 @@ std::wstring GetQuickstarterLinkNameW(MSIHANDLE handle)
|
||||
{
|
||||
sz++; // space for the final '\0'
|
||||
DWORD nbytes = sz * sizeof(WCHAR);
|
||||
PWSTR buff = reinterpret_cast<PWSTR>(_alloca(nbytes));
|
||||
PWSTR buff = static_cast<PWSTR>(_alloca(nbytes));
|
||||
ZeroMemory(buff, nbytes);
|
||||
MsiGetPropertyW(handle, L"Quickstarterlinkname", buff, &sz);
|
||||
quickstarterlinkname = buff;
|
||||
@@ -84,7 +84,7 @@ std::wstring GetQuickstarterLinkNameW(MSIHANDLE handle)
|
||||
{
|
||||
sz++; // space for the final '\0'
|
||||
DWORD nbytes = sz * sizeof(WCHAR);
|
||||
PWSTR buff = reinterpret_cast<PWSTR>(_alloca(nbytes));
|
||||
PWSTR buff = static_cast<PWSTR>(_alloca(nbytes));
|
||||
ZeroMemory(buff, nbytes);
|
||||
MsiGetPropertyW(handle, L"ProductName", buff, &sz);
|
||||
quickstarterlinkname = buff;
|
||||
@@ -94,14 +94,14 @@ std::wstring GetQuickstarterLinkNameW(MSIHANDLE handle)
|
||||
|
||||
inline bool IsValidHandle( HANDLE handle )
|
||||
{
|
||||
return NULL != handle && INVALID_HANDLE_VALUE != handle;
|
||||
return nullptr != handle && INVALID_HANDLE_VALUE != handle;
|
||||
}
|
||||
|
||||
static DWORD WINAPI _GetModuleFileNameExW( HANDLE hProcess, HMODULE hModule, PWSTR lpFileName, DWORD nSize )
|
||||
static DWORD WINAPI GetModuleFileNameExW_( HANDLE hProcess, HMODULE hModule, PWSTR lpFileName, DWORD nSize )
|
||||
{
|
||||
typedef DWORD (WINAPI *FN_PROC)( HANDLE hProcess, HMODULE hModule, LPWSTR lpFileName, DWORD nSize );
|
||||
|
||||
static FN_PROC lpProc = NULL;
|
||||
static FN_PROC lpProc = nullptr;
|
||||
|
||||
if ( !lpProc )
|
||||
{
|
||||
@@ -128,7 +128,7 @@ std::wstring GetProcessImagePathW( DWORD dwProcessId )
|
||||
{
|
||||
WCHAR szPathBuffer[MAX_PATH] = L"";
|
||||
|
||||
if ( _GetModuleFileNameExW( hProcess, NULL, szPathBuffer, sizeof(szPathBuffer)/sizeof(szPathBuffer[0]) ) )
|
||||
if ( GetModuleFileNameExW_( hProcess, nullptr, szPathBuffer, sizeof(szPathBuffer)/sizeof(szPathBuffer[0]) ) )
|
||||
sImagePath = szPathBuffer;
|
||||
|
||||
CloseHandle( hProcess );
|
||||
|
@@ -32,7 +32,7 @@ extern "C" UINT __stdcall RemoveQuickstarterLink( MSIHANDLE hMSI )
|
||||
{
|
||||
WCHAR szStartupPath[MAX_PATH];
|
||||
|
||||
if ( SHGetSpecialFolderPathW( NULL, szStartupPath, CSIDL_STARTUP, FALSE ) )
|
||||
if ( SHGetSpecialFolderPathW( nullptr, szStartupPath, CSIDL_STARTUP, FALSE ) )
|
||||
{
|
||||
std::wstring sQuickstartLinkPath = szStartupPath;
|
||||
|
||||
|
@@ -64,7 +64,7 @@ static const CHAR* g_Extensions[] =
|
||||
".dpt", // Kingsoft Presentation Template
|
||||
".vsd", // Visio 2000/XP/2003 document
|
||||
".vst", // Visio 2000/XP/2003 template
|
||||
0
|
||||
nullptr
|
||||
};
|
||||
|
||||
static const int WORD_START = 0;
|
||||
@@ -97,7 +97,7 @@ static inline void OutputDebugStringFormatA( LPCSTR, ... )
|
||||
static BOOL CheckExtensionInRegistry( LPCSTR lpSubKey )
|
||||
{
|
||||
BOOL bRet = false;
|
||||
HKEY hKey = NULL;
|
||||
HKEY hKey = nullptr;
|
||||
LONG lResult = RegOpenKeyExA( HKEY_CLASSES_ROOT, lpSubKey, 0, KEY_QUERY_VALUE, &hKey );
|
||||
|
||||
if ( ERROR_SUCCESS == lResult )
|
||||
@@ -105,7 +105,7 @@ static BOOL CheckExtensionInRegistry( LPCSTR lpSubKey )
|
||||
CHAR szBuffer[1024];
|
||||
DWORD nSize = sizeof( szBuffer );
|
||||
|
||||
lResult = RegQueryValueExA( hKey, "", NULL, NULL, (LPBYTE)szBuffer, &nSize );
|
||||
lResult = RegQueryValueExA( hKey, "", nullptr, nullptr, reinterpret_cast<LPBYTE>(szBuffer), &nSize );
|
||||
if ( ERROR_SUCCESS == lResult && nSize > 0 )
|
||||
{
|
||||
szBuffer[nSize] = '\0';
|
||||
@@ -145,7 +145,7 @@ bool GetMsiPropA( MSIHANDLE handle, LPCSTR name, /*out*/std::string& value )
|
||||
{
|
||||
sz++;
|
||||
DWORD nbytes = sz * sizeof(CHAR);
|
||||
LPSTR buff = reinterpret_cast<LPSTR>(_alloca(nbytes));
|
||||
LPSTR buff = static_cast<LPSTR>(_alloca(nbytes));
|
||||
ZeroMemory(buff, nbytes);
|
||||
MsiGetPropertyA(handle, name, buff, &sz);
|
||||
value = buff;
|
||||
@@ -179,7 +179,7 @@ static void registerForExtension( MSIHANDLE handle, const int nIndex, bool bRegi
|
||||
|
||||
static void saveOldRegistration( LPCSTR lpSubKey )
|
||||
{
|
||||
HKEY hKey = NULL;
|
||||
HKEY hKey = nullptr;
|
||||
LONG lResult = RegOpenKeyExA( HKEY_CLASSES_ROOT, lpSubKey, 0,
|
||||
KEY_QUERY_VALUE|KEY_SET_VALUE, &hKey );
|
||||
|
||||
@@ -188,7 +188,7 @@ static void saveOldRegistration( LPCSTR lpSubKey )
|
||||
CHAR szBuffer[1024];
|
||||
DWORD nSize = sizeof( szBuffer );
|
||||
|
||||
lResult = RegQueryValueExA( hKey, "", NULL, NULL, (LPBYTE)szBuffer, &nSize );
|
||||
lResult = RegQueryValueExA( hKey, "", nullptr, nullptr, reinterpret_cast<LPBYTE>(szBuffer), &nSize );
|
||||
if ( ERROR_SUCCESS == lResult )
|
||||
{
|
||||
szBuffer[nSize] = '\0';
|
||||
@@ -198,20 +198,20 @@ static void saveOldRegistration( LPCSTR lpSubKey )
|
||||
{
|
||||
// Save the old association
|
||||
RegSetValueExA( hKey, "LOBackupAssociation", 0,
|
||||
REG_SZ, (LPBYTE)szBuffer, nSize );
|
||||
REG_SZ, reinterpret_cast<LPBYTE>(szBuffer), nSize );
|
||||
// Also save what the old association means, just so we can try to verify
|
||||
// if/when restoring it that the old application still exists
|
||||
HKEY hKey2 = NULL;
|
||||
HKEY hKey2 = nullptr;
|
||||
lResult = RegOpenKeyExA( HKEY_CLASSES_ROOT, szBuffer, 0,
|
||||
KEY_QUERY_VALUE, &hKey2 );
|
||||
if ( ERROR_SUCCESS == lResult )
|
||||
{
|
||||
nSize = sizeof( szBuffer );
|
||||
lResult = RegQueryValueExA( hKey2, "", NULL, NULL, (LPBYTE)szBuffer, &nSize );
|
||||
lResult = RegQueryValueExA( hKey2, "", nullptr, nullptr, reinterpret_cast<LPBYTE>(szBuffer), &nSize );
|
||||
if ( ERROR_SUCCESS == lResult )
|
||||
{
|
||||
RegSetValueExA( hKey, "LOBackupAssociationDeref", 0,
|
||||
REG_SZ, (LPBYTE)szBuffer, nSize );
|
||||
REG_SZ, reinterpret_cast<LPBYTE>(szBuffer), nSize );
|
||||
}
|
||||
RegCloseKey( hKey2 );
|
||||
}
|
||||
@@ -224,7 +224,7 @@ static void saveOldRegistration( LPCSTR lpSubKey )
|
||||
static void registerForExtensions( MSIHANDLE handle, BOOL bRegisterAll )
|
||||
{ // Check all file extensions
|
||||
int nIndex = 0;
|
||||
while ( g_Extensions[nIndex] != 0 )
|
||||
while ( g_Extensions[nIndex] != nullptr )
|
||||
{
|
||||
saveOldRegistration( g_Extensions[nIndex] );
|
||||
|
||||
@@ -240,7 +240,7 @@ static bool checkSomeExtensionInRegistry( const int nStart, const int nEnd )
|
||||
int nIndex = nStart;
|
||||
bool bFound = false;
|
||||
|
||||
while ( !bFound && (nIndex < nEnd) && (g_Extensions[nIndex] != 0) )
|
||||
while ( !bFound && (nIndex < nEnd) && (g_Extensions[nIndex] != nullptr) )
|
||||
{
|
||||
bFound = ! CheckExtensionInRegistry( g_Extensions[nIndex] );
|
||||
|
||||
@@ -256,7 +256,7 @@ static void registerSomeExtensions( MSIHANDLE handle, const int nStart, const in
|
||||
{ // Check all file extensions
|
||||
int nIndex = nStart;
|
||||
|
||||
while ( (nIndex < nEnd) && (g_Extensions[nIndex] != 0) )
|
||||
while ( (nIndex < nEnd) && (g_Extensions[nIndex] != nullptr) )
|
||||
{
|
||||
registerForExtension( handle, nIndex++, bRegister );
|
||||
}
|
||||
@@ -457,7 +457,7 @@ extern "C" UINT __stdcall FindRegisteredExtensions( MSIHANDLE handle )
|
||||
|
||||
static void restoreOldRegistration( LPCSTR lpSubKey )
|
||||
{
|
||||
HKEY hKey = NULL;
|
||||
HKEY hKey = nullptr;
|
||||
LONG lResult = RegOpenKeyExA( HKEY_CLASSES_ROOT, lpSubKey, 0,
|
||||
KEY_QUERY_VALUE|KEY_SET_VALUE, &hKey );
|
||||
|
||||
@@ -466,11 +466,11 @@ static void restoreOldRegistration( LPCSTR lpSubKey )
|
||||
CHAR szBuffer[1024];
|
||||
DWORD nSize = sizeof( szBuffer );
|
||||
|
||||
lResult = RegQueryValueExA( hKey, "LOBackupAssociation", NULL, NULL,
|
||||
(LPBYTE)szBuffer, &nSize );
|
||||
lResult = RegQueryValueExA( hKey, "LOBackupAssociation", nullptr, nullptr,
|
||||
reinterpret_cast<LPBYTE>(szBuffer), &nSize );
|
||||
if ( ERROR_SUCCESS == lResult )
|
||||
{
|
||||
HKEY hKey2 = NULL;
|
||||
HKEY hKey2 = nullptr;
|
||||
lResult = RegOpenKeyExA( HKEY_CLASSES_ROOT, szBuffer, 0,
|
||||
KEY_QUERY_VALUE, &hKey2 );
|
||||
if ( ERROR_SUCCESS == lResult )
|
||||
@@ -478,21 +478,21 @@ static void restoreOldRegistration( LPCSTR lpSubKey )
|
||||
CHAR szBuffer2[1024];
|
||||
DWORD nSize2 = sizeof( szBuffer2 );
|
||||
|
||||
lResult = RegQueryValueExA( hKey2, "", NULL, NULL, (LPBYTE)szBuffer2, &nSize2 );
|
||||
lResult = RegQueryValueExA( hKey2, "", nullptr, nullptr, reinterpret_cast<LPBYTE>(szBuffer2), &nSize2 );
|
||||
if ( ERROR_SUCCESS == lResult )
|
||||
{
|
||||
CHAR szBuffer3[1024];
|
||||
DWORD nSize3 = sizeof( szBuffer3 );
|
||||
|
||||
// Try to verify that the old association is OK to restore
|
||||
lResult = RegQueryValueExA( hKey, "LOBackupAssociationDeref", NULL, NULL,
|
||||
(LPBYTE)szBuffer3, &nSize3 );
|
||||
lResult = RegQueryValueExA( hKey, "LOBackupAssociationDeref", nullptr, nullptr,
|
||||
reinterpret_cast<LPBYTE>(szBuffer3), &nSize3 );
|
||||
if ( ERROR_SUCCESS == lResult )
|
||||
{
|
||||
if ( nSize2 == nSize3 && strcmp (szBuffer2, szBuffer3) == 0)
|
||||
{
|
||||
// Yep. So restore it
|
||||
RegSetValueExA( hKey, "", 0, REG_SZ, (LPBYTE)szBuffer, nSize );
|
||||
RegSetValueExA( hKey, "", 0, REG_SZ, reinterpret_cast<LPBYTE>(szBuffer), nSize );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -510,7 +510,7 @@ extern "C" UINT __stdcall RestoreRegAllMSDoc( MSIHANDLE /*handle*/ )
|
||||
OutputDebugStringFormatA( "RestoreRegAllMSDoc\n" );
|
||||
|
||||
int nIndex = 0;
|
||||
while ( g_Extensions[nIndex] != 0 )
|
||||
while ( g_Extensions[nIndex] != nullptr )
|
||||
{
|
||||
restoreOldRegistration( g_Extensions[nIndex] );
|
||||
++nIndex;
|
||||
|
@@ -43,13 +43,16 @@ typedef int ( __stdcall * DllNativeUnregProc ) ( int, BOOL, BOOL );
|
||||
|
||||
BOOL UnicodeEquals( wchar_t const * pStr1, wchar_t const * pStr2 )
|
||||
{
|
||||
if ( pStr1 == NULL && pStr2 == NULL )
|
||||
if ( pStr1 == nullptr && pStr2 == nullptr )
|
||||
return TRUE;
|
||||
else if ( pStr1 == NULL || pStr2 == NULL )
|
||||
else if ( pStr1 == nullptr || pStr2 == nullptr )
|
||||
return FALSE;
|
||||
|
||||
while( *pStr1 == *pStr2 && *pStr1 && *pStr2 )
|
||||
pStr1++, pStr2++;
|
||||
{
|
||||
pStr1++;
|
||||
pStr2++;
|
||||
}
|
||||
|
||||
return ( *pStr1 == 0 && *pStr2 == 0 );
|
||||
}
|
||||
@@ -58,12 +61,12 @@ BOOL UnicodeEquals( wchar_t const * pStr1, wchar_t const * pStr2 )
|
||||
char* UnicodeToAnsiString( wchar_t* pUniString )
|
||||
{
|
||||
int len = WideCharToMultiByte(
|
||||
CP_ACP, 0, pUniString, -1, 0, 0, 0, 0 );
|
||||
CP_ACP, 0, pUniString, -1, nullptr, 0, nullptr, nullptr );
|
||||
|
||||
char* buff = reinterpret_cast<char*>( malloc( len ) );
|
||||
char* buff = static_cast<char*>( malloc( len ) );
|
||||
|
||||
WideCharToMultiByte(
|
||||
CP_ACP, 0, pUniString, -1, buff, len, 0, 0 );
|
||||
CP_ACP, 0, pUniString, -1, buff, len, nullptr, nullptr );
|
||||
|
||||
return buff;
|
||||
}
|
||||
@@ -71,17 +74,17 @@ char* UnicodeToAnsiString( wchar_t* pUniString )
|
||||
|
||||
void RegisterActiveXNative( const char* pActiveXPath, int nMode, BOOL InstallForAllUser, BOOL InstallFor64Bit )
|
||||
{
|
||||
HINSTANCE hModule = LoadLibraryExA( pActiveXPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH );
|
||||
HINSTANCE hModule = LoadLibraryExA( pActiveXPath, nullptr, LOAD_WITH_ALTERED_SEARCH_PATH );
|
||||
if( hModule )
|
||||
{
|
||||
DllNativeRegProc pNativeProc = ( DllNativeRegProc )GetProcAddress( hModule, "DllRegisterServerNative" );
|
||||
if( pNativeProc!=NULL )
|
||||
DllNativeRegProc pNativeProc = reinterpret_cast<DllNativeRegProc>(GetProcAddress( hModule, "DllRegisterServerNative" ));
|
||||
if( pNativeProc!=nullptr )
|
||||
{
|
||||
int nLen = strlen( pActiveXPath );
|
||||
int nRemoveLen = strlen( "\\so_activex.dll" );
|
||||
if ( nLen > nRemoveLen )
|
||||
{
|
||||
char* pProgramPath = reinterpret_cast<char*>( malloc( nLen - nRemoveLen + 1 ) );
|
||||
char* pProgramPath = static_cast<char*>( malloc( nLen - nRemoveLen + 1 ) );
|
||||
strncpy( pProgramPath, pActiveXPath, nLen - nRemoveLen );
|
||||
pProgramPath[ nLen - nRemoveLen ] = 0;
|
||||
|
||||
@@ -98,11 +101,11 @@ void RegisterActiveXNative( const char* pActiveXPath, int nMode, BOOL InstallFor
|
||||
|
||||
void UnregisterActiveXNative( const char* pActiveXPath, int nMode, BOOL InstallForAllUser, BOOL InstallFor64Bit )
|
||||
{
|
||||
HINSTANCE hModule = LoadLibraryExA( pActiveXPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH );
|
||||
HINSTANCE hModule = LoadLibraryExA( pActiveXPath, nullptr, LOAD_WITH_ALTERED_SEARCH_PATH );
|
||||
if( hModule )
|
||||
{
|
||||
DllNativeUnregProc pNativeProc = ( DllNativeUnregProc )GetProcAddress( hModule, "DllUnregisterServerNative" );
|
||||
if( pNativeProc!=NULL )
|
||||
DllNativeUnregProc pNativeProc = reinterpret_cast<DllNativeUnregProc>(GetProcAddress( hModule, "DllUnregisterServerNative" ));
|
||||
if( pNativeProc!=nullptr )
|
||||
( *pNativeProc )( nMode, InstallForAllUser, InstallFor64Bit );
|
||||
|
||||
FreeLibrary( hModule );
|
||||
@@ -117,7 +120,7 @@ BOOL GetMsiPropW( MSIHANDLE hMSI, const wchar_t* pPropName, wchar_t** ppValue )
|
||||
{
|
||||
sz++;
|
||||
DWORD nbytes = sz * sizeof( wchar_t );
|
||||
wchar_t* buff = reinterpret_cast<wchar_t*>( malloc( nbytes ) );
|
||||
wchar_t* buff = static_cast<wchar_t*>( malloc( nbytes ) );
|
||||
ZeroMemory( buff, nbytes );
|
||||
MsiGetPropertyW( hMSI, pPropName, buff, &sz );
|
||||
*ppValue = buff;
|
||||
@@ -131,7 +134,7 @@ BOOL GetMsiPropW( MSIHANDLE hMSI, const wchar_t* pPropName, wchar_t** ppValue )
|
||||
|
||||
BOOL GetActiveXControlPath( MSIHANDLE hMSI, char** ppActiveXPath )
|
||||
{
|
||||
wchar_t* pProgPath = NULL;
|
||||
wchar_t* pProgPath = nullptr;
|
||||
if ( GetMsiPropW( hMSI, L"INSTALLLOCATION", &pProgPath ) && pProgPath )
|
||||
{
|
||||
char* pCharProgPath = UnicodeToAnsiString( pProgPath );
|
||||
@@ -139,7 +142,7 @@ BOOL GetActiveXControlPath( MSIHANDLE hMSI, char** ppActiveXPath )
|
||||
if ( pCharProgPath )
|
||||
{
|
||||
int nLen = strlen( pCharProgPath );
|
||||
*ppActiveXPath = reinterpret_cast<char*>( malloc( nLen + 23 ) );
|
||||
*ppActiveXPath = static_cast<char*>( malloc( nLen + 23 ) );
|
||||
strncpy( *ppActiveXPath, pCharProgPath, nLen );
|
||||
strncpy( (*ppActiveXPath) + nLen, "program\\so_activex.dll", 22 );
|
||||
(*ppActiveXPath)[nLen+22] = 0;
|
||||
@@ -258,7 +261,7 @@ BOOL GetDelta( MSIHANDLE hMSI, int& nOldInstallMode, int& nInstallMode, int& nDe
|
||||
BOOL MakeInstallForAllUsers( MSIHANDLE hMSI )
|
||||
{
|
||||
BOOL bResult = FALSE;
|
||||
wchar_t* pVal = NULL;
|
||||
wchar_t* pVal = nullptr;
|
||||
if ( GetMsiPropW( hMSI, L"ALLUSERS", &pVal ) && pVal )
|
||||
{
|
||||
bResult = UnicodeEquals( pVal , L"1" );
|
||||
@@ -272,7 +275,7 @@ BOOL MakeInstallForAllUsers( MSIHANDLE hMSI )
|
||||
BOOL MakeInstallFor64Bit( MSIHANDLE hMSI )
|
||||
{
|
||||
BOOL bResult = FALSE;
|
||||
wchar_t* pVal = NULL;
|
||||
wchar_t* pVal = nullptr;
|
||||
if ( GetMsiPropW( hMSI, L"VersionNT64", &pVal ) && pVal )
|
||||
{
|
||||
bResult = TRUE;
|
||||
@@ -295,7 +298,7 @@ extern "C" UINT __stdcall InstallActiveXControl( MSIHANDLE hMSI )
|
||||
BOOL bInstallForAllUser = MakeInstallForAllUsers( hMSI );
|
||||
BOOL bInstallFor64Bit = MakeInstallFor64Bit( hMSI );
|
||||
|
||||
char* pActiveXPath = NULL;
|
||||
char* pActiveXPath = nullptr;
|
||||
if ( GetActiveXControlPath( hMSI, &pActiveXPath ) && pActiveXPath
|
||||
&& GetDelta( hMSI, nOldInstallMode, nInstallMode, nDeinstallMode ) )
|
||||
{
|
||||
@@ -336,7 +339,7 @@ extern "C" UINT __stdcall DeinstallActiveXControl( MSIHANDLE hMSI )
|
||||
|
||||
if ( ERROR_SUCCESS == MsiGetFeatureState( hMSI, L"gm_o_Activexcontrol", ¤t_state, &future_state ) )
|
||||
{
|
||||
char* pActiveXPath = NULL;
|
||||
char* pActiveXPath = nullptr;
|
||||
if ( current_state == INSTALLSTATE_LOCAL && GetActiveXControlPath( hMSI, &pActiveXPath ) && pActiveXPath )
|
||||
{
|
||||
BOOL bInstallForAllUser = MakeInstallForAllUsers( hMSI );
|
||||
|
@@ -43,7 +43,7 @@ BOOL GetMsiPropA( MSIHANDLE hMSI, const char* pPropName, char** ppValue )
|
||||
if ( MsiGetPropertyA( hMSI, pPropName, const_cast<char *>(""), &sz ) == ERROR_MORE_DATA ) {
|
||||
sz++;
|
||||
DWORD nbytes = sz * sizeof( char );
|
||||
char* buff = reinterpret_cast<char*>( malloc( nbytes ) );
|
||||
char* buff = static_cast<char*>( malloc( nbytes ) );
|
||||
ZeroMemory( buff, nbytes );
|
||||
MsiGetPropertyA( hMSI, pPropName, buff, &sz );
|
||||
*ppValue = buff;
|
||||
@@ -151,7 +151,7 @@ langid_to_string( LANGID langid )
|
||||
case MAKELANGID(LANG_NORWEGIAN, SUBLANG_NORWEGIAN_NYNORSK): return "nn";
|
||||
case MAKELANGID(LANG_SERBIAN, SUBLANG_SERBIAN_LATIN): return "sh";
|
||||
case MAKELANGID(LANG_SERBIAN, SUBLANG_SERBIAN_CYRILLIC): return "sr";
|
||||
default: return 0;
|
||||
default: return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -164,7 +164,7 @@ static int num_ui_langs = 0;
|
||||
|
||||
void add_ui_lang(char const * lang)
|
||||
{
|
||||
if (lang != 0 && num_ui_langs != SAL_N_ELEMENTS(ui_langs)) {
|
||||
if (lang != nullptr && num_ui_langs != SAL_N_ELEMENTS(ui_langs)) {
|
||||
ui_langs[num_ui_langs++] = lang;
|
||||
}
|
||||
}
|
||||
@@ -172,7 +172,7 @@ void add_ui_lang(char const * lang)
|
||||
BOOL CALLBACK
|
||||
enum_ui_lang_proc (LPTSTR language, LONG_PTR /* unused_lParam */)
|
||||
{
|
||||
long langid = strtol(language, NULL, 16);
|
||||
long langid = strtol(language, nullptr, 16);
|
||||
if (langid > 0xFFFF)
|
||||
return TRUE;
|
||||
add_ui_lang(langid_to_string((LANGID) langid));
|
||||
@@ -186,7 +186,7 @@ present_in_ui_langs(const char *lang)
|
||||
{
|
||||
for (int i = 0; i < num_ui_langs; i++)
|
||||
{
|
||||
if (strchr (lang, '_') != NULL)
|
||||
if (strchr (lang, '_') != nullptr)
|
||||
if (memcmp (ui_langs[i], lang, std::min(strlen(ui_langs[i]), strlen(lang))) == 0)
|
||||
return TRUE;
|
||||
if (strcmp (ui_langs[i], lang) == 0)
|
||||
@@ -215,7 +215,7 @@ void addMatchingDictionaries(
|
||||
if (strcmp(lang, setup_native::languageDictionaries[i].language) == 0) {
|
||||
for (char const * const * p = setup_native::languageDictionaries[i].
|
||||
dictionaries;
|
||||
*p != NULL; ++p)
|
||||
*p != nullptr; ++p)
|
||||
{
|
||||
for (int j = 0; j != ndicts; ++j) {
|
||||
if (_stricmp(*p, dicts[j].lang) == 0) {
|
||||
@@ -313,13 +313,13 @@ extern "C" UINT __stdcall SelectLanguage( MSIHANDLE handle )
|
||||
/* Keep track of what UI languages are relevant, either the ones explicitly
|
||||
* requested with the UI_LANGS property, or all available on the system:
|
||||
*/
|
||||
char* pVal = NULL;
|
||||
char* pVal = nullptr;
|
||||
if ( (GetMsiPropA( handle, "UI_LANGS", &pVal )) && pVal ) {
|
||||
char *str_ptr;
|
||||
str_ptr = strtok(pVal, ",");
|
||||
for(; str_ptr != NULL ;) {
|
||||
for(; str_ptr != nullptr ;) {
|
||||
add_ui_lang(str_ptr);
|
||||
str_ptr = strtok(NULL, ",");
|
||||
str_ptr = strtok(nullptr, ",");
|
||||
}
|
||||
} else {
|
||||
add_ui_lang(langid_to_string(GetSystemDefaultUILanguage()));
|
||||
|
@@ -22,33 +22,33 @@ extern "C" UINT __stdcall SortTree(MSIHANDLE)
|
||||
{
|
||||
// Sort items (languages) in SelectionTree control, fdo#46355
|
||||
|
||||
HWND hwndMSI = FindWindowW(L"MsiDialogCloseClass", NULL);
|
||||
if (hwndMSI == NULL)
|
||||
HWND hwndMSI = FindWindowW(L"MsiDialogCloseClass", nullptr);
|
||||
if (hwndMSI == nullptr)
|
||||
{
|
||||
OutputDebugStringA("SortTree: MsiDialogCloseClass not found\n");
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
HWND hwndTV = FindWindowExW(hwndMSI, NULL, L"SysTreeView32", NULL);
|
||||
if (hwndTV == NULL)
|
||||
HWND hwndTV = FindWindowExW(hwndMSI, nullptr, L"SysTreeView32", nullptr);
|
||||
if (hwndTV == nullptr)
|
||||
{
|
||||
OutputDebugStringA("SortTree: SysTreeView32 not found\n");
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
HTREEITEM optional = TreeView_GetRoot(hwndTV);
|
||||
if (optional == NULL)
|
||||
if (optional == nullptr)
|
||||
{
|
||||
OutputDebugStringA("SortTree: Optional Components branch not found\n");
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
HTREEITEM dicts = TreeView_GetChild(hwndTV, optional);
|
||||
if (dicts == NULL)
|
||||
if (dicts == nullptr)
|
||||
{
|
||||
OutputDebugStringA("SortTree: Dictionaries branch not found\n");
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
TreeView_SortChildren(hwndTV, dicts, TRUE);
|
||||
HTREEITEM langs = TreeView_GetNextSibling(hwndTV, optional);
|
||||
if (langs == NULL)
|
||||
if (langs == nullptr)
|
||||
{
|
||||
OutputDebugStringA("SortTree: Additional UI Languages branch not found\n");
|
||||
return ERROR_SUCCESS;
|
||||
|
@@ -38,7 +38,7 @@ extern "C" UINT __stdcall MigrateInstallPath( MSIHANDLE handle )
|
||||
|
||||
if ( ERROR_SUCCESS == RegOpenKeyW( HKEY_CURRENT_USER, sProductKey.c_str(), &hKey ) )
|
||||
{
|
||||
if ( ERROR_SUCCESS == RegQueryValueExW( hKey, L"INSTALLLOCATION", NULL, NULL, (LPBYTE)szValue, &nValueSize ) )
|
||||
if ( ERROR_SUCCESS == RegQueryValueExW( hKey, L"INSTALLLOCATION", nullptr, nullptr, reinterpret_cast<LPBYTE>(szValue), &nValueSize ) )
|
||||
{
|
||||
sInstDir = szValue;
|
||||
MsiSetPropertyW(handle, L"INSTALLLOCATION", sInstDir.c_str());
|
||||
@@ -49,7 +49,7 @@ extern "C" UINT __stdcall MigrateInstallPath( MSIHANDLE handle )
|
||||
}
|
||||
else if ( ERROR_SUCCESS == RegOpenKeyW( HKEY_LOCAL_MACHINE, sProductKey.c_str(), &hKey ) )
|
||||
{
|
||||
if ( ERROR_SUCCESS == RegQueryValueExW( hKey, L"INSTALLLOCATION", NULL, NULL, (LPBYTE)szValue, &nValueSize ) )
|
||||
if ( ERROR_SUCCESS == RegQueryValueExW( hKey, L"INSTALLLOCATION", nullptr, nullptr, reinterpret_cast<LPBYTE>(szValue), &nValueSize ) )
|
||||
{
|
||||
sInstDir = szValue;
|
||||
MsiSetPropertyW(handle, L"INSTALLLOCATION", sInstDir.c_str());
|
||||
|
@@ -44,7 +44,7 @@ static inline std::wstring GetMsiPropertyW( MSIHANDLE handle, const std::wstring
|
||||
if ( MsiGetPropertyW( handle, sProperty.c_str(), szDummy, &nChars ) == ERROR_MORE_DATA )
|
||||
{
|
||||
DWORD nBytes = ++nChars * sizeof(WCHAR);
|
||||
PWSTR buffer = reinterpret_cast<PWSTR>(_alloca(nBytes));
|
||||
PWSTR buffer = static_cast<PWSTR>(_alloca(nBytes));
|
||||
ZeroMemory( buffer, nBytes );
|
||||
MsiGetPropertyW( handle, sProperty.c_str(), buffer, &nChars );
|
||||
result = buffer;
|
||||
@@ -60,7 +60,7 @@ static inline void SetMsiPropertyW( MSIHANDLE handle, const std::wstring& sPrope
|
||||
|
||||
static inline void UnsetMsiPropertyW( MSIHANDLE handle, const std::wstring& sProperty )
|
||||
{
|
||||
MsiSetPropertyW( handle, sProperty.c_str(), NULL );
|
||||
MsiSetPropertyW( handle, sProperty.c_str(), nullptr );
|
||||
}
|
||||
|
||||
#endif // INCLUDED_SETUP_NATIVE_SOURCE_WIN32_CUSTOMACTIONS_SHELLEXTENSIONS_SHLXTMSI_HXX
|
||||
|
@@ -33,7 +33,7 @@ extern "C" UINT __stdcall InstallStartmenuFolderIcon( MSIHANDLE handle )
|
||||
|
||||
// the Win32 SDK 8.1 deprecates GetVersionEx()
|
||||
#ifdef _WIN32_WINNT_WINBLUE
|
||||
bool const bIsVistaOrLater = IsWindowsVistaOrGreater() ? true : false;
|
||||
bool const bIsVistaOrLater = IsWindowsVistaOrGreater();
|
||||
#else
|
||||
OSVERSIONINFO osverinfo;
|
||||
osverinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||
|
@@ -54,7 +54,7 @@ namespace
|
||||
|
||||
string Invert(const string& str)
|
||||
{
|
||||
char* buff = reinterpret_cast<char*>(_alloca(str.length()));
|
||||
char* buff = static_cast<char*>(_alloca(str.length()));
|
||||
strncpy(buff, str.c_str(), str.length());
|
||||
|
||||
char* front = buff;
|
||||
@@ -108,7 +108,7 @@ namespace
|
||||
if (MsiGetPropertyA(handle, sProperty.c_str(), szDummy, &nChars) == ERROR_MORE_DATA)
|
||||
{
|
||||
DWORD nBytes = ++nChars * sizeof(CHAR);
|
||||
LPSTR buffer = reinterpret_cast<LPSTR>(_alloca(nBytes));
|
||||
LPSTR buffer = static_cast<LPSTR>(_alloca(nBytes));
|
||||
ZeroMemory( buffer, nBytes );
|
||||
MsiGetPropertyA( handle, sProperty.c_str(), buffer, &nChars );
|
||||
result = buffer;
|
||||
@@ -123,7 +123,7 @@ namespace
|
||||
|
||||
inline void UnsetMsiPropertyA(MSIHANDLE handle, const string& sProperty)
|
||||
{
|
||||
MsiSetPropertyA(handle, sProperty.c_str(), NULL);
|
||||
MsiSetPropertyA(handle, sProperty.c_str(), nullptr);
|
||||
}
|
||||
|
||||
inline void SetMsiPropertyA(MSIHANDLE handle, const string& sProperty)
|
||||
@@ -141,9 +141,9 @@ namespace
|
||||
DWORD lLongestSubKey;
|
||||
|
||||
if (RegQueryInfoKeyA(
|
||||
hKey, NULL, NULL, NULL, &nSubKeys, &lLongestSubKey, NULL, NULL, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
|
||||
hKey, nullptr, nullptr, nullptr, &nSubKeys, &lLongestSubKey, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr) == ERROR_SUCCESS)
|
||||
{
|
||||
LPSTR buffer = reinterpret_cast<LPSTR>(_alloca(lLongestSubKey + 1));
|
||||
LPSTR buffer = static_cast<LPSTR>(_alloca(lLongestSubKey + 1));
|
||||
|
||||
for (DWORD i = 0; i < nSubKeys; i++)
|
||||
{
|
||||
|
@@ -43,7 +43,7 @@ BOOL GetMsiPropW( MSIHANDLE hMSI, const wchar_t* pPropName, wchar_t** ppValue )
|
||||
{
|
||||
sz++;
|
||||
DWORD nbytes = sz * sizeof( wchar_t );
|
||||
wchar_t* buff = reinterpret_cast<wchar_t*>( malloc( nbytes ) );
|
||||
wchar_t* buff = static_cast<wchar_t*>( malloc( nbytes ) );
|
||||
ZeroMemory( buff, nbytes );
|
||||
MsiGetPropertyW( hMSI, pPropName, buff, &sz );
|
||||
*ppValue = buff;
|
||||
@@ -77,7 +77,7 @@ extern "C" UINT __stdcall CheckVersions( MSIHANDLE hMSI )
|
||||
{
|
||||
// MessageBoxW(NULL, L"CheckVersions", L"Information", MB_OK | MB_ICONINFORMATION);
|
||||
|
||||
wchar_t* pVal = NULL;
|
||||
wchar_t* pVal = nullptr;
|
||||
|
||||
if ( GetMsiPropW( hMSI, L"NEWPRODUCTS", &pVal ) && pVal )
|
||||
{
|
||||
@@ -86,7 +86,7 @@ extern "C" UINT __stdcall CheckVersions( MSIHANDLE hMSI )
|
||||
SetMsiErrorCode( MSI_ERROR_NEW_VERSION_FOUND );
|
||||
free( pVal );
|
||||
}
|
||||
pVal = NULL;
|
||||
pVal = nullptr;
|
||||
if ( GetMsiPropW( hMSI, L"OLDPRODUCTS", &pVal ) && pVal )
|
||||
{
|
||||
OutputDebugStringFormatW( L"DEBUG: OLDPRODUCTS found [%s]", pVal );
|
||||
@@ -94,7 +94,7 @@ extern "C" UINT __stdcall CheckVersions( MSIHANDLE hMSI )
|
||||
SetMsiErrorCode( MSI_ERROR_OLD_VERSION_FOUND );
|
||||
free( pVal );
|
||||
}
|
||||
pVal = NULL;
|
||||
pVal = nullptr;
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
@@ -65,17 +65,17 @@ void SetMsiErrorCode( int nErrorCode )
|
||||
FALSE, // do not inherit the name
|
||||
sMemMapName ); // name of mapping object
|
||||
|
||||
if ( hMapFile == NULL ) // can not set error code
|
||||
if ( hMapFile == nullptr ) // can not set error code
|
||||
{
|
||||
OutputDebugStringFormatW( L"Could not open map file (%d).\n", GetLastError() );
|
||||
return;
|
||||
}
|
||||
|
||||
pBuf = (int*) MapViewOfFile( hMapFile, // handle to map object
|
||||
pBuf = static_cast<int*>(MapViewOfFile( hMapFile, // handle to map object
|
||||
FILE_MAP_ALL_ACCESS, // read/write permission
|
||||
0,
|
||||
0,
|
||||
sizeof( int ) );
|
||||
sizeof( int ) ));
|
||||
if ( pBuf )
|
||||
{
|
||||
*pBuf = nErrorCode;
|
||||
|
Reference in New Issue
Block a user