Changeset 39080
- Timestamp:
- 12/11/11 02:03:52 (18 months ago)
- Location:
- lang/objective-cplusplus/i3/trunk
- Files:
-
- 2 added
- 1 removed
- 6 modified
-
configure.ac (modified) (4 diffs)
-
tmp/dwmedit/ApiHook.cc (modified) (2 diffs)
-
tmp/dwmedit/BlurEditController.cc (modified) (2 diffs)
-
tmp/dwmedit/DWMEdit.cc (modified) (2 diffs)
-
tmp/dwmedit/DWMEdit.vcxproj (modified) (2 diffs)
-
tmp/dwmedit/configure.ac (modified) (1 diff)
-
unix/m4-local/i3.m4 (added)
-
unix/scripts/ac_init_version.sh (deleted)
-
unix/scripts/get_version_for_ac_init.sh (added)
Legend:
- Unmodified
- Added
- Removed
-
lang/objective-cplusplus/i3/trunk/configure.ac
r39049 r39080 2 2 3 3 m4_define( 4 [I3_VERSION_ M4_MACRO],5 [m4_esyscmd([. ./unix/scripts/ ac_init_version.sh | tr -d '\r\n'])])4 [I3_VERSION_FOR_AC_INIT], 5 [m4_esyscmd([. ./unix/scripts/get_version_for_ac_init.sh | tr -d '\r\n'])]) 6 6 7 7 AC_PREREQ([2.61]) 8 AC_INIT([windcrest],[I3_VERSION_M4_MACRO],[dyob@lunaport.net]) 9 10 # 11 # macros 12 # 13 14 AC_DEFUN([I3_HIGHLIGHTED_ECHO],[ 15 echo $1 | GREP_COLOR='01' grep --color=auto '.' 2> /dev/null 16 if test $? -ne 0; then 17 echo $1 18 fi 19 ]) 20 21 AC_DEFUN([I3_ADD_OPTION],[ 22 if test "$2" != ""; then 23 AC_MSG_CHECKING([for $2 ]) 24 orig="$$1" 25 $1="$2 $$1" 26 27 check_result=no 28 29 case $1 in 30 CPPFLAGS) 31 AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[$3]],[[$4]])],[check_result=yes]) 32 ;; 33 CFLAGS) 34 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$3]],[[$4]])],[check_result=yes]) 35 ;; 36 CXXFLAGS) 37 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$3]],[[$4]])],[check_result=yes]) 38 ;; 39 LDFLAGS) 40 AC_LINK_IFELSE([AC_LANG_PROGRAM([[$3]],[[$4]])],[check_result=yes]) 41 ;; 42 LIBS) 43 AC_LINK_IFELSE([AC_LANG_PROGRAM([[$3]],[[$4]])],[check_result=yes]) 44 ;; 45 *) 46 AC_MSG_FAILURE([unknown variable name]) 47 ;; 48 esac 49 50 AC_MSG_RESULT([$check_result]) 51 if test "$check_result" = "yes"; then 52 true 53 $5 54 else 55 $1="$orig" 56 $6 57 fi 58 fi 59 ]) 60 61 AC_DEFUN([I3_ADD_CPPFLAGS],[I3_ADD_OPTION([CPPFLAGS],[$1],[$2],[$3],[$4],[$5])]) 62 AC_DEFUN([I3_ADD_CFLAGS], [I3_ADD_OPTION([CFLAGS], [$1],[$2],[$3],[$4],[$5])]) 63 AC_DEFUN([I3_ADD_CXXFLAGS],[I3_ADD_OPTION([CXXFLAGS],[$1],[$2],[$3],[$4],[$5])]) 64 AC_DEFUN([I3_ADD_LDFLAGS], [I3_ADD_OPTION([LDFLAGS], [$1],[$2],[$3],[$4],[$5])]) 65 AC_DEFUN([I3_ADD_LIBS], [I3_ADD_OPTION([LIBS], [$1],[$2],[$3],[$4],[$5])]) 8 AC_INIT([windcrest],[I3_VERSION_FOR_AC_INIT],[dyob@lunaport.net]) 66 9 67 10 CFLAGS_before_configure="$CFLAGS" … … 73 16 74 17 I3_HIGHLIGHTED_ECHO([$0: $PACKAGE_STRING]) 75 76 18 77 19 # … … 86 28 AC_USE_SYSTEM_EXTENSIONS 87 29 AC_CANONICAL_HOST 88 89 90 30 91 31 AC_PROG_CXXCPP # for some configurations of cygwin … … 159 99 #I3_ADD_CXXFLAGS([-Wno-unused]) # ... 160 100 fi 161 162 101 163 102 # --------------------------------------- -
lang/objective-cplusplus/i3/trunk/tmp/dwmedit/ApiHook.cc
r39073 r39080 4 4 #include <tlhelp32.h> 5 5 #include <stdio.h> 6 #include <delayimp.h> 6 7 7 8 namespace api_hook { 9 void replaceAddress(IMAGE_THUNK_DATA* importAddressTable, const void* pfnCurrent, const void* pfnNew) { 10 for (; importAddressTable->u1.Function; ++importAddressTable) { 11 void** ppfn = reinterpret_cast<void**>(&importAddressTable->u1.Function); 12 if (*ppfn != pfnCurrent) { 13 continue; 14 } 15 DWORD dwDummy = 0; 16 VirtualProtect(ppfn, sizeof(ppfn), PAGE_EXECUTE_READWRITE, &dwDummy); 17 // DLL code will be CoW 18 WriteProcessMemory(GetCurrentProcess(), ppfn, &pfnNew, sizeof(pfnNew), NULL); 19 puts(" +++++ REPLACE OK +++++"); 20 return; 21 } 22 } 23 24 25 void delay( 26 const char* pszModuleName, 27 const void* pfnCurrent, 28 const void* pfnNew, 29 HMODULE hmodCaller) { 30 31 ULONG ulSize = 0; 32 33 ImgDelayDescr* delayDescr = 34 reinterpret_cast<ImgDelayDescr*>( 35 dll.ImageDirectoryEntryToData( 36 hmodCaller, TRUE, IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT, &ulSize)); 37 38 if (!delayDescr) { 39 return; 40 } 41 42 printf(" delay import\n"); 43 char* const base = reinterpret_cast<char* const>(hmodCaller); 44 for (; delayDescr->grAttrs; ++delayDescr) { 45 char* const name = base + delayDescr->rvaDLLName; 46 printf(" name=%08p:%s\n", base, name); 47 if (lstrcmpiA(name, pszModuleName) == 0) { 48 break; 49 } 50 } 51 52 if (!delayDescr->grAttrs) { 53 return; 54 } 55 56 IMAGE_THUNK_DATA* importAddressTable = 57 reinterpret_cast<IMAGE_THUNK_DATA*>(base + delayDescr->rvaIAT); 58 59 replaceAddress(importAddressTable, pfnCurrent, pfnNew); 60 } 61 62 void normal( 63 const char* pszModuleName, 64 const void* pfnCurrent, 65 const void* pfnNew, 66 HMODULE hmodCaller) { 67 68 printf("DLL: %s\n", pszModuleName); 69 70 ULONG ulSize = 0; 71 72 IMAGE_IMPORT_DESCRIPTOR* pImportDesc = 73 reinterpret_cast<IMAGE_IMPORT_DESCRIPTOR*>( 74 dll.ImageDirectoryEntryToData( 75 hmodCaller, TRUE, IMAGE_DIRECTORY_ENTRY_IMPORT, &ulSize)); 76 77 if (!pImportDesc) { 78 return; 79 } 80 81 for (; pImportDesc->Characteristics; ++pImportDesc) { 82 char* base = reinterpret_cast<char*>(hmodCaller); 83 ptrdiff_t off = pImportDesc->Name; 84 char* pszModName = base + off; 85 printf(" base=0x%p, off=0x%x pszModName=%s\n", base, off, pszModName); 86 if (lstrcmpiA(pszModName, pszModuleName) == 0) { 87 break; 88 } 89 } 90 91 if (!pImportDesc->Characteristics) { 92 return; 93 } 94 95 IMAGE_THUNK_DATA* importAddressTable = 96 reinterpret_cast<IMAGE_THUNK_DATA*>( 97 reinterpret_cast<char*>(hmodCaller) + pImportDesc->FirstThunk); 98 99 replaceAddress(importAddressTable, pfnCurrent, pfnNew); 100 } 8 101 9 102 /** … … 18 111 HMODULE hmodCaller) 19 112 { 20 ULONG ulSize = 0; 21 22 23 IMAGE_IMPORT_DESCRIPTOR* pImportDesc = NULL; 24 int entries[] = {IMAGE_DIRECTORY_ENTRY_IMPORT, IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT}; 25 for (int i = 0; i < _countof(entries); ++i) { 26 27 pImportDesc = 28 reinterpret_cast<IMAGE_IMPORT_DESCRIPTOR*>( 29 dll.ImageDirectoryEntryToData( 30 hmodCaller, TRUE, IMAGE_DIRECTORY_ENTRY_IMPORT, &ulSize)); 31 32 if (!pImportDesc) { 33 continue; 34 } 35 36 for (; pImportDesc->Name; ++pImportDesc) { 37 char* base = reinterpret_cast<char*>(hmodCaller); 38 ptrdiff_t off = pImportDesc->Name; 39 char* pszModName = base + off; 40 printf(" base=0x%p, off=0x%x pszModName=%s\n", base, off, pszModName); 41 if (lstrcmpiA(pszModName, pszModuleName) == 0) { 42 break; 43 } 44 } 45 46 if (pImportDesc->Name) { 47 break; 48 } 49 } 50 51 if (!pImportDesc) { 52 puts(" failed 1"); 53 return; 54 } 55 56 if (!pImportDesc->Name) { 57 puts(" failed 2"); 58 return; 59 } 60 61 IMAGE_THUNK_DATA* pThunk = 62 reinterpret_cast<IMAGE_THUNK_DATA*>( 63 reinterpret_cast<char*>(hmodCaller) + pImportDesc->FirstThunk); 64 65 for (; pThunk->u1.Function; ++pThunk) { 66 void** ppfn = reinterpret_cast<void**>(&pThunk->u1.Function); 67 if (*ppfn != pfnCurrent) { 68 continue; 69 } 70 DWORD dwDummy = 0; 71 VirtualProtect(ppfn, sizeof(ppfn), PAGE_EXECUTE_READWRITE, &dwDummy); 72 // DLL code will be CoW 73 WriteProcessMemory(GetCurrentProcess(), ppfn, &pfnNew, sizeof(pfnNew), NULL); 74 puts("++++++++++++ REPLACE OK ++++++++++++++"); 75 return; 76 } 77 puts(" failed 3"); 113 normal(pszModuleName, pfnCurrent, pfnNew, hmodCaller); 114 delay(pszModuleName, pfnCurrent, pfnNew, hmodCaller); 78 115 } 79 116 -
lang/objective-cplusplus/i3/trunk/tmp/dwmedit/BlurEditController.cc
r39073 r39080 20 20 21 21 bool v() { 22 return true; 22 23 // DrawThemeBackground(0, 0, 0, 0, NULL, NULL); 23 24 OSVERSIONINFO osvi = {}; 24 25 osvi.dwOSVersionInfoSize = sizeof(osvi); 25 26 GetVersionEx(&osvi); 26 if (osvi.dwMajorVersion > 6 || (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion > 1)) { 27 if (osvi.dwMajorVersion > 6 || (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion > 1)) { // Windows 8 27 28 return true; 28 29 } … … 160 161 } 161 162 162 o.GetProcAddress = (decltype(&H::GetProcAddress))GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "GetProcAddress"); 163 if (!o.GetProcAddress) { 164 return; 165 } 166 167 o.DrawThemeBackground = (decltype(&H::DrawThemeBackground))GetProcAddress(GetModuleHandleW(L"uxtheme.dll"), "DrawThemeBackground"); 168 if (!o.DrawThemeBackground) { 169 return; 170 } 171 172 o.ExtTextOutW = (decltype(&H::ExtTextOutW))GetProcAddress(GetModuleHandleW(L"gdi32.dll"), "ExtTextOutW"); 173 if (!o.ExtTextOutW) { 174 return; 175 } 163 HMODULE kernel32Dll = GetModuleHandleW(L"kernel32.dll"); 164 if (kernel32Dll) { 165 o.GetProcAddress = (decltype(&H::GetProcAddress))GetProcAddress(kernel32Dll, "GetProcAddress"); 166 if (!o.GetProcAddress) { 167 return; 168 } 169 } 170 171 HMODULE uxthemeDll = GetModuleHandleW(L"uxtheme.dll"); 172 if (uxthemeDll) { 173 o.DrawThemeBackground = (decltype(&H::DrawThemeBackground))GetProcAddress(uxthemeDll, "DrawThemeBackground"); 174 if (!o.DrawThemeBackground) { 175 return; 176 } 177 } 178 179 HMODULE gdi32Dll = GetModuleHandleW(L"gdi32.dll"); 180 if (gdi32Dll) { 181 o.ExtTextOutW = (decltype(&H::ExtTextOutW))GetProcAddress(gdi32Dll, "ExtTextOutW"); 182 if (!o.ExtTextOutW) { 183 return; 184 } 185 } 176 186 177 187 if (!v()) { -
lang/objective-cplusplus/i3/trunk/tmp/dwmedit/DWMEdit.cc
r39070 r39080 38 38 if (message == WM_WINDOWPOSCHANGING) { 39 39 WINDOWPOS* window_pos = (WINDOWPOS*)lParam; 40 if (window_pos->flags | SWP_SHOWWINDOW && window_pos->flags | SWP_NOREDRAW) { 41 // First time ShowWindow() is special on Windows 7 (ignore SWP_NOREDRAW) 40 if (window_pos->flags & (SWP_SHOWWINDOW | SWP_NOREDRAW)) { 41 // First time ShowWindow() is special on Windows 7 42 // then we should ignore SWP_NOREDRAW 42 43 InvalidateRect(hWnd, NULL, FALSE); 43 44 WndProc(hWnd, WM_PAINT, 0, 0); … … 186 187 } 187 188 188 -
lang/objective-cplusplus/i3/trunk/tmp/dwmedit/DWMEdit.vcxproj
r39071 r39080 105 105 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> 106 106 <LinkIncremental>false</LinkIncremental> 107 <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> 107 108 </PropertyGroup> 108 109 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'"> … … 174 175 <IntrinsicFunctions>true</IntrinsicFunctions> 175 176 <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;DWMEDIT_TEST;%(PreprocessorDefinitions)</PreprocessorDefinitions> 177 <EnablePREfast>true</EnablePREfast> 176 178 </ClCompile> 177 179 <Link> -
lang/objective-cplusplus/i3/trunk/tmp/dwmedit/configure.ac
r39061 r39080 11 11 AC_DEFINE(MIL_CONFIG_H_INCLUDED, 1, [config.h include guard]) 12 12 13 CXXFLAGS="$CXXFLAGS -DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0601 -Wno-missing-field-initializers "13 CXXFLAGS="$CXXFLAGS -DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0601 -Wno-missing-field-initializers -static" 14 14 15 15 AC_CHECK_HEADERS([uxtheme.h dwmapi.h],[],[],[
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)