ここに、wow64 リダイレクトを無効にする実際のサンプルがあります。
BOOL CCopyUtils::CopyServiceFiles(CAtlString szSourceDir, CAtlString szTargetDir)
{
BOOL bResult = TRUE;
TCHAR szSource[MAX_PATH];
TCHAR szDest[MAX_PATH];
TCHAR szSourceFile[MAX_PATH];
TCHAR szDestFile[MAX_PATH];
HINSTANCE hDll;
PVOID OldValue;
Wow64DisableWow64FsRedirection pfWow64DisableWow64FsRedirection=NULL;
Wow64RevertWow64FsRedirection pfWow64RevertWow64FsRedirection=NULL;
hDll=LoadLibrary("Kernel32.dll");
ATLASSERT(hDll!=NULL);
pfWow64DisableWow64FsRedirection=(Wow64DisableWow64FsRedirection)GetProcAddress(
hDll, "Wow64DisableWow64FsRedirection");
// http://msdn.microsoft.com/en-us/library/aa365745(VS.85).aspx
pfWow64RevertWow64FsRedirection=(Wow64RevertWow64FsRedirection)GetProcAddress(
hDll, "Wow64RevertWow64FsRedirection");
if(pfWow64DisableWow64FsRedirection==NULL)
ATLTRACE(_T("Function 'Wow64DisableWow64FsRedirection' not loaded."));
else if((pfWow64DisableWow64FsRedirection)(&OldValue)==TRUE)
ATLTRACE(_T("Wow64 filesystem redirecton disabled."));
else
ATLTRACE(_T("Wow64 filesystem redirecton not disabled."));
if (_taccess(szTargetDir, 0) != 0)
_tmkdir(szTargetDir);
DeleteOldFiles(szTargetDir);
int i = 0;
_tcscpy(szSource, szSourceDir);
if (szSource[_tcslen (szSource) -1] != '\\')
_tcscat (szSource,"\\");
_tcscpy(szDest, szTargetDir);
if (szDest[_tcslen (szDest) -1] != '\\')
_tcscat (szDest,"\\");
while (m_ServiceFiles[i] != NULL)
{
_tcscpy(szSourceFile, szSource);
_tcscat(szSourceFile, m_ServiceFiles[i]);
_tcscpy(szDestFile, szDest);
_tcscat(szDestFile, m_ServiceFiles[i]);
if (!CopyFile(szSourceFile, szDestFile, FALSE))
{
bResult = FALSE;
ATLTRACE(_T("Error coping %s to %s\n"), szSourceFile, szDestFile);
ATLASSERT(FALSE);
break;
}
i++;
}
if(pfWow64RevertWow64FsRedirection==NULL)
ATLTRACE(_T("Function 'pfWow64RevertWow64FsRedirection' not loaded."));
else if((pfWow64RevertWow64FsRedirection)(OldValue)==TRUE)
ATLTRACE(_T("Wow64 filesystem redirecton restored."));
else
ATLTRACE(_T("Wow64 filesystem redirecton not restored."));
FreeLibrary(hDll);
return bResult;
}
よろしくお願いします