Browse Subversion Repository
Annotation of /trunk/teraterm/teraterm/teraterml.h
Parent Directory
| Revision Log
| 1 |
maya |
3227 |
#include "stdafx.h" |
| 2 |
|
|
|
| 3 |
maya |
4497 |
|
| 4 |
|
|
// Visual Studio が MS11-025 適用済みで MFC がスタティックリンクの場合 |
| 5 |
|
|
// http://club.pep.ne.jp/~hiroki.o/visualcpp/ms11-025_problem.htm |
| 6 |
|
|
// http://tedwvc.wordpress.com/2011/04/16/fixing-problems-with-findactctxsectionstring-in-mfc-security-updates/ |
| 7 |
|
|
|
| 8 |
|
|
#undef FindActCtxSectionString |
| 9 |
|
|
#define FindActCtxSectionString MyFindActCtxSectionString |
| 10 |
|
|
|
| 11 |
|
|
#ifdef _UNICODE |
| 12 |
|
|
#define _FINDACTCTXSECTIONSTRING "FindActCtxSectionStringW" |
| 13 |
|
|
#else |
| 14 |
|
|
#define _FINDACTCTXSECTIONSTRING "FindActCtxSectionStringA" |
| 15 |
|
|
#endif |
| 16 |
|
|
|
| 17 |
|
|
typedef BOOL (WINAPI * PFN_FINDAC)(DWORD dwFlags, const GUID *lpExtensionGuid,ULONG ulSectionId,LPCTSTR lpStringToFind,PACTCTX_SECTION_KEYED_DATA ReturnedData); |
| 18 |
|
|
|
| 19 |
|
|
BOOL WINAPI MyFindActCtxSectionString( |
| 20 |
|
|
DWORD dwFlags, |
| 21 |
|
|
const GUID *lpExtensionGuid, |
| 22 |
|
|
ULONG ulSectionId, |
| 23 |
|
|
LPCTSTR lpStringToFind, |
| 24 |
|
|
PACTCTX_SECTION_KEYED_DATA ReturnedData) |
| 25 |
|
|
{ |
| 26 |
|
|
// Bug #1 - Windows 2000 |
| 27 |
|
|
PFN_FINDAC pfnFindActCtxSectionString =NULL; |
| 28 |
|
|
{ |
| 29 |
|
|
HINSTANCE hKernel32 = GetModuleHandle(_T("kernel32.dll")); |
| 30 |
|
|
if (hKernel32 == NULL) |
| 31 |
|
|
{ |
| 32 |
|
|
return FALSE; |
| 33 |
|
|
} |
| 34 |
|
|
|
| 35 |
|
|
pfnFindActCtxSectionString = (PFN_FINDAC) GetProcAddress(hKernel32, _FINDACTCTXSECTIONSTRING); |
| 36 |
|
|
|
| 37 |
|
|
if (pfnFindActCtxSectionString == NULL) |
| 38 |
|
|
{ |
| 39 |
|
|
/* pre-fusion OS, so no more checking.*/ |
| 40 |
|
|
return FALSE; |
| 41 |
|
|
} |
| 42 |
|
|
} |
| 43 |
|
|
|
| 44 |
|
|
ReturnedData->cbSize = sizeof(ACTCTX_SECTION_KEYED_DATA); // Bug #2 - missing cbSize initializer |
| 45 |
|
|
return pfnFindActCtxSectionString(/* dwFlags */ 0, // Bug #3 memory leak - pass in zero as return handle not freed |
| 46 |
|
|
lpExtensionGuid, ulSectionId, lpStringToFind, ReturnedData); |
| 47 |
|
|
} |
| |