diff options
author | Tor Lillqvist <tlillqvist@suse.com> | 2011-09-12 15:07:59 +0300 |
---|---|---|
committer | Tor Lillqvist <tlillqvist@suse.com> | 2011-09-12 15:30:40 +0300 |
commit | 42c6acee93439e144f820a3ad7a1e68587d47b60 (patch) | |
tree | faa8cce506cadbac5762c9672e75895fe0ba4404 /setup_native | |
parent | Drop Win9x code (diff) | |
download | core-42c6acee93439e144f820a3ad7a1e68587d47b60.tar.gz core-42c6acee93439e144f820a3ad7a1e68587d47b60.zip |
Drop Win9x code
Diffstat (limited to 'setup_native')
-rw-r--r-- | setup_native/source/win32/customactions/quickstarter/quickstarter.cxx | 105 |
1 files changed, 1 insertions, 104 deletions
diff --git a/setup_native/source/win32/customactions/quickstarter/quickstarter.cxx b/setup_native/source/win32/customactions/quickstarter/quickstarter.cxx index fbb4982a96f4..f09ecb2a3abb 100644 --- a/setup_native/source/win32/customactions/quickstarter/quickstarter.cxx +++ b/setup_native/source/win32/customactions/quickstarter/quickstarter.cxx @@ -7,7 +7,6 @@ #ifdef _MSC_VER #pragma warning(pop) #endif -#include <tlhelp32.h> #include <malloc.h> std::string GetOfficeInstallationPath(MSIHANDLE handle) @@ -78,103 +77,6 @@ inline bool IsValidHandle( HANDLE handle ) return NULL != handle && INVALID_HANDLE_VALUE != handle; } - -static HANDLE WINAPI _CreateToolhelp32Snapshot( DWORD dwFlags, DWORD th32ProcessID ) -{ - typedef HANDLE (WINAPI *FN_PROC)( DWORD dwFlags, DWORD th32ProcessID ); - static FN_PROC lpProc = NULL; - - HANDLE hSnapshot = NULL; - - if ( !lpProc ) - { - HMODULE hLibrary = GetModuleHandle("KERNEL32.DLL"); - - if ( hLibrary ) - lpProc = reinterpret_cast< FN_PROC >(GetProcAddress( hLibrary, "CreateToolhelp32Snapshot" )); - } - - if ( lpProc ) - hSnapshot = lpProc( dwFlags, th32ProcessID ); - - return hSnapshot; -} - -static BOOL WINAPI _Process32First( HANDLE hSnapshot, PROCESSENTRY32 *lppe32 ) -{ - typedef BOOL (WINAPI *FN_PROC)( HANDLE hSnapshot, PROCESSENTRY32 *lppe32 ); - static FN_PROC lpProc = NULL; - - BOOL fSuccess = FALSE; - - if ( !lpProc ) - { - HMODULE hLibrary = GetModuleHandle("KERNEL32.DLL"); - - if ( hLibrary ) - lpProc = reinterpret_cast< FN_PROC >(GetProcAddress( hLibrary, "Process32First" )); - } - - if ( lpProc ) - fSuccess = lpProc( hSnapshot, lppe32 ); - - return fSuccess; -} - -static BOOL WINAPI _Process32Next( HANDLE hSnapshot, PROCESSENTRY32 *lppe32 ) -{ - typedef BOOL (WINAPI *FN_PROC)( HANDLE hSnapshot, PROCESSENTRY32 *lppe32 ); - static FN_PROC lpProc = NULL; - - BOOL fSuccess = FALSE; - - if ( !lpProc ) - { - HMODULE hLibrary = GetModuleHandle("KERNEL32.DLL"); - - if ( hLibrary ) - lpProc = reinterpret_cast< FN_PROC >(GetProcAddress( hLibrary, "Process32Next" )); - } - - if ( lpProc ) - fSuccess = lpProc( hSnapshot, lppe32 ); - - return fSuccess; -} - -static std::string GetProcessImagePath_9x( DWORD dwProcessId ) -{ - std::string sImagePath; - - HANDLE hSnapshot = _CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 ); - - if ( IsValidHandle( hSnapshot ) ) - { - PROCESSENTRY32 pe32 = { 0 }; - - pe32.dwSize = sizeof(PROCESSENTRY32); - - BOOL fSuccess = _Process32First( hSnapshot, &pe32 ); - bool found = false; - - while ( !found && fSuccess ) - { - if ( pe32.th32ProcessID == dwProcessId ) - { - found = true; - sImagePath = pe32.szExeFile; - } - - if ( !found ) - fSuccess = _Process32Next( hSnapshot, &pe32 ); - } - - CloseHandle( hSnapshot ); - } - - return sImagePath; -} - static DWORD WINAPI _GetModuleFileNameExA( HANDLE hProcess, HMODULE hModule, LPSTR lpFileName, DWORD nSize ) { typedef DWORD (WINAPI *FN_PROC)( HANDLE hProcess, HMODULE hModule, LPSTR lpFileName, DWORD nSize ); @@ -196,7 +98,7 @@ static DWORD WINAPI _GetModuleFileNameExA( HANDLE hProcess, HMODULE hModule, LPS } -static std::string GetProcessImagePath_NT( DWORD dwProcessId ) +std::string GetProcessImagePath( DWORD dwProcessId ) { std::string sImagePath; @@ -215,9 +117,4 @@ static std::string GetProcessImagePath_NT( DWORD dwProcessId ) return sImagePath; } -std::string GetProcessImagePath( DWORD dwProcessId ) -{ - return (LONG)GetVersion() < 0 ? GetProcessImagePath_9x( dwProcessId ) : GetProcessImagePath_NT( dwProcessId ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |