Re: How to modify program when running on x64 platform?
  Home FAQ Contact Sign in
microsoft.public.vc.mfc only
 
Advanced search
POPULAR GROUPS

more...

 Up
Re: How to modify program when running on x64 platform?         

Group: microsoft.public.vc.mfc · Group Profile
Author: bluestar
Date: Apr 28, 2008 19:17

Dear Sir:

I know that it is best way to use inf to install.
But this program already used by company for a long time,
so i need to modify it to work x64 platform.

I already found Wow64DisableWow64FsRedirection and
Wow64RevertWow64FsRedirection to use, it works successfully.

Thanks for your information.
It's good to me for my concept of programming.
> ****
> This is what happens if a 32-bit program tries to access c:\windows\system32. It is the
> specified behavior of Win64 when running 32-bit drivers. The program that does this will
> have to be compiled as a 64-bit program to work correctly.
> ****
>
>> My driver file is 64-bit driver(build from WDK 6000) and my
>>windows version
>> is WinXP x64 SP1. I logged in by using Account:Administrator.
>
> ****
> OK, and now the trick is to get it into the actual windows directory. Note that end users
> will rarely be logged on as administrators, so the fact that this works on your machine is
> probably not relevant to being a product.
> ****
>
>> I would try to copy my driver into c:\windows\system32\drivers
>>manually when
>> fail to copy into c:\windows\SysWOW64\drivers. And plug-in the
>>device, the
>> driver is loaded successfully.
>
> ****
> The general way to handle this is via a .INF file and do a correct install.
> ****
>
>> Why this api can't work at x64 platform?
>
> ****
> It is working correctly, as it is supposed to, when a 32-bit program is run in the 32-bit
> emulator of Win64.
> ****> Could you help me how to copy to correct folder?
>
>>//---------CopyFile-------------//
>>GetSystemDirectory(m_cWinSysDir,MAX_PATH);
>
> ****
> Is there some reason this needs to be a member variable as opposed to a local variable?
> ****>GetModuleFileName(NULL, szSource, MAX_PATH);
>
>> if(!m_bWin64) //Win32
>> _tcscat_s(szSource, MAX_PATH, _T("\\usbflt.sys"));
>> else//Win64
>> _tcscat_s(szSource, MAX_PATH, _T("\\usbflt64.sys"));
>> _tcscpy_s (szDest,MAX_PATH,m_cWinSysDir);
>> _tcscat_s(szDest, MAX_PATH, _T("\\drivers\\usbflt.sys"));
>
> ****
> If this is MFC, why are you using things like _tcscpy_s and _tcscat_s, when CString is so
> much easier to use? (At least you're using the safe versions, which is Good)
>
> Type in the string Wow64Disable to the MSDN Index and you will hit the API call you need.
> ****
>
>> if (!CopyFile(szSource, szDest, FALSE))
>> {
>> MessageBox(_T("Copy driver:usbflt.sys failed!"), _T("USB Fast"),
>>MB_ICONWARNING);
>> return false;
>> }
>
> ****
> I can't comment on the manifest because as far as I can tell there is no available
> documentation on them.
> joe
> ****
>
>>//----------.manifest------------//
>>
>> >>manifestVersion='1.0'>
>>
>>
>>
>> >> level="requireAdministrator"
>> uiAccess="false"/>
>>

>>

>>

>>
>
> Joseph M. Newcomer [MVP]
> email: newco...@flounder.com
> Web:http://www.flounder.com
> MVP Tips:http://www.flounder.com/mvp_tips.htm- 隱藏被引用文字 -
>
> - 顯示被引用文字 -
no comments
diggit! del.icio.us! reddit!