diff options
Diffstat (limited to 'desktop/win32/source/rebase')
-rw-r--r-- | desktop/win32/source/rebase/Resource.h | 10 | ||||
-rw-r--r-- | desktop/win32/source/rebase/rebase.cxx | 34 | ||||
-rw-r--r-- | desktop/win32/source/rebase/rebasegui.cxx | 54 |
3 files changed, 49 insertions, 49 deletions
diff --git a/desktop/win32/source/rebase/Resource.h b/desktop/win32/source/rebase/Resource.h index a8e23f2eba1d..8c892111c995 100644 --- a/desktop/win32/source/rebase/Resource.h +++ b/desktop/win32/source/rebase/Resource.h @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -29,10 +29,10 @@ #ifndef _RESOURCE_H #define _RESOURCE_H -#define IDS_APP_TITLE 10 -#define IDS_MSG_OPTIMIZED_FOR_CLIENT 11 -#define IDS_MSG_OPTIMIZED_FOR_SERVER 12 -#define IDS_MSG_NO_INSTALLATION_FOUND 13 +#define IDS_APP_TITLE 10 +#define IDS_MSG_OPTIMIZED_FOR_CLIENT 11 +#define IDS_MSG_OPTIMIZED_FOR_SERVER 12 +#define IDS_MSG_NO_INSTALLATION_FOUND 13 #define IDI_REBASEGUI 99 diff --git a/desktop/win32/source/rebase/rebase.cxx b/desktop/win32/source/rebase/rebase.cxx index ba6c3937227a..e712c8d548e5 100644 --- a/desktop/win32/source/rebase/rebase.cxx +++ b/desktop/win32/source/rebase/rebase.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -52,7 +52,7 @@ const int FORMAT_MESSAGE_SIZE = 4096; const DWORD PE_Signature = 0x00004550; -const DWORD BASEVIRTUALADDRESS = 0x10000000; +const DWORD BASEVIRTUALADDRESS = 0x10000000; namespace { @@ -62,7 +62,7 @@ bool IsValidHandle( HANDLE handle ) return ((NULL != handle) && (INVALID_HANDLE_VALUE != handle)); } -void fail() +void fail() { LPWSTR buf = NULL; FormatMessageW( @@ -79,12 +79,12 @@ bool rebaseImage( wchar_t* pszFilePath, ULONG nNewImageBase) ULONG_PTR lpOldImageBase; ULONG ulNewImageSize; ULONG_PTR lpNewImageBase = nNewImageBase; - ULONG ulDateTimeStamp = 0; + ULONG ulDateTimeStamp = 0; bool bResult(false); - + char cszFilePath[_MAX_PATH+1] = {0}; int nResult = WideCharToMultiByte(CP_ACP, 0, pszFilePath, -1, cszFilePath, _MAX_PATH, NULL, NULL); - + if (nResult != 0) { BOOL bResult = ReBaseImage( @@ -116,7 +116,7 @@ wchar_t* getBrandPath(wchar_t * path) void rebaseImagesInFolder( wchar_t* pszFolder, DWORD nNewImageBase ) { wchar_t szPattern[MAX_PATH]; - wchar_t *lpLastSlash = wcsrchr( pszFolder, '\\' ); + wchar_t *lpLastSlash = wcsrchr( pszFolder, '\\' ); if ( lpLastSlash ) { size_t len = lpLastSlash - pszFolder + 1; @@ -124,8 +124,8 @@ void rebaseImagesInFolder( wchar_t* pszFolder, DWORD nNewImageBase ) wcsncpy( szPattern + len, TEXT("*.dll"), SAL_N_ELEMENTS(szPattern) - len ); } - WIN32_FIND_DATA aFindFileData; - HANDLE hFind = FindFirstFile( szPattern, &aFindFileData ); + WIN32_FIND_DATA aFindFileData; + HANDLE hFind = FindFirstFile( szPattern, &aFindFileData ); if ( IsValidHandle(hFind) ) { @@ -134,7 +134,7 @@ void rebaseImagesInFolder( wchar_t* pszFolder, DWORD nNewImageBase ) do { wchar_t szLibFilePath[MAX_PATH]; - wchar_t *lpLastSlash = wcsrchr( pszFolder, '\\' ); + wchar_t *lpLastSlash = wcsrchr( pszFolder, '\\' ); if ( lpLastSlash ) { size_t len = lpLastSlash - pszFolder + 1; @@ -156,31 +156,31 @@ void rebaseImagesInFolder( wchar_t* pszFolder, DWORD nNewImageBase ) extern "C" int APIENTRY WinMain( HINSTANCE, HINSTANCE, LPSTR, int ) { wchar_t path[MAX_PATH]; - + wchar_t * pathEnd = getBrandPath(path); - + if (tools::buildPath(path, path, pathEnd, MY_STRING(L"")) == NULL) fail(); rebaseImagesInFolder(path, BASEVIRTUALADDRESS); - + if (tools::buildPath(path, path, pathEnd, MY_STRING(L"..\\basis-link")) == NULL) fail(); pathEnd = tools::resolveLink(path); - + if ( pathEnd == NULL ) return 0; if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\program\\")) == NULL) fail(); rebaseImagesInFolder(path, BASEVIRTUALADDRESS); - + if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\ure-link")) == NULL) fail(); pathEnd = tools::resolveLink(path); - + if ( pathEnd == NULL ) return 0; - + if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\bin\\")) == NULL) fail(); rebaseImagesInFolder(path, BASEVIRTUALADDRESS); diff --git a/desktop/win32/source/rebase/rebasegui.cxx b/desktop/win32/source/rebase/rebasegui.cxx index 71b4f1246447..e1bb148c2b56 100644 --- a/desktop/win32/source/rebase/rebasegui.cxx +++ b/desktop/win32/source/rebase/rebasegui.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -32,13 +32,13 @@ #define _UNICODE 1 #ifndef _WINDOWS_ -# define WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN #if defined _MSC_VER #pragma warning(push, 1) #endif -# include <windows.h> -# include <shellapi.h> -# include <wchar.h> +# include <windows.h> +# include <shellapi.h> +# include <wchar.h> #if defined _MSC_VER #pragma warning(pop) #endif @@ -51,9 +51,9 @@ const DWORD PE_Signature = 0x00004550; -#define MY_LENGTH(s) (sizeof (s) / sizeof *(s) - 1) -#define MY_STRING(s) (s), MY_LENGTH(s) -#define MAX_STR_CAPTION 256 +#define MY_LENGTH(s) (sizeof (s) / sizeof *(s) - 1) +#define MY_STRING(s) (s), MY_LENGTH(s) +#define MAX_STR_CAPTION 256 #define MAX_TEXT_LENGTH 1024 static void failPath(wchar_t* pszAppTitle, wchar_t* pszMsg) @@ -62,7 +62,7 @@ static void failPath(wchar_t* pszAppTitle, wchar_t* pszMsg) TerminateProcess(GetCurrentProcess(), 255); } -static void fail() +static void fail() { LPWSTR buf = NULL; FormatMessageW( @@ -77,27 +77,27 @@ static LPVOID getVirtualBaseAddress( wchar_t* pszFilePath ) { HANDLE hFile; HANDLE hFileMapping; - LPVOID lpFileBase = 0; + LPVOID lpFileBase = 0; PIMAGE_DOS_HEADER lpDosHeader; PIMAGE_NT_HEADERS lpNTHeader; - hFile = CreateFile(pszFilePath, + hFile = CreateFile(pszFilePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); - + if ( hFile == INVALID_HANDLE_VALUE ) - { + { return NULL; } - + hFileMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL); if ( hFileMapping == 0 ) - { + { CloseHandle(hFile); return NULL; } - + lpFileBase = MapViewOfFile(hFileMapping, FILE_MAP_READ, 0, 0, 0); if ( lpFileBase == 0 ) { @@ -108,16 +108,16 @@ static LPVOID getVirtualBaseAddress( wchar_t* pszFilePath ) lpDosHeader = (PIMAGE_DOS_HEADER)lpFileBase; if ( lpDosHeader->e_magic == IMAGE_DOS_SIGNATURE ) - { + { lpNTHeader = (PIMAGE_NT_HEADERS)((char*)lpDosHeader + lpDosHeader->e_lfanew); if (lpNTHeader->Signature == PE_Signature ) lpFileBase = reinterpret_cast<LPVOID>( lpNTHeader->OptionalHeader.ImageBase ); } - + UnmapViewOfFile(lpFileBase); CloseHandle(hFileMapping); CloseHandle(hFile); - + return lpFileBase; } @@ -156,16 +156,16 @@ extern "C" int APIENTRY WinMain( HINSTANCE hInst, HINSTANCE, LPSTR, int ) wchar_t* pTextNoInstallation = new wchar_t[ MAX_TEXT_LENGTH ]; pTextNoInstallation[0] = '\0'; LoadString( hInst, IDS_MSG_NO_INSTALLATION_FOUND, pTextNoInstallation, MAX_TEXT_LENGTH ); - + LPVOID VBA = (void*)0x10000000; wchar_t path[MAX_PATH]; - + wchar_t * pathEnd = getBrandPath(path); - + if (tools::buildPath(path, path, pathEnd, MY_STRING(L"libxml2.dll")) == NULL) fail(); bool bFast = checkImageVirtualBaseAddress(path, VBA); - + if (tools::buildPath(path, path, pathEnd, MY_STRING(L"..\\basis-link")) == NULL) fail(); pathEnd = tools::resolveLink(path); @@ -180,10 +180,10 @@ extern "C" int APIENTRY WinMain( HINSTANCE hInst, HINSTANCE, LPSTR, int ) if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\ure-link")) == NULL) fail(); pathEnd = tools::resolveLink(path); - + if (pathEnd == NULL) failPath(pAppTitle, pTextNoInstallation); - + if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\bin\\sal3.dll")) == NULL) fail(); bFast &= checkImageVirtualBaseAddress(path, VBA); @@ -191,9 +191,9 @@ extern "C" int APIENTRY WinMain( HINSTANCE hInst, HINSTANCE, LPSTR, int ) const wchar_t* pOutput = pTextClient; if (!bFast) pOutput = pTextServer; - + MessageBoxW( NULL, pOutput, pAppTitle, MB_OK ); - + return 0; } |